1
0
mirror of https://github.com/TwidereProject/Twidere-Android synced 2025-02-14 18:50:39 +01:00

improved account selection

This commit is contained in:
Mariotaku Lee 2014-10-29 16:58:42 +08:00
parent 8c6802a9b2
commit 582a9e221f
21 changed files with 684 additions and 581 deletions

View File

@ -108,6 +108,7 @@ public interface Constants extends TwidereConstants {
public static final int MENU_PROGRESS = R.id.progress; public static final int MENU_PROGRESS = R.id.progress;
public static final int MENU_OPEN_WITH_ACCOUNT = R.id.open_with_account; public static final int MENU_OPEN_WITH_ACCOUNT = R.id.open_with_account;
public static final int MENU_ACCOUNTS = R.id.accounts; public static final int MENU_ACCOUNTS = R.id.accounts;
public static final int MENU_INVERSE_SELECTION = R.id.inverse_selection;
public static final int LINK_ID_STATUS = 1; public static final int LINK_ID_STATUS = 1;
public static final int LINK_ID_USER = 2; public static final int LINK_ID_USER = 2;

View File

@ -5,6 +5,7 @@ import android.app.Dialog;
import android.content.Context; import android.content.Context;
import android.graphics.PorterDuff.Mode; import android.graphics.PorterDuff.Mode;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
@ -22,13 +23,16 @@ import org.mariotaku.twidere.util.ThemeUtils;
public abstract class MenuDialogFragment extends BaseSupportDialogFragment implements OnItemClickListener { public abstract class MenuDialogFragment extends BaseSupportDialogFragment implements OnItemClickListener {
private MenuAdapter mAdapter;
@NonNull
@Override @Override
public Dialog onCreateDialog(final Bundle savedInstanceState) { public Dialog onCreateDialog(final Bundle savedInstanceState) {
final Context context = getThemedContext(); final Context context = getThemedContext();
final AlertDialog.Builder builder = new AlertDialog.Builder(context); final AlertDialog.Builder builder = new AlertDialog.Builder(context);
final MenuAdapter adapter = new MenuAdapter(context); mAdapter = new MenuAdapter(context);
final ListView listView = new ListView(context); final ListView listView = new ListView(context);
listView.setAdapter(adapter); listView.setAdapter(mAdapter);
listView.setOnItemClickListener(this); listView.setOnItemClickListener(this);
builder.setView(listView); builder.setView(listView);
final Menu menu = MenuUtils.createMenu(context); final Menu menu = MenuUtils.createMenu(context);
@ -36,7 +40,7 @@ public abstract class MenuDialogFragment extends BaseSupportDialogFragment imple
final int itemColor = ThemeUtils.getThemeForegroundColor(context); final int itemColor = ThemeUtils.getThemeForegroundColor(context);
final int highlightColor = ThemeUtils.getUserAccentColor(context); final int highlightColor = ThemeUtils.getUserAccentColor(context);
ThemeUtils.applyColorFilterToMenuIcon(menu, itemColor, highlightColor, Mode.SRC_ATOP); ThemeUtils.applyColorFilterToMenuIcon(menu, itemColor, highlightColor, Mode.SRC_ATOP);
adapter.setMenu(menu); mAdapter.setMenu(menu);
return builder.create(); return builder.create();
} }
@ -49,7 +53,7 @@ public abstract class MenuDialogFragment extends BaseSupportDialogFragment imple
final Fragment parentFragment = getParentFragment(); final Fragment parentFragment = getParentFragment();
final MenuItem item = (MenuItem) parent.getItemAtPosition(position); final MenuItem item = (MenuItem) parent.getItemAtPosition(position);
if (item.hasSubMenu()) { if (item.hasSubMenu()) {
mAdapter.setMenu(item.getSubMenu());
} else if (parentFragment instanceof OnMenuItemClickListener) { } else if (parentFragment instanceof OnMenuItemClickListener) {
((OnMenuItemClickListener) parentFragment).onMenuItemClick(item); ((OnMenuItemClickListener) parentFragment).onMenuItemClick(item);
dismiss(); dismiss();

View File

@ -30,12 +30,13 @@ import com.mobeta.android.dslv.SimpleDragSortCursorAdapter;
import org.mariotaku.twidere.Constants; import org.mariotaku.twidere.Constants;
import org.mariotaku.twidere.R; import org.mariotaku.twidere.R;
import org.mariotaku.twidere.adapter.iface.IBaseAdapter;
import org.mariotaku.twidere.app.TwidereApplication; import org.mariotaku.twidere.app.TwidereApplication;
import org.mariotaku.twidere.provider.TweetStore.Accounts; import org.mariotaku.twidere.provider.TweetStore.Accounts;
import org.mariotaku.twidere.util.ImageLoaderWrapper; import org.mariotaku.twidere.util.ImageLoaderWrapper;
import org.mariotaku.twidere.view.holder.AccountViewHolder; import org.mariotaku.twidere.view.holder.AccountViewHolder;
public class AccountsAdapter extends SimpleDragSortCursorAdapter implements Constants { public class AccountsAdapter extends SimpleDragSortCursorAdapter implements Constants, IBaseAdapter {
private final ImageLoaderWrapper mImageLoader; private final ImageLoaderWrapper mImageLoader;
private final SharedPreferences mPreferences; private final SharedPreferences mPreferences;
@ -94,23 +95,94 @@ public class AccountsAdapter extends SimpleDragSortCursorAdapter implements Cons
return view; return view;
} }
@Override
public ImageLoaderWrapper getImageLoader() {
return mImageLoader;
}
@Override
public int getLinkHighlightColor() {
return 0;
}
@Override
public int getLinkHighlightOption() {
return 0;
}
@Override
public float getTextSize() {
return 0;
}
@Override
public boolean isDisplayNameFirst() {
return false;
}
@Override
public boolean isDisplayProfileImage() {
return mDisplayProfileImage;
}
@Override
public boolean isNicknameOnly() {
return false;
}
@Override
public boolean isShowAccountColor() {
return false;
}
@Override @Override
public void notifyDataSetChanged() { public void notifyDataSetChanged() {
mDefaultAccountId = mPreferences.getLong(KEY_DEFAULT_ACCOUNT_ID, -1); mDefaultAccountId = mPreferences.getLong(KEY_DEFAULT_ACCOUNT_ID, -1);
super.notifyDataSetChanged(); super.notifyDataSetChanged();
} }
@Override
public void setDisplayNameFirst(boolean nameFirst) {
}
public void setChoiceMode(final int mode) { public void setChoiceMode(final int mode) {
if (mChoiceMode == mode) return; if (mChoiceMode == mode) return;
mChoiceMode = mode; mChoiceMode = mode;
notifyDataSetChanged(); notifyDataSetChanged();
} }
@Override
public void setDisplayProfileImage(final boolean display) { public void setDisplayProfileImage(final boolean display) {
mDisplayProfileImage = display; mDisplayProfileImage = display;
notifyDataSetChanged(); notifyDataSetChanged();
} }
@Override
public void setLinkHighlightColor(int color) {
}
@Override
public void setLinkHighlightOption(String option) {
}
@Override
public void setNicknameOnly(boolean nicknameOnly) {
}
@Override
public void setShowAccountColor(boolean show) {
}
@Override
public void setTextSize(float textSize) {
}
@Override @Override
public Cursor swapCursor(final Cursor cursor) { public Cursor swapCursor(final Cursor cursor) {
if (cursor != null) { if (cursor != null) {

View File

@ -19,8 +19,6 @@
package org.mariotaku.twidere.adapter; package org.mariotaku.twidere.adapter;
import static org.mariotaku.twidere.util.Utils.getLinkHighlightOptionInt;
import android.content.Context; import android.content.Context;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener; import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
@ -33,119 +31,124 @@ import org.mariotaku.twidere.util.TwidereLinkify;
import java.util.Collection; import java.util.Collection;
import static org.mariotaku.twidere.util.Utils.getLinkHighlightOptionInt;
public class BaseArrayAdapter<T> extends ArrayAdapter<T> implements IBaseAdapter, OnSharedPreferenceChangeListener { public class BaseArrayAdapter<T> extends ArrayAdapter<T> implements IBaseAdapter, OnSharedPreferenceChangeListener {
private final TwidereLinkify mLinkify; private final TwidereLinkify mLinkify;
private float mTextSize; private float mTextSize;
private int mLinkHighlightOption, mLinkHighlightColor; private int mLinkHighlightOption, mLinkHighlightColor;
private boolean mDisplayProfileImage, mNicknameOnly, mDisplayNameFirst, mShowAccountColor; private boolean mDisplayProfileImage, mNicknameOnly, mDisplayNameFirst, mShowAccountColor;
private final SharedPreferences mNicknamePrefs, mColorPrefs; private final SharedPreferences mNicknamePrefs, mColorPrefs;
private final ImageLoaderWrapper mImageLoader; private final ImageLoaderWrapper mImageLoader;
public BaseArrayAdapter(final Context context, final int layoutRes) { public BaseArrayAdapter(final Context context, final int layoutRes) {
this(context, layoutRes, null); this(context, layoutRes, null);
} }
public BaseArrayAdapter(final Context context, final int layoutRes, final Collection<? extends T> collection) { public BaseArrayAdapter(final Context context, final int layoutRes, final Collection<? extends T> collection) {
super(context, layoutRes, collection); super(context, layoutRes, collection);
final TwidereApplication app = TwidereApplication.getInstance(context); final TwidereApplication app = TwidereApplication.getInstance(context);
mLinkify = new TwidereLinkify(new OnLinkClickHandler(context, app.getMultiSelectManager())); mLinkify = new TwidereLinkify(new OnLinkClickHandler(context, app.getMultiSelectManager()));
mImageLoader = app.getImageLoaderWrapper(); mImageLoader = app.getImageLoaderWrapper();
mNicknamePrefs = context.getSharedPreferences(USER_NICKNAME_PREFERENCES_NAME, Context.MODE_PRIVATE); mNicknamePrefs = context.getSharedPreferences(USER_NICKNAME_PREFERENCES_NAME, Context.MODE_PRIVATE);
mColorPrefs = context.getSharedPreferences(USER_COLOR_PREFERENCES_NAME, Context.MODE_PRIVATE); mColorPrefs = context.getSharedPreferences(USER_COLOR_PREFERENCES_NAME, Context.MODE_PRIVATE);
mNicknamePrefs.registerOnSharedPreferenceChangeListener(this); mNicknamePrefs.registerOnSharedPreferenceChangeListener(this);
mColorPrefs.registerOnSharedPreferenceChangeListener(this); mColorPrefs.registerOnSharedPreferenceChangeListener(this);
} }
@Override @Override
public ImageLoaderWrapper getImageLoader() { public ImageLoaderWrapper getImageLoader() {
return mImageLoader; return mImageLoader;
} }
@Override @Override
public final int getLinkHighlightColor() { public final int getLinkHighlightColor() {
return mLinkHighlightColor; return mLinkHighlightColor;
} }
@Override @Override
public final int getLinkHighlightOption() { public final int getLinkHighlightOption() {
return mLinkHighlightOption; return mLinkHighlightOption;
} }
public final TwidereLinkify getLinkify() { public final TwidereLinkify getLinkify() {
return mLinkify; return mLinkify;
} }
@Override @Override
public final float getTextSize() { public final float getTextSize() {
return mTextSize; return mTextSize;
} }
@Override @Override
public final boolean isDisplayNameFirst() { public final boolean isDisplayNameFirst() {
return mDisplayNameFirst; return mDisplayNameFirst;
} }
@Override @Override
public final boolean isDisplayProfileImage() { public final boolean isDisplayProfileImage() {
return mDisplayProfileImage; return mDisplayProfileImage;
} }
@Override @Override
public final boolean isNicknameOnly() { public final boolean isNicknameOnly() {
return mNicknameOnly; return mNicknameOnly;
} }
@Override @Override
public final boolean isShowAccountColor() { public final boolean isShowAccountColor() {
return mShowAccountColor; return mShowAccountColor;
} }
@Override @Override
public void onSharedPreferenceChanged(final SharedPreferences sharedPreferences, final String key) { public void onSharedPreferenceChanged(final SharedPreferences preferences, final String key) {
notifyDataSetChanged(); if (KEY_NICKNAME_ONLY.equals(key) || KEY_DISPLAY_PROFILE_IMAGE.equals(key)
} || KEY_DISPLAY_IMAGE_PREVIEW.equals(key) || KEY_DISPLAY_SENSITIVE_CONTENTS.equals(key)) {
notifyDataSetChanged();
}
}
@Override @Override
public final void setDisplayNameFirst(final boolean nameFirst) { public final void setDisplayNameFirst(final boolean nameFirst) {
mDisplayNameFirst = nameFirst; mDisplayNameFirst = nameFirst;
} }
@Override @Override
public final void setDisplayProfileImage(final boolean display) { public final void setDisplayProfileImage(final boolean display) {
mDisplayProfileImage = display; mDisplayProfileImage = display;
} }
@Override @Override
public final void setLinkHighlightColor(final int color) { public final void setLinkHighlightColor(final int color) {
mLinkify.setLinkTextColor(color); mLinkify.setLinkTextColor(color);
mLinkHighlightColor = color; mLinkHighlightColor = color;
} }
@Override @Override
public final void setLinkHighlightOption(final String option) { public final void setLinkHighlightOption(final String option) {
final int optionInt = getLinkHighlightOptionInt(option); final int optionInt = getLinkHighlightOptionInt(option);
mLinkify.setHighlightOption(optionInt); mLinkify.setHighlightOption(optionInt);
if (optionInt == mLinkHighlightOption) return; if (optionInt == mLinkHighlightOption) return;
mLinkHighlightOption = optionInt; mLinkHighlightOption = optionInt;
} }
@Override @Override
public final void setNicknameOnly(final boolean nickname_only) { public final void setNicknameOnly(final boolean nicknameOnly) {
mNicknameOnly = nickname_only; mNicknameOnly = nicknameOnly;
} }
@Override @Override
public final void setShowAccountColor(final boolean show) { public final void setShowAccountColor(final boolean show) {
mShowAccountColor = show; mShowAccountColor = show;
} }
@Override @Override
public final void setTextSize(final float textSize) { public final void setTextSize(final float textSize) {
mTextSize = textSize; mTextSize = textSize;
} }
} }

View File

@ -144,9 +144,9 @@ public class BaseCursorAdapter extends SimpleCursorAdapter implements IBaseAdapt
} }
@Override @Override
public final void setNicknameOnly(final boolean nickname_only) { public final void setNicknameOnly(final boolean nicknameOnly) {
if (mNicknameOnly == nickname_only) return; if (mNicknameOnly == nicknameOnly) return;
mNicknameOnly = nickname_only; mNicknameOnly = nicknameOnly;
notifyDataSetChanged(); notifyDataSetChanged();
} }
@ -158,9 +158,9 @@ public class BaseCursorAdapter extends SimpleCursorAdapter implements IBaseAdapt
} }
@Override @Override
public final void setTextSize(final float text_size) { public final void setTextSize(final float textSize) {
if (text_size == mTextSize) return; if (textSize == mTextSize) return;
mTextSize = text_size; mTextSize = textSize;
notifyDataSetChanged(); notifyDataSetChanged();
} }

View File

@ -52,9 +52,9 @@ public interface IBaseAdapter extends Constants, ListAdapter {
public void setLinkHighlightOption(String option); public void setLinkHighlightOption(String option);
public void setNicknameOnly(boolean nickname_only); public void setNicknameOnly(boolean nicknameOnly);
public void setShowAccountColor(boolean show); public void setShowAccountColor(boolean show);
public void setTextSize(float text_size); public void setTextSize(float textSize);
} }

View File

@ -19,8 +19,6 @@
package org.mariotaku.twidere.fragment; package org.mariotaku.twidere.fragment;
import static org.mariotaku.twidere.util.Utils.getDisplayName;
import android.content.BroadcastReceiver; import android.content.BroadcastReceiver;
import android.content.ContentResolver; import android.content.ContentResolver;
import android.content.Context; import android.content.Context;
@ -34,6 +32,7 @@ import android.os.Bundle;
import android.support.v4.app.LoaderManager; import android.support.v4.app.LoaderManager;
import android.support.v4.content.CursorLoader; import android.support.v4.content.CursorLoader;
import android.support.v4.content.Loader; import android.support.v4.content.Loader;
import android.util.SparseBooleanArray;
import android.view.ActionMode; import android.view.ActionMode;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.Menu; import android.view.Menu;
@ -52,255 +51,264 @@ import org.mariotaku.twidere.R;
import org.mariotaku.twidere.fragment.support.BaseSupportListFragment; import org.mariotaku.twidere.fragment.support.BaseSupportListFragment;
import org.mariotaku.twidere.provider.TweetStore.Filters; import org.mariotaku.twidere.provider.TweetStore.Filters;
import static org.mariotaku.twidere.util.Utils.getDisplayName;
public abstract class BaseFiltersFragment extends BaseSupportListFragment implements LoaderManager.LoaderCallbacks<Cursor>, public abstract class BaseFiltersFragment extends BaseSupportListFragment implements LoaderManager.LoaderCallbacks<Cursor>,
MultiChoiceModeListener { MultiChoiceModeListener {
private ListView mListView; private ListView mListView;
private SimpleCursorAdapter mAdapter; private SimpleCursorAdapter mAdapter;
private ContentResolver mResolver; private ContentResolver mResolver;
private ActionMode mActionMode; private ActionMode mActionMode;
private final BroadcastReceiver mStateReceiver = new BroadcastReceiver() { private final BroadcastReceiver mStateReceiver = new BroadcastReceiver() {
@Override @Override
public void onReceive(final Context context, final Intent intent) { public void onReceive(final Context context, final Intent intent) {
if (getActivity() == null || !isAdded() || isDetached()) return; if (getActivity() == null || !isAdded() || isDetached()) return;
final String action = intent.getAction(); final String action = intent.getAction();
if (BROADCAST_FILTERS_UPDATED.equals(action)) { if (BROADCAST_FILTERS_UPDATED.equals(action)) {
getLoaderManager().restartLoader(0, null, BaseFiltersFragment.this); getLoaderManager().restartLoader(0, null, BaseFiltersFragment.this);
} }
} }
}; };
public abstract Uri getContentUri(); public abstract Uri getContentUri();
@Override @Override
public boolean onActionItemClicked(final ActionMode mode, final MenuItem item) { public boolean onActionItemClicked(final ActionMode mode, final MenuItem item) {
switch (item.getItemId()) { switch (item.getItemId()) {
case MENU_DELETE: { case MENU_DELETE: {
final Where where = Where.in(new Column(Filters._ID), new RawItemArray(mListView.getCheckedItemIds())); final Where where = Where.in(new Column(Filters._ID), new RawItemArray(mListView.getCheckedItemIds()));
mResolver.delete(getContentUri(), where.getSQL(), null); mResolver.delete(getContentUri(), where.getSQL(), null);
break; break;
} }
default: { case MENU_INVERSE_SELECTION: {
return false; final SparseBooleanArray positions = mListView.getCheckedItemPositions();
} for (int i = 0, j = mListView.getCount(); i < j; i++) {
} mListView.setItemChecked(i, !positions.get(i));
mode.finish(); }
return true; return true;
} }
default: {
return false;
}
}
mode.finish();
return true;
}
@Override @Override
public void onActivityCreated(final Bundle savedInstanceState) { public void onActivityCreated(final Bundle savedInstanceState) {
mResolver = getContentResolver(); mResolver = getContentResolver();
super.onActivityCreated(savedInstanceState); super.onActivityCreated(savedInstanceState);
mAdapter = createListAdapter(); mAdapter = createListAdapter();
setListAdapter(mAdapter); setListAdapter(mAdapter);
mListView = getListView(); mListView = getListView();
mListView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE_MODAL); mListView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE_MODAL);
mListView.setMultiChoiceModeListener(this); mListView.setMultiChoiceModeListener(this);
setEmptyText(getString(R.string.no_rule)); setEmptyText(getString(R.string.no_rule));
getLoaderManager().initLoader(0, null, this); getLoaderManager().initLoader(0, null, this);
setListShown(false); setListShown(false);
} }
@Override @Override
public boolean onCreateActionMode(final ActionMode mode, final Menu menu) { public boolean onCreateActionMode(final ActionMode mode, final Menu menu) {
mActionMode = mode; mActionMode = mode;
getActivity().getMenuInflater().inflate(R.menu.action_multi_select_items, menu); getActivity().getMenuInflater().inflate(R.menu.action_multi_select_items, menu);
return true; return true;
} }
@Override @Override
public Loader<Cursor> onCreateLoader(final int id, final Bundle args) { public Loader<Cursor> onCreateLoader(final int id, final Bundle args) {
return new CursorLoader(getActivity(), getContentUri(), getContentColumns(), null, null, null); return new CursorLoader(getActivity(), getContentUri(), getContentColumns(), null, null, null);
} }
@Override @Override
public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) { public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) {
final View view = super.onCreateView(inflater, container, savedInstanceState); final View view = super.onCreateView(inflater, container, savedInstanceState);
final View lv = view.findViewById(android.R.id.list); final View lv = view.findViewById(android.R.id.list);
final Resources res = getResources(); final Resources res = getResources();
final float density = res.getDisplayMetrics().density; final float density = res.getDisplayMetrics().density;
final int padding = (int) density * 16; final int padding = (int) density * 16;
lv.setId(android.R.id.list); lv.setId(android.R.id.list);
lv.setPadding(padding, 0, padding, 0); lv.setPadding(padding, 0, padding, 0);
return view; return view;
} }
@Override @Override
public void onDestroyActionMode(final ActionMode mode) { public void onDestroyActionMode(final ActionMode mode) {
} }
@Override @Override
public void onItemCheckedStateChanged(final ActionMode mode, final int position, final long id, public void onItemCheckedStateChanged(final ActionMode mode, final int position, final long id,
final boolean checked) { final boolean checked) {
updateTitle(mode); updateTitle(mode);
} }
@Override @Override
public void onLoaderReset(final Loader<Cursor> loader) { public void onLoaderReset(final Loader<Cursor> loader) {
mAdapter.swapCursor(null); mAdapter.swapCursor(null);
} }
@Override @Override
public void onLoadFinished(final Loader<Cursor> loader, final Cursor data) { public void onLoadFinished(final Loader<Cursor> loader, final Cursor data) {
mAdapter.swapCursor(data); mAdapter.swapCursor(data);
setListShown(true); setListShown(true);
} }
@Override @Override
public boolean onPrepareActionMode(final ActionMode mode, final Menu menu) { public boolean onPrepareActionMode(final ActionMode mode, final Menu menu) {
updateTitle(mode); updateTitle(mode);
return true; return true;
} }
@Override @Override
public void onStart() { public void onStart() {
super.onStart(); super.onStart();
final IntentFilter filter = new IntentFilter(BROADCAST_FILTERS_UPDATED); final IntentFilter filter = new IntentFilter(BROADCAST_FILTERS_UPDATED);
registerReceiver(mStateReceiver, filter); registerReceiver(mStateReceiver, filter);
} }
@Override @Override
public void onStop() { public void onStop() {
unregisterReceiver(mStateReceiver); unregisterReceiver(mStateReceiver);
super.onStop(); super.onStop();
} }
@Override @Override
public void setUserVisibleHint(final boolean isVisibleToUser) { public void setUserVisibleHint(final boolean isVisibleToUser) {
super.setUserVisibleHint(isVisibleToUser); super.setUserVisibleHint(isVisibleToUser);
if (!isVisibleToUser && mActionMode != null) { if (!isVisibleToUser && mActionMode != null) {
mActionMode.finish(); mActionMode.finish();
} }
} }
protected SimpleCursorAdapter createListAdapter() { protected SimpleCursorAdapter createListAdapter() {
return new FilterListAdapter(getActivity()); return new FilterListAdapter(getActivity());
} }
protected abstract String[] getContentColumns(); protected abstract String[] getContentColumns();
private void updateTitle(final ActionMode mode) { private void updateTitle(final ActionMode mode) {
if (mListView == null || mode == null || getActivity() == null) return; if (mListView == null || mode == null || getActivity() == null) return;
final int count = mListView.getCheckedItemCount(); final int count = mListView.getCheckedItemCount();
mode.setTitle(getResources().getQuantityString(R.plurals.Nitems_selected, count, count)); mode.setTitle(getResources().getQuantityString(R.plurals.Nitems_selected, count, count));
} }
public static final class FilteredKeywordsFragment extends BaseFiltersFragment { public static final class FilteredKeywordsFragment extends BaseFiltersFragment {
@Override @Override
public String[] getContentColumns() { public String[] getContentColumns() {
return Filters.Keywords.COLUMNS; return Filters.Keywords.COLUMNS;
} }
@Override @Override
public Uri getContentUri() { public Uri getContentUri() {
return Filters.Keywords.CONTENT_URI; return Filters.Keywords.CONTENT_URI;
} }
} }
public static final class FilteredLinksFragment extends BaseFiltersFragment { public static final class FilteredLinksFragment extends BaseFiltersFragment {
@Override @Override
public String[] getContentColumns() { public String[] getContentColumns() {
return Filters.Links.COLUMNS; return Filters.Links.COLUMNS;
} }
@Override @Override
public Uri getContentUri() { public Uri getContentUri() {
return Filters.Links.CONTENT_URI; return Filters.Links.CONTENT_URI;
} }
} }
public static final class FilteredSourcesFragment extends BaseFiltersFragment { public static final class FilteredSourcesFragment extends BaseFiltersFragment {
@Override @Override
public String[] getContentColumns() { public String[] getContentColumns() {
return Filters.Sources.COLUMNS; return Filters.Sources.COLUMNS;
} }
@Override @Override
public Uri getContentUri() { public Uri getContentUri() {
return Filters.Sources.CONTENT_URI; return Filters.Sources.CONTENT_URI;
} }
} }
public static final class FilteredUsersFragment extends BaseFiltersFragment { public static final class FilteredUsersFragment extends BaseFiltersFragment {
@Override @Override
public String[] getContentColumns() { public String[] getContentColumns() {
return Filters.Users.COLUMNS; return Filters.Users.COLUMNS;
} }
@Override @Override
public Uri getContentUri() { public Uri getContentUri() {
return Filters.Users.CONTENT_URI; return Filters.Users.CONTENT_URI;
} }
@Override @Override
protected SimpleCursorAdapter createListAdapter() { protected SimpleCursorAdapter createListAdapter() {
return new FilterUsersListAdapter(getActivity()); return new FilterUsersListAdapter(getActivity());
} }
private static final class FilterUsersListAdapter extends SimpleCursorAdapter { private static final class FilterUsersListAdapter extends SimpleCursorAdapter {
private int mUserIdIdx, mNameIdx, mScreenNameIdx; private int mUserIdIdx, mNameIdx, mScreenNameIdx;
private final boolean mNameFirst, mNicknameOnly; private final boolean mNameFirst, mNicknameOnly;
public FilterUsersListAdapter(final Context context) { public FilterUsersListAdapter(final Context context) {
super(context, android.R.layout.simple_list_item_activated_1, null, new String[0], new int[0], 0); super(context, android.R.layout.simple_list_item_activated_1, null, new String[0], new int[0], 0);
final SharedPreferences prefs = context.getSharedPreferences(SHARED_PREFERENCES_NAME, final SharedPreferences prefs = context.getSharedPreferences(SHARED_PREFERENCES_NAME,
Context.MODE_PRIVATE); Context.MODE_PRIVATE);
mNameFirst = prefs.getBoolean(KEY_NAME_FIRST, true); mNameFirst = prefs.getBoolean(KEY_NAME_FIRST, true);
mNicknameOnly = prefs.getBoolean(KEY_NICKNAME_ONLY, false); mNicknameOnly = prefs.getBoolean(KEY_NICKNAME_ONLY, false);
} }
@Override @Override
public void bindView(final View view, final Context context, final Cursor cursor) { public void bindView(final View view, final Context context, final Cursor cursor) {
super.bindView(view, context, cursor); super.bindView(view, context, cursor);
final TextView text1 = (TextView) view.findViewById(android.R.id.text1); final TextView text1 = (TextView) view.findViewById(android.R.id.text1);
final long user_id = cursor.getLong(mUserIdIdx); final long user_id = cursor.getLong(mUserIdIdx);
final String name = cursor.getString(mNameIdx); final String name = cursor.getString(mNameIdx);
final String screen_name = cursor.getString(mScreenNameIdx); final String screen_name = cursor.getString(mScreenNameIdx);
final String display_name = getDisplayName(context, user_id, name, screen_name, mNameFirst, final String display_name = getDisplayName(context, user_id, name, screen_name, mNameFirst,
mNicknameOnly); mNicknameOnly);
text1.setText(display_name); text1.setText(display_name);
} }
@Override @Override
public Cursor swapCursor(final Cursor c) { public Cursor swapCursor(final Cursor c) {
final Cursor old = super.swapCursor(c); final Cursor old = super.swapCursor(c);
if (c != null) { if (c != null) {
mUserIdIdx = c.getColumnIndex(Filters.Users.USER_ID); mUserIdIdx = c.getColumnIndex(Filters.Users.USER_ID);
mNameIdx = c.getColumnIndex(Filters.Users.NAME); mNameIdx = c.getColumnIndex(Filters.Users.NAME);
mScreenNameIdx = c.getColumnIndex(Filters.Users.SCREEN_NAME); mScreenNameIdx = c.getColumnIndex(Filters.Users.SCREEN_NAME);
} }
return old; return old;
} }
} }
} }
private static final class FilterListAdapter extends SimpleCursorAdapter { private static final class FilterListAdapter extends SimpleCursorAdapter {
private static final String[] from = new String[] { Filters.VALUE }; private static final String[] from = new String[]{Filters.VALUE};
private static final int[] to = new int[] { android.R.id.text1 }; private static final int[] to = new int[]{android.R.id.text1};
public FilterListAdapter(final Context context) { public FilterListAdapter(final Context context) {
super(context, android.R.layout.simple_list_item_activated_1, null, from, to, 0); super(context, android.R.layout.simple_list_item_activated_1, null, from, to, 0);
} }
} }
} }

