aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/thedevstack/conversationsplus/ui
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/de/thedevstack/conversationsplus/ui')
-rw-r--r--src/main/java/de/thedevstack/conversationsplus/ui/ConferenceDetailsActivity.java24
-rw-r--r--src/main/java/de/thedevstack/conversationsplus/ui/ConversationActivity.java93
-rw-r--r--src/main/java/de/thedevstack/conversationsplus/ui/ConversationFragment.java4
-rw-r--r--src/main/java/de/thedevstack/conversationsplus/ui/EditAccountActivity.java10
-rw-r--r--src/main/java/de/thedevstack/conversationsplus/ui/LogCatOutputActivity.java40
-rw-r--r--src/main/java/de/thedevstack/conversationsplus/ui/ShareWithActivity.java32
-rw-r--r--src/main/java/de/thedevstack/conversationsplus/ui/StartConversationActivity.java4
-rw-r--r--src/main/java/de/thedevstack/conversationsplus/ui/XmppActivity.java22
-rw-r--r--src/main/java/de/thedevstack/conversationsplus/ui/adapter/ConversationAdapter.java3
-rw-r--r--src/main/java/de/thedevstack/conversationsplus/ui/listeners/LogCatOutputCopyOnClickListener.java41
10 files changed, 181 insertions, 92 deletions
diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/ConferenceDetailsActivity.java b/src/main/java/de/thedevstack/conversationsplus/ui/ConferenceDetailsActivity.java
index 12ff2a52..2a3cd7fe 100644
--- a/src/main/java/de/thedevstack/conversationsplus/ui/ConferenceDetailsActivity.java
+++ b/src/main/java/de/thedevstack/conversationsplus/ui/ConferenceDetailsActivity.java
@@ -3,8 +3,10 @@ package de.thedevstack.conversationsplus.ui;
import android.annotation.TargetApi;
import android.app.AlertDialog;
import android.app.PendingIntent;
+import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.DialogInterface;
+import android.content.Intent;
import android.content.IntentSender.SendIntentException;
import android.os.Build;
import android.os.Bundle;
@@ -30,6 +32,7 @@ import java.util.Comparator;
import java.util.concurrent.atomic.AtomicInteger;
import de.thedevstack.conversationsplus.Config;
+import de.thedevstack.conversationsplus.ConversationsPlusPreferences;
import de.thedevstack.conversationsplus.R;
import de.thedevstack.conversationsplus.crypto.PgpEngine;
import de.thedevstack.conversationsplus.entities.Account;
@@ -262,7 +265,7 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
});
}
});
- this.mAdvancedMode = getPreferences().getBoolean("advanced_muc_mode", false);
+ this.mAdvancedMode = ConversationsPlusPreferences.advancedMucMode();
this.mConferenceInfoTable = (TableLayout) findViewById(R.id.muc_info_more);
mConferenceInfoTable.setVisibility(this.mAdvancedMode ? View.VISIBLE : View.GONE);
this.mConferenceInfoMam = (TextView) findViewById(R.id.muc_info_mam);
@@ -282,6 +285,9 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
quickEdit(mConversation.getName(),this.onSubjectEdited);
}
break;
+ case R.id.action_share:
+ share();
+ break;
case R.id.action_save_as_bookmark:
saveAsBookmark();
break;
@@ -291,7 +297,7 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
case R.id.action_advanced_mode:
this.mAdvancedMode = !menuItem.isChecked();
menuItem.setChecked(this.mAdvancedMode);
- getPreferences().edit().putBoolean("advanced_muc_mode", mAdvancedMode).commit();
+ ConversationsPlusPreferences.commitAdvancedMucMode(mAdvancedMode);
mConferenceInfoTable.setVisibility(this.mAdvancedMode ? View.VISIBLE : View.GONE);
invalidateOptionsMenu();
updateView();
@@ -309,6 +315,18 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
}
}
+ private void share() {
+ Intent shareIntent = new Intent();
+ shareIntent.setAction(Intent.ACTION_SEND);
+ shareIntent.putExtra(Intent.EXTRA_TEXT, getShareableUri());
+ shareIntent.setType("text/plain");
+ try {
+ startActivity(Intent.createChooser(shareIntent, getText(R.string.share_uri_with)));
+ } catch (ActivityNotFoundException e) {
+ Toast.makeText(this, R.string.no_application_to_share_uri, Toast.LENGTH_SHORT).show();
+ }
+ }
+
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
MenuItem menuItemSaveBookmark = menu.findItem(R.id.action_save_as_bookmark);
@@ -468,7 +486,7 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
bookmark.setNick(mConversation.getJid().getResourcepart());
}
bookmark.setBookmarkName(mConversation.getMucOptions().getSubject());
- bookmark.setAutojoin(getPreferences().getBoolean("autojoin",true));
+ bookmark.setAutojoin(ConversationsPlusPreferences.autojoin());
account.getBookmarks().add(bookmark);
xmppConnectionService.pushBookmarks(account);
mConversation.setBookmark(bookmark);
diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/ConversationActivity.java b/src/main/java/de/thedevstack/conversationsplus/ui/ConversationActivity.java
index dbaa5a7c..e46095e7 100644
--- a/src/main/java/de/thedevstack/conversationsplus/ui/ConversationActivity.java
+++ b/src/main/java/de/thedevstack/conversationsplus/ui/ConversationActivity.java
@@ -113,6 +113,7 @@ public class ConversationActivity extends XmppActivity
private Message mPendingDownloadableMessage = null;
private boolean conversationWasSelectedByKeyboard = false;
+ protected boolean mUsingEnterKey = false;
private View mContentView;
private View avatarLogoView;
@@ -190,6 +191,7 @@ public class ConversationActivity extends XmppActivity
mPendingImageUris.add(Uri.parse(pending));
}
}
+ this.mUsingEnterKey = ConversationsPlusPreferences.displayEnterKey();
setContentView(R.layout.fragment_conversations_overview);
@@ -337,12 +339,12 @@ public class ConversationActivity extends XmppActivity
public void switchToConversation(Conversation conversation) {
setSelectedConversation(conversation);
runOnUiThread(new Runnable() {
- @Override
- public void run() {
- ConversationActivity.this.mConversationFragment.reInit(getSelectedConversation());
- openConversation();
- }
- });
+ @Override
+ public void run() {
+ ConversationActivity.this.mConversationFragment.reInit(getSelectedConversation());
+ openConversation();
+ }
+ });
}
private void updateActionBarTitle() {
@@ -776,19 +778,19 @@ public class ConversationActivity extends XmppActivity
builder.setView(dialogView);
builder.setNegativeButton(getString(R.string.cancel), null);
builder.setPositiveButton(getString(R.string.delete_messages),
- new OnClickListener() {
-
- @Override
- public void onClick(DialogInterface dialog, int which) {
- ConversationActivity.this.xmppConnectionService.clearConversationHistory(conversation);
- if (endConversationCheckBox.isChecked()) {
- endConversation(conversation);
- } else {
- updateConversationList();
- ConversationActivity.this.mConversationFragment.updateMessages();
- }
- }
- });
+ new OnClickListener() {
+
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ ConversationActivity.this.xmppConnectionService.clearConversationHistory(conversation);
+ if (endConversationCheckBox.isChecked()) {
+ endConversation(conversation);
+ } else {
+ updateConversationList();
+ ConversationActivity.this.mConversationFragment.updateMessages();
+ }
+ }
+ });
builder.create().show();
}
@@ -959,24 +961,24 @@ public class ConversationActivity extends XmppActivity
builder.setTitle(R.string.disable_notifications);
final int[] durations = getResources().getIntArray(R.array.mute_options_durations);
builder.setItems(R.array.mute_options_descriptions,
- new OnClickListener() {
-
- @Override
- public void onClick(final DialogInterface dialog, final int which) {
- final long till;
- if (durations[which] == -1) {
- till = Long.MAX_VALUE;
- } else {
- till = System.currentTimeMillis() + (durations[which] * 1000);
- }
- conversation.setMutedTill(till);
- ConversationActivity.this.xmppConnectionService.databaseBackend
- .updateConversation(conversation);
- updateConversationList();
- ConversationActivity.this.mConversationFragment.updateMessages();
- invalidateOptionsMenu();
- }
- });
+ new OnClickListener() {
+
+ @Override
+ public void onClick(final DialogInterface dialog, final int which) {
+ final long till;
+ if (durations[which] == -1) {
+ till = Long.MAX_VALUE;
+ } else {
+ till = System.currentTimeMillis() + (durations[which] * 1000);
+ }
+ conversation.setMutedTill(till);
+ ConversationActivity.this.xmppConnectionService.databaseBackend
+ .updateConversation(conversation);
+ updateConversationList();
+ ConversationActivity.this.mConversationFragment.updateMessages();
+ invalidateOptionsMenu();
+ }
+ });
builder.create().show();
}
@@ -1372,10 +1374,6 @@ public class ConversationActivity extends XmppActivity
} else if (requestCode == ATTACHMENT_CHOICE_CHOOSE_FILE || requestCode == ATTACHMENT_CHOICE_RECORD_VOICE) {
final List<Uri> uris = extractUriFromIntent(data);
final Conversation c = getSelectedConversation();
- final long max = c.getAccount()
- .getXmppConnection()
- .getFeatures()
- .getMaxHttpUploadSize();
final OnPresenceSelected callback = new OnPresenceSelected() {
@Override
public void onPresenceSelected() {
@@ -1389,7 +1387,7 @@ public class ConversationActivity extends XmppActivity
}
};
if (c.getMode() == Conversation.MODE_MULTI
- || FileUtils.allFilesUnderSize(this, uris, max)
+ || FileUtils.allFilesUnderSize(this, uris, getMaxHttpUploadSize(c))
|| c.getNextEncryption() == Message.ENCRYPTION_OTR) {
callback.onPresenceSelected();
} else {
@@ -1433,19 +1431,20 @@ public class ConversationActivity extends XmppActivity
mConversationFragment.onActivityResult(requestCode, resultCode, data);
}
if (requestCode == REQUEST_BATTERY_OP) {
- setNeverAskForBatteryOptimizationsAgain();
+ // Never Ask For Battery Optimizations Again
+ ConversationsPlusPreferences.commitShowBatteryOptimization(false);
}
}
}
- private void setNeverAskForBatteryOptimizationsAgain() {
- getPreferences().edit().putBoolean("show_battery_optimization", false).commit();
+ private long getMaxHttpUploadSize(Conversation conversation) {
+ return conversation.getAccount().getXmppConnection().getFeatures().getMaxHttpUploadSize();
}
private void openBatteryOptimizationDialogIfNeeded() {
if (hasAccountWithoutPush()
&& isOptimizingBattery()
- && getPreferences().getBoolean("show_battery_optimization", true)) {
+ && ConversationsPlusPreferences.showBatteryOptimization()) {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(R.string.battery_optimizations_enabled);
builder.setMessage(R.string.battery_optimizations_enabled_dialog);
@@ -1462,7 +1461,7 @@ public class ConversationActivity extends XmppActivity
builder.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
- setNeverAskForBatteryOptimizationsAgain();
+ ConversationsPlusPreferences.commitShowBatteryOptimization(false);
}
});
}
diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/ConversationFragment.java b/src/main/java/de/thedevstack/conversationsplus/ui/ConversationFragment.java
index 7c5f6ffa..4ae88a5e 100644
--- a/src/main/java/de/thedevstack/conversationsplus/ui/ConversationFragment.java
+++ b/src/main/java/de/thedevstack/conversationsplus/ui/ConversationFragment.java
@@ -313,10 +313,10 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
public void setupIme() {
if (activity == null) {
return;
- } else if (activity.usingEnterKey() && ConversationsPlusPreferences.enterIsSend()) {
+ } else if (ConversationsPlusPreferences.displayEnterKey() && ConversationsPlusPreferences.enterIsSend()) {
mEditMessage.setInputType(mEditMessage.getInputType() & (~InputType.TYPE_TEXT_FLAG_MULTI_LINE));
mEditMessage.setInputType(mEditMessage.getInputType() & (~InputType.TYPE_TEXT_VARIATION_SHORT_MESSAGE));
- } else if (activity.usingEnterKey()) {
+ } else if (ConversationsPlusPreferences.displayEnterKey()) {
mEditMessage.setInputType(mEditMessage.getInputType() | InputType.TYPE_TEXT_FLAG_MULTI_LINE);
mEditMessage.setInputType(mEditMessage.getInputType() & (~InputType.TYPE_TEXT_VARIATION_SHORT_MESSAGE));
} else {
diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/EditAccountActivity.java b/src/main/java/de/thedevstack/conversationsplus/ui/EditAccountActivity.java
index 2b8e619f..1a868949 100644
--- a/src/main/java/de/thedevstack/conversationsplus/ui/EditAccountActivity.java
+++ b/src/main/java/de/thedevstack/conversationsplus/ui/EditAccountActivity.java
@@ -39,6 +39,7 @@ import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
import de.thedevstack.conversationsplus.ConversationsPlusColors;
+import de.thedevstack.conversationsplus.ConversationsPlusPreferences;
import de.thedevstack.conversationsplus.ui.listeners.ShowResourcesListDialogListener;
import de.thedevstack.conversationsplus.Config;
import de.thedevstack.conversationsplus.R;
@@ -246,12 +247,11 @@ public class EditAccountActivity extends XmppActivity implements OnAccountUpdate
mFetchingAvatar = true;
AvatarService.getInstance().checkForAvatar(mAccount, mAvatarFetchCallback);
}
- } else {
- updateSaveButton();
}
if (mAccount != null) {
updateAccountInformation(false);
}
+ updateSaveButton();
}
@Override
@@ -522,8 +522,7 @@ public class EditAccountActivity extends XmppActivity implements OnAccountUpdate
}
}
}
- SharedPreferences preferences = getPreferences();
- this.mShowOptions = preferences.getBoolean("show_connection_options", false);
+ this.mShowOptions = ConversationsPlusPreferences.showConnectionOptions();
this.mNamePort.setVisibility(mShowOptions ? View.VISIBLE : View.GONE);
}
@@ -531,6 +530,7 @@ public class EditAccountActivity extends XmppActivity implements OnAccountUpdate
protected void onBackendConnected() {
if (this.jidToEdit != null) {
this.mAccount = xmppConnectionService.findAccountByJid(jidToEdit);
+ this.mInitMode |= this.mAccount.isOptionSet(Account.OPTION_REGISTER);
if (this.mAccount != null) {
if (this.mAccount.getPrivateKeyAlias() != null) {
this.mPassword.setHint(R.string.authenticate_with_certificate);
@@ -625,6 +625,8 @@ public class EditAccountActivity extends XmppActivity implements OnAccountUpdate
if (!mInitMode) {
this.mAvatar.setVisibility(View.VISIBLE);
this.mAvatar.setImageBitmap(AvatarService.getInstance().get(this.mAccount, getPixel(72)));
+ } else {
+ this.mAvatar.setVisibility(View.GONE);
}
if (this.mAccount.isOptionSet(Account.OPTION_REGISTER)) {
this.mRegisterNew.setVisibility(View.VISIBLE);
diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/LogCatOutputActivity.java b/src/main/java/de/thedevstack/conversationsplus/ui/LogCatOutputActivity.java
index d15b59c6..fe7968cb 100644
--- a/src/main/java/de/thedevstack/conversationsplus/ui/LogCatOutputActivity.java
+++ b/src/main/java/de/thedevstack/conversationsplus/ui/LogCatOutputActivity.java
@@ -2,27 +2,55 @@ package de.thedevstack.conversationsplus.ui;
import android.app.Activity;
import android.os.Bundle;
+import android.view.ContextMenu;
+import android.view.MenuItem;
+import android.view.View;
+import android.widget.AdapterView;
import android.widget.Button;
import android.widget.ListView;
import de.thedevstack.android.logcat.adapters.LogCatArrayAdapter;
import de.thedevstack.android.logcat.tasks.ReadLogCatAsyncTask;
-import de.thedevstack.android.logcat.ui.LogCatOutputCopyOnClickListener;
import de.thedevstack.conversationsplus.R;
+import de.thedevstack.conversationsplus.ui.listeners.LogCatOutputCopyOnClickListener;
+import de.thedevstack.conversationsplus.utils.ClipboardUtil;
/**
- * Created by tzur on 07.10.2015.
+ * Activity to display the logcat output.
*/
public class LogCatOutputActivity extends Activity {
+ /**
+ * List adapter containing the logcat entries.
+ */
+ private LogCatArrayAdapter logCatArrayAdapter;
+
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_logcatoutput);
ListView lv = (ListView)findViewById(R.id.actLogInfoOutput);
- LogCatArrayAdapter logCatOutputAdapter = new LogCatArrayAdapter(this, R.layout.list_item_logcatoutput);
- lv.setAdapter(logCatOutputAdapter);
- new ReadLogCatAsyncTask(logCatOutputAdapter).execute();
+ this.logCatArrayAdapter = new LogCatArrayAdapter(this, R.layout.list_item_logcatoutput);
+ lv.setAdapter(this.logCatArrayAdapter);
+ new ReadLogCatAsyncTask(this.logCatArrayAdapter).execute();
Button copyButton = (Button) findViewById(R.id.actLogOutputCopyButton);
- copyButton.setOnClickListener(new LogCatOutputCopyOnClickListener(this, logCatOutputAdapter, R.string.cplus_copied_to_clipboard, R.string.cplus_not_copied_to_clipboard_empty));
+ copyButton.setOnClickListener(new LogCatOutputCopyOnClickListener(this.logCatArrayAdapter));
+ registerForContextMenu(lv);
+ }
+
+ @Override
+ public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
+ super.onCreateContextMenu(menu, v, menuInfo);
+ menu.add(0, 123456789, 0, R.string.cplus_copy_item);
+ }
+
+ @Override
+ public boolean onContextItemSelected(MenuItem item) {
+ if (123456789 == item.getItemId()) {
+ AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo();
+ String itemText = this.logCatArrayAdapter.getItems().get(info.position);
+ ClipboardUtil.copyToClipboard(itemText);
+ return true;
+ }
+ return super.onContextItemSelected(item);
}
}
diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/ShareWithActivity.java b/src/main/java/de/thedevstack/conversationsplus/ui/ShareWithActivity.java
index 51fe92bb..fe3ed73f 100644
--- a/src/main/java/de/thedevstack/conversationsplus/ui/ShareWithActivity.java
+++ b/src/main/java/de/thedevstack/conversationsplus/ui/ShareWithActivity.java
@@ -37,6 +37,8 @@ import de.thedevstack.conversationsplus.xmpp.jid.Jid;
public class ShareWithActivity extends XmppActivity implements XmppConnectionService.OnConversationUpdate {
+ private boolean mReturnToPrevious = false;
+
@Override
public void onConversationUpdate() {
refreshUi();
@@ -85,7 +87,7 @@ public class ShareWithActivity extends XmppActivity implements XmppConnectionSer
resId = R.string.shared_file_with_x;
}
replaceToast(getString(resId, message.getConversation().getName()));
- if (share.uuid != null) {
+ if (mReturnToPrevious) {
finish();
} else {
switchToConversation(message.getConversation());
@@ -186,6 +188,7 @@ public class ShareWithActivity extends XmppActivity implements XmppConnectionSer
if (intent == null) {
return;
}
+ this.mReturnToPrevious = ConversationsPlusPreferences.returnToPrevious();
final String type = intent.getType();
final String action = intent.getAction();
Log.d(Config.LOGTAG, "action: "+action+ ", type:"+type);
@@ -306,8 +309,7 @@ public class ShareWithActivity extends XmppActivity implements XmppConnectionSer
};
}
if (account.httpUploadAvailable()
- && ((share.image && !neverCompressPictures())
- || conversation.getMode() == Conversation.MODE_MULTI
+ && (conversation.getMode() == Conversation.MODE_MULTI
|| FileUtils.allFilesUnderSize(this, share.uris, max))
&& conversation.getNextEncryption() != Message.ENCRYPTION_OTR) {
callback.onPresenceSelected();
@@ -315,8 +317,28 @@ public class ShareWithActivity extends XmppActivity implements XmppConnectionSer
selectPresence(conversation, callback);
}
} else {
- switchToConversation(conversation, this.share.text, true);
- finish();
+ if (mReturnToPrevious && this.share.text != null && !this.share.text.isEmpty() ) {
+ final OnPresenceSelected callback = new OnPresenceSelected() {
+ @Override
+ public void onPresenceSelected() {
+ Message message = new Message(conversation,share.text, conversation.getNextEncryption());
+ if (conversation.getNextEncryption() == Message.ENCRYPTION_OTR) {
+ message.setCounterpart(conversation.getNextCounterpart());
+ }
+ xmppConnectionService.sendMessage(message);
+ replaceToast(getString(R.string.shared_text_with_x, conversation.getName()));
+ finish();
+ }
+ };
+ if (conversation.getNextEncryption() == Message.ENCRYPTION_OTR) {
+ selectPresence(conversation, callback);
+ } else {
+ callback.onPresenceSelected();
+ }
+ } else {
+ switchToConversation(conversation, this.share.text, true);
+ finish();
+ }
}
}
diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/StartConversationActivity.java b/src/main/java/de/thedevstack/conversationsplus/ui/StartConversationActivity.java
index bd3dd684..2dc8d1a5 100644
--- a/src/main/java/de/thedevstack/conversationsplus/ui/StartConversationActivity.java
+++ b/src/main/java/de/thedevstack/conversationsplus/ui/StartConversationActivity.java
@@ -288,7 +288,7 @@ public class StartConversationActivity extends XmppActivity implements OnRosterU
if (!conversation.getMucOptions().online()) {
xmppConnectionService.joinMuc(conversation);
}
- if (!bookmark.autojoin() && getPreferences().getBoolean("autojoin", true)) {
+ if (!bookmark.autojoin() && ConversationsPlusPreferences.autojoin()) {
bookmark.setAutojoin(true);
xmppConnectionService.pushBookmarks(bookmark.getAccount());
}
@@ -438,7 +438,7 @@ public class StartConversationActivity extends XmppActivity implements OnRosterU
jid.setError(getString(R.string.bookmark_already_exists));
} else {
final Bookmark bookmark = new Bookmark(account, conferenceJid.toBareJid());
- bookmark.setAutojoin(getPreferences().getBoolean("autojoin", true));
+ bookmark.setAutojoin(ConversationsPlusPreferences.autojoin());
String nick = conferenceJid.getResourcepart();
if (nick != null && !nick.isEmpty()) {
bookmark.setNick(nick);
diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/XmppActivity.java b/src/main/java/de/thedevstack/conversationsplus/ui/XmppActivity.java
index f2ee20a0..726facac 100644
--- a/src/main/java/de/thedevstack/conversationsplus/ui/XmppActivity.java
+++ b/src/main/java/de/thedevstack/conversationsplus/ui/XmppActivity.java
@@ -104,11 +104,8 @@ public abstract class XmppActivity extends Activity {
public boolean xmppConnectionServiceBound = false;
protected boolean registeredListeners = false;
- protected boolean mUseSubject = true;
-
private DisplayMetrics metrics;
protected int mTheme;
- protected boolean mUsingEnterKey = false;
private long mLastUiRefresh = 0;
private Handler mRefreshUiHandler = new Handler();
@@ -353,8 +350,6 @@ public abstract class XmppActivity extends Activity {
ExceptionHelper.init(getApplicationContext());
this.mTheme = findTheme();
setTheme(this.mTheme);
- this.mUsingEnterKey = ConversationsPlusPreferences.displayEnterKey();
- mUseSubject = getPreferences().getBoolean("use_subject", true);
final ActionBar ab = getActionBar();
if (ab!=null) {
ab.setDisplayHomeAsUpEnabled(true);
@@ -383,19 +378,6 @@ public abstract class XmppActivity extends Activity {
}
}
- protected boolean usingEnterKey() {
- return getPreferences().getBoolean("display_enter_key", false);
- }
-
- protected SharedPreferences getPreferences() {
- return PreferenceManager
- .getDefaultSharedPreferences(getApplicationContext());
- }
-
- public boolean useSubjectToIdentifyConference() {
- return mUseSubject;
- }
-
public void switchToConversation(Conversation conversation) {
switchToConversation(conversation, null, false);
}
@@ -957,10 +939,6 @@ public abstract class XmppActivity extends Activity {
}
}
- protected boolean neverCompressPictures() {
- return getPreferences().getString("picture_compression", "auto").equals("never");
- }
-
protected void unregisterNdefPushMessageCallback() {
NfcAdapter nfcAdapter = NfcAdapter.getDefaultAdapter(this);
if (nfcAdapter != null && nfcAdapter.isEnabled()) {
diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/adapter/ConversationAdapter.java b/src/main/java/de/thedevstack/conversationsplus/ui/adapter/ConversationAdapter.java
index 2b2d9298..e28774f2 100644
--- a/src/main/java/de/thedevstack/conversationsplus/ui/adapter/ConversationAdapter.java
+++ b/src/main/java/de/thedevstack/conversationsplus/ui/adapter/ConversationAdapter.java
@@ -21,6 +21,7 @@ import java.util.List;
import java.util.concurrent.RejectedExecutionException;
import de.thedevstack.conversationsplus.ConversationsPlusColors;
+import de.thedevstack.conversationsplus.ConversationsPlusPreferences;
import de.thedevstack.conversationsplus.ui.listeners.ShowResourcesListDialogListener;
import de.tzur.conversations.Settings;
import de.thedevstack.conversationsplus.R;
@@ -58,7 +59,7 @@ public class ConversationAdapter extends ArrayAdapter<Conversation> {
view.findViewById(R.id.conversationListRowFrame).setBackgroundColor(c);
}
TextView convName = (TextView) view.findViewById(R.id.conversation_name);
- if (conversation.getMode() == Conversation.MODE_SINGLE || activity.useSubjectToIdentifyConference()) {
+ if (conversation.getMode() == Conversation.MODE_SINGLE || ConversationsPlusPreferences.useSubject()) {
convName.setText(conversation.getName());
} else {
convName.setText(conversation.getJid().toBareJid().toString());
diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/listeners/LogCatOutputCopyOnClickListener.java b/src/main/java/de/thedevstack/conversationsplus/ui/listeners/LogCatOutputCopyOnClickListener.java
new file mode 100644
index 00000000..f71c67db
--- /dev/null
+++ b/src/main/java/de/thedevstack/conversationsplus/ui/listeners/LogCatOutputCopyOnClickListener.java
@@ -0,0 +1,41 @@
+package de.thedevstack.conversationsplus.ui.listeners;
+
+import android.view.View;
+
+import java.util.List;
+
+import de.thedevstack.android.logcat.Logging;
+import de.thedevstack.android.logcat.adapters.LogCatArrayAdapter;
+import de.thedevstack.conversationsplus.utils.ClipboardUtil;
+
+/**
+ * OnClickListener to copy logcat entries from LogCatArrayAdapter to clipboard.
+ */
+public class LogCatOutputCopyOnClickListener implements View.OnClickListener {
+ private final LogCatArrayAdapter logCatOutputAdapter;
+
+ public LogCatOutputCopyOnClickListener(LogCatArrayAdapter logCatOutputAdapter) {
+ this.logCatOutputAdapter = logCatOutputAdapter;
+ }
+
+ /**
+ * Copies the entries of LogCatArrayAdapter separated by a new line to the clipboard.
+ *
+ * @param v The view that was clicked.
+ */
+ @Override
+ public void onClick(View v) {
+ Logging.d("copylogcat", "Start Copying log cat");
+ List<String> items = this.logCatOutputAdapter.getItems();
+ String textToCopy = null;
+ if (null != items && !items.isEmpty()) {
+ StringBuilder sb = new StringBuilder();
+ for (String item : items) {
+ sb.append(item);
+ sb.append("\n");
+ }
+ textToCopy = sb.toString();
+ }
+ ClipboardUtil.copyToClipboard("c+logcat", textToCopy);
+ }
+}