1
0
mirror of https://github.com/TwidereProject/Twidere-Android synced 2025-02-14 10:40:46 +01:00

improved theme

finding a library for colored widgets
This commit is contained in:
Mariotaku Lee 2015-04-22 22:19:26 +08:00
parent c09259f30e
commit 16baa2c966
68 changed files with 537 additions and 1517 deletions

View File

@ -87,8 +87,8 @@ public class OpenStreetMapViewerActivity extends ThemedAppCompatActivity impleme
} }
@Override @Override
public void onSupportContentChanged() { public void onContentChanged() {
super.onSupportContentChanged(); super.onContentChanged();
mMapView = (MapView) findViewById(R.id.map_view); mMapView = (MapView) findViewById(R.id.map_view);
} }

View File

@ -196,6 +196,7 @@
<activity <activity
android:name=".activity.support.SignInActivity" android:name=".activity.support.SignInActivity"
android:label="@string/sign_in" android:label="@string/sign_in"
android:theme="@style/Theme.Twidere.Dark"
android:windowSoftInputMode="adjustResize"> android:windowSoftInputMode="adjustResize">
<intent-filter> <intent-filter>
<action android:name="org.mariotaku.twidere.TWITTER_LOGIN"/> <action android:name="org.mariotaku.twidere.TWITTER_LOGIN"/>

View File

@ -0,0 +1,94 @@
/*
* 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 android.support.v7.app;
import android.app.Activity;
import android.content.Context;
import android.os.Build;
import android.support.v4.view.LayoutInflaterCompat;
import android.support.v4.view.LayoutInflaterFactory;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.Window;
import org.mariotaku.twidere.Constants;
import org.mariotaku.twidere.activity.iface.IThemedActivity;
import org.mariotaku.twidere.util.ThemeUtils;
/**
* Created by mariotaku on 15/4/22.
*/
public class ThemedAppCompatDelegate implements Constants {
/**
* Create a {@link android.support.v7.app.AppCompatDelegate} to use with {@code activity}.
*
* @param callback An optional callback for AppCompat specific events
*/
public static AppCompatDelegate create(IThemedActivity themed, AppCompatCallback callback) {
final Activity activity = (Activity) themed;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
return new ThemedAppCompatDelegateImplV11(themed, activity, activity.getWindow(), callback);
} else {
throw new UnsupportedOperationException();
}
}
private static class ThemedAppCompatDelegateImplV11 extends AppCompatDelegateImplV11 {
private final IThemedActivity themed;
private ThemedAppCompatDelegateImplV11(IThemedActivity themed, Context context, Window window, AppCompatCallback callback) {
super(context, window, callback);
this.themed = themed;
}
@Override
public void installViewFactory() {
final LayoutInflater inflater = LayoutInflater.from(mContext);
if (inflater.getFactory() == null) {
LayoutInflaterCompat.setFactory(inflater, new ThemedLayoutInflaterFactory(themed, this));
}
}
}
/**
* 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.getCurrentThemeColor(), activity.getCurrentProfileImageStyle());
return createdView;
}
}
}

View File

@ -22,7 +22,9 @@ import android.support.annotation.LayoutRes;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.v7.app.ActionBar; import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatCallback;
import android.support.v7.app.AppCompatDelegate; import android.support.v7.app.AppCompatDelegate;
import android.support.v7.view.ActionMode;
import android.support.v7.widget.Toolbar; import android.support.v7.widget.Toolbar;
import android.view.MenuInflater; import android.view.MenuInflater;
import android.view.View; import android.view.View;
@ -35,13 +37,37 @@ import android.view.ViewGroup;
* This technique can be used with an {@link android.app.Activity} class, not just * This technique can be used with an {@link android.app.Activity} class, not just
* {@link android.preference.PreferenceActivity}. * {@link android.preference.PreferenceActivity}.
*/ */
public abstract class AppCompatPreferenceActivity extends PreferenceActivity { public abstract class AppCompatPreferenceActivity extends PreferenceActivity implements AppCompatCallback {
private AppCompatDelegate mDelegate; private AppCompatDelegate mDelegate;
public ActionBar getSupportActionBar() { public ActionBar getSupportActionBar() {
return getDelegate().getSupportActionBar(); return getDelegate().getSupportActionBar();
} }
/**
* Notifies the Activity that a support action mode has been started.
* Activity subclasses overriding this method should call the superclass implementation.
*
* @param mode The new action mode.
*/
@Override
public void onSupportActionModeStarted(ActionMode mode) {
}
/**
* Notifies the activity that a support action mode has finished.
* Activity subclasses overriding this method should call the superclass implementation.
*
* @param mode The action mode that just finished.
*/
@Override
public void onSupportActionModeFinished(ActionMode mode) {
}
public ActionMode startSupportActionMode(ActionMode.Callback callback) {
return getDelegate().startSupportActionMode(callback);
}
public void setSupportActionBar(@Nullable Toolbar toolbar) { public void setSupportActionBar(@Nullable Toolbar toolbar) {
getDelegate().setSupportActionBar(toolbar); getDelegate().setSupportActionBar(toolbar);
} }
@ -126,7 +152,7 @@ public abstract class AppCompatPreferenceActivity extends PreferenceActivity {
private AppCompatDelegate getDelegate() { private AppCompatDelegate getDelegate() {
if (mDelegate == null) { if (mDelegate == null) {
mDelegate = AppCompatDelegate.create(this, null); mDelegate = AppCompatDelegate.create(this, this);
} }
return mDelegate; return mDelegate;
} }

View File

@ -19,41 +19,46 @@
package org.mariotaku.twidere.activity; package org.mariotaku.twidere.activity;
import android.annotation.SuppressLint;
import android.content.Context; import android.content.Context;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.LayoutRes;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.v4.view.WindowCompat;
import android.support.v7.app.ActionBar;
import android.support.v7.widget.ActionMenuView;
import android.support.v7.widget.Toolbar;
import android.text.SpannableStringBuilder; import android.text.SpannableStringBuilder;
import android.text.Spanned; import android.text.Spanned;
import android.text.style.ForegroundColorSpan; import android.text.style.ForegroundColorSpan;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.view.Menu;
import android.view.View; import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager.LayoutParams;
import android.widget.FrameLayout;
import org.mariotaku.twidere.Constants; import org.mariotaku.twidere.Constants;
import org.mariotaku.twidere.R;
import org.mariotaku.twidere.activity.iface.IThemedActivity; import org.mariotaku.twidere.activity.iface.IThemedActivity;
import org.mariotaku.twidere.util.StrictModeUtils; import org.mariotaku.twidere.util.StrictModeUtils;
import org.mariotaku.twidere.util.ThemeUtils; import org.mariotaku.twidere.util.ThemeUtils;
import org.mariotaku.twidere.util.Utils; import org.mariotaku.twidere.util.Utils;
import org.mariotaku.twidere.view.ShapedImageView; import org.mariotaku.twidere.util.ViewUtils;
import org.mariotaku.twidere.view.ShapedImageView.ShapeStyle; import org.mariotaku.twidere.view.ShapedImageView.ShapeStyle;
import org.mariotaku.twidere.view.TintedStatusFrameLayout;
public abstract class BasePreferenceActivity extends AppCompatPreferenceActivity implements Constants, public abstract class BasePreferenceActivity extends AppCompatPreferenceActivity implements Constants,
IThemedActivity { IThemedActivity {
private TintedStatusFrameLayout mMainContent;
private int mCurrentThemeResource, mCurrentThemeColor, mCurrentThemeBackgroundAlpha; private int mCurrentThemeResource, mCurrentThemeColor, mCurrentThemeBackgroundAlpha;
@ShapeStyle @ShapeStyle
private int mProfileImageStyle; private int mProfileImageStyle;
private String mCurrentThemeBackgroundOption; private String mCurrentThemeBackgroundOption;
@Override
public final int getCurrentThemeResourceId() {
return mCurrentThemeResource;
}
@Override
public int getThemeBackgroundAlpha() {
return ThemeUtils.getUserThemeBackgroundAlpha(this);
}
@Override @Override
public int getCurrentThemeBackgroundAlpha() { public int getCurrentThemeBackgroundAlpha() {
return mCurrentThemeBackgroundAlpha; return mCurrentThemeBackgroundAlpha;
@ -65,13 +70,23 @@ public abstract class BasePreferenceActivity extends AppCompatPreferenceActivity
} }
@Override @Override
public String getThemeBackgroundOption() { public int getCurrentThemeColor() {
return ThemeUtils.getThemeBackgroundOption(this); return mCurrentThemeColor;
} }
@Override @Override
public int getCurrentThemeColor() { public final int getCurrentThemeResourceId() {
return mCurrentThemeColor; return mCurrentThemeResource;
}
@Override
public int getThemeBackgroundAlpha() {
return ThemeUtils.getUserThemeBackgroundAlpha(this);
}
@Override
public String getThemeBackgroundOption() {
return ThemeUtils.getThemeBackgroundOption(this);
} }
@Override @Override
@ -79,11 +94,30 @@ public abstract class BasePreferenceActivity extends AppCompatPreferenceActivity
return ThemeUtils.getThemeFontFamily(this); return ThemeUtils.getThemeFontFamily(this);
} }
@Override
public int getCurrentProfileImageStyle() {
return mProfileImageStyle;
}
@Override @Override
public final void restart() { public final void restart() {
Utils.restartActivity(this); Utils.restartActivity(this);
} }
@Override
public void onContentChanged() {
super.onContentChanged();
mMainContent = (TintedStatusFrameLayout) findViewById(R.id.main_content);
setupTintStatusBar();
}
@Override
public void onSupportActionModeStarted(android.support.v7.view.ActionMode mode) {
super.onSupportActionModeStarted(mode);
ThemeUtils.applySupportActionModeColor(mode, this, getCurrentThemeResourceId(),
getCurrentThemeColor(), getThemeBackgroundOption(), true);
}
@Override @Override
protected void onCreate(final Bundle savedInstanceState) { protected void onCreate(final Bundle savedInstanceState) {
if (Utils.isDebugBuild()) { if (Utils.isDebugBuild()) {
@ -91,28 +125,44 @@ public abstract class BasePreferenceActivity extends AppCompatPreferenceActivity
StrictModeUtils.detectAllThreadPolicy(); StrictModeUtils.detectAllThreadPolicy();
} }
setTheme(); setTheme();
setupWindow();
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setupActionBar();
} }
@Override @Override
public View onCreateView(String name, @NonNull Context context, @NonNull AttributeSet attrs) { public void setContentView(@LayoutRes int layoutResID) {
final View view = ThemeUtils.createView(name, context, attrs, mCurrentThemeColor); final FrameLayout mainContent = initMainContent();
if (view instanceof ShapedImageView) { getLayoutInflater().inflate(layoutResID, mainContent, true);
final ShapedImageView shapedImageView = (ShapedImageView) view; super.setContentView(mainContent);
shapedImageView.setStyle(mProfileImageStyle); }
@Override
public void setContentView(View view) {
final FrameLayout mainContent = initMainContent();
mainContent.removeAllViews();
mainContent.addView(view);
super.setContentView(mainContent);
}
@Override
public void setContentView(View view, ViewGroup.LayoutParams params) {
final FrameLayout mainContent = initMainContent();
mainContent.removeAllViews();
mainContent.addView(view, params);
super.setContentView(mainContent);
}
@Override
public void addContentView(View view, ViewGroup.LayoutParams params) {
FrameLayout mainContent = (FrameLayout) findViewById(R.id.main_content);
if (mainContent == null) {
@SuppressLint("InflateParams")
final View mainLayout = getLayoutInflater().inflate(R.layout.activity_settings, null);
mainContent = (FrameLayout) mainLayout.findViewById(R.id.main_content);
} }
if (view != null) return view; mainContent.addView(view, params);
return super.onCreateView(name, context, attrs); onContentChanged();
}
@Override
protected void onResume() {
super.onResume();
}
@Override
protected void onStart() {
super.onStart();
} }
@Override @Override
@ -127,6 +177,58 @@ public abstract class BasePreferenceActivity extends AppCompatPreferenceActivity
super.onTitleChanged(title, color); super.onTitleChanged(title, color);
} }
protected boolean isActionBarOutlineEnabled() {
return true;
}
@Override
protected void onStart() {
super.onStart();
}
@Override
protected void onResume() {
super.onResume();
}
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
final boolean result = super.onPrepareOptionsMenu(menu);
if (!shouldSetActionItemColor()) return result;
final View actionBarView = getWindow().findViewById(android.support.v7.appcompat.R.id.action_bar);
if (actionBarView instanceof Toolbar) {
final int themeColor = getCurrentThemeColor();
final int themeId = getCurrentThemeResourceId();
final int itemColor = ThemeUtils.getContrastActionBarItemColor(this, themeId, themeColor);
final Toolbar toolbar = (Toolbar) actionBarView;
ThemeUtils.setActionBarOverflowColor(toolbar, itemColor);
final int popupColor = ThemeUtils.getThemeForegroundColor(toolbar.getContext(), toolbar.getPopupTheme());
ThemeUtils.wrapToolbarMenuIcon(ViewUtils.findViewByType(actionBarView, ActionMenuView.class), itemColor, popupColor);
}
return result;
}
@Override
public View onCreateView(String name, @NonNull Context context, @NonNull AttributeSet attrs) {
final View view = super.onCreateView(name, context, attrs);
ThemeUtils.initView(view, getCurrentThemeColor(), mProfileImageStyle);
return view;
}
protected boolean shouldSetActionItemColor() {
return true;
}
private FrameLayout initMainContent() {
final FrameLayout mainContent = (FrameLayout) findViewById(R.id.main_content);
if (mainContent != null) {
return mainContent;
}
@SuppressLint("InflateParams")
final View view = getLayoutInflater().inflate(R.layout.activity_settings, null);
return (FrameLayout) view.findViewById(R.id.main_content);
}
private void setTheme() { private void setTheme() {
mCurrentThemeResource = getThemeResourceId(); mCurrentThemeResource = getThemeResourceId();
mCurrentThemeColor = getThemeColor(); mCurrentThemeColor = getThemeColor();
@ -137,4 +239,41 @@ public abstract class BasePreferenceActivity extends AppCompatPreferenceActivity
ThemeUtils.applyWindowBackground(this, getWindow(), mCurrentThemeResource, mCurrentThemeBackgroundOption, mCurrentThemeBackgroundAlpha); ThemeUtils.applyWindowBackground(this, getWindow(), mCurrentThemeResource, mCurrentThemeBackgroundOption, mCurrentThemeBackgroundAlpha);
} }
private void setupActionBar() {
final ActionBar actionBar = getSupportActionBar();
if (actionBar == null) return;
final int themeColor = getCurrentThemeColor();
final int themeId = getCurrentThemeResourceId();
final String option = getThemeBackgroundOption();
final int actionBarItemsColor = ThemeUtils.getContrastActionBarItemColor(this, themeId, themeColor);
ThemeUtils.applyActionBarBackground(actionBar, this, themeId, themeColor, option, isActionBarOutlineEnabled());
ThemeUtils.setActionBarItemsColor(getWindow(), actionBar, actionBarItemsColor);
}
private void setupTintStatusBar() {
if (mMainContent == null) return;
final int color = getCurrentThemeColor();
final int alpha = ThemeUtils.isTransparentBackground(getThemeBackgroundOption()) ? getCurrentThemeBackgroundAlpha() : 0xFF;
if (ThemeUtils.isDarkTheme(getCurrentThemeResourceId())) {
mMainContent.setColor(getResources().getColor(R.color.background_color_action_bar_dark), alpha);
} else {
mMainContent.setColor(color, alpha);
}
mMainContent.setDrawShadow(false);
mMainContent.setDrawColor(true);
mMainContent.setFactor(1);
}
private void setupWindow() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
getWindow().addFlags(LayoutParams.FLAG_TRANSLUCENT_STATUS);
}
supportRequestWindowFeature(WindowCompat.FEATURE_ACTION_BAR);
supportRequestWindowFeature(WindowCompat.FEATURE_ACTION_BAR_OVERLAY);
supportRequestWindowFeature(WindowCompat.FEATURE_ACTION_MODE_OVERLAY);
}
} }

