Remove redundant casts from findViewById.

This commit is contained in:
akwizgran
2017-10-11 18:22:14 +01:00
parent b56724dee5
commit 43ee3246f6
63 changed files with 218 additions and 232 deletions

View File

@@ -38,7 +38,7 @@ public class StartupFailureActivity extends BaseActivity {
} }
// show proper error message // show proper error message
TextView view = (TextView) findViewById(R.id.errorView); TextView view = findViewById(R.id.errorView);
if (result.equals(StartResult.DB_ERROR)) { if (result.equals(StartResult.DB_ERROR)) {
view.setText(getText(R.string.startup_failed_db_error)); view.setText(getText(R.string.startup_failed_db_error));
} else if (result.equals(StartResult.SERVICE_ERROR)) { } else if (result.equals(StartResult.SERVICE_ERROR)) {

View File

@@ -85,7 +85,7 @@ public abstract class BriarActivity extends BaseActivity {
@Nullable @Nullable
protected Toolbar setUpCustomToolbar(boolean ownLayout) { protected Toolbar setUpCustomToolbar(boolean ownLayout) {
// Custom Toolbar // Custom Toolbar
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar); setSupportActionBar(toolbar);
ActionBar ab = getSupportActionBar(); ActionBar ab = getSupportActionBar();
if (ab != null) { if (ab != null) {

View File

@@ -58,7 +58,7 @@ abstract class BasePostFragment extends BaseFragment {
View view = inflater.inflate(R.layout.fragment_blog_post, container, View view = inflater.inflate(R.layout.fragment_blog_post, container,
false); false);
progressBar = (ProgressBar) view.findViewById(R.id.progressBar); progressBar = view.findViewById(R.id.progressBar);
progressBar.setVisibility(VISIBLE); progressBar.setVisibility(VISIBLE);
ui = new BlogPostViewHolder(view, true, new OnBlogPostClickListener() { ui = new BlogPostViewHolder(view, true, new OnBlogPostClickListener() {
@Override @Override

View File

@@ -92,7 +92,7 @@ public class BlogFragment extends BaseFragment
View v = inflater.inflate(R.layout.fragment_blog, container, false); View v = inflater.inflate(R.layout.fragment_blog, container, false);
adapter = new BlogPostAdapter(getActivity(), this); adapter = new BlogPostAdapter(getActivity(), this);
list = (BriarRecyclerView) v.findViewById(R.id.postList); list = v.findViewById(R.id.postList);
list.setLayoutManager(new LinearLayoutManager(getActivity())); list.setLayoutManager(new LinearLayoutManager(getActivity()));
list.setAdapter(adapter); list.setAdapter(adapter);
list.showProgressBar(); list.showProgressBar();

View File

@@ -59,13 +59,12 @@ class BlogPostViewHolder extends RecyclerView.ViewHolder {
this.listener = listener; this.listener = listener;
ctx = v.getContext(); ctx = v.getContext();
layout = (ViewGroup) v.findViewById(R.id.postLayout); layout = v.findViewById(R.id.postLayout);
reblogger = (AuthorView) v.findViewById(R.id.rebloggerView); reblogger = v.findViewById(R.id.rebloggerView);
author = (AuthorView) v.findViewById(R.id.authorView); author = v.findViewById(R.id.authorView);
reblogButton = (ImageView) v.findViewById(R.id.commentView); reblogButton = v.findViewById(R.id.commentView);
body = (TextView) v.findViewById(R.id.bodyView); body = v.findViewById(R.id.bodyView);
commentContainer = commentContainer = v.findViewById(R.id.commentContainer);
(ViewGroup) v.findViewById(R.id.commentContainer);
} }
void setVisibility(int visibility) { void setVisibility(int visibility) {
@@ -135,7 +134,7 @@ class BlogPostViewHolder extends RecyclerView.ViewHolder {
ActivityOptionsCompat options = ActivityOptionsCompat options =
makeSceneTransitionAnimation((Activity) ctx, layout, makeSceneTransitionAnimation((Activity) ctx, layout,
getTransitionName(item.getId())); getTransitionName(item.getId()));
ActivityCompat.startActivity((Activity) ctx, i, ActivityCompat.startActivity(ctx, i,
options.toBundle()); options.toBundle());
} else { } else {
// work-around for android bug #224270 // work-around for android bug #224270
@@ -173,8 +172,8 @@ class BlogPostViewHolder extends RecyclerView.ViewHolder {
.inflate(R.layout.list_item_blog_comment, .inflate(R.layout.list_item_blog_comment,
commentContainer, false); commentContainer, false);
AuthorView author = (AuthorView) v.findViewById(R.id.authorView); AuthorView author = v.findViewById(R.id.authorView);
TextView body = (TextView) v.findViewById(R.id.bodyView); TextView body = v.findViewById(R.id.bodyView);
author.setAuthor(c.getAuthor()); author.setAuthor(c.getAuthor());
author.setAuthorStatus(c.getAuthorStatus()); author.setAuthorStatus(c.getAuthorStatus());

View File

@@ -77,7 +77,7 @@ public class FeedFragment extends BaseFragment implements
adapter = new BlogPostAdapter(getActivity(), this); adapter = new BlogPostAdapter(getActivity(), this);
layoutManager = new LinearLayoutManager(getActivity()); layoutManager = new LinearLayoutManager(getActivity());
list = (BriarRecyclerView) v.findViewById(R.id.postList); list = v.findViewById(R.id.postList);
list.setLayoutManager(layoutManager); list.setLayoutManager(layoutManager);
list.setAdapter(adapter); list.setAdapter(adapter);
list.setEmptyText(R.string.blogs_feed_empty_state); list.setEmptyText(R.string.blogs_feed_empty_state);

View File

@@ -154,8 +154,8 @@ public class ReblogFragment extends BaseFragment implements TextInputListener {
private final TextInputView input; private final TextInputView input;
private ViewHolder(View v) { private ViewHolder(View v) {
scrollView = (ScrollView) v.findViewById(R.id.scrollView); scrollView = v.findViewById(R.id.scrollView);
progressBar = (ProgressBar) v.findViewById(R.id.progressBar); progressBar = v.findViewById(R.id.progressBar);
post = new BlogPostViewHolder(v.findViewById(R.id.postLayout), post = new BlogPostViewHolder(v.findViewById(R.id.postLayout),
true, new OnBlogPostClickListener() { true, new OnBlogPostClickListener() {
@Override @Override
@@ -168,7 +168,7 @@ public class ReblogFragment extends BaseFragment implements TextInputListener {
// probably don't want to allow author clicks here // probably don't want to allow author clicks here
} }
}); });
input = (TextInputView) v.findViewById(R.id.inputText); input = v.findViewById(R.id.inputText);
} }
} }
} }

View File

@@ -104,13 +104,13 @@ class RssFeedAdapter extends BriarAdapter<Feed, RssFeedAdapter.FeedViewHolder> {
super(v); super(v);
layout = v; layout = v;
title = (TextView) v.findViewById(R.id.titleView); title = v.findViewById(R.id.titleView);
delete = (ImageButton) v.findViewById(R.id.deleteButton); delete = v.findViewById(R.id.deleteButton);
imported = (TextView) v.findViewById(R.id.importedView); imported = v.findViewById(R.id.importedView);
updated = (TextView) v.findViewById(R.id.updatedView); updated = v.findViewById(R.id.updatedView);
author = (TextView) v.findViewById(R.id.authorView); author = v.findViewById(R.id.authorView);
authorLabel = (TextView) v.findViewById(R.id.author); authorLabel = v.findViewById(R.id.author);
description = (TextView) v.findViewById(R.id.descriptionView); description = v.findViewById(R.id.descriptionView);
} }
} }

View File

@@ -54,7 +54,7 @@ public class RssFeedImportActivity extends BriarActivity {
setContentView(R.layout.activity_rss_feed_import); setContentView(R.layout.activity_rss_feed_import);
urlInput = (EditText) findViewById(R.id.urlInput); urlInput = findViewById(R.id.urlInput);
urlInput.addTextChangedListener(new TextWatcher() { urlInput.addTextChangedListener(new TextWatcher() {
@Override @Override
public void beforeTextChanged(CharSequence s, int start, int count, 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()); importButton.setOnClickListener(v -> publish());
progressBar = (ProgressBar) findViewById(R.id.progressBar); progressBar = findViewById(R.id.progressBar);
} }
@Override @Override

View File

@@ -49,7 +49,7 @@ public class RssFeedManageActivity extends BriarActivity
adapter = new RssFeedAdapter(this, this); adapter = new RssFeedAdapter(this, this);
list = (BriarRecyclerView) findViewById(R.id.feedList); list = findViewById(R.id.feedList);
list.setLayoutManager(new LinearLayoutManager(this)); list.setLayoutManager(new LinearLayoutManager(this));
list.setAdapter(adapter); list.setAdapter(adapter);
} }

View File

@@ -69,7 +69,7 @@ public class WriteBlogPostActivity extends BriarActivity
setContentView(R.layout.activity_write_blog_post); setContentView(R.layout.activity_write_blog_post);
input = (TextInputView) findViewById(R.id.bodyInput); input = findViewById(R.id.bodyInput);
input.setSendButtonEnabled(false); input.setSendButtonEnabled(false);
input.addTextChangedListener(new TextWatcher() { input.addTextChangedListener(new TextWatcher() {
@Override @Override
@@ -89,7 +89,7 @@ public class WriteBlogPostActivity extends BriarActivity
}); });
input.setListener(this); input.setListener(this);
progressBar = (ProgressBar) findViewById(R.id.progressBar); progressBar = findViewById(R.id.progressBar);
} }
@Override @Override

View File

@@ -31,10 +31,10 @@ public class ContactItemViewHolder<I extends ContactItem>
super(v); super(v);
layout = (ViewGroup) v; layout = (ViewGroup) v;
avatar = (ImageView) v.findViewById(R.id.avatarView); avatar = v.findViewById(R.id.avatarView);
name = (TextView) v.findViewById(R.id.nameView); name = v.findViewById(R.id.nameView);
// this can be null as not all layouts that use this ViewHolder have it // 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) { protected void bind(I item, @Nullable OnContactClickListener<I> listener) {

View File

@@ -143,7 +143,7 @@ public class ContactListFragment extends BaseFragment implements EventListener {
} }
}; };
adapter = new ContactListAdapter(getContext(), onContactClickListener); adapter = new ContactListAdapter(getContext(), onContactClickListener);
list = (BriarRecyclerView) contentView.findViewById(R.id.list); list = contentView.findViewById(R.id.list);
list.setLayoutManager(new LinearLayoutManager(getContext())); list.setLayoutManager(new LinearLayoutManager(getContext()));
list.setAdapter(adapter); list.setAdapter(adapter);
list.setEmptyText(getString(R.string.no_contacts)); list.setEmptyText(getString(R.string.no_contacts));

View File

@@ -24,8 +24,8 @@ class ContactListItemViewHolder extends ContactItemViewHolder<ContactListItem> {
ContactListItemViewHolder(View v) { ContactListItemViewHolder(View v) {
super(v); super(v);
unread = (TextView) v.findViewById(R.id.unreadCountView); unread = v.findViewById(R.id.unreadCountView);
date = (TextView) v.findViewById(R.id.dateView); date = v.findViewById(R.id.dateView);
} }
@Override @Override

View File

@@ -14,7 +14,6 @@ import android.util.SparseArray;
import android.view.Menu; import android.view.Menu;
import android.view.MenuInflater; import android.view.MenuInflater;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View; import android.view.View;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
@@ -100,7 +99,7 @@ import javax.inject.Inject;
import de.hdodenhof.circleimageview.CircleImageView; import de.hdodenhof.circleimageview.CircleImageView;
import im.delight.android.identicons.IdenticonDrawable; import im.delight.android.identicons.IdenticonDrawable;
import uk.co.samuelwall.materialtaptargetprompt.MaterialTapTargetPrompt; 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.v4.view.ViewCompat.setTransitionName;
import static android.support.v7.util.SortedList.INVALID_POSITION; 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.getAvatarTransitionName;
import static org.briarproject.briar.android.util.UiUtils.getBulbTransitionName; import static org.briarproject.briar.android.util.UiUtils.getBulbTransitionName;
import static org.briarproject.briar.api.messaging.MessagingConstants.MAX_PRIVATE_MESSAGE_BODY_LENGTH; 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 @MethodsNotNullByDefault
@ParametersNotNullByDefault @ParametersNotNullByDefault
@@ -199,23 +200,21 @@ public class ConversationActivity extends BriarActivity
// Custom Toolbar // Custom Toolbar
toolbar = setUpCustomToolbar(true); toolbar = setUpCustomToolbar(true);
if (toolbar != null) { if (toolbar != null) {
toolbarAvatar = toolbarAvatar = toolbar.findViewById(R.id.contactAvatar);
(CircleImageView) toolbar.findViewById(R.id.contactAvatar); toolbarStatus = toolbar.findViewById(R.id.contactStatus);
toolbarStatus = toolbarTitle = toolbar.findViewById(R.id.contactName);
(ImageView) toolbar.findViewById(R.id.contactStatus);
toolbarTitle = (TextView) toolbar.findViewById(R.id.contactName);
} }
setTransitionName(toolbarAvatar, getAvatarTransitionName(contactId)); setTransitionName(toolbarAvatar, getAvatarTransitionName(contactId));
setTransitionName(toolbarStatus, getBulbTransitionName(contactId)); setTransitionName(toolbarStatus, getBulbTransitionName(contactId));
adapter = new ConversationAdapter(this, this); adapter = new ConversationAdapter(this, this);
list = (BriarRecyclerView) findViewById(R.id.conversationView); list = findViewById(R.id.conversationView);
list.setLayoutManager(new LinearLayoutManager(this)); list.setLayoutManager(new LinearLayoutManager(this));
list.setAdapter(adapter); list.setAdapter(adapter);
list.setEmptyText(getString(R.string.no_private_messages)); 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); textInputView.setListener(this);
} }
@@ -393,7 +392,7 @@ public class ConversationActivity extends BriarActivity
/** /**
* Creates ConversationItems from headers loaded from the database. * Creates ConversationItems from headers loaded from the database.
* * <p>
* Attention: Call this only after contactName has been initialized. * Attention: Call this only after contactName has been initialized.
*/ */
@SuppressWarnings("ConstantConditions") @SuppressWarnings("ConstantConditions")
@@ -562,6 +561,7 @@ public class ConversationActivity extends BriarActivity
addConversationItem(item); addConversationItem(item);
}); });
} }
@Override @Override
public void onFailure(Throwable exception) { public void onFailure(Throwable exception) {
runOnUiThreadUnlessDestroyed( runOnUiThreadUnlessDestroyed(
@@ -580,6 +580,7 @@ public class ConversationActivity extends BriarActivity
addConversationItem(item); addConversationItem(item);
}); });
} }
@Override @Override
public void onFailure(Throwable exception) { public void onFailure(Throwable exception) {
runOnUiThreadUnlessDestroyed( runOnUiThreadUnlessDestroyed(
@@ -598,6 +599,7 @@ public class ConversationActivity extends BriarActivity
addConversationItem(item); addConversationItem(item);
}); });
} }
@Override @Override
public void onFailure(Throwable exception) { public void onFailure(Throwable exception) {
runOnUiThreadUnlessDestroyed( runOnUiThreadUnlessDestroyed(
@@ -616,6 +618,7 @@ public class ConversationActivity extends BriarActivity
addConversationItem(item); addConversationItem(item);
}); });
} }
@Override @Override
public void onFailure(Throwable exception) { public void onFailure(Throwable exception) {
runOnUiThreadUnlessDestroyed( runOnUiThreadUnlessDestroyed(
@@ -778,25 +781,25 @@ public class ConversationActivity extends BriarActivity
return; return;
} }
OnHidePromptListener listener = new OnHidePromptListener() { PromptStateChangeListener listener = new PromptStateChangeListener() {
@Override @Override
public void onHidePrompt(MotionEvent motionEvent, public void onPromptStateChanged(
boolean focalClicked) { MaterialTapTargetPrompt prompt, int state) {
introductionOnboardingSeen(); 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();
}); });
} }

