remove redundant findViewById type casts

refactor-toolbar
Floens 8 years ago
parent 203fe03a17
commit 0876aed5fc
  1. 2
      Clover/app/src/main/java/org/floens/chan/ui/activity/StartActivity.java
  2. 18
      Clover/app/src/main/java/org/floens/chan/ui/adapter/DrawerAdapter.java
  3. 4
      Clover/app/src/main/java/org/floens/chan/ui/adapter/FilesAdapter.java
  4. 6
      Clover/app/src/main/java/org/floens/chan/ui/captcha/LegacyCaptchaLayout.java
  5. 4
      Clover/app/src/main/java/org/floens/chan/ui/cell/AlbumViewCell.java
  6. 12
      Clover/app/src/main/java/org/floens/chan/ui/cell/CardPostCell.java
  7. 4
      Clover/app/src/main/java/org/floens/chan/ui/cell/PostStubCell.java
  8. 2
      Clover/app/src/main/java/org/floens/chan/ui/cell/ThreadStatusCell.java
  9. 2
      Clover/app/src/main/java/org/floens/chan/ui/controller/AdvancedSettingsController.java
  10. 8
      Clover/app/src/main/java/org/floens/chan/ui/controller/AlbumDownloadController.java
  11. 4
      Clover/app/src/main/java/org/floens/chan/ui/controller/AlbumViewController.java
  12. 12
      Clover/app/src/main/java/org/floens/chan/ui/controller/DrawerController.java
  13. 10
      Clover/app/src/main/java/org/floens/chan/ui/controller/FiltersController.java
  14. 12
      Clover/app/src/main/java/org/floens/chan/ui/controller/HistoryController.java
  15. 8
      Clover/app/src/main/java/org/floens/chan/ui/controller/ImageViewerController.java
  16. 2
      Clover/app/src/main/java/org/floens/chan/ui/controller/ImageViewerNavigationController.java
  17. 7
      Clover/app/src/main/java/org/floens/chan/ui/controller/MainSettingsController.java
  18. 4
      Clover/app/src/main/java/org/floens/chan/ui/controller/PopupController.java
  19. 8
      Clover/app/src/main/java/org/floens/chan/ui/controller/PostRepliesController.java
  20. 4
      Clover/app/src/main/java/org/floens/chan/ui/controller/SaveLocationController.java
  21. 2
      Clover/app/src/main/java/org/floens/chan/ui/controller/StyledToolbarNavigationController.java
  22. 6
      Clover/app/src/main/java/org/floens/chan/ui/controller/ThemeSettingsController.java
  23. 2
      Clover/app/src/main/java/org/floens/chan/ui/controller/ThreadSlideController.java
  24. 4
      Clover/app/src/main/java/org/floens/chan/ui/controller/WatchSettingsController.java
  25. 2
      Clover/app/src/main/java/org/floens/chan/ui/layout/BoardAddLayout.java
  26. 8
      Clover/app/src/main/java/org/floens/chan/ui/layout/FilesLayout.java
  27. 18
      Clover/app/src/main/java/org/floens/chan/ui/layout/FilterLayout.java
  28. 12
      Clover/app/src/main/java/org/floens/chan/ui/layout/SelectLayout.java
  29. 4
      Clover/app/src/main/java/org/floens/chan/ui/layout/ThreadSlidingPaneLayout.java
  30. 2
      Clover/app/src/main/java/org/floens/chan/ui/settings/BooleanSettingView.java
  31. 2
      Clover/app/src/main/java/org/floens/chan/ui/settings/SettingsController.java
  32. 10
      Clover/app/src/main/java/org/floens/chan/ui/toolbar/Toolbar.java

@ -113,7 +113,7 @@ public class StartActivity extends AppCompatActivity implements NfcAdapter.Creat
runtimePermissionsHelper = new RuntimePermissionsHelper(this); runtimePermissionsHelper = new RuntimePermissionsHelper(this);
versionHandler = new VersionHandler(this, runtimePermissionsHelper); versionHandler = new VersionHandler(this, runtimePermissionsHelper);
contentView = (ViewGroup) findViewById(android.R.id.content); contentView = findViewById(android.R.id.content);
// Setup base controllers, and decide if to use the split layout for tablets // Setup base controllers, and decide if to use the split layout for tablets
drawerController = new DrawerController(this); drawerController = new DrawerController(this);

