diff --git a/briar-android/src/main/java/org/briarproject/briar/android/StartupFailureActivity.java b/briar-android/src/main/java/org/briarproject/briar/android/StartupFailureActivity.java index 51ee125d5319e7fd4e2e6aef08c4cd1919e47c85..dae9706d68f15c64253ac1012183ad4c3d9cb135 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/StartupFailureActivity.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/StartupFailureActivity.java @@ -38,7 +38,7 @@ public class StartupFailureActivity extends BaseActivity { } // show proper error message - TextView view = (TextView) findViewById(R.id.errorView); + TextView view = findViewById(R.id.errorView); if (result.equals(StartResult.DB_ERROR)) { view.setText(getText(R.string.startup_failed_db_error)); } else if (result.equals(StartResult.SERVICE_ERROR)) { diff --git a/briar-android/src/main/java/org/briarproject/briar/android/activity/BriarActivity.java b/briar-android/src/main/java/org/briarproject/briar/android/activity/BriarActivity.java index e98a63cfa560756c7a97e53cbce1fe84966991e1..a989f26c35e6ab48b72765ee4ec9fd9991519af1 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/activity/BriarActivity.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/activity/BriarActivity.java @@ -85,7 +85,7 @@ public abstract class BriarActivity extends BaseActivity { @Nullable protected Toolbar setUpCustomToolbar(boolean ownLayout) { // Custom Toolbar - Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); + Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); ActionBar ab = getSupportActionBar(); if (ab != null) { diff --git a/briar-android/src/main/java/org/briarproject/briar/android/blog/BasePostFragment.java b/briar-android/src/main/java/org/briarproject/briar/android/blog/BasePostFragment.java index 7817c5a3ae05f3b3ca75f7e3a182d0667cedd2c8..3dd18e0be69ea91d23be7b6d5294a981fbbaaf0e 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/blog/BasePostFragment.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/blog/BasePostFragment.java @@ -58,7 +58,7 @@ abstract class BasePostFragment extends BaseFragment { View view = inflater.inflate(R.layout.fragment_blog_post, container, false); - progressBar = (ProgressBar) view.findViewById(R.id.progressBar); + progressBar = view.findViewById(R.id.progressBar); progressBar.setVisibility(VISIBLE); ui = new BlogPostViewHolder(view, true, new OnBlogPostClickListener() { @Override diff --git a/briar-android/src/main/java/org/briarproject/briar/android/blog/BlogFragment.java b/briar-android/src/main/java/org/briarproject/briar/android/blog/BlogFragment.java index 7f6e36eda4787ef0a02a75b9856b9e46b6116080..765d83f2023e50f264de481c479ecfca0ed20f5a 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/blog/BlogFragment.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/blog/BlogFragment.java @@ -92,7 +92,7 @@ public class BlogFragment extends BaseFragment View v = inflater.inflate(R.layout.fragment_blog, container, false); adapter = new BlogPostAdapter(getActivity(), this); - list = (BriarRecyclerView) v.findViewById(R.id.postList); + list = v.findViewById(R.id.postList); list.setLayoutManager(new LinearLayoutManager(getActivity())); list.setAdapter(adapter); list.showProgressBar(); diff --git a/briar-android/src/main/java/org/briarproject/briar/android/blog/BlogPostViewHolder.java b/briar-android/src/main/java/org/briarproject/briar/android/blog/BlogPostViewHolder.java index 4e01c943f6e67d80bcaacd1f422cb94107160869..d013fbcb503feeab079353cc07bd7ed373bf5cc5 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/blog/BlogPostViewHolder.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/blog/BlogPostViewHolder.java @@ -59,13 +59,12 @@ class BlogPostViewHolder extends RecyclerView.ViewHolder { this.listener = listener; ctx = v.getContext(); - layout = (ViewGroup) v.findViewById(R.id.postLayout); - reblogger = (AuthorView) v.findViewById(R.id.rebloggerView); - author = (AuthorView) v.findViewById(R.id.authorView); - reblogButton = (ImageView) v.findViewById(R.id.commentView); - body = (TextView) v.findViewById(R.id.bodyView); - commentContainer = - (ViewGroup) v.findViewById(R.id.commentContainer); + layout = v.findViewById(R.id.postLayout); + reblogger = v.findViewById(R.id.rebloggerView); + author = v.findViewById(R.id.authorView); + reblogButton = v.findViewById(R.id.commentView); + body = v.findViewById(R.id.bodyView); + commentContainer = v.findViewById(R.id.commentContainer); } void setVisibility(int visibility) { @@ -135,7 +134,7 @@ class BlogPostViewHolder extends RecyclerView.ViewHolder { ActivityOptionsCompat options = makeSceneTransitionAnimation((Activity) ctx, layout, getTransitionName(item.getId())); - ActivityCompat.startActivity((Activity) ctx, i, + ActivityCompat.startActivity(ctx, i, options.toBundle()); } else { // work-around for android bug #224270 @@ -173,8 +172,8 @@ class BlogPostViewHolder extends RecyclerView.ViewHolder { .inflate(R.layout.list_item_blog_comment, commentContainer, false); - AuthorView author = (AuthorView) v.findViewById(R.id.authorView); - TextView body = (TextView) v.findViewById(R.id.bodyView); + AuthorView author = v.findViewById(R.id.authorView); + TextView body = v.findViewById(R.id.bodyView); author.setAuthor(c.getAuthor()); author.setAuthorStatus(c.getAuthorStatus()); diff --git a/briar-android/src/main/java/org/briarproject/briar/android/blog/FeedFragment.java b/briar-android/src/main/java/org/briarproject/briar/android/blog/FeedFragment.java index a884510a0ff8c9c9d5f40d3f5ea86c7c3fb6b62a..6f7f309903c849a436458c158c0ba7eef9923db9 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/blog/FeedFragment.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/blog/FeedFragment.java @@ -77,7 +77,7 @@ public class FeedFragment extends BaseFragment implements adapter = new BlogPostAdapter(getActivity(), this); layoutManager = new LinearLayoutManager(getActivity()); - list = (BriarRecyclerView) v.findViewById(R.id.postList); + list = v.findViewById(R.id.postList); list.setLayoutManager(layoutManager); list.setAdapter(adapter); list.setEmptyText(R.string.blogs_feed_empty_state); diff --git a/briar-android/src/main/java/org/briarproject/briar/android/blog/ReblogFragment.java b/briar-android/src/main/java/org/briarproject/briar/android/blog/ReblogFragment.java index db6625bf7b5878ee361a98c017104c318e25b883..8bd99617d3506f9be1a0adb3ebb8e793a39c9b15 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/blog/ReblogFragment.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/blog/ReblogFragment.java @@ -154,8 +154,8 @@ public class ReblogFragment extends BaseFragment implements TextInputListener { private final TextInputView input; private ViewHolder(View v) { - scrollView = (ScrollView) v.findViewById(R.id.scrollView); - progressBar = (ProgressBar) v.findViewById(R.id.progressBar); + scrollView = v.findViewById(R.id.scrollView); + progressBar = v.findViewById(R.id.progressBar); post = new BlogPostViewHolder(v.findViewById(R.id.postLayout), true, new OnBlogPostClickListener() { @Override @@ -168,7 +168,7 @@ public class ReblogFragment extends BaseFragment implements TextInputListener { // probably don't want to allow author clicks here } }); - input = (TextInputView) v.findViewById(R.id.inputText); + input = v.findViewById(R.id.inputText); } } } diff --git a/briar-android/src/main/java/org/briarproject/briar/android/blog/RssFeedAdapter.java b/briar-android/src/main/java/org/briarproject/briar/android/blog/RssFeedAdapter.java index 4318958cd4bece6f0896f1f11f87436db311975c..d51fdc4aa66f9599d73a9ae59e55e648a20c9c97 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/blog/RssFeedAdapter.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/blog/RssFeedAdapter.java @@ -104,13 +104,13 @@ class RssFeedAdapter extends BriarAdapter<Feed, RssFeedAdapter.FeedViewHolder> { super(v); layout = v; - title = (TextView) v.findViewById(R.id.titleView); - delete = (ImageButton) v.findViewById(R.id.deleteButton); - imported = (TextView) v.findViewById(R.id.importedView); - updated = (TextView) v.findViewById(R.id.updatedView); - author = (TextView) v.findViewById(R.id.authorView); - authorLabel = (TextView) v.findViewById(R.id.author); - description = (TextView) v.findViewById(R.id.descriptionView); + title = v.findViewById(R.id.titleView); + delete = v.findViewById(R.id.deleteButton); + imported = v.findViewById(R.id.importedView); + updated = v.findViewById(R.id.updatedView); + author = v.findViewById(R.id.authorView); + authorLabel = v.findViewById(R.id.author); + description = v.findViewById(R.id.descriptionView); } } diff --git a/briar-android/src/main/java/org/briarproject/briar/android/blog/RssFeedImportActivity.java b/briar-android/src/main/java/org/briarproject/briar/android/blog/RssFeedImportActivity.java index 3629f9bef02809bfcf9ffc7cf104483bf1d752a9..dafea3054e097daf2e303509056b6adae8ddcca2 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/blog/RssFeedImportActivity.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/blog/RssFeedImportActivity.java @@ -54,7 +54,7 @@ public class RssFeedImportActivity extends BriarActivity { setContentView(R.layout.activity_rss_feed_import); - urlInput = (EditText) findViewById(R.id.urlInput); + urlInput = findViewById(R.id.urlInput); urlInput.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, @@ -72,10 +72,10 @@ public class RssFeedImportActivity extends BriarActivity { } }); - importButton = (Button) findViewById(R.id.importButton); + importButton = findViewById(R.id.importButton); importButton.setOnClickListener(v -> publish()); - progressBar = (ProgressBar) findViewById(R.id.progressBar); + progressBar = findViewById(R.id.progressBar); } @Override diff --git a/briar-android/src/main/java/org/briarproject/briar/android/blog/RssFeedManageActivity.java b/briar-android/src/main/java/org/briarproject/briar/android/blog/RssFeedManageActivity.java index 49dbc997d33a5931552c7212f49e08778fc9a84c..1220f39867976f916cc82ee2c64cd2c8fb98ea2e 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/blog/RssFeedManageActivity.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/blog/RssFeedManageActivity.java @@ -49,7 +49,7 @@ public class RssFeedManageActivity extends BriarActivity adapter = new RssFeedAdapter(this, this); - list = (BriarRecyclerView) findViewById(R.id.feedList); + list = findViewById(R.id.feedList); list.setLayoutManager(new LinearLayoutManager(this)); list.setAdapter(adapter); } diff --git a/briar-android/src/main/java/org/briarproject/briar/android/blog/WriteBlogPostActivity.java b/briar-android/src/main/java/org/briarproject/briar/android/blog/WriteBlogPostActivity.java index 45ed94f948a6d623e8634189eeb65f521ac86cb4..918c6def21fbcda550b06f00e4792ca51bed482b 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/blog/WriteBlogPostActivity.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/blog/WriteBlogPostActivity.java @@ -69,7 +69,7 @@ public class WriteBlogPostActivity extends BriarActivity setContentView(R.layout.activity_write_blog_post); - input = (TextInputView) findViewById(R.id.bodyInput); + input = findViewById(R.id.bodyInput); input.setSendButtonEnabled(false); input.addTextChangedListener(new TextWatcher() { @Override @@ -89,7 +89,7 @@ public class WriteBlogPostActivity extends BriarActivity }); input.setListener(this); - progressBar = (ProgressBar) findViewById(R.id.progressBar); + progressBar = findViewById(R.id.progressBar); } @Override diff --git a/briar-android/src/main/java/org/briarproject/briar/android/contact/ContactItemViewHolder.java b/briar-android/src/main/java/org/briarproject/briar/android/contact/ContactItemViewHolder.java index a21e9ae1b3a1ee89727f45b06712bd594ada9b73..6bc4f3d493e0b49159859c6289b35599b6d26a11 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/contact/ContactItemViewHolder.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/contact/ContactItemViewHolder.java @@ -31,10 +31,10 @@ public class ContactItemViewHolder<I extends ContactItem> super(v); layout = (ViewGroup) v; - avatar = (ImageView) v.findViewById(R.id.avatarView); - name = (TextView) v.findViewById(R.id.nameView); + avatar = v.findViewById(R.id.avatarView); + name = v.findViewById(R.id.nameView); // this can be null as not all layouts that use this ViewHolder have it - bulb = (ImageView) v.findViewById(R.id.bulbView); + bulb = v.findViewById(R.id.bulbView); } protected void bind(I item, @Nullable OnContactClickListener<I> listener) { diff --git a/briar-android/src/main/java/org/briarproject/briar/android/contact/ContactListFragment.java b/briar-android/src/main/java/org/briarproject/briar/android/contact/ContactListFragment.java index 47826355fba0674ace514f842335b6de636e19a5..d404ea47a40b6894aa481838c1b8b8790a1c65cf 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/contact/ContactListFragment.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/contact/ContactListFragment.java @@ -143,7 +143,7 @@ public class ContactListFragment extends BaseFragment implements EventListener { } }; adapter = new ContactListAdapter(getContext(), onContactClickListener); - list = (BriarRecyclerView) contentView.findViewById(R.id.list); + list = contentView.findViewById(R.id.list); list.setLayoutManager(new LinearLayoutManager(getContext())); list.setAdapter(adapter); list.setEmptyText(getString(R.string.no_contacts)); diff --git a/briar-android/src/main/java/org/briarproject/briar/android/contact/ContactListItemViewHolder.java b/briar-android/src/main/java/org/briarproject/briar/android/contact/ContactListItemViewHolder.java index 386b2590620ef8a648019525b926d9cd1c4e1037..337f6b7e96008f18ea3e7e9879a69583495b32d7 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/contact/ContactListItemViewHolder.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/contact/ContactListItemViewHolder.java @@ -24,8 +24,8 @@ class ContactListItemViewHolder extends ContactItemViewHolder<ContactListItem> { ContactListItemViewHolder(View v) { super(v); - unread = (TextView) v.findViewById(R.id.unreadCountView); - date = (TextView) v.findViewById(R.id.dateView); + unread = v.findViewById(R.id.unreadCountView); + date = v.findViewById(R.id.dateView); } @Override diff --git a/briar-android/src/main/java/org/briarproject/briar/android/contact/ConversationActivity.java b/briar-android/src/main/java/org/briarproject/briar/android/contact/ConversationActivity.java index d0ae82427af1938bb94d7528c7798dd3860937c6..585b0fed9be5a448482568b7b21e7e962dfc157b 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/contact/ConversationActivity.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/contact/ConversationActivity.java @@ -14,7 +14,6 @@ import android.util.SparseArray; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; -import android.view.MotionEvent; import android.view.View; import android.widget.ImageView; import android.widget.TextView; @@ -100,7 +99,7 @@ import javax.inject.Inject; import de.hdodenhof.circleimageview.CircleImageView; import im.delight.android.identicons.IdenticonDrawable; import uk.co.samuelwall.materialtaptargetprompt.MaterialTapTargetPrompt; -import uk.co.samuelwall.materialtaptargetprompt.MaterialTapTargetPrompt.OnHidePromptListener; +import uk.co.samuelwall.materialtaptargetprompt.MaterialTapTargetPrompt.PromptStateChangeListener; import static android.support.v4.view.ViewCompat.setTransitionName; import static android.support.v7.util.SortedList.INVALID_POSITION; @@ -112,6 +111,8 @@ import static org.briarproject.briar.android.settings.SettingsFragment.SETTINGS_ import static org.briarproject.briar.android.util.UiUtils.getAvatarTransitionName; import static org.briarproject.briar.android.util.UiUtils.getBulbTransitionName; import static org.briarproject.briar.api.messaging.MessagingConstants.MAX_PRIVATE_MESSAGE_BODY_LENGTH; +import static uk.co.samuelwall.materialtaptargetprompt.MaterialTapTargetPrompt.STATE_DISMISSED; +import static uk.co.samuelwall.materialtaptargetprompt.MaterialTapTargetPrompt.STATE_FINISHED; @MethodsNotNullByDefault @ParametersNotNullByDefault @@ -199,23 +200,21 @@ public class ConversationActivity extends BriarActivity // Custom Toolbar toolbar = setUpCustomToolbar(true); if (toolbar != null) { - toolbarAvatar = - (CircleImageView) toolbar.findViewById(R.id.contactAvatar); - toolbarStatus = - (ImageView) toolbar.findViewById(R.id.contactStatus); - toolbarTitle = (TextView) toolbar.findViewById(R.id.contactName); + toolbarAvatar = toolbar.findViewById(R.id.contactAvatar); + toolbarStatus = toolbar.findViewById(R.id.contactStatus); + toolbarTitle = toolbar.findViewById(R.id.contactName); } setTransitionName(toolbarAvatar, getAvatarTransitionName(contactId)); setTransitionName(toolbarStatus, getBulbTransitionName(contactId)); adapter = new ConversationAdapter(this, this); - list = (BriarRecyclerView) findViewById(R.id.conversationView); + list = findViewById(R.id.conversationView); list.setLayoutManager(new LinearLayoutManager(this)); list.setAdapter(adapter); list.setEmptyText(getString(R.string.no_private_messages)); - textInputView = (TextInputView) findViewById(R.id.text_input_container); + textInputView = findViewById(R.id.text_input_container); textInputView.setListener(this); } @@ -393,7 +392,7 @@ public class ConversationActivity extends BriarActivity /** * Creates ConversationItems from headers loaded from the database. - * + * <p> * Attention: Call this only after contactName has been initialized. */ @SuppressWarnings("ConstantConditions") @@ -562,6 +561,7 @@ public class ConversationActivity extends BriarActivity addConversationItem(item); }); } + @Override public void onFailure(Throwable exception) { runOnUiThreadUnlessDestroyed( @@ -580,6 +580,7 @@ public class ConversationActivity extends BriarActivity addConversationItem(item); }); } + @Override public void onFailure(Throwable exception) { runOnUiThreadUnlessDestroyed( @@ -598,6 +599,7 @@ public class ConversationActivity extends BriarActivity addConversationItem(item); }); } + @Override public void onFailure(Throwable exception) { runOnUiThreadUnlessDestroyed( @@ -616,6 +618,7 @@ public class ConversationActivity extends BriarActivity addConversationItem(item); }); } + @Override public void onFailure(Throwable exception) { runOnUiThreadUnlessDestroyed( @@ -778,25 +781,25 @@ public class ConversationActivity extends BriarActivity return; } - OnHidePromptListener listener = new OnHidePromptListener() { - @Override - public void onHidePrompt(MotionEvent motionEvent, - boolean focalClicked) { - introductionOnboardingSeen(); - } + PromptStateChangeListener listener = new PromptStateChangeListener() { + @Override + public void onPromptStateChanged( + MaterialTapTargetPrompt prompt, int state) { + if (state == STATE_DISMISSED || + state == STATE_FINISHED) { +introductionOnboardingSeen(); + } + } + + }; + new MaterialTapTargetPrompt.Builder(ConversationActivity.this, + R.style.OnboardingDialogTheme).setTarget(target) + .setPrimaryText(R.string.introduction_onboarding_title) + .setSecondaryText(R.string.introduction_onboarding_text) + .setIcon(R.drawable.ic_more_vert_accent) + .setPromptStateChangeListener(listener) + .show(); - @Override - public void onHidePromptComplete() { - } - }; - new MaterialTapTargetPrompt.Builder(ConversationActivity.this) - .setTarget(target) - .setPrimaryText(R.string.introduction_onboarding_title) - .setSecondaryText(R.string.introduction_onboarding_text) - .setBackgroundColourFromRes(R.color.briar_primary) - .setIcon(R.drawable.ic_more_vert_accent) - .setOnHidePromptListener(listener) - .show(); }); } diff --git a/briar-android/src/main/java/org/briarproject/briar/android/contact/ConversationItemViewHolder.java b/briar-android/src/main/java/org/briarproject/briar/android/contact/ConversationItemViewHolder.java index e58ed523c91d001f31d74f44be7e4f109aa4790e..2d0763a3b85e20a5b1ea3b3823bd56335749aec0 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/contact/ConversationItemViewHolder.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/contact/ConversationItemViewHolder.java @@ -22,9 +22,9 @@ class ConversationItemViewHolder extends ViewHolder { ConversationItemViewHolder(View v) { super(v); - layout = (ViewGroup) v.findViewById(R.id.layout); - text = (TextView) v.findViewById(R.id.text); - time = (TextView) v.findViewById(R.id.time); + layout = v.findViewById(R.id.layout); + text = v.findViewById(R.id.text); + time = v.findViewById(R.id.time); } @CallSuper diff --git a/briar-android/src/main/java/org/briarproject/briar/android/contact/ConversationNoticeInViewHolder.java b/briar-android/src/main/java/org/briarproject/briar/android/contact/ConversationNoticeInViewHolder.java index db6bbd89b3f804bd282e3780db778905f3da04e3..a77ec07bac37792fb45f182508f023c7f1a33d3c 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/contact/ConversationNoticeInViewHolder.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/contact/ConversationNoticeInViewHolder.java @@ -19,7 +19,7 @@ class ConversationNoticeInViewHolder extends ConversationItemViewHolder { ConversationNoticeInViewHolder(View v) { super(v); - msgText = (TextView) v.findViewById(R.id.msgText); + msgText = v.findViewById(R.id.msgText); } @Override diff --git a/briar-android/src/main/java/org/briarproject/briar/android/contact/ConversationNoticeOutViewHolder.java b/briar-android/src/main/java/org/briarproject/briar/android/contact/ConversationNoticeOutViewHolder.java index 504137ada8fe3caa13d60683129d0d53c46f6c96..d762018fba584f1a0432072ee8dbc9e9b822a787 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/contact/ConversationNoticeOutViewHolder.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/contact/ConversationNoticeOutViewHolder.java @@ -19,7 +19,7 @@ class ConversationNoticeOutViewHolder extends ConversationOutItemViewHolder { ConversationNoticeOutViewHolder(View v) { super(v); - msgText = (TextView) v.findViewById(R.id.msgText); + msgText = v.findViewById(R.id.msgText); } @Override diff --git a/briar-android/src/main/java/org/briarproject/briar/android/contact/ConversationOutItemViewHolder.java b/briar-android/src/main/java/org/briarproject/briar/android/contact/ConversationOutItemViewHolder.java index 8e5bf264da3c7be9ab5861c6f13cc77ec13bd222..39fa86887db86aeaafda565dcc84412241e750a3 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/contact/ConversationOutItemViewHolder.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/contact/ConversationOutItemViewHolder.java @@ -16,7 +16,7 @@ abstract class ConversationOutItemViewHolder ConversationOutItemViewHolder(View v) { super(v); - status = (ImageView) v.findViewById(R.id.status); + status = v.findViewById(R.id.status); } @Override diff --git a/briar-android/src/main/java/org/briarproject/briar/android/contact/ConversationRequestViewHolder.java b/briar-android/src/main/java/org/briarproject/briar/android/contact/ConversationRequestViewHolder.java index f5718c1dc9c97cc80daf55613d512ac5997278d0..b3f53a74fc91a29cfc26341744205f81e088fdfb 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/contact/ConversationRequestViewHolder.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/contact/ConversationRequestViewHolder.java @@ -20,8 +20,8 @@ class ConversationRequestViewHolder extends ConversationNoticeInViewHolder { ConversationRequestViewHolder(View v) { super(v); - acceptButton = (Button) v.findViewById(R.id.acceptButton); - declineButton = (Button) v.findViewById(R.id.declineButton); + acceptButton = v.findViewById(R.id.acceptButton); + declineButton = v.findViewById(R.id.declineButton); } void bind(ConversationItem conversationItem, diff --git a/briar-android/src/main/java/org/briarproject/briar/android/contactselection/BaseContactSelectorFragment.java b/briar-android/src/main/java/org/briarproject/briar/android/contactselection/BaseContactSelectorFragment.java index 7b3f681e90d1775ea7589907cbcabaec4fc7af2f..03e6ff06b9de33576433d2bcba4e17f5a20bf255 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/contactselection/BaseContactSelectorFragment.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/contactselection/BaseContactSelectorFragment.java @@ -67,7 +67,7 @@ public abstract class BaseContactSelectorFragment<I extends SelectableContactIte View contentView = inflater.inflate(R.layout.list, container, false); - list = (BriarRecyclerView) contentView.findViewById(R.id.list); + list = contentView.findViewById(R.id.list); list.setLayoutManager(new LinearLayoutManager(getActivity())); list.setEmptyText(getString(R.string.no_contacts_selector)); adapter = getAdapter(getContext(), this); diff --git a/briar-android/src/main/java/org/briarproject/briar/android/contactselection/BaseSelectableContactHolder.java b/briar-android/src/main/java/org/briarproject/briar/android/contactselection/BaseSelectableContactHolder.java index e0fe9a688e13aa7e772b76ea2596a44707135269..fd69f6c12b29bf54db77586eb58fe961237c6011 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/contactselection/BaseSelectableContactHolder.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/contactselection/BaseSelectableContactHolder.java @@ -24,8 +24,8 @@ public class BaseSelectableContactHolder<I extends SelectableContactItem> public BaseSelectableContactHolder(View v) { super(v); - checkBox = (CheckBox) v.findViewById(R.id.checkBox); - info = (TextView) v.findViewById(R.id.infoView); + checkBox = v.findViewById(R.id.checkBox); + info = v.findViewById(R.id.infoView); } @Override diff --git a/briar-android/src/main/java/org/briarproject/briar/android/forum/CreateForumActivity.java b/briar-android/src/main/java/org/briarproject/briar/android/forum/CreateForumActivity.java index 6a87b3b7120032d6287c796f5ce4c498d10903bd..2015be8db47c736b58688f8d763281eb79933d12 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/forum/CreateForumActivity.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/forum/CreateForumActivity.java @@ -54,9 +54,8 @@ public class CreateForumActivity extends BriarActivity { setContentView(R.layout.activity_create_forum); - nameEntryLayout = - (TextInputLayout) findViewById(R.id.createForumNameLayout); - nameEntry = (EditText) findViewById(R.id.createForumNameEntry); + nameEntryLayout = findViewById(R.id.createForumNameLayout); + nameEntry = findViewById(R.id.createForumNameEntry); nameEntry.addTextChangedListener(new TextWatcher() { @Override @@ -79,10 +78,10 @@ public class CreateForumActivity extends BriarActivity { return true; }); - createForumButton = (Button) findViewById(R.id.createForumButton); + createForumButton = findViewById(R.id.createForumButton); createForumButton.setOnClickListener(v -> createForum()); - progress = (ProgressBar) findViewById(R.id.createForumProgressBar); + progress = findViewById(R.id.createForumProgressBar); } @Override diff --git a/briar-android/src/main/java/org/briarproject/briar/android/forum/ForumListAdapter.java b/briar-android/src/main/java/org/briarproject/briar/android/forum/ForumListAdapter.java index c46833fe2dd5fcd0de9759785b05c4f7afd15421..b49ba9d6b4e674f19caba960489387ea5ec1fbfa 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/forum/ForumListAdapter.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/forum/ForumListAdapter.java @@ -133,10 +133,10 @@ class ForumListAdapter super(v); layout = (ViewGroup) v; - avatar = (TextAvatarView) v.findViewById(R.id.avatarView); - name = (TextView) v.findViewById(R.id.forumNameView); - postCount = (TextView) v.findViewById(R.id.postCountView); - date = (TextView) v.findViewById(R.id.dateView); + avatar = v.findViewById(R.id.avatarView); + name = v.findViewById(R.id.forumNameView); + postCount = v.findViewById(R.id.postCountView); + date = v.findViewById(R.id.dateView); } } } diff --git a/briar-android/src/main/java/org/briarproject/briar/android/forum/ForumListFragment.java b/briar-android/src/main/java/org/briarproject/briar/android/forum/ForumListFragment.java index 5fcf22ecf352d69c9bcdf1b405cc77332e2602b6..af52ab94360633ef447ddf9028dbcb4f930ee773 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/forum/ForumListFragment.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/forum/ForumListFragment.java @@ -92,7 +92,7 @@ public class ForumListFragment extends BaseEventFragment implements adapter = new ForumListAdapter(getActivity()); - list = (BriarRecyclerView) contentView.findViewById(R.id.forumList); + list = contentView.findViewById(R.id.forumList); list.setLayoutManager(new LinearLayoutManager(getActivity())); list.setAdapter(adapter); list.setEmptyText(getString(R.string.no_forums)); diff --git a/briar-android/src/main/java/org/briarproject/briar/android/introduction/ContactChooserFragment.java b/briar-android/src/main/java/org/briarproject/briar/android/introduction/ContactChooserFragment.java index 99ccd1f3bd9ad8fd7f469b844994cc93330da8c2..252ed6734b804decfa165b11b3e612d19d3badc8 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/introduction/ContactChooserFragment.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/introduction/ContactChooserFragment.java @@ -78,7 +78,7 @@ public class ContactChooserFragment extends BaseFragment { }; adapter = new ContactListAdapter(getActivity(), onContactClickListener); - list = (BriarRecyclerView) contentView.findViewById(R.id.list); + list = contentView.findViewById(R.id.list); list.setLayoutManager(new LinearLayoutManager(getActivity())); list.setAdapter(adapter); list.setEmptyText(getString(R.string.no_contacts)); diff --git a/briar-android/src/main/java/org/briarproject/briar/android/introduction/IntroductionMessageFragment.java b/briar-android/src/main/java/org/briarproject/briar/android/introduction/IntroductionMessageFragment.java index 52fcd30cba4a1916c1479c6873742257b8eda3c5..3a76421b375e9c8f9b51ac4fa6976a923cd56582 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/introduction/IntroductionMessageFragment.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/introduction/IntroductionMessageFragment.java @@ -211,13 +211,12 @@ public class IntroductionMessageFragment extends BaseFragment private final TextInputView message; private ViewHolder(View v) { - progressBar = (ProgressBar) v.findViewById(R.id.progressBar); - avatar1 = (CircleImageView) v.findViewById(R.id.avatarContact1); - avatar2 = (CircleImageView) v.findViewById(R.id.avatarContact2); - contactName1 = (TextView) v.findViewById(R.id.nameContact1); - contactName2 = (TextView) v.findViewById(R.id.nameContact2); - message = (TextInputView) v - .findViewById(R.id.introductionMessageView); + progressBar = v.findViewById(R.id.progressBar); + avatar1 = v.findViewById(R.id.avatarContact1); + avatar2 = v.findViewById(R.id.avatarContact2); + contactName1 = v.findViewById(R.id.nameContact1); + contactName2 = v.findViewById(R.id.nameContact2); + message = v.findViewById(R.id.introductionMessageView); } } } diff --git a/briar-android/src/main/java/org/briarproject/briar/android/keyagreement/IntroFragment.java b/briar-android/src/main/java/org/briarproject/briar/android/keyagreement/IntroFragment.java index f1112729794cee833ada6a697dd44f716c042a7f..4a94db19011465f99a1f1629e0c7ffec96abf813 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/keyagreement/IntroFragment.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/keyagreement/IntroFragment.java @@ -63,7 +63,7 @@ public class IntroFragment extends BaseFragment { View v = inflater.inflate(R.layout.fragment_keyagreement_id, container, false); - scrollView = (ScrollView) v.findViewById(R.id.scrollView); + scrollView = v.findViewById(R.id.scrollView); View button = v.findViewById(R.id.continueButton); button.setOnClickListener(view -> screenSeenListener.showNextScreen()); return v; diff --git a/briar-android/src/main/java/org/briarproject/briar/android/keyagreement/KeyAgreementActivity.java b/briar-android/src/main/java/org/briarproject/briar/android/keyagreement/KeyAgreementActivity.java index e866662dca5e2d4ed38fe66c773e002b2d0f1551..040312127b7f850a007d6dd82fc6f27e632a8997 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/keyagreement/KeyAgreementActivity.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/keyagreement/KeyAgreementActivity.java @@ -75,7 +75,7 @@ public class KeyAgreementActivity extends BriarActivity implements super.onCreate(state); setContentView(R.layout.activity_fragment_container_toolbar); - Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); + Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); diff --git a/briar-android/src/main/java/org/briarproject/briar/android/keyagreement/ShowQrCodeFragment.java b/briar-android/src/main/java/org/briarproject/briar/android/keyagreement/ShowQrCodeFragment.java index ae01d66c49b5b0f866fd56b91e9a0bd25009b79d..54df56f3ae9caab020390a4e14aacd670a42c82d 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/keyagreement/ShowQrCodeFragment.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/keyagreement/ShowQrCodeFragment.java @@ -124,14 +124,12 @@ public class ShowQrCodeFragment extends BaseEventFragment public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); - cameraView = (CameraView) view.findViewById(R.id.camera_view); + cameraView = view.findViewById(R.id.camera_view); statusView = view.findViewById(R.id.status_container); - status = (TextView) view.findViewById(R.id.connect_status); - qrCode = (ImageView) view.findViewById(R.id.qr_code); - mainProgressTitle = - (TextView) view.findViewById(R.id.title_progress_bar); - mainProgressContainer = - (ViewGroup) view.findViewById(R.id.container_progress); + status = view.findViewById(R.id.connect_status); + qrCode = view.findViewById(R.id.qr_code); + mainProgressTitle = view.findViewById(R.id.title_progress_bar); + mainProgressContainer = view.findViewById(R.id.container_progress); } @Override diff --git a/briar-android/src/main/java/org/briarproject/briar/android/login/AuthorNameFragment.java b/briar-android/src/main/java/org/briarproject/briar/android/login/AuthorNameFragment.java index 303d79d1507710f63a99df877234c1356bd566da..ec28c6563e7c773ffaaf3e65dc5741c5395504b3 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/login/AuthorNameFragment.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/login/AuthorNameFragment.java @@ -35,11 +35,9 @@ public class AuthorNameFragment extends SetupFragment { getActivity().setTitle(getString(R.string.setup_title)); View v = inflater.inflate(R.layout.fragment_setup_author_name, container, false); - authorNameWrapper = - (TextInputLayout) v.findViewById(R.id.nickname_entry_wrapper); - authorNameInput = - (TextInputEditText) v.findViewById(R.id.nickname_entry); - nextButton = (Button) v.findViewById(R.id.next); + authorNameWrapper = v.findViewById(R.id.nickname_entry_wrapper); + authorNameInput = v.findViewById(R.id.nickname_entry); + nextButton = v.findViewById(R.id.next); authorNameInput.addTextChangedListener(this); nextButton.setOnClickListener(this); diff --git a/briar-android/src/main/java/org/briarproject/briar/android/login/ChangePasswordActivity.java b/briar-android/src/main/java/org/briarproject/briar/android/login/ChangePasswordActivity.java index cc460deb7e1d1689205393244a72c31e459cb0c0..cabab8e9ec9065ee82083b2dc7d85dddde3f7a45 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/login/ChangePasswordActivity.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/login/ChangePasswordActivity.java @@ -49,20 +49,16 @@ public class ChangePasswordActivity extends BaseActivity setContentView(R.layout.activity_change_password); currentPasswordEntryWrapper = - (TextInputLayout) findViewById( - R.id.current_password_entry_wrapper); - newPasswordEntryWrapper = - (TextInputLayout) findViewById(R.id.new_password_entry_wrapper); + findViewById(R.id.current_password_entry_wrapper); + newPasswordEntryWrapper = findViewById(R.id.new_password_entry_wrapper); newPasswordConfirmationWrapper = - (TextInputLayout) findViewById( - R.id.new_password_confirm_wrapper); - currentPassword = (EditText) findViewById(R.id.current_password_entry); - newPassword = (EditText) findViewById(R.id.new_password_entry); - newPasswordConfirmation = - (EditText) findViewById(R.id.new_password_confirm); - strengthMeter = (StrengthMeter) findViewById(R.id.strength_meter); - changePasswordButton = (Button) findViewById(R.id.change_password); - progress = (ProgressBar) findViewById(R.id.progress_wheel); + findViewById(R.id.new_password_confirm_wrapper); + currentPassword = findViewById(R.id.current_password_entry); + newPassword = findViewById(R.id.new_password_entry); + newPasswordConfirmation = findViewById(R.id.new_password_confirm); + strengthMeter = findViewById(R.id.strength_meter); + changePasswordButton = findViewById(R.id.change_password); + progress = findViewById(R.id.progress_wheel); TextWatcher tw = new TextWatcher() { diff --git a/briar-android/src/main/java/org/briarproject/briar/android/login/DozeFragment.java b/briar-android/src/main/java/org/briarproject/briar/android/login/DozeFragment.java index 68dc243458121bf857d0780feae8a51142ef091b..8908195a49343e3762b2add716e01e2b039466b7 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/login/DozeFragment.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/login/DozeFragment.java @@ -37,8 +37,8 @@ public class DozeFragment extends SetupFragment { getActivity().setTitle(getString(R.string.setup_doze_title)); View v = inflater.inflate(R.layout.fragment_setup_doze, container, false); - dozeButton = (Button) v.findViewById(R.id.dozeButton); - progressBar = (ProgressBar) v.findViewById(R.id.progress); + dozeButton = v.findViewById(R.id.dozeButton); + progressBar = v.findViewById(R.id.progress); dozeButton.setOnClickListener(view -> askForDozeWhitelisting()); diff --git a/briar-android/src/main/java/org/briarproject/briar/android/login/PasswordActivity.java b/briar-android/src/main/java/org/briarproject/briar/android/login/PasswordActivity.java index ec0ccb5721a8d3dabb1ef5fb458888a9a5bf8b29..c381beb36f20073b13cf49e55b74cce44d773680 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/login/PasswordActivity.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/login/PasswordActivity.java @@ -53,10 +53,10 @@ public class PasswordActivity extends BaseActivity { } setContentView(R.layout.activity_password); - signInButton = (Button) findViewById(R.id.btn_sign_in); - progress = (ProgressBar) findViewById(R.id.progress_wheel); - input = (TextInputLayout) findViewById(R.id.password_layout); - password = (EditText) findViewById(R.id.edit_password); + signInButton = findViewById(R.id.btn_sign_in); + progress = findViewById(R.id.progress_wheel); + input = findViewById(R.id.password_layout); + password = findViewById(R.id.edit_password); password.setOnEditorActionListener((v, actionId, event) -> { validatePassword(); return true; diff --git a/briar-android/src/main/java/org/briarproject/briar/android/login/PasswordFragment.java b/briar-android/src/main/java/org/briarproject/briar/android/login/PasswordFragment.java index 0106892a15c12c177b1011d9161ad0cf703eeece..17f7e06eb16d2a3700be32ff7f3634f75d84a0c3 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/login/PasswordFragment.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/login/PasswordFragment.java @@ -40,16 +40,14 @@ public class PasswordFragment extends SetupFragment { View v = inflater.inflate(R.layout.fragment_setup_password, container, false); - strengthMeter = (StrengthMeter) v.findViewById(R.id.strength_meter); - passwordEntryWrapper = - (TextInputLayout) v.findViewById(R.id.password_entry_wrapper); - passwordEntry = (TextInputEditText) v.findViewById(R.id.password_entry); + strengthMeter = v.findViewById(R.id.strength_meter); + passwordEntryWrapper = v.findViewById(R.id.password_entry_wrapper); + passwordEntry = v.findViewById(R.id.password_entry); passwordConfirmationWrapper = - (TextInputLayout) v.findViewById(R.id.password_confirm_wrapper); - passwordConfirmation = - (TextInputEditText) v.findViewById(R.id.password_confirm); - nextButton = (Button) v.findViewById(R.id.next); - progressBar = (ProgressBar) v.findViewById(R.id.progress); + v.findViewById(R.id.password_confirm_wrapper); + passwordConfirmation = v.findViewById(R.id.password_confirm); + nextButton = v.findViewById(R.id.next); + progressBar = v.findViewById(R.id.progress); passwordEntry.addTextChangedListener(this); passwordConfirmation.addTextChangedListener(this); diff --git a/briar-android/src/main/java/org/briarproject/briar/android/navdrawer/NavDrawerActivity.java b/briar-android/src/main/java/org/briarproject/briar/android/navdrawer/NavDrawerActivity.java index e0ad7d8c9cb03e2c799b850cb01f3eb23071a3ff..ea3484dfbb89735a66020f05cd5e9972adf0703b 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/navdrawer/NavDrawerActivity.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/navdrawer/NavDrawerActivity.java @@ -113,10 +113,10 @@ public class NavDrawerActivity extends BriarActivity implements exitIfStartupFailed(getIntent()); setContentView(R.layout.activity_nav_drawer); - Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); - drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); - navigation = (NavigationView) findViewById(R.id.navigation); - GridView transportsView = (GridView) findViewById(R.id.transportsView); + Toolbar toolbar = findViewById(R.id.toolbar); + drawerLayout = findViewById(R.id.drawer_layout); + navigation = findViewById(R.id.navigation); + GridView transportsView = findViewById(R.id.transportsView); setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); @@ -282,12 +282,12 @@ public class NavDrawerActivity extends BriarActivity implements if (daysUntilExpiry < 0) signOut(); // show expiry warning text - ViewGroup expiryWarning = (ViewGroup) findViewById(R.id.expiryWarning); + ViewGroup expiryWarning = findViewById(R.id.expiryWarning); TextView expiryWarningText = - (TextView) expiryWarning.findViewById(R.id.expiryWarningText); + expiryWarning.findViewById(R.id.expiryWarningText); // make close button functional ImageView expiryWarningClose = - (ImageView) expiryWarning.findViewById(R.id.expiryWarningClose); + expiryWarning.findViewById(R.id.expiryWarningClose); // show a different snackbar in green if this is an update if (expiry == UPDATE) { @@ -388,12 +388,12 @@ public class NavDrawerActivity extends BriarActivity implements android.R.color.tertiary_text_light); } - ImageView icon = (ImageView) view.findViewById(R.id.imageView); + ImageView icon = view.findViewById(R.id.imageView); icon.setImageDrawable(ContextCompat .getDrawable(NavDrawerActivity.this, t.iconId)); icon.setColorFilter(c); - TextView text = (TextView) view.findViewById(R.id.textView); + TextView text = view.findViewById(R.id.textView); text.setText(getString(t.textId)); return view; diff --git a/briar-android/src/main/java/org/briarproject/briar/android/privategroup/creation/CreateGroupFragment.java b/briar-android/src/main/java/org/briarproject/briar/android/privategroup/creation/CreateGroupFragment.java index c8a6bac35d1e6e1ecf6067ccd7f8451c2d6ed10c..c402bcb4ad4209cd9198db26219998a7054a2057 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/privategroup/creation/CreateGroupFragment.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/privategroup/creation/CreateGroupFragment.java @@ -43,7 +43,7 @@ public class CreateGroupFragment extends BaseFragment { View v = inflater.inflate(R.layout.fragment_create_group, container, false); - nameEntry = (EditText) v.findViewById(R.id.name); + nameEntry = v.findViewById(R.id.name); nameEntry.addTextChangedListener(new TextWatcher() { @Override @@ -66,12 +66,12 @@ public class CreateGroupFragment extends BaseFragment { return true; }); - nameLayout = (TextInputLayout) v.findViewById(R.id.nameLayout); + nameLayout = v.findViewById(R.id.nameLayout); - createGroupButton = (Button) v.findViewById(R.id.button); + createGroupButton = v.findViewById(R.id.button); createGroupButton.setOnClickListener(v1 -> createGroup()); - progress = (ProgressBar) v.findViewById(R.id.progressBar); + progress = v.findViewById(R.id.progressBar); return v; } diff --git a/briar-android/src/main/java/org/briarproject/briar/android/privategroup/list/GroupListFragment.java b/briar-android/src/main/java/org/briarproject/briar/android/privategroup/list/GroupListFragment.java index fbcce8cf5a9c8818fe4a93ee169e07a65741e269..548fa95336e110b4e955f9f7840636d3db11c72c 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/privategroup/list/GroupListFragment.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/privategroup/list/GroupListFragment.java @@ -68,7 +68,7 @@ public class GroupListFragment extends BaseFragment implements View v = inflater.inflate(R.layout.list, container, false); adapter = new GroupListAdapter(getContext(), this); - list = (BriarRecyclerView) v.findViewById(R.id.list); + list = v.findViewById(R.id.list); list.setEmptyText(R.string.groups_list_empty); list.setLayoutManager(new LinearLayoutManager(getContext())); list.setAdapter(adapter); diff --git a/briar-android/src/main/java/org/briarproject/briar/android/privategroup/list/GroupViewHolder.java b/briar-android/src/main/java/org/briarproject/briar/android/privategroup/list/GroupViewHolder.java index 15219e5859316ad6b2a74cfc659e91178cb4b266..e09e371bf577eef70bdd422ed623b2f46d1df4a0 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/privategroup/list/GroupViewHolder.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/privategroup/list/GroupViewHolder.java @@ -41,13 +41,13 @@ class GroupViewHolder extends RecyclerView.ViewHolder { super(v); layout = (ViewGroup) v; - avatar = (TextAvatarView) v.findViewById(R.id.avatarView); - name = (TextView) v.findViewById(R.id.nameView); - creator = (TextView) v.findViewById(R.id.creatorView); - postCount = (TextView) v.findViewById(R.id.messageCountView); - date = (TextView) v.findViewById(R.id.dateView); - status = (TextView) v.findViewById(R.id.statusView); - remove = (Button) v.findViewById(R.id.removeButton); + avatar = v.findViewById(R.id.avatarView); + name = v.findViewById(R.id.nameView); + creator = v.findViewById(R.id.creatorView); + postCount = v.findViewById(R.id.messageCountView); + date = v.findViewById(R.id.dateView); + status = v.findViewById(R.id.statusView); + remove = v.findViewById(R.id.removeButton); } void bindView(Context ctx, GroupItem group, diff --git a/briar-android/src/main/java/org/briarproject/briar/android/privategroup/memberlist/GroupMemberListActivity.java b/briar-android/src/main/java/org/briarproject/briar/android/privategroup/memberlist/GroupMemberListActivity.java index e893ecf888db4a0dc48862c0e62ed22e9a9f4156..5538a26a447c91095c9a4d6581a5203dc281cb07 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/privategroup/memberlist/GroupMemberListActivity.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/privategroup/memberlist/GroupMemberListActivity.java @@ -48,13 +48,13 @@ public class GroupMemberListActivity extends BriarActivity { if (b == null) throw new IllegalStateException("No GroupId in intent."); groupId = new GroupId(b); - list = (BriarRecyclerView) findViewById(R.id.list); + list = findViewById(R.id.list); LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this); list.setLayoutManager(linearLayoutManager); adapter = new MemberListAdapter(this); list.setAdapter(adapter); - TextView info = (TextView) findViewById(R.id.info); + TextView info = findViewById(R.id.info); info.setText(R.string.sharing_status_groups); } diff --git a/briar-android/src/main/java/org/briarproject/briar/android/privategroup/memberlist/MemberListItemHolder.java b/briar-android/src/main/java/org/briarproject/briar/android/privategroup/memberlist/MemberListItemHolder.java index 4a242bcec32eab8d067cec193cbf003be08719c3..002f80db2e6f2a3a58605d4594904f4629a4be00 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/privategroup/memberlist/MemberListItemHolder.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/privategroup/memberlist/MemberListItemHolder.java @@ -22,9 +22,9 @@ class MemberListItemHolder extends RecyclerView.ViewHolder { MemberListItemHolder(View v) { super(v); - author = (AuthorView) v.findViewById(R.id.authorView); - bulb = (ImageView) v.findViewById(R.id.bulbView); - creator = (TextView) v.findViewById(R.id.creatorView); + author = v.findViewById(R.id.authorView); + bulb = v.findViewById(R.id.bulbView); + creator = v.findViewById(R.id.creatorView); } protected void bind(MemberListItem item) { diff --git a/briar-android/src/main/java/org/briarproject/briar/android/privategroup/reveal/RevealContactsActivity.java b/briar-android/src/main/java/org/briarproject/briar/android/privategroup/reveal/RevealContactsActivity.java index 79a287755bc75f1d33bdd19797c96e2abf60124a..239269e6a3a7e0ad822a1f127d5682e8dc0cdeeb 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/privategroup/reveal/RevealContactsActivity.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/privategroup/reveal/RevealContactsActivity.java @@ -52,7 +52,7 @@ public class RevealContactsActivity extends ContactSelectorActivity if (b == null) throw new IllegalStateException("No GroupId"); groupId = new GroupId(b); - button = (Button) findViewById(R.id.revealButton); + button = findViewById(R.id.revealButton); button.setOnClickListener(this); button.setEnabled(false); diff --git a/briar-android/src/main/java/org/briarproject/briar/android/privategroup/reveal/RevealableContactViewHolder.java b/briar-android/src/main/java/org/briarproject/briar/android/privategroup/reveal/RevealableContactViewHolder.java index 585e2f622be02cf34ccb20e0e64771f726f990b0..ab7777f4bdffc38789b722d627c35f4f9e40d563 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/privategroup/reveal/RevealableContactViewHolder.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/privategroup/reveal/RevealableContactViewHolder.java @@ -25,7 +25,7 @@ class RevealableContactViewHolder RevealableContactViewHolder(View v) { super(v); - icon = (ImageView) v.findViewById(R.id.visibilityView); + icon = v.findViewById(R.id.visibilityView); } @Override diff --git a/briar-android/src/main/java/org/briarproject/briar/android/reporting/DevReportActivity.java b/briar-android/src/main/java/org/briarproject/briar/android/reporting/DevReportActivity.java index 2091e65b612d6936fe9c10875ed3581c0b3513de..a25e1e41fcb728116f91a9d04e4850720fecbc8b 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/reporting/DevReportActivity.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/reporting/DevReportActivity.java @@ -90,15 +90,15 @@ public class DevReportActivity extends BaseCrashReportDialog getDelegate().setContentView(R.layout.activity_dev_report); - Toolbar tb = (Toolbar) findViewById(R.id.toolbar); + Toolbar tb = findViewById(R.id.toolbar); getDelegate().setSupportActionBar(tb); View requestReport = findViewById(R.id.request_report); - userCommentView = (EditText) findViewById(R.id.user_comment); - userEmailView = (EditText) findViewById(R.id.user_email); - includeDebugReport = (CheckBox) findViewById(R.id.include_debug_report); - chevron = (Button) findViewById(R.id.chevron); - report = (LinearLayout) findViewById(R.id.report_content); + userCommentView = findViewById(R.id.user_comment); + userEmailView = findViewById(R.id.user_email); + includeDebugReport = findViewById(R.id.include_debug_report); + chevron = findViewById(R.id.chevron); + report = findViewById(R.id.report_content); progress = findViewById(R.id.progress_wheel); //noinspection ConstantConditions @@ -262,7 +262,7 @@ public class DevReportActivity extends BaseCrashReportDialog boolean excluded = excludedFields.contains(field); View v = inflater.inflate(R.layout.list_item_crash, report, false); - CheckBox cb = (CheckBox) v + CheckBox cb = v .findViewById(R.id.include_in_report); cb.setTag(field); cb.setChecked(required || !excluded); diff --git a/briar-android/src/main/java/org/briarproject/briar/android/sharing/BaseMessageFragment.java b/briar-android/src/main/java/org/briarproject/briar/android/sharing/BaseMessageFragment.java index 026498b12facc43a1aa3e4612972e2db09ff41ee..75d999c9b00a8e2918abc51af3cd79c5fbd634dc 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/sharing/BaseMessageFragment.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/sharing/BaseMessageFragment.java @@ -40,7 +40,7 @@ public abstract class BaseMessageFragment extends BaseFragment // inflate view View v = inflater.inflate(R.layout.fragment_message, container, false); - message = (LargeTextInputView) v.findViewById(R.id.messageView); + message = v.findViewById(R.id.messageView); message.setButtonText(getString(getButtonText())); message.setHint(getHintText()); message.setListener(this); diff --git a/briar-android/src/main/java/org/briarproject/briar/android/sharing/InvitationActivity.java b/briar-android/src/main/java/org/briarproject/briar/android/sharing/InvitationActivity.java index bc755d43a32f383adb3f76968cf88bfea428ea2f..77d3b2eb354c917e1ae24a7cbf2ba8f905284546 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/sharing/InvitationActivity.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/sharing/InvitationActivity.java @@ -44,7 +44,7 @@ public abstract class InvitationActivity<I extends InvitationItem> setContentView(R.layout.list); adapter = getAdapter(this, this); - list = (BriarRecyclerView) findViewById(R.id.list); + list = findViewById(R.id.list); if (list != null) { list.setLayoutManager(new LinearLayoutManager(this)); list.setAdapter(adapter); diff --git a/briar-android/src/main/java/org/briarproject/briar/android/sharing/InvitationViewHolder.java b/briar-android/src/main/java/org/briarproject/briar/android/sharing/InvitationViewHolder.java index ef21497ce1c56832185c44791f5f21c18948ec3d..0a258b2c2506b5e2b5dcea29dec6d2b8abbf9bf8 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/sharing/InvitationViewHolder.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/sharing/InvitationViewHolder.java @@ -29,12 +29,12 @@ public class InvitationViewHolder<I extends InvitationItem> public InvitationViewHolder(View v) { super(v); - avatar = (TextAvatarView) v.findViewById(R.id.avatarView); - name = (TextView) v.findViewById(R.id.forumNameView); - sharedBy = (TextView) v.findViewById(R.id.sharedByView); - subscribed = (TextView) v.findViewById(R.id.forumSubscribedView); - accept = (Button) v.findViewById(R.id.acceptButton); - decline = (Button) v.findViewById(R.id.declineButton); + avatar = v.findViewById(R.id.avatarView); + name = v.findViewById(R.id.forumNameView); + sharedBy = v.findViewById(R.id.sharedByView); + subscribed = v.findViewById(R.id.forumSubscribedView); + accept = v.findViewById(R.id.acceptButton); + decline = v.findViewById(R.id.declineButton); } @CallSuper diff --git a/briar-android/src/main/java/org/briarproject/briar/android/sharing/SharingStatusActivity.java b/briar-android/src/main/java/org/briarproject/briar/android/sharing/SharingStatusActivity.java index efe97420574cf88f27ca2359e53a28202b183a96..6087e38e680267e6e8259a3f810777d5dad0e01a 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/sharing/SharingStatusActivity.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/sharing/SharingStatusActivity.java @@ -54,13 +54,13 @@ abstract class SharingStatusActivity extends BriarActivity { if (b == null) throw new IllegalStateException("No GroupId"); groupId = new GroupId(b); - list = (BriarRecyclerView) findViewById(R.id.list); + list = findViewById(R.id.list); adapter = new SharingStatusAdapter(this); list.setLayoutManager(new LinearLayoutManager(this)); list.setAdapter(adapter); list.setEmptyText(getString(R.string.nobody)); - TextView info = (TextView) findViewById(R.id.info); + TextView info = findViewById(R.id.info); info.setText(getInfoText()); } diff --git a/briar-android/src/main/java/org/briarproject/briar/android/threaded/BaseThreadItemViewHolder.java b/briar-android/src/main/java/org/briarproject/briar/android/threaded/BaseThreadItemViewHolder.java index aac9621a2dd2e17ab23f540c5c46f94694c40bed..0532e6a9512b22ee2cfeb1474822281760a4252d 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/threaded/BaseThreadItemViewHolder.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/threaded/BaseThreadItemViewHolder.java @@ -34,9 +34,9 @@ public abstract class BaseThreadItemViewHolder<I extends ThreadItem> public BaseThreadItemViewHolder(View v) { super(v); - layout = (ViewGroup) v.findViewById(R.id.layout); - textView = (TextView) v.findViewById(R.id.text); - author = (AuthorView) v.findViewById(R.id.author); + layout = v.findViewById(R.id.layout); + textView = v.findViewById(R.id.text); + author = v.findViewById(R.id.author); } @CallSuper diff --git a/briar-android/src/main/java/org/briarproject/briar/android/threaded/ThreadListActivity.java b/briar-android/src/main/java/org/briarproject/briar/android/threaded/ThreadListActivity.java index 2e5d62ac5867ac1e68bcfaf1c45451fe5480220b..3515459e17a0bee945855d7e5f8eb953b2ac3b22 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/threaded/ThreadListActivity.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/threaded/ThreadListActivity.java @@ -85,9 +85,9 @@ public abstract class ThreadListActivity<G extends NamedGroup, I extends ThreadI groupId = new GroupId(b); getController().setGroupId(groupId); - textInput = (TextInputView) findViewById(R.id.text_input_container); + textInput = findViewById(R.id.text_input_container); textInput.setListener(this); - list = (BriarRecyclerView) findViewById(R.id.list); + list = findViewById(R.id.list); layoutManager = new LinearLayoutManager(this); list.setLayoutManager(layoutManager); adapter = createAdapter(layoutManager); @@ -114,8 +114,8 @@ public abstract class ThreadListActivity<G extends NamedGroup, I extends ThreadI } } }); - upButton = (UnreadMessageButton) findViewById(R.id.upButton); - downButton = (UnreadMessageButton) findViewById(R.id.downButton); + upButton = findViewById(R.id.upButton); + downButton = findViewById(R.id.downButton); upButton.setOnClickListener(v -> { int position = adapter.getVisibleUnreadPosTop(); if (position != NO_POSITION) { diff --git a/briar-android/src/main/java/org/briarproject/briar/android/threaded/ThreadPostViewHolder.java b/briar-android/src/main/java/org/briarproject/briar/android/threaded/ThreadPostViewHolder.java index dbab681c588445f6953b63a6a34a0687c29e2a3c..62344474afcab2cec2891fb1190ae277c29c8c7c 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/threaded/ThreadPostViewHolder.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/threaded/ThreadPostViewHolder.java @@ -28,7 +28,7 @@ public class ThreadPostViewHolder<I extends ThreadItem> public ThreadPostViewHolder(View v) { super(v); - lvlText = (TextView) v.findViewById(R.id.nested_line_text); + lvlText = v.findViewById(R.id.nested_line_text); lvls = new View[nestedLineIds.length]; for (int i = 0; i < lvls.length; i++) { lvls[i] = v.findViewById(nestedLineIds[i]); diff --git a/briar-android/src/main/java/org/briarproject/briar/android/view/AuthorView.java b/briar-android/src/main/java/org/briarproject/briar/android/view/AuthorView.java index e4cddd8c4b1d63eeec02d4e9b540a35dc5619432..117ce12cbe32b5e5db5cd5d2dfa3a044f146ed14 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/view/AuthorView.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/view/AuthorView.java @@ -53,12 +53,12 @@ public class AuthorView extends RelativeLayout { .getSystemService(LAYOUT_INFLATER_SERVICE); inflater.inflate(R.layout.author_view, this, true); - avatar = (CircleImageView) findViewById(R.id.avatar); - avatarIcon = (ImageView) findViewById(R.id.avatarIcon); - authorName = (TextView) findViewById(R.id.authorName); + avatar = findViewById(R.id.avatar); + avatarIcon = findViewById(R.id.avatarIcon); + authorName = findViewById(R.id.authorName); authorNameTypeface = authorName.getTypeface(); - date = (TextView) findViewById(R.id.dateView); - trustIndicator = (TrustIndicatorView) findViewById(R.id.trustIndicator); + date = findViewById(R.id.dateView); + trustIndicator = findViewById(R.id.trustIndicator); TypedArray attributes = context.obtainStyledAttributes(attrs, R.styleable.AuthorView); diff --git a/briar-android/src/main/java/org/briarproject/briar/android/view/BriarRecyclerView.java b/briar-android/src/main/java/org/briarproject/briar/android/view/BriarRecyclerView.java index d90b7f2c62baeae35ba4d6d41282c8dc802fe62d..69d063bf945d52babf1d3f59139c0ad7481a8bbe 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/view/BriarRecyclerView.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/view/BriarRecyclerView.java @@ -67,9 +67,9 @@ public class BriarRecyclerView extends FrameLayout { View v = LayoutInflater.from(getContext()).inflate( R.layout.briar_recycler_view, this, true); - recyclerView = (RecyclerView) v.findViewById(R.id.recyclerView); - emptyView = (TextView) v.findViewById(R.id.emptyView); - progressBar = (ProgressBar) v.findViewById(R.id.progressBar); + recyclerView = v.findViewById(R.id.recyclerView); + emptyView = v.findViewById(R.id.emptyView); + progressBar = v.findViewById(R.id.progressBar); showProgressBar(); diff --git a/briar-android/src/main/java/org/briarproject/briar/android/view/LargeTextInputView.java b/briar-android/src/main/java/org/briarproject/briar/android/view/LargeTextInputView.java index 6b036844932e9f9e15d4eef12ced402dbca34ba7..3cdf8fff8ac67e4cc08f3101929b2e6e95b5c5d2 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/view/LargeTextInputView.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/view/LargeTextInputView.java @@ -58,8 +58,7 @@ public class LargeTextInputView extends TextInputView { if (buttonText != null) setButtonText(buttonText); if (maxLines > 0) ui.editText.setMaxLines(maxLines); if (fillHeight) { - LinearLayout layout = - (LinearLayout) findViewById(R.id.input_layout); + LinearLayout layout = findViewById(R.id.input_layout); LayoutParams params = (LayoutParams) layout.getLayoutParams(); params.height = 0; params.weight = 1; diff --git a/briar-android/src/main/java/org/briarproject/briar/android/view/TextAvatarView.java b/briar-android/src/main/java/org/briarproject/briar/android/view/TextAvatarView.java index 36ee3b4133927f8d52ebc8c0b09f96c22ceb9b4c..9d24bbe7543edfb34faf02b089c13bc99b67c34f 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/view/TextAvatarView.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/view/TextAvatarView.java @@ -33,11 +33,10 @@ public class TextAvatarView extends FrameLayout { LayoutInflater inflater = (LayoutInflater) context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); - inflater - .inflate(R.layout.text_avatar_view, this, true); - character = (AppCompatTextView) findViewById(R.id.textAvatarView); - background = (CircleImageView) findViewById(R.id.avatarBackground); - badge = (TextView) findViewById(R.id.unreadCountView); + inflater.inflate(R.layout.text_avatar_view, this, true); + character = findViewById(R.id.textAvatarView); + background = findViewById(R.id.avatarBackground); + badge = findViewById(R.id.unreadCountView); badge.setVisibility(INVISIBLE); } diff --git a/briar-android/src/main/java/org/briarproject/briar/android/view/TextInputView.java b/briar-android/src/main/java/org/briarproject/briar/android/view/TextInputView.java index ce97e11fb85e7fbc8b8995c33914e030bb46d760..bf83a61dcc2c925e4d11580d1e2364fe107093d1 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/view/TextInputView.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/view/TextInputView.java @@ -193,9 +193,9 @@ public class TextInputView extends KeyboardAwareLinearLayout final EmojiDrawer emojiDrawer; private ViewHolder() { - emojiToggle = (EmojiToggle) findViewById(R.id.emoji_toggle); - editText = (EmojiEditText) findViewById(R.id.input_text); - emojiDrawer = (EmojiDrawer) findViewById(R.id.emoji_drawer); + emojiToggle = findViewById(R.id.emoji_toggle); + editText = findViewById(R.id.input_text); + emojiDrawer = findViewById(R.id.emoji_drawer); sendButton = findViewById(R.id.btn_send); } } diff --git a/briar-android/src/main/java/org/briarproject/briar/android/view/UnreadMessageButton.java b/briar-android/src/main/java/org/briarproject/briar/android/view/UnreadMessageButton.java index 0270cfea34d2353b1fdcb90b7c8d670883ad0471..ae19023dd91ccfe32845ad5f6eb27565c32f3436 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/view/UnreadMessageButton.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/view/UnreadMessageButton.java @@ -39,8 +39,8 @@ public class UnreadMessageButton extends FrameLayout { .getSystemService(Context.LAYOUT_INFLATER_SERVICE); inflater.inflate(R.layout.unread_message_button, this, true); - fab = (FloatingActionButton) findViewById(R.id.fab); - unread = (TextView) findViewById(R.id.unreadCountView); + fab = findViewById(R.id.fab); + unread = findViewById(R.id.unreadCountView); TypedArray attributes = context.obtainStyledAttributes(attrs, R.styleable.UnreadMessageButton); diff --git a/briar-android/src/main/java/org/briarproject/briar/android/widget/LinkDialogFragment.java b/briar-android/src/main/java/org/briarproject/briar/android/widget/LinkDialogFragment.java index 075daecfc857fd32b9d096d66473f9291b1931f1..5889294db209312a1f9e97122e3e86670ca3f4ee 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/widget/LinkDialogFragment.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/widget/LinkDialogFragment.java @@ -48,7 +48,7 @@ public class LinkDialogFragment extends DialogFragment { View v = inflater.inflate(R.layout.fragment_link_dialog, container, false); - TextView urlView = (TextView) v.findViewById(R.id.urlView); + TextView urlView = v.findViewById(R.id.urlView); urlView.setText(url); // prepare normal intent or intent chooser @@ -60,13 +60,13 @@ public class LinkDialogFragment extends DialogFragment { Intent intent = choice ? Intent.createChooser(i, getString(R.string.link_warning_open_link)) : i; - Button openButton = (Button) v.findViewById(R.id.openButton); + Button openButton = v.findViewById(R.id.openButton); openButton.setOnClickListener(v1 -> { startActivity(intent); getDialog().dismiss(); }); - Button cancelButton = (Button) v.findViewById(R.id.cancelButton); + Button cancelButton = v.findViewById(R.id.cancelButton); cancelButton.setOnClickListener(v1 -> getDialog().cancel()); return v; diff --git a/briar-android/src/main/java/org/thoughtcrime/securesms/components/emoji/EmojiDrawer.java b/briar-android/src/main/java/org/thoughtcrime/securesms/components/emoji/EmojiDrawer.java index 43a1340e78889ef09fd2dac50e01e1b00c410538..7ba1810f9e7e316a94b6f409e1ba7c42792874f8 100644 --- a/briar-android/src/main/java/org/thoughtcrime/securesms/components/emoji/EmojiDrawer.java +++ b/briar-android/src/main/java/org/thoughtcrime/securesms/components/emoji/EmojiDrawer.java @@ -72,11 +72,10 @@ public class EmojiDrawer extends LinearLayout { } private void initializeResources(View v) { - this.pager = (ViewPager) v.findViewById(R.id.emoji_pager); - this.strip = (PagerSlidingTabStrip) v.findViewById(R.id.tabs); + this.pager = v.findViewById(R.id.emoji_pager); + this.strip = v.findViewById(R.id.tabs); - RepeatableImageKey backspace = - (RepeatableImageKey) v.findViewById(R.id.backspace); + RepeatableImageKey backspace = v.findViewById(R.id.backspace); backspace.setOnKeyEventListener(() -> { if (listener != null) listener.onKeyEvent(DELETE_KEY_EVENT); }); diff --git a/briar-android/src/main/java/org/thoughtcrime/securesms/components/emoji/EmojiPageView.java b/briar-android/src/main/java/org/thoughtcrime/securesms/components/emoji/EmojiPageView.java index 4b186e634f056e38ebf864c356d4992db0fe8b45..91598c381ee741e7cfe4808a3455d3c1c4599b04 100644 --- a/briar-android/src/main/java/org/thoughtcrime/securesms/components/emoji/EmojiPageView.java +++ b/briar-android/src/main/java/org/thoughtcrime/securesms/components/emoji/EmojiPageView.java @@ -35,7 +35,7 @@ public class EmojiPageView extends FrameLayout { super(context, attrs, defStyleAttr); View view = LayoutInflater.from(getContext()) .inflate(R.layout.emoji_grid_layout, this, true); - grid = (GridView) view.findViewById(R.id.emoji); + grid = view.findViewById(R.id.emoji); grid.setColumnWidth(getResources() .getDimensionPixelSize(R.dimen.emoji_drawer_size) + 2 * getResources().getDimensionPixelSize( diff --git a/briar-android/src/test/java/org/briarproject/briar/android/login/ChangePasswordActivityTest.java b/briar-android/src/test/java/org/briarproject/briar/android/login/ChangePasswordActivityTest.java index 852624f79ebd64af2b70642877624db4d352bf86..a41a949c6b5b3638ef0218a41cb71822c6b2e121 100644 --- a/briar-android/src/test/java/org/briarproject/briar/android/login/ChangePasswordActivityTest.java +++ b/briar-android/src/test/java/org/briarproject/briar/android/login/ChangePasswordActivityTest.java @@ -55,17 +55,17 @@ public class ChangePasswordActivityTest { MockitoAnnotations.initMocks(this); changePasswordActivity = Robolectric.setupActivity(TestChangePasswordActivity.class); - passwordConfirmationWrapper = (TextInputLayout) changePasswordActivity + passwordConfirmationWrapper = changePasswordActivity .findViewById(R.id.new_password_confirm_wrapper); - currentPassword = (EditText) changePasswordActivity + currentPassword = changePasswordActivity .findViewById(R.id.current_password_entry); - newPassword = (EditText) changePasswordActivity + newPassword = changePasswordActivity .findViewById(R.id.new_password_entry); - newPasswordConfirmation = (EditText) changePasswordActivity + newPasswordConfirmation = changePasswordActivity .findViewById(R.id.new_password_confirm); - strengthMeter = (StrengthMeter) changePasswordActivity + strengthMeter = changePasswordActivity .findViewById(R.id.strength_meter); - changePasswordButton = (Button) changePasswordActivity + changePasswordButton = changePasswordActivity .findViewById(R.id.change_password); } diff --git a/briar-android/src/test/java/org/briarproject/briar/android/login/PasswordFragmentTest.java b/briar-android/src/test/java/org/briarproject/briar/android/login/PasswordFragmentTest.java index 7e13211a42ea09f4fe0ebd704e293745d1d33ee3..490f2653a8a1f410648c589fced92c22e8f4a81a 100644 --- a/briar-android/src/test/java/org/briarproject/briar/android/login/PasswordFragmentTest.java +++ b/briar-android/src/test/java/org/briarproject/briar/android/login/PasswordFragmentTest.java @@ -48,12 +48,12 @@ public class PasswordFragmentTest { startFragment(passwordFragment, SetupActivity.class); View v = passwordFragment.getView(); - passwordEntry = (EditText) v.findViewById(R.id.password_entry); - passwordConfirmation = (EditText) v.findViewById(R.id.password_confirm); + passwordEntry = v.findViewById(R.id.password_entry); + passwordConfirmation = v.findViewById(R.id.password_confirm); passwordConfirmationWrapper = - (TextInputLayout) v.findViewById(R.id.password_confirm_wrapper); - strengthMeter = (StrengthMeter) v.findViewById(R.id.strength_meter); - createAccountButton = (Button) v.findViewById(R.id.next); + v.findViewById(R.id.password_confirm_wrapper); + strengthMeter = v.findViewById(R.id.strength_meter); + createAccountButton = v.findViewById(R.id.next); } @Test diff --git a/briar-android/src/test/java/org/briarproject/briar/android/login/SetupActivityTest.java b/briar-android/src/test/java/org/briarproject/briar/android/login/SetupActivityTest.java index 3f25509033d6c28b2d54624490c69001dd8e6ae8..3541d0bda324baf98f783e8caafdf4db5fb8584e 100644 --- a/briar-android/src/test/java/org/briarproject/briar/android/login/SetupActivityTest.java +++ b/briar-android/src/test/java/org/briarproject/briar/android/login/SetupActivityTest.java @@ -45,10 +45,9 @@ public class SetupActivityTest { public void setUp() { MockitoAnnotations.initMocks(this); setupActivity = Robolectric.setupActivity(SetupActivity.class); - nicknameEntryWrapper = (TextInputLayout) setupActivity - .findViewById(R.id.nickname_entry_wrapper); - nicknameEntry = - (EditText) setupActivity.findViewById(R.id.nickname_entry); + nicknameEntryWrapper = + setupActivity.findViewById(R.id.nickname_entry_wrapper); + nicknameEntry = setupActivity.findViewById(R.id.nickname_entry); } @Test