View File

@@ -22,9 +22,9 @@ class ConversationItemViewHolder extends ViewHolder {
ConversationItemViewHolder(View v) { ConversationItemViewHolder(View v) {
super(v); super(v);
layout = (ViewGroup) v.findViewById(R.id.layout); layout = v.findViewById(R.id.layout);
text = (TextView) v.findViewById(R.id.text); text = v.findViewById(R.id.text);
time = (TextView) v.findViewById(R.id.time); time = v.findViewById(R.id.time);
} }
@CallSuper @CallSuper

View File

@@ -19,7 +19,7 @@ class ConversationNoticeInViewHolder extends ConversationItemViewHolder {
ConversationNoticeInViewHolder(View v) { ConversationNoticeInViewHolder(View v) {
super(v); super(v);
msgText = (TextView) v.findViewById(R.id.msgText); msgText = v.findViewById(R.id.msgText);
} }
@Override @Override

View File

@@ -19,7 +19,7 @@ class ConversationNoticeOutViewHolder extends ConversationOutItemViewHolder {
ConversationNoticeOutViewHolder(View v) { ConversationNoticeOutViewHolder(View v) {
super(v); super(v);
msgText = (TextView) v.findViewById(R.id.msgText); msgText = v.findViewById(R.id.msgText);
} }
@Override @Override

View File

@@ -16,7 +16,7 @@ abstract class ConversationOutItemViewHolder
ConversationOutItemViewHolder(View v) { ConversationOutItemViewHolder(View v) {
super(v); super(v);
status = (ImageView) v.findViewById(R.id.status); status = v.findViewById(R.id.status);
} }
@Override @Override

View File

@@ -20,8 +20,8 @@ class ConversationRequestViewHolder extends ConversationNoticeInViewHolder {
ConversationRequestViewHolder(View v) { ConversationRequestViewHolder(View v) {
super(v); super(v);
acceptButton = (Button) v.findViewById(R.id.acceptButton); acceptButton = v.findViewById(R.id.acceptButton);
declineButton = (Button) v.findViewById(R.id.declineButton); declineButton = v.findViewById(R.id.declineButton);
} }
void bind(ConversationItem conversationItem, void bind(ConversationItem conversationItem,

View File

@@ -67,7 +67,7 @@ public abstract class BaseContactSelectorFragment<I extends SelectableContactIte
View contentView = inflater.inflate(R.layout.list, container, false); 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.setLayoutManager(new LinearLayoutManager(getActivity()));
list.setEmptyText(getString(R.string.no_contacts_selector)); list.setEmptyText(getString(R.string.no_contacts_selector));
adapter = getAdapter(getContext(), this); adapter = getAdapter(getContext(), this);

View File

@@ -24,8 +24,8 @@ public class BaseSelectableContactHolder<I extends SelectableContactItem>
public BaseSelectableContactHolder(View v) { public BaseSelectableContactHolder(View v) {
super(v); super(v);
checkBox = (CheckBox) v.findViewById(R.id.checkBox); checkBox = v.findViewById(R.id.checkBox);
info = (TextView) v.findViewById(R.id.infoView); info = v.findViewById(R.id.infoView);
} }
@Override @Override

View File

@@ -54,9 +54,8 @@ public class CreateForumActivity extends BriarActivity {
setContentView(R.layout.activity_create_forum); setContentView(R.layout.activity_create_forum);
nameEntryLayout = nameEntryLayout = findViewById(R.id.createForumNameLayout);
(TextInputLayout) findViewById(R.id.createForumNameLayout); nameEntry = findViewById(R.id.createForumNameEntry);
nameEntry = (EditText) findViewById(R.id.createForumNameEntry);
nameEntry.addTextChangedListener(new TextWatcher() { nameEntry.addTextChangedListener(new TextWatcher() {
@Override @Override
@@ -79,10 +78,10 @@ public class CreateForumActivity extends BriarActivity {
return true; return true;
}); });
createForumButton = (Button) findViewById(R.id.createForumButton); createForumButton = findViewById(R.id.createForumButton);
createForumButton.setOnClickListener(v -> createForum()); createForumButton.setOnClickListener(v -> createForum());
progress = (ProgressBar) findViewById(R.id.createForumProgressBar); progress = findViewById(R.id.createForumProgressBar);
} }
@Override @Override

View File

@@ -133,10 +133,10 @@ class ForumListAdapter
super(v); super(v);
layout = (ViewGroup) v; layout = (ViewGroup) v;
avatar = (TextAvatarView) v.findViewById(R.id.avatarView); avatar = v.findViewById(R.id.avatarView);
name = (TextView) v.findViewById(R.id.forumNameView); name = v.findViewById(R.id.forumNameView);
postCount = (TextView) v.findViewById(R.id.postCountView); postCount = v.findViewById(R.id.postCountView);
date = (TextView) v.findViewById(R.id.dateView); date = v.findViewById(R.id.dateView);
} }
} }
} }

