diff options
author | Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> | 2017-09-24 12:49:51 +0200 |
---|---|---|
committer | Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> | 2017-09-24 13:58:16 +0200 |
commit | d67358d05c718683ef35cdcaefc802a6403de7ee (patch) | |
tree | d10b49b7a1ee0aa6120f004beb311690f3dc169c | |
parent | e731867f056a344aed11ec1e6513a4bec1eb755e (diff) |
lint: remove redundant type casts (findViewById to object of type)
Change-Id: I0ec35ea5817d110ca20942ce9d95e0120848580a
13 files changed, 63 insertions, 63 deletions
diff --git a/android/source/src/java/org/libreoffice/AboutDialogFragment.java b/android/source/src/java/org/libreoffice/AboutDialogFragment.java index c5875ecf0ee3..9b9a6c7b348f 100644 --- a/android/source/src/java/org/libreoffice/AboutDialogFragment.java +++ b/android/source/src/java/org/libreoffice/AboutDialogFragment.java @@ -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() diff --git a/android/source/src/java/org/libreoffice/ColorPaletteAdapter.java b/android/source/src/java/org/libreoffice/ColorPaletteAdapter.java index e5e078934c71..55c12792ae0a 100644 --- a/android/source/src/java/org/libreoffice/ColorPaletteAdapter.java +++ b/android/source/src/java/org/libreoffice/ColorPaletteAdapter.java @@ -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); } } diff --git a/android/source/src/java/org/libreoffice/ColorPickerAdapter.java b/android/source/src/java/org/libreoffice/ColorPickerAdapter.java index 8c5f2744bcfe..14e6988f7a9c 100644 --- a/android/source/src/java/org/libreoffice/ColorPickerAdapter.java +++ b/android/source/src/java/org/libreoffice/ColorPickerAdapter.java @@ -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); } } }
\ No newline at end of file diff --git a/android/source/src/java/org/libreoffice/DocumentPartViewListAdapter.java b/android/source/src/java/org/libreoffice/DocumentPartViewListAdapter.java index d3292d5e472d..a576fc67dcb2 100644 --- a/android/source/src/java/org/libreoffice/DocumentPartViewListAdapter.java +++ b/android/source/src/java/org/libreoffice/DocumentPartViewListAdapter.java @@ -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; diff --git a/android/source/src/java/org/libreoffice/FontController.java b/android/source/src/java/org/libreoffice/FontController.java index 6b8ebe1785ad..6d0ebee21ba0 100644 --- a/android/source/src/java/org/libreoffice/FontController.java +++ b/android/source/src/java/org/libreoffice/FontController.java @@ -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; diff --git a/android/source/src/java/org/libreoffice/FormattingController.java b/android/source/src/java/org/libreoffice/FormattingController.java index b7e5398963dc..4d36249dc6b9 100644 --- a/android/source/src/java/org/libreoffice/FormattingController.java +++ b/android/source/src/java/org/libreoffice/FormattingController.java @@ -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}); diff --git a/android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java b/android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java index 97e23f238d09..83f0267095a7 100755 --- a/android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java +++ b/android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java @@ -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); diff --git a/android/source/src/java/org/libreoffice/PresentationActivity.java b/android/source/src/java/org/libreoffice/PresentationActivity.java index ae14796e9ee3..3308e6884fe9 100644 --- a/android/source/src/java/org/libreoffice/PresentationActivity.java +++ b/android/source/src/java/org/libreoffice/PresentationActivity.java @@ -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 diff --git a/android/source/src/java/org/libreoffice/overlay/CalcHeadersController.java b/android/source/src/java/org/libreoffice/overlay/CalcHeadersController.java index 78a329adfe94..a7ff26a5ea88 100644 --- a/android/source/src/java/org/libreoffice/overlay/CalcHeadersController.java +++ b/android/source/src/java/org/libreoffice/overlay/CalcHeadersController.java @@ -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 { diff --git a/android/source/src/java/org/libreoffice/overlay/DocumentOverlay.java b/android/source/src/java/org/libreoffice/overlay/DocumentOverlay.java index 127972d998d4..f977866a282e 100644 --- a/android/source/src/java/org/libreoffice/overlay/DocumentOverlay.java +++ b/android/source/src/java/org/libreoffice/overlay/DocumentOverlay.java @@ -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"); diff --git a/android/source/src/java/org/libreoffice/storage/external/DirectoryBrowserFragment.java b/android/source/src/java/org/libreoffice/storage/external/DirectoryBrowserFragment.java index 27cbfbce14be..cf71691cce2a 100644 --- a/android/source/src/java/org/libreoffice/storage/external/DirectoryBrowserFragment.java +++ b/android/source/src/java/org/libreoffice/storage/external/DirectoryBrowserFragment.java @@ -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; diff --git a/android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java b/android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java index 5b20c7d98fef..786b949bb504 100644 --- a/android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java +++ b/android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java @@ -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); } } } diff --git a/android/source/src/java/org/libreoffice/ui/RecentFilesAdapter.java b/android/source/src/java/org/libreoffice/ui/RecentFilesAdapter.java index 4ebb9e06328a..7f81df877dfb 100644 --- a/android/source/src/java/org/libreoffice/ui/RecentFilesAdapter.java +++ b/android/source/src/java/org/libreoffice/ui/RecentFilesAdapter.java @@ -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); } } } |