@ -307,11 +307,11 @@ public class DrawerAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
private PinViewHolder(View itemView) { private PinViewHolder(View itemView) {
super(itemView); super(itemView);
image = (ThumbnailView) itemView.findViewById(R.id.thumb); image = itemView.findViewById(R.id.thumb);
image.setCircular(true); image.setCircular(true);
textView = (TextView) itemView.findViewById(R.id.text); textView = itemView.findViewById(R.id.text);
textView.setTypeface(ROBOTO_MEDIUM); textView.setTypeface(ROBOTO_MEDIUM);
watchCountText = (TextView) itemView.findViewById(R.id.watch_count); watchCountText = itemView.findViewById(R.id.watch_count);
watchCountText.setTypeface(ROBOTO_MEDIUM); watchCountText.setTypeface(ROBOTO_MEDIUM);
setRoundItemBackground(watchCountText); setRoundItemBackground(watchCountText);
@ -357,9 +357,9 @@ public class DrawerAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
private HeaderHolder(View itemView) { private HeaderHolder(View itemView) {
super(itemView); super(itemView);
text = (TextView) itemView.findViewById(R.id.text); text = itemView.findViewById(R.id.text);
text.setTypeface(ROBOTO_MEDIUM); text.setTypeface(ROBOTO_MEDIUM);
clear = (ImageView) itemView.findViewById(R.id.clear); clear = itemView.findViewById(R.id.clear);
setRoundItemBackground(clear); setRoundItemBackground(clear);
clear.setOnClickListener(new View.OnClickListener() { clear.setOnClickListener(new View.OnClickListener() {
@Override @Override
@ -374,7 +374,7 @@ public class DrawerAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
return true; return true;
} }
}); });
settings = (ImageView) itemView.findViewById(R.id.settings); settings = itemView.findViewById(R.id.settings);
setRoundItemBackground(settings); setRoundItemBackground(settings);
settings.setOnClickListener(new View.OnClickListener() { settings.setOnClickListener(new View.OnClickListener() {
@Override @Override
@ -391,8 +391,8 @@ public class DrawerAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
private LinkHolder(View itemView) { private LinkHolder(View itemView) {
super(itemView); super(itemView);
image = (ImageView) itemView.findViewById(R.id.image); image = itemView.findViewById(R.id.image);
text = (TextView) itemView.findViewById(R.id.text); text = itemView.findViewById(R.id.text);
text.setTypeface(ROBOTO_MEDIUM); text.setTypeface(ROBOTO_MEDIUM);
itemView.setOnClickListener(new View.OnClickListener() { itemView.setOnClickListener(new View.OnClickListener() {
@ -416,7 +416,7 @@ public class DrawerAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
private BoardInputHolder(View itemView) { private BoardInputHolder(View itemView) {
super(itemView); super(itemView);
input = (EditText) itemView.findViewById(R.id.input); input = itemView.findViewById(R.id.input);
} }
} }

@ -127,8 +127,8 @@ public class FilesAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
public FileViewHolder(View itemView) { public FileViewHolder(View itemView) {
super(itemView); super(itemView);
image = (ImageView) itemView.findViewById(R.id.image); image = itemView.findViewById(R.id.image);
text = (TextView) itemView.findViewById(R.id.text); text = itemView.findViewById(R.id.text);
itemView.setOnClickListener(this); itemView.setOnClickListener(this);
} }

@ -73,10 +73,10 @@ public class LegacyCaptchaLayout extends LinearLayout implements AuthenticationL
protected void onFinishInflate() { protected void onFinishInflate() {
super.onFinishInflate(); super.onFinishInflate();
image = (FixedRatioThumbnailView) findViewById(R.id.image); image = findViewById(R.id.image);
image.setRatio(300f / 57f); image.setRatio(300f / 57f);
image.setOnClickListener(this); image.setOnClickListener(this);
input = (EditText) findViewById(R.id.input); input = findViewById(R.id.input);
input.setOnEditorActionListener(new TextView.OnEditorActionListener() { input.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override @Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
@ -88,7 +88,7 @@ public class LegacyCaptchaLayout extends LinearLayout implements AuthenticationL
return false; return false;
} }
}); });
submit = (ImageView) findViewById(R.id.submit); submit = findViewById(R.id.submit);
theme().sendDrawable.apply(submit); theme().sendDrawable.apply(submit);
setRoundItemBackground(submit); setRoundItemBackground(submit);
submit.setOnClickListener(this); submit.setOnClickListener(this);

@ -52,8 +52,8 @@ public class AlbumViewCell extends FrameLayout {
@Override @Override
protected void onFinishInflate() { protected void onFinishInflate() {
super.onFinishInflate(); super.onFinishInflate();
thumbnailView = (PostImageThumbnailView) findViewById(R.id.thumbnail_view); thumbnailView = findViewById(R.id.thumbnail_view);
text = (TextView) findViewById(R.id.text); text = findViewById(R.id.text);
} }
public void setPostImage(PostImage postImage) { public void setPostImage(PostImage postImage) {

@ -76,15 +76,15 @@ public class CardPostCell extends CardView implements PostCellInterface, View.On
protected void onFinishInflate() { protected void onFinishInflate() {
super.onFinishInflate(); super.onFinishInflate();
content = (FixedRatioLinearLayout) findViewById(R.id.card_content); content = findViewById(R.id.card_content);
content.setRatio(9f / 16f); content.setRatio(9f / 16f);
thumbnailView = (PostImageThumbnailView) findViewById(R.id.thumbnail); thumbnailView = findViewById(R.id.thumbnail);
thumbnailView.setRatio(16f / 9f); thumbnailView.setRatio(16f / 9f);
thumbnailView.setOnClickListener(this); thumbnailView.setOnClickListener(this);
title = (TextView) findViewById(R.id.title); title = findViewById(R.id.title);
comment = (FastTextView) findViewById(R.id.comment); comment = findViewById(R.id.comment);
replies = (TextView) findViewById(R.id.replies); replies = findViewById(R.id.replies);
options = (ImageView) findViewById(R.id.options); options = findViewById(R.id.options);
setRoundItemBackground(options); setRoundItemBackground(options);
filterMatchColor = findViewById(R.id.filter_match_color); filterMatchColor = findViewById(R.id.filter_match_color);

@ -72,8 +72,8 @@ public class PostStubCell extends RelativeLayout implements PostCellInterface, V
protected void onFinishInflate() { protected void onFinishInflate() {
super.onFinishInflate(); super.onFinishInflate();
title = (TextView) findViewById(R.id.title); title = findViewById(R.id.title);
options = (ImageView) findViewById(R.id.options); options = findViewById(R.id.options);
setRoundItemBackground(options); setRoundItemBackground(options);
divider = findViewById(R.id.divider); divider = findViewById(R.id.divider);

@ -70,7 +70,7 @@ public class ThreadStatusCell extends LinearLayout implements View.OnClickListen
@Override @Override
protected void onFinishInflate() { protected void onFinishInflate() {
super.onFinishInflate(); super.onFinishInflate();
text = (TextView) findViewById(R.id.text); text = findViewById(R.id.text);
text.setTypeface(ROBOTO_MEDIUM); text.setTypeface(ROBOTO_MEDIUM);
setOnClickListener(this); setOnClickListener(this);

@ -53,7 +53,7 @@ public class AdvancedSettingsController extends SettingsController {
navigation.setTitle(R.string.settings_screen_advanced); navigation.setTitle(R.string.settings_screen_advanced);
view = inflateRes(R.layout.settings_layout); view = inflateRes(R.layout.settings_layout);
content = (LinearLayout) view.findViewById(R.id.scrollview_content); content = view.findViewById(R.id.scrollview_content);
populatePreferences(); populatePreferences();

@ -82,10 +82,10 @@ public class AlbumDownloadController extends Controller implements ToolbarMenuIt
navigation.menu = new ToolbarMenu(context); navigation.menu = new ToolbarMenu(context);
navigation.menu.addItem(new ToolbarMenuItem(context, this, CHECK_ALL, R.drawable.ic_select_all_white_24dp)); navigation.menu.addItem(new ToolbarMenuItem(context, this, CHECK_ALL, R.drawable.ic_select_all_white_24dp));
download = (FloatingActionButton) view.findViewById(R.id.download); download = view.findViewById(R.id.download);
download.setOnClickListener(this); download.setOnClickListener(this);
theme().applyFabColor(download); theme().applyFabColor(download);
recyclerView = (GridRecyclerView) view.findViewById(R.id.recycler_view); recyclerView = view.findViewById(R.id.recycler_view);
recyclerView.setHasFixedSize(true); recyclerView.setHasFixedSize(true);
gridLayoutManager = new GridLayoutManager(context, 3); gridLayoutManager = new GridLayoutManager(context, 3);
recyclerView.setLayoutManager(gridLayoutManager); recyclerView.setLayoutManager(gridLayoutManager);
@ -233,8 +233,8 @@ public class AlbumDownloadController extends Controller implements ToolbarMenuIt
public AlbumDownloadCell(View itemView) { public AlbumDownloadCell(View itemView) {
super(itemView); super(itemView);
itemView.getLayoutParams().height = recyclerView.getRealSpanWidth(); itemView.getLayoutParams().height = recyclerView.getRealSpanWidth();
checkbox = (ImageView) itemView.findViewById(R.id.checkbox); checkbox = itemView.findViewById(R.id.checkbox);
thumbnailView = (PostImageThumbnailView) itemView.findViewById(R.id.thumbnail_view); thumbnailView = itemView.findViewById(R.id.thumbnail_view);
itemView.setOnClickListener(this); itemView.setOnClickListener(this);
} }

@ -68,7 +68,7 @@ public class AlbumViewController extends Controller implements ImageViewerContro
items.add(new FloatingMenuItem(SAVE_ALBUM_ID, R.string.action_download_album)); items.add(new FloatingMenuItem(SAVE_ALBUM_ID, R.string.action_download_album));
navigation.createOverflow(context, this, items); navigation.createOverflow(context, this, items);
recyclerView = (GridRecyclerView) view.findViewById(R.id.recycler_view); recyclerView = view.findViewById(R.id.recycler_view);
recyclerView.setHasFixedSize(true); recyclerView.setHasFixedSize(true);
gridLayoutManager = new GridLayoutManager(context, 3); gridLayoutManager = new GridLayoutManager(context, 3);
recyclerView.setLayoutManager(gridLayoutManager); recyclerView.setLayoutManager(gridLayoutManager);
@ -199,7 +199,7 @@ public class AlbumViewController extends Controller implements ImageViewerContro
public AlbumItemCellHolder(View itemView) { public AlbumItemCellHolder(View itemView) {
super(itemView); super(itemView);
cell = (AlbumViewCell) itemView; cell = (AlbumViewCell) itemView;
thumbnailView = (PostImageThumbnailView) itemView.findViewById(R.id.thumbnail_view); thumbnailView = itemView.findViewById(R.id.thumbnail_view);
thumbnailView.setOnClickListener(this); thumbnailView.setOnClickListener(this);
} }

@ -78,16 +78,16 @@ public class DrawerController extends Controller implements DrawerAdapter.Callba
EventBus.getDefault().register(this); EventBus.getDefault().register(this);
view = inflateRes(R.layout.controller_navigation_drawer); view = inflateRes(R.layout.controller_navigation_drawer);
container = (FrameLayout) view.findViewById(R.id.container); container = view.findViewById(R.id.container);
drawerLayout = (DrawerLayout) view.findViewById(R.id.drawer_layout); drawerLayout = view.findViewById(R.id.drawer_layout);
drawerLayout.setDrawerShadow(R.drawable.drawer_shadow, Gravity.LEFT); drawerLayout.setDrawerShadow(R.drawable.drawer_shadow, Gravity.LEFT);
drawer = (LinearLayout) view.findViewById(R.id.drawer); drawer = view.findViewById(R.id.drawer);
recyclerView = (RecyclerView) view.findViewById(R.id.drawer_recycler_view); recyclerView = view.findViewById(R.id.drawer_recycler_view);
recyclerView.setHasFixedSize(true); recyclerView.setHasFixedSize(true);
recyclerView.setLayoutManager(new LinearLayoutManager(context)); recyclerView.setLayoutManager(new LinearLayoutManager(context));
settings = (LinearLayout) view.findViewById(R.id.settings); settings = view.findViewById(R.id.settings);
settings.setOnClickListener(this); settings.setOnClickListener(this);
theme().settingsDrawable.apply((ImageView) settings.findViewById(R.id.image)); theme().settingsDrawable.apply(settings.findViewById(R.id.image));
((TextView) settings.findViewById(R.id.text)).setTypeface(ROBOTO_MEDIUM); ((TextView) settings.findViewById(R.id.text)).setTypeface(ROBOTO_MEDIUM);
drawerAdapter = new DrawerAdapter(this); drawerAdapter = new DrawerAdapter(this);

@ -114,11 +114,11 @@ public class FiltersController extends Controller implements ToolbarMenuItem.Too
view = inflateRes(R.layout.controller_filters); view = inflateRes(R.layout.controller_filters);
recyclerView = (RecyclerView) view.findViewById(R.id.recycler_view); recyclerView = view.findViewById(R.id.recycler_view);
recyclerView.setHasFixedSize(true); recyclerView.setHasFixedSize(true);
recyclerView.setLayoutManager(new LinearLayoutManager(context)); recyclerView.setLayoutManager(new LinearLayoutManager(context));
add = (FloatingActionButton) view.findViewById(R.id.add); add = view.findViewById(R.id.add);
add.setOnClickListener(this); add.setOnClickListener(this);
theme().applyFabColor(add); theme().applyFabColor(add);
@ -272,9 +272,9 @@ public class FiltersController extends Controller implements ToolbarMenuItem.Too
public FilterCell(View itemView) { public FilterCell(View itemView) {
super(itemView); super(itemView);
text = (TextView) itemView.findViewById(R.id.text); text = itemView.findViewById(R.id.text);
subtext = (TextView) itemView.findViewById(R.id.subtext); subtext = itemView.findViewById(R.id.subtext);
delete = (ImageView) itemView.findViewById(R.id.delete); delete = itemView.findViewById(R.id.delete);
theme().clearDrawable.apply(delete); theme().clearDrawable.apply(delete);

@ -102,8 +102,8 @@ public class HistoryController extends Controller implements CompoundButton.OnCh
navigation.rightView = historyEnabledSwitch; navigation.rightView = historyEnabledSwitch;
view = inflateRes(R.layout.controller_history); view = inflateRes(R.layout.controller_history);
crossfade = (CrossfadeView) view.findViewById(R.id.crossfade); crossfade = view.findViewById(R.id.crossfade);
recyclerView = (RecyclerView) view.findViewById(R.id.recycler_view); recyclerView = view.findViewById(R.id.recycler_view);
recyclerView.setHasFixedSize(true); recyclerView.setHasFixedSize(true);
recyclerView.setLayoutManager(new LinearLayoutManager(context)); recyclerView.setLayoutManager(new LinearLayoutManager(context));
@ -265,11 +265,11 @@ public class HistoryController extends Controller implements CompoundButton.OnCh
public HistoryCell(View itemView) { public HistoryCell(View itemView) {
super(itemView); super(itemView);
thumbnail = (ThumbnailView) itemView.findViewById(R.id.thumbnail); thumbnail = itemView.findViewById(R.id.thumbnail);
thumbnail.setCircular(true); thumbnail.setCircular(true);
text = (TextView) itemView.findViewById(R.id.text); text = itemView.findViewById(R.id.text);
subtext = (TextView) itemView.findViewById(R.id.subtext); subtext = itemView.findViewById(R.id.subtext);
delete = (ImageView) itemView.findViewById(R.id.delete); delete = itemView.findViewById(R.id.delete);
theme().clearDrawable.apply(delete); theme().clearDrawable.apply(delete);

@ -139,10 +139,10 @@ public class ImageViewerController extends Controller implements ImageViewerPres
overflowMenuItem = navigation.createOverflow(context, this, items); overflowMenuItem = navigation.createOverflow(context, this, items);
view = inflateRes(R.layout.controller_image_viewer); view = inflateRes(R.layout.controller_image_viewer);
previewImage = (TransitionImageView) view.findViewById(R.id.preview_image); previewImage = view.findViewById(R.id.preview_image);
pager = (OptionalSwipeViewPager) view.findViewById(R.id.pager); pager = view.findViewById(R.id.pager);
pager.addOnPageChangeListener(presenter); pager.addOnPageChangeListener(presenter);
loadingBar = (LoadingBar) view.findViewById(R.id.loading_bar); loadingBar = view.findViewById(R.id.loading_bar);
// Sanity check // Sanity check
if (parentController.view.getWindowToken() == null) { if (parentController.view.getWindowToken() == null) {
@ -317,7 +317,7 @@ public class ImageViewerController extends Controller implements ImageViewerPres
} else { } else {
@SuppressLint("InflateParams") @SuppressLint("InflateParams")
View notice = LayoutInflater.from(context).inflate(R.layout.dialog_video_error, null); View notice = LayoutInflater.from(context).inflate(R.layout.dialog_video_error, null);
final CheckBox dontShowAgain = (CheckBox) notice.findViewById(R.id.checkbox); final CheckBox dontShowAgain = notice.findViewById(R.id.checkbox);
new AlertDialog.Builder(context) new AlertDialog.Builder(context)
.setTitle(R.string.video_playback_warning_title) .setTitle(R.string.video_playback_warning_title)

@ -43,7 +43,7 @@ public class ImageViewerNavigationController extends ToolbarNavigationController
NavigationControllerContainerLayout nav = (NavigationControllerContainerLayout) container; NavigationControllerContainerLayout nav = (NavigationControllerContainerLayout) container;
nav.setNavigationController(this); nav.setNavigationController(this);
nav.setSwipeEnabled(false); nav.setSwipeEnabled(false);
toolbar = (Toolbar) view.findViewById(R.id.toolbar); toolbar = view.findViewById(R.id.toolbar);
toolbar.setCallback(this); toolbar.setCallback(this);
} }

@ -24,12 +24,10 @@ import android.net.Uri;
import android.text.TextUtils; import android.text.TextUtils;
import android.view.View; import android.view.View;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.Toast; import android.widget.Toast;
import org.floens.chan.R; import org.floens.chan.R;
import org.floens.chan.core.database.DatabaseManager; import org.floens.chan.core.database.DatabaseManager;
import org.floens.chan.core.manager.BoardManager;
import org.floens.chan.core.settings.ChanSettings; import org.floens.chan.core.settings.ChanSettings;
import org.floens.chan.ui.activity.StartActivity; import org.floens.chan.ui.activity.StartActivity;
import org.floens.chan.ui.helper.HintPopup; import org.floens.chan.ui.helper.HintPopup;
@ -81,9 +79,6 @@ public class MainSettingsController extends SettingsController implements Toolba
@Inject @Inject
DatabaseManager databaseManager; DatabaseManager databaseManager;
@Inject
BoardManager boardManager;
public MainSettingsController(Context context) { public MainSettingsController(Context context) {
super(context); super(context);
} }
@ -102,7 +97,7 @@ public class MainSettingsController extends SettingsController implements Toolba
)); ));
view = inflateRes(R.layout.settings_layout); view = inflateRes(R.layout.settings_layout);
content = (LinearLayout) view.findViewById(R.id.scrollview_content); content = view.findViewById(R.id.scrollview_content);
previousLayoutMode = ChanSettings.layoutMode.get(); previousLayoutMode = ChanSettings.layoutMode.get();

@ -38,9 +38,9 @@ public class PopupController extends Controller implements View.OnClickListener
super.onCreate(); super.onCreate();
view = inflateRes(R.layout.layout_controller_popup); view = inflateRes(R.layout.layout_controller_popup);
topView = (FrameLayout) view.findViewById(R.id.top_view); topView = view.findViewById(R.id.top_view);
topView.setOnClickListener(this); topView.setOnClickListener(this);
container = (FrameLayout) view.findViewById(R.id.container); container = view.findViewById(R.id.container);
} }
public void setChildController(NavigationController childController) { public void setChildController(NavigationController childController) {

@ -81,7 +81,7 @@ public class PostRepliesController extends Controller {
} }
}); });
loadView = (LoadView) view.findViewById(R.id.loadview); loadView = view.findViewById(R.id.loadview);
if (Build.VERSION.SDK_INT >= 21) { if (Build.VERSION.SDK_INT >= 21) {
statusBarColorPrevious = getWindow().getStatusBarColor(); statusBarColorPrevious = getWindow().getStatusBarColor();
@ -143,7 +143,7 @@ public class PostRepliesController extends Controller {
dataView = inflateRes(R.layout.layout_post_replies); dataView = inflateRes(R.layout.layout_post_replies);
} }
listView = (ListView) dataView.findViewById(R.id.post_list); listView = dataView.findViewById(R.id.post_list);
listView.setDivider(null); listView.setDivider(null);
listView.setDividerHeight(0); listView.setDividerHeight(0);
@ -166,8 +166,8 @@ public class PostRepliesController extends Controller {
Drawable backDrawable = theme().backDrawable.makeDrawable(context); Drawable backDrawable = theme().backDrawable.makeDrawable(context);
Drawable doneDrawable = theme().doneDrawable.makeDrawable(context); Drawable doneDrawable = theme().doneDrawable.makeDrawable(context);
TextView repliesBackText = ((TextView) dataView.findViewById(R.id.replies_back_icon)); TextView repliesBackText = dataView.findViewById(R.id.replies_back_icon);
TextView repliesCloseText = ((TextView) dataView.findViewById(R.id.replies_close_icon)); TextView repliesCloseText = dataView.findViewById(R.id.replies_close_icon);
repliesBackText.setCompoundDrawablesWithIntrinsicBounds(backDrawable, null, null, null); repliesBackText.setCompoundDrawablesWithIntrinsicBounds(backDrawable, null, null, null);
repliesCloseText.setCompoundDrawablesWithIntrinsicBounds(doneDrawable, null, null, null); repliesCloseText.setCompoundDrawablesWithIntrinsicBounds(doneDrawable, null, null, null);
if (theme().isLightTheme) { if (theme().isLightTheme) {

@ -59,9 +59,9 @@ public class SaveLocationController extends Controller implements FileWatcher.Fi
navigation.setTitle(R.string.save_location_screen); navigation.setTitle(R.string.save_location_screen);
view = inflateRes(R.layout.controller_save_location); view = inflateRes(R.layout.controller_save_location);
filesLayout = (FilesLayout) view.findViewById(R.id.files_layout); filesLayout = view.findViewById(R.id.files_layout);
filesLayout.setCallback(this); filesLayout.setCallback(this);
setButton = (FloatingActionButton) view.findViewById(R.id.set_button); setButton = view.findViewById(R.id.set_button);
setButton.setOnClickListener(this); setButton.setOnClickListener(this);
File saveLocation = new File(ChanSettings.saveLocation.get()); File saveLocation = new File(ChanSettings.saveLocation.get());

@ -41,7 +41,7 @@ public class StyledToolbarNavigationController extends ToolbarNavigationControll
NavigationControllerContainerLayout nav = (NavigationControllerContainerLayout) container; NavigationControllerContainerLayout nav = (NavigationControllerContainerLayout) container;
nav.setNavigationController(this); nav.setNavigationController(this);
nav.setSwipeEnabled(ChanSettings.controllerSwipeable.get()); nav.setSwipeEnabled(ChanSettings.controllerSwipeable.get());
toolbar = (Toolbar) view.findViewById(R.id.toolbar); toolbar = view.findViewById(R.id.toolbar);
toolbar.setBackgroundColor(ThemeHelper.getInstance().getTheme().primaryColor.color); toolbar.setBackgroundColor(ThemeHelper.getInstance().getTheme().primaryColor.color);
toolbar.setCallback(this); toolbar.setCallback(this);
} }

@ -153,11 +153,11 @@ public class ThemeSettingsController extends Controller implements View.OnClickL
themeHelper = ThemeHelper.getInstance(); themeHelper = ThemeHelper.getInstance();
themes = themeHelper.getThemes(); themes = themeHelper.getThemes();
pager = (ViewPager) view.findViewById(R.id.pager); pager = view.findViewById(R.id.pager);
done = (FloatingActionButton) view.findViewById(R.id.add); done = view.findViewById(R.id.add);
done.setOnClickListener(this); done.setOnClickListener(this);
textView = (TextView) view.findViewById(R.id.text); textView = view.findViewById(R.id.text);
SpannableString changeAccentColor = new SpannableString(getString(R.string.setting_theme_accent)); SpannableString changeAccentColor = new SpannableString(getString(R.string.setting_theme_accent));
changeAccentColor.setSpan(new ClickableSpan() { changeAccentColor.setSpan(new ClickableSpan() {

@ -61,7 +61,7 @@ public class ThreadSlideController extends Controller implements DoubleNavigatio
view = inflateRes(R.layout.controller_thread_slide); view = inflateRes(R.layout.controller_thread_slide);
slidingPaneLayout = (ThreadSlidingPaneLayout) view.findViewById(R.id.sliding_pane_layout); slidingPaneLayout = view.findViewById(R.id.sliding_pane_layout);
slidingPaneLayout.setThreadSlideController(this); slidingPaneLayout.setThreadSlideController(this);
slidingPaneLayout.setPanelSlideListener(this); slidingPaneLayout.setPanelSlideListener(this);
slidingPaneLayout.setParallaxDistance(dp(100)); slidingPaneLayout.setParallaxDistance(dp(100));

@ -55,8 +55,8 @@ public class WatchSettingsController extends SettingsController implements Compo
navigation.setTitle(R.string.settings_screen_watch); navigation.setTitle(R.string.settings_screen_watch);
view = inflateRes(R.layout.controller_watch); view = inflateRes(R.layout.controller_watch);
content = (LinearLayout) view.findViewById(R.id.scrollview_content); content = view.findViewById(R.id.scrollview_content);
crossfadeView = (CrossfadeView) view.findViewById(R.id.crossfade); crossfadeView = view.findViewById(R.id.crossfade);
crossfadeView.toggle(enabled, false); crossfadeView.toggle(enabled, false);

@ -66,7 +66,7 @@ public class BoardAddLayout extends LinearLayout implements SearchLayout.SearchL
// View binding // View binding
search = findViewById(R.id.search); search = findViewById(R.id.search);
suggestionsRecycler = findViewById(R.id.suggestions); suggestionsRecycler = findViewById(R.id.suggestions);
checkAllButton = (Button) findViewById(R.id.select_all); checkAllButton = findViewById(R.id.select_all);
// Adapters // Adapters
suggestionsAdapter = new SuggestionsAdapter(); suggestionsAdapter = new SuggestionsAdapter();

@ -69,11 +69,11 @@ public class FilesLayout extends LinearLayout implements FilesAdapter.Callback,
@Override @Override
protected void onFinishInflate() { protected void onFinishInflate() {
super.onFinishInflate(); super.onFinishInflate();
backLayout = (ViewGroup) findViewById(R.id.back_layout); backLayout = findViewById(R.id.back_layout);
backImage = (ImageView) backLayout.findViewById(R.id.back_image); backImage = backLayout.findViewById(R.id.back_image);
backImage.setImageDrawable(DrawableCompat.wrap(backImage.getDrawable())); backImage.setImageDrawable(DrawableCompat.wrap(backImage.getDrawable()));
backText = (TextView) backLayout.findViewById(R.id.back_text); backText = backLayout.findViewById(R.id.back_text);
recyclerView = (RecyclerView) findViewById(R.id.recycler); recyclerView = findViewById(R.id.recycler);
backLayout.setOnClickListener(this); backLayout.setOnClickListener(this);
} }

@ -104,10 +104,10 @@ public class FilterLayout extends LinearLayout implements View.OnClickListener {
super.onFinishInflate(); super.onFinishInflate();
inject(this); inject(this);
typeText = (TextView) findViewById(R.id.type); typeText = findViewById(R.id.type);
boardsSelector = (TextView) findViewById(R.id.boards); boardsSelector = findViewById(R.id.boards);
actionText = (TextView) findViewById(R.id.action); actionText = findViewById(R.id.action);
pattern = (TextView) findViewById(R.id.pattern); pattern = findViewById(R.id.pattern);
pattern.addTextChangedListener(new TextWatcher() { pattern.addTextChangedListener(new TextWatcher() {
@Override @Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) { public void beforeTextChanged(CharSequence s, int start, int count, int after) {
@ -124,7 +124,7 @@ public class FilterLayout extends LinearLayout implements View.OnClickListener {
public void afterTextChanged(Editable s) { public void afterTextChanged(Editable s) {
} }
}); });
patternPreview = (TextView) findViewById(R.id.pattern_preview); patternPreview = findViewById(R.id.pattern_preview);
patternPreview.addTextChangedListener(new TextWatcher() { patternPreview.addTextChangedListener(new TextWatcher() {
@Override @Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) { public void beforeTextChanged(CharSequence s, int start, int count, int after) {
@ -139,12 +139,12 @@ public class FilterLayout extends LinearLayout implements View.OnClickListener {
public void afterTextChanged(Editable s) { public void afterTextChanged(Editable s) {
} }
}); });
patternPreviewStatus = (TextView) findViewById(R.id.pattern_preview_status); patternPreviewStatus = findViewById(R.id.pattern_preview_status);
enabled = (CheckBox) findViewById(R.id.enabled); enabled = findViewById(R.id.enabled);
help = (ImageView) findViewById(R.id.help); help = findViewById(R.id.help);
theme().helpDrawable.apply(help); theme().helpDrawable.apply(help);
help.setOnClickListener(this); help.setOnClickListener(this);
colorContainer = (LinearLayout) findViewById(R.id.color_container); colorContainer = findViewById(R.id.color_container);
colorContainer.setOnClickListener(this); colorContainer.setOnClickListener(this);
colorPreview = findViewById(R.id.color_preview); colorPreview = findViewById(R.id.color_preview);

@ -70,17 +70,17 @@ public class SelectLayout<T> extends LinearLayout implements SearchLayout.Search
protected void onFinishInflate() { protected void onFinishInflate() {
super.onFinishInflate(); super.onFinishInflate();
searchLayout = (SearchLayout) findViewById(R.id.search_layout); searchLayout = findViewById(R.id.search_layout);
searchLayout.setCallback(this); searchLayout.setCallback(this);
searchLayout.setHint(getString(R.string.search_hint)); searchLayout.setHint(getString(R.string.search_hint));
searchLayout.setTextColor(getAttrColor(getContext(), R.attr.text_color_primary)); searchLayout.setTextColor(getAttrColor(getContext(), R.attr.text_color_primary));
searchLayout.setHintColor(getAttrColor(getContext(), R.attr.text_color_hint)); searchLayout.setHintColor(getAttrColor(getContext(), R.attr.text_color_hint));
searchLayout.setClearButtonImage(R.drawable.ic_clear_black_24dp); searchLayout.setClearButtonImage(R.drawable.ic_clear_black_24dp);
checkAllButton = (Button) findViewById(R.id.select_all); checkAllButton = findViewById(R.id.select_all);
checkAllButton.setOnClickListener(this); checkAllButton.setOnClickListener(this);
recyclerView = (RecyclerView) findViewById(R.id.recycler_view); recyclerView = findViewById(R.id.recycler_view);
recyclerView.setHasFixedSize(true); recyclerView.setHasFixedSize(true);
recyclerView.setLayoutManager(new LinearLayoutManager(getContext())); recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
} }
@ -213,9 +213,9 @@ public class SelectLayout<T> extends LinearLayout implements SearchLayout.Search
public BoardSelectViewHolder(View itemView) { public BoardSelectViewHolder(View itemView) {
super(itemView); super(itemView);
checkBox = (CheckBox) itemView.findViewById(R.id.checkbox); checkBox = itemView.findViewById(R.id.checkbox);
text = (TextView) itemView.findViewById(R.id.text); text = itemView.findViewById(R.id.text);
description = (TextView) itemView.findViewById(R.id.description); description = itemView.findViewById(R.id.description);
checkBox.setOnCheckedChangeListener(this); checkBox.setOnCheckedChangeListener(this);

@ -51,8 +51,8 @@ public class ThreadSlidingPaneLayout extends SlidingPaneLayout {
@Override @Override
protected void onFinishInflate() { protected void onFinishInflate() {
super.onFinishInflate(); super.onFinishInflate();
leftPane = (ViewGroup) findViewById(R.id.left_pane); leftPane = findViewById(R.id.left_pane);
rightPane = (ViewGroup) findViewById(R.id.right_pane); rightPane = findViewById(R.id.right_pane);
} }
@Override @Override

@ -46,7 +46,7 @@ public class BooleanSettingView extends SettingView implements View.OnClickListe
view.setOnClickListener(this); view.setOnClickListener(this);
switcher = (SwitchCompat) view.findViewById(R.id.switcher); switcher = view.findViewById(R.id.switcher);
switcher.setOnCheckedChangeListener(this); switcher.setOnCheckedChangeListener(this);
switcher.setChecked(setting.get()); switcher.setChecked(setting.get());

@ -156,7 +156,7 @@ public class SettingsController extends Controller implements AndroidUtils.OnMea
private void setDescriptionText(View view, String topText, String bottomText) { private void setDescriptionText(View view, String topText, String bottomText) {
((TextView) view.findViewById(R.id.top)).setText(topText); ((TextView) view.findViewById(R.id.top)).setText(topText);
final TextView bottom = ((TextView) view.findViewById(R.id.bottom)); final TextView bottom = view.findViewById(R.id.bottom);
if (bottom != null) { if (bottom != null) {
bottom.setText(bottomText); bottom.setText(bottomText);
bottom.setVisibility(bottomText == null ? View.GONE : View.VISIBLE); bottom.setVisibility(bottomText == null ? View.GONE : View.VISIBLE);

@ -284,13 +284,13 @@ public class Toolbar extends LinearLayout implements View.OnClickListener {
public void updateTitle(NavigationItem navigationItem) { public void updateTitle(NavigationItem navigationItem) {
LinearLayout view = navigationItem == fromItem ? fromView : (navigationItem == toItem ? toView : null); LinearLayout view = navigationItem == fromItem ? fromView : (navigationItem == toItem ? toView : null);
if (view != null) { if (view != null) {
TextView titleView = (TextView) view.findViewById(R.id.title); TextView titleView = view.findViewById(R.id.title);
if (titleView != null) { if (titleView != null) {
titleView.setText(navigationItem.title); titleView.setText(navigationItem.title);
} }
if (!TextUtils.isEmpty(navigationItem.subtitle)) { if (!TextUtils.isEmpty(navigationItem.subtitle)) {
TextView subtitleView = (TextView) view.findViewById(R.id.subtitle); TextView subtitleView = view.findViewById(R.id.subtitle);
if (subtitleView != null) { if (subtitleView != null) {
subtitleView.setText(navigationItem.subtitle); subtitleView.setText(navigationItem.subtitle);
} }
@ -470,9 +470,9 @@ public class Toolbar extends LinearLayout implements View.OnClickListener {
LinearLayout menu = (LinearLayout) LayoutInflater.from(getContext()).inflate(R.layout.toolbar_menu, null); LinearLayout menu = (LinearLayout) LayoutInflater.from(getContext()).inflate(R.layout.toolbar_menu, null);
menu.setGravity(Gravity.CENTER_VERTICAL); menu.setGravity(Gravity.CENTER_VERTICAL);
FrameLayout titleContainer = (FrameLayout) menu.findViewById(R.id.title_container); FrameLayout titleContainer = menu.findViewById(R.id.title_container);
final TextView titleView = (TextView) menu.findViewById(R.id.title); final TextView titleView = menu.findViewById(R.id.title);
titleView.setTypeface(AndroidUtils.ROBOTO_MEDIUM); titleView.setTypeface(AndroidUtils.ROBOTO_MEDIUM);
titleView.setText(item.title); titleView.setText(item.title);
titleView.setTextColor(0xffffffff); titleView.setTextColor(0xffffffff);
@ -491,7 +491,7 @@ public class Toolbar extends LinearLayout implements View.OnClickListener {
}); });
} }
TextView subtitleView = (TextView) menu.findViewById(R.id.subtitle); TextView subtitleView = menu.findViewById(R.id.subtitle);
if (!TextUtils.isEmpty(item.subtitle)) { if (!TextUtils.isEmpty(item.subtitle)) {
ViewGroup.LayoutParams titleParams = titleView.getLayoutParams(); ViewGroup.LayoutParams titleParams = titleView.getLayoutParams();
titleParams.height = ViewGroup.LayoutParams.WRAP_CONTENT; titleParams.height = ViewGroup.LayoutParams.WRAP_CONTENT;

Loading…
Cancel
Save