View File

@ -4,6 +4,7 @@ import android.content.Intent;
import android.database.Cursor; import android.database.Cursor;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.LoaderManager.LoaderCallbacks; import android.support.v4.app.LoaderManager.LoaderCallbacks;
import android.support.v4.content.CursorLoader; import android.support.v4.content.CursorLoader;
import android.support.v4.content.Loader; import android.support.v4.content.Loader;
@ -14,16 +15,20 @@ import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.ListView; import android.widget.ListView;
import com.mobeta.android.dslv.DragSortListView;
import com.mobeta.android.dslv.DragSortListView.DropListener;
import org.mariotaku.twidere.R; import org.mariotaku.twidere.R;
import org.mariotaku.twidere.activity.support.SignInActivity; import org.mariotaku.twidere.activity.support.SignInActivity;
import org.mariotaku.twidere.adapter.AccountsAdapter; import org.mariotaku.twidere.adapter.AccountsAdapter;
import org.mariotaku.twidere.menu.TwidereMenuInflater; import org.mariotaku.twidere.menu.TwidereMenuInflater;
import org.mariotaku.twidere.provider.TweetStore.Accounts; import org.mariotaku.twidere.provider.TweetStore.Accounts;
import org.mariotaku.twidere.util.Utils;
/** /**
* Created by mariotaku on 14/10/26. * Created by mariotaku on 14/10/26.
*/ */
public class AccountsManagerFragment extends BaseSupportListFragment implements LoaderCallbacks<Cursor> { public class AccountsManagerFragment extends BaseSupportListFragment implements LoaderCallbacks<Cursor>, DropListener {
private AccountsAdapter mAdapter; private AccountsAdapter mAdapter;
@ -49,8 +54,12 @@ public class AccountsManagerFragment extends BaseSupportListFragment implements
public void onActivityCreated(Bundle savedInstanceState) { public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState); super.onActivityCreated(savedInstanceState);
setHasOptionsMenu(true); setHasOptionsMenu(true);
mAdapter = new AccountsAdapter(getActivity()); final FragmentActivity activity = getActivity();
mAdapter = new AccountsAdapter(activity);
Utils.configBaseAdapter(activity, mAdapter);
setListAdapter(mAdapter); setListAdapter(mAdapter);
final DragSortListView listView = (DragSortListView) getListView();
listView.setDropListener(this);
getLoaderManager().initLoader(0, null, this); getLoaderManager().initLoader(0, null, this);
} }
@ -79,4 +88,10 @@ public class AccountsManagerFragment extends BaseSupportListFragment implements
public void onLoaderReset(Loader<Cursor> loader) { public void onLoaderReset(Loader<Cursor> loader) {
mAdapter.changeCursor(null); mAdapter.changeCursor(null);
} }
@Override
public void drop(int from, int to) {
}
} }