View File

@ -35,17 +35,18 @@ public abstract class BaseThemedActivity extends Activity implements IThemedActi
private int mCurrentThemeBackgroundAlpha; private int mCurrentThemeBackgroundAlpha;
private String mCurrentThemeFontFamily; private String mCurrentThemeFontFamily;
private String mCurrentThemeBackgroundOption; private String mCurrentThemeBackgroundOption;
private int mProfileImageStyle;
@Override
public String getCurrentThemeBackgroundOption() {
return mCurrentThemeBackgroundOption;
}
@Override @Override
public int getCurrentThemeBackgroundAlpha() { public int getCurrentThemeBackgroundAlpha() {
return mCurrentThemeBackgroundAlpha; return mCurrentThemeBackgroundAlpha;
} }
@Override
public String getCurrentThemeBackgroundOption() {
return mCurrentThemeBackgroundOption;
}
@Override @Override
public int getCurrentThemeColor() { public int getCurrentThemeColor() {
return mCurrentThemeColor; return mCurrentThemeColor;
@ -72,6 +73,11 @@ public abstract class BaseThemedActivity extends Activity implements IThemedActi
@Override @Override
public abstract int getThemeResourceId(); public abstract int getThemeResourceId();
@Override
public int getCurrentProfileImageStyle() {
return mProfileImageStyle;
}
@Override @Override
public final void restart() { public final void restart() {
Utils.restartActivity(this); Utils.restartActivity(this);
@ -112,6 +118,7 @@ public abstract class BaseThemedActivity extends Activity implements IThemedActi
mCurrentThemeFontFamily = getThemeFontFamily(); mCurrentThemeFontFamily = getThemeFontFamily();
mCurrentThemeBackgroundAlpha = getThemeBackgroundAlpha(); mCurrentThemeBackgroundAlpha = getThemeBackgroundAlpha();
mCurrentThemeBackgroundOption = getThemeBackgroundOption(); mCurrentThemeBackgroundOption = getThemeBackgroundOption();
mProfileImageStyle = Utils.getProfileImageStyle(this);
setTheme(mCurrentThemeResource); setTheme(mCurrentThemeResource);
ThemeUtils.applyWindowBackground(this, getWindow(), mCurrentThemeResource, mCurrentThemeBackgroundOption, mCurrentThemeBackgroundAlpha); ThemeUtils.applyWindowBackground(this, getWindow(), mCurrentThemeResource, mCurrentThemeBackgroundOption, mCurrentThemeBackgroundAlpha);
} }

View File

@ -87,8 +87,8 @@ public class FiltersActivity extends BaseDialogWhenLargeActivity {
} }
@Override @Override
public void onSupportContentChanged() { public void onContentChanged() {
super.onSupportContentChanged(); super.onContentChanged();
mViewPager = (ViewPager) findViewById(R.id.view_pager); mViewPager = (ViewPager) findViewById(R.id.view_pager);
mPagerIndicator = (TabPagerIndicator) findViewById(R.id.view_pager_tabs); mPagerIndicator = (TabPagerIndicator) findViewById(R.id.view_pager_tabs);
} }

View File

@ -39,6 +39,8 @@ public interface IThemedActivity {
int getThemeResourceId(); int getThemeResourceId();
int getCurrentProfileImageStyle();
void restart(); void restart();
} }

View File

@ -70,8 +70,8 @@ public class BaseDialogWhenLargeActivity extends BaseAppCompatActivity {
} }
@Override @Override
public void onSupportContentChanged() { public void onContentChanged() {
super.onSupportContentChanged(); super.onContentChanged();
mMainContent = (TintedStatusFrameLayout) findViewById(R.id.main_content); mMainContent = (TintedStatusFrameLayout) findViewById(R.id.main_content);
setupTintStatusBar(); setupTintStatusBar();
} }

View File

@ -242,8 +242,8 @@ public class DraftsActivity extends BaseDialogWhenLargeActivity implements Loade
} }
@Override @Override
public void onSupportContentChanged() { public void onContentChanged() {
super.onSupportContentChanged(); super.onContentChanged();
mListView = (ListView) findViewById(android.R.id.list); mListView = (ListView) findViewById(android.R.id.list);
mEmptyView = findViewById(android.R.id.empty); mEmptyView = findViewById(android.R.id.empty);
mEmptyText = (TextView) findViewById(R.id.empty_text); mEmptyText = (TextView) findViewById(R.id.empty_text);

View File

@ -660,8 +660,8 @@ public class HomeActivity extends BaseAppCompatActivity implements OnClickListen
} }
@Override @Override
public void onSupportContentChanged() { public void onContentChanged() {
super.onSupportContentChanged(); super.onContentChanged();
mActionBar = (Toolbar) findViewById(R.id.actionbar); mActionBar = (Toolbar) findViewById(R.id.actionbar);
mTabIndicator = (TabPagerIndicator) findViewById(R.id.main_tabs); mTabIndicator = (TabPagerIndicator) findViewById(R.id.main_tabs);
mSlidingMenu = (HomeSlidingMenu) findViewById(R.id.home_menu); mSlidingMenu = (HomeSlidingMenu) findViewById(R.id.home_menu);

View File

@ -200,8 +200,8 @@ public class LinkHandlerActivity extends BaseAppCompatActivity implements System
} }
@Override @Override
public void onSupportContentChanged() { public void onContentChanged() {
super.onSupportContentChanged(); super.onContentChanged();
mMainContent = (TintedStatusFrameLayout) findViewById(R.id.main_content); mMainContent = (TintedStatusFrameLayout) findViewById(R.id.main_content);
} }

View File

