From 00b0745b867ad7b558ed52a38d3f72e51b1f35d6 Mon Sep 17 00:00:00 2001 From: mkulesh Date: Mon, 20 Jul 2020 18:18:04 +0200 Subject: [PATCH] Fixed compiler warnings: redundant cast --- app/src/main/java/com/mkulesh/mmd/MainActivity.java | 6 +++--- .../main/java/com/mkulesh/mmd/MainFragmentExperiment.java | 4 ++-- .../main/java/com/mkulesh/mmd/MainFragmentPotential.java | 4 ++-- app/src/main/java/com/mkulesh/mmd/SettingsActivity.java | 6 +++--- .../main/java/com/mkulesh/mmd/widgets/ControlDialog.java | 6 +++--- .../java/com/mkulesh/mmd/widgets/ImageArrayAdapter.java | 4 ++-- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/app/src/main/java/com/mkulesh/mmd/MainActivity.java b/app/src/main/java/com/mkulesh/mmd/MainActivity.java index 47ce994..b837c35 100644 --- a/app/src/main/java/com/mkulesh/mmd/MainActivity.java +++ b/app/src/main/java/com/mkulesh/mmd/MainActivity.java @@ -97,15 +97,15 @@ protected void onCreate(Bundle savedInstanceState) + pm.getInstallerPackageName(getPackageName())); // Action bar (v7 compatibility library): use Toolbar - mToolbar = (Toolbar) findViewById(R.id.toolbar); + mToolbar = findViewById(R.id.toolbar); setSupportActionBar(mToolbar); final ActionBar actionBar = getSupportActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); // Action bar drawer - mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); + mDrawerLayout = findViewById(R.id.drawer_layout); - navigationView = (NavigationView) findViewById(R.id.nav_view); + navigationView = findViewById(R.id.nav_view); if (navigationView != null) { navigationView.setNavigationItemSelectedListener( diff --git a/app/src/main/java/com/mkulesh/mmd/MainFragmentExperiment.java b/app/src/main/java/com/mkulesh/mmd/MainFragmentExperiment.java index c5a4c03..80879b8 100644 --- a/app/src/main/java/com/mkulesh/mmd/MainFragmentExperiment.java +++ b/app/src/main/java/com/mkulesh/mmd/MainFragmentExperiment.java @@ -94,10 +94,10 @@ public void onOrientationChanged(int orientation) } }; - primaryButtonsSet = (FloatingButtonsSet) rootView.findViewById(R.id.main_flb_set_primary); + primaryButtonsSet = rootView.findViewById(R.id.main_flb_set_primary); // surface preparation - surface = (SurfaceView) rootView.findViewById(R.id.experiment_view); + surface = rootView.findViewById(R.id.experiment_view); surface.getHolder().setFormat(PixelFormat.TRANSPARENT); touchListener = new SurfaceTouchListener(activity, surface); surface.setOnTouchListener(touchListener); diff --git a/app/src/main/java/com/mkulesh/mmd/MainFragmentPotential.java b/app/src/main/java/com/mkulesh/mmd/MainFragmentPotential.java index 9bebdb5..8bc9c4e 100644 --- a/app/src/main/java/com/mkulesh/mmd/MainFragmentPotential.java +++ b/app/src/main/java/com/mkulesh/mmd/MainFragmentPotential.java @@ -145,12 +145,12 @@ private void setPotential(PotentialType potentialType) 2.0 * Math.abs(potential.getPotentialMin())); // value view - FunctionView v1 = (FunctionView) rootView.findViewById(R.id.activity_potential_value); + FunctionView v1 = rootView.findViewById(R.id.activity_potential_value); v1.setPotential(potential, BasePotential.ValueType.VALUE, area); v1.invalidate(); // derivative - FunctionView v2 = (FunctionView) rootView.findViewById(R.id.activity_potential_derivative); + FunctionView v2 = rootView.findViewById(R.id.activity_potential_derivative); v2.setPotential(potential, BasePotential.ValueType.DERIVATIVE, area); v2.invalidate(); diff --git a/app/src/main/java/com/mkulesh/mmd/SettingsActivity.java b/app/src/main/java/com/mkulesh/mmd/SettingsActivity.java index bdf4c9c..97ff489 100644 --- a/app/src/main/java/com/mkulesh/mmd/SettingsActivity.java +++ b/app/src/main/java/com/mkulesh/mmd/SettingsActivity.java @@ -137,13 +137,13 @@ protected void onCreate(Bundle savedInstanceState) private void setupActionBar() { - ViewGroup rootView = (ViewGroup) findViewById(R.id.action_bar_root); //id from appcompat + ViewGroup rootView = findViewById(R.id.action_bar_root); //id from appcompat if (rootView != null) { View view = getLayoutInflater().inflate(R.layout.activity_toolbar, rootView, false); rootView.addView(view, 0); - Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); + Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); } @@ -294,7 +294,7 @@ private void updateAreaPref(SharedPreferences sharedPref, String key, String val prefEditor.putString(key, value); prefEditor.commit(); ((EditTextPreference) pref).setText(value); - ((EditTextPreference) pref).setSummary(value); + pref.setSummary(value); } } diff --git a/app/src/main/java/com/mkulesh/mmd/widgets/ControlDialog.java b/app/src/main/java/com/mkulesh/mmd/widgets/ControlDialog.java index 9ad657e..af994ef 100644 --- a/app/src/main/java/com/mkulesh/mmd/widgets/ControlDialog.java +++ b/app/src/main/java/com/mkulesh/mmd/widgets/ControlDialog.java @@ -94,7 +94,7 @@ private void createSurfaceSchemaInterface() { setContentView(R.layout.surface_touch_schema); getWindow().setLayout(par.width, par.height); - ((Button) findViewById(R.id.button_cancel)).setOnClickListener(new View.OnClickListener() + (findViewById(R.id.button_cancel)).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) @@ -117,7 +117,7 @@ private void createSeekBarInterface() { setContentView(R.layout.control_dialog_seekbar); ((TextView) findViewById(R.id.control_dialog_title)).setText(par.title); - LinearLayout layout = (LinearLayout) findViewById(R.id.control_dialog_seekbar_sbarea); + LinearLayout layout = findViewById(R.id.control_dialog_seekbar_sbarea); { progressBar = par.isVertical ? new VerticalSeekBar(context) : new SeekBar(context); ViewGroup.LayoutParams lp1 = new ViewGroup.LayoutParams(par.width, par.height); @@ -132,7 +132,7 @@ private void createSeekBarInterface() android.graphics.PorterDuff.Mode.SRC_IN); layout.addView(progressBar); } - progressText = (TextView) findViewById(R.id.control_dialog_seekbar_value); + progressText = findViewById(R.id.control_dialog_seekbar_value); progressText.setText(decimalFormat.format(par.selectedValue)); } diff --git a/app/src/main/java/com/mkulesh/mmd/widgets/ImageArrayAdapter.java b/app/src/main/java/com/mkulesh/mmd/widgets/ImageArrayAdapter.java index 6898562..bd3731a 100644 --- a/app/src/main/java/com/mkulesh/mmd/widgets/ImageArrayAdapter.java +++ b/app/src/main/java/com/mkulesh/mmd/widgets/ImageArrayAdapter.java @@ -67,11 +67,11 @@ public View getView(int position, View convertView, ViewGroup parent) LayoutInflater inflater = ((Activity) getContext()).getLayoutInflater(); View row = inflater.inflate(textViewResourceId, parent, false); - CheckedTextView checkedTextView = (CheckedTextView) row.findViewById(R.id.image_list_item_checkbox); + CheckedTextView checkedTextView = row.findViewById(R.id.image_list_item_checkbox); if (images != null && images.get(position) != null) { checkedTextView.setCompoundDrawablesWithIntrinsicBounds( - new BitmapDrawable(((Activity) getContext()).getResources(), images.get(position)), null, null, + new BitmapDrawable((getContext()).getResources(), images.get(position)), null, null, null); } checkedTextView.setText(getItem(position));