diff --git a/twidere.component.common/src/main/java/org/mariotaku/microblog/library/twitter/model/ResponseList$$JsonObjectMapper.java b/twidere.component.common/src/main/java/org/mariotaku/microblog/library/twitter/model/ResponseList$$JsonObjectMapper.java index 93a244b95..41dc3cff4 100644 --- a/twidere.component.common/src/main/java/org/mariotaku/microblog/library/twitter/model/ResponseList$$JsonObjectMapper.java +++ b/twidere.component.common/src/main/java/org/mariotaku/microblog/library/twitter/model/ResponseList$$JsonObjectMapper.java @@ -61,11 +61,8 @@ public final class ResponseList$$JsonObjectMapper extends JsonMapper instance, String fieldName, JsonParser jsonParser) throws IOException { - switch (fieldName) { - case "results": { - instance.addAll(m84ClassJsonMapper.parseList(jsonParser)); - break; - } + if ("results".equals(fieldName)) { + instance.addAll(m84ClassJsonMapper.parseList(jsonParser)); } } diff --git a/twidere.component.common/src/main/java/org/mariotaku/twidere/model/message/conversation/ConversationExtras.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/model/message/conversation/ConversationExtras.java index 345db02fc..7f30d1c8c 100644 --- a/twidere.component.common/src/main/java/org/mariotaku/twidere/model/message/conversation/ConversationExtras.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/model/message/conversation/ConversationExtras.java @@ -35,10 +35,8 @@ import java.io.IOException; public abstract class ConversationExtras implements Parcelable { public static ConversationExtras parse(@NonNull final String extrasType, @Nullable final String json) throws IOException { if (json == null) return null; - switch (extrasType) { - case ExtrasType.TWITTER_OFFICIAL: { - return LoganSquare.parse(json, TwitterOfficialConversationExtras.class); - } + if (ExtrasType.TWITTER_OFFICIAL.equals(extrasType)) { + return LoganSquare.parse(json, TwitterOfficialConversationExtras.class); } return LoganSquare.parse(json, DefaultConversationExtras.class); } diff --git a/twidere/src/main/java/org/mariotaku/twidere/fragment/DataExportImportTypeSelectorDialogFragment.java b/twidere/src/main/java/org/mariotaku/twidere/fragment/DataExportImportTypeSelectorDialogFragment.java index ab3f95d0a..1e6817c91 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/fragment/DataExportImportTypeSelectorDialogFragment.java +++ b/twidere/src/main/java/org/mariotaku/twidere/fragment/DataExportImportTypeSelectorDialogFragment.java @@ -66,12 +66,9 @@ public final class DataExportImportTypeSelectorDialogFragment extends BaseDialog @Override public final void onClick(final DialogInterface dialog, final int which) { - switch (which) { - case DialogInterface.BUTTON_POSITIVE: { - final int flags = getCheckedFlags(); - onPositiveButtonClicked(flags); - break; - } + if (which == DialogInterface.BUTTON_POSITIVE) { + final int flags = getCheckedFlags(); + onPositiveButtonClicked(flags); } } diff --git a/twidere/src/main/java/org/mariotaku/twidere/fragment/KeyboardShortcutsFragment.java b/twidere/src/main/java/org/mariotaku/twidere/fragment/KeyboardShortcutsFragment.java index da22ce032..66fa84f94 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/fragment/KeyboardShortcutsFragment.java +++ b/twidere/src/main/java/org/mariotaku/twidere/fragment/KeyboardShortcutsFragment.java @@ -66,12 +66,10 @@ public class KeyboardShortcutsFragment extends BasePreferenceFragment implements @Override public boolean onOptionsItemSelected(MenuItem item) { - switch (item.getItemId()) { - case R.id.reset: { - final DialogFragment f = new ResetKeyboardShortcutConfirmDialogFragment(); - f.show(getFragmentManager(), "reset_keyboard_shortcut_confirm"); - return true; - } + if (item.getItemId() == R.id.reset) { + final DialogFragment f = new ResetKeyboardShortcutConfirmDialogFragment(); + f.show(getFragmentManager(), "reset_keyboard_shortcut_confirm"); + return true; } return super.onOptionsItemSelected(item); } @@ -132,11 +130,8 @@ public class KeyboardShortcutsFragment extends BasePreferenceFragment implements implements OnClickListener { @Override public void onClick(DialogInterface dialog, int which) { - switch (which) { - case DialogInterface.BUTTON_POSITIVE: { - keyboardShortcutsHandler.reset(); - break; - } + if (which == DialogInterface.BUTTON_POSITIVE) { + keyboardShortcutsHandler.reset(); } } diff --git a/twidere/src/main/java/org/mariotaku/twidere/util/RecyclerViewNavigationHelper.java b/twidere/src/main/java/org/mariotaku/twidere/util/RecyclerViewNavigationHelper.java index 0d9fe69fb..3c1b0ff82 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/util/RecyclerViewNavigationHelper.java +++ b/twidere/src/main/java/org/mariotaku/twidere/util/RecyclerViewNavigationHelper.java @@ -112,13 +112,11 @@ public class RecyclerViewNavigationHelper implements KeyboardShortcutCallback { public boolean handleKeyboardShortcutSingle(@NonNull KeyboardShortcutsHandler handler, int keyCode, @NonNull KeyEvent event, int metaState) { final String action = handler.getKeyAction(CONTEXT_TAG_NAVIGATION, keyCode, event, metaState); if (action == null) return false; - switch (action) { - case ACTION_NAVIGATION_TOP: { - if (iface != null) { - iface.scrollToStart(); - } - return true; + if (ACTION_NAVIGATION_TOP.equals(action)) { + if (iface != null) { + iface.scrollToStart(); } + return true; } return false; } diff --git a/twidere/src/main/java/org/mariotaku/twidere/util/media/preview/provider/ImgurProvider.java b/twidere/src/main/java/org/mariotaku/twidere/util/media/preview/provider/ImgurProvider.java index 59ab2d90a..6c2a77f11 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/util/media/preview/provider/ImgurProvider.java +++ b/twidere/src/main/java/org/mariotaku/twidere/util/media/preview/provider/ImgurProvider.java @@ -15,12 +15,7 @@ public class ImgurProvider implements Provider { public boolean supports(@NonNull String link) { final String authority = UriUtils.getAuthority(link); if (authority == null) return false; - switch (authority) { - case "i.imgur.com": - return true; - default: - return false; - } + return "i.imgur.com".equals(authority); } @Nullable @@ -28,13 +23,11 @@ public class ImgurProvider implements Provider { public ParcelableMedia from(@NonNull String url) { final String authority = UriUtils.getAuthority(url); if (authority == null) return null; - switch (authority) { - case "i.imgur.com": { - final String path = UriUtils.getPath(url); - if (path == null) return null; - ParcelableMedia media = new ParcelableMedia(); - media.url = url; - } + if ("i.imgur.com".equals(authority)) { + final String path = UriUtils.getPath(url); + if (path == null) return null; + ParcelableMedia media = new ParcelableMedia(); + media.url = url; } return null; }