@ -140,8 +140,8 @@ public final class MediaViewerActivity extends ThemedAppCompatActivity implement
} }
@Override @Override
public void onSupportContentChanged() { public void onContentChanged() {
super.onSupportContentChanged(); super.onContentChanged();
mViewPager = (ViewPager) findViewById(R.id.view_pager); mViewPager = (ViewPager) findViewById(R.id.view_pager);
mIndicator = (LinePageIndicator) findViewById(R.id.pager_indicator); mIndicator = (LinePageIndicator) findViewById(R.id.pager_indicator);
mMediaStatusContainer = findViewById(R.id.media_status_container); mMediaStatusContainer = findViewById(R.id.media_status_container);

View File

@ -48,7 +48,6 @@ import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.view.View.OnClickListener; import android.view.View.OnClickListener;
import android.view.Window;
import android.widget.Button; import android.widget.Button;
import android.widget.EditText; import android.widget.EditText;
import android.widget.LinearLayout; import android.widget.LinearLayout;
@ -104,12 +103,11 @@ public class SignInActivity extends BaseAppCompatActivity implements TwitterCons
private int mAuthType; private int mAuthType;
private String mConsumerKey, mConsumerSecret; private String mConsumerKey, mConsumerSecret;
private String mUsername, mPassword; private String mUsername, mPassword;
private boolean mBackPressed;
private long mAPIChangeTimestamp; private long mAPIChangeTimestamp;
private EditText mEditUsername, mEditPassword; private EditText mEditUsername, mEditPassword;
private Button mSignInButton, mSignUpButton; private Button mSignInButton, mSignUpButton;
private LinearLayout mSigninSignupContainer, mUsernamePasswordContainer; private LinearLayout mSignInSignUpContainer, mUsernamePasswordContainer;
private TwidereApplication mApplication; private TwidereApplication mApplication;
private SharedPreferences mPreferences; private SharedPreferences mPreferences;
@ -140,8 +138,7 @@ public class SignInActivity extends BaseAppCompatActivity implements TwitterCons
mConsumerSecret = data.getStringExtra(Accounts.CONSUMER_SECRET); mConsumerSecret = data.getStringExtra(Accounts.CONSUMER_SECRET);
final boolean isTwipOMode = mAuthType == Accounts.AUTH_TYPE_TWIP_O_MODE; final boolean isTwipOMode = mAuthType == Accounts.AUTH_TYPE_TWIP_O_MODE;
mUsernamePasswordContainer.setVisibility(isTwipOMode ? View.GONE : View.VISIBLE); mUsernamePasswordContainer.setVisibility(isTwipOMode ? View.GONE : View.VISIBLE);
mSigninSignupContainer mSignInSignUpContainer.setOrientation(isTwipOMode ? LinearLayout.VERTICAL : LinearLayout.HORIZONTAL);
.setOrientation(isTwipOMode ? LinearLayout.VERTICAL : LinearLayout.HORIZONTAL);
} }
setSignInButton(); setSignInButton();
invalidateOptionsMenu(); invalidateOptionsMenu();
@ -157,19 +154,6 @@ public class SignInActivity extends BaseAppCompatActivity implements TwitterCons
super.onActivityResult(requestCode, resultCode, data); super.onActivityResult(requestCode, resultCode, data);
} }
@Override
public void onBackPressed() {
if (mTask != null && mTask.getStatus() == AsyncTask.Status.RUNNING && !mBackPressed) {
final Toast toast = Toast.makeText(this, R.string.signing_in_please_wait, Toast.LENGTH_SHORT);
toast.show();
return;
}
if (mTask != null && mTask.getStatus() == AsyncTask.Status.RUNNING) {
mTask.cancel(false);
}
super.onBackPressed();
}
@Override @Override
public void onClick(final View v) { public void onClick(final View v) {
switch (v.getId()) { switch (v.getId()) {
@ -192,13 +176,13 @@ public class SignInActivity extends BaseAppCompatActivity implements TwitterCons
} }
@Override @Override
public void onSupportContentChanged() { public void onContentChanged() {
super.onSupportContentChanged(); super.onContentChanged();
mEditUsername = (EditText) findViewById(R.id.username); mEditUsername = (EditText) findViewById(R.id.username);
mEditPassword = (EditText) findViewById(R.id.password); mEditPassword = (EditText) findViewById(R.id.password);
mSignInButton = (Button) findViewById(R.id.sign_in); mSignInButton = (Button) findViewById(R.id.sign_in);
mSignUpButton = (Button) findViewById(R.id.sign_up); mSignUpButton = (Button) findViewById(R.id.sign_up);
mSigninSignupContainer = (LinearLayout) findViewById(R.id.sign_in_sign_up); mSignInSignUpContainer = (LinearLayout) findViewById(R.id.sign_in_sign_up);
mUsernamePasswordContainer = (LinearLayout) findViewById(R.id.username_password); mUsernamePasswordContainer = (LinearLayout) findViewById(R.id.username_password);
} }
@ -293,14 +277,12 @@ public class SignInActivity extends BaseAppCompatActivity implements TwitterCons
@Override @Override
protected void onCreate(final Bundle savedInstanceState) { protected void onCreate(final Bundle savedInstanceState) {
supportRequestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
supportRequestWindowFeature(WindowCompat.FEATURE_ACTION_BAR); supportRequestWindowFeature(WindowCompat.FEATURE_ACTION_BAR);
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
mPreferences = getSharedPreferences(SHARED_PREFERENCES_NAME, MODE_PRIVATE); mPreferences = getSharedPreferences(SHARED_PREFERENCES_NAME, MODE_PRIVATE);
mResolver = getContentResolver(); mResolver = getContentResolver();
mApplication = TwidereApplication.getInstance(this); mApplication = TwidereApplication.getInstance(this);
setContentView(R.layout.activity_sign_in); setContentView(R.layout.activity_sign_in);
setSupportProgressBarIndeterminateVisibility(false);
final long[] account_ids = getActivatedAccountIds(this); final long[] account_ids = getActivatedAccountIds(this);
final ActionBar actionBar = getSupportActionBar(); final ActionBar actionBar = getSupportActionBar();
if (actionBar != null) { if (actionBar != null) {
@ -320,7 +302,7 @@ public class SignInActivity extends BaseAppCompatActivity implements TwitterCons
mUsernamePasswordContainer mUsernamePasswordContainer
.setVisibility(mAuthType == Accounts.AUTH_TYPE_TWIP_O_MODE ? View.GONE : View.VISIBLE); .setVisibility(mAuthType == Accounts.AUTH_TYPE_TWIP_O_MODE ? View.GONE : View.VISIBLE);
mSigninSignupContainer.setOrientation(mAuthType == Accounts.AUTH_TYPE_TWIP_O_MODE ? LinearLayout.VERTICAL mSignInSignUpContainer.setOrientation(mAuthType == Accounts.AUTH_TYPE_TWIP_O_MODE ? LinearLayout.VERTICAL
: LinearLayout.HORIZONTAL); : LinearLayout.HORIZONTAL);
mEditUsername.setText(mUsername); mEditUsername.setText(mUsername);
@ -701,11 +683,6 @@ public class SignInActivity extends BaseAppCompatActivity implements TwitterCons
} }
@Override
public int getThemeResourceId() {
return ThemeUtils.getThemeResource(this);
}
static class SignInResponse { static class SignInResponse {
public final boolean already_logged_in, succeed; public final boolean already_logged_in, succeed;

View File

@ -19,19 +19,16 @@
package org.mariotaku.twidere.activity.support; package org.mariotaku.twidere.activity.support;
import android.content.Context;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatActivity;
import android.util.AttributeSet; import android.support.v7.app.AppCompatDelegate;
import android.view.View; import android.support.v7.app.ThemedAppCompatDelegate;
import org.mariotaku.twidere.Constants; import org.mariotaku.twidere.Constants;
import org.mariotaku.twidere.activity.iface.IThemedActivity; import org.mariotaku.twidere.activity.iface.IThemedActivity;
import org.mariotaku.twidere.util.StrictModeUtils; import org.mariotaku.twidere.util.StrictModeUtils;
import org.mariotaku.twidere.util.ThemeUtils; import org.mariotaku.twidere.util.ThemeUtils;
import org.mariotaku.twidere.util.Utils; import org.mariotaku.twidere.util.Utils;
import org.mariotaku.twidere.view.ShapedImageView;
import org.mariotaku.twidere.view.ShapedImageView.ShapeStyle; import org.mariotaku.twidere.view.ShapedImageView.ShapeStyle;
public abstract class ThemedAppCompatActivity extends AppCompatActivity implements Constants, IThemedActivity { public abstract class ThemedAppCompatActivity extends AppCompatActivity implements Constants, IThemedActivity {
@ -41,6 +38,8 @@ public abstract class ThemedAppCompatActivity extends AppCompatActivity implemen
private int mProfileImageStyle; private int mProfileImageStyle;
private String mCurrentThemeBackgroundOption; private String mCurrentThemeBackgroundOption;
private AppCompatDelegate mDelegate;
@Override @Override
public int getCurrentThemeBackgroundAlpha() { public int getCurrentThemeBackgroundAlpha() {
return mCurrentThemeBackgroundAlpha; return mCurrentThemeBackgroundAlpha;
@ -77,15 +76,13 @@ public abstract class ThemedAppCompatActivity extends AppCompatActivity implemen
} }
@Override @Override
public final void restart() { public int getCurrentProfileImageStyle() {
Utils.restartActivity(this); return mProfileImageStyle;
} }
@Override @Override
public void onSupportActionModeStarted(android.support.v7.view.ActionMode mode) { public final void restart() {
super.onSupportActionModeStarted(mode); Utils.restartActivity(this);
ThemeUtils.applySupportActionModeColor(mode, this, getCurrentThemeResourceId(),
getCurrentThemeColor(), getThemeBackgroundOption(), true);
} }
@Override @Override
@ -99,24 +96,16 @@ public abstract class ThemedAppCompatActivity extends AppCompatActivity implemen
} }
@Override @Override
public View onCreateView(String name, @NonNull Context context, @NonNull AttributeSet attrs) { public void onSupportActionModeStarted(android.support.v7.view.ActionMode mode) {
final View view = ThemeUtils.createView(name, context, attrs, mCurrentThemeColor); super.onSupportActionModeStarted(mode);
if (view instanceof ShapedImageView) { ThemeUtils.applySupportActionModeColor(mode, this, getCurrentThemeResourceId(),
final ShapedImageView shapedImageView = (ShapedImageView) view; getCurrentThemeColor(), getThemeBackgroundOption(), true);
shapedImageView.setStyle(mProfileImageStyle);
}
if (view != null) return view;
return super.onCreateView(name, context, attrs);
} }
@Override @Override
protected void onResume() { public AppCompatDelegate getDelegate() {
super.onResume(); if (mDelegate != null) return mDelegate;
} return mDelegate = ThemedAppCompatDelegate.create(this, this);
@Override
protected void onStart() {
super.onStart();
} }
private void setupTheme() { private void setupTheme() {
@ -126,8 +115,8 @@ public abstract class ThemedAppCompatActivity extends AppCompatActivity implemen
mProfileImageStyle = Utils.getProfileImageStyle(this); mProfileImageStyle = Utils.getProfileImageStyle(this);
mCurrentThemeBackgroundOption = getThemeBackgroundOption(); mCurrentThemeBackgroundOption = getThemeBackgroundOption();
setTheme(mCurrentThemeResource); setTheme(mCurrentThemeResource);
ThemeUtils.applyWindowBackground(this, getWindow(), mCurrentThemeResource, mCurrentThemeBackgroundOption, mCurrentThemeBackgroundAlpha); ThemeUtils.applyWindowBackground(this, getWindow(), mCurrentThemeResource,
mCurrentThemeBackgroundOption, mCurrentThemeBackgroundAlpha);
} }
} }

View File

@ -34,7 +34,6 @@ import org.mariotaku.twidere.activity.iface.IThemedActivity;
import org.mariotaku.twidere.util.StrictModeUtils; import org.mariotaku.twidere.util.StrictModeUtils;
import org.mariotaku.twidere.util.ThemeUtils; import org.mariotaku.twidere.util.ThemeUtils;
import org.mariotaku.twidere.util.Utils; import org.mariotaku.twidere.util.Utils;
import org.mariotaku.twidere.view.ShapedImageView;
import org.mariotaku.twidere.view.ShapedImageView.ShapeStyle; import org.mariotaku.twidere.view.ShapedImageView.ShapeStyle;
public abstract class ThemedFragmentActivity extends FragmentActivity implements Constants, IThemedActivity { public abstract class ThemedFragmentActivity extends FragmentActivity implements Constants, IThemedActivity {
@ -44,16 +43,6 @@ public abstract class ThemedFragmentActivity extends FragmentActivity implements
private int mProfileImageStyle; private int mProfileImageStyle;
private String mCurrentThemeBackgroundOption; private String mCurrentThemeBackgroundOption;
@Override
public final int getCurrentThemeResourceId() {
return mCurrentThemeResource;
}
@Override
public int getThemeBackgroundAlpha() {
return ThemeUtils.getUserThemeBackgroundAlpha(this);
}
@Override @Override
public int getCurrentThemeBackgroundAlpha() { public int getCurrentThemeBackgroundAlpha() {
return mCurrentThemeBackgroundAlpha; return mCurrentThemeBackgroundAlpha;
@ -64,21 +53,36 @@ public abstract class ThemedFragmentActivity extends FragmentActivity implements
return mCurrentThemeBackgroundOption; return mCurrentThemeBackgroundOption;
} }
@Override
public String getThemeBackgroundOption() {
return ThemeUtils.getThemeBackgroundOption(this);
}
@Override @Override
public int getCurrentThemeColor() { public int getCurrentThemeColor() {
return mCurrentThemeColor; return mCurrentThemeColor;
} }
@Override
public final int getCurrentThemeResourceId() {
return mCurrentThemeResource;
}
@Override
public int getThemeBackgroundAlpha() {
return ThemeUtils.getUserThemeBackgroundAlpha(this);
}
@Override
public String getThemeBackgroundOption() {
return ThemeUtils.getThemeBackgroundOption(this);
}
@Override @Override
public String getThemeFontFamily() { public String getThemeFontFamily() {
return ThemeUtils.getThemeFontFamily(this); return ThemeUtils.getThemeFontFamily(this);
} }
@Override
public int getCurrentProfileImageStyle() {
return mProfileImageStyle;
}
@Override @Override
public final void restart() { public final void restart() {
Utils.restartActivity(this); Utils.restartActivity(this);
@ -96,23 +100,9 @@ public abstract class ThemedFragmentActivity extends FragmentActivity implements
@Override @Override
public View onCreateView(String name, @NonNull Context context, @NonNull AttributeSet attrs) { public View onCreateView(String name, @NonNull Context context, @NonNull AttributeSet attrs) {
final View view = ThemeUtils.createView(name, context, attrs, mCurrentThemeColor); final View view = super.onCreateView(name, context, attrs);
if (view instanceof ShapedImageView) { ThemeUtils.initView(view, getCurrentThemeColor(), mProfileImageStyle);
final ShapedImageView shapedImageView = (ShapedImageView) view; return view;
shapedImageView.setStyle(mProfileImageStyle);
}
if (view != null) return view;
return super.onCreateView(name, context, attrs);
}
@Override
protected void onResume() {
super.onResume();
}
@Override
protected void onStart() {
super.onStart();
} }
@Override @Override

View File

@ -278,8 +278,8 @@ public class UserProfileEditorActivity extends BaseDialogWhenLargeActivity imple
} }
@Override @Override
public void onSupportContentChanged() { public void onContentChanged() {
super.onSupportContentChanged(); super.onContentChanged();
mProgressContainer = findViewById(R.id.progress_container); mProgressContainer = findViewById(R.id.progress_container);
mEditProfileContent = findViewById(R.id.edit_profile_content); mEditProfileContent = findViewById(R.id.edit_profile_content);
mProfileBannerView = (ImageView) findViewById(R.id.profile_banner); mProfileBannerView = (ImageView) findViewById(R.id.profile_banner);

View File

@ -292,7 +292,6 @@ public class TwidereApplication extends MultiDexApplication implements Constants
reloadConnectivitySettings(); reloadConnectivitySettings();
} else if (KEY_USAGE_STATISTICS.equals(key)) { } else if (KEY_USAGE_STATISTICS.equals(key)) {
stopService(new Intent(this, UCDService.class)); stopService(new Intent(this, UCDService.class));
startUsageStatisticsServiceIfNeeded(this);
//spice //spice
stopService(new Intent(this, SpiceService.class)); stopService(new Intent(this, SpiceService.class));
startUsageStatisticsServiceIfNeeded(this); startUsageStatisticsServiceIfNeeded(this);

View File

@ -34,6 +34,7 @@ import android.graphics.PorterDuff.Mode;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.content.res.ResourcesCompat; import android.support.v4.content.res.ResourcesCompat;
import android.support.v7.app.ActionBar;
import android.text.TextUtils; import android.text.TextUtils;
import android.view.ActionMode; import android.view.ActionMode;
import android.view.LayoutInflater; import android.view.LayoutInflater;
@ -59,13 +60,16 @@ import org.mariotaku.querybuilder.Columns.Column;
import org.mariotaku.querybuilder.Expression; import org.mariotaku.querybuilder.Expression;
import org.mariotaku.querybuilder.RawItemArray; import org.mariotaku.querybuilder.RawItemArray;
import org.mariotaku.twidere.R; import org.mariotaku.twidere.R;
import org.mariotaku.twidere.activity.BasePreferenceActivity;
import org.mariotaku.twidere.activity.SettingsActivity; import org.mariotaku.twidere.activity.SettingsActivity;
import org.mariotaku.twidere.activity.iface.IThemedActivity;
import org.mariotaku.twidere.activity.support.CustomTabEditorActivity; import org.mariotaku.twidere.activity.support.CustomTabEditorActivity;
import org.mariotaku.twidere.model.CustomTabConfiguration; import org.mariotaku.twidere.model.CustomTabConfiguration;
import org.mariotaku.twidere.model.CustomTabConfiguration.CustomTabConfigurationComparator; import org.mariotaku.twidere.model.CustomTabConfiguration.CustomTabConfigurationComparator;
import org.mariotaku.twidere.provider.TwidereDataStore.Tabs; import org.mariotaku.twidere.provider.TwidereDataStore.Tabs;
import org.mariotaku.twidere.util.SharedPreferencesWrapper; import org.mariotaku.twidere.util.SharedPreferencesWrapper;
import org.mariotaku.twidere.util.ThemeUtils; import org.mariotaku.twidere.util.ThemeUtils;
import org.mariotaku.twidere.util.TwidereColorUtils;
import org.mariotaku.twidere.util.Utils; import org.mariotaku.twidere.util.Utils;
import org.mariotaku.twidere.view.holder.TwoLineWithIconViewHolder; import org.mariotaku.twidere.view.holder.TwoLineWithIconViewHolder;
@ -307,7 +311,16 @@ public class CustomTabsFragment extends BaseFragment implements LoaderCallbacks<
subItem.setIntent(intent); subItem.setIntent(intent);
} }
} }
ThemeUtils.applyColorFilterToMenuIcon(getActivity(), menu);
final Activity activity = getActivity();
if (activity instanceof BasePreferenceActivity) {
final ActionBar actionBar = ((BasePreferenceActivity) activity).getSupportActionBar();
final int themeColor = ((IThemedActivity) activity).getCurrentThemeColor();
final int itemColor = TwidereColorUtils.getContrastYIQ(themeColor, 192);
final int popupTheme = ThemeUtils.getActionBarPopupThemeRes(actionBar.getThemedContext());
final int popupColor = ThemeUtils.getThemeForegroundColor(activity, popupTheme);
ThemeUtils.applyColorFilterToMenuIcon(menu, itemColor, popupColor, 0, Mode.SRC_ATOP);
}
} }
@Override @Override

View File

@ -21,6 +21,7 @@ package org.mariotaku.twidere.graphic;
import android.graphics.PorterDuff.Mode; import android.graphics.PorterDuff.Mode;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.support.v7.graphics.drawable.DrawableWrapper;
import android.view.MenuItem; import android.view.MenuItem;
import org.mariotaku.twidere.util.menu.TwidereMenuInfo; import org.mariotaku.twidere.util.menu.TwidereMenuInfo;
@ -35,7 +36,7 @@ public class ActionIconDrawable extends DrawableWrapper {
public ActionIconDrawable(Drawable drawable, int defaultColor) { public ActionIconDrawable(Drawable drawable, int defaultColor) {
super(drawable); super(drawable);
mDefaultColor = defaultColor; setDefaultColor(defaultColor);
setHighlightColor(0); setHighlightColor(0);
} }
@ -62,7 +63,9 @@ public class ActionIconDrawable extends DrawableWrapper {
} }
private void updateColorFilter() { private void updateColorFilter() {
setColorFilter(mHighlightColor == 0 ? mDefaultColor : mHighlightColor, Mode.SRC_ATOP); final int color = mHighlightColor == 0 ? mDefaultColor : mHighlightColor;
setColorFilter(color, Mode.SRC_ATOP);
invalidateSelf();
} }
} }

View File

