diff --git a/src/main/java/eu/siacs/conversations/ui/AboutActivity.java b/src/main/java/eu/siacs/conversations/ui/AboutActivity.java index 5d51e8b96..7efca7bc2 100644 --- a/src/main/java/eu/siacs/conversations/ui/AboutActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/AboutActivity.java @@ -1,7 +1,6 @@ package eu.siacs.conversations.ui; import android.app.Activity; -import android.content.res.Resources; import android.os.Bundle; import android.preference.PreferenceManager; diff --git a/src/main/java/eu/siacs/conversations/ui/BlocklistActivity.java b/src/main/java/eu/siacs/conversations/ui/BlocklistActivity.java index 64430aa26..784931c14 100644 --- a/src/main/java/eu/siacs/conversations/ui/BlocklistActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/BlocklistActivity.java @@ -19,7 +19,7 @@ import eu.siacs.conversations.xmpp.OnUpdateBlocklist; import eu.siacs.conversations.xmpp.jid.Jid; public class BlocklistActivity extends AbstractSearchableListItemActivity implements OnUpdateBlocklist { - private List mKnownHosts = new ArrayList(); + private List mKnownHosts = new ArrayList<>(); private Account account = null; diff --git a/src/main/java/eu/siacs/conversations/ui/ChangePasswordActivity.java b/src/main/java/eu/siacs/conversations/ui/ChangePasswordActivity.java index 3fb756308..acc25bf4a 100644 --- a/src/main/java/eu/siacs/conversations/ui/ChangePasswordActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ChangePasswordActivity.java @@ -11,8 +11,6 @@ import android.widget.Toast; import eu.siacs.conversations.R; import eu.siacs.conversations.entities.Account; import eu.siacs.conversations.services.XmppConnectionService; -import eu.siacs.conversations.xmpp.jid.InvalidJidException; -import eu.siacs.conversations.xmpp.jid.Jid; public class ChangePasswordActivity extends XmppActivity implements XmppConnectionService.OnAccountPasswordChanged { diff --git a/src/main/java/eu/siacs/conversations/ui/ChooseContactActivity.java b/src/main/java/eu/siacs/conversations/ui/ChooseContactActivity.java index 5156fcca4..199936e14 100644 --- a/src/main/java/eu/siacs/conversations/ui/ChooseContactActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ChooseContactActivity.java @@ -29,7 +29,7 @@ import eu.siacs.conversations.entities.ListItem; import eu.siacs.conversations.xmpp.jid.Jid; public class ChooseContactActivity extends AbstractSearchableListItemActivity { - private List mActivatedAccounts = new ArrayList(); + private List mActivatedAccounts = new ArrayList<>(); private List mKnownHosts; private Set selected; @@ -61,7 +61,7 @@ public class ChooseContactActivity extends AbstractSearchableListItemActivity { InputMethodManager.HIDE_IMPLICIT_ONLY); MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.select_multiple, menu); - selected = new HashSet(); + selected = new HashSet<>(); return true; } diff --git a/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java b/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java index 606f5cc0d..378e61c6e 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java @@ -55,8 +55,6 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers }; private TextView mYourNick; private ImageView mYourPhoto; - private ImageButton mEditNickButton; - private TextView mRoleAffiliaton; private TextView mFullJid; private TextView mAccountJid; private LinearLayout membersView; @@ -232,7 +230,7 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers setContentView(R.layout.activity_muc_details); mYourNick = (TextView) findViewById(R.id.muc_your_nick); mYourPhoto = (ImageView) findViewById(R.id.your_photo); - mEditNickButton = (ImageButton) findViewById(R.id.edit_nick_button); + ImageButton mEditNickButton = (ImageButton) findViewById(R.id.edit_nick_button); mFullJid = (TextView) findViewById(R.id.muc_jabberid); membersView = (LinearLayout) findViewById(R.id.muc_members); mAccountJid = (TextView) findViewById(R.id.details_account); @@ -305,7 +303,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(); + getPreferences().edit().putBoolean("advanced_muc_mode", mAdvancedMode).apply(); mConferenceInfoTable.setVisibility(this.mAdvancedMode ? View.VISIBLE : View.GONE); invalidateOptionsMenu(); updateView(); @@ -534,7 +532,7 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers setTitle(mConversation.getName()); mFullJid.setText(mConversation.getJid().toBareJid().toString()); mYourNick.setText(mucOptions.getActualNick()); - mRoleAffiliaton = (TextView) findViewById(R.id.muc_role); + TextView mRoleAffiliaton = (TextView) findViewById(R.id.muc_role); if (mucOptions.online()) { mMoreDetails.setVisibility(View.VISIBLE); final String status = getStatus(self); @@ -639,12 +637,8 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers private String getStatus(User user) { if (mAdvancedMode) { - StringBuilder builder = new StringBuilder(); - builder.append(getString(user.getAffiliation().getResId())); - builder.append(" ("); - builder.append(getString(user.getRole().getResId())); - builder.append(')'); - return builder.toString(); + return getString(user.getAffiliation().getResId()) + + " (" + getString(user.getRole().getResId()) + ')'; } else { return getString(user.getAffiliation().getResId()); } diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java index 88596d173..8845dd9e2 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java @@ -433,17 +433,17 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa } public void setupIme() { - if (activity == null) { - return; - } else if (activity.usingEnterKey() && activity.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()) { - mEditMessage.setInputType(mEditMessage.getInputType() | InputType.TYPE_TEXT_FLAG_MULTI_LINE); - mEditMessage.setInputType(mEditMessage.getInputType() & (~InputType.TYPE_TEXT_VARIATION_SHORT_MESSAGE)); - } else { - mEditMessage.setInputType(mEditMessage.getInputType() | InputType.TYPE_TEXT_FLAG_MULTI_LINE); - mEditMessage.setInputType(mEditMessage.getInputType() | InputType.TYPE_TEXT_VARIATION_SHORT_MESSAGE); + if (activity != null) { + if (activity.usingEnterKey() && activity.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()) { + mEditMessage.setInputType(mEditMessage.getInputType() | InputType.TYPE_TEXT_FLAG_MULTI_LINE); + mEditMessage.setInputType(mEditMessage.getInputType() & (~InputType.TYPE_TEXT_VARIATION_SHORT_MESSAGE)); + } else { + mEditMessage.setInputType(mEditMessage.getInputType() | InputType.TYPE_TEXT_FLAG_MULTI_LINE); + mEditMessage.setInputType(mEditMessage.getInputType() | InputType.TYPE_TEXT_VARIATION_SHORT_MESSAGE); + } } } diff --git a/src/main/java/eu/siacs/conversations/ui/OmemoActivity.java b/src/main/java/eu/siacs/conversations/ui/OmemoActivity.java index d139fdd88..fcf9b3de9 100644 --- a/src/main/java/eu/siacs/conversations/ui/OmemoActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/OmemoActivity.java @@ -42,7 +42,7 @@ public abstract class OmemoActivity extends XmppActivity { super.onCreateContextMenu(menu,v,menuInfo); Object account = v.getTag(R.id.TAG_ACCOUNT); Object fingerprint = v.getTag(R.id.TAG_FINGERPRINT); - Object fingerprintStatus = v.getTag(R.id.TAG_FINGERPRINT_STATUS);; + Object fingerprintStatus = v.getTag(R.id.TAG_FINGERPRINT_STATUS); if (account != null && fingerprint != null && account instanceof Account diff --git a/src/main/java/eu/siacs/conversations/ui/SetPresenceActivity.java b/src/main/java/eu/siacs/conversations/ui/SetPresenceActivity.java index 0962d209b..ca1fb8f7c 100644 --- a/src/main/java/eu/siacs/conversations/ui/SetPresenceActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/SetPresenceActivity.java @@ -18,15 +18,8 @@ import android.widget.ScrollView; import android.widget.Spinner; import android.widget.TextView; -import android.util.Log; - -import org.openintents.openpgp.util.OpenPgpApi; - import java.util.List; -import java.util.concurrent.RunnableFuture; -import java.util.concurrent.atomic.AtomicBoolean; -import eu.siacs.conversations.Config; import eu.siacs.conversations.R; import eu.siacs.conversations.entities.Account; import eu.siacs.conversations.entities.ListItem;