View File

@@ -92,7 +92,7 @@ public class ForumListFragment extends BaseEventFragment implements
adapter = new ForumListAdapter(getActivity()); adapter = new ForumListAdapter(getActivity());
list = (BriarRecyclerView) contentView.findViewById(R.id.forumList); list = contentView.findViewById(R.id.forumList);
list.setLayoutManager(new LinearLayoutManager(getActivity())); list.setLayoutManager(new LinearLayoutManager(getActivity()));
list.setAdapter(adapter); list.setAdapter(adapter);
list.setEmptyText(getString(R.string.no_forums)); list.setEmptyText(getString(R.string.no_forums));

View File

@@ -78,7 +78,7 @@ public class ContactChooserFragment extends BaseFragment {
}; };
adapter = new ContactListAdapter(getActivity(), onContactClickListener); adapter = new ContactListAdapter(getActivity(), onContactClickListener);
list = (BriarRecyclerView) contentView.findViewById(R.id.list); list = contentView.findViewById(R.id.list);
list.setLayoutManager(new LinearLayoutManager(getActivity())); list.setLayoutManager(new LinearLayoutManager(getActivity()));
list.setAdapter(adapter); list.setAdapter(adapter);
list.setEmptyText(getString(R.string.no_contacts)); list.setEmptyText(getString(R.string.no_contacts));