View File

@ -28,8 +28,8 @@ public class UserListMenuDialogFragment extends MenuDialogFragment {
extensionsExtras.putParcelable(EXTRA_USER_LIST, user); extensionsExtras.putParcelable(EXTRA_USER_LIST, user);
extensionsIntent.putExtras(extensionsExtras); extensionsIntent.putExtras(extensionsExtras);
addIntentToMenu(getThemedContext(), menu, extensionsIntent); addIntentToMenu(getThemedContext(), menu, extensionsIntent);
final boolean longclickToOpenMenu = prefs.getBoolean(KEY_LONG_CLICK_TO_OPEN_MENU, false); final boolean longClickToOpenMenu = prefs.getBoolean(KEY_LONG_CLICK_TO_OPEN_MENU, false);
Utils.setMenuItemAvailability(menu, MENU_MULTI_SELECT, longclickToOpenMenu); Utils.setMenuItemAvailability(menu, MENU_MULTI_SELECT, longClickToOpenMenu);
} }
protected void onPrepareItemMenu(final Menu menu, final ParcelableUserList userList) { protected void onPrepareItemMenu(final Menu menu, final ParcelableUserList userList) {

Binary file not shown.

After

Width:  |  Height:  |  Size: 173 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 149 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 190 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 243 B

View File

@ -1,6 +1,9 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android" <org.mariotaku.twidere.view.MainFrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".activity.FiltersActivity"> tools:context=".activity.FiltersActivity">
<org.mariotaku.twidere.view.ExtendedViewPager <org.mariotaku.twidere.view.ExtendedViewPager
@ -8,4 +11,4 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"/> android:layout_height="match_parent"/>
</merge> </org.mariotaku.twidere.view.MainFrameLayout>

View File

@ -31,10 +31,9 @@
android:id="@+id/drag_handle" android:id="@+id/drag_handle"
android:layout_width="24dp" android:layout_width="24dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="0"
android:layout_centerVertical="true"
android:layout_alignParentLeft="true" android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_weight="0"
android:background="@drawable/list_drag_handle"/> android:background="@drawable/list_drag_handle"/>
<ImageView <ImageView
@ -56,12 +55,27 @@
android:orientation="vertical" android:orientation="vertical"
android:padding="@dimen/element_spacing_normal"> android:padding="@dimen/element_spacing_normal">
<TextView <LinearLayout
android:id="@android:id/text1"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:singleLine="true" android:orientation="horizontal">
android:textAppearance="?android:attr/textAppearanceMedium"/>
<TextView
android:id="@android:id/text1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceMedium"/>
<TextView
android:id="@+id/default_indicator"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:text="@string/default_account"
android:textAppearance="?android:attr/textAppearanceSmall"/>
</LinearLayout>
<TextView <TextView
android:id="@android:id/text2" android:id="@android:id/text2"
@ -80,16 +94,4 @@
android:clickable="false" android:clickable="false"
android:focusable="false"/> android:focusable="false"/>
<TextView
android:id="@+id/default_indicator"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@android:id/icon"
android:layout_alignLeft="@android:id/icon"
android:background="#80000000"
android:singleLine="true"
android:text="@string/default_account"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@android:color/white"/>
</org.mariotaku.twidere.view.ColorLabelRelativeLayout> </org.mariotaku.twidere.view.ColorLabelRelativeLayout>

View File

@ -1,10 +1,15 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"> <menu xmlns:android="http://schemas.android.com/apk/res/android">
<item <item
android:id="@id/delete" android:id="@id/inverse_selection"
android:icon="@drawable/ic_action_delete" android:icon="@drawable/ic_action_inverse_selection"
android:showAsAction="ifRoom|withText" android:showAsAction="ifRoom|withText"
android:title="@string/delete"/> android:title="@string/inverse_selection"/>
<item
android:id="@id/delete"
android:icon="@drawable/ic_action_delete"
android:showAsAction="ifRoom|withText"
android:title="@string/delete"/>
</menu> </menu>

View File

@ -1,37 +1,37 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"> <menu xmlns:android="http://schemas.android.com/apk/res/android">
<item <item
android:id="@id/take_photo" android:id="@id/take_photo"
android:icon="@drawable/ic_action_camera" android:icon="@drawable/ic_action_camera"
android:showAsAction="ifRoom" android:showAsAction="ifRoom"
android:title="@string/take_photo"/> android:title="@string/take_photo"/>
<item <item
android:id="@id/add_image" android:id="@id/add_image"
android:icon="@drawable/ic_action_gallery" android:icon="@drawable/ic_action_gallery"
android:showAsAction="ifRoom" android:showAsAction="ifRoom"
android:title="@string/add_image"/> android:title="@string/add_image"/>
<item <item
android:id="@id/add_location" android:id="@id/add_location"
android:checkable="true" android:checkable="true"
android:icon="@drawable/ic_action_mylocation" android:icon="@drawable/ic_action_mylocation"
android:showAsAction="ifRoom" android:showAsAction="ifRoom"
android:title="@string/location"/> android:title="@string/location"/>
<item <item
android:id="@id/view" android:id="@id/view"
android:icon="@drawable/ic_action_reply" android:icon="@drawable/ic_action_reply"
android:showAsAction="ifRoom" android:showAsAction="ifRoom"
android:title="@string/original_status" android:title="@string/original_status"
android:visible="false"/> android:visible="false"/>
<item <item
android:id="@id/drafts" android:id="@id/drafts"
android:icon="@drawable/ic_action_draft" android:icon="@drawable/ic_action_draft"
android:showAsAction="ifRoom" android:showAsAction="ifRoom"
android:title="@string/drafts"/> android:title="@string/drafts"/>
<item <item
android:id="@id/toggle_sensitive" android:id="@id/toggle_sensitive"
android:checkable="true" android:checkable="true"
android:icon="@drawable/ic_action_warning" android:icon="@drawable/ic_action_warning"
android:title="@string/mark_as_sensitive"/> android:title="@string/mark_as_sensitive"/>
</menu> </menu>

View File

@ -1,160 +1,158 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<string-array name="entries_refresh_interval"> <string-array name="entries_refresh_interval">
<item>@string/item_3_minutes</item> <item>@string/item_3_minutes</item>
<item>@string/item_5_minutes</item> <item>@string/item_5_minutes</item>
<item>@string/item_10_minutes</item> <item>@string/item_10_minutes</item>
<item>@string/item_15_minutes</item> <item>@string/item_15_minutes</item>
<item>@string/item_30_minutes</item> <item>@string/item_30_minutes</item>
<item>@string/item_1_hour</item> <item>@string/item_1_hour</item>
<item>@string/item_2_hours</item> <item>@string/item_2_hours</item>
<item>@string/item_4_hours</item> <item>@string/item_4_hours</item>
</string-array> </string-array>
<string-array name="values_refresh_interval"> <string-array name="values_refresh_interval">
<item>3</item> <item>3</item>
<item>5</item> <item>5</item>
<item>10</item> <item>10</item>
<item>15</item> <item>15</item>
<item>30</item> <item>30</item>
<item>60</item> <item>60</item>
<item>120</item> <item>120</item>
<item>240</item> <item>240</item>
</string-array> </string-array>
<string-array name="entries_auto_refresh_content"> <string-array name="entries_auto_refresh_content">
<item>@string/home</item> <item>@string/home</item>
<item>@string/mentions</item> <item>@string/mentions</item>
<item>@string/inbox</item> <item>@string/inbox</item>
<item>@string/trends</item> <item>@string/trends</item>
</string-array> </string-array>
<string-array name="entries_notification_content"> <string-array name="entries_notification_content">
<item>@string/home</item> <item>@string/home</item>
<item>@string/mentions</item> <item>@string/mentions</item>
<item>@string/inbox</item> <item>@string/inbox</item>
</string-array> </string-array>
<string-array name="entries_home_refresh_content"> <string-array name="entries_home_refresh_content">
<item>@string/mentions</item> <item>@string/mentions</item>
<item>@string/inbox</item> <item>@string/inbox</item>
<item>@string/trends</item> <item>@string/trends</item>
</string-array> </string-array>
<string-array name="entries_image_preload_option"> <string-array name="entries_image_preload_option">
<item>@string/profile_images</item> <item>@string/profile_images</item>
<item>@string/preview_images</item> <item>@string/preview_images</item>
</string-array> </string-array>
<string-array name="entries_compose_quit_action"> <string-array name="entries_compose_quit_action">
<item>@string/ask</item> <item>@string/ask</item>
<item>@string/save</item> <item>@string/save</item>
<item>@string/discard</item> <item>@string/discard</item>
</string-array> </string-array>
<string-array name="values_compose_quit_action"> <string-array name="values_compose_quit_action">
<item>ask</item> <item>ask</item>
<item>save</item> <item>save</item>
<item>discard</item> <item>discard</item>
</string-array> </string-array>
<string-array name="entries_official_consumer_key_secret"> <string-array name="entries_official_consumer_key_secret">
<item>Twitter for Android</item> <item>Twitter for Android</item>
<item>Twitter for iPhone</item> <item>Twitter for iPhone</item>
<item>Twitter for iPad</item> <item>Twitter for iPad</item>
<item>Twitter for Mac</item> <item>Twitter for Mac</item>
<item>Twitter for Windows Phone</item> <item>Twitter for Windows Phone</item>
<item>Twitter for Google TV</item> <item>Twitter for Google TV</item>
</string-array> </string-array>
<string-array name="values_official_consumer_key_secret"> <string-array name="values_official_consumer_key_secret">
<item>3nVuSoBZnx6U4vzUxf5w;Bcs59EFbbsdF6Sl9Ng71smgStWEGwXXKSjYvPVt7qys</item> <item>3nVuSoBZnx6U4vzUxf5w;Bcs59EFbbsdF6Sl9Ng71smgStWEGwXXKSjYvPVt7qys</item>
<item>IQKbtAYlXLripLGPWd0HUA;GgDYlkSvaPxGxC4X8liwpUoqKwwr3lCADbz8A7ADU</item> <item>IQKbtAYlXLripLGPWd0HUA;GgDYlkSvaPxGxC4X8liwpUoqKwwr3lCADbz8A7ADU</item>
<item>CjulERsDeqhhjSme66ECg;IQWdVyqFxghAtURHGeGiWAsmCAGmdW3WmbEx6Hck</item> <item>CjulERsDeqhhjSme66ECg;IQWdVyqFxghAtURHGeGiWAsmCAGmdW3WmbEx6Hck</item>
<item>3rJOl1ODzm9yZy63FACdg;5jPoQ5kQvMJFDYRNE8bQ4rHuds4xJqhvgNJM4awaE8</item> <item>3rJOl1ODzm9yZy63FACdg;5jPoQ5kQvMJFDYRNE8bQ4rHuds4xJqhvgNJM4awaE8</item>
<item>yN3DUNVO0Me63IAQdhTfCA;c768oTKdzAjIYCmpSNIdZbGaG0t6rOhSFQP0S5uC79g</item> <item>yN3DUNVO0Me63IAQdhTfCA;c768oTKdzAjIYCmpSNIdZbGaG0t6rOhSFQP0S5uC79g</item>
<item>iAtYJ4HpUVfIUoNnif1DA;172fOpzuZoYzNYaU3mMYvE8m8MEyLbztOdbrUolU</item> <item>iAtYJ4HpUVfIUoNnif1DA;172fOpzuZoYzNYaU3mMYvE8m8MEyLbztOdbrUolU</item>
</string-array> </string-array>
<string-array name="entries_theme"> <string-array name="entries_theme">
<item>@string/theme_twidere</item> <item>@string/theme_light</item>
<item>@string/theme_light</item> <item>@string/theme_dark</item>
<item>@string/theme_dark</item> </string-array>
</string-array> <string-array name="values_theme">
<string-array name="values_theme"> <item>light</item>
<item>twidere</item> <item>dark</item>
<item>light</item> </string-array>
<item>dark</item> <string-array name="values_theme_background">
</string-array> <item>default</item>
<string-array name="values_theme_background"> <item>solid</item>
<item>default</item> <item>transparent</item>
<item>solid</item> </string-array>
<item>transparent</item> <string-array name="entries_theme_background">
</string-array> <item>@string/theme_background_default</item>
<string-array name="entries_theme_background"> <item>@string/theme_background_solid</item>
<item>@string/theme_background_default</item> <item>@string/theme_background_transparent</item>
<item>@string/theme_background_solid</item> </string-array>
<item>@string/theme_background_transparent</item> <string-array name="dependency_values_actionbar_theme">
</string-array> <item>twidere</item>
<string-array name="dependency_values_actionbar_theme"> <item>light</item>
<item>twidere</item> </string-array>
<item>light</item> <string-array name="dependency_values_theme_background_alpha">
</string-array> <item>transparent</item>
<string-array name="dependency_values_theme_background_alpha"> </string-array>
<item>transparent</item> <string-array name="dependency_values_true">
</string-array> <item>true</item>
<string-array name="dependency_values_true"> </string-array>
<item>true</item> <string-array name="dependency_values_false">
</string-array> <item>false</item>
<string-array name="dependency_values_false"> </string-array>
<item>false</item> <string-array name="values_tab_display_option">
</string-array> <item>icon</item>
<string-array name="values_tab_display_option"> <item>label</item>
<item>icon</item> <item>both</item>
<item>label</item> </string-array>
<item>both</item> <string-array name="entries_tab_display_option">
</string-array> <item>@string/tab_display_option_icon</item>
<string-array name="entries_tab_display_option"> <item>@string/tab_display_option_label</item>
<item>@string/tab_display_option_icon</item> <item>@string/tab_display_option_icon_and_label</item>
<item>@string/tab_display_option_label</item> </string-array>
<item>@string/tab_display_option_icon_and_label</item> <string-array name="entries_settings_export">
</string-array> <item>@string/accounts</item>
<string-array name="entries_settings_export"> <item>@string/drafts</item>
<item>@string/accounts</item> <item>@string/settings</item>
<item>@string/drafts</item> <item>@string/tabs</item>
<item>@string/settings</item> <item>@string/filters</item>
<item>@string/tabs</item> <item>@string/nicknames</item>
<item>@string/filters</item> <item>@string/user_colors</item>
<item>@string/nicknames</item> <item>@string/custom_host_mapping</item>
<item>@string/user_colors</item> </string-array>
<item>@string/custom_host_mapping</item> <string-array name="values_compose_now_action">
</string-array> <item>compose</item>
<string-array name="values_compose_now_action"> <item>take_photo</item>
<item>compose</item> <item>pick_image</item>
<item>take_photo</item> </string-array>
<item>pick_image</item> <string-array name="entries_compose_now_action">
</string-array> <item>@string/compose</item>
<string-array name="entries_compose_now_action"> <item>@string/take_photo</item>
<item>@string/compose</item> <item>@string/add_image</item>
<item>@string/take_photo</item> </string-array>
<item>@string/add_image</item> <string-array name="values_card_highlight_option">
</string-array> <item>background</item>
<string-array name="values_card_highlight_option"> <item>line</item>
<item>background</item> <item>none</item>
<item>line</item> </string-array>
<item>none</item> <string-array name="entries_card_highlight_option">
</string-array> <item>@string/card_highlight_option_highlight</item>
<string-array name="entries_card_highlight_option"> <item>@string/card_highlight_option_line</item>
<item>@string/card_highlight_option_highlight</item> <item>@string/none</item>
<item>@string/card_highlight_option_line</item> </string-array>
<item>@string/none</item> <string-array name="values_image_preview_scale_type">
</string-array> <item>CENTER_CROP</item>
<string-array name="values_image_preview_scale_type"> <item>FIT_CENTER</item>
<item>CENTER_CROP</item> </string-array>
<item>FIT_CENTER</item> <string-array name="entries_image_preview_scale_type">
</string-array> <item>@string/image_preview_scale_type_crop</item>
<string-array name="entries_image_preview_scale_type"> <item>@string/image_preview_scale_type_fit_center</item>
<item>@string/image_preview_scale_type_crop</item> </string-array>
<item>@string/image_preview_scale_type_fit_center</item> <string-array name="entries_image_sources">
</string-array> <item>@string/from_camera</item>
<string-array name="entries_image_sources"> <item>@string/from_gallery</item>
<item>@string/from_camera</item> </string-array>
<item>@string/from_gallery</item> <string-array name="value_image_sources">
</string-array> <item>camera</item>
<string-array name="value_image_sources"> <item>gallery</item>
<item>camera</item> </string-array>
<item>gallery</item>
</string-array>
</resources> </resources>

View File

@ -75,4 +75,5 @@
<item name="progress" type="id"/> <item name="progress" type="id"/>
<item name="open_with_account" type="id"/> <item name="open_with_account" type="id"/>
<item name="accounts" type="id"/> <item name="accounts" type="id"/>
<item name="inverse_selection" type="id"/>
</resources> </resources>

View File

@ -646,5 +646,6 @@
<string name="exclude_this_host">Exclude this host</string> <string name="exclude_this_host">Exclude this host</string>
<string name="api_url_format_help">[DOMAIN]: Twitter API domain.\nExample: https://[DOMAIN].twitter.com/ will be replaced to https://api.twitter.com/.</string> <string name="api_url_format_help">[DOMAIN]: Twitter API domain.\nExample: https://[DOMAIN].twitter.com/ will be replaced to https://api.twitter.com/.</string>
<string name="no_version_suffix">No version suffix</string> <string name="no_version_suffix">No version suffix</string>
<string name="inverse_selection">Inverse selection</string>
</resources> </resources>

View File

@ -1,69 +1,59 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" <PreferenceScreen
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/theme"> xmlns:app="http://schemas.android.com/apk/res-auto"
android:title="@string/theme">
<PreferenceCategory <PreferenceCategory
android:key="cat_theme_preview" android:key="cat_theme_preview"
android:order="11" android:order="11"
android:title="@string/preview"> android:title="@string/preview">
<org.mariotaku.twidere.preference.ThemePreviewPreference android:key="theme_preview"/> <org.mariotaku.twidere.preference.ThemePreviewPreference android:key="theme_preview"/>
</PreferenceCategory> </PreferenceCategory>
<org.mariotaku.twidere.preference.AutoInvalidateListPreference <org.mariotaku.twidere.preference.SummaryListPreference
android:defaultValue="twidere" android:defaultValue="twidere"
android:entries="@array/entries_theme" android:entries="@array/entries_theme"
android:entryValues="@array/values_theme" android:entryValues="@array/values_theme"
android:key="theme" android:key="theme"
android:order="21" android:order="21"
android:summary="%s" android:title="@string/theme"/>
android:title="@string/theme"/> <org.mariotaku.twidere.preference.SummaryListPreference
<org.mariotaku.twidere.preference.AutoInvalidateListPreference android:defaultValue="default"
android:defaultValue="default" android:entries="@array/entries_theme_background"
android:entries="@array/entries_theme_background" android:entryValues="@array/values_theme_background"
android:entryValues="@array/values_theme_background" android:key="theme_background"
android:key="theme_background" android:order="22"
android:order="22" android:title="@string/theme_background"/>
android:summary="%s"
android:title="@string/theme_background"/>
<org.mariotaku.twidere.preference.ValueDependencySeekBarDialogPreference <org.mariotaku.twidere.preference.ValueDependencySeekBarDialogPreference
android:defaultValue="160" android:defaultValue="160"
android:key="theme_background_alpha" android:key="theme_background_alpha"
android:order="23" android:order="23"
android:title="@string/theme_background_alpha" android:title="@string/theme_background_alpha"
app:dependencyKey="theme_background" app:dependencyKey="theme_background"
app:dependencyValueDefault="default" app:dependencyValueDefault="default"
app:dependencyValues="@array/dependency_values_theme_background_alpha" app:dependencyValues="@array/dependency_values_theme_background_alpha"
app:max="255" app:max="255"
app:min="0"/> app:min="0"/>
<org.mariotaku.twidere.preference.ValueDependencyCheckBoxPreference <org.mariotaku.twidere.preference.ColorPickerPreference
android:defaultValue="true" android:defaultValue="@android:color/holo_blue_light"
android:key="theme_dark_actionbar" android:key="theme_color"
android:order="24" android:order="25"
android:title="@string/theme_dark_actionbar" android:title="@string/theme_color"/>
app:dependencyKey="theme"
app:dependencyValueDefault="twidere"
app:dependencyValues="@array/dependency_values_actionbar_theme"/>
<org.mariotaku.twidere.preference.ColorPickerPreference <org.mariotaku.twidere.preference.ThemeFontFamilyPreference
android:defaultValue="@android:color/holo_blue_light" android:defaultValue="sans-serif-light"
android:key="theme_color" android:enabled="@bool/has_font_family"
android:order="25" android:key="theme_font_family"
android:title="@string/theme_color"/> android:order="26"
android:title="@string/theme_font_family"/>
<org.mariotaku.twidere.preference.ThemeFontFamilyPreference <org.mariotaku.twidere.preference.AutoFixCheckBoxPreference
android:defaultValue="sans-serif-light" android:defaultValue="true"
android:enabled="@bool/has_font_family" android:key="dark_drawer"
android:key="theme_font_family" android:order="27"
android:order="26" android:title="@string/dark_drawer"/>
android:title="@string/theme_font_family"/>
<org.mariotaku.twidere.preference.AutoFixCheckBoxPreference
android:defaultValue="true"
android:key="dark_drawer"
android:order="27"
android:title="@string/dark_drawer"/>
</PreferenceScreen> </PreferenceScreen>