parent
c5ec57652f
commit
9c24a984dc
|
@ -1,9 +1,17 @@
|
|||
package android.support.v4.app;
|
||||
|
||||
import android.support.v4.view.LayoutInflaterFactory;
|
||||
|
||||
public class FragmentManagerTrojan {
|
||||
|
||||
public static boolean isStateSaved(final FragmentManager fm) {
|
||||
if (fm instanceof FragmentManagerImpl) return ((FragmentManagerImpl) fm).mStateSaved;
|
||||
return false;
|
||||
}
|
||||
public static boolean isStateSaved(final FragmentManager fm) {
|
||||
if (fm instanceof FragmentManagerImpl) return ((FragmentManagerImpl) fm).mStateSaved;
|
||||
return false;
|
||||
}
|
||||
|
||||
public static LayoutInflaterFactory getLayoutInflaterFactory(final FragmentManager fm) {
|
||||
if (fm instanceof FragmentManagerImpl)
|
||||
return ((FragmentManagerImpl) fm).getLayoutInflaterFactory();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,9 +24,7 @@ import android.content.Context;
|
|||
import android.os.Build;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.view.LayoutInflaterCompat;
|
||||
import android.support.v4.view.LayoutInflaterFactory;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.InflateException;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
|
@ -34,11 +32,7 @@ import android.view.Window;
|
|||
import org.mariotaku.twidere.Constants;
|
||||
import org.mariotaku.twidere.activity.iface.IThemedActivity;
|
||||
import org.mariotaku.twidere.util.ThemeUtils;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import org.mariotaku.twidere.util.ThemedLayoutInflaterFactory;
|
||||
|
||||
/**
|
||||
* Created by mariotaku on 15/4/22.
|
||||
|
@ -63,7 +57,6 @@ public class ThemedAppCompatDelegate implements Constants {
|
|||
private static class ThemedAppCompatDelegateImplV11 extends AppCompatDelegateImplV11 {
|
||||
|
||||
private final IThemedActivity themed;
|
||||
private static final Map<String, Constructor> sConstructorCache = new HashMap<>();
|
||||
|
||||
private ThemedAppCompatDelegateImplV11(IThemedActivity themed, Context context, Window window, AppCompatCallback callback) {
|
||||
super(context, window, callback);
|
||||
|
@ -81,42 +74,11 @@ public class ThemedAppCompatDelegate implements Constants {
|
|||
@Override
|
||||
public View createView(View parent, String name, @NonNull Context context, @NonNull AttributeSet attrs) {
|
||||
View view = super.createView(parent, name, context, attrs);
|
||||
if (view == null && name.contains(".")) {
|
||||
try {
|
||||
Constructor<?> constructor = sConstructorCache.get(name);
|
||||
if (constructor == null) {
|
||||
final Class<?> viewCls = Class.forName(name);
|
||||
constructor = viewCls.getConstructor(Context.class, AttributeSet.class);
|
||||
sConstructorCache.put(name, constructor);
|
||||
}
|
||||
view = (View) constructor.newInstance(context, attrs);
|
||||
} catch (ClassNotFoundException ignore) {
|
||||
} catch (NoSuchMethodException | InvocationTargetException | InstantiationException | IllegalAccessException e) {
|
||||
throw new InflateException(e);
|
||||
}
|
||||
if (view == null) {
|
||||
// view = ThemeUtils.createCustomView(parent, name, context, attrs);
|
||||
}
|
||||
return view;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Created by mariotaku on 15/4/22.
|
||||
*/
|
||||
private static class ThemedLayoutInflaterFactory implements LayoutInflaterFactory {
|
||||
|
||||
private final IThemedActivity activity;
|
||||
private final ThemedAppCompatDelegateImplV11 delegate;
|
||||
|
||||
public ThemedLayoutInflaterFactory(IThemedActivity activity, ThemedAppCompatDelegateImplV11 delegate) {
|
||||
this.activity = activity;
|
||||
this.delegate = delegate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(View view, String s, Context context, AttributeSet attributeSet) {
|
||||
final View createdView = delegate.onCreateView(view, s, context, attributeSet);
|
||||
ThemeUtils.initView(createdView, activity);
|
||||
return createdView;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ import java.io.OutputStream;
|
|||
|
||||
import static android.os.Environment.getExternalStorageState;
|
||||
|
||||
public class ImagePickerActivity extends ThemedAppCompatActivity {
|
||||
public class ImagePickerActivity extends ThemedFragmentActivity {
|
||||
|
||||
public static final int REQUEST_PICK_IMAGE = 101;
|
||||
public static final int REQUEST_TAKE_PHOTO = 102;
|
||||
|
|
|
@ -67,6 +67,7 @@ import android.view.View;
|
|||
import android.view.View.OnClickListener;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.animation.DecelerateInterpolator;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ListAdapter;
|
||||
import android.widget.ListView;
|
||||
|
@ -114,8 +115,8 @@ import static org.mariotaku.twidere.util.Utils.openUserFavorites;
|
|||
import static org.mariotaku.twidere.util.Utils.openUserLists;
|
||||
import static org.mariotaku.twidere.util.Utils.openUserProfile;
|
||||
|
||||
public class AccountsDashboardFragment extends BaseSupportListFragment implements LoaderCallbacks<Cursor>,
|
||||
OnSharedPreferenceChangeListener, ImageLoadingListener, OnClickListener, KeyboardShortcutCallback {
|
||||
public class AccountsDashboardFragment extends BaseSupportFragment implements LoaderCallbacks<Cursor>,
|
||||
OnSharedPreferenceChangeListener, ImageLoadingListener, OnClickListener, KeyboardShortcutCallback, AdapterView.OnItemClickListener {
|
||||
|
||||
private final SupportFragmentReloadCursorObserver mReloadContentObserver = new SupportFragmentReloadCursorObserver(
|
||||
this, 0, this);
|
||||
|
@ -128,6 +129,7 @@ public class AccountsDashboardFragment extends BaseSupportListFragment implement
|
|||
private AccountOptionsAdapter mAccountOptionsAdapter;
|
||||
private AppMenuAdapter mAppMenuAdapter;
|
||||
|
||||
private ListView mListView;
|
||||
private TextView mAppMenuSectionView;
|
||||
private View mAccountSelectorView;
|
||||
private RecyclerView mAccountsSelector;
|
||||
|
@ -177,12 +179,11 @@ public class AccountsDashboardFragment extends BaseSupportListFragment implement
|
|||
return false;
|
||||
}
|
||||
}
|
||||
final ListView listView = getListView();
|
||||
final int firstVisiblePosition = ListViewUtils.getFirstFullyVisiblePosition(listView);
|
||||
final int selectedItem = listView.getSelectedItemPosition();
|
||||
final int count = listView.getCount();
|
||||
final int firstVisiblePosition = ListViewUtils.getFirstFullyVisiblePosition(mListView);
|
||||
final int selectedItem = mListView.getSelectedItemPosition();
|
||||
final int count = mListView.getCount();
|
||||
int resultPosition;
|
||||
if (!listView.isFocused() || selectedItem == ListView.INVALID_POSITION) {
|
||||
if (!mListView.isFocused() || selectedItem == ListView.INVALID_POSITION) {
|
||||
resultPosition = firstVisiblePosition;
|
||||
} else {
|
||||
resultPosition = selectedItem + offset;
|
||||
|
@ -190,12 +191,12 @@ public class AccountsDashboardFragment extends BaseSupportListFragment implement
|
|||
resultPosition += offset;
|
||||
}
|
||||
}
|
||||
final View focusedChild = listView.getFocusedChild();
|
||||
final View focusedChild = mListView.getFocusedChild();
|
||||
if (focusedChild == null) {
|
||||
listView.requestChildFocus(listView.getChildAt(0), null);
|
||||
mListView.requestChildFocus(mListView.getChildAt(0), null);
|
||||
}
|
||||
if (resultPosition >= 0 && resultPosition < count) {
|
||||
listView.setSelection(resultPosition);
|
||||
mListView.setSelection(resultPosition);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -270,7 +271,7 @@ public class AccountsDashboardFragment extends BaseSupportListFragment implement
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onListItemClick(final ListView l, final View v, final int position, final long id) {
|
||||
public void onItemClick(final AdapterView<?> parent, final View v, final int position, final long id) {
|
||||
final ListAdapter adapter = mAdapter.getAdapter(position);
|
||||
final Object item = mAdapter.getItem(position);
|
||||
if (adapter instanceof AccountOptionsAdapter) {
|
||||
|
@ -388,15 +389,14 @@ public class AccountsDashboardFragment extends BaseSupportListFragment implement
|
|||
final Context context = view.getContext();
|
||||
final TwidereApplication application = TwidereApplication.getInstance(context);
|
||||
mImageLoader = application.getMediaLoaderWrapper();
|
||||
final LayoutInflater inflater = LayoutInflater.from(context);
|
||||
final ListView listView = getListView();
|
||||
listView.setItemsCanFocus(true);
|
||||
mListView.setItemsCanFocus(true);
|
||||
mAdapter = new MergeAdapter();
|
||||
mAccountsAdapter = new AccountSelectorAdapter(context, this);
|
||||
final LayoutInflater inflater = getLayoutInflater(savedInstanceState);
|
||||
mAccountsAdapter = new AccountSelectorAdapter(context, inflater, this);
|
||||
mAccountOptionsAdapter = new AccountOptionsAdapter(context);
|
||||
mAppMenuAdapter = new AppMenuAdapter(context);
|
||||
mAppMenuSectionView = Utils.newSectionView(context, R.string.more);
|
||||
mAccountSelectorView = inflater.inflate(R.layout.header_drawer_account_selector, listView, false);
|
||||
mAccountSelectorView = inflater.inflate(R.layout.header_drawer_account_selector, mListView, false);
|
||||
mAccountsSelector = (RecyclerView) mAccountSelectorView.findViewById(R.id.other_accounts_list);
|
||||
final LinearLayoutManager layoutManager = new FixedLinearLayoutManager(context);
|
||||
layoutManager.setOrientation(LinearLayoutManager.HORIZONTAL);
|
||||
|
@ -435,14 +435,21 @@ public class AccountsDashboardFragment extends BaseSupportListFragment implement
|
|||
mAdapter.addAdapter(mAccountOptionsAdapter);
|
||||
mAdapter.addView(mAppMenuSectionView, false);
|
||||
mAdapter.addAdapter(mAppMenuAdapter);
|
||||
setListAdapter(mAdapter);
|
||||
mListView.setAdapter(mAdapter);
|
||||
mListView.setOnItemClickListener(this);
|
||||
mPreferences.registerOnSharedPreferenceChangeListener(this);
|
||||
getLoaderManager().initLoader(0, null, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) {
|
||||
return LayoutInflater.from(getThemedContext()).inflate(R.layout.fragment_accounts_dashboard, container, false);
|
||||
return inflater.inflate(R.layout.fragment_accounts_dashboard, container, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBaseViewCreated(View view, Bundle savedInstanceState) {
|
||||
super.onBaseViewCreated(view, savedInstanceState);
|
||||
mListView = (ListView) view.findViewById(android.R.id.list);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -483,7 +490,8 @@ public class AccountsDashboardFragment extends BaseSupportListFragment implement
|
|||
rectF.set(location[0], location[1], location[0] + view.getWidth(), location[1] + view.getHeight());
|
||||
}
|
||||
|
||||
private Context getThemedContext() {
|
||||
@Override
|
||||
public Context getThemedContext() {
|
||||
if (mThemedContext != null) return mThemedContext;
|
||||
final Context context = getActivity();
|
||||
final int themeResource = ThemeUtils.getDrawerThemeResource(context);
|
||||
|
@ -672,8 +680,8 @@ public class AccountsDashboardFragment extends BaseSupportListFragment implement
|
|||
private final LongSparseArray<Long> positionMap = new LongSparseArray<>();
|
||||
private ParcelableAccount[] mInternalAccounts;
|
||||
|
||||
AccountSelectorAdapter(Context context, AccountsDashboardFragment fragment) {
|
||||
mInflater = LayoutInflater.from(context);
|
||||
AccountSelectorAdapter(Context context, LayoutInflater inflater, AccountsDashboardFragment fragment) {
|
||||
mInflater = inflater;
|
||||
mImageLoader = TwidereApplication.getInstance(context).getMediaLoaderWrapper();
|
||||
mFragment = fragment;
|
||||
setHasStableIds(true);
|
||||
|
|
|
@ -22,6 +22,7 @@ package org.mariotaku.twidere.fragment.support;
|
|||
import android.app.Activity;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.SharedPreferences;
|
||||
import android.graphics.Rect;
|
||||
|
@ -29,15 +30,21 @@ import android.os.Bundle;
|
|||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
import android.support.v4.app.FragmentManagerTrojan;
|
||||
import android.support.v4.view.LayoutInflaterCompat;
|
||||
import android.support.v4.view.LayoutInflaterFactory;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
||||
import org.mariotaku.twidere.Constants;
|
||||
import org.mariotaku.twidere.activity.iface.IThemedActivity;
|
||||
import org.mariotaku.twidere.activity.support.BaseAppCompatActivity;
|
||||
import org.mariotaku.twidere.app.TwidereApplication;
|
||||
import org.mariotaku.twidere.fragment.iface.IBaseFragment;
|
||||
import org.mariotaku.twidere.util.AsyncTwitterWrapper;
|
||||
import org.mariotaku.twidere.util.MultiSelectManager;
|
||||
import org.mariotaku.twidere.util.ReadStateManager;
|
||||
import org.mariotaku.twidere.util.ThemedLayoutInflaterFactory;
|
||||
|
||||
public class BaseSupportFragment extends Fragment implements IBaseFragment, Constants {
|
||||
|
||||
|
@ -147,7 +154,24 @@ public class BaseSupportFragment extends Fragment implements IBaseFragment, Cons
|
|||
|
||||
}
|
||||
|
||||
protected void fitSystemWindows(Rect insets) {
|
||||
@Override
|
||||
public LayoutInflater getLayoutInflater(Bundle savedInstanceState) {
|
||||
final FragmentActivity activity = getActivity();
|
||||
if (!(activity instanceof IThemedActivity)) {
|
||||
return super.getLayoutInflater(savedInstanceState);
|
||||
}
|
||||
final LayoutInflater inflater = activity.getLayoutInflater().cloneInContext(getThemedContext());
|
||||
getChildFragmentManager(); // Init if needed; use raw implementation below.
|
||||
final LayoutInflaterFactory delegate = FragmentManagerTrojan.getLayoutInflaterFactory(getChildFragmentManager());
|
||||
LayoutInflaterCompat.setFactory(inflater, new ThemedLayoutInflaterFactory((IThemedActivity) activity, delegate));
|
||||
return inflater;
|
||||
}
|
||||
|
||||
public Context getThemedContext() {
|
||||
return getActivity();
|
||||
}
|
||||
|
||||
|
||||
protected void fitSystemWindows(Rect insets) {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,11 @@ import android.content.SharedPreferences;
|
|||
import android.graphics.Rect;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
import android.support.v4.app.FragmentManagerTrojan;
|
||||
import android.support.v4.app.ListFragment;
|
||||
import android.support.v4.view.LayoutInflaterCompat;
|
||||
import android.support.v4.view.LayoutInflaterFactory;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MotionEvent;
|
||||
|
@ -45,6 +49,7 @@ import android.widget.TextView;
|
|||
|
||||
import org.mariotaku.twidere.Constants;
|
||||
import org.mariotaku.twidere.activity.iface.IControlBarActivity;
|
||||
import org.mariotaku.twidere.activity.iface.IThemedActivity;
|
||||
import org.mariotaku.twidere.app.TwidereApplication;
|
||||
import org.mariotaku.twidere.fragment.iface.IBaseFragment;
|
||||
import org.mariotaku.twidere.fragment.iface.RefreshScrollTopInterface;
|
||||
|
@ -53,6 +58,7 @@ import org.mariotaku.twidere.util.ListScrollDistanceCalculator;
|
|||
import org.mariotaku.twidere.util.ListScrollDistanceCalculator.ScrollDistanceListener;
|
||||
import org.mariotaku.twidere.util.MultiSelectManager;
|
||||
import org.mariotaku.twidere.util.ThemeUtils;
|
||||
import org.mariotaku.twidere.util.ThemedLayoutInflaterFactory;
|
||||
import org.mariotaku.twidere.util.Utils;
|
||||
import org.mariotaku.twidere.view.ExtendedFrameLayout;
|
||||
import org.mariotaku.twidere.view.iface.IExtendedView.TouchInterceptor;
|
||||
|
@ -382,6 +388,23 @@ public class BaseSupportListFragment extends ListFragment implements IBaseFragme
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LayoutInflater getLayoutInflater(Bundle savedInstanceState) {
|
||||
final FragmentActivity activity = getActivity();
|
||||
if (!(activity instanceof IThemedActivity)) {
|
||||
return super.getLayoutInflater(savedInstanceState);
|
||||
}
|
||||
final LayoutInflater inflater = activity.getLayoutInflater().cloneInContext(getThemedContext());
|
||||
getChildFragmentManager(); // Init if needed; use raw implementation below.
|
||||
final LayoutInflaterFactory delegate = FragmentManagerTrojan.getLayoutInflaterFactory(getChildFragmentManager());
|
||||
LayoutInflaterCompat.setFactory(inflater, new ThemedLayoutInflaterFactory((IThemedActivity) activity, delegate));
|
||||
return inflater;
|
||||
}
|
||||
|
||||
public Context getThemedContext() {
|
||||
return getActivity();
|
||||
}
|
||||
|
||||
public void unregisterReceiver(final BroadcastReceiver receiver) {
|
||||
final Activity activity = getActivity();
|
||||
if (activity == null) return;
|
||||
|
|
|
@ -31,11 +31,14 @@ import android.os.AsyncTask;
|
|||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
import android.support.v4.app.FragmentManagerTrojan;
|
||||
import android.support.v4.app.LoaderManager;
|
||||
import android.support.v4.app.LoaderManager.LoaderCallbacks;
|
||||
import android.support.v4.content.CursorLoader;
|
||||
import android.support.v4.content.Loader;
|
||||
import android.support.v4.util.Pair;
|
||||
import android.support.v4.view.LayoutInflaterCompat;
|
||||
import android.support.v4.view.LayoutInflaterFactory;
|
||||
import android.support.v4.view.MenuItemCompat;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.support.v7.widget.FixedLinearLayoutManager;
|
||||
|
@ -74,6 +77,7 @@ import org.mariotaku.querybuilder.Expression;
|
|||
import org.mariotaku.querybuilder.OrderBy;
|
||||
import org.mariotaku.querybuilder.RawItemArray;
|
||||
import org.mariotaku.twidere.R;
|
||||
import org.mariotaku.twidere.activity.iface.IThemedActivity;
|
||||
import org.mariotaku.twidere.activity.support.BaseAppCompatActivity;
|
||||
import org.mariotaku.twidere.activity.support.ImagePickerActivity;
|
||||
import org.mariotaku.twidere.adapter.AccountsSpinnerAdapter;
|
||||
|
@ -103,6 +107,7 @@ import org.mariotaku.twidere.util.MediaLoaderWrapper;
|
|||
import org.mariotaku.twidere.util.ParseUtils;
|
||||
import org.mariotaku.twidere.util.ReadStateManager;
|
||||
import org.mariotaku.twidere.util.SharedPreferencesWrapper;
|
||||
import org.mariotaku.twidere.util.ThemedLayoutInflaterFactory;
|
||||
import org.mariotaku.twidere.util.TwidereValidator;
|
||||
import org.mariotaku.twidere.util.UserColorNameManager;
|
||||
import org.mariotaku.twidere.util.Utils;
|
||||
|
|
|
@ -146,7 +146,8 @@ public class QuickMenuFragment extends BaseSupportFragment implements OnFitSyste
|
|||
return -1;
|
||||
}
|
||||
|
||||
private Context getThemedContext() {
|
||||
@Override
|
||||
public Context getThemedContext() {
|
||||
if (mThemedContext != null) return mThemedContext;
|
||||
final Context context = getActivity();
|
||||
final int currentThemeResource = ThemeUtils.getThemeResource(context);
|
||||
|
|
|
@ -23,6 +23,8 @@ import android.annotation.SuppressLint;
|
|||
import android.app.ActionBar;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.ContextWrapper;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.content.res.Resources;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Color;
|
||||
|
@ -35,7 +37,9 @@ import android.os.Build;
|
|||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
import android.support.v4.view.TintableBackgroundView;
|
||||
import android.support.v4.view.ViewCompat;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.internal.app.WindowDecorActionBar;
|
||||
import android.support.v7.internal.app.WindowDecorActionBar.ActionModeImpl;
|
||||
import android.support.v7.internal.view.SupportActionModeWrapper;
|
||||
|
@ -59,12 +63,14 @@ import android.view.View;
|
|||
import android.view.View.OnLongClickListener;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.mariotaku.twidere.Constants;
|
||||
import org.mariotaku.twidere.R;
|
||||
import org.mariotaku.twidere.activity.AppCompatPreferenceActivity;
|
||||
import org.mariotaku.twidere.activity.iface.IThemedActivity;
|
||||
import org.mariotaku.twidere.graphic.ActionBarColorDrawable;
|
||||
import org.mariotaku.twidere.graphic.ActionIconDrawable;
|
||||
|
@ -72,6 +78,7 @@ import org.mariotaku.twidere.text.ParagraphSpacingSpan;
|
|||
import org.mariotaku.twidere.util.menu.TwidereMenuInfo;
|
||||
import org.mariotaku.twidere.view.ShapedImageView;
|
||||
import org.mariotaku.twidere.view.TabPagerIndicator;
|
||||
import org.mariotaku.twidere.view.iface.IThemedView;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
|
@ -770,19 +777,6 @@ public class ThemeUtils implements Constants {
|
|||
indicator.updateAppearance();
|
||||
}
|
||||
|
||||
public static void initView(View view, IThemedActivity activity) {
|
||||
if (view == null) return;
|
||||
if (view instanceof ShapedImageView) {
|
||||
final ShapedImageView shapedImageView = (ShapedImageView) view;
|
||||
shapedImageView.setStyle(activity.getCurrentProfileImageStyle());
|
||||
} else if (view instanceof TextView) {
|
||||
final String fontFamily = activity.getCurrentThemeFontFamily();
|
||||
final TextView textView = (TextView) view;
|
||||
final Typeface defTypeface = textView.getTypeface();
|
||||
textView.setTypeface(getUserTypeface((Context) activity, fontFamily, defTypeface));
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isColoredActionBar(int themeRes) {
|
||||
return !isDarkTheme(themeRes);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,159 @@
|
|||
/*
|
||||
* Twidere - Twitter client for Android
|
||||
*
|
||||
* Copyright (C) 2012-2015 Mariotaku Lee <mariotaku.lee@gmail.com>
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.mariotaku.twidere.util;
|
||||
|
||||
import android.app.ActionBar;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.ContextWrapper;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Typeface;
|
||||
import android.support.v4.view.LayoutInflaterFactory;
|
||||
import android.support.v4.view.TintableBackgroundView;
|
||||
import android.support.v4.view.ViewCompat;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.InflateException;
|
||||
import android.view.View;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.mariotaku.twidere.activity.AppCompatPreferenceActivity;
|
||||
import org.mariotaku.twidere.activity.iface.IThemedActivity;
|
||||
import org.mariotaku.twidere.view.ShapedImageView;
|
||||
import org.mariotaku.twidere.view.iface.IThemedView;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Created by mariotaku on 15/4/22.
|
||||
*/
|
||||
public class ThemedLayoutInflaterFactory implements LayoutInflaterFactory {
|
||||
|
||||
private static final String[] sCustomViewPrefixWhiteList = {"org.mariotaku.twidere.view"};
|
||||
private static final Map<String, Constructor> sConstructorCache = new HashMap<>();
|
||||
|
||||
private final IThemedActivity activity;
|
||||
private final LayoutInflaterFactory delegate;
|
||||
|
||||
public ThemedLayoutInflaterFactory(IThemedActivity activity, LayoutInflaterFactory delegate) {
|
||||
this.activity = activity;
|
||||
this.delegate = delegate;
|
||||
}
|
||||
|
||||
public static View createCustomView(String name, Context context, AttributeSet attrs) {
|
||||
if (!name.contains(".")) return null;
|
||||
boolean whiteListed = false;
|
||||
for (String prefix : sCustomViewPrefixWhiteList) {
|
||||
if (name.startsWith(prefix)) {
|
||||
whiteListed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!whiteListed) return null;
|
||||
try {
|
||||
Constructor<?> constructor = sConstructorCache.get(name);
|
||||
if (constructor == null) {
|
||||
final Class<?> viewCls = Class.forName(name);
|
||||
if (!View.class.isAssignableFrom(viewCls)) return null;
|
||||
constructor = viewCls.getConstructor(Context.class, AttributeSet.class);
|
||||
sConstructorCache.put(name, constructor);
|
||||
}
|
||||
return (View) constructor.newInstance(context, attrs);
|
||||
} catch (ClassNotFoundException ignore) {
|
||||
} catch (NoSuchMethodException | InvocationTargetException | InstantiationException | IllegalAccessException e) {
|
||||
throw new InflateException(e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void initView(View view, IThemedActivity activity) {
|
||||
if (view == null) return;
|
||||
if (view instanceof ShapedImageView) {
|
||||
final ShapedImageView shapedImageView = (ShapedImageView) view;
|
||||
shapedImageView.setStyle(activity.getCurrentProfileImageStyle());
|
||||
}
|
||||
if (view instanceof TextView) {
|
||||
final String fontFamily = activity.getCurrentThemeFontFamily();
|
||||
final TextView textView = (TextView) view;
|
||||
final Typeface defTypeface = textView.getTypeface();
|
||||
textView.setTypeface(ThemeUtils.getUserTypeface((Context) activity, fontFamily, defTypeface));
|
||||
}
|
||||
initViewTint(view, activity);
|
||||
}
|
||||
|
||||
private static void initViewTint(View view, IThemedActivity activity) {
|
||||
final ColorStateList tintList;
|
||||
if (!isActionBarContext(view.getContext(), getActionBarContext((Activity) activity))) {
|
||||
tintList = ColorStateList.valueOf(activity.getCurrentThemeColor());
|
||||
} else if (ThemeUtils.isDarkTheme(activity.getCurrentThemeResourceId())) {
|
||||
tintList = ColorStateList.valueOf(Color.WHITE);
|
||||
} else {
|
||||
final int themeColor = activity.getCurrentThemeColor();
|
||||
tintList = ColorStateList.valueOf(TwidereColorUtils.getContrastYIQ(themeColor, 192));
|
||||
}
|
||||
if (view instanceof IThemedView) {
|
||||
((IThemedView) view).setThemeTintColor(tintList);
|
||||
} else if (view instanceof TintableBackgroundView) {
|
||||
((TintableBackgroundView) view).setSupportBackgroundTintList(tintList);
|
||||
} else if (view instanceof EditText) {
|
||||
ViewCompat.setBackgroundTintList(view, tintList);
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isActionBarContext(Context context, Context actionBarContext) {
|
||||
if (context == actionBarContext) return true;
|
||||
Context base = context;
|
||||
while (base instanceof ContextWrapper && (base = ((ContextWrapper) base).getBaseContext()) != null) {
|
||||
if (base == actionBarContext) return true;
|
||||
}
|
||||
return base == actionBarContext;
|
||||
}
|
||||
|
||||
private static Context getActionBarContext(Activity activity) {
|
||||
if (activity instanceof AppCompatActivity) {
|
||||
final android.support.v7.app.ActionBar actionBar = ((AppCompatActivity) activity).getSupportActionBar();
|
||||
if (actionBar != null)
|
||||
return actionBar.getThemedContext();
|
||||
} else if (activity instanceof AppCompatPreferenceActivity) {
|
||||
final android.support.v7.app.ActionBar actionBar = ((AppCompatPreferenceActivity) activity).getSupportActionBar();
|
||||
if (actionBar != null)
|
||||
return actionBar.getThemedContext();
|
||||
}
|
||||
final ActionBar actionBar = activity.getActionBar();
|
||||
if (actionBar != null) return actionBar.getThemedContext();
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(View parent, String name, Context context, AttributeSet attrs) {
|
||||
View view = delegate.onCreateView(parent, name, context, attrs);
|
||||
if (view == null) {
|
||||
view = createCustomView(name, context, attrs);
|
||||
}
|
||||
initView(view, activity);
|
||||
return view;
|
||||
}
|
||||
|
||||
}
|
|
@ -2912,6 +2912,7 @@ public final class Utils implements Constants, TwitterConstants {
|
|||
builder.appendQueryParameter(QUERY_PARAM_RECIPIENT_ID, String.valueOf(recipientId));
|
||||
}
|
||||
final Intent intent = new Intent(Intent.ACTION_VIEW, builder.build());
|
||||
intent.setPackage(BuildConfig.APPLICATION_ID);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,72 @@
|
|||
/*
|
||||
* Twidere - Twitter client for Android
|
||||
*
|
||||
* Copyright (C) 2012-2015 Mariotaku Lee <mariotaku.lee@gmail.com>
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.mariotaku.twidere.view.themed;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.PorterDuff.Mode;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.ImageButton;
|
||||
|
||||
import org.mariotaku.twidere.view.iface.IThemedView;
|
||||
|
||||
/**
|
||||
* Created by mariotaku on 14/11/5.
|
||||
*/
|
||||
public class TintThemedImageButton extends ImageButton implements IThemedView {
|
||||
|
||||
private final int mDefaultColor;
|
||||
|
||||
public TintThemedImageButton(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public TintThemedImageButton(Context context, AttributeSet attrs) {
|
||||
this(context, attrs, android.R.attr.imageButtonStyle);
|
||||
}
|
||||
|
||||
public TintThemedImageButton(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
final TypedArray a = context.obtainStyledAttributes(attrs, new int[]{android.R.attr.color,
|
||||
android.R.attr.colorForeground});
|
||||
if (a.hasValue(0)) {
|
||||
mDefaultColor = a.getColor(0, 0);
|
||||
} else {
|
||||
mDefaultColor = a.getColor(1, 0);
|
||||
}
|
||||
setColorFilter(mDefaultColor, Mode.SRC_ATOP);
|
||||
a.recycle();
|
||||
}
|
||||
|
||||
public int getDefaultColor() {
|
||||
return mDefaultColor;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setThemeTintColor(ColorStateList color) {
|
||||
if (color == null) {
|
||||
clearColorFilter();
|
||||
} else {
|
||||
setColorFilter(color.getDefaultColor());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -23,7 +23,7 @@
|
|||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:background="?selectableItemBackground"
|
||||
android:duplicateParentState="true"/>
|
||||
|
||||
<ProgressBar
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ Twidere - Twitter client for Android
|
||||
~
|
||||
~ Copyright (C) 2012-2014 Mariotaku Lee <mariotaku.lee@gmail.com>
|
||||
|
@ -19,7 +18,7 @@
|
|||
-->
|
||||
|
||||
<org.mariotaku.twidere.view.ColorLabelFrameLayout
|
||||
style="?android:actionButtonStyle"
|
||||
style="?actionButtonStyle"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -34,6 +33,6 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:layout_margin="@dimen/element_spacing_msmall"/>
|
||||
android:layout_margin="@dimen/element_spacing_msmall" />
|
||||
|
||||
</org.mariotaku.twidere.view.ColorLabelFrameLayout>
|
|
@ -53,7 +53,7 @@
|
|||
<requestFocus/>
|
||||
</EditText>
|
||||
|
||||
<org.mariotaku.twidere.view.ActionIconButton
|
||||
<org.mariotaku.twidere.view.themed.TintThemedImageButton
|
||||
android:id="@+id/query_button"
|
||||
style="?cardActionButtonStyle"
|
||||
android:layout_width="@dimen/element_size_normal"
|
||||
|
|
|
@ -71,7 +71,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:background="?selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
|
|
|
@ -113,7 +113,7 @@
|
|||
android:id="@+id/secondary_field"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:background="?selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:onClick="onClick"
|
||||
android:padding="@dimen/element_spacing_normal">
|
||||
|
|
|
@ -99,7 +99,7 @@
|
|||
android:layout_width="@dimen/minimum_element_size"
|
||||
android:layout_height="@dimen/minimum_element_size"
|
||||
android:layout_weight="0"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:background="?selectableItemBackground"
|
||||
android:contentDescription="@android:string/search_go"
|
||||
android:onClick="onClick"
|
||||
android:src="@android:drawable/ic_menu_search"/>
|
||||
|
|
|
@ -66,7 +66,7 @@
|
|||
android:layout_width="@dimen/element_size_mlarge"
|
||||
android:layout_height="@dimen/element_size_mlarge"
|
||||
android:layout_gravity="center"
|
||||
android:foreground="?android:selectableItemBackground"
|
||||
android:foreground="?selectableItemBackground"
|
||||
android:scaleType="centerCrop"/>
|
||||
|
||||
<LinearLayout
|
||||
|
@ -135,7 +135,7 @@
|
|||
android:layout_width="@dimen/element_size_mlarge"
|
||||
android:layout_height="@dimen/element_size_mlarge"
|
||||
android:layout_gravity="center"
|
||||
android:foreground="?android:selectableItemBackground"
|
||||
android:foreground="?selectableItemBackground"
|
||||
android:scaleType="centerCrop"/>
|
||||
|
||||
<LinearLayout
|
||||
|
@ -280,7 +280,7 @@
|
|||
android:id="@+id/set_link_color"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:background="?selectableItemBackground"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:padding="@dimen/element_spacing_normal">
|
||||
|
@ -308,7 +308,7 @@
|
|||
android:id="@+id/set_background_color"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:background="?selectableItemBackground"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:padding="@dimen/element_spacing_normal">
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
android:layout_height="match_parent"
|
||||
android:layout_margin="@dimen/element_spacing_small"
|
||||
android:clickable="true"
|
||||
android:foreground="?android:selectableItemBackground"
|
||||
android:foreground="?selectableItemBackground"
|
||||
app:cardBackgroundColor="?cardItemBackgroundColor"
|
||||
app:cardCornerRadius="2dp"
|
||||
app:cardElevation="2dp">
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
android:id="@+id/item_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:background="?selectableItemBackground"
|
||||
android:orientation="horizontal"
|
||||
android:padding="@dimen/element_spacing_normal">
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:background="?selectableItemBackground"
|
||||
android:orientation="horizontal"
|
||||
android:padding="@dimen/element_spacing_normal">
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/element_size_normal"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:background="?selectableItemBackground"
|
||||
android:gravity="center"
|
||||
android:text="@string/load_more"
|
||||
android:focusable="true"
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
android:id="@+id/item_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:background="?selectableItemBackground"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="false"
|
||||
android:orientation="vertical"
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ Twidere - Twitter client for Android
|
||||
~
|
||||
~ Copyright (C) 2012-2014 Mariotaku Lee <mariotaku.lee@gmail.com>
|
||||
|
@ -29,7 +28,7 @@
|
|||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:background="?selectableItemBackground"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="false"
|
||||
android:orientation="horizontal"
|
||||
|
@ -50,7 +49,7 @@
|
|||
android:scaleType="centerInside"
|
||||
android:visibility="gone"
|
||||
tools:src="@drawable/ic_activity_action_retweet"
|
||||
tools:visibility="visible"/>
|
||||
tools:visibility="visible" />
|
||||
|
||||
<org.mariotaku.twidere.view.ActionIconThemedTextView
|
||||
android:id="@+id/reply_retweet_status"
|
||||
|
@ -68,14 +67,14 @@
|
|||
android:textSize="10sp"
|
||||
android:visibility="gone"
|
||||
tools:text="Retweeted by Mariotaku"
|
||||
tools:visibility="visible"/>
|
||||
tools:visibility="visible" />
|
||||
|
||||
<Space
|
||||
android:id="@+id/profile_image_space"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/icon_size_status_profile_image"
|
||||
android:layout_alignRight="@id/profile_image"
|
||||
android:layout_below="@+id/reply_retweet_icon"/>
|
||||
android:layout_below="@+id/reply_retweet_icon" />
|
||||
|
||||
<org.mariotaku.twidere.view.ShapedImageView
|
||||
android:id="@+id/profile_image"
|
||||
|
@ -86,7 +85,7 @@
|
|||
android:layout_alignWithParentIfMissing="true"
|
||||
android:layout_below="@+id/reply_retweet_status"
|
||||
android:contentDescription="@string/profile_image"
|
||||
android:scaleType="centerCrop"/>
|
||||
android:scaleType="centerCrop" />
|
||||
|
||||
<org.mariotaku.twidere.view.BoundsImageView
|
||||
android:id="@+id/profile_type"
|
||||
|
@ -96,7 +95,7 @@
|
|||
android:layout_alignRight="@id/profile_image"
|
||||
android:layout_marginBottom="@dimen/element_spacing_minus_small"
|
||||
android:layout_marginRight="@dimen/element_spacing_minus_small"
|
||||
android:scaleType="fitCenter"/>
|
||||
android:scaleType="fitCenter" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/status_content"
|
||||
|
@ -131,7 +130,7 @@
|
|||
android:textAppearance="?android:textAppearanceSmall"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textStyle="bold"
|
||||
tools:text="User"/>
|
||||
tools:text="User" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/screen_name"
|
||||
|
@ -142,7 +141,7 @@
|
|||
android:textAppearance="?android:textAppearanceSmall"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
tools:text="\@username"
|
||||
tools:textSize="10sp"/>
|
||||
tools:textSize="10sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<org.mariotaku.twidere.view.ShortTimeView
|
||||
|
@ -151,7 +150,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0"
|
||||
android:textAppearance="?android:textAppearanceSmall"
|
||||
tools:textSize="10sp"/>
|
||||
tools:textSize="10sp" />
|
||||
|
||||
<org.mariotaku.twidere.view.ActionIconView
|
||||
android:id="@+id/extra_type"
|
||||
|
@ -159,7 +158,7 @@
|
|||
android:layout_height="@dimen/element_size_small"
|
||||
android:layout_weight="0"
|
||||
android:color="?android:textColorSecondary"
|
||||
tools:src="@drawable/ic_action_gallery"/>
|
||||
tools:src="@drawable/ic_action_gallery" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
@ -175,7 +174,7 @@
|
|||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:visibility="gone"
|
||||
tools:text="@string/sample_status_text"
|
||||
tools:visibility="visible"/>
|
||||
tools:visibility="visible" />
|
||||
|
||||
<org.mariotaku.twidere.view.ForegroundColorView
|
||||
android:id="@+id/quote_indicator"
|
||||
|
@ -186,7 +185,7 @@
|
|||
android:layout_marginRight="@dimen/element_spacing_normal"
|
||||
android:background="?android:dividerHorizontal"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"/>
|
||||
tools:visibility="visible" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/quoted_name_container"
|
||||
|
@ -207,7 +206,7 @@
|
|||
android:textAppearance="?android:textAppearanceSmall"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textStyle="bold"
|
||||
tools:text="User"/>
|
||||
tools:text="User" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/quoted_screen_name"
|
||||
|
@ -219,7 +218,7 @@
|
|||
android:textColor="?android:textColorSecondary"
|
||||
tools:ignore="SmallSp"
|
||||
tools:text="\@user"
|
||||
tools:textSize="10sp"/>
|
||||
tools:textSize="10sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<org.mariotaku.twidere.view.CardMediaContainer
|
||||
|
@ -245,7 +244,7 @@
|
|||
android:layout_toRightOf="@+id/quote_indicator"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
tools:text="@string/sample_status_text"/>
|
||||
tools:text="@string/sample_status_text" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
@ -275,7 +274,7 @@
|
|||
android:paddingRight="@dimen/element_spacing_normal"
|
||||
android:textAppearance="?android:textAppearanceSmall"
|
||||
app:iabActivatedColor="@color/highlight_reply"
|
||||
app:iabColor="?android:textColorTertiary"/>
|
||||
app:iabColor="?android:textColorTertiary" />
|
||||
|
||||
<org.mariotaku.twidere.view.ActionIconThemedTextView
|
||||
android:id="@+id/retweet_count"
|
||||
|
@ -290,7 +289,7 @@
|
|||
android:paddingRight="@dimen/element_spacing_normal"
|
||||
android:textAppearance="?android:textAppearanceSmall"
|
||||
app:iabActivatedColor="@color/highlight_retweet"
|
||||
app:iabColor="?android:textColorTertiary"/>
|
||||
app:iabColor="?android:textColorTertiary" />
|
||||
|
||||
<org.mariotaku.twidere.view.ActionIconThemedTextView
|
||||
android:id="@+id/favorite_count"
|
||||
|
@ -305,7 +304,7 @@
|
|||
android:paddingRight="@dimen/element_spacing_normal"
|
||||
android:textAppearance="?android:textAppearanceSmall"
|
||||
app:iabActivatedColor="@color/highlight_favorite"
|
||||
app:iabColor="?android:textColorTertiary"/>
|
||||
app:iabColor="?android:textColorTertiary" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
@ -320,7 +319,7 @@
|
|||
android:layout_marginTop="@dimen/element_spacing_minus_normal"
|
||||
android:color="?android:textColorTertiary"
|
||||
android:focusable="false"
|
||||
android:src="@drawable/ic_action_more_horizontal"/>
|
||||
android:src="@drawable/ic_action_more_horizontal" />
|
||||
|
||||
</RelativeLayout>
|
||||
</org.mariotaku.twidere.view.ColorLabelFrameLayout>
|
|
@ -37,7 +37,7 @@
|
|||
android:id="@+id/item_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:background="?selectableItemBackground"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="false"
|
||||
android:orientation="vertical"
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="@dimen/element_spacing_small"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:background="?selectableItemBackground"
|
||||
android:paddingLeft="@dimen/element_spacing_normal"
|
||||
android:paddingRight="@dimen/element_spacing_normal"
|
||||
android:paddingTop="@dimen/element_spacing_small"
|
||||
|
|
|
@ -19,10 +19,11 @@
|
|||
-->
|
||||
|
||||
<ListView
|
||||
android:id="@android:id/list"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@android:id/list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:focusable="true"
|
||||
android:listSelector="?selectableItemBackground"
|
||||
tools:context=".fragment.support.AccountsDashboardFragment"/>
|
||||
|
|
|
@ -19,9 +19,9 @@
|
|||
-->
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/fragment_content"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/fragment_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".fragment.DirectMessagesConversationFragment">
|
||||
|
@ -53,16 +53,17 @@
|
|||
android:id="@+id/input_send_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0"
|
||||
android:gravity="bottom"
|
||||
android:orientation="horizontal"
|
||||
android:layout_weight="0">
|
||||
android:orientation="horizontal">
|
||||
|
||||
<org.mariotaku.twidere.view.ActionIconView
|
||||
android:id="@+id/add_image"
|
||||
style="?android:borderlessButtonStyle"
|
||||
android:layout_width="?android:actionBarSize"
|
||||
android:layout_height="?android:actionBarSize"
|
||||
android:layout_weight="0"
|
||||
android:background="?selectableItemBackgroundBorderless"
|
||||
android:clickable="true"
|
||||
android:color="?android:textColorSecondary"
|
||||
android:contentDescription="@string/add_image"
|
||||
android:padding="0dp"
|
||||
|
@ -88,10 +89,11 @@
|
|||
|
||||
<FrameLayout
|
||||
android:id="@+id/send"
|
||||
style="?android:borderlessButtonStyle"
|
||||
android:layout_width="?android:actionBarSize"
|
||||
android:layout_height="?android:actionBarSize"
|
||||
android:layout_weight="0"
|
||||
android:background="?selectableItemBackgroundBorderless"
|
||||
android:clickable="true"
|
||||
android:padding="0dp">
|
||||
|
||||
<org.mariotaku.twidere.view.ActionIconView
|
||||
|
|
|
@ -73,7 +73,7 @@
|
|||
android:layout_width="@dimen/element_size_normal"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="0"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:background="?selectableItemBackground"
|
||||
android:contentDescription="@string/customize"
|
||||
android:src="@drawable/ic_action_settings"
|
||||
android:text="@string/notifications"/>
|
||||
|
|
|
@ -62,7 +62,7 @@
|
|||
android:id="@+id/exit_wizard"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:background="?selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:padding="@dimen/element_spacing_large">
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:focusable="false"
|
||||
android:foreground="?android:selectableItemBackground">
|
||||
android:foreground="?selectableItemBackground">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:background="?selectableItemBackground"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="false"
|
||||
android:orientation="vertical"
|
||||
|
@ -35,7 +35,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/element_spacing_minus_normal"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:background="?selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:paddingLeft="@dimen/element_spacing_small"
|
||||
android:paddingRight="@dimen/element_spacing_small"
|
||||
|
@ -63,7 +63,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/retweeted_by_container"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:background="?selectableItemBackground"
|
||||
android:padding="@dimen/element_spacing_small"
|
||||
app:ignorePadding="true">
|
||||
|
||||
|
@ -257,7 +257,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/action_button_size"
|
||||
android:layout_gravity="center"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:background="?selectableItemBackground"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
android:visibility="gone"
|
||||
|
@ -302,7 +302,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/twitter_card"
|
||||
android:layout_toRightOf="@+id/quote_indicator"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:background="?selectableItemBackground"
|
||||
android:drawableLeft="@drawable/ic_indicator_location"
|
||||
android:drawablePadding="4dp"
|
||||
android:gravity="center_vertical"
|
||||
|
@ -327,7 +327,7 @@
|
|||
android:id="@+id/replies_container"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:background="?selectableItemBackground"
|
||||
android:baselineAligned="true"
|
||||
android:clickable="true"
|
||||
android:gravity="center"
|
||||
|
@ -357,7 +357,7 @@
|
|||
android:id="@+id/retweets_container"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:background="?selectableItemBackground"
|
||||
android:baselineAligned="true"
|
||||
android:clickable="true"
|
||||
android:gravity="center"
|
||||
|
@ -387,7 +387,7 @@
|
|||
android:id="@+id/favorites_container"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:background="?selectableItemBackground"
|
||||
android:baselineAligned="true"
|
||||
android:clickable="true"
|
||||
android:gravity="center"
|
||||
|
|
|
@ -131,7 +131,7 @@
|
|||
android:id="@+id/description_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:background="?selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:orientation="vertical"
|
||||
android:padding="@dimen/element_spacing_small">
|
||||
|
@ -163,7 +163,7 @@
|
|||
android:id="@+id/location_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:background="?selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
|
@ -191,7 +191,7 @@
|
|||
android:id="@+id/url_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:background="?selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
|
@ -220,7 +220,7 @@
|
|||
android:id="@+id/created_at_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:background="?selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
|
@ -263,7 +263,7 @@
|
|||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:background="?selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
|
@ -292,7 +292,7 @@
|
|||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:background="?selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
|
@ -321,7 +321,7 @@
|
|||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:background="?selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
android:layout_width="@dimen/element_size_small"
|
||||
android:layout_height="@dimen/element_size_small"
|
||||
android:layout_weight="0"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:background="?selectableItemBackground"
|
||||
android:src="@drawable/ic_action_info"/>
|
||||
</LinearLayout>
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
android:id="@+id/media_preview_item_0"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:foreground="?android:selectableItemBackground">
|
||||
android:foreground="?selectableItemBackground">
|
||||
|
||||
<include layout="@layout/layout_card_media_preview_item"/>
|
||||
</FrameLayout>
|
||||
|
@ -38,7 +38,7 @@
|
|||
android:id="@+id/media_preview_item_1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:foreground="?android:selectableItemBackground">
|
||||
android:foreground="?selectableItemBackground">
|
||||
|
||||
<include layout="@layout/layout_card_media_preview_item"/>
|
||||
</FrameLayout>
|
||||
|
@ -47,7 +47,7 @@
|
|||
android:id="@+id/media_preview_item_2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:foreground="?android:selectableItemBackground">
|
||||
android:foreground="?selectableItemBackground">
|
||||
|
||||
<include layout="@layout/layout_card_media_preview_item"/>
|
||||
</FrameLayout>
|
||||
|
@ -56,7 +56,7 @@
|
|||
android:id="@+id/media_preview_item_3"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:foreground="?android:selectableItemBackground">
|
||||
android:foreground="?selectableItemBackground">
|
||||
|
||||
<include layout="@layout/layout_card_media_preview_item"/>
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?android:selectableItemBackground">
|
||||
android:background="?selectableItemBackground">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/tab_content"
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:background="?selectableItemBackground"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:padding="@dimen/element_spacing_normal">
|
||||
|
@ -67,7 +67,7 @@
|
|||
android:layout_height="@dimen/icon_size_card_details"
|
||||
android:layout_weight="0"
|
||||
android:contentDescription="@string/profile_image"
|
||||
android:foreground="?android:selectableItemBackground"
|
||||
android:foreground="?selectableItemBackground"
|
||||
android:scaleType="fitCenter"/>
|
||||
</LinearLayout>
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:background="?selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:descendantFocusability="blocksDescendants"
|
||||
android:gravity="center_vertical"
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:background="?selectableItemBackground"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="false"
|
||||
android:minHeight="?android:listPreferredItemHeight"
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
android:id="@+id/settings"
|
||||
android:layout_width="@dimen/element_size_normal"
|
||||
android:layout_height="@dimen/element_size_normal"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:background="?selectableItemBackground"
|
||||
android:src="@drawable/ic_action_settings"/>
|
||||
|
||||
|
||||
|
|
|
@ -2,12 +2,12 @@
|
|||
<resources>
|
||||
|
||||
<style name="Widget.CardActionButton" parent="Widget.Base.ImageButton">
|
||||
<item name="android:background">?android:selectableItemBackgroundBorderless</item>
|
||||
<item name="android:background">?selectableItemBackgroundBorderless</item>
|
||||
<item name="android:color">?android:textColorSecondary</item>
|
||||
</style>
|
||||
|
||||
<style name="Widget.Light.CardActionButton" parent="Widget.Base.ImageButton">
|
||||
<item name="android:background">?android:selectableItemBackgroundBorderless</item>
|
||||
<item name="android:background">?selectableItemBackgroundBorderless</item>
|
||||
<item name="android:color">?android:textColorSecondary</item>
|
||||
</style>
|
||||
|
||||
|
|
|
@ -16,12 +16,12 @@
|
|||
</style>
|
||||
|
||||
<style name="Widget.CardActionButton" parent="Widget.Base.ImageButton">
|
||||
<item name="android:background">?android:selectableItemBackground</item>
|
||||
<item name="android:background">?selectableItemBackground</item>
|
||||
<item name="android:color">?android:textColorSecondary</item>
|
||||
</style>
|
||||
|
||||
<style name="Widget.Light.CardActionButton" parent="Widget.Base.Light.ImageButton">
|
||||
<item name="android:background">?android:selectableItemBackground</item>
|
||||
<item name="android:background">?selectableItemBackground</item>
|
||||
<item name="android:color">?android:textColorSecondary</item>
|
||||
</style>
|
||||
|
||||
|
|
Loading…
Reference in New Issue