View File

@@ -211,13 +211,12 @@ public class IntroductionMessageFragment extends BaseFragment
private final TextInputView message; private final TextInputView message;
private ViewHolder(View v) { private ViewHolder(View v) {
progressBar = (ProgressBar) v.findViewById(R.id.progressBar); progressBar = v.findViewById(R.id.progressBar);
avatar1 = (CircleImageView) v.findViewById(R.id.avatarContact1); avatar1 = v.findViewById(R.id.avatarContact1);
avatar2 = (CircleImageView) v.findViewById(R.id.avatarContact2); avatar2 = v.findViewById(R.id.avatarContact2);
contactName1 = (TextView) v.findViewById(R.id.nameContact1); contactName1 = v.findViewById(R.id.nameContact1);
contactName2 = (TextView) v.findViewById(R.id.nameContact2); contactName2 = v.findViewById(R.id.nameContact2);
message = (TextInputView) v message = v.findViewById(R.id.introductionMessageView);
.findViewById(R.id.introductionMessageView);
} }
} }
} }

View File

@@ -63,7 +63,7 @@ public class IntroFragment extends BaseFragment {
View v = inflater.inflate(R.layout.fragment_keyagreement_id, container, View v = inflater.inflate(R.layout.fragment_keyagreement_id, container,
false); false);
scrollView = (ScrollView) v.findViewById(R.id.scrollView); scrollView = v.findViewById(R.id.scrollView);
View button = v.findViewById(R.id.continueButton); View button = v.findViewById(R.id.continueButton);
button.setOnClickListener(view -> screenSeenListener.showNextScreen()); button.setOnClickListener(view -> screenSeenListener.showNextScreen());
return v; return v;

View File

@@ -75,7 +75,7 @@ public class KeyAgreementActivity extends BriarActivity implements
super.onCreate(state); super.onCreate(state);
setContentView(R.layout.activity_fragment_container_toolbar); setContentView(R.layout.activity_fragment_container_toolbar);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar); setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);

View File

@@ -124,14 +124,12 @@ public class ShowQrCodeFragment extends BaseEventFragment
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, 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); statusView = view.findViewById(R.id.status_container);
status = (TextView) view.findViewById(R.id.connect_status); status = view.findViewById(R.id.connect_status);
qrCode = (ImageView) view.findViewById(R.id.qr_code); qrCode = view.findViewById(R.id.qr_code);
mainProgressTitle = mainProgressTitle = view.findViewById(R.id.title_progress_bar);
(TextView) view.findViewById(R.id.title_progress_bar); mainProgressContainer = view.findViewById(R.id.container_progress);
mainProgressContainer =
(ViewGroup) view.findViewById(R.id.container_progress);
} }
@Override @Override

View File

