diff --git a/twidere.component.common/src/main/java/org/mariotaku/twidere/constant/SharedPreferenceConstants.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/constant/SharedPreferenceConstants.java index a625e01a7..e4711c9f3 100644 --- a/twidere.component.common/src/main/java/org/mariotaku/twidere/constant/SharedPreferenceConstants.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/constant/SharedPreferenceConstants.java @@ -68,13 +68,13 @@ public interface SharedPreferenceConstants { String VALUE_COMPOSE_QUIT_ACTION_SAVE = "save"; String VALUE_COMPOSE_QUIT_ACTION_DISCARD = "discard"; - String VALUE_TAB_DIPLAY_OPTION_ICON = "icon"; - String VALUE_TAB_DIPLAY_OPTION_LABEL = "label"; - String VALUE_TAB_DIPLAY_OPTION_BOTH = "both"; - int VALUE_TAB_DIPLAY_OPTION_CODE_ICON = 0x1; - int VALUE_TAB_DIPLAY_OPTION_CODE_LABEL = 0x2; - int VALUE_TAB_DIPLAY_OPTION_CODE_BOTH = VALUE_TAB_DIPLAY_OPTION_CODE_ICON - | VALUE_TAB_DIPLAY_OPTION_CODE_LABEL; + String VALUE_TAB_DISPLAY_OPTION_ICON = "icon"; + String VALUE_TAB_DISPLAY_OPTION_LABEL = "label"; + String VALUE_TAB_DISPLAY_OPTION_BOTH = "both"; + int VALUE_TAB_DISPLAY_OPTION_CODE_LABEL = 0x1; + int VALUE_TAB_DISPLAY_OPTION_CODE_ICON = 0x2; + int VALUE_TAB_DISPLAY_OPTION_CODE_BOTH = VALUE_TAB_DISPLAY_OPTION_CODE_ICON + | VALUE_TAB_DISPLAY_OPTION_CODE_LABEL; String VALUE_THEME_BACKGROUND_DEFAULT = "default"; String VALUE_THEME_BACKGROUND_SOLID = "solid"; diff --git a/twidere.component.common/src/main/java/org/mariotaku/twidere/model/ParcelableAccount.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/model/ParcelableAccount.java index 1efb5ab7b..34957901b 100644 --- a/twidere.component.common/src/main/java/org/mariotaku/twidere/model/ParcelableAccount.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/model/ParcelableAccount.java @@ -148,6 +148,7 @@ public class ParcelableAccount implements Parcelable { return null; } + @NonNull public static long[] getAccountIds(final ParcelableAccount[] accounts) { final long[] ids = new long[accounts.length]; for (int i = 0, j = accounts.length; i < j; i++) { @@ -156,6 +157,7 @@ public class ParcelableAccount implements Parcelable { return ids; } + @NonNull public static ParcelableAccount[] getAccounts(final Context context, final boolean activatedOnly, final boolean officialKeyOnly) { final List list = getAccountsList(context, activatedOnly, officialKeyOnly); diff --git a/twidere/build.gradle b/twidere/build.gradle index d3b6b5e00..516e9d6b0 100644 --- a/twidere/build.gradle +++ b/twidere/build.gradle @@ -58,8 +58,8 @@ repositories { maven { url "https://jitpack.io" } } -configurations.all { - exclude group: 'org.yaml', module: 'snakeyaml' +configurations { + all*.exclude group: 'org.yaml', module: 'snakeyaml' } dependencies { diff --git a/twidere/src/main/java/android/support/v4/app/ListFragmentTrojan.java b/twidere/src/main/java/android/support/v4/app/ListFragmentTrojan.java deleted file mode 100755 index ea123bf9a..000000000 --- a/twidere/src/main/java/android/support/v4/app/ListFragmentTrojan.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Tweetings - Twitter client for Android - * - * Copyright (C) 2012 Mariotaku Lee - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package android.support.v4.app; - -public interface ListFragmentTrojan { - - public static final int INTERNAL_EMPTY_ID = ListFragment.INTERNAL_EMPTY_ID; - public static final int INTERNAL_PROGRESS_CONTAINER_ID = ListFragment.INTERNAL_PROGRESS_CONTAINER_ID; - public static final int INTERNAL_LIST_CONTAINER_ID = ListFragment.INTERNAL_LIST_CONTAINER_ID; -} diff --git a/twidere/src/main/java/android/support/v7/app/ThemedAppCompatDelegateFactory.java b/twidere/src/main/java/android/support/v7/app/ThemedAppCompatDelegateFactory.java index 16354fc31..0c6b63d9d 100644 --- a/twidere/src/main/java/android/support/v7/app/ThemedAppCompatDelegateFactory.java +++ b/twidere/src/main/java/android/support/v7/app/ThemedAppCompatDelegateFactory.java @@ -89,7 +89,7 @@ public class ThemedAppCompatDelegateFactory implements Constants { } } - public static interface KeyListener { + public interface KeyListener { boolean onKeyDown(int keyCode, KeyEvent event); diff --git a/twidere/src/main/java/com/meizu/flyme/reflect/StatusBarProxy.java b/twidere/src/main/java/com/meizu/flyme/reflect/StatusBarProxy.java index 8db7d7fcc..4da5efb72 100755 --- a/twidere/src/main/java/com/meizu/flyme/reflect/StatusBarProxy.java +++ b/twidere/src/main/java/com/meizu/flyme/reflect/StatusBarProxy.java @@ -1,9 +1,5 @@ package com.meizu.flyme.reflect; -import android.annotation.TargetApi; -import android.content.Context; -import android.os.Build; -import android.util.Log; import android.view.Window; import android.view.WindowManager; diff --git a/twidere/src/main/java/org/mariotaku/twidere/activity/TwitterLinkHandlerActivity.java b/twidere/src/main/java/org/mariotaku/twidere/activity/TwitterLinkHandlerActivity.java index 7114149da..a54e6e42e 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/activity/TwitterLinkHandlerActivity.java +++ b/twidere/src/main/java/org/mariotaku/twidere/activity/TwitterLinkHandlerActivity.java @@ -22,6 +22,7 @@ import static org.mariotaku.twidere.util.Utils.getDefaultAccountId; public class TwitterLinkHandlerActivity extends Activity implements Constants { + @SuppressWarnings("SpellCheckingInspection") public static final String[] TWITTER_RESERVED_PATHS = {"about", "account", "accounts", "activity", "all", "announcements", "anywhere", "api_rules", "api_terms", "apirules", "apps", "auth", "badges", "blog", "business", "buttons", "contacts", "devices", "direct_messages", "download", "downloads", diff --git a/twidere/src/main/java/org/mariotaku/twidere/activity/iface/IControlBarActivity.java b/twidere/src/main/java/org/mariotaku/twidere/activity/iface/IControlBarActivity.java index cec40b0a8..3f1c815cf 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/activity/iface/IControlBarActivity.java +++ b/twidere/src/main/java/org/mariotaku/twidere/activity/iface/IControlBarActivity.java @@ -11,25 +11,25 @@ import android.view.animation.DecelerateInterpolator; */ public interface IControlBarActivity { - public void setControlBarOffset(float offset); + void setControlBarOffset(float offset); - public void setControlBarVisibleAnimate(boolean visible); + void setControlBarVisibleAnimate(boolean visible); - public float getControlBarOffset(); + float getControlBarOffset(); - public int getControlBarHeight(); + int getControlBarHeight(); - public void notifyControlBarOffsetChanged(); + void notifyControlBarOffsetChanged(); - public void registerControlBarOffsetListener(ControlBarOffsetListener listener); + void registerControlBarOffsetListener(ControlBarOffsetListener listener); - public void unregisterControlBarOffsetListener(ControlBarOffsetListener listener); + void unregisterControlBarOffsetListener(ControlBarOffsetListener listener); - public interface ControlBarOffsetListener { - public void onControlBarOffsetChanged(IControlBarActivity activity, float offset); + interface ControlBarOffsetListener { + void onControlBarOffsetChanged(IControlBarActivity activity, float offset); } - public final class ControlBarShowHideHelper { + final class ControlBarShowHideHelper { private static final long DURATION = 200l; diff --git a/twidere/src/main/java/org/mariotaku/twidere/activity/support/DataImportActivity.java b/twidere/src/main/java/org/mariotaku/twidere/activity/support/DataImportActivity.java index d8df13a96..4da341d99 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/activity/support/DataImportActivity.java +++ b/twidere/src/main/java/org/mariotaku/twidere/activity/support/DataImportActivity.java @@ -5,7 +5,6 @@ import android.os.Bundle; import android.os.Environment; import android.support.v4.app.DialogFragment; import android.support.v4.app.Fragment; -import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentManager; import org.mariotaku.twidere.R; diff --git a/twidere/src/main/java/org/mariotaku/twidere/activity/support/QuickSearchBarActivity.java b/twidere/src/main/java/org/mariotaku/twidere/activity/support/QuickSearchBarActivity.java index 98122a830..acd78a2f8 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/activity/support/QuickSearchBarActivity.java +++ b/twidere/src/main/java/org/mariotaku/twidere/activity/support/QuickSearchBarActivity.java @@ -290,7 +290,7 @@ public class QuickSearchBarActivity extends ThemedFragmentActivity implements On window.setAttributes(attributes); } - static interface SuggestionItem { + interface SuggestionItem { void bindView(SuggestionsAdapter adapter, View view, int position); diff --git a/twidere/src/main/java/org/mariotaku/twidere/adapter/AbsActivitiesAdapter.java b/twidere/src/main/java/org/mariotaku/twidere/adapter/AbsActivitiesAdapter.java index 70e995bfa..8ef24468c 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/adapter/AbsActivitiesAdapter.java +++ b/twidere/src/main/java/org/mariotaku/twidere/adapter/AbsActivitiesAdapter.java @@ -385,7 +385,7 @@ public abstract class AbsActivitiesAdapter extends Adapter imp return mDisplayMediaPreview; } - public static interface ActivityAdapterListener { + public interface ActivityAdapterListener { void onGapClick(GapViewHolder holder, int position); } diff --git a/twidere/src/main/java/org/mariotaku/twidere/adapter/AbsStatusesAdapter.java b/twidere/src/main/java/org/mariotaku/twidere/adapter/AbsStatusesAdapter.java index 6914cb795..c353e172d 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/adapter/AbsStatusesAdapter.java +++ b/twidere/src/main/java/org/mariotaku/twidere/adapter/AbsStatusesAdapter.java @@ -303,7 +303,7 @@ public abstract class AbsStatusesAdapter extends LoadMoreSupportAdapter extends LoadMoreSupportAdapter extends LoadMoreSupportAdapter map = getConfiguraionMap(); + final HashMap map = getConfigurationMap(); final List> tabs = new ArrayList<>( map.entrySet()); Collections.sort(tabs, CustomTabConfigurationComparator.SINGLETON); @@ -289,18 +289,18 @@ public class CustomTabsFragment extends BaseFragment implements LoaderCallbacks< final String type = entry.getKey(); final CustomTabConfiguration conf = entry.getValue(); - final boolean isOfficiakKeyAccountRequired = TAB_TYPE_ACTIVITIES_ABOUT_ME.equals(type) + final boolean isOfficialKeyAccountRequired = TAB_TYPE_ACTIVITIES_ABOUT_ME.equals(type) || TAB_TYPE_ACTIVITIES_BY_FRIENDS.equals(type); final boolean accountIdRequired = conf.getAccountRequirement() == CustomTabConfiguration.ACCOUNT_REQUIRED; final Intent intent = new Intent(INTENT_ACTION_ADD_TAB); intent.setClass(getActivity(), CustomTabEditorActivity.class); intent.putExtra(EXTRA_TYPE, type); - intent.putExtra(EXTRA_OFFICIAL_KEY_ONLY, isOfficiakKeyAccountRequired); + intent.putExtra(EXTRA_OFFICIAL_KEY_ONLY, isOfficialKeyAccountRequired); final MenuItem subItem = subMenu.add(conf.getDefaultTitle()); final boolean disabledByNoAccount = accountIdRequired && accountIds.length == 0; - final boolean disabledByNoOfficialKey = !forcePrivateAPI && isOfficiakKeyAccountRequired && !hasOfficialKeyAccounts; + final boolean disabledByNoOfficialKey = !forcePrivateAPI && isOfficialKeyAccountRequired && !hasOfficialKeyAccounts; final boolean disabledByDuplicateTab = conf.isSingleTab() && isTabAdded(getActivity(), type); final boolean shouldDisable = disabledByDuplicateTab || disabledByNoOfficialKey || disabledByNoAccount; subItem.setVisible(!shouldDisable); diff --git a/twidere/src/main/java/org/mariotaku/twidere/fragment/iface/IBaseFragment.java b/twidere/src/main/java/org/mariotaku/twidere/fragment/iface/IBaseFragment.java index 79748fcde..05d3263cb 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/fragment/iface/IBaseFragment.java +++ b/twidere/src/main/java/org/mariotaku/twidere/fragment/iface/IBaseFragment.java @@ -32,7 +32,7 @@ public interface IBaseFragment { void onBaseViewCreated(View view, Bundle savedInstanceState); - public interface SystemWindowsInsetsCallback { + interface SystemWindowsInsetsCallback { boolean getSystemWindowsInsets(Rect insets); } } diff --git a/twidere/src/main/java/org/mariotaku/twidere/fragment/iface/IBasePullToRefreshFragment.java b/twidere/src/main/java/org/mariotaku/twidere/fragment/iface/IBasePullToRefreshFragment.java index fe8698203..b871cc0f2 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/fragment/iface/IBasePullToRefreshFragment.java +++ b/twidere/src/main/java/org/mariotaku/twidere/fragment/iface/IBasePullToRefreshFragment.java @@ -21,9 +21,9 @@ package org.mariotaku.twidere.fragment.iface; public interface IBasePullToRefreshFragment { - public void onRefresh(); + void onRefresh(); - public boolean isRefreshing(); + boolean isRefreshing(); void setRefreshing(boolean refresh); } diff --git a/twidere/src/main/java/org/mariotaku/twidere/fragment/iface/IMapFragment.java b/twidere/src/main/java/org/mariotaku/twidere/fragment/iface/IMapFragment.java index b4cc79610..29295abb9 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/fragment/iface/IMapFragment.java +++ b/twidere/src/main/java/org/mariotaku/twidere/fragment/iface/IMapFragment.java @@ -21,6 +21,6 @@ package org.mariotaku.twidere.fragment.iface; public interface IMapFragment { - public void center(); + void center(); } diff --git a/twidere/src/main/java/org/mariotaku/twidere/fragment/iface/RefreshScrollTopInterface.java b/twidere/src/main/java/org/mariotaku/twidere/fragment/iface/RefreshScrollTopInterface.java index de259f5c5..b296a0aad 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/fragment/iface/RefreshScrollTopInterface.java +++ b/twidere/src/main/java/org/mariotaku/twidere/fragment/iface/RefreshScrollTopInterface.java @@ -21,8 +21,8 @@ package org.mariotaku.twidere.fragment.iface; public interface RefreshScrollTopInterface { - public boolean scrollToStart(); + boolean scrollToStart(); - public boolean triggerRefresh(); + boolean triggerRefresh(); } diff --git a/twidere/src/main/java/org/mariotaku/twidere/fragment/iface/SupportFragmentCallback.java b/twidere/src/main/java/org/mariotaku/twidere/fragment/iface/SupportFragmentCallback.java index b81103e8d..606a04d03 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/fragment/iface/SupportFragmentCallback.java +++ b/twidere/src/main/java/org/mariotaku/twidere/fragment/iface/SupportFragmentCallback.java @@ -23,8 +23,8 @@ import android.support.v4.app.Fragment; public interface SupportFragmentCallback { - public Fragment getCurrentVisibleFragment(); + Fragment getCurrentVisibleFragment(); - public boolean triggerRefresh(int position); + boolean triggerRefresh(int position); } diff --git a/twidere/src/main/java/org/mariotaku/twidere/fragment/support/AccountsDashboardFragment.java b/twidere/src/main/java/org/mariotaku/twidere/fragment/support/AccountsDashboardFragment.java index 084ddf5ed..955a249d4 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/fragment/support/AccountsDashboardFragment.java +++ b/twidere/src/main/java/org/mariotaku/twidere/fragment/support/AccountsDashboardFragment.java @@ -243,7 +243,6 @@ public class AccountsDashboardFragment extends BaseSupportFragment implements Lo public void onLoadFinished(final Loader loader, final Cursor data) { final Menu menu = mAccountsToggleMenu.getMenu(); mAccountActionProvider = (AccountToggleProvider) MenuItemCompat.getActionProvider(menu.findItem(MENU_SELECT_ACCOUNT)); - mAccountActionProvider.setExclusive(false); final ParcelableAccount[] accounts = ParcelableAccount.getAccounts(data); long defaultId = -1; for (ParcelableAccount account : accounts) { @@ -255,7 +254,11 @@ public class AccountsDashboardFragment extends BaseSupportFragment implements Lo mAccountsAdapter.setAccounts(accounts); mAccountsAdapter.setSelectedAccountId(mPreferences.getLong(KEY_DEFAULT_ACCOUNT_ID, defaultId)); mAccountOptionsAdapter.setSelectedAccount(mAccountsAdapter.getSelectedAccount()); - mAccountActionProvider.setAccounts(accounts); + + if (mAccountActionProvider != null) { + mAccountActionProvider.setExclusive(false); + mAccountActionProvider.setAccounts(accounts); + } initAccountActionsAdapter(accounts); updateAccountOptionsSeparatorLabel(null); diff --git a/twidere/src/main/java/org/mariotaku/twidere/fragment/support/AccountsManagerFragment.java b/twidere/src/main/java/org/mariotaku/twidere/fragment/support/AccountsManagerFragment.java index e41f969e9..917f30e24 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/fragment/support/AccountsManagerFragment.java +++ b/twidere/src/main/java/org/mariotaku/twidere/fragment/support/AccountsManagerFragment.java @@ -12,7 +12,6 @@ import android.content.SharedPreferences; import android.content.SharedPreferences.OnSharedPreferenceChangeListener; import android.database.Cursor; import android.graphics.Color; -import android.graphics.Rect; import android.net.Uri; import android.os.Bundle; import android.support.annotation.NonNull; diff --git a/twidere/src/main/java/org/mariotaku/twidere/fragment/support/ColorPickerDialogFragment.java b/twidere/src/main/java/org/mariotaku/twidere/fragment/support/ColorPickerDialogFragment.java index 3ccae2707..bf1c39901 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/fragment/support/ColorPickerDialogFragment.java +++ b/twidere/src/main/java/org/mariotaku/twidere/fragment/support/ColorPickerDialogFragment.java @@ -106,11 +106,11 @@ public final class ColorPickerDialogFragment extends BaseSupportDialogFragment i super.onSaveInstanceState(outState); } - public static interface Callback extends IDialogFragmentCallback { + public interface Callback extends IDialogFragmentCallback { - public void onColorCleared(); + void onColorCleared(); - public void onColorSelected(int color); + void onColorSelected(int color); } diff --git a/twidere/src/main/java/org/mariotaku/twidere/fragment/support/DataExportImportTypeSelectorDialogFragment.java b/twidere/src/main/java/org/mariotaku/twidere/fragment/support/DataExportImportTypeSelectorDialogFragment.java index bb8fee869..454303f46 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/fragment/support/DataExportImportTypeSelectorDialogFragment.java +++ b/twidere/src/main/java/org/mariotaku/twidere/fragment/support/DataExportImportTypeSelectorDialogFragment.java @@ -162,7 +162,7 @@ public final class DataExportImportTypeSelectorDialogFragment extends BaseSuppor positiveButton.setEnabled(getCheckedFlags() != 0); } - public static interface Callback extends ISupportDialogFragmentCallback { + public interface Callback extends ISupportDialogFragmentCallback { void onPositiveButtonClicked(String path, int flags); } diff --git a/twidere/src/main/java/org/mariotaku/twidere/fragment/support/DraftsFragment.java b/twidere/src/main/java/org/mariotaku/twidere/fragment/support/DraftsFragment.java index a68ce7e1e..4484c9182 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/fragment/support/DraftsFragment.java +++ b/twidere/src/main/java/org/mariotaku/twidere/fragment/support/DraftsFragment.java @@ -29,7 +29,6 @@ import android.content.DialogInterface.OnClickListener; import android.content.Intent; import android.content.SharedPreferences; import android.database.Cursor; -import android.graphics.Rect; import android.net.Uri; import android.os.AsyncTask; import android.os.Bundle; diff --git a/twidere/src/main/java/org/mariotaku/twidere/fragment/support/FileSelectorDialogFragment.java b/twidere/src/main/java/org/mariotaku/twidere/fragment/support/FileSelectorDialogFragment.java index 7ccf5a7a2..a744d4ec7 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/fragment/support/FileSelectorDialogFragment.java +++ b/twidere/src/main/java/org/mariotaku/twidere/fragment/support/FileSelectorDialogFragment.java @@ -191,7 +191,7 @@ public class FileSelectorDialogFragment extends BaseSupportDialogFragment implem dialog.setTitle(title); } - public static interface Callback extends ISupportDialogFragmentCallback { + public interface Callback extends ISupportDialogFragmentCallback { void onFilePicked(File file); } diff --git a/twidere/src/main/java/org/mariotaku/twidere/fragment/support/StatusFragment.java b/twidere/src/main/java/org/mariotaku/twidere/fragment/support/StatusFragment.java index adc4767bd..11399c1a9 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/fragment/support/StatusFragment.java +++ b/twidere/src/main/java/org/mariotaku/twidere/fragment/support/StatusFragment.java @@ -28,7 +28,6 @@ import android.content.Intent; import android.content.res.Resources; import android.graphics.Color; import android.graphics.Point; -import android.graphics.Rect; import android.nfc.NdefMessage; import android.nfc.NdefRecord; import android.nfc.NfcAdapter.CreateNdefMessageCallback; @@ -1102,7 +1101,7 @@ public class StatusFragment extends BaseSupportFragment implements LoaderCallbac private final boolean mIsCompact; private final int mProfileImageStyle; private final int mMediaPreviewStyle; - private final int mLinkHighligingStyle; + private final int mLinkHighlightingStyle; private final boolean mDisplayMediaPreview; private final boolean mDisplayProfileImage; private final boolean mSensitiveContentEnabled; @@ -1139,7 +1138,7 @@ public class StatusFragment extends BaseSupportFragment implements LoaderCallbac mTextSize = preferences.getInt(KEY_TEXT_SIZE, res.getInteger(R.integer.default_text_size)); mProfileImageStyle = Utils.getProfileImageStyle(preferences.getString(KEY_PROFILE_IMAGE_STYLE, null)); mMediaPreviewStyle = Utils.getMediaPreviewStyle(preferences.getString(KEY_MEDIA_PREVIEW_STYLE, null)); - mLinkHighligingStyle = Utils.getLinkHighlightingStyleInt(preferences.getString(KEY_LINK_HIGHLIGHT_OPTION, null)); + mLinkHighlightingStyle = Utils.getLinkHighlightingStyleInt(preferences.getString(KEY_LINK_HIGHLIGHT_OPTION, null)); mIsCompact = compact; mDisplayProfileImage = preferences.getBoolean(KEY_DISPLAY_PROFILE_IMAGE, true); mDisplayMediaPreview = preferences.getBoolean(KEY_MEDIA_PREVIEW, false); @@ -1206,7 +1205,7 @@ public class StatusFragment extends BaseSupportFragment implements LoaderCallbac @Override public int getLinkHighlightingStyle() { - return mLinkHighligingStyle; + return mLinkHighlightingStyle; } @Override diff --git a/twidere/src/main/java/org/mariotaku/twidere/fragment/support/UserFragment.java b/twidere/src/main/java/org/mariotaku/twidere/fragment/support/UserFragment.java index 9ac168970..85d445c3c 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/fragment/support/UserFragment.java +++ b/twidere/src/main/java/org/mariotaku/twidere/fragment/support/UserFragment.java @@ -1077,7 +1077,7 @@ public class UserFragment extends BaseSupportFragment implements OnClickListener mProfileBannerSpace = headerView.findViewById(R.id.profile_banner_space); mViewPager = (ViewPager) contentView.findViewById(R.id.view_pager); mPagerIndicator = (TabPagerIndicator) contentView.findViewById(R.id.view_pager_tabs); - mPagerOverlay = (View) contentView.findViewById(R.id.pager_window_overlay); + mPagerOverlay = contentView.findViewById(R.id.pager_window_overlay); mFollowButton = (Button) headerView.findViewById(R.id.follow); mFollowProgress = (ProgressBar) headerView.findViewById(R.id.follow_progress); mUuckyFooter = headerView.findViewById(R.id.uucky_footer); diff --git a/twidere/src/main/java/org/mariotaku/twidere/loader/support/TileImageLoader.java b/twidere/src/main/java/org/mariotaku/twidere/loader/support/TileImageLoader.java index 7a85ca99a..b9a3adbee 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/loader/support/TileImageLoader.java +++ b/twidere/src/main/java/org/mariotaku/twidere/loader/support/TileImageLoader.java @@ -165,7 +165,7 @@ public class TileImageLoader extends AsyncTaskLoader { } } - public static interface DownloadListener { + public interface DownloadListener { void onDownloadError(Throwable t); void onDownloadFinished(); diff --git a/twidere/src/main/java/org/mariotaku/twidere/loader/support/UserTimelineLoader.java b/twidere/src/main/java/org/mariotaku/twidere/loader/support/UserTimelineLoader.java index 648565957..a61952044 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/loader/support/UserTimelineLoader.java +++ b/twidere/src/main/java/org/mariotaku/twidere/loader/support/UserTimelineLoader.java @@ -55,13 +55,12 @@ public class UserTimelineLoader extends TwitterAPIStatusesLoader { @NonNull @Override protected ResponseList getStatuses(@NonNull final Twitter twitter, final Paging paging) throws TwitterException { - if (twitter == null) return null; if (mUserId != -1) return twitter.getUserTimeline(mUserId, paging); else if (mUserScreenName != null) return twitter.getUserTimeline(mUserScreenName, paging); else - return null; + throw new TwitterException("Invalid user"); } @Override diff --git a/twidere/src/main/java/org/mariotaku/twidere/model/CustomTabConfiguration.java b/twidere/src/main/java/org/mariotaku/twidere/model/CustomTabConfiguration.java index e9e591545..729436216 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/model/CustomTabConfiguration.java +++ b/twidere/src/main/java/org/mariotaku/twidere/model/CustomTabConfiguration.java @@ -173,7 +173,7 @@ public final class CustomTabConfiguration { return new ExtraConfiguration(key, titleRes, Type.BOOLEAN, def); } - public static enum Type { + public enum Type { BOOLEAN } } diff --git a/twidere/src/main/java/org/mariotaku/twidere/preference/AccountsListPreference.java b/twidere/src/main/java/org/mariotaku/twidere/preference/AccountsListPreference.java index fa459d505..c0ead4e8e 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/preference/AccountsListPreference.java +++ b/twidere/src/main/java/org/mariotaku/twidere/preference/AccountsListPreference.java @@ -37,7 +37,6 @@ import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.CompoundButton; import android.widget.CompoundButton.OnCheckedChangeListener; -import android.widget.Switch; import android.widget.TextView; import com.nostra13.universalimageloader.core.assist.FailReason; diff --git a/twidere/src/main/java/org/mariotaku/twidere/preference/AsyncTaskPreference.java b/twidere/src/main/java/org/mariotaku/twidere/preference/AsyncTaskPreference.java index 14c5da438..d7e67df8d 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/preference/AsyncTaskPreference.java +++ b/twidere/src/main/java/org/mariotaku/twidere/preference/AsyncTaskPreference.java @@ -32,69 +32,67 @@ import org.mariotaku.twidere.R; public abstract class AsyncTaskPreference extends Preference implements Constants, OnPreferenceClickListener { - private Task mTask; + private Task mTask; - public AsyncTaskPreference(final Context context) { - this(context, null); - } + public AsyncTaskPreference(final Context context) { + this(context, null); + } - public AsyncTaskPreference(final Context context, final AttributeSet attrs) { - this(context, attrs, android.R.attr.preferenceStyle); - } + public AsyncTaskPreference(final Context context, final AttributeSet attrs) { + this(context, attrs, android.R.attr.preferenceStyle); + } - public AsyncTaskPreference(final Context context, final AttributeSet attrs, final int defStyle) { - super(context, attrs, defStyle); - setOnPreferenceClickListener(this); - } + public AsyncTaskPreference(final Context context, final AttributeSet attrs, final int defStyle) { + super(context, attrs, defStyle); + setOnPreferenceClickListener(this); + } - @Override - public final boolean onPreferenceClick(final Preference preference) { - if (mTask == null || mTask.getStatus() != Status.RUNNING) { - mTask = new Task(this); - mTask.execute(); - } - return true; - } + @Override + public final boolean onPreferenceClick(final Preference preference) { + if (mTask == null || mTask.getStatus() != Status.RUNNING) { + mTask = new Task(this); + mTask.execute(); + } + return true; + } - protected abstract void doInBackground(); + protected abstract void doInBackground(); - private static class Task extends AsyncTask { + private static class Task extends AsyncTask { - private final AsyncTaskPreference mPreference; - private final Context mContext; - private final ProgressDialog mProgress; + private final AsyncTaskPreference mPreference; + private final Context mContext; + private final ProgressDialog mProgress; - public Task(final AsyncTaskPreference preference) { - mPreference = preference; - mContext = preference.getContext(); - mProgress = new ProgressDialog(mContext); - } + public Task(final AsyncTaskPreference preference) { + mPreference = preference; + mContext = preference.getContext(); + mProgress = new ProgressDialog(mContext); + } - @Override - protected Object doInBackground(final Object... args) { - mPreference.doInBackground(); - return null; - } + @Override + protected Object doInBackground(final Object... args) { + mPreference.doInBackground(); + return null; + } - @Override - protected void onPostExecute(final Object result) { - if (mProgress == null) return; - if (mProgress.isShowing()) { - mProgress.dismiss(); - } - } + @Override + protected void onPostExecute(final Object result) { + if (mProgress.isShowing()) { + mProgress.dismiss(); + } + } - @Override - protected void onPreExecute() { - if (mProgress == null) return; - if (mProgress.isShowing()) { - mProgress.dismiss(); - } - mProgress.setMessage(mContext.getString(R.string.please_wait)); - mProgress.setCancelable(false); - mProgress.show(); - } + @Override + protected void onPreExecute() { + if (mProgress.isShowing()) { + mProgress.dismiss(); + } + mProgress.setMessage(mContext.getString(R.string.please_wait)); + mProgress.setCancelable(false); + mProgress.show(); + } - } + } } diff --git a/twidere/src/main/java/org/mariotaku/twidere/preference/ClearCachePreference.java b/twidere/src/main/java/org/mariotaku/twidere/preference/ClearCachePreference.java index 1ac44e6a2..5983ea713 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/preference/ClearCachePreference.java +++ b/twidere/src/main/java/org/mariotaku/twidere/preference/ClearCachePreference.java @@ -60,7 +60,9 @@ public class ClearCachePreference extends AsyncTaskPreference { private static void deleteRecursive(final File f) { if (f.isDirectory()) { - for (final File c : f.listFiles()) { + final File[] files = f.listFiles(); + if (files == null) return; + for (final File c : files) { deleteRecursive(c); } } diff --git a/twidere/src/main/java/org/mariotaku/twidere/service/RefreshService.java b/twidere/src/main/java/org/mariotaku/twidere/service/RefreshService.java index bcf99cc46..b10ca8918 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/service/RefreshService.java +++ b/twidere/src/main/java/org/mariotaku/twidere/service/RefreshService.java @@ -296,7 +296,7 @@ public class RefreshService extends Service implements Constants { } } - private static interface RefreshableAccountFilter { + private interface RefreshableAccountFilter { boolean isRefreshable(AccountPreferences pref); } diff --git a/twidere/src/main/java/org/mariotaku/twidere/util/ContentListScrollListener.java b/twidere/src/main/java/org/mariotaku/twidere/util/ContentListScrollListener.java index f7b89a5db..74da06cdf 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/util/ContentListScrollListener.java +++ b/twidere/src/main/java/org/mariotaku/twidere/util/ContentListScrollListener.java @@ -81,7 +81,7 @@ public class ContentListScrollListener extends OnScrollListener { } } - public static interface ContentListSupport { + public interface ContentListSupport { Object getAdapter(); diff --git a/twidere/src/main/java/org/mariotaku/twidere/util/CustomTabUtils.java b/twidere/src/main/java/org/mariotaku/twidere/util/CustomTabUtils.java index 53aea036c..bdb7f4548 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/util/CustomTabUtils.java +++ b/twidere/src/main/java/org/mariotaku/twidere/util/CustomTabUtils.java @@ -128,14 +128,14 @@ public class CustomTabUtils implements Constants { } public static String findTabType(final Class cls) { - for (final Entry entry : getConfiguraionMap().entrySet()) { + for (final Entry entry : getConfigurationMap().entrySet()) { if (classEquals(cls, entry.getValue().getFragmentClass())) return entry.getKey(); } return null; } - public static HashMap getConfiguraionMap() { + public static HashMap getConfigurationMap() { return new HashMap<>(CUSTOM_TABS_CONFIGURATION_MAP); } diff --git a/twidere/src/main/java/org/mariotaku/twidere/util/DataImportExportUtils.java b/twidere/src/main/java/org/mariotaku/twidere/util/DataImportExportUtils.java index 1b7fd461f..7dad3eba8 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/util/DataImportExportUtils.java +++ b/twidere/src/main/java/org/mariotaku/twidere/util/DataImportExportUtils.java @@ -183,7 +183,7 @@ public class DataImportExportUtils implements Constants { zos.closeEntry(); } - private static interface ProcessStrategy { + private interface ProcessStrategy { boolean importValue(JSONObject json, String key, SharedPreferences.Editor editor); boolean exportValue(JSONObject json, String key, SharedPreferences preferences); diff --git a/twidere/src/main/java/org/mariotaku/twidere/util/EditTextEnterHandler.java b/twidere/src/main/java/org/mariotaku/twidere/util/EditTextEnterHandler.java index 476ea35fe..e7a045a77 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/util/EditTextEnterHandler.java +++ b/twidere/src/main/java/org/mariotaku/twidere/util/EditTextEnterHandler.java @@ -124,7 +124,7 @@ public class EditTextEnterHandler implements View.OnKeyListener, OnEditorActionL this.listener = listener; } - public static interface EnterListener { + public interface EnterListener { void onHitEnter(); } diff --git a/twidere/src/main/java/org/mariotaku/twidere/util/Exif.java b/twidere/src/main/java/org/mariotaku/twidere/util/Exif.java index 2f753e181..f340fcacd 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/util/Exif.java +++ b/twidere/src/main/java/org/mariotaku/twidere/util/Exif.java @@ -25,164 +25,164 @@ import java.io.IOException; import java.io.InputStream; public class Exif { - private static final String TAG = "Exif"; + private static final String TAG = "Exif"; - public static int getOrientation(final File file) { - InputStream is = null; - try { - is = new FileInputStream(file); - return getOrientation(is); - } catch (final IOException e) { - return 0; - } finally { - Utils.closeSilently(is); - } - } + public static int getOrientation(final File file) { + InputStream is = null; + try { + is = new FileInputStream(file); + return getOrientation(is); + } catch (final IOException e) { + return 0; + } finally { + Utils.closeSilently(is); + } + } - public static int getOrientation(final FileDescriptor fd) { - InputStream is = null; - try { - is = new FileInputStream(fd); - return getOrientation(is); - } finally { - Utils.closeSilently(is); - } - } + public static int getOrientation(final FileDescriptor fd) { + InputStream is = null; + try { + is = new FileInputStream(fd); + return getOrientation(is); + } finally { + Utils.closeSilently(is); + } + } - public static int getOrientation(final InputStream is) { - if (is == null) return 0; + public static int getOrientation(final InputStream is) { + if (is == null) return 0; - final byte[] buf = new byte[8]; - int length = 0; + final byte[] buf = new byte[8]; + int length = 0; - // ISO/IEC 10918-1:1993(E) - while (read(is, buf, 2) && (buf[0] & 0xFF) == 0xFF) { - final int marker = buf[1] & 0xFF; + // ISO/IEC 10918-1:1993(E) + while (read(is, buf, 2) && (buf[0] & 0xFF) == 0xFF) { + final int marker = buf[1] & 0xFF; - // Check if the marker is a padding. - if (marker == 0xFF) { - continue; - } + // Check if the marker is a padding. + if (marker == 0xFF) { + continue; + } - // Check if the marker is SOI or TEM. - if (marker == 0xD8 || marker == 0x01) { - continue; - } - // Check if the marker is EOI or SOS. - if (marker == 0xD9 || marker == 0xDA) return 0; + // Check if the marker is SOI or TEM. + if (marker == 0xD8 || marker == 0x01) { + continue; + } + // Check if the marker is EOI or SOS. + if (marker == 0xD9 || marker == 0xDA) return 0; - // Get the length and check if it is reasonable. - if (!read(is, buf, 2)) return 0; - length = pack(buf, 0, 2, false); - if (length < 2) { - Log.e(TAG, "Invalid length"); - return 0; - } - length -= 2; + // Get the length and check if it is reasonable. + if (!read(is, buf, 2)) return 0; + length = pack(buf, 0, 2, false); + if (length < 2) { + Log.e(TAG, "Invalid length"); + return 0; + } + length -= 2; - // Break if the marker is EXIF in APP1. - if (marker == 0xE1 && length >= 6) { - if (!read(is, buf, 6)) return 0; - length -= 6; - if (pack(buf, 0, 4, false) == 0x45786966 && pack(buf, 4, 2, false) == 0) { - break; - } - } + // Break if the marker is EXIF in APP1. + if (marker == 0xE1 && length >= 6) { + if (!read(is, buf, 6)) return 0; + length -= 6; + if (pack(buf, 0, 4, false) == 0x45786966 && pack(buf, 4, 2, false) == 0) { + break; + } + } - // Skip other markers. - try { - is.skip(length); - } catch (final IOException ex) { - return 0; - } - length = 0; - } + // Skip other markers. + try { + is.skip(length); + } catch (final IOException ex) { + return 0; + } + length = 0; + } - // JEITA CP-3451 Exif Version 2.2 - if (length > 8) { - int offset = 0; - final byte[] jpeg = new byte[length]; - if (!read(is, jpeg, length)) return 0; + // JEITA CP-3451 Exif Version 2.2 + if (length > 8) { + int offset = 0; + final byte[] jpeg = new byte[length]; + if (!read(is, jpeg, length)) return 0; - // Identify the byte order. - int tag = pack(jpeg, offset, 4, false); - if (tag != 0x49492A00 && tag != 0x4D4D002A) { - Log.e(TAG, "Invalid byte order"); - return 0; - } - final boolean littleEndian = tag == 0x49492A00; + // Identify the byte order. + int tag = pack(jpeg, offset, 4, false); + if (tag != 0x49492A00 && tag != 0x4D4D002A) { + Log.e(TAG, "Invalid byte order"); + return 0; + } + final boolean littleEndian = tag == 0x49492A00; - // Get the offset and check if it is reasonable. - int count = pack(jpeg, offset + 4, 4, littleEndian) + 2; - if (count < 10 || count > length) { - Log.e(TAG, "Invalid offset"); - return 0; - } - offset += count; - length -= count; + // Get the offset and check if it is reasonable. + int count = pack(jpeg, offset + 4, 4, littleEndian) + 2; + if (count < 10 || count > length) { + Log.e(TAG, "Invalid offset"); + return 0; + } + offset += count; + length -= count; - // Get the count and go through all the elements. - count = pack(jpeg, offset - 2, 2, littleEndian); - while (count-- > 0 && length >= 12) { - // Get the tag and check if it is orientation. - tag = pack(jpeg, offset, 2, littleEndian); - if (tag == 0x0112) { - // We do not really care about type and count, do we? - final int orientation = pack(jpeg, offset + 8, 2, littleEndian); - switch (orientation) { - case 1: - return 0; - case 3: - return 180; - case 6: - return 90; - case 8: - return 270; - } - Log.i(TAG, "Unsupported orientation"); - return 0; - } - offset += 12; - length -= 12; - } - } + // Get the count and go through all the elements. + count = pack(jpeg, offset - 2, 2, littleEndian); + while (count-- > 0 && length >= 12) { + // Get the tag and check if it is orientation. + tag = pack(jpeg, offset, 2, littleEndian); + if (tag == 0x0112) { + // We do not really care about type and count, do we? + final int orientation = pack(jpeg, offset + 8, 2, littleEndian); + switch (orientation) { + case 1: + return 0; + case 3: + return 180; + case 6: + return 90; + case 8: + return 270; + } + Log.i(TAG, "Unsupported orientation"); + return 0; + } + offset += 12; + length -= 12; + } + } - Log.i(TAG, "Orientation not found"); - return 0; - } + Log.i(TAG, "Orientation not found"); + return 0; + } - public static int getOrientation(final String file) { - InputStream is = null; - try { - is = new FileInputStream(file); - return getOrientation(is); - } catch (final IOException e) { - return 0; - } finally { - Utils.closeSilently(is); - } - } + public static int getOrientation(final String file) { + InputStream is = null; + try { + is = new FileInputStream(file); + return getOrientation(is); + } catch (final IOException e) { + return 0; + } finally { + Utils.closeSilently(is); + } + } - private static int pack(final byte[] bytes, int offset, int length, final boolean littleEndian) { - int step = 1; - if (littleEndian) { - offset += length - 1; - step = -1; - } + private static int pack(final byte[] bytes, int offset, int length, final boolean littleEndian) { + int step = 1; + if (littleEndian) { + offset += length - 1; + step = -1; + } - int value = 0; - while (length-- > 0) { - value = value << 8 | bytes[offset] & 0xFF; - offset += step; - } - return value; - } + int value = 0; + while (length-- > 0) { + value = value << 8 | bytes[offset] & 0xFF; + offset += step; + } + return value; + } - private static boolean read(final InputStream is, final byte[] buf, final int length) { - try { - return is.read(buf, 0, length) == length; - } catch (final IOException ex) { - return false; - } - } + private static boolean read(final InputStream is, final byte[] buf, final int length) { + try { + return is.read(buf, 0, length) == length; + } catch (final IOException ex) { + return false; + } + } } diff --git a/twidere/src/main/java/org/mariotaku/twidere/util/KeyboardShortcutsHandler.java b/twidere/src/main/java/org/mariotaku/twidere/util/KeyboardShortcutsHandler.java index baa4eeb63..97fb5dd4f 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/util/KeyboardShortcutsHandler.java +++ b/twidere/src/main/java/org/mariotaku/twidere/util/KeyboardShortcutsHandler.java @@ -241,14 +241,14 @@ public class KeyboardShortcutsHandler implements Constants, KeyboardShortcutCons mPreferences.unregisterOnSharedPreferenceChangeListener(listener); } - public static interface KeyboardShortcutCallback extends KeyboardShortcutConstants { + public interface KeyboardShortcutCallback extends KeyboardShortcutConstants { boolean handleKeyboardShortcutRepeat(@NonNull KeyboardShortcutsHandler handler, int keyCode, int repeatCount, @NonNull KeyEvent event); boolean handleKeyboardShortcutSingle(@NonNull KeyboardShortcutsHandler handler, int keyCode, @NonNull KeyEvent event); } - public static interface TakeAllKeyboardShortcut { + public interface TakeAllKeyboardShortcut { } diff --git a/twidere/src/main/java/org/mariotaku/twidere/util/ListScrollDistanceCalculator.java b/twidere/src/main/java/org/mariotaku/twidere/util/ListScrollDistanceCalculator.java index 8d19c51bc..251daf063 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/util/ListScrollDistanceCalculator.java +++ b/twidere/src/main/java/org/mariotaku/twidere/util/ListScrollDistanceCalculator.java @@ -72,7 +72,7 @@ public class ListScrollDistanceCalculator implements OnScrollListener { mScrollDistanceListener = listener; } - public static interface ScrollDistanceListener { + public interface ScrollDistanceListener { void onScrollDistanceChanged(int delta, int total); } } diff --git a/twidere/src/main/java/org/mariotaku/twidere/util/MIUIUtils.java b/twidere/src/main/java/org/mariotaku/twidere/util/MIUIUtils.java deleted file mode 100644 index 52d1a74d4..000000000 --- a/twidere/src/main/java/org/mariotaku/twidere/util/MIUIUtils.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.mariotaku.twidere.util; - -import java.io.IOException; - -public final class MIUIUtils { - - private static final String KEY_MIUI_VERSION_CODE = "ro.miui.ui.version.code"; - private static final String KEY_MIUI_VERSION_NAME = "ro.miui.ui.version.name"; - private static final String KEY_MIUI_INTERNAL_STORAGE = "ro.miui.internal.storage"; - - public static boolean isMIUI() { - try { - final BuildProperties prop = BuildProperties.newInstance(); - return prop.getProperty(KEY_MIUI_VERSION_CODE, null) != null - || prop.getProperty(KEY_MIUI_VERSION_NAME, null) != null - || prop.getProperty(KEY_MIUI_INTERNAL_STORAGE, null) != null; - } catch (final IOException e) { - return false; - } - } -} diff --git a/twidere/src/main/java/org/mariotaku/twidere/util/MapFragmentFactory.java b/twidere/src/main/java/org/mariotaku/twidere/util/MapFragmentFactory.java index a8fa566b2..923cc52ef 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/util/MapFragmentFactory.java +++ b/twidere/src/main/java/org/mariotaku/twidere/util/MapFragmentFactory.java @@ -22,8 +22,6 @@ package org.mariotaku.twidere.util; import android.content.Context; import android.support.v4.app.Fragment; -import org.mariotaku.twidere.model.ParcelableStatus; - /** * Created by mariotaku on 15/4/27. */ diff --git a/twidere/src/main/java/org/mariotaku/twidere/util/MultiSelectManager.java b/twidere/src/main/java/org/mariotaku/twidere/util/MultiSelectManager.java index 2ad29555f..8df964eeb 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/util/MultiSelectManager.java +++ b/twidere/src/main/java/org/mariotaku/twidere/util/MultiSelectManager.java @@ -89,7 +89,7 @@ public class MultiSelectManager implements Constants { mCallbacks.remove(callback); } - public boolean unselectItem(final Object item) { + public boolean deselectItem(final Object item) { return mSelectedItems.remove(item); } @@ -132,13 +132,13 @@ public class MultiSelectManager implements Constants { return TwidereArrayUtils.fromList(ids_list); } - public static interface Callback { + public interface Callback { - public void onItemsCleared(); + void onItemsCleared(); - public void onItemSelected(Object item); + void onItemSelected(Object item); - public void onItemUnselected(Object item); + void onItemUnselected(Object item); } diff --git a/twidere/src/main/java/org/mariotaku/twidere/util/SQLiteDatabaseWrapper.java b/twidere/src/main/java/org/mariotaku/twidere/util/SQLiteDatabaseWrapper.java index 761bfb918..72e58eaf6 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/util/SQLiteDatabaseWrapper.java +++ b/twidere/src/main/java/org/mariotaku/twidere/util/SQLiteDatabaseWrapper.java @@ -101,7 +101,7 @@ public class SQLiteDatabaseWrapper { throw new IllegalStateException("Callback must not return null instance!"); } - public static interface LazyLoadCallback { + public interface LazyLoadCallback { SQLiteDatabase onCreateSQLiteDatabase(); } diff --git a/twidere/src/main/java/org/mariotaku/twidere/util/SimpleDrawerCallback.java b/twidere/src/main/java/org/mariotaku/twidere/util/SimpleDrawerCallback.java index 99211d32c..de03803cf 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/util/SimpleDrawerCallback.java +++ b/twidere/src/main/java/org/mariotaku/twidere/util/SimpleDrawerCallback.java @@ -20,7 +20,6 @@ package org.mariotaku.twidere.util; import android.os.SystemClock; -import android.support.v4.view.ViewPager; import android.support.v7.widget.RecyclerView; import android.view.MotionEvent; import android.view.View; diff --git a/twidere/src/main/java/org/mariotaku/twidere/util/TwidereActionModeForChildListener.java b/twidere/src/main/java/org/mariotaku/twidere/util/TwidereActionModeForChildListener.java index b514c2fc7..e45f29bea 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/util/TwidereActionModeForChildListener.java +++ b/twidere/src/main/java/org/mariotaku/twidere/util/TwidereActionModeForChildListener.java @@ -127,6 +127,7 @@ public class TwidereActionModeForChildListener implements NativeActionModeAwareL mThemed.getCurrentThemeBackgroundOption(), false); mActionModePopup.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT); mShowActionModePopup = new Runnable() { + @Override public void run() { mActionModePopup.showAtLocation( mWindow.getDecorView(), diff --git a/twidere/src/main/java/org/mariotaku/twidere/util/TwidereLinkify.java b/twidere/src/main/java/org/mariotaku/twidere/util/TwidereLinkify.java index 1db40b256..750836454 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/util/TwidereLinkify.java +++ b/twidere/src/main/java/org/mariotaku/twidere/util/TwidereLinkify.java @@ -336,12 +336,12 @@ public final class TwidereLinkify implements Constants { @IntDef({VALUE_LINK_HIGHLIGHT_OPTION_CODE_NONE, VALUE_LINK_HIGHLIGHT_OPTION_CODE_HIGHLIGHT, VALUE_LINK_HIGHLIGHT_OPTION_CODE_UNDERLINE, VALUE_LINK_HIGHLIGHT_OPTION_CODE_BOTH}) @Retention(RetentionPolicy.SOURCE) - public static @interface HighlightStyle { + public @interface HighlightStyle { } public interface OnLinkClickListener { - public void onLinkClick(String link, String orig, long accountId, long extraId, int type, - boolean sensitive, int start, int end); + void onLinkClick(String link, String orig, long accountId, long extraId, int type, + boolean sensitive, int start, int end); } } diff --git a/twidere/src/main/java/org/mariotaku/twidere/util/UserColorNameManager.java b/twidere/src/main/java/org/mariotaku/twidere/util/UserColorNameManager.java index 3931a42c9..e5998cdef 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/util/UserColorNameManager.java +++ b/twidere/src/main/java/org/mariotaku/twidere/util/UserColorNameManager.java @@ -160,11 +160,11 @@ public class UserColorNameManager implements TwidereConstants { return mNicknamePreferences.getAll().entrySet(); } - public static interface OnUserColorChangedListener { + public interface OnUserColorChangedListener { void onUserColorChanged(long userId, int color); } - public static interface OnUserNicknameChangedListener { + public interface OnUserNicknameChangedListener { void onUserNicknameChanged(long userId, String nick); } diff --git a/twidere/src/main/java/org/mariotaku/twidere/util/Utils.java b/twidere/src/main/java/org/mariotaku/twidere/util/Utils.java index d1b6e3459..54a5ff039 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/util/Utils.java +++ b/twidere/src/main/java/org/mariotaku/twidere/util/Utils.java @@ -76,6 +76,7 @@ import android.support.v4.app.ListFragment; import android.support.v4.util.LongSparseArray; import android.support.v4.util.Pair; import android.support.v4.view.ActionProvider; +import android.support.v4.view.GravityCompat; import android.support.v4.view.MenuItemCompat; import android.support.v4.view.accessibility.AccessibilityEventCompat; import android.support.v7.app.AppCompatActivity; @@ -546,8 +547,8 @@ public final class Utils implements Constants, TwitterConstants { return builder.build(); } - public static Expression buildStatusFilterWhereClause(final String table, final Expression extraSelection) { - if (table == null) return null; + @NonNull + public static Expression buildStatusFilterWhereClause(@NonNull final String table, final Expression extraSelection) { final SQLSelectQuery filteredUsersQuery = SQLQueryBuilder .select(new Column(new Table(Filters.Users.TABLE_NAME), Filters.Users.USER_ID)) .from(new Tables(Filters.Users.TABLE_NAME)) @@ -1470,11 +1471,13 @@ public final class Utils implements Constants, TwitterConstants { } } - public static int getAllStatusesCount(final Context context, final Uri uri) { + public static int getAllStatusesCount(final Context context, @NonNull final Uri uri) { if (context == null) return 0; final ContentResolver resolver = context.getContentResolver(); + final String table = getTableNameByUri(uri); + if (table == null) return 0; final Cursor cur = ContentResolverUtils.query(resolver, uri, new String[]{Statuses.STATUS_ID}, - buildStatusFilterWhereClause(getTableNameByUri(uri), null).getSQL(), + buildStatusFilterWhereClause(table, null).getSQL(), null, null); if (cur == null) return 0; try { @@ -1512,11 +1515,14 @@ public final class Utils implements Constants, TwitterConstants { return 0; } + @NonNull public static long[] getAllStatusesIds(final Context context, final Uri uri) { if (context == null) return new long[0]; final ContentResolver resolver = context.getContentResolver(); + final String table = getTableNameByUri(uri); + if (table == null) return new long[0]; final Cursor cur = ContentResolverUtils.query(resolver, uri, new String[]{Statuses.STATUS_ID}, - buildStatusFilterWhereClause(getTableNameByUri(uri), null).getSQL(), + buildStatusFilterWhereClause(table, null).getSQL(), null, null); if (cur == null) return new long[0]; final long[] ids = new long[cur.getCount()]; @@ -2279,11 +2285,11 @@ public final class Utils implements Constants, TwitterConstants { } public static int getTabDisplayOptionInt(final String option) { - if (VALUE_TAB_DIPLAY_OPTION_ICON.equals(option)) - return VALUE_TAB_DIPLAY_OPTION_CODE_ICON; - else if (VALUE_TAB_DIPLAY_OPTION_LABEL.equals(option)) - return VALUE_TAB_DIPLAY_OPTION_CODE_LABEL; - return VALUE_TAB_DIPLAY_OPTION_CODE_BOTH; + if (VALUE_TAB_DISPLAY_OPTION_ICON.equals(option)) + return VALUE_TAB_DISPLAY_OPTION_CODE_ICON; + else if (VALUE_TAB_DISPLAY_OPTION_LABEL.equals(option)) + return VALUE_TAB_DISPLAY_OPTION_CODE_LABEL; + return VALUE_TAB_DISPLAY_OPTION_CODE_BOTH; } public static int getTableId(final Uri uri) { @@ -3779,7 +3785,7 @@ public final class Utils implements Constants, TwitterConstants { cheatSheet.setGravity(Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL, 0, height); } else { // Show along the top; follow action buttons - cheatSheet.setGravity(Gravity.TOP | Gravity.RIGHT, screenWidth - screenPos[0] - width / 2, height); + cheatSheet.setGravity(Gravity.TOP | GravityCompat.END, screenWidth - screenPos[0] - width / 2, height); } cheatSheet.show(); } diff --git a/twidere/src/main/java/org/mariotaku/twidere/util/content/DatabaseUpgradeHelper.java b/twidere/src/main/java/org/mariotaku/twidere/util/content/DatabaseUpgradeHelper.java index e9a6fcc9c..da4f46cb2 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/util/content/DatabaseUpgradeHelper.java +++ b/twidere/src/main/java/org/mariotaku/twidere/util/content/DatabaseUpgradeHelper.java @@ -72,13 +72,13 @@ public final class DatabaseUpgradeHelper { if (strictMode) { final String oldCreate = getCreateSQL(db, table); final Map map = getTypeMapByCreateQuery(oldCreate); - boolean differenct = false; + boolean different = false; for (final NewColumn newCol : newCols) { if (!newCol.getType().equalsIgnoreCase(map.get(newCol.getName()))) { - differenct = true; + different = true; } } - if (!differenct) return; + if (!different) return; } else if (oldCols == null || TwidereArrayUtils.contentMatch(newColNames, oldCols)) return; if (dropDirectly) { db.beginTransaction(); diff --git a/twidere/src/main/java/org/mariotaku/twidere/util/net/TwidereHostAddressResolver.java b/twidere/src/main/java/org/mariotaku/twidere/util/net/TwidereHostAddressResolver.java index 424510556..5d5739182 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/util/net/TwidereHostAddressResolver.java +++ b/twidere/src/main/java/org/mariotaku/twidere/util/net/TwidereHostAddressResolver.java @@ -27,7 +27,6 @@ import android.util.Log; import org.apache.http.conn.util.InetAddressUtils; import org.mariotaku.twidere.Constants; import org.mariotaku.twidere.util.HostsFileParser; -import org.mariotaku.twidere.util.UriUtils; import org.mariotaku.twidere.util.Utils; import org.xbill.DNS.AAAARecord; import org.xbill.DNS.ARecord; diff --git a/twidere/src/main/java/org/mariotaku/twidere/view/CardMediaContainer.java b/twidere/src/main/java/org/mariotaku/twidere/view/CardMediaContainer.java index a315b8962..747922e62 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/view/CardMediaContainer.java +++ b/twidere/src/main/java/org/mariotaku/twidere/view/CardMediaContainer.java @@ -302,7 +302,7 @@ public class CardMediaContainer extends ViewGroup implements Constants { @IntDef({VALUE_MEDIA_PREVIEW_STYLE_CODE_SCALE, VALUE_MEDIA_PREVIEW_STYLE_CODE_CROP}) @Retention(RetentionPolicy.SOURCE) - public static @interface PreviewStyle { + public @interface PreviewStyle { } } diff --git a/twidere/src/main/java/org/mariotaku/twidere/view/ColorLabelFrameLayout.java b/twidere/src/main/java/org/mariotaku/twidere/view/ColorLabelFrameLayout.java index ef17a9eb8..6dca02447 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/view/ColorLabelFrameLayout.java +++ b/twidere/src/main/java/org/mariotaku/twidere/view/ColorLabelFrameLayout.java @@ -75,13 +75,13 @@ public class ColorLabelFrameLayout extends FrameLayout implements IColorLabelVie } @Override - public boolean isPaddingsIgnored() { - return mHelper.isPaddingsIgnored(); + public boolean isPaddingIgnored() { + return mHelper.isPaddingIgnored(); } @Override - public void setIgnorePaddings(final boolean ignorePaddings) { - mHelper.setIgnorePaddings(ignorePaddings); + public void setIgnorePadding(final boolean ignorePadding) { + mHelper.setIgnorePadding(ignorePadding); } @Override diff --git a/twidere/src/main/java/org/mariotaku/twidere/view/ColorLabelLinearLayout.java b/twidere/src/main/java/org/mariotaku/twidere/view/ColorLabelLinearLayout.java index 2326fded1..781a25f1a 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/view/ColorLabelLinearLayout.java +++ b/twidere/src/main/java/org/mariotaku/twidere/view/ColorLabelLinearLayout.java @@ -75,13 +75,13 @@ public class ColorLabelLinearLayout extends LinearLayout implements IColorLabelV } @Override - public boolean isPaddingsIgnored() { - return mHelper.isPaddingsIgnored(); + public boolean isPaddingIgnored() { + return mHelper.isPaddingIgnored(); } @Override - public void setIgnorePaddings(final boolean ignorePaddings) { - mHelper.setIgnorePaddings(ignorePaddings); + public void setIgnorePadding(final boolean ignorePadding) { + mHelper.setIgnorePadding(ignorePadding); } @Override diff --git a/twidere/src/main/java/org/mariotaku/twidere/view/ColorLabelRelativeLayout.java b/twidere/src/main/java/org/mariotaku/twidere/view/ColorLabelRelativeLayout.java index 2d9192193..87d05e85f 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/view/ColorLabelRelativeLayout.java +++ b/twidere/src/main/java/org/mariotaku/twidere/view/ColorLabelRelativeLayout.java @@ -75,13 +75,13 @@ public class ColorLabelRelativeLayout extends RelativeLayout implements IColorLa } @Override - public boolean isPaddingsIgnored() { - return mHelper.isPaddingsIgnored(); + public boolean isPaddingIgnored() { + return mHelper.isPaddingIgnored(); } @Override - public void setIgnorePaddings(final boolean ignorePaddings) { - mHelper.setIgnorePaddings(ignorePaddings); + public void setIgnorePadding(final boolean ignorePadding) { + mHelper.setIgnorePadding(ignorePadding); } @Override diff --git a/twidere/src/main/java/org/mariotaku/twidere/view/HeaderDrawerLayout.java b/twidere/src/main/java/org/mariotaku/twidere/view/HeaderDrawerLayout.java index 62f1206ca..89e580434 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/view/HeaderDrawerLayout.java +++ b/twidere/src/main/java/org/mariotaku/twidere/view/HeaderDrawerLayout.java @@ -291,7 +291,7 @@ public class HeaderDrawerLayout extends ViewGroup { private void updateViewOffset() { } - public static interface DrawerCallback { + public interface DrawerCallback { boolean canScroll(float dy); diff --git a/twidere/src/main/java/org/mariotaku/twidere/view/HomeActionButtonCompat.java b/twidere/src/main/java/org/mariotaku/twidere/view/HomeActionButtonCompat.java index 652d26a3a..a7f3a73d1 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/view/HomeActionButtonCompat.java +++ b/twidere/src/main/java/org/mariotaku/twidere/view/HomeActionButtonCompat.java @@ -41,7 +41,6 @@ import android.widget.ProgressBar; import org.mariotaku.twidere.R; import org.mariotaku.twidere.activity.iface.IThemedActivity; import org.mariotaku.twidere.util.ThemeUtils; -import org.mariotaku.twidere.util.TwidereColorUtils; import org.mariotaku.twidere.util.support.ViewSupport; import org.mariotaku.twidere.view.iface.IHomeActionButton; diff --git a/twidere/src/main/java/org/mariotaku/twidere/view/LinePageIndicator.java b/twidere/src/main/java/org/mariotaku/twidere/view/LinePageIndicator.java index 818ec58eb..f72df7451 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/view/LinePageIndicator.java +++ b/twidere/src/main/java/org/mariotaku/twidere/view/LinePageIndicator.java @@ -125,6 +125,7 @@ public class LinePageIndicator extends View implements PagerIndicator { return mPaintSelected.getStrokeWidth(); } + @SuppressWarnings("SuspiciousNameCombination") public void setStrokeWidth(final float lineHeight) { mPaintSelected.setStrokeWidth(lineHeight); mPaintUnselected.setStrokeWidth(lineHeight); diff --git a/twidere/src/main/java/org/mariotaku/twidere/view/ProfileBannerSpace.java b/twidere/src/main/java/org/mariotaku/twidere/view/ProfileBannerSpace.java index f0453923c..388eb8688 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/view/ProfileBannerSpace.java +++ b/twidere/src/main/java/org/mariotaku/twidere/view/ProfileBannerSpace.java @@ -47,6 +47,7 @@ public class ProfileBannerSpace extends View { public void draw(@NonNull final Canvas canvas) { } + @Deprecated @Override protected boolean fitSystemWindows(@NonNull Rect insets) { mSystemWindowsInsets.set(insets); diff --git a/twidere/src/main/java/org/mariotaku/twidere/view/StatusTextCountView.java b/twidere/src/main/java/org/mariotaku/twidere/view/StatusTextCountView.java index 2a1f91e13..99ac64b9f 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/view/StatusTextCountView.java +++ b/twidere/src/main/java/org/mariotaku/twidere/view/StatusTextCountView.java @@ -24,7 +24,6 @@ import android.content.res.TypedArray; import android.graphics.Color; import android.support.v7.widget.AppCompatTextView; import android.util.AttributeSet; -import android.widget.TextView; import org.mariotaku.twidere.util.ThemeUtils; import org.mariotaku.twidere.util.TwidereValidator; diff --git a/twidere/src/main/java/org/mariotaku/twidere/view/TabPagerIndicator.java b/twidere/src/main/java/org/mariotaku/twidere/view/TabPagerIndicator.java index 353a79d1f..0d2d61e3c 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/view/TabPagerIndicator.java +++ b/twidere/src/main/java/org/mariotaku/twidere/view/TabPagerIndicator.java @@ -22,6 +22,7 @@ import android.widget.ImageView; import android.widget.RelativeLayout; import android.widget.TextView; +import org.mariotaku.twidere.Constants; import org.mariotaku.twidere.R; import org.mariotaku.twidere.adapter.decorator.DividerItemDecoration; import org.mariotaku.twidere.util.ThemeUtils; @@ -33,11 +34,11 @@ import java.lang.annotation.RetentionPolicy; /** * Created by mariotaku on 14/10/21. */ -public class TabPagerIndicator extends RecyclerView implements PagerIndicator { +public class TabPagerIndicator extends RecyclerView implements PagerIndicator, Constants { - public static final int ICON = 0x1; - public static final int LABEL = 0x2; - public static final int BOTH = ICON | LABEL; + public static final int LABEL = VALUE_TAB_DISPLAY_OPTION_CODE_LABEL; + public static final int ICON = VALUE_TAB_DISPLAY_OPTION_CODE_ICON; + public static final int BOTH = VALUE_TAB_DISPLAY_OPTION_CODE_BOTH; private final int mStripHeight; private final TabPagerIndicatorAdapter mIndicatorAdapter; diff --git a/twidere/src/main/java/org/mariotaku/twidere/view/holder/StatusViewHolder.java b/twidere/src/main/java/org/mariotaku/twidere/view/holder/StatusViewHolder.java index 5879a18ac..dbcf6b200 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/view/holder/StatusViewHolder.java +++ b/twidere/src/main/java/org/mariotaku/twidere/view/holder/StatusViewHolder.java @@ -657,7 +657,7 @@ public class StatusViewHolder extends ViewHolder implements Constants, OnClickLi return false; } - public static interface StatusClickListener extends ContentCardClickListener { + public interface StatusClickListener extends ContentCardClickListener { void onMediaClick(StatusViewHolder holder, View view, ParcelableMedia media, int position); diff --git a/twidere/src/main/java/org/mariotaku/twidere/view/holder/UserListViewHolder.java b/twidere/src/main/java/org/mariotaku/twidere/view/holder/UserListViewHolder.java index bd764fdab..ecffe0dd5 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/view/holder/UserListViewHolder.java +++ b/twidere/src/main/java/org/mariotaku/twidere/view/holder/UserListViewHolder.java @@ -121,7 +121,7 @@ public class UserListViewHolder extends ViewHolder implements View.OnClickListen } - public static interface UserListClickListener extends ContentCardClickListener { + public interface UserListClickListener extends ContentCardClickListener { void onUserListClick(UserListViewHolder holder, int position); diff --git a/twidere/src/main/java/org/mariotaku/twidere/view/holder/UserViewHolder.java b/twidere/src/main/java/org/mariotaku/twidere/view/holder/UserViewHolder.java index 0337142f4..ae3ca7915 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/view/holder/UserViewHolder.java +++ b/twidere/src/main/java/org/mariotaku/twidere/view/holder/UserViewHolder.java @@ -19,7 +19,6 @@ package org.mariotaku.twidere.view.holder; -import android.content.Context; import android.support.v7.widget.RecyclerView.ViewHolder; import android.text.TextUtils; import android.view.View; @@ -161,7 +160,7 @@ public class UserViewHolder extends ViewHolder implements OnClickListener, OnLon profileImageView.setStyle(adapter.getProfileImageStyle()); } - public static interface UserClickListener extends ContentCardClickListener { + public interface UserClickListener extends ContentCardClickListener { void onUserClick(UserViewHolder holder, int position); diff --git a/twidere/src/main/java/org/mariotaku/twidere/view/iface/IColorLabelView.java b/twidere/src/main/java/org/mariotaku/twidere/view/iface/IColorLabelView.java index 6c86e7691..4b9b26939 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/view/iface/IColorLabelView.java +++ b/twidere/src/main/java/org/mariotaku/twidere/view/iface/IColorLabelView.java @@ -47,13 +47,13 @@ public interface IColorLabelView { void drawTop(final int... colors); - boolean isPaddingsIgnored(); + boolean isPaddingIgnored(); - void setIgnorePaddings(final boolean ignorePaddings); + void setIgnorePadding(final boolean ignorePadding); void setVisibility(int visibility); - public static final class Helper { + final class Helper { private final View mView; @@ -88,6 +88,7 @@ public interface IColorLabelView { canvas.drawRect(left, top, right, bottom, mPaint); } + @SuppressWarnings("SuspiciousNameCombination") public void dispatchDrawLabels(final Canvas canvas) { final int left = mIgnorePadding ? 0 : mView.getPaddingLeft(); final int top = mIgnorePadding ? 0 : mView.getPaddingTop(); @@ -132,12 +133,12 @@ public interface IColorLabelView { drawLabel(mStartColors, mEndColors, colors, mBottomColors, mBackgroundColor); } - public boolean isPaddingsIgnored() { + public boolean isPaddingIgnored() { return mIgnorePadding; } - public void setIgnorePaddings(final boolean ignorePaddings) { - mIgnorePadding = ignorePaddings; + public void setIgnorePadding(final boolean ignorePadding) { + mIgnorePadding = ignorePadding; mView.invalidate(); } diff --git a/twidere/src/main/java/org/mariotaku/twidere/view/iface/IExtendedView.java b/twidere/src/main/java/org/mariotaku/twidere/view/iface/IExtendedView.java index b40d914d6..b1a17cc42 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/view/iface/IExtendedView.java +++ b/twidere/src/main/java/org/mariotaku/twidere/view/iface/IExtendedView.java @@ -25,21 +25,21 @@ import android.view.View; public interface IExtendedView { - public void setOnFitSystemWindowsListener(final OnFitSystemWindowsListener listener); + void setOnFitSystemWindowsListener(final OnFitSystemWindowsListener listener); - public void setOnSizeChangedListener(final OnSizeChangedListener listener); + void setOnSizeChangedListener(final OnSizeChangedListener listener); - public void setTouchInterceptor(final TouchInterceptor listener); + void setTouchInterceptor(final TouchInterceptor listener); - public static interface OnFitSystemWindowsListener { + interface OnFitSystemWindowsListener { void onFitSystemWindows(Rect insets); } - public static interface OnSizeChangedListener { + interface OnSizeChangedListener { void onSizeChanged(View view, int w, int h, int oldw, int oldh); } - public static interface TouchInterceptor { + interface TouchInterceptor { boolean dispatchTouchEvent(View view, MotionEvent event); diff --git a/twidere/src/main/java/org/mariotaku/twidere/view/iface/IForegroundView.java b/twidere/src/main/java/org/mariotaku/twidere/view/iface/IForegroundView.java index c22abddcb..1c6541d99 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/view/iface/IForegroundView.java +++ b/twidere/src/main/java/org/mariotaku/twidere/view/iface/IForegroundView.java @@ -39,7 +39,7 @@ public interface IForegroundView { * * @return A Drawable or null if no foreground was set. */ - public Drawable getForeground(); + Drawable getForeground(); /** * Supply a Drawable that is to be rendered on top of all of the child views @@ -50,7 +50,7 @@ public interface IForegroundView { * @param drawable The Drawable to be drawn on top of the children. * @attr ref android.R.attr#foreground */ - public void setForeground(final Drawable drawable); + void setForeground(final Drawable drawable); /** * Describes how the foreground is positioned. Defaults to START and TOP. @@ -58,9 +58,9 @@ public interface IForegroundView { * @param foregroundGravity See {@link android.view.Gravity} * @attr ref android.R.attr#foregroundGravity */ - public void setForegroundGravity(int foregroundGravity); + void setForegroundGravity(int foregroundGravity); - public static class ForegroundViewHelper { + class ForegroundViewHelper { private final View mView; diff --git a/twidere/src/main/java/org/mariotaku/twidere/view/iface/IThemeAccentView.java b/twidere/src/main/java/org/mariotaku/twidere/view/iface/IThemeAccentView.java index 1b0dee843..d13392fdd 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/view/iface/IThemeAccentView.java +++ b/twidere/src/main/java/org/mariotaku/twidere/view/iface/IThemeAccentView.java @@ -27,6 +27,6 @@ import android.support.annotation.NonNull; */ public interface IThemeAccentView { - public void setAccentTintColor(@NonNull ColorStateList color); + void setAccentTintColor(@NonNull ColorStateList color); } diff --git a/twidere/src/main/java/org/mariotaku/twidere/view/iface/IThemeBackgroundTintView.java b/twidere/src/main/java/org/mariotaku/twidere/view/iface/IThemeBackgroundTintView.java index 6d55bef7a..a8fd9c857 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/view/iface/IThemeBackgroundTintView.java +++ b/twidere/src/main/java/org/mariotaku/twidere/view/iface/IThemeBackgroundTintView.java @@ -27,6 +27,6 @@ import android.support.annotation.NonNull; */ public interface IThemeBackgroundTintView { - public void setBackgroundTintColor(@NonNull ColorStateList color); + void setBackgroundTintColor(@NonNull ColorStateList color); } diff --git a/twidere/src/main/java/org/mariotaku/twidere/view/iface/PagerIndicator.java b/twidere/src/main/java/org/mariotaku/twidere/view/iface/PagerIndicator.java index cef212fae..7bde4aec4 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/view/iface/PagerIndicator.java +++ b/twidere/src/main/java/org/mariotaku/twidere/view/iface/PagerIndicator.java @@ -69,11 +69,11 @@ public interface PagerIndicator extends ViewPager.OnPageChangeListener { interface TabListener { - public void onPageReselected(int position); + void onPageReselected(int position); - public void onPageSelected(int position); + void onPageSelected(int position); - public boolean onTabLongClick(int position); + boolean onTabLongClick(int position); } /** @@ -81,7 +81,7 @@ public interface PagerIndicator extends ViewPager.OnPageChangeListener { */ interface TabProvider { - public int getCount(); + int getCount(); /** * Returns the icon of the view at position @@ -89,7 +89,7 @@ public interface PagerIndicator extends ViewPager.OnPageChangeListener { * @param position * @return */ - public Drawable getPageIcon(int position); + Drawable getPageIcon(int position); /** * Returns the title of the view at position @@ -97,8 +97,8 @@ public interface PagerIndicator extends ViewPager.OnPageChangeListener { * @param position * @return */ - public CharSequence getPageTitle(int position); + CharSequence getPageTitle(int position); - public float getPageWidth(int position); + float getPageWidth(int position); } } \ No newline at end of file diff --git a/twidere/src/main/res/layout/activity_custom_tab_editor.xml b/twidere/src/main/res/layout/activity_custom_tab_editor.xml index d0af7d799..d8b4bf4d6 100644 --- a/twidere/src/main/res/layout/activity_custom_tab_editor.xml +++ b/twidere/src/main/res/layout/activity_custom_tab_editor.xml @@ -1,5 +1,4 @@ - - - + tools:listitem="@layout/spinner_item_custom_tab_icon" /> + android:textAppearance="?android:attr/textAppearanceSmall" /> + android:textAppearance="?android:attr/textAppearanceMedium" /> @@ -86,14 +87,14 @@ style="?android:listSeparatorTextViewStyle" android:layout_width="match_parent" android:layout_height="wrap_content" - android:text="@string/account"/> + android:text="@string/account" /> + tools:listitem="@layout/list_item_two_line_small" /> + android:text="@string/user" /> - + @@ -133,7 +134,7 @@ style="?android:listSeparatorTextViewStyle" android:layout_width="match_parent" android:layout_height="wrap_content" - android:text="@string/extra_configurations"/> + android:text="@string/extra_configurations" /> + android:padding="@dimen/element_spacing_normal" /> @@ -156,6 +157,6 @@ android:layout_weight="0" android:gravity="center" android:onClick="onClick" - android:text="@android:string/ok"/> + android:text="@android:string/ok" /> \ No newline at end of file diff --git a/twidere/src/main/res/layout/activity_keyboard_shortcut_input.xml b/twidere/src/main/res/layout/activity_keyboard_shortcut_input.xml index e7905366f..2f481cf32 100644 --- a/twidere/src/main/res/layout/activity_keyboard_shortcut_input.xml +++ b/twidere/src/main/res/layout/activity_keyboard_shortcut_input.xml @@ -18,11 +18,14 @@ ~ You should have received a copy of the GNU General Public License ~ along with this program. If not, see . --> - + android:divider="?android:attr/dividerHorizontal" + android:dividerPadding="0dip" + android:orientation="vertical" + android:showDividers="middle"> + android:textAppearance="?android:textAppearanceMedium" /> + android:visibility="gone" /> + android:orientation="horizontal" + tools:ignore="UselessParent"> - + android:layout_gravity="start" + android:layout_weight="1" + android:maxLines="2" + android:minHeight="@dimen/element_size_normal" + android:text="@android:string/cancel" + android:textSize="14sp" /> -