forked from amazingfate/loongoffice
lint: remove redundant type casts (findViewById to object of type)
Change-Id: I0ec35ea5817d110ca20942ce9d95e0120848580a
This commit is contained in:
@ -40,13 +40,13 @@ public class AboutDialogFragment extends DialogFragment {
|
||||
|
||||
// When linking text, force to always use default color. This works
|
||||
// around a pressed color state bug.
|
||||
TextView textView = (TextView) messageView.findViewById(R.id.about_credits);
|
||||
TextView textView = messageView.findViewById(R.id.about_credits);
|
||||
int defaultColor = textView.getTextColors().getDefaultColor();
|
||||
textView.setTextColor(defaultColor);
|
||||
|
||||
// Take care of placeholders in the version and vendor text views.
|
||||
TextView versionView = (TextView)messageView.findViewById(R.id.about_version);
|
||||
TextView vendorView = (TextView)messageView.findViewById(R.id.about_vendor);
|
||||
TextView versionView = messageView.findViewById(R.id.about_version);
|
||||
TextView vendorView = messageView.findViewById(R.id.about_vendor);
|
||||
try
|
||||
{
|
||||
String versionName = getActivity().getPackageManager()
|
||||
|
||||
@ -122,7 +122,7 @@ public class ColorPaletteAdapter extends RecyclerView.Adapter<ColorPaletteAdapte
|
||||
|
||||
public ColorPaletteViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
colorBox = (ImageButton) itemView.findViewById(R.id.fontColorBox);
|
||||
colorBox = itemView.findViewById(R.id.fontColorBox);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -160,7 +160,7 @@ public class ColorPickerAdapter extends RecyclerView.Adapter<ColorPickerAdapter.
|
||||
|
||||
public ColorPickerViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
this.colorBox = (ImageButton) itemView.findViewById(R.id.fontColorBox);
|
||||
this.colorBox = itemView.findViewById(R.id.fontColorBox);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -38,10 +38,10 @@ public class DocumentPartViewListAdapter extends ArrayAdapter<DocumentPartView>
|
||||
}
|
||||
|
||||
DocumentPartView documentPartView = getItem(position);
|
||||
TextView textView = (TextView) view.findViewById(R.id.text);
|
||||
TextView textView = view.findViewById(R.id.text);
|
||||
textView.setText(documentPartView.partName);
|
||||
|
||||
ImageView imageView = (ImageView) view.findViewById(R.id.image);
|
||||
ImageView imageView = view.findViewById(R.id.image);
|
||||
thumbnailCollector.createThumbnail(position, imageView);
|
||||
|
||||
return view;
|
||||
|
||||
@ -57,7 +57,7 @@ public class FontController implements AdapterView.OnItemSelectedListener {
|
||||
};
|
||||
|
||||
private void changeFontColorBoxColor(final int color){
|
||||
final ImageButton fontColorPickerButton = (ImageButton)mActivity.findViewById(R.id.font_color_picker_button);
|
||||
final ImageButton fontColorPickerButton = mActivity.findViewById(R.id.font_color_picker_button);
|
||||
|
||||
LOKitShell.getMainHandler().post(new Runnable() {
|
||||
@Override
|
||||
@ -176,28 +176,28 @@ public class FontController implements AdapterView.OnItemSelectedListener {
|
||||
}
|
||||
|
||||
private void setupFontNameSpinner() {
|
||||
Spinner fontSpinner = (Spinner) mActivity.findViewById(R.id.font_name_spinner);
|
||||
Spinner fontSpinner = mActivity.findViewById(R.id.font_name_spinner);
|
||||
ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(mActivity, android.R.layout.simple_spinner_item, mFontList);
|
||||
dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
fontSpinner.setAdapter(dataAdapter);
|
||||
}
|
||||
|
||||
private void setupFontSizeSpinner() {
|
||||
Spinner fontSizeSpinner = (Spinner) mActivity.findViewById(R.id.font_size_spinner);
|
||||
Spinner fontSizeSpinner = mActivity.findViewById(R.id.font_size_spinner);
|
||||
ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(mActivity, android.R.layout.simple_spinner_item, mFontSizes);
|
||||
dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
fontSizeSpinner.setAdapter(dataAdapter);
|
||||
}
|
||||
|
||||
private void setupColorPicker(){
|
||||
RecyclerView recyclerView = (RecyclerView) mActivity.findViewById(R.id.fontColorView);
|
||||
RecyclerView recyclerView = mActivity.findViewById(R.id.fontColorView);
|
||||
GridLayoutManager gridLayoutManager = new GridLayoutManager(mActivity, 11, GridLayoutManager.VERTICAL, true);
|
||||
recyclerView.setHasFixedSize(true);
|
||||
recyclerView.setLayoutManager(gridLayoutManager);
|
||||
|
||||
|
||||
|
||||
RecyclerView recyclerView2 = (RecyclerView) mActivity.findViewById(R.id.fontColorViewSub);
|
||||
RecyclerView recyclerView2 = mActivity.findViewById(R.id.fontColorViewSub);
|
||||
GridLayoutManager gridLayoutManager2 = new GridLayoutManager(mActivity,4);
|
||||
recyclerView2.setHasFixedSize(true);
|
||||
recyclerView2.addItemDecoration(new RecyclerView.ItemDecoration() {
|
||||
@ -217,8 +217,8 @@ public class FontController implements AdapterView.OnItemSelectedListener {
|
||||
|
||||
this.colorPickerAdapter = new ColorPickerAdapter(mActivity, colorPaletteAdapter, colorPaletteListener);
|
||||
recyclerView.setAdapter(colorPickerAdapter);
|
||||
RelativeLayout fontColorPicker = (RelativeLayout) mActivity.findViewById(R.id.font_color_picker);
|
||||
ImageButton fontColorPickerButton = (ImageButton)mActivity.findViewById(R.id.font_color_picker_button);
|
||||
RelativeLayout fontColorPicker = mActivity.findViewById(R.id.font_color_picker);
|
||||
ImageButton fontColorPickerButton = mActivity.findViewById(R.id.font_color_picker_button);
|
||||
View.OnClickListener clickListener = new View.OnClickListener(){
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
@ -227,12 +227,12 @@ public class FontController implements AdapterView.OnItemSelectedListener {
|
||||
mActivity.findViewById(R.id.search_toolbar).setVisibility(View.GONE);
|
||||
}
|
||||
};
|
||||
LinearLayout toolbarColorPicker = (LinearLayout) mActivity.findViewById(R.id.toolbar_color_picker);
|
||||
LinearLayout toolbarBottomLayout = (LinearLayout) mActivity.findViewById(R.id.toolbar_bottom);
|
||||
LinearLayout toolbarColorPicker = mActivity.findViewById(R.id.toolbar_color_picker);
|
||||
LinearLayout toolbarBottomLayout = mActivity.findViewById(R.id.toolbar_bottom);
|
||||
colorPickerBehavior = BottomSheetBehavior.from(toolbarColorPicker);
|
||||
toolBarBottomBehavior = BottomSheetBehavior.from(toolbarBottomLayout);
|
||||
|
||||
ImageButton pickerGoBackButton = (ImageButton)mActivity.findViewById(R.id.button_go_back_color_picker);
|
||||
ImageButton pickerGoBackButton = mActivity.findViewById(R.id.button_go_back_color_picker);
|
||||
pickerGoBackButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
@ -256,7 +256,7 @@ public class FontController implements AdapterView.OnItemSelectedListener {
|
||||
}
|
||||
|
||||
private void selectFontCurrentThread(String fontName) {
|
||||
Spinner spinner = (Spinner) mActivity.findViewById(R.id.font_name_spinner);
|
||||
Spinner spinner = mActivity.findViewById(R.id.font_name_spinner);
|
||||
|
||||
if (!mFontNameSpinnerSet) {
|
||||
spinner.setOnItemSelectedListener(this);
|
||||
@ -277,7 +277,7 @@ public class FontController implements AdapterView.OnItemSelectedListener {
|
||||
}
|
||||
|
||||
private void resetFontSizes(String fontName) {
|
||||
Spinner spinner = (Spinner) mActivity.findViewById(R.id.font_size_spinner);
|
||||
Spinner spinner = mActivity.findViewById(R.id.font_size_spinner);
|
||||
ArrayAdapter<String> arrayAdapter = (ArrayAdapter<String>) spinner.getAdapter();
|
||||
|
||||
List<String> fontSizes = mAllFontSizes.get(fontName);
|
||||
@ -296,7 +296,7 @@ public class FontController implements AdapterView.OnItemSelectedListener {
|
||||
}
|
||||
|
||||
private void selectFontSizeCurrentThread(String fontSize) {
|
||||
Spinner spinner = (Spinner) mActivity.findViewById(R.id.font_size_spinner);
|
||||
Spinner spinner = mActivity.findViewById(R.id.font_size_spinner);
|
||||
if (!mFontSizeSpinnerSet) {
|
||||
spinner.setOnItemSelectedListener(this);
|
||||
mFontSizeSpinnerSet = true;
|
||||
|
||||
@ -142,7 +142,7 @@ import org.libreoffice.kit.Document;
|
||||
return;
|
||||
}
|
||||
|
||||
ImageButton button = (ImageButton) mContext.findViewById(buttonId);
|
||||
ImageButton button = mContext.findViewById(buttonId);
|
||||
button.setSelected(selected);
|
||||
if (selected) {
|
||||
button.getBackground().setState(new int[]{android.R.attr.state_selected});
|
||||
|
||||
@ -132,7 +132,7 @@ public class LibreOfficeMainActivity extends AppCompatActivity implements Settin
|
||||
}
|
||||
setContentView(R.layout.activity_main);
|
||||
|
||||
toolbarTop = (Toolbar) findViewById(R.id.toolbar);
|
||||
toolbarTop = findViewById(R.id.toolbar);
|
||||
hideBottomToolbar();
|
||||
|
||||
mToolbarController = new ToolbarController(this, toolbarTop);
|
||||
@ -151,7 +151,7 @@ public class LibreOfficeMainActivity extends AppCompatActivity implements Settin
|
||||
loKitThread.start();
|
||||
|
||||
mLayerClient = new GeckoLayerClient(this);
|
||||
LayerView layerView = (LayerView) findViewById(R.id.layer_view);
|
||||
LayerView layerView = findViewById(R.id.layer_view);
|
||||
mLayerClient.setView(layerView);
|
||||
layerView.setInputConnectionHandler(new LOKitInputConnectionHandler());
|
||||
mLayerClient.notifyReady();
|
||||
@ -204,10 +204,10 @@ public class LibreOfficeMainActivity extends AppCompatActivity implements Settin
|
||||
}
|
||||
}
|
||||
|
||||
mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
|
||||
mDrawerLayout = findViewById(R.id.drawer_layout);
|
||||
|
||||
if (mDocumentPartViewListAdapter == null) {
|
||||
mDrawerList = (ListView) findViewById(R.id.left_drawer);
|
||||
mDrawerList = findViewById(R.id.left_drawer);
|
||||
|
||||
mDocumentPartViewListAdapter = new DocumentPartViewListAdapter(this, R.layout.document_part_list_layout, mDocumentPartView);
|
||||
mDrawerList.setAdapter(mDocumentPartViewListAdapter);
|
||||
@ -216,7 +216,7 @@ public class LibreOfficeMainActivity extends AppCompatActivity implements Settin
|
||||
|
||||
mToolbarController.setupToolbars();
|
||||
|
||||
TabHost host = (TabHost) findViewById(R.id.toolbarTabHost);
|
||||
TabHost host = findViewById(R.id.toolbarTabHost);
|
||||
host.setup();
|
||||
|
||||
TabHost.TabSpec spec = host.newTabSpec("Character");
|
||||
@ -234,8 +234,8 @@ public class LibreOfficeMainActivity extends AppCompatActivity implements Settin
|
||||
spec.setIndicator("Insert");
|
||||
host.addTab(spec);
|
||||
|
||||
LinearLayout bottomToolbarLayout = (LinearLayout) findViewById(R.id.toolbar_bottom);
|
||||
LinearLayout toolbarColorPickerLayout = (LinearLayout) findViewById(R.id.toolbar_color_picker);
|
||||
LinearLayout bottomToolbarLayout = findViewById(R.id.toolbar_bottom);
|
||||
LinearLayout toolbarColorPickerLayout = findViewById(R.id.toolbar_color_picker);
|
||||
bottomToolbarSheetBehavior = BottomSheetBehavior.from(bottomToolbarLayout);
|
||||
toolbarColorPickerBottomSheetBehavior = BottomSheetBehavior.from(toolbarColorPickerLayout);
|
||||
bottomToolbarSheetBehavior.setHideable(true);
|
||||
@ -505,7 +505,7 @@ public class LibreOfficeMainActivity extends AppCompatActivity implements Settin
|
||||
}
|
||||
|
||||
private void showSoftKeyboardDirect() {
|
||||
LayerView layerView = (LayerView) findViewById(R.id.layer_view);
|
||||
LayerView layerView = findViewById(R.id.layer_view);
|
||||
|
||||
if (layerView.requestFocus()) {
|
||||
InputMethodManager inputMethodManager = (InputMethodManager) getApplicationContext().getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
|
||||
@ -46,7 +46,7 @@ public class PresentationActivity extends AppCompatActivity {
|
||||
String filePath = intent.getDataString();
|
||||
|
||||
// set up WebView
|
||||
mWebView = (WebView) findViewById(R.id.presentation_view);
|
||||
mWebView = findViewById(R.id.presentation_view);
|
||||
mWebView.getSettings().setJavaScriptEnabled(true);
|
||||
mWebView.setOnTouchListener(new View.OnTouchListener() {
|
||||
@Override
|
||||
@ -56,9 +56,9 @@ public class PresentationActivity extends AppCompatActivity {
|
||||
});
|
||||
|
||||
// set up buttons within presentation_gesture_view
|
||||
ImageButton prevButton = (ImageButton) findViewById(R.id.slide_show_nav_prev);
|
||||
ImageButton nextButton = (ImageButton) findViewById(R.id.slide_show_nav_next);
|
||||
Button backButton = (Button) findViewById(R.id.slide_show_nav_back);
|
||||
ImageButton prevButton = findViewById(R.id.slide_show_nav_prev);
|
||||
ImageButton nextButton = findViewById(R.id.slide_show_nav_next);
|
||||
Button backButton = findViewById(R.id.slide_show_nav_back);
|
||||
|
||||
prevButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
||||
@ -38,8 +38,8 @@ public class CalcHeadersController {
|
||||
public CalcHeadersController(LibreOfficeMainActivity context, LayerView layerView) {
|
||||
mContext = context;
|
||||
mContext.getDocumentOverlay().setCalcHeadersController(this);
|
||||
mCalcRowHeadersView = (CalcHeadersView) context.findViewById(R.id.calc_header_row);
|
||||
mCalcColumnHeadersView = (CalcHeadersView) context.findViewById(R.id.calc_header_column);
|
||||
mCalcRowHeadersView = context.findViewById(R.id.calc_header_row);
|
||||
mCalcColumnHeadersView = context.findViewById(R.id.calc_header_column);
|
||||
if (mCalcColumnHeadersView == null || mCalcRowHeadersView == null) {
|
||||
Log.e(LOGTAG, "Failed to initialize Calc headers - View is null");
|
||||
} else {
|
||||
|
||||
@ -67,7 +67,7 @@ public class DocumentOverlay {
|
||||
}
|
||||
|
||||
public DocumentOverlay(LibreOfficeMainActivity context, LayerView layerView) {
|
||||
mDocumentOverlayView = (DocumentOverlayView) context.findViewById(R.id.text_cursor_view);
|
||||
mDocumentOverlayView = context.findViewById(R.id.text_cursor_view);
|
||||
mDocumentOverlayLayer = new DocumentOverlayLayer();
|
||||
if (mDocumentOverlayView == null) {
|
||||
Log.e(LOGTAG, "Failed to initialize TextCursorLayer - CursorView is null");
|
||||
|
||||
@ -59,12 +59,12 @@ public class DirectoryBrowserFragment extends Fragment {
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
View v = inflater.inflate(R.layout.fragment_directory_browser, container, false);
|
||||
|
||||
final EditText directoryHeader = (EditText)v.findViewById(R.id.directory_header);
|
||||
Button directorySearchButton = (Button)v.findViewById(R.id.directory_search_button);
|
||||
Button positiveButton = (Button)v.findViewById(R.id.confirm_button);
|
||||
Button negativeButton = (Button)v.findViewById(R.id.cancel_button);
|
||||
ImageView upImage = (ImageView)v.findViewById(R.id.up_image);
|
||||
ListView directoryListView = (ListView) v.findViewById(R.id.directory_list);
|
||||
final EditText directoryHeader = v.findViewById(R.id.directory_header);
|
||||
Button directorySearchButton = v.findViewById(R.id.directory_search_button);
|
||||
Button positiveButton = v.findViewById(R.id.confirm_button);
|
||||
Button negativeButton = v.findViewById(R.id.cancel_button);
|
||||
ImageView upImage = v.findViewById(R.id.up_image);
|
||||
ListView directoryListView = v.findViewById(R.id.directory_list);
|
||||
|
||||
directoryHeader.setText(currentDirectory.getPath());
|
||||
directorySearchButton.setOnClickListener(new View.OnClickListener() {
|
||||
@ -167,7 +167,7 @@ public class DirectoryBrowserFragment extends Fragment {
|
||||
}
|
||||
|
||||
File f = this.getItem(position);
|
||||
TextView tv = (TextView) convertView.findViewById(android.R.id.text1);
|
||||
TextView tv = convertView.findViewById(android.R.id.text1);
|
||||
tv.setText(f.getName());
|
||||
|
||||
return convertView;
|
||||
|
||||
@ -167,7 +167,7 @@ public class LibreOfficeUIActivity extends AppCompatActivity implements Settings
|
||||
|
||||
setContentView(R.layout.activity_document_browser);
|
||||
|
||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
Toolbar toolbar = findViewById(R.id.toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
actionBar = getSupportActionBar();
|
||||
|
||||
@ -175,22 +175,22 @@ public class LibreOfficeUIActivity extends AppCompatActivity implements Settings
|
||||
actionBar.setDisplayHomeAsUpEnabled(true);
|
||||
}
|
||||
|
||||
editFAB = (FloatingActionButton) findViewById(R.id.editFAB);
|
||||
editFAB = findViewById(R.id.editFAB);
|
||||
editFAB.setOnClickListener(this);
|
||||
impressFAB = (FloatingActionButton) findViewById(R.id.newImpressFAB);
|
||||
impressFAB = findViewById(R.id.newImpressFAB);
|
||||
impressFAB.setOnClickListener(this);
|
||||
writerFAB = (FloatingActionButton) findViewById(R.id.newWriterFAB);
|
||||
writerFAB = findViewById(R.id.newWriterFAB);
|
||||
writerFAB.setOnClickListener(this);
|
||||
calcFAB = (FloatingActionButton) findViewById(R.id.newCalcFAB);
|
||||
calcFAB = findViewById(R.id.newCalcFAB);
|
||||
calcFAB.setOnClickListener(this);
|
||||
drawFAB = (FloatingActionButton) findViewById(R.id.newDrawFAB);
|
||||
drawFAB = findViewById(R.id.newDrawFAB);
|
||||
drawFAB.setOnClickListener(this);
|
||||
writerLayout = (LinearLayout) findViewById(R.id.writerLayout);
|
||||
impressLayout = (LinearLayout) findViewById(R.id.impressLayout);
|
||||
calcLayout = (LinearLayout) findViewById(R.id.calcLayout);
|
||||
drawLayout = (LinearLayout) findViewById(R.id.drawLayout);
|
||||
writerLayout = findViewById(R.id.writerLayout);
|
||||
impressLayout = findViewById(R.id.impressLayout);
|
||||
calcLayout = findViewById(R.id.calcLayout);
|
||||
drawLayout = findViewById(R.id.drawLayout);
|
||||
|
||||
recentRecyclerView = (RecyclerView) findViewById(R.id.list_recent);
|
||||
recentRecyclerView = findViewById(R.id.list_recent);
|
||||
|
||||
Set<String> recentFileStrings = prefs.getStringSet(RECENT_DOCUMENTS_KEY, new HashSet<String>());
|
||||
|
||||
@ -208,15 +208,15 @@ public class LibreOfficeUIActivity extends AppCompatActivity implements Settings
|
||||
recentRecyclerView.setLayoutManager(new GridLayoutManager(this, 2));
|
||||
recentRecyclerView.setAdapter(new RecentFilesAdapter(this, recentFiles));
|
||||
|
||||
fileRecyclerView = (RecyclerView) findViewById(R.id.file_recycler_view);
|
||||
fileRecyclerView = findViewById(R.id.file_recycler_view);
|
||||
//This should be tested because it possibly disables view recycling
|
||||
fileRecyclerView.setNestedScrollingEnabled(false);
|
||||
openDirectory(currentDirectory);
|
||||
registerForContextMenu(fileRecyclerView);
|
||||
|
||||
//Setting up navigation drawer
|
||||
drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
|
||||
navigationDrawer = (NavigationView) findViewById(R.id.navigation_drawer);
|
||||
drawerLayout = findViewById(R.id.drawer_layout);
|
||||
navigationDrawer = findViewById(R.id.navigation_drawer);
|
||||
|
||||
final ArrayList<CharSequence> providerNames = new ArrayList<CharSequence>(
|
||||
Arrays.asList(documentProviderFactory.getNames())
|
||||
@ -1132,12 +1132,12 @@ public class LibreOfficeUIActivity extends AppCompatActivity implements Settings
|
||||
ViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
this.itemView = itemView;
|
||||
filenameView = (TextView) itemView.findViewById(R.id.file_item_name);
|
||||
iconView = (ImageView) itemView.findViewById(R.id.file_item_icon);
|
||||
filenameView = itemView.findViewById(R.id.file_item_name);
|
||||
iconView = itemView.findViewById(R.id.file_item_icon);
|
||||
// Check if view mode is List, only then initialise Size and Date field
|
||||
if (isViewModeList()) {
|
||||
fileSizeView = (TextView) itemView.findViewById(R.id.file_item_size);
|
||||
fileDateView = (TextView) itemView.findViewById(R.id.file_item_date);
|
||||
fileSizeView = itemView.findViewById(R.id.file_item_size);
|
||||
fileDateView = itemView.findViewById(R.id.file_item_date);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -85,8 +85,8 @@ class RecentFilesAdapter extends RecyclerView.Adapter<RecentFilesAdapter.ViewHol
|
||||
|
||||
ViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
this.textView = (TextView) itemView.findViewById(R.id.textView);
|
||||
this.imageView = (ImageView) itemView.findViewById(R.id.imageView);
|
||||
this.textView = itemView.findViewById(R.id.textView);
|
||||
this.imageView = itemView.findViewById(R.id.imageView);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user