@@ -35,11 +35,9 @@ public class AuthorNameFragment extends SetupFragment {
getActivity().setTitle(getString(R.string.setup_title)); getActivity().setTitle(getString(R.string.setup_title));
View v = inflater.inflate(R.layout.fragment_setup_author_name, View v = inflater.inflate(R.layout.fragment_setup_author_name,
container, false); container, false);
authorNameWrapper = authorNameWrapper = v.findViewById(R.id.nickname_entry_wrapper);
(TextInputLayout) v.findViewById(R.id.nickname_entry_wrapper); authorNameInput = v.findViewById(R.id.nickname_entry);
authorNameInput = nextButton = v.findViewById(R.id.next);
(TextInputEditText) v.findViewById(R.id.nickname_entry);
nextButton = (Button) v.findViewById(R.id.next);
authorNameInput.addTextChangedListener(this); authorNameInput.addTextChangedListener(this);
nextButton.setOnClickListener(this); nextButton.setOnClickListener(this);

View File

@@ -49,20 +49,16 @@ public class ChangePasswordActivity extends BaseActivity
setContentView(R.layout.activity_change_password); setContentView(R.layout.activity_change_password);
currentPasswordEntryWrapper = currentPasswordEntryWrapper =
(TextInputLayout) findViewById( findViewById(R.id.current_password_entry_wrapper);
R.id.current_password_entry_wrapper); newPasswordEntryWrapper = findViewById(R.id.new_password_entry_wrapper);
newPasswordEntryWrapper =
(TextInputLayout) findViewById(R.id.new_password_entry_wrapper);
newPasswordConfirmationWrapper = newPasswordConfirmationWrapper =
(TextInputLayout) findViewById( findViewById(R.id.new_password_confirm_wrapper);
R.id.new_password_confirm_wrapper); currentPassword = findViewById(R.id.current_password_entry);
currentPassword = (EditText) findViewById(R.id.current_password_entry); newPassword = findViewById(R.id.new_password_entry);
newPassword = (EditText) findViewById(R.id.new_password_entry); newPasswordConfirmation = findViewById(R.id.new_password_confirm);
newPasswordConfirmation = strengthMeter = findViewById(R.id.strength_meter);
(EditText) findViewById(R.id.new_password_confirm); changePasswordButton = findViewById(R.id.change_password);
strengthMeter = (StrengthMeter) findViewById(R.id.strength_meter); progress = findViewById(R.id.progress_wheel);
changePasswordButton = (Button) findViewById(R.id.change_password);
progress = (ProgressBar) findViewById(R.id.progress_wheel);
TextWatcher tw = new TextWatcher() { TextWatcher tw = new TextWatcher() {

View File

@@ -37,8 +37,8 @@ public class DozeFragment extends SetupFragment {
getActivity().setTitle(getString(R.string.setup_doze_title)); getActivity().setTitle(getString(R.string.setup_doze_title));
View v = inflater.inflate(R.layout.fragment_setup_doze, container, View v = inflater.inflate(R.layout.fragment_setup_doze, container,
false); false);
dozeButton = (Button) v.findViewById(R.id.dozeButton); dozeButton = v.findViewById(R.id.dozeButton);
progressBar = (ProgressBar) v.findViewById(R.id.progress); progressBar = v.findViewById(R.id.progress);
dozeButton.setOnClickListener(view -> askForDozeWhitelisting()); dozeButton.setOnClickListener(view -> askForDozeWhitelisting());

View File

@@ -53,10 +53,10 @@ public class PasswordActivity extends BaseActivity {
} }
setContentView(R.layout.activity_password); setContentView(R.layout.activity_password);
signInButton = (Button) findViewById(R.id.btn_sign_in); signInButton = findViewById(R.id.btn_sign_in);
progress = (ProgressBar) findViewById(R.id.progress_wheel); progress = findViewById(R.id.progress_wheel);
input = (TextInputLayout) findViewById(R.id.password_layout); input = findViewById(R.id.password_layout);
password = (EditText) findViewById(R.id.edit_password); password = findViewById(R.id.edit_password);
password.setOnEditorActionListener((v, actionId, event) -> { password.setOnEditorActionListener((v, actionId, event) -> {
validatePassword(); validatePassword();
return true; return true;

View File

@@ -40,16 +40,14 @@ public class PasswordFragment extends SetupFragment {
View v = inflater.inflate(R.layout.fragment_setup_password, container, View v = inflater.inflate(R.layout.fragment_setup_password, container,
false); false);
strengthMeter = (StrengthMeter) v.findViewById(R.id.strength_meter); strengthMeter = v.findViewById(R.id.strength_meter);
passwordEntryWrapper = passwordEntryWrapper = v.findViewById(R.id.password_entry_wrapper);
(TextInputLayout) v.findViewById(R.id.password_entry_wrapper); passwordEntry = v.findViewById(R.id.password_entry);
passwordEntry = (TextInputEditText) v.findViewById(R.id.password_entry);
passwordConfirmationWrapper = passwordConfirmationWrapper =
(TextInputLayout) v.findViewById(R.id.password_confirm_wrapper); v.findViewById(R.id.password_confirm_wrapper);
passwordConfirmation = passwordConfirmation = v.findViewById(R.id.password_confirm);
(TextInputEditText) v.findViewById(R.id.password_confirm); nextButton = v.findViewById(R.id.next);
nextButton = (Button) v.findViewById(R.id.next); progressBar = v.findViewById(R.id.progress);
progressBar = (ProgressBar) v.findViewById(R.id.progress);
passwordEntry.addTextChangedListener(this); passwordEntry.addTextChangedListener(this);
passwordConfirmation.addTextChangedListener(this); passwordConfirmation.addTextChangedListener(this);

View File

@@ -113,10 +113,10 @@ public class NavDrawerActivity extends BriarActivity implements
exitIfStartupFailed(getIntent()); exitIfStartupFailed(getIntent());
setContentView(R.layout.activity_nav_drawer); setContentView(R.layout.activity_nav_drawer);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); Toolbar toolbar = findViewById(R.id.toolbar);
drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); drawerLayout = findViewById(R.id.drawer_layout);
navigation = (NavigationView) findViewById(R.id.navigation); navigation = findViewById(R.id.navigation);
GridView transportsView = (GridView) findViewById(R.id.transportsView); GridView transportsView = findViewById(R.id.transportsView);
setSupportActionBar(toolbar); setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
@@ -282,12 +282,12 @@ public class NavDrawerActivity extends BriarActivity implements
if (daysUntilExpiry < 0) signOut(); if (daysUntilExpiry < 0) signOut();
// show expiry warning text // show expiry warning text
ViewGroup expiryWarning = (ViewGroup) findViewById(R.id.expiryWarning); ViewGroup expiryWarning = findViewById(R.id.expiryWarning);
TextView expiryWarningText = TextView expiryWarningText =
(TextView) expiryWarning.findViewById(R.id.expiryWarningText); expiryWarning.findViewById(R.id.expiryWarningText);
// make close button functional // make close button functional
ImageView expiryWarningClose = ImageView expiryWarningClose =
(ImageView) expiryWarning.findViewById(R.id.expiryWarningClose); expiryWarning.findViewById(R.id.expiryWarningClose);
// show a different snackbar in green if this is an update // show a different snackbar in green if this is an update
if (expiry == UPDATE) { if (expiry == UPDATE) {
@@ -388,12 +388,12 @@ public class NavDrawerActivity extends BriarActivity implements
android.R.color.tertiary_text_light); android.R.color.tertiary_text_light);
} }
ImageView icon = (ImageView) view.findViewById(R.id.imageView); ImageView icon = view.findViewById(R.id.imageView);
icon.setImageDrawable(ContextCompat icon.setImageDrawable(ContextCompat
.getDrawable(NavDrawerActivity.this, t.iconId)); .getDrawable(NavDrawerActivity.this, t.iconId));
icon.setColorFilter(c); icon.setColorFilter(c);
TextView text = (TextView) view.findViewById(R.id.textView); TextView text = view.findViewById(R.id.textView);
text.setText(getString(t.textId)); text.setText(getString(t.textId));
return view; return view;

View File

@@ -43,7 +43,7 @@ public class CreateGroupFragment extends BaseFragment {
View v = inflater.inflate(R.layout.fragment_create_group, container, View v = inflater.inflate(R.layout.fragment_create_group, container,
false); false);
nameEntry = (EditText) v.findViewById(R.id.name); nameEntry = v.findViewById(R.id.name);
nameEntry.addTextChangedListener(new TextWatcher() { nameEntry.addTextChangedListener(new TextWatcher() {
@Override @Override
@@ -66,12 +66,12 @@ public class CreateGroupFragment extends BaseFragment {
return true; 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()); createGroupButton.setOnClickListener(v1 -> createGroup());
progress = (ProgressBar) v.findViewById(R.id.progressBar); progress = v.findViewById(R.id.progressBar);
return v; return v;
} }

View File

@@ -68,7 +68,7 @@ public class GroupListFragment extends BaseFragment implements
View v = inflater.inflate(R.layout.list, container, false); View v = inflater.inflate(R.layout.list, container, false);
adapter = new GroupListAdapter(getContext(), this); 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.setEmptyText(R.string.groups_list_empty);
list.setLayoutManager(new LinearLayoutManager(getContext())); list.setLayoutManager(new LinearLayoutManager(getContext()));
list.setAdapter(adapter); list.setAdapter(adapter);

View File

@@ -41,13 +41,13 @@ class GroupViewHolder extends RecyclerView.ViewHolder {
super(v); super(v);
layout = (ViewGroup) v; layout = (ViewGroup) v;
avatar = (TextAvatarView) v.findViewById(R.id.avatarView); avatar = v.findViewById(R.id.avatarView);
name = (TextView) v.findViewById(R.id.nameView); name = v.findViewById(R.id.nameView);
creator = (TextView) v.findViewById(R.id.creatorView); creator = v.findViewById(R.id.creatorView);
postCount = (TextView) v.findViewById(R.id.messageCountView); postCount = v.findViewById(R.id.messageCountView);
date = (TextView) v.findViewById(R.id.dateView); date = v.findViewById(R.id.dateView);
status = (TextView) v.findViewById(R.id.statusView); status = v.findViewById(R.id.statusView);
remove = (Button) v.findViewById(R.id.removeButton); remove = v.findViewById(R.id.removeButton);
} }
void bindView(Context ctx, GroupItem group, void bindView(Context ctx, GroupItem group,

View File

@@ -48,13 +48,13 @@ public class GroupMemberListActivity extends BriarActivity {
if (b == null) throw new IllegalStateException("No GroupId in intent."); if (b == null) throw new IllegalStateException("No GroupId in intent.");
groupId = new GroupId(b); groupId = new GroupId(b);
list = (BriarRecyclerView) findViewById(R.id.list); list = findViewById(R.id.list);
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this); LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
list.setLayoutManager(linearLayoutManager); list.setLayoutManager(linearLayoutManager);
adapter = new MemberListAdapter(this); adapter = new MemberListAdapter(this);
list.setAdapter(adapter); list.setAdapter(adapter);
TextView info = (TextView) findViewById(R.id.info); TextView info = findViewById(R.id.info);
info.setText(R.string.sharing_status_groups); info.setText(R.string.sharing_status_groups);
} }

View File

@@ -22,9 +22,9 @@ class MemberListItemHolder extends RecyclerView.ViewHolder {
MemberListItemHolder(View v) { MemberListItemHolder(View v) {
super(v); super(v);
author = (AuthorView) v.findViewById(R.id.authorView); author = v.findViewById(R.id.authorView);
bulb = (ImageView) v.findViewById(R.id.bulbView); bulb = v.findViewById(R.id.bulbView);
creator = (TextView) v.findViewById(R.id.creatorView); creator = v.findViewById(R.id.creatorView);
} }
protected void bind(MemberListItem item) { protected void bind(MemberListItem item) {

View File

@@ -52,7 +52,7 @@ public class RevealContactsActivity extends ContactSelectorActivity
if (b == null) throw new IllegalStateException("No GroupId"); if (b == null) throw new IllegalStateException("No GroupId");
groupId = new GroupId(b); groupId = new GroupId(b);
button = (Button) findViewById(R.id.revealButton); button = findViewById(R.id.revealButton);
button.setOnClickListener(this); button.setOnClickListener(this);
button.setEnabled(false); button.setEnabled(false);

View File

@@ -25,7 +25,7 @@ class RevealableContactViewHolder
RevealableContactViewHolder(View v) { RevealableContactViewHolder(View v) {
super(v); super(v);
icon = (ImageView) v.findViewById(R.id.visibilityView); icon = v.findViewById(R.id.visibilityView);
} }
@Override @Override

View File

@@ -90,15 +90,15 @@ public class DevReportActivity extends BaseCrashReportDialog
getDelegate().setContentView(R.layout.activity_dev_report); getDelegate().setContentView(R.layout.activity_dev_report);
Toolbar tb = (Toolbar) findViewById(R.id.toolbar); Toolbar tb = findViewById(R.id.toolbar);
getDelegate().setSupportActionBar(tb); getDelegate().setSupportActionBar(tb);
View requestReport = findViewById(R.id.request_report); View requestReport = findViewById(R.id.request_report);
userCommentView = (EditText) findViewById(R.id.user_comment); userCommentView = findViewById(R.id.user_comment);
userEmailView = (EditText) findViewById(R.id.user_email); userEmailView = findViewById(R.id.user_email);
includeDebugReport = (CheckBox) findViewById(R.id.include_debug_report); includeDebugReport = findViewById(R.id.include_debug_report);
chevron = (Button) findViewById(R.id.chevron); chevron = findViewById(R.id.chevron);
report = (LinearLayout) findViewById(R.id.report_content); report = findViewById(R.id.report_content);
progress = findViewById(R.id.progress_wheel); progress = findViewById(R.id.progress_wheel);
//noinspection ConstantConditions //noinspection ConstantConditions
@@ -262,7 +262,7 @@ public class DevReportActivity extends BaseCrashReportDialog
boolean excluded = excludedFields.contains(field); boolean excluded = excludedFields.contains(field);
View v = inflater.inflate(R.layout.list_item_crash, View v = inflater.inflate(R.layout.list_item_crash,
report, false); report, false);
CheckBox cb = (CheckBox) v CheckBox cb = v
.findViewById(R.id.include_in_report); .findViewById(R.id.include_in_report);
cb.setTag(field); cb.setTag(field);
cb.setChecked(required || !excluded); cb.setChecked(required || !excluded);

View File

@@ -40,7 +40,7 @@ public abstract class BaseMessageFragment extends BaseFragment
// inflate view // inflate view
View v = inflater.inflate(R.layout.fragment_message, container, View v = inflater.inflate(R.layout.fragment_message, container,
false); false);
message = (LargeTextInputView) v.findViewById(R.id.messageView); message = v.findViewById(R.id.messageView);
message.setButtonText(getString(getButtonText())); message.setButtonText(getString(getButtonText()));
message.setHint(getHintText()); message.setHint(getHintText());
message.setListener(this); message.setListener(this);

View File

@@ -44,7 +44,7 @@ public abstract class InvitationActivity<I extends InvitationItem>
setContentView(R.layout.list); setContentView(R.layout.list);
adapter = getAdapter(this, this); adapter = getAdapter(this, this);
list = (BriarRecyclerView) findViewById(R.id.list); list = findViewById(R.id.list);
if (list != null) { if (list != null) {
list.setLayoutManager(new LinearLayoutManager(this)); list.setLayoutManager(new LinearLayoutManager(this));
list.setAdapter(adapter); list.setAdapter(adapter);

View File

@@ -29,12 +29,12 @@ public class InvitationViewHolder<I extends InvitationItem>
public InvitationViewHolder(View v) { public InvitationViewHolder(View v) {
super(v); super(v);
avatar = (TextAvatarView) v.findViewById(R.id.avatarView); avatar = v.findViewById(R.id.avatarView);
name = (TextView) v.findViewById(R.id.forumNameView); name = v.findViewById(R.id.forumNameView);
sharedBy = (TextView) v.findViewById(R.id.sharedByView); sharedBy = v.findViewById(R.id.sharedByView);
subscribed = (TextView) v.findViewById(R.id.forumSubscribedView); subscribed = v.findViewById(R.id.forumSubscribedView);
accept = (Button) v.findViewById(R.id.acceptButton); accept = v.findViewById(R.id.acceptButton);
decline = (Button) v.findViewById(R.id.declineButton); decline = v.findViewById(R.id.declineButton);
} }
@CallSuper @CallSuper

View File

@@ -54,13 +54,13 @@ abstract class SharingStatusActivity extends BriarActivity {
if (b == null) throw new IllegalStateException("No GroupId"); if (b == null) throw new IllegalStateException("No GroupId");
groupId = new GroupId(b); groupId = new GroupId(b);
list = (BriarRecyclerView) findViewById(R.id.list); list = findViewById(R.id.list);
adapter = new SharingStatusAdapter(this); adapter = new SharingStatusAdapter(this);
list.setLayoutManager(new LinearLayoutManager(this)); list.setLayoutManager(new LinearLayoutManager(this));
list.setAdapter(adapter); list.setAdapter(adapter);
list.setEmptyText(getString(R.string.nobody)); list.setEmptyText(getString(R.string.nobody));
TextView info = (TextView) findViewById(R.id.info); TextView info = findViewById(R.id.info);
info.setText(getInfoText()); info.setText(getInfoText());
} }

View File

@@ -34,9 +34,9 @@ public abstract class BaseThreadItemViewHolder<I extends ThreadItem>
public BaseThreadItemViewHolder(View v) { public BaseThreadItemViewHolder(View v) {
super(v); super(v);
layout = (ViewGroup) v.findViewById(R.id.layout); layout = v.findViewById(R.id.layout);
textView = (TextView) v.findViewById(R.id.text); textView = v.findViewById(R.id.text);
author = (AuthorView) v.findViewById(R.id.author); author = v.findViewById(R.id.author);
} }
@CallSuper @CallSuper

View File

@@ -85,9 +85,9 @@ public abstract class ThreadListActivity<G extends NamedGroup, I extends ThreadI
groupId = new GroupId(b); groupId = new GroupId(b);
getController().setGroupId(groupId); getController().setGroupId(groupId);
textInput = (TextInputView) findViewById(R.id.text_input_container); textInput = findViewById(R.id.text_input_container);
textInput.setListener(this); textInput.setListener(this);
list = (BriarRecyclerView) findViewById(R.id.list); list = findViewById(R.id.list);
layoutManager = new LinearLayoutManager(this); layoutManager = new LinearLayoutManager(this);
list.setLayoutManager(layoutManager); list.setLayoutManager(layoutManager);
adapter = createAdapter(layoutManager); adapter = createAdapter(layoutManager);
@@ -114,8 +114,8 @@ public abstract class ThreadListActivity<G extends NamedGroup, I extends ThreadI
} }
} }
}); });
upButton = (UnreadMessageButton) findViewById(R.id.upButton); upButton = findViewById(R.id.upButton);
downButton = (UnreadMessageButton) findViewById(R.id.downButton); downButton = findViewById(R.id.downButton);
upButton.setOnClickListener(v -> { upButton.setOnClickListener(v -> {
int position = adapter.getVisibleUnreadPosTop(); int position = adapter.getVisibleUnreadPosTop();
if (position != NO_POSITION) { if (position != NO_POSITION) {

View File

@@ -28,7 +28,7 @@ public class ThreadPostViewHolder<I extends ThreadItem>
public ThreadPostViewHolder(View v) { public ThreadPostViewHolder(View v) {
super(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]; lvls = new View[nestedLineIds.length];
for (int i = 0; i < lvls.length; i++) { for (int i = 0; i < lvls.length; i++) {
lvls[i] = v.findViewById(nestedLineIds[i]); lvls[i] = v.findViewById(nestedLineIds[i]);

View File

@@ -53,12 +53,12 @@ public class AuthorView extends RelativeLayout {
.getSystemService(LAYOUT_INFLATER_SERVICE); .getSystemService(LAYOUT_INFLATER_SERVICE);
inflater.inflate(R.layout.author_view, this, true); inflater.inflate(R.layout.author_view, this, true);
avatar = (CircleImageView) findViewById(R.id.avatar); avatar = findViewById(R.id.avatar);
avatarIcon = (ImageView) findViewById(R.id.avatarIcon); avatarIcon = findViewById(R.id.avatarIcon);
authorName = (TextView) findViewById(R.id.authorName); authorName = findViewById(R.id.authorName);
authorNameTypeface = authorName.getTypeface(); authorNameTypeface = authorName.getTypeface();
date = (TextView) findViewById(R.id.dateView); date = findViewById(R.id.dateView);
trustIndicator = (TrustIndicatorView) findViewById(R.id.trustIndicator); trustIndicator = findViewById(R.id.trustIndicator);
TypedArray attributes = TypedArray attributes =
context.obtainStyledAttributes(attrs, R.styleable.AuthorView); context.obtainStyledAttributes(attrs, R.styleable.AuthorView);

View File

@@ -67,9 +67,9 @@ public class BriarRecyclerView extends FrameLayout {
View v = LayoutInflater.from(getContext()).inflate( View v = LayoutInflater.from(getContext()).inflate(
R.layout.briar_recycler_view, this, true); R.layout.briar_recycler_view, this, true);
recyclerView = (RecyclerView) v.findViewById(R.id.recyclerView); recyclerView = v.findViewById(R.id.recyclerView);
emptyView = (TextView) v.findViewById(R.id.emptyView); emptyView = v.findViewById(R.id.emptyView);
progressBar = (ProgressBar) v.findViewById(R.id.progressBar); progressBar = v.findViewById(R.id.progressBar);
showProgressBar(); showProgressBar();

View File

@@ -58,8 +58,7 @@ public class LargeTextInputView extends TextInputView {
if (buttonText != null) setButtonText(buttonText); if (buttonText != null) setButtonText(buttonText);
if (maxLines > 0) ui.editText.setMaxLines(maxLines); if (maxLines > 0) ui.editText.setMaxLines(maxLines);
if (fillHeight) { if (fillHeight) {
LinearLayout layout = LinearLayout layout = findViewById(R.id.input_layout);
(LinearLayout) findViewById(R.id.input_layout);
LayoutParams params = (LayoutParams) layout.getLayoutParams(); LayoutParams params = (LayoutParams) layout.getLayoutParams();
params.height = 0; params.height = 0;
params.weight = 1; params.weight = 1;

View File

@@ -33,11 +33,10 @@ public class TextAvatarView extends FrameLayout {
LayoutInflater inflater = (LayoutInflater) context LayoutInflater inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE); .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
inflater inflater.inflate(R.layout.text_avatar_view, this, true);
.inflate(R.layout.text_avatar_view, this, true); character = findViewById(R.id.textAvatarView);
character = (AppCompatTextView) findViewById(R.id.textAvatarView); background = findViewById(R.id.avatarBackground);
background = (CircleImageView) findViewById(R.id.avatarBackground); badge = findViewById(R.id.unreadCountView);
badge = (TextView) findViewById(R.id.unreadCountView);
badge.setVisibility(INVISIBLE); badge.setVisibility(INVISIBLE);
} }

View File

@@ -193,9 +193,9 @@ public class TextInputView extends KeyboardAwareLinearLayout
final EmojiDrawer emojiDrawer; final EmojiDrawer emojiDrawer;
private ViewHolder() { private ViewHolder() {
emojiToggle = (EmojiToggle) findViewById(R.id.emoji_toggle); emojiToggle = findViewById(R.id.emoji_toggle);
editText = (EmojiEditText) findViewById(R.id.input_text); editText = findViewById(R.id.input_text);
emojiDrawer = (EmojiDrawer) findViewById(R.id.emoji_drawer); emojiDrawer = findViewById(R.id.emoji_drawer);
sendButton = findViewById(R.id.btn_send); sendButton = findViewById(R.id.btn_send);
} }
} }

View File

@@ -39,8 +39,8 @@ public class UnreadMessageButton extends FrameLayout {
.getSystemService(Context.LAYOUT_INFLATER_SERVICE); .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
inflater.inflate(R.layout.unread_message_button, this, true); inflater.inflate(R.layout.unread_message_button, this, true);
fab = (FloatingActionButton) findViewById(R.id.fab); fab = findViewById(R.id.fab);
unread = (TextView) findViewById(R.id.unreadCountView); unread = findViewById(R.id.unreadCountView);
TypedArray attributes = context.obtainStyledAttributes(attrs, TypedArray attributes = context.obtainStyledAttributes(attrs,
R.styleable.UnreadMessageButton); R.styleable.UnreadMessageButton);

View File

@@ -48,7 +48,7 @@ public class LinkDialogFragment extends DialogFragment {
View v = inflater.inflate(R.layout.fragment_link_dialog, container, View v = inflater.inflate(R.layout.fragment_link_dialog, container,
false); false);
TextView urlView = (TextView) v.findViewById(R.id.urlView); TextView urlView = v.findViewById(R.id.urlView);
urlView.setText(url); urlView.setText(url);
// prepare normal intent or intent chooser // prepare normal intent or intent chooser
@@ -60,13 +60,13 @@ public class LinkDialogFragment extends DialogFragment {
Intent intent = choice ? Intent.createChooser(i, Intent intent = choice ? Intent.createChooser(i,
getString(R.string.link_warning_open_link)) : 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 -> { openButton.setOnClickListener(v1 -> {
startActivity(intent); startActivity(intent);
getDialog().dismiss(); getDialog().dismiss();
}); });
Button cancelButton = (Button) v.findViewById(R.id.cancelButton); Button cancelButton = v.findViewById(R.id.cancelButton);
cancelButton.setOnClickListener(v1 -> getDialog().cancel()); cancelButton.setOnClickListener(v1 -> getDialog().cancel());
return v; return v;

View File

@@ -72,11 +72,10 @@ public class EmojiDrawer extends LinearLayout {
} }
private void initializeResources(View v) { private void initializeResources(View v) {
this.pager = (ViewPager) v.findViewById(R.id.emoji_pager); this.pager = v.findViewById(R.id.emoji_pager);
this.strip = (PagerSlidingTabStrip) v.findViewById(R.id.tabs); this.strip = v.findViewById(R.id.tabs);
RepeatableImageKey backspace = RepeatableImageKey backspace = v.findViewById(R.id.backspace);
(RepeatableImageKey) v.findViewById(R.id.backspace);
backspace.setOnKeyEventListener(() -> { backspace.setOnKeyEventListener(() -> {
if (listener != null) listener.onKeyEvent(DELETE_KEY_EVENT); if (listener != null) listener.onKeyEvent(DELETE_KEY_EVENT);
}); });

View File

@@ -35,7 +35,7 @@ public class EmojiPageView extends FrameLayout {
super(context, attrs, defStyleAttr); super(context, attrs, defStyleAttr);
View view = LayoutInflater.from(getContext()) View view = LayoutInflater.from(getContext())
.inflate(R.layout.emoji_grid_layout, this, true); .inflate(R.layout.emoji_grid_layout, this, true);
grid = (GridView) view.findViewById(R.id.emoji); grid = view.findViewById(R.id.emoji);
grid.setColumnWidth(getResources() grid.setColumnWidth(getResources()
.getDimensionPixelSize(R.dimen.emoji_drawer_size) + 2 * .getDimensionPixelSize(R.dimen.emoji_drawer_size) + 2 *
getResources().getDimensionPixelSize( getResources().getDimensionPixelSize(

View File

@@ -55,17 +55,17 @@ public class ChangePasswordActivityTest {
MockitoAnnotations.initMocks(this); MockitoAnnotations.initMocks(this);
changePasswordActivity = changePasswordActivity =
Robolectric.setupActivity(TestChangePasswordActivity.class); Robolectric.setupActivity(TestChangePasswordActivity.class);
passwordConfirmationWrapper = (TextInputLayout) changePasswordActivity passwordConfirmationWrapper = changePasswordActivity
.findViewById(R.id.new_password_confirm_wrapper); .findViewById(R.id.new_password_confirm_wrapper);
currentPassword = (EditText) changePasswordActivity currentPassword = changePasswordActivity
.findViewById(R.id.current_password_entry); .findViewById(R.id.current_password_entry);
newPassword = (EditText) changePasswordActivity newPassword = changePasswordActivity
.findViewById(R.id.new_password_entry); .findViewById(R.id.new_password_entry);
newPasswordConfirmation = (EditText) changePasswordActivity newPasswordConfirmation = changePasswordActivity
.findViewById(R.id.new_password_confirm); .findViewById(R.id.new_password_confirm);
strengthMeter = (StrengthMeter) changePasswordActivity strengthMeter = changePasswordActivity
.findViewById(R.id.strength_meter); .findViewById(R.id.strength_meter);
changePasswordButton = (Button) changePasswordActivity changePasswordButton = changePasswordActivity
.findViewById(R.id.change_password); .findViewById(R.id.change_password);
} }

View File

@@ -48,12 +48,12 @@ public class PasswordFragmentTest {
startFragment(passwordFragment, SetupActivity.class); startFragment(passwordFragment, SetupActivity.class);
View v = passwordFragment.getView(); View v = passwordFragment.getView();
passwordEntry = (EditText) v.findViewById(R.id.password_entry); passwordEntry = v.findViewById(R.id.password_entry);
passwordConfirmation = (EditText) v.findViewById(R.id.password_confirm); passwordConfirmation = v.findViewById(R.id.password_confirm);
passwordConfirmationWrapper = passwordConfirmationWrapper =
(TextInputLayout) v.findViewById(R.id.password_confirm_wrapper); v.findViewById(R.id.password_confirm_wrapper);
strengthMeter = (StrengthMeter) v.findViewById(R.id.strength_meter); strengthMeter = v.findViewById(R.id.strength_meter);
createAccountButton = (Button) v.findViewById(R.id.next); createAccountButton = v.findViewById(R.id.next);
} }
@Test @Test

View File

@@ -45,10 +45,9 @@ public class SetupActivityTest {
public void setUp() { public void setUp() {
MockitoAnnotations.initMocks(this); MockitoAnnotations.initMocks(this);
setupActivity = Robolectric.setupActivity(SetupActivity.class); setupActivity = Robolectric.setupActivity(SetupActivity.class);
nicknameEntryWrapper = (TextInputLayout) setupActivity nicknameEntryWrapper =
.findViewById(R.id.nickname_entry_wrapper); setupActivity.findViewById(R.id.nickname_entry_wrapper);
nicknameEntry = nicknameEntry = setupActivity.findViewById(R.id.nickname_entry);
(EditText) setupActivity.findViewById(R.id.nickname_entry);
} }
@Test @Test