@ -1,215 +0,0 @@
/*
* 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.graphic;
import android.content.res.ColorStateList;
import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.PorterDuff;
import android.graphics.Rect;
import android.graphics.Region;
import android.graphics.drawable.Drawable;
import android.support.v4.graphics.drawable.DrawableCompat;
import android.view.View;
/**
* Base wrapper that delegates all calls to another {@link Drawable}. The wrapped {@link Drawable}
* <em>must</em> be fully released from any {@link View} before wrapping, otherwise internal {@link
* Drawable.Callback} may be dropped.
*/
class DrawableWrapper extends Drawable implements Drawable.Callback {
private final Drawable mDrawable;
public DrawableWrapper(Drawable drawable) {
mDrawable = drawable;
mDrawable.setCallback(this);
}
@Override
public void draw(Canvas canvas) {
mDrawable.draw(canvas);
}
@Override
public void setBounds(int left, int top, int right, int bottom) {
super.setBounds(left, top, right, bottom);
mDrawable.setBounds(left, top, right, bottom);
}
@Override
public void setChangingConfigurations(int configs) {
mDrawable.setChangingConfigurations(configs);
}
@Override
public int getChangingConfigurations() {
return mDrawable.getChangingConfigurations();
}
@Override
public void setDither(boolean dither) {
mDrawable.setDither(dither);
}
@Override
public void setFilterBitmap(boolean filter) {
mDrawable.setFilterBitmap(filter);
}
@Override
public void setAlpha(int alpha) {
mDrawable.setAlpha(alpha);
}
@Override
public void setColorFilter(ColorFilter cf) {
mDrawable.setColorFilter(cf);
}
@Override
public boolean isStateful() {
return mDrawable.isStateful();
}
@Override
public boolean setState(final int[] stateSet) {
return mDrawable.setState(stateSet);
}
@Override
public int[] getState() {
return mDrawable.getState();
}
@Override
public void jumpToCurrentState() {
DrawableCompat.jumpToCurrentState(mDrawable);
}
@Override
public Drawable getCurrent() {
return mDrawable.getCurrent();
}
@Override
public boolean setVisible(boolean visible, boolean restart) {
return super.setVisible(visible, restart) || mDrawable.setVisible(visible, restart);
}
@Override
public int getOpacity() {
return mDrawable.getOpacity();
}
@Override
public Region getTransparentRegion() {
return mDrawable.getTransparentRegion();
}
@Override
public int getIntrinsicWidth() {
return mDrawable.getIntrinsicWidth();
}
@Override
public int getIntrinsicHeight() {
return mDrawable.getIntrinsicHeight();
}
@Override
public int getMinimumWidth() {
return mDrawable.getMinimumWidth();
}
@Override
public int getMinimumHeight() {
return mDrawable.getMinimumHeight();
}
@Override
public boolean getPadding(Rect padding) {
return mDrawable.getPadding(padding);
}
/**
* {@inheritDoc}
*/
@Override
public void invalidateDrawable(Drawable who) {
invalidateSelf();
}
/**
* {@inheritDoc}
*/
@Override
public void scheduleDrawable(Drawable who, Runnable what, long when) {
scheduleSelf(what, when);
}
/**
* {@inheritDoc}
*/
@Override
public void unscheduleDrawable(Drawable who, Runnable what) {
unscheduleSelf(what);
}
@Override
protected boolean onLevelChange(int level) {
return mDrawable.setLevel(level);
}
@Override
public void setAutoMirrored(boolean mirrored) {
DrawableCompat.setAutoMirrored(mDrawable, mirrored);
}
@Override
public boolean isAutoMirrored() {
return DrawableCompat.isAutoMirrored(mDrawable);
}
@Override
public void setTint(int tint) {
DrawableCompat.setTint(mDrawable, tint);
}
@Override
public void setTintList(ColorStateList tint) {
DrawableCompat.setTintList(mDrawable, tint);
}
@Override
public void setTintMode(PorterDuff.Mode tintMode) {
DrawableCompat.setTintMode(mDrawable, tintMode);
}
@Override
public void setHotspot(float x, float y) {
DrawableCompat.setHotspot(mDrawable, x, y);
}
@Override
public void setHotspotBounds(int left, int top, int right, int bottom) {
DrawableCompat.setHotspotBounds(mDrawable, left, top, right, bottom);
}
}

View File

@ -1,166 +0,0 @@
/*
* 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.popup;
import android.content.Context;
import android.content.res.Resources;
import android.os.Build;
import android.support.annotation.NonNull;
import android.util.SparseBooleanArray;
import android.view.LayoutInflater;
import android.view.LayoutInflater.Factory;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AbsListView;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.GridView;
import android.widget.ImageView;
import android.widget.PopupWindow;
import org.apache.commons.lang3.ArrayUtils;
import org.mariotaku.twidere.R;
import org.mariotaku.twidere.adapter.ArrayAdapter;
import org.mariotaku.twidere.app.TwidereApplication;
import org.mariotaku.twidere.model.ParcelableAccount;
import org.mariotaku.twidere.util.MediaLoaderWrapper;
import org.mariotaku.twidere.util.ThemeUtils;
import org.mariotaku.twidere.util.ThemedViewFactory;
import org.mariotaku.twidere.util.Utils;
import java.util.List;
/**
* Created by mariotaku on 15/1/12.
*/
public class AccountSelectorPopupWindow {
private final Context mContext;
private final View mAnchor;
private final PopupWindow mPopup;
private final AccountsGridAdapter mAdapter;
private final GridView mGridView;
private AccountSelectionListener mAccountSelectionListener;
public AccountSelectorPopupWindow(Context context, View anchor) {
mContext = context;
mAnchor = anchor;
final int themeAttr;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
themeAttr = android.R.attr.actionOverflowMenuStyle;
} else {
themeAttr = android.R.attr.popupMenuStyle;
}
mAdapter = new AccountsGridAdapter(context);
final Resources resources = context.getResources();
final LayoutInflater inflater = LayoutInflater.from(context);
final int themeColor = ThemeUtils.getUserAccentColor(context);
if (!(context instanceof Factory)) {
inflater.setFactory2(new ThemedViewFactory(themeColor));
}
final View contentView = inflater.inflate(R.layout.popup_account_selector, null);
mGridView = (GridView) contentView.findViewById(R.id.grid_view);
mGridView.setAdapter(mAdapter);
mGridView.setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE);
mGridView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
if (mAccountSelectionListener == null) return;
mAccountSelectionListener.onSelectionChanged(getSelectedAccountIds());
}
});
mPopup = new PopupWindow(context, null, themeAttr);
mPopup.setFocusable(true);
mPopup.setWidth(Utils.getActionBarHeight(context) * 2);
mPopup.setWindowLayoutMode(0, ViewGroup.LayoutParams.WRAP_CONTENT);
mPopup.setContentView(contentView);
}
public void setAccountSelectionListener(AccountSelectionListener listener) {
mAccountSelectionListener = listener;
}
public boolean isShowing() {
return mPopup.isShowing();
}
public void dismiss() {
mPopup.dismiss();
}
public void show() {
mPopup.showAsDropDown(mAnchor);
}
public interface AccountSelectionListener {
public void onSelectionChanged(long[] accountIds);
}
public void setSelectedAccountIds(long[] accountIds) {
if (accountIds == null) {
mGridView.clearChoices();
}
for (int i = 0, j = mAdapter.getCount(); i < j; i++) {
mGridView.setItemChecked(i, ArrayUtils.contains(accountIds, mAdapter.getItem(i).account_id));
}
}
@NonNull
public long[] getSelectedAccountIds() {
final long[] accountIds = new long[mGridView.getCheckedItemCount()];
final SparseBooleanArray positions = mGridView.getCheckedItemPositions();
for (int i = 0, j = positions.size(), k = 0; i < j; i++) {
if (positions.valueAt(i)) {
accountIds[k++] = mAdapter.getItem(positions.keyAt(i)).account_id;
}
}
return accountIds;
}
public void setAccounts(List<ParcelableAccount> accounts) {
mAdapter.clear();
if (accounts != null) {
mAdapter.addAll(accounts);
}
}
private static class AccountsGridAdapter extends ArrayAdapter<ParcelableAccount> {
private final MediaLoaderWrapper mImageLoader;
public AccountsGridAdapter(Context context) {
super(context, R.layout.grid_item_selector_account);
mImageLoader = TwidereApplication.getInstance(context).getMediaLoaderWrapper();
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
final View view = super.getView(position, convertView, parent);
final ParcelableAccount account = getItem(position);
final ImageView icon = (ImageView) view.findViewById(android.R.id.icon);
mImageLoader.displayProfileImage(icon, account.profile_image_url);
return view;
}
}
}

View File

