diff options
author | Carlos Galindo <carlos.s.galindo@gmail.com> | 2019-09-14 14:44:44 +0300 |
---|---|---|
committer | Carlos Galindo <carlos.s.galindo@gmail.com> | 2019-09-14 14:44:44 +0300 |
commit | 305896a62efe10d463aa56e8d04659e8369ff9d1 (patch) | |
tree | bd1ea459e2b03320929b36e1303d16959c0e1885 /News-Android-App/src/main | |
parent | 0ec0d406f29cad2cb7b8e1e73b328d8f22054d90 (diff) |
Fixed codacy-bot warnings
Signed-off-by: Carlos Galindo <carlos.s.galindo@gmail.com>
Diffstat (limited to 'News-Android-App/src/main')
-rw-r--r-- | News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/NewsReaderDetailFragment.java | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/NewsReaderDetailFragment.java b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/NewsReaderDetailFragment.java index c96aa52c..d15380bb 100644 --- a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/NewsReaderDetailFragment.java +++ b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/NewsReaderDetailFragment.java @@ -594,15 +594,12 @@ public class NewsReaderDetailFragment extends Fragment { public void onSwiped(final RecyclerView.ViewHolder viewHolder, final int direction) { final NewsListRecyclerAdapter adapter = (NewsListRecyclerAdapter) recyclerView.getAdapter(); - String prefName, defValue; - if (direction == ItemTouchHelper.LEFT) { - prefName = SP_SWIPE_LEFT_ACTION; - defValue = SP_SWIPE_LEFT_ACTION_DEFAULT; - } else { - prefName = SettingsActivity.SP_SWIPE_RIGHT_ACTION; - defValue = SP_SWIPE_RIGHT_ACTION_DEFAULT; - } - switch (mPrefs.getString(prefName, defValue)) { + String swipeAction; + if (direction == ItemTouchHelper.LEFT) + swipeAction = mPrefs.getString(SP_SWIPE_LEFT_ACTION, SP_SWIPE_LEFT_ACTION_DEFAULT); + else + swipeAction = mPrefs.getString(SP_SWIPE_RIGHT_ACTION, SP_SWIPE_RIGHT_ACTION_DEFAULT); + switch (swipeAction) { case "0": // Open link in browser and mark as read String currentUrl = ((ViewHolder) viewHolder).getRssItem().getLink(); Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(currentUrl)); @@ -615,6 +612,8 @@ public class NewsReaderDetailFragment extends Fragment { case "2": // Read adapter.toggleReadStateOfItem((ViewHolder) viewHolder); break; + default: + Log.e(TAG, "Swipe preferences has an invalid value"); } // Hack to reset view, see https://code.google.com/p/android/issues/detail?id=175798 recyclerView.removeView(viewHolder.itemView); |