From ee04c79bcff4507271521299a3c6105f8cfb08c4 Mon Sep 17 00:00:00 2001 From: Varun Tiwari Date: Tue, 30 Mar 2021 12:13:32 +0530 Subject: [PATCH] Removed the Redundant Castings and Unused Imports --- .../tables/fragments/EditColorRuleFragment.java | 4 ++-- .../tables/fragments/TablePreferenceFragment.java | 8 ++++---- .../tables/preferences/DefaultViewTypePreference.java | 1 - .../java/org/opendatakit/tables/views/TabularView.java | 2 -- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/tables_app/src/main/java/org/opendatakit/tables/fragments/EditColorRuleFragment.java b/tables_app/src/main/java/org/opendatakit/tables/fragments/EditColorRuleFragment.java index 04a8cb7b..99644e71 100644 --- a/tables_app/src/main/java/org/opendatakit/tables/fragments/EditColorRuleFragment.java +++ b/tables_app/src/main/java/org/opendatakit/tables/fragments/EditColorRuleFragment.java @@ -361,14 +361,14 @@ public boolean onPreferenceChange(Preference preference, Object newValue) { } private void initializeTextColor() { - EditColorPreference pref = (EditColorPreference) this + EditColorPreference pref = this .findPreference(Constants.PreferenceKeys.ColorRule.TEXT_COLOR); pref.initColorPickerListener(this, COLOR_PREF_KEY_TEXT, getActivity().getString(R.string.text_color), this.mTextColor); } private void initializeBackgroundColor() { - EditColorPreference pref = (EditColorPreference) this + EditColorPreference pref = this .findPreference(Constants.PreferenceKeys.ColorRule.BACKGROUND_COLOR); pref.initColorPickerListener(this, COLOR_PREF_KEY_BACKGROUND, getActivity().getString(R.string.background_color), this.mBackgroundColor); diff --git a/tables_app/src/main/java/org/opendatakit/tables/fragments/TablePreferenceFragment.java b/tables_app/src/main/java/org/opendatakit/tables/fragments/TablePreferenceFragment.java index 45ef06e6..6fd11681 100644 --- a/tables_app/src/main/java/org/opendatakit/tables/fragments/TablePreferenceFragment.java +++ b/tables_app/src/main/java/org/opendatakit/tables/fragments/TablePreferenceFragment.java @@ -396,7 +396,7 @@ public boolean onPreferenceChange(Preference preference, Object newValue) { * Sets EditTextPreference for Survey form */ private void initializeDefaultForm() { - EditTextPreference editFormPref = (EditTextPreference) this + EditTextPreference editFormPref = this .findPreference(Constants.PreferenceKeys.Table.DEFAULT_FORM); final AbsTableActivity mActivity = ((AbsTableActivity) getActivity()); @@ -492,7 +492,7 @@ public boolean onPreferenceClick(Preference preference) { * @throws ServicesAvailabilityException if the database is down */ private void initializeListFile(DbHandle db) throws ServicesAvailabilityException { - FileSelectorPreference listPref = (FileSelectorPreference) this + FileSelectorPreference listPref = this .findPreference(Constants.PreferenceKeys.Table.LIST_FILE); listPref.setFields(this, RequestCodeConsts.RequestCodes.CHOOSE_LIST_FILE, ((IAppAwareActivity) getActivity()).getAppName()); @@ -508,7 +508,7 @@ private void initializeListFile(DbHandle db) throws ServicesAvailabilityExceptio * @throws ServicesAvailabilityException if the database is down */ private void initializeMapListFile(DbHandle db) throws ServicesAvailabilityException { - FileSelectorPreference mapListPref = (FileSelectorPreference) this + FileSelectorPreference mapListPref = this .findPreference(Constants.PreferenceKeys.Table.MAP_LIST_FILE); mapListPref.setFields(this, RequestCodeConsts.RequestCodes.CHOOSE_MAP_FILE, ((IAppAwareActivity) getActivity()).getAppName()); @@ -527,7 +527,7 @@ private void initializeMapListFile(DbHandle db) throws ServicesAvailabilityExcep * @throws ServicesAvailabilityException if the database is down */ private void initializeDetailFile(DbHandle db) throws ServicesAvailabilityException { - FileSelectorPreference detailPref = (FileSelectorPreference) this + FileSelectorPreference detailPref = this .findPreference(Constants.PreferenceKeys.Table.DETAIL_FILE); detailPref.setFields(this, RequestCodeConsts.RequestCodes.CHOOSE_DETAIL_FILE, ((IAppAwareActivity) getActivity()).getAppName()); diff --git a/tables_app/src/main/java/org/opendatakit/tables/preferences/DefaultViewTypePreference.java b/tables_app/src/main/java/org/opendatakit/tables/preferences/DefaultViewTypePreference.java index 86145d11..8344724c 100644 --- a/tables_app/src/main/java/org/opendatakit/tables/preferences/DefaultViewTypePreference.java +++ b/tables_app/src/main/java/org/opendatakit/tables/preferences/DefaultViewTypePreference.java @@ -18,7 +18,6 @@ import android.content.Context; import androidx.preference.ListPreference; import android.util.AttributeSet; -import android.view.ContextThemeWrapper; import org.opendatakit.activities.IAppAwareActivity; import org.opendatakit.data.TableViewType; import org.opendatakit.data.utilities.TableUtil; diff --git a/tables_app/src/main/java/org/opendatakit/tables/views/TabularView.java b/tables_app/src/main/java/org/opendatakit/tables/views/TabularView.java index 2625c504..2318e4d5 100644 --- a/tables_app/src/main/java/org/opendatakit/tables/views/TabularView.java +++ b/tables_app/src/main/java/org/opendatakit/tables/views/TabularView.java @@ -23,12 +23,10 @@ import android.util.DisplayMetrics; import android.view.ContextMenu; import android.view.View; -import org.opendatakit.activities.IAppAwareActivity; import org.opendatakit.data.ColorGuide; import org.opendatakit.data.ColorGuideGroup; import org.opendatakit.data.ColorRuleGroup; import org.opendatakit.database.data.ColumnDefinition; -import org.opendatakit.database.data.Row; import org.opendatakit.database.data.TypedRow; import org.opendatakit.logging.WebLogger; import org.opendatakit.provider.DataTableColumns;