@ -51,7 +51,6 @@ import android.text.SpannableStringBuilder;
import android.text.Spanned; import android.text.Spanned;
import android.text.TextPaint; import android.text.TextPaint;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.ActionMode; import android.view.ActionMode;
import android.view.ContextMenu.ContextMenuInfo; import android.view.ContextMenu.ContextMenuInfo;
import android.view.ContextThemeWrapper; import android.view.ContextThemeWrapper;
@ -61,9 +60,8 @@ import android.view.View;
import android.view.View.OnLongClickListener; import android.view.View.OnLongClickListener;
import android.view.Window; import android.view.Window;
import android.view.WindowManager; import android.view.WindowManager;
import android.widget.CompoundButton; import android.widget.AdapterView;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView; import android.widget.TextView;
import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ArrayUtils;
@ -74,12 +72,10 @@ import org.mariotaku.twidere.graphic.ActionBarColorDrawable;
import org.mariotaku.twidere.graphic.ActionIconDrawable; import org.mariotaku.twidere.graphic.ActionIconDrawable;
import org.mariotaku.twidere.text.ParagraphSpacingSpan; import org.mariotaku.twidere.text.ParagraphSpacingSpan;
import org.mariotaku.twidere.util.menu.TwidereMenuInfo; import org.mariotaku.twidere.util.menu.TwidereMenuInfo;
import org.mariotaku.twidere.view.ShapedImageView;
import org.mariotaku.twidere.view.TabPagerIndicator; import org.mariotaku.twidere.view.TabPagerIndicator;
import org.mariotaku.twidere.view.iface.IThemedView;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
public class ThemeUtils implements Constants { public class ThemeUtils implements Constants {
@ -88,8 +84,6 @@ public class ThemeUtils implements Constants {
private static final int[] ANIM_CLOSE_STYLE_ATTRS = {android.R.attr.activityCloseEnterAnimation, private static final int[] ANIM_CLOSE_STYLE_ATTRS = {android.R.attr.activityCloseEnterAnimation,
android.R.attr.activityCloseExitAnimation}; android.R.attr.activityCloseExitAnimation};
private static final String[] sClassPrefixList = {"android.widget.", "android.webkit.", "org.mariotaku.twidere.view"};
private ThemeUtils() { private ThemeUtils() {
throw new AssertionError(); throw new AssertionError();
} }
@ -189,7 +183,7 @@ public class ThemeUtils implements Constants {
textView.setText(builder); textView.setText(builder);
} }
public static void applySupportActionModeColor(ActionMode mode, FragmentActivity activity, public static void applySupportActionModeColor(final ActionMode mode, final Activity activity,
int themeRes, int accentColor, int themeRes, int accentColor,
String backgroundOption, boolean outlineEnabled) { String backgroundOption, boolean outlineEnabled) {
// Very dirty implementation // Very dirty implementation
@ -199,8 +193,8 @@ public class ThemeUtils implements Constants {
applySupportActionModeColor(modeCompat, activity, themeRes, accentColor, backgroundOption, outlineEnabled); applySupportActionModeColor(modeCompat, activity, themeRes, accentColor, backgroundOption, outlineEnabled);
} }
public static void applySupportActionModeColor(android.support.v7.view.ActionMode modeCompat, public static void applySupportActionModeColor(final android.support.v7.view.ActionMode modeCompat,
FragmentActivity activity, int themeRes, Activity activity, int themeRes,
int accentColor, String backgroundOption, int accentColor, String backgroundOption,
boolean outlineEnabled) { boolean outlineEnabled) {
// Very dirty implementation // Very dirty implementation
@ -226,8 +220,6 @@ public class ThemeUtils implements Constants {
final TextView actionBarSubtitleView = (TextView) contextView.findViewById(android.support.v7.appcompat.R.id.action_bar_subtitle); final TextView actionBarSubtitleView = (TextView) contextView.findViewById(android.support.v7.appcompat.R.id.action_bar_subtitle);
final ImageView actionModeCloseButton = (ImageView) contextView.findViewById(android.support.v7.appcompat.R.id.action_mode_close_button); final ImageView actionModeCloseButton = (ImageView) contextView.findViewById(android.support.v7.appcompat.R.id.action_mode_close_button);
final ActionMenuView menuView = ViewUtils.findViewByType(contextView, ActionMenuView.class); final ActionMenuView menuView = ViewUtils.findViewByType(contextView, ActionMenuView.class);
if (actionBarTitleView == null || actionBarSubtitleView == null || actionModeCloseButton == null || menuView == null)
return;
final int actionBarColor; final int actionBarColor;
if (isDarkTheme(themeRes)) { if (isDarkTheme(themeRes)) {
actionBarColor = context.getResources().getColor(R.color.background_color_action_bar_dark); actionBarColor = context.getResources().getColor(R.color.background_color_action_bar_dark);
@ -236,11 +228,19 @@ public class ThemeUtils implements Constants {
} }
final int titleColor = getContrastActionBarTitleColor(context, themeRes, actionBarColor); final int titleColor = getContrastActionBarTitleColor(context, themeRes, actionBarColor);
final int itemColor = getContrastActionBarItemColor(context, themeRes, actionBarColor); final int itemColor = getContrastActionBarItemColor(context, themeRes, actionBarColor);
actionBarTitleView.setTextColor(titleColor); if (actionBarTitleView != null) {
actionBarSubtitleView.setTextColor(titleColor); actionBarTitleView.setTextColor(titleColor);
actionModeCloseButton.setColorFilter(itemColor, Mode.SRC_ATOP); }
setActionBarOverflowColor(menuView, itemColor); if (actionBarSubtitleView != null) {
ThemeUtils.wrapToolbarMenuIcon(menuView, itemColor, itemColor); actionBarSubtitleView.setTextColor(titleColor);
}
if (actionModeCloseButton != null) {
actionModeCloseButton.setColorFilter(itemColor, Mode.SRC_ATOP);
}
if (menuView != null) {
setActionBarOverflowColor(menuView, itemColor);
ThemeUtils.wrapToolbarMenuIcon(menuView, itemColor, itemColor);
}
ViewUtils.setBackground(contextView, getActionBarBackground(activity, themeRes, accentColor, backgroundOption, outlineEnabled)); ViewUtils.setBackground(contextView, getActionBarBackground(activity, themeRes, accentColor, backgroundOption, outlineEnabled));
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
@ -268,45 +268,6 @@ public class ThemeUtils implements Constants {
} }
} }
public static View createView(final String name, final Context context,
final AttributeSet attrs) {
return createView(name, context, attrs, 0);
}
public static View createView(final String name, final Context context,
final AttributeSet attrs, final int tintColor) {
View view = null;
try {
view = newViewInstance(name, context, attrs);
} catch (final Exception e) {
// In this case we want to let the base class take a crack
// at it.
}
for (final String prefix : sClassPrefixList) {
try {
view = newViewInstance(prefix + name, context, attrs);
} catch (final Exception e) {
// In this case we want to let the base class take a crack
// at it.
}
}
if (view != null) {
applyColorTintForView(view, tintColor);
}
return view;
}
@Deprecated
public static Drawable getActionBarBackground(final Context context, final int themeRes) {
@SuppressWarnings("ConstantConditions")
final TypedArray array = context.obtainStyledAttributes(null, new int[]{android.R.attr.background},
android.R.attr.actionBarStyle, themeRes);
try {
return array.getDrawable(0);
} finally {
array.recycle();
}
}
@NonNull @NonNull
public static Drawable getActionBarBackground(final Context context, final int themeRes, public static Drawable getActionBarBackground(final Context context, final int themeRes,
@ -802,12 +763,13 @@ public class ThemeUtils implements Constants {
indicator.updateAppearance(); indicator.updateAppearance();
} }
public static void initTextView(TextView view) { public static void initView(View view, int themeColor, int profileImageStyle) {
if (view.isInEditMode()) return; if (view == null) return;
final Context context = view.getContext(); if (view instanceof ShapedImageView) {
// view.setLinkTextColor(ThemeUtils.getUserLinkTextColor(context)); final ShapedImageView shapedImageView = (ShapedImageView) view;
// view.setHighlightColor(ThemeUtils.getUserHighlightColor(context)); shapedImageView.setStyle(profileImageStyle);
view.setTypeface(ThemeUtils.getUserTypeface(context, view.getTypeface())); } else if (view instanceof TextView) {
}
} }
public static boolean isColoredActionBar(int themeRes) { public static boolean isColoredActionBar(int themeRes) {
@ -1038,7 +1000,7 @@ public class ThemeUtils implements Constants {
final MenuItem item = menu.getItem(i); final MenuItem item = menu.getItem(i);
wrapMenuItemIcon(item, itemColor, excludeGroups); wrapMenuItemIcon(item, itemColor, excludeGroups);
if (item.hasSubMenu()) { if (item.hasSubMenu()) {
wrapMenuIcon(menu, popupItemColor, popupItemColor, excludeGroups); wrapMenuIcon(item.getSubMenu(), popupItemColor, popupItemColor, excludeGroups);
} }
if (item.isVisible()) { if (item.isVisible()) {
k++; k++;
@ -1094,7 +1056,7 @@ public class ThemeUtils implements Constants {
final MenuItem item = menu.getItem(i); final MenuItem item = menu.getItem(i);
wrapMenuItemIcon(item, itemColor, excludeGroups); wrapMenuItemIcon(item, itemColor, excludeGroups);
if (item.hasSubMenu()) { if (item.hasSubMenu()) {
wrapMenuIcon(menu, popupItemColor, popupItemColor, excludeGroups); wrapMenuIcon(item.getSubMenu(), popupItemColor, popupItemColor, excludeGroups);
} }
if (item.isVisible()) { if (item.isVisible()) {
k++; k++;
@ -1102,26 +1064,6 @@ public class ThemeUtils implements Constants {
} }
} }
private static void applyColorTintForView(View view, int tintColor) {
if (view instanceof IThemedView) {
final ColorStateList tintList = ColorStateList.valueOf(tintColor);
((IThemedView) view).setThemeTintColor(tintList);
} else if (view instanceof ProgressBar) {
final ColorStateList tintList = ColorStateList.valueOf(tintColor);
final ProgressBar progressBar = (ProgressBar) view;
ViewUtils.setProgressTintList(progressBar, tintList);
ViewUtils.setProgressBackgroundTintList(progressBar, tintList);
ViewUtils.setIndeterminateTintList(progressBar, tintList);
} else if (view instanceof CompoundButton) {
final ColorStateList tintList = ColorStateList.valueOf(tintColor);
final CompoundButton compoundButton = (CompoundButton) view;
ViewUtils.setButtonTintList(compoundButton, tintList);
} else {
// final ColorStateList tintList = ColorStateList.valueOf(tintColor);
// ViewCompat.setBackgroundTintList(view, tintList);
}
}
@NonNull @NonNull
private static SharedPreferencesWrapper getSharedPreferencesWrapper(Context context) { private static SharedPreferencesWrapper getSharedPreferencesWrapper(Context context) {
final Context appContext = context.getApplicationContext(); final Context appContext = context.getApplicationContext();
@ -1129,11 +1071,4 @@ public class ThemeUtils implements Constants {
Context.MODE_PRIVATE); Context.MODE_PRIVATE);
} }
private static View newViewInstance(final String className, final Context context, final AttributeSet attrs)
throws ClassNotFoundException, NoSuchMethodException, InstantiationException, IllegalAccessException,
InvocationTargetException {
final Class<?> viewCls = Class.forName(className);
final Constructor<?> constructor = viewCls.getConstructor(Context.class, AttributeSet.class);
return (View) constructor.newInstance(context, attrs);
}
} }

View File

@ -1,47 +0,0 @@
/*
* 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.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater.Factory2;
import android.view.View;
/**
* Created by mariotaku on 15/1/13.
*/
public class ThemedViewFactory implements Factory2 {
private final int mThemeColor;
public ThemedViewFactory(int themeColor) {
mThemeColor = themeColor;
}
@Override
public View onCreateView(View parent, String name, Context context, AttributeSet attrs) {
return ThemeUtils.createView(name, context, attrs, mThemeColor);
}
@Override
public View onCreateView(String name, Context context, AttributeSet attrs) {
return null;
}
}

View File

@ -24,15 +24,15 @@ import android.content.res.ColorStateList;
import android.content.res.TypedArray; import android.content.res.TypedArray;
import android.graphics.PorterDuff.Mode; import android.graphics.PorterDuff.Mode;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.support.v7.widget.AppCompatTextView;
import android.util.AttributeSet; import android.util.AttributeSet;
import org.mariotaku.twidere.R; import org.mariotaku.twidere.R;
import org.mariotaku.twidere.view.themed.ThemedTextView;
/** /**
* Created by mariotaku on 14/11/20. * Created by mariotaku on 14/11/20.
*/ */
public class ActionIconThemedTextView extends ThemedTextView { public class ActionIconThemedTextView extends AppCompatTextView {
private final int mIconWidth, mIconHeight; private final int mIconWidth, mIconHeight;
private int mColor, mDisabledColor, mActivatedColor; private int mColor, mDisabledColor, mActivatedColor;

View File

@ -21,6 +21,7 @@ package org.mariotaku.twidere.view;
import android.content.Context; import android.content.Context;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.v7.widget.AppCompatTextView;
import android.text.Layout; import android.text.Layout;
import android.text.Selection; import android.text.Selection;
import android.text.Spannable; import android.text.Spannable;
@ -29,9 +30,7 @@ import android.text.style.ClickableSpan;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.view.MotionEvent; import android.view.MotionEvent;
import org.mariotaku.twidere.view.themed.ThemedTextView; public class HandleSpanClickTextView extends AppCompatTextView {
public class HandleSpanClickTextView extends ThemedTextView {
public HandleSpanClickTextView(final Context context) { public HandleSpanClickTextView(final Context context) {
super(context); super(context);

View File

@ -24,17 +24,17 @@ import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener; import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.os.Handler; import android.os.Handler;
import android.os.SystemClock; import android.os.SystemClock;
import android.support.v7.widget.AppCompatTextView;
import android.text.format.DateUtils; import android.text.format.DateUtils;
import android.util.AttributeSet; import android.util.AttributeSet;
import org.mariotaku.twidere.Constants; import org.mariotaku.twidere.Constants;
import org.mariotaku.twidere.R; import org.mariotaku.twidere.R;
import org.mariotaku.twidere.view.themed.ThemedTextView;
import static android.text.format.DateUtils.getRelativeTimeSpanString; import static android.text.format.DateUtils.getRelativeTimeSpanString;
import static org.mariotaku.twidere.util.Utils.formatSameDayTime; import static org.mariotaku.twidere.util.Utils.formatSameDayTime;
public class ShortTimeView extends ThemedTextView implements Constants, OnSharedPreferenceChangeListener { public class ShortTimeView extends AppCompatTextView implements Constants, OnSharedPreferenceChangeListener {
private static final long TICKER_DURATION = 5000L; private static final long TICKER_DURATION = 5000L;

View File

@ -1,61 +0,0 @@
/*
* 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;
import android.content.Context;
import android.util.AttributeSet;
import android.view.ViewGroup;
public class SquareActionIconView extends ActionIconView {
public SquareActionIconView(final Context context) {
this(context, null);
}
public SquareActionIconView(final Context context, final AttributeSet attrs) {
this(context, attrs, 0);
}
public SquareActionIconView(final Context context, final AttributeSet attrs, final int defStyle) {
super(context, attrs, defStyle);
}
@Override
protected void onMeasure(final int widthMeasureSpec, final int heightMeasureSpec) {
final int width = MeasureSpec.getSize(widthMeasureSpec), height = MeasureSpec.getSize(heightMeasureSpec);
final ViewGroup.LayoutParams lp = getLayoutParams();
if (lp.height == ViewGroup.LayoutParams.MATCH_PARENT && lp.width == ViewGroup.LayoutParams.WRAP_CONTENT) {
super.onMeasure(heightMeasureSpec, heightMeasureSpec);
setMeasuredDimension(height, height);
} else if (lp.width == ViewGroup.LayoutParams.MATCH_PARENT && lp.height == ViewGroup.LayoutParams.WRAP_CONTENT) {
super.onMeasure(widthMeasureSpec, widthMeasureSpec);
setMeasuredDimension(width, width);
} else {
if (width > height) {
super.onMeasure(heightMeasureSpec, heightMeasureSpec);
setMeasuredDimension(height, height);
} else {
super.onMeasure(widthMeasureSpec, widthMeasureSpec);
setMeasuredDimension(width, width);
}
}
}
}

View File

@ -20,6 +20,7 @@
package org.mariotaku.twidere.view; package org.mariotaku.twidere.view;
import android.content.Context; import android.content.Context;
import android.support.v7.widget.AppCompatMultiAutoCompleteTextView;
import android.text.InputType; import android.text.InputType;
import android.text.SpannableString; import android.text.SpannableString;
import android.text.Spanned; import android.text.Spanned;
@ -28,10 +29,8 @@ import android.text.method.ArrowKeyMovementMethod;
import android.util.AttributeSet; import android.util.AttributeSet;
import org.mariotaku.twidere.adapter.UserHashtagAutoCompleteAdapter; import org.mariotaku.twidere.adapter.UserHashtagAutoCompleteAdapter;
import org.mariotaku.twidere.view.iface.IThemedView;
import org.mariotaku.twidere.view.themed.ThemedMultiAutoCompleteTextView;
public class StatusComposeEditText extends ThemedMultiAutoCompleteTextView implements IThemedView { public class StatusComposeEditText extends AppCompatMultiAutoCompleteTextView {
private UserHashtagAutoCompleteAdapter mAdapter; private UserHashtagAutoCompleteAdapter mAdapter;
private long mAccountId; private long mAccountId;

View File

@ -1,17 +1,14 @@
package org.mariotaku.twidere.view; package org.mariotaku.twidere.view;
import android.content.Context; import android.content.Context;
import android.support.v7.widget.AppCompatTextView;
import android.text.Editable; import android.text.Editable;
import android.text.Spannable; import android.text.Spannable;
import android.text.SpannableString; import android.text.SpannableString;
import android.text.SpannableStringBuilder; import android.text.SpannableStringBuilder;
import android.util.AttributeSet; import android.util.AttributeSet;
import org.mariotaku.twidere.view.themed.ThemedTextView; public class StatusTextView extends AppCompatTextView {
public class StatusTextView extends ThemedTextView {
private OnSelectionChangeListener mOnSelectionChangeListener;
public StatusTextView(final Context context) { public StatusTextView(final Context context) {
this(context, null); this(context, null);
@ -28,22 +25,6 @@ public class StatusTextView extends ThemedTextView {
setSpannableFactory(new SafeSpannableFactory()); setSpannableFactory(new SafeSpannableFactory());
} }
public void setOnSelectionChangeListener(final OnSelectionChangeListener l) {
mOnSelectionChangeListener = l;
}
@Override
protected void onSelectionChanged(final int selStart, final int selEnd) {
super.onSelectionChanged(selStart, selEnd);
if (mOnSelectionChangeListener != null) {
mOnSelectionChangeListener.onSelectionChanged(selStart, selEnd);
}
}
public interface OnSelectionChangeListener {
void onSelectionChanged(int selStart, int selEnd);
}
private static class SafeSpannableString extends SpannableString { private static class SafeSpannableString extends SpannableString {
public SafeSpannableString(CharSequence source) { public SafeSpannableString(CharSequence source) {

View File

@ -1,39 +0,0 @@
/*
* 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;
import android.content.Context;
import android.support.v7.widget.ActionMenuView;
import android.util.AttributeSet;
/**
* Created by mariotaku on 15/1/22.
*/
public class TwidereActionMenuView extends ActionMenuView {
public TwidereActionMenuView(Context context) {
super(context);
}
public TwidereActionMenuView(Context context, AttributeSet attrs) {
super(context, attrs);
}
}

View File

@ -1,51 +0,0 @@
/*
* Twidere - Twitter client for Android
*
* Copyright (C) 2012-2014 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.support.v4.view.ViewCompat;
import android.util.AttributeSet;
import android.widget.AutoCompleteTextView;
import org.mariotaku.twidere.util.ThemeUtils;
import org.mariotaku.twidere.util.ViewUtils;
import org.mariotaku.twidere.view.iface.IThemedView;
public class ThemedAutoCompleteTextView extends AutoCompleteTextView implements IThemedView {
public ThemedAutoCompleteTextView(final Context context) {
this(context, null);
}
public ThemedAutoCompleteTextView(final Context context, final AttributeSet attrs) {
this(context, attrs, android.R.attr.editTextStyle);
}
public ThemedAutoCompleteTextView(final Context context, final AttributeSet attrs, final int defStyle) {
super(context, attrs, defStyle);
ThemeUtils.initTextView(this);
}
@Override
public void setThemeTintColor(ColorStateList color) {
ViewCompat.setBackgroundTintList(this, color);
}
}

View File

@ -1,43 +0,0 @@
/*
* Twidere - Twitter client for Android
*
* Copyright (C) 2012-2014 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.util.AttributeSet;
import android.widget.CheckBox;
import org.mariotaku.twidere.util.ThemeUtils;
public class ThemedCheckBox extends CheckBox {
public ThemedCheckBox(final Context context) {
this(context, null);
}
public ThemedCheckBox(final Context context, final AttributeSet attrs) {
this(context, attrs, android.R.attr.checkboxStyle);
}
public ThemedCheckBox(final Context context, final AttributeSet attrs, final int defStyle) {
super(context, attrs, defStyle);
ThemeUtils.initTextView(this);
}
}

View File

@ -1,51 +0,0 @@
/*
* Twidere - Twitter client for Android
*
* Copyright (C) 2012-2014 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.support.v4.view.ViewCompat;
import android.util.AttributeSet;
import android.widget.EditText;
import org.mariotaku.twidere.util.ThemeUtils;
import org.mariotaku.twidere.util.ViewUtils;
import org.mariotaku.twidere.view.iface.IThemedView;
public class ThemedEditText extends EditText implements IThemedView {
public ThemedEditText(final Context context) {
this(context, null);
}
public ThemedEditText(final Context context, final AttributeSet attrs) {
this(context, attrs, android.R.attr.editTextStyle);
}
public ThemedEditText(final Context context, final AttributeSet attrs, final int defStyle) {
super(context, attrs, defStyle);
ThemeUtils.initTextView(this);
}
@Override
public void setThemeTintColor(ColorStateList color) {
ViewCompat.setBackgroundTintList(this, color);
}
}

View File

@ -1,50 +0,0 @@
/*
* 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.util.AttributeSet;
import com.rengwuxian.materialedittext.MaterialEditText;
import org.mariotaku.twidere.view.iface.IThemedView;
/**
* Created by mariotaku on 15/1/18.
*/
public class ThemedMaterialEditText extends MaterialEditText implements IThemedView {
public ThemedMaterialEditText(Context context) {
super(context);
}
public ThemedMaterialEditText(Context context, AttributeSet attrs) {
super(context, attrs);
}
public ThemedMaterialEditText(Context context, AttributeSet attrs, int style) {
super(context, attrs, style);
}
@Override
public void setThemeTintColor(ColorStateList color) {
setPrimaryColor(color.getDefaultColor());
}
}

View File

@ -1,53 +0,0 @@
/*
* Twidere - Twitter client for Android
*
* Copyright (C) 2012-2014 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.support.v4.view.ViewCompat;
import android.util.AttributeSet;
import android.widget.MultiAutoCompleteTextView;
import org.mariotaku.twidere.util.ThemeUtils;
import org.mariotaku.twidere.util.ViewUtils;
import org.mariotaku.twidere.view.iface.IThemedView;
public class ThemedMultiAutoCompleteTextView extends MultiAutoCompleteTextView implements IThemedView {
public ThemedMultiAutoCompleteTextView(final Context context) {
this(context, null);
}
public ThemedMultiAutoCompleteTextView(final Context context, final AttributeSet attrs) {
this(context, attrs, android.R.attr.editTextStyle);
}
public ThemedMultiAutoCompleteTextView(final Context context, final AttributeSet attrs, final int defStyle) {
super(context, attrs, defStyle);
ThemeUtils.initTextView(this);
}
@Override
public void setThemeTintColor(ColorStateList color) {
ViewCompat.setBackgroundTintList(this, color);
setLinkTextColor(color);
setHighlightColor(color.getDefaultColor());
}
}

View File

@ -1,43 +0,0 @@
/*
* Twidere - Twitter client for Android
*
* Copyright (C) 2012-2014 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.util.AttributeSet;
import android.widget.RadioButton;
import org.mariotaku.twidere.util.ThemeUtils;
public class ThemedRadioButton extends RadioButton {
public ThemedRadioButton(final Context context) {
this(context, null);
}
public ThemedRadioButton(final Context context, final AttributeSet attrs) {
this(context, attrs, android.R.attr.checkboxStyle);
}
public ThemedRadioButton(final Context context, final AttributeSet attrs, final int defStyle) {
super(context, attrs, defStyle);
ThemeUtils.initTextView(this);
}
}

View File

@ -1,57 +0,0 @@
/*
* Twidere - Twitter client for Android
*
* Copyright (C) 2012-2014 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.annotation.TargetApi;
import android.content.Context;
import android.content.res.ColorStateList;
import android.os.Build;
import android.support.v4.graphics.drawable.DrawableCompat;
import android.util.AttributeSet;
import android.widget.Switch;
import org.mariotaku.twidere.util.ThemeUtils;
import org.mariotaku.twidere.view.iface.IThemedView;
public class ThemedSwitch extends Switch implements IThemedView {
public ThemedSwitch(final Context context) {
this(context, null);
}
public ThemedSwitch(final Context context, final AttributeSet attrs) {
super(context, attrs);
ThemeUtils.initTextView(this);
}
@Override
public void setThemeTintColor(ColorStateList color) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
setDrawableTint(color);
}
}
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
private void setDrawableTint(ColorStateList color) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) return;
DrawableCompat.setTintList(getThumbDrawable(), color);
DrawableCompat.setTintList(getTrackDrawable(), color);
}
}

View File

@ -1,50 +0,0 @@
/*
* 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.os.Build;
import android.support.v4.graphics.drawable.DrawableCompat;
import android.support.v7.widget.SwitchCompat;
import android.util.AttributeSet;
import org.mariotaku.twidere.util.ThemeUtils;
import org.mariotaku.twidere.view.iface.IThemedView;
public class ThemedSwitchCompat extends SwitchCompat implements IThemedView {
public ThemedSwitchCompat(final Context context) {
this(context, null);
}
public ThemedSwitchCompat(final Context context, final AttributeSet attrs) {
super(context, attrs);
ThemeUtils.initTextView(this);
}
@Override
public void setThemeTintColor(ColorStateList color) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
DrawableCompat.setTintList(getThumbDrawable(), color);
DrawableCompat.setTintList(getTrackDrawable(), color);
}
}
}

View File

@ -1,53 +0,0 @@
/*
* Twidere - Twitter client for Android
*
* Copyright (C) 2012-2014 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.graphics.Color;
import android.util.AttributeSet;
import android.widget.TextView;
import org.mariotaku.twidere.util.ThemeUtils;
import org.mariotaku.twidere.view.iface.IThemedView;
public class ThemedTextView extends TextView implements IThemedView {
public ThemedTextView(final Context context) {
this(context, null);
}
public ThemedTextView(final Context context, final AttributeSet attrs) {
this(context, attrs, android.R.attr.textViewStyle);
}
public ThemedTextView(final Context context, final AttributeSet attrs, final int defStyle) {
super(context, attrs, defStyle);
ThemeUtils.initTextView(this);
}
@Override
public void setThemeTintColor(ColorStateList color) {
final int linkTextColor = ThemeUtils.getOptimalLinkColor(color.getDefaultColor(), getCurrentTextColor());
final int red = Color.red(linkTextColor), green = Color.green(linkTextColor), blue = Color.blue(linkTextColor);
setLinkTextColor(linkTextColor);
setHighlightColor(Color.argb(0x66, red, green, blue));
}
}

View File

@ -86,7 +86,7 @@
android:color="?android:textColorSecondary" android:color="?android:textColorSecondary"
android:src="@drawable/ic_action_location"/> android:src="@drawable/ic_action_location"/>
<org.mariotaku.twidere.view.themed.ThemedTextView <TextView
android:id="@+id/location_text" android:id="@+id/location_text"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View File

@ -71,7 +71,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<org.mariotaku.twidere.view.TwidereActionMenuView <android.support.v7.widget.ActionMenuView
android:id="@+id/menu_bar" android:id="@+id/menu_bar"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"

View File

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ 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/>.
-->
<org.mariotaku.twidere.view.TintedStatusFrameLayout
android:id="@+id/main_content"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:setPadding="true"/>

View File

@ -69,7 +69,7 @@
android:orientation="horizontal" android:orientation="horizontal"
android:padding="8dp"> android:padding="8dp">
<android.support.v7.internal.widget.TintButton <Button
android:id="@+id/sign_up" android:id="@+id/sign_up"
style="?android:buttonStyleSmall" style="?android:buttonStyleSmall"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -79,7 +79,7 @@
android:onClick="onClick" android:onClick="onClick"
android:text="@string/register"/> android:text="@string/register"/>
<android.support.v7.internal.widget.TintButton <Button
android:id="@+id/sign_in" android:id="@+id/sign_in"
style="?android:buttonStyleSmall" style="?android:buttonStyleSmall"
android:layout_width="match_parent" android:layout_width="match_parent"

View File

@ -98,7 +98,7 @@
android:layout_margin="2dp" android:layout_margin="2dp"
android:contentDescription="@string/profile_image"/> android:contentDescription="@string/profile_image"/>
<org.mariotaku.twidere.view.themed.ThemedTextView <TextView
android:id="@+id/activity_profile_image_more_number" android:id="@+id/activity_profile_image_more_number"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View File

@ -86,7 +86,7 @@
android:layout_margin="2dp" android:layout_margin="2dp"
android:contentDescription="@string/profile_image"/> android:contentDescription="@string/profile_image"/>
<org.mariotaku.twidere.view.themed.ThemedTextView <TextView
android:id="@+id/activity_profile_image_more_number" android:id="@+id/activity_profile_image_more_number"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View File

@ -51,7 +51,7 @@
android:textColor="?android:attr/textColorSecondary" android:textColor="?android:attr/textColorSecondary"
tools:text="@string/sample_status_text"/> tools:text="@string/sample_status_text"/>
<org.mariotaku.twidere.view.themed.ThemedTextView <TextView
android:id="@+id/time" android:id="@+id/time"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View File

@ -59,7 +59,7 @@
tools:src="@drawable/ic_activity_action_retweet" tools:src="@drawable/ic_activity_action_retweet"
tools:visibility="visible"/> tools:visibility="visible"/>
<org.mariotaku.twidere.view.themed.ThemedTextView <TextView
android:id="@+id/reply_retweet_status" android:id="@+id/reply_retweet_status"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -121,7 +121,7 @@
android:gravity="center_vertical" android:gravity="center_vertical"
android:orientation="horizontal"> android:orientation="horizontal">
<org.mariotaku.twidere.view.themed.ThemedTextView <TextView
android:id="@+id/name" android:id="@+id/name"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -131,7 +131,7 @@
android:textStyle="bold" android:textStyle="bold"
tools:text="User"/> tools:text="User"/>
<org.mariotaku.twidere.view.themed.ThemedTextView <TextView
android:id="@+id/screen_name" android:id="@+id/screen_name"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -213,7 +213,7 @@
android:visibility="gone" android:visibility="gone"
tools:visibility="visible"> tools:visibility="visible">
<org.mariotaku.twidere.view.themed.ThemedTextView <TextView
android:id="@+id/quoted_name" android:id="@+id/quoted_name"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -223,7 +223,7 @@
android:textStyle="bold" android:textStyle="bold"
tools:text="User"/> tools:text="User"/>
<org.mariotaku.twidere.view.themed.ThemedTextView <TextView
android:id="@+id/quoted_screen_name" android:id="@+id/quoted_screen_name"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View File

@ -123,7 +123,7 @@
android:gravity="center_vertical" android:gravity="center_vertical"
android:orientation="horizontal"> android:orientation="horizontal">
<org.mariotaku.twidere.view.themed.ThemedTextView <TextView
android:id="@+id/name" android:id="@+id/name"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -133,7 +133,7 @@
android:textStyle="bold" android:textStyle="bold"
tools:text="User"/> tools:text="User"/>
<org.mariotaku.twidere.view.themed.ThemedTextView <TextView
android:id="@+id/screen_name" android:id="@+id/screen_name"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -199,7 +199,7 @@
android:visibility="gone" android:visibility="gone"
tools:visibility="visible"> tools:visibility="visible">
<org.mariotaku.twidere.view.themed.ThemedTextView <TextView
android:id="@+id/quoted_name" android:id="@+id/quoted_name"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -209,7 +209,7 @@
android:textStyle="bold" android:textStyle="bold"
tools:text="User"/> tools:text="User"/>
<org.mariotaku.twidere.view.themed.ThemedTextView <TextView
android:id="@+id/quoted_screen_name" android:id="@+id/quoted_screen_name"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View File

@ -85,7 +85,7 @@
android:orientation="vertical" android:orientation="vertical"
android:paddingLeft="8dp"> android:paddingLeft="8dp">
<org.mariotaku.twidere.view.themed.ThemedTextView <TextView
android:id="@+id/name" android:id="@+id/name"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -95,7 +95,7 @@
android:textStyle="bold" android:textStyle="bold"
tools:text="Name"/> tools:text="Name"/>
<org.mariotaku.twidere.view.themed.ThemedTextView <TextView
android:id="@+id/screen_name" android:id="@+id/screen_name"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -106,7 +106,7 @@
</LinearLayout> </LinearLayout>
</RelativeLayout> </RelativeLayout>
<org.mariotaku.twidere.view.themed.ThemedTextView <TextView
android:id="@+id/description" android:id="@+id/description"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -140,7 +140,7 @@
android:orientation="horizontal" android:orientation="horizontal"
android:padding="8dp"> android:padding="8dp">
<org.mariotaku.twidere.view.themed.ThemedTextView <TextView
android:id="@+id/statuses_count" android:id="@+id/statuses_count"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -150,7 +150,7 @@
android:singleLine="true" android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"/> android:textAppearance="?android:attr/textAppearanceSmall"/>
<org.mariotaku.twidere.view.themed.ThemedTextView <TextView
android:id="@+id/followers_count" android:id="@+id/followers_count"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -160,7 +160,7 @@
android:singleLine="true" android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"/> android:textAppearance="?android:attr/textAppearanceSmall"/>
<org.mariotaku.twidere.view.themed.ThemedTextView <TextView
android:id="@+id/friends_count" android:id="@+id/friends_count"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View File

@ -98,7 +98,7 @@
</LinearLayout> </LinearLayout>
</FrameLayout> </FrameLayout>
<org.mariotaku.twidere.view.themed.ThemedTextView <TextView
android:id="@+id/description" android:id="@+id/description"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -120,7 +120,7 @@
android:singleLine="true" android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"/> android:textAppearance="?android:attr/textAppearanceSmall"/>
<org.mariotaku.twidere.view.themed.ThemedTextView <TextView
android:id="@+id/url" android:id="@+id/url"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -140,7 +140,7 @@
android:orientation="horizontal" android:orientation="horizontal"
android:paddingTop="@dimen/element_spacing_small"> android:paddingTop="@dimen/element_spacing_small">
<org.mariotaku.twidere.view.themed.ThemedTextView <TextView
android:id="@+id/statuses_count" android:id="@+id/statuses_count"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -150,7 +150,7 @@
android:singleLine="true" android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"/> android:textAppearance="?android:attr/textAppearanceSmall"/>
<org.mariotaku.twidere.view.themed.ThemedTextView <TextView
android:id="@+id/followers_count" android:id="@+id/followers_count"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -160,7 +160,7 @@
android:singleLine="true" android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"/> android:textAppearance="?android:attr/textAppearanceSmall"/>
<org.mariotaku.twidere.view.themed.ThemedTextView <TextView
android:id="@+id/friends_count" android:id="@+id/friends_count"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View File

@ -59,7 +59,7 @@
android:orientation="vertical" android:orientation="vertical"
android:paddingLeft="@dimen/element_spacing_normal"> android:paddingLeft="@dimen/element_spacing_normal">
<org.mariotaku.twidere.view.themed.ThemedTextView <TextView
android:id="@+id/name" android:id="@+id/name"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -68,7 +68,7 @@
android:textColor="?android:attr/textColorPrimary" android:textColor="?android:attr/textColorPrimary"
android:textStyle="bold"/> android:textStyle="bold"/>
<org.mariotaku.twidere.view.themed.ThemedTextView <TextView
android:id="@+id/created_by" android:id="@+id/created_by"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -84,7 +84,7 @@
android:layout_height="0.2dp" android:layout_height="0.2dp"
android:background="#40808080"/> android:background="#40808080"/>
<org.mariotaku.twidere.view.themed.ThemedTextView <TextView
android:id="@+id/description" android:id="@+id/description"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -98,7 +98,7 @@
android:orientation="horizontal" android:orientation="horizontal"
android:padding="@dimen/element_spacing_normal"> android:padding="@dimen/element_spacing_normal">
<org.mariotaku.twidere.view.themed.ThemedTextView <TextView
android:id="@+id/members_count" android:id="@+id/members_count"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -108,7 +108,7 @@
android:singleLine="true" android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"/> android:textAppearance="?android:attr/textAppearanceSmall"/>
<org.mariotaku.twidere.view.themed.ThemedTextView <TextView
android:id="@+id/subscribers_count" android:id="@+id/subscribers_count"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View File

@ -87,7 +87,7 @@
</LinearLayout> </LinearLayout>
</FrameLayout> </FrameLayout>
<org.mariotaku.twidere.view.themed.ThemedTextView <TextView
android:id="@+id/description" android:id="@+id/description"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -105,7 +105,7 @@
android:orientation="horizontal" android:orientation="horizontal"
android:paddingTop="@dimen/element_spacing_small"> android:paddingTop="@dimen/element_spacing_small">
<org.mariotaku.twidere.view.themed.ThemedTextView <TextView
android:id="@+id/members_count" android:id="@+id/members_count"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -115,7 +115,7 @@
android:singleLine="true" android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"/> android:textAppearance="?android:attr/textAppearanceSmall"/>
<org.mariotaku.twidere.view.themed.ThemedTextView <TextView
android:id="@+id/subscribers_count" android:id="@+id/subscribers_count"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View File

@ -41,7 +41,7 @@
<requestFocus/> <requestFocus/>
</android.support.v7.widget.RecyclerView> </android.support.v7.widget.RecyclerView>
<org.mariotaku.twidere.view.themed.ThemedMultiAutoCompleteTextView <MultiAutoCompleteTextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:visibility="gone"/> android:visibility="gone"/>

View File

@ -96,7 +96,7 @@
android:focusable="false" android:focusable="false"
android:orientation="vertical"> android:orientation="vertical">
<org.mariotaku.twidere.view.themed.ThemedTextView <TextView
android:id="@+id/name" android:id="@+id/name"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -107,7 +107,7 @@
android:textStyle="bold" android:textStyle="bold"
tools:text="Name"/> tools:text="Name"/>
<org.mariotaku.twidere.view.themed.ThemedTextView <TextView
android:id="@+id/screen_name" android:id="@+id/screen_name"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -124,7 +124,7 @@
android:layout_height="@dimen/element_size_normal" android:layout_height="@dimen/element_size_normal"
android:focusable="false"> android:focusable="false">
<org.mariotaku.twidere.view.TwidereActionMenuView <android.support.v7.widget.ActionMenuView
android:id="@+id/toggle_menu" android:id="@+id/toggle_menu"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"

View File

@ -46,7 +46,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="@dimen/padding_profile_image_detail_page"/> android:layout_margin="@dimen/padding_profile_image_detail_page"/>
<org.mariotaku.twidere.view.themed.ThemedTextView <TextView
android:id="@+id/retweeted_by" android:id="@+id/retweeted_by"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -109,7 +109,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal"> android:orientation="horizontal">
<org.mariotaku.twidere.view.themed.ThemedTextView <TextView
android:id="@+id/name" android:id="@+id/name"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -118,7 +118,7 @@
android:textColor="?android:textColorPrimary" android:textColor="?android:textColorPrimary"
tools:text="Name"/> tools:text="Name"/>
<org.mariotaku.twidere.view.themed.ThemedTextView <TextView
android:id="@+id/screen_name" android:id="@+id/screen_name"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -129,7 +129,7 @@
tools:text="\@username"/> tools:text="\@username"/>
</LinearLayout> </LinearLayout>
<org.mariotaku.twidere.view.themed.ThemedTextView <TextView
android:id="@+id/time_source" android:id="@+id/time_source"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -209,7 +209,7 @@
android:visibility="gone" android:visibility="gone"
tools:visibility="visible"> tools:visibility="visible">
<org.mariotaku.twidere.view.themed.ThemedTextView <TextView
android:id="@+id/quoted_name" android:id="@+id/quoted_name"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -218,7 +218,7 @@
android:textColor="?android:textColorPrimary" android:textColor="?android:textColorPrimary"
tools:text="Name"/> tools:text="Name"/>
<org.mariotaku.twidere.view.themed.ThemedTextView <TextView
android:id="@+id/quoted_screen_name" android:id="@+id/quoted_screen_name"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -334,7 +334,7 @@
android:orientation="horizontal" android:orientation="horizontal"
android:padding="@dimen/element_spacing_normal"> android:padding="@dimen/element_spacing_normal">
<org.mariotaku.twidere.view.themed.ThemedTextView <TextView
android:id="@+id/replies_count" android:id="@+id/replies_count"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -344,7 +344,7 @@
android:textColor="?android:textColorPrimary" android:textColor="?android:textColorPrimary"
tools:text="255"/> tools:text="255"/>
<org.mariotaku.twidere.view.themed.ThemedTextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:singleLine="true" android:singleLine="true"
@ -364,7 +364,7 @@
android:orientation="horizontal" android:orientation="horizontal"
android:padding="@dimen/element_spacing_normal"> android:padding="@dimen/element_spacing_normal">
<org.mariotaku.twidere.view.themed.ThemedTextView <TextView
android:id="@+id/retweets_count" android:id="@+id/retweets_count"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -374,7 +374,7 @@
android:textColor="?android:textColorPrimary" android:textColor="?android:textColorPrimary"
tools:text="255"/> tools:text="255"/>
<org.mariotaku.twidere.view.themed.ThemedTextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:singleLine="true" android:singleLine="true"
@ -394,7 +394,7 @@
android:orientation="horizontal" android:orientation="horizontal"
android:padding="@dimen/element_spacing_normal"> android:padding="@dimen/element_spacing_normal">
<org.mariotaku.twidere.view.themed.ThemedTextView <TextView
android:id="@+id/favorites_count" android:id="@+id/favorites_count"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -404,7 +404,7 @@
android:textColor="?android:textColorPrimary" android:textColor="?android:textColorPrimary"
tools:text="255"/> tools:text="255"/>
<org.mariotaku.twidere.view.themed.ThemedTextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:singleLine="true" android:singleLine="true"
@ -415,7 +415,7 @@
</LinearLayout> </LinearLayout>
<org.mariotaku.twidere.view.TwidereActionMenuView <android.support.v7.widget.ActionMenuView
android:id="@+id/menu_bar" android:id="@+id/menu_bar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="?android:actionBarSize" android:layout_height="?android:actionBarSize"

View File

@ -60,7 +60,7 @@
android:layout_centerInParent="true" android:layout_centerInParent="true"
android:minWidth="48dp"> android:minWidth="48dp">
<android.support.v7.internal.widget.TintButton <Button
android:id="@+id/follow" android:id="@+id/follow"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -87,7 +87,7 @@
android:minHeight="@dimen/element_size_normal" android:minHeight="@dimen/element_size_normal"
android:orientation="vertical"> android:orientation="vertical">
<org.mariotaku.twidere.view.themed.ThemedTextView <TextView
android:id="@+id/name" android:id="@+id/name"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -96,7 +96,7 @@
android:textColor="?android:textColorPrimary" android:textColor="?android:textColorPrimary"
tools:text="Name"/> tools:text="Name"/>
<org.mariotaku.twidere.view.themed.ThemedTextView <TextView
android:id="@+id/screen_name" android:id="@+id/screen_name"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -136,7 +136,7 @@
android:orientation="vertical" android:orientation="vertical"
android:padding="@dimen/element_spacing_small"> android:padding="@dimen/element_spacing_small">
<org.mariotaku.twidere.view.themed.ThemedTextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:padding="@dimen/element_spacing_small" android:padding="@dimen/element_spacing_small"
@ -175,7 +175,7 @@
android:color="?android:textColorPrimary" android:color="?android:textColorPrimary"
android:src="@drawable/ic_action_location"/> android:src="@drawable/ic_action_location"/>
<org.mariotaku.twidere.view.themed.ThemedTextView <TextView
android:id="@+id/location" android:id="@+id/location"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -232,7 +232,7 @@
android:color="?android:textColorPrimary" android:color="?android:textColorPrimary"
android:src="@drawable/ic_action_portal_cake"/> android:src="@drawable/ic_action_portal_cake"/>
<org.mariotaku.twidere.view.themed.ThemedTextView <TextView
android:id="@+id/created_at" android:id="@+id/created_at"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -269,7 +269,7 @@
android:orientation="vertical" android:orientation="vertical"
android:padding="@dimen/element_spacing_small"> android:padding="@dimen/element_spacing_small">
<org.mariotaku.twidere.view.themed.ThemedTextView <TextView
android:id="@+id/followers_count" android:id="@+id/followers_count"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -278,7 +278,7 @@
android:textColor="?android:textColorPrimary" android:textColor="?android:textColorPrimary"
tools:text="255"/> tools:text="255"/>
<org.mariotaku.twidere.view.themed.ThemedTextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:singleLine="true" android:singleLine="true"
@ -298,7 +298,7 @@
android:orientation="vertical" android:orientation="vertical"
android:padding="@dimen/element_spacing_small"> android:padding="@dimen/element_spacing_small">
<org.mariotaku.twidere.view.themed.ThemedTextView <TextView
android:id="@+id/friends_count" android:id="@+id/friends_count"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -307,7 +307,7 @@
android:textColor="?android:textColorPrimary" android:textColor="?android:textColorPrimary"
tools:text="255"/> tools:text="255"/>
<org.mariotaku.twidere.view.themed.ThemedTextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:singleLine="true" android:singleLine="true"
@ -327,7 +327,7 @@
android:orientation="vertical" android:orientation="vertical"
android:padding="@dimen/element_spacing_small"> android:padding="@dimen/element_spacing_small">
<org.mariotaku.twidere.view.themed.ThemedTextView <TextView
android:id="@+id/listed_count" android:id="@+id/listed_count"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -336,7 +336,7 @@
android:textColor="?android:textColorPrimary" android:textColor="?android:textColorPrimary"
tools:text="255"/> tools:text="255"/>
<org.mariotaku.twidere.view.themed.ThemedTextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:singleLine="true" android:singleLine="true"

View File

@ -44,14 +44,14 @@
android:gravity="center_vertical" android:gravity="center_vertical"
android:orientation="vertical"> android:orientation="vertical">
<org.mariotaku.twidere.view.themed.ThemedTextView <TextView
android:id="@+id/list_name" android:id="@+id/list_name"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:singleLine="true" android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceMedium"/> android:textAppearance="?android:attr/textAppearanceMedium"/>
<org.mariotaku.twidere.view.themed.ThemedTextView <TextView
android:id="@+id/created_by" android:id="@+id/created_by"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -76,7 +76,7 @@
android:layout_height="0.2dp" android:layout_height="0.2dp"
android:background="?android:dividerVertical"/> android:background="?android:dividerVertical"/>
<org.mariotaku.twidere.view.themed.ThemedTextView <TextView
android:id="@+id/description" android:id="@+id/description"
tools:text="@string/sample_status_text" tools:text="@string/sample_status_text"
android:layout_width="match_parent" android:layout_width="match_parent"

View File

@ -60,6 +60,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:singleLine="true" android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceMedium" android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="?android:textColorPrimary"
android:textStyle="bold"/> android:textStyle="bold"/>
<TextView <TextView
@ -67,7 +68,8 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:singleLine="true" android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"/> android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:textColorSecondary"/>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>

View File

@ -47,7 +47,7 @@
</org.mariotaku.twidere.view.CardMediaContainer> </org.mariotaku.twidere.view.CardMediaContainer>
<org.mariotaku.twidere.view.themed.ThemedTextView <TextView
android:id="@+id/text" android:id="@+id/text"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -59,7 +59,7 @@
android:textAppearance="?android:textAppearanceSmall" android:textAppearance="?android:textAppearanceSmall"
android:textColor="?android:textColorPrimary"/> android:textColor="?android:textColorPrimary"/>
<org.mariotaku.twidere.view.themed.ThemedTextView <TextView
android:id="@+id/time" android:id="@+id/time"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View File

@ -1,86 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Twidere - Twitter client for Android
~
~ Copyright (C) 2012-2014 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/>.
-->
<org.mariotaku.twidere.view.ColorLabelRelativeLayout
android:id="@+id/account_content"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:descendantFocusability="blocksDescendants"
android:padding="@dimen/element_spacing_small"
app:ignorePadding="true">
<LinearLayout
android:id="@+id/profile_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:gravity="center_vertical"
android:minHeight="?android:listPreferredItemHeightSmall"
android:orientation="horizontal"
android:padding="@dimen/element_spacing_small">
<org.mariotaku.twidere.view.SquareShapedImageView
android:id="@+id/profile_image"
style="?profileImageStyle"
android:layout_width="@dimen/icon_size_list_item_small"
android:layout_height="@dimen/icon_size_list_item_small"
android:layout_weight="0"
android:contentDescription="@string/icon"
android:scaleType="fitCenter"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center_vertical"
android:orientation="vertical"
android:paddingLeft="@dimen/element_spacing_small">
<org.mariotaku.twidere.view.themed.ThemedTextView
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="?android:textAppearanceMedium"
android:textSize="@dimen/accounts_drawer_name_size"/>
<TextView
android:id="@+id/screen_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textSize="@dimen/accounts_drawer_screen_name_size"
android:visibility="gone"/>
</LinearLayout>
<org.mariotaku.twidere.view.themed.ThemedSwitch
android:id="@+id/toggle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"/>
</LinearLayout>
</org.mariotaku.twidere.view.ColorLabelRelativeLayout>

View File

@ -29,7 +29,7 @@
android:minHeight="48dp" android:minHeight="48dp"
android:orientation="horizontal"> android:orientation="horizontal">
<org.mariotaku.twidere.view.themed.ThemedTextView <TextView
android:id="@android:id/title" android:id="@android:id/title"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="48dp" android:layout_height="48dp"

View File

@ -35,7 +35,7 @@
android:layout_weight="0" android:layout_weight="0"
android:scaleType="centerInside"/> android:scaleType="centerInside"/>
<org.mariotaku.twidere.view.themed.ThemedTextView <TextView
android:id="@android:id/text1" android:id="@android:id/text1"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="48dp" android:layout_height="48dp"

View File

@ -99,7 +99,7 @@
android:textColor="?android:attr/textColorSecondary" android:textColor="?android:attr/textColorSecondary"
tools:text="12:00"/> tools:text="12:00"/>
<org.mariotaku.twidere.view.themed.ThemedTextView <TextView
android:id="@+id/text" android:id="@+id/text"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View File

@ -35,7 +35,7 @@
android:orientation="vertical" android:orientation="vertical"
android:paddingRight="@dimen/element_spacing_normal"> android:paddingRight="@dimen/element_spacing_normal">
<org.mariotaku.twidere.view.themed.ThemedTextView <TextView
android:id="@+id/name" android:id="@+id/name"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -46,7 +46,7 @@
android:textStyle="bold" android:textStyle="bold"
tools:text="Sample list"/> tools:text="Sample list"/>
<org.mariotaku.twidere.view.themed.ThemedTextView <TextView
android:id="@+id/created_by" android:id="@+id/created_by"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View File

@ -20,45 +20,16 @@
<resources> <resources>
<style name="Theme.Base" parent="android:Theme.Material"> <style name="Theme.Base" parent="android:Theme.Material"/>
<!--<item name="android:colorPrimary">@color/material_light_blue</item>-->
<!--<item name="android:colorPrimaryDark">@color/material_light_blue_700</item>-->
<!--<item name="android:colorAccent">@color/material_light_blue_a200</item>-->
<item name="android:colorAccent">#ccc</item>
</style>
<style name="Theme.Base.NoActionBar" parent="android:Theme.Material.NoActionBar"> <style name="Theme.Base.NoActionBar" parent="android:Theme.Material.NoActionBar"/>
<!--<item name="android:colorPrimary">@color/material_light_blue</item>-->
<!--<item name="android:colorPrimaryDark">@color/material_light_blue_700</item>-->
<!--<item name="android:colorAccent">@color/material_light_blue_a200</item>-->
<item name="android:colorAccent">#ccc</item>
</style>
<style name="Theme.Base.Dialog" parent="android:Theme.Material.Dialog"> <style name="Theme.Base.Dialog" parent="android:Theme.Material.Dialog"/>
<!--<item name="android:colorPrimary">@color/material_light_blue</item>-->
<!--<item name="android:colorPrimaryDark">@color/material_light_blue_700</item>-->
<!--<item name="android:colorAccent">@color/material_light_blue_a200</item>-->
<item name="android:colorAccent">#ccc</item>
</style>
<style name="Theme.Base.Light" parent="android:Theme.Material.Light"> <style name="Theme.Base.Light" parent="android:Theme.Material.Light"/>
<!--<item name="android:colorPrimary">@color/material_light_blue</item>-->
<!--<item name="android:colorPrimaryDark">@color/material_light_blue_700</item>-->
<!--<item name="android:colorAccent">@color/material_light_blue_a200</item>-->
<item name="android:colorAccent">#aaa</item>
</style>
<style name="Theme.Base.Light.DarkActionBar" parent="android:Theme.Material.Light.DarkActionBar"> <style name="Theme.Base.Light.DarkActionBar" parent="android:Theme.Material.Light.DarkActionBar"/>
<!--<item name="android:colorPrimary">@color/material_light_blue</item>-->
<!--<item name="android:colorPrimaryDark">@color/material_light_blue_700</item>--> <style name="Theme.Base.Light.Dialog" parent="android:Theme.Material.Light.Dialog"/>
<!--<item name="android:colorAccent">@color/material_light_blue_a200</item>-->
<item name="android:colorAccent">#aaa</item>
</style>
<style name="Theme.Base.Light.Dialog" parent="android:Theme.Material.Light.Dialog">
<!--<item name="android:colorPrimary">@color/material_light_blue</item>-->
<!--<item name="android:colorPrimaryDark">@color/material_light_blue_700</item>-->
<!--<item name="android:colorAccent">@color/material_light_blue_a200</item>-->
<item name="android:colorAccent">#aaa</item>
</style>
</resources> </resources>

View File

@ -21,116 +21,47 @@
<resources> <resources>
<style name="Theme.Compat.Base" parent="Theme.AppCompat"> <style name="Theme.Compat.Base" parent="Theme.AppCompat">
<!--<item name="colorPrimary">@color/material_light_blue</item>-->
<!--<item name="colorPrimaryDark">@color/material_light_blue_700</item>-->
<!--<item name="colorAccent">@color/material_light_blue_a200</item>-->
<!-- fix for https://github.com/TwidereProject/Twidere-Android/issues/76-->
<item name="actionModeBackground">?android:colorBackground</item>
<item name="android:textColorTertiary">@color/tertiary_text_mtrl_dark</item> <item name="android:textColorTertiary">@color/tertiary_text_mtrl_dark</item>
<item name="android:textColorTertiaryInverse">@color/tertiary_text_mtrl_light</item> <item name="android:textColorTertiaryInverse">@color/tertiary_text_mtrl_light</item>
</style> </style>
<style name="Theme.Compat.Base.DialogWhenLarge" parent="Theme.AppCompat.DialogWhenLarge"> <style name="Theme.Compat.Base.DialogWhenLarge" parent="Theme.AppCompat.DialogWhenLarge">
<!--<item name="colorPrimary">@color/material_light_blue</item>-->
<!--<item name="colorPrimaryDark">@color/material_light_blue_700</item>-->
<!--<item name="colorAccent">@color/material_light_blue_a200</item>-->
<!-- fix for https://github.com/TwidereProject/Twidere-Android/issues/76-->
<item name="actionModeBackground">?android:colorBackground</item>
<item name="android:textColorTertiary">@color/tertiary_text_mtrl_dark</item> <item name="android:textColorTertiary">@color/tertiary_text_mtrl_dark</item>
<item name="android:textColorTertiaryInverse">@color/tertiary_text_mtrl_light</item> <item name="android:textColorTertiaryInverse">@color/tertiary_text_mtrl_light</item>
</style> </style>
<style name="Theme.Compat.Base.NoActionBar" parent="Theme.AppCompat.NoActionBar"> <style name="Theme.Compat.Base.NoActionBar" parent="Theme.AppCompat.NoActionBar">
<!--<item name="colorPrimary">@color/material_light_blue</item>-->
<!--<item name="colorPrimaryDark">@color/material_light_blue_700</item>-->
<!--<item name="colorAccent">@color/material_light_blue_a200</item>-->
<!-- fix for https://github.com/TwidereProject/Twidere-Android/issues/76-->
<item name="actionModeBackground">?android:colorBackground</item>
<item name="android:textColorTertiary">@color/tertiary_text_mtrl_dark</item> <item name="android:textColorTertiary">@color/tertiary_text_mtrl_dark</item>
<item name="android:textColorTertiaryInverse">@color/tertiary_text_mtrl_light</item> <item name="android:textColorTertiaryInverse">@color/tertiary_text_mtrl_light</item>
</style> </style>
<style name="Theme.Compat.Base.Dialog" parent="Theme.AppCompat.Dialog"> <style name="Theme.Compat.Base.Dialog" parent="Theme.AppCompat.Dialog">
<!--<item name="colorPrimary">@color/material_light_blue</item>-->
<!--<item name="colorPrimaryDark">@color/material_light_blue_700</item>-->
<!--<item name="colorAccent">@color/material_light_blue_a200</item>-->
<!-- fix for https://github.com/TwidereProject/Twidere-Android/issues/76-->
<item name="actionModeBackground">?android:colorBackground</item>
<item name="android:textColorTertiary">@color/tertiary_text_mtrl_dark</item> <item name="android:textColorTertiary">@color/tertiary_text_mtrl_dark</item>
<item name="android:textColorTertiaryInverse">@color/tertiary_text_mtrl_light</item> <item name="android:textColorTertiaryInverse">@color/tertiary_text_mtrl_light</item>
</style> </style>
<style name="Theme.Compat.Base.Light" parent="Theme.AppCompat.Light"> <style name="Theme.Compat.Base.Light" parent="Theme.AppCompat.Light">
<!--<item name="colorPrimary">@color/material_light_blue</item>-->
<!--<item name="colorPrimaryDark">@color/material_light_blue_700</item>-->
<!--<item name="colorAccent">@color/material_light_blue_a200</item>-->
<!-- fix for https://github.com/TwidereProject/Twidere-Android/issues/76-->
<item name="actionModeBackground">?android:colorBackground</item>
<item name="android:textColorTertiary">@color/tertiary_text_mtrl_light</item> <item name="android:textColorTertiary">@color/tertiary_text_mtrl_light</item>
<item name="android:textColorTertiaryInverse">@color/tertiary_text_mtrl_dark</item> <item name="android:textColorTertiaryInverse">@color/tertiary_text_mtrl_dark</item>
</style> </style>
<style name="Theme.Compat.Base.Light.DialogWhenLarge" parent="Theme.AppCompat.Light.DialogWhenLarge"> <style name="Theme.Compat.Base.Light.DialogWhenLarge" parent="Theme.AppCompat.Light.DialogWhenLarge">
<!--<item name="colorPrimary">@color/material_light_blue</item>-->
<!--<item name="colorPrimaryDark">@color/material_light_blue_700</item>-->
<!--<item name="colorAccent">@color/material_light_blue_a200</item>-->
<!-- fix for https://github.com/TwidereProject/Twidere-Android/issues/76-->
<item name="actionModeBackground">?android:colorBackground</item>
<item name="android:textColorTertiary">@color/tertiary_text_mtrl_light</item> <item name="android:textColorTertiary">@color/tertiary_text_mtrl_light</item>
<item name="android:textColorTertiaryInverse">@color/tertiary_text_mtrl_dark</item> <item name="android:textColorTertiaryInverse">@color/tertiary_text_mtrl_dark</item>
</style> </style>
<style name="Theme.Compat.Base.Light.DarkActionBar" parent="Theme.AppCompat.Light.DarkActionBar"> <style name="Theme.Compat.Base.Light.DarkActionBar" parent="Theme.AppCompat.Light.DarkActionBar">
<!--<item name="colorPrimary">@color/material_light_blue</item>-->
<!--<item name="colorPrimaryDark">@color/material_light_blue_700</item>-->
<!--<item name="colorAccent">@color/material_light_blue_a200</item>-->
<!-- fix for https://github.com/TwidereProject/Twidere-Android/issues/76-->
<item name="actionModeBackground">?android:colorBackground</item>
<item name="android:textColorTertiary">@color/tertiary_text_mtrl_light</item> <item name="android:textColorTertiary">@color/tertiary_text_mtrl_light</item>
<item name="android:textColorTertiaryInverse">@color/tertiary_text_mtrl_dark</item> <item name="android:textColorTertiaryInverse">@color/tertiary_text_mtrl_dark</item>
</style> </style>
<style name="Theme.Compat.Base.Light.NoActionBar" parent="Theme.AppCompat.Light.NoActionBar"> <style name="Theme.Compat.Base.Light.NoActionBar" parent="Theme.AppCompat.Light.NoActionBar">
<!--<item name="colorPrimary">@color/material_light_blue</item>-->
<!--<item name="colorPrimaryDark">@color/material_light_blue_700</item>-->
<!--<item name="colorAccent">@color/material_light_blue_a200</item>-->
<!-- fix for https://github.com/TwidereProject/Twidere-Android/issues/76-->
<item name="actionModeBackground">?android:colorBackground</item>
<item name="android:textColorTertiary">@color/tertiary_text_mtrl_light</item> <item name="android:textColorTertiary">@color/tertiary_text_mtrl_light</item>
<item name="android:textColorTertiaryInverse">@color/tertiary_text_mtrl_dark</item> <item name="android:textColorTertiaryInverse">@color/tertiary_text_mtrl_dark</item>
</style> </style>
<style name="Theme.Compat.Base.Light.Dialog" parent="Theme.AppCompat.Light.Dialog"> <style name="Theme.Compat.Base.Light.Dialog" parent="Theme.AppCompat.Light.Dialog">
<!--<item name="colorPrimary">@color/material_light_blue</item>-->
<!--<item name="colorPrimaryDark">@color/material_light_blue_700</item>-->
<!--<item name="colorAccent">@color/material_light_blue_a200</item>-->
<!-- fix for https://github.com/TwidereProject/Twidere-Android/issues/76-->
<item name="actionModeBackground">?android:colorBackground</item>
<item name="android:textColorTertiary">@color/tertiary_text_mtrl_light</item> <item name="android:textColorTertiary">@color/tertiary_text_mtrl_light</item>
<item name="android:textColorTertiaryInverse">@color/tertiary_text_mtrl_dark</item> <item name="android:textColorTertiaryInverse">@color/tertiary_text_mtrl_dark</item>
</style> </style>