From d198e7dec5d93208b762331c0b7cfca016bf4178 Mon Sep 17 00:00:00 2001 From: Mariotaku Lee Date: Tue, 31 Mar 2015 19:05:19 +0800 Subject: [PATCH] fixed #93 --- .../twidere/fragment/CustomTabsFragment.java | 23 ++++++++++--------- .../fragment/support/UserFragment.java | 5 ++-- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/twidere/src/main/java/org/mariotaku/twidere/fragment/CustomTabsFragment.java b/twidere/src/main/java/org/mariotaku/twidere/fragment/CustomTabsFragment.java index e7d0c8fa5..6f75d5b0f 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/fragment/CustomTabsFragment.java +++ b/twidere/src/main/java/org/mariotaku/twidere/fragment/CustomTabsFragment.java @@ -82,7 +82,7 @@ import static org.mariotaku.twidere.util.CustomTabUtils.isTabTypeValid; import static org.mariotaku.twidere.util.Utils.getAccountIds; public class CustomTabsFragment extends BaseFragment implements LoaderCallbacks, - MultiChoiceModeListener, DropListener, OnItemClickListener { + MultiChoiceModeListener, OnItemClickListener { private ContentResolver mResolver; @@ -94,14 +94,6 @@ public class CustomTabsFragment extends BaseFragment implements LoaderCallbacks< private TextView mEmptyText; private ImageView mEmptyIcon; - @Override - public void drop(final int from, final int to) { - mAdapter.drop(from, to); - if (mListView.getChoiceMode() != AbsListView.CHOICE_MODE_NONE) { - mListView.moveCheckState(from, to); - } - saveTabPositions(); - } @Override public boolean onActionItemClicked(final ActionMode mode, final MenuItem item) { @@ -127,10 +119,19 @@ public class CustomTabsFragment extends BaseFragment implements LoaderCallbacks< mAdapter = new CustomTabsAdapter(context); mListView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE_MODAL); mListView.setMultiChoiceModeListener(this); - mListView.setDropListener(this); mListView.setOnItemClickListener(this); mListView.setAdapter(mAdapter); mListView.setEmptyView(mEmptyView); + mListView.setDropListener(new DropListener() { + @Override + public void drop(final int from, final int to) { + mAdapter.drop(from, to); + if (mListView.getChoiceMode() != AbsListView.CHOICE_MODE_NONE) { + mListView.moveCheckState(from, to); + } + saveTabPositions(); + } + }); mEmptyText.setText(R.string.no_tab); mEmptyIcon.setImageResource(R.drawable.ic_info_tab); getLoaderManager().initLoader(0, null, this); @@ -316,7 +317,7 @@ public class CustomTabsFragment extends BaseFragment implements LoaderCallbacks< final long id = c.getLong(idIdx); final ContentValues values = new ContentValues(); values.put(Tabs.POSITION, i); - final String where = Tabs._ID + " = " + id; + final String where = Expression.equals(Tabs._ID, id).getSQL(); mResolver.update(Tabs.CONTENT_URI, values, where, null); } } 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 e31884f33..c729076fb 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 @@ -56,6 +56,7 @@ import android.support.v4.app.LoaderManager.LoaderCallbacks; import android.support.v4.app.SharedElementCallback; import android.support.v4.content.AsyncTaskLoader; import android.support.v4.content.Loader; +import android.support.v4.content.res.ResourcesCompat; import android.support.v4.view.ViewCompat; import android.support.v4.view.ViewPager; import android.support.v7.app.ActionBar; @@ -376,7 +377,7 @@ public class UserFragment extends BaseSupportFragment implements OnClickListener drawableRes = R.drawable.ic_follow_none; } } - final Drawable icon = getResources().getDrawable(drawableRes); + final Drawable icon = ResourcesCompat.getDrawable(getResources(), drawableRes, null); final int iconSize = Math.round(mFollowButton.getTextSize() * 1.4f); icon.setBounds(0, 0, iconSize, iconSize); icon.setColorFilter(mFollowButton.getCurrentTextColor(), Mode.SRC_ATOP); @@ -1241,7 +1242,7 @@ public class UserFragment extends BaseSupportFragment implements OnClickListener final ActionBar actionBar = linkHandler.getSupportActionBar(); if (actionBar == null) return; final int themeResId = linkHandler.getCurrentThemeResourceId(); - final Drawable shadow = activity.getResources().getDrawable(R.drawable.shadow_user_banner_action_bar); + final Drawable shadow = ResourcesCompat.getDrawable(activity.getResources(), R.drawable.shadow_user_banner_action_bar, null); final Drawable background = ThemeUtils.getActionBarBackground(activity, themeResId); mActionBarBackground = new ActionBarDrawable(getResources(), shadow, background, ThemeUtils.isDarkTheme(themeResId)); mActionBarBackground.setAlpha(linkHandler.getCurrentThemeBackgroundAlpha());