theme color fixes
This commit is contained in:
parent
4122992df5
commit
a5901eaab8
|
@ -64,9 +64,11 @@ import org.mariotaku.twidere.util.dagger.ApplicationModule;
|
|||
import org.mariotaku.twidere.util.dagger.DependencyHolder;
|
||||
import org.mariotaku.twidere.util.net.TwidereDns;
|
||||
import org.mariotaku.twidere.util.theme.ActionBarContextViewViewProcessor;
|
||||
import org.mariotaku.twidere.util.theme.ExtendedSwipeRefreshLayoutViewProcessor;
|
||||
import org.mariotaku.twidere.util.theme.FloatingActionButtonViewProcessor;
|
||||
import org.mariotaku.twidere.util.theme.TabPagerIndicatorViewProcessor;
|
||||
import org.mariotaku.twidere.view.TabPagerIndicator;
|
||||
import org.mariotaku.twidere.view.themed.ExtendedSwipeRefreshLayout;
|
||||
|
||||
public class TwidereApplication extends Application implements Constants,
|
||||
OnSharedPreferenceChangeListener {
|
||||
|
@ -127,6 +129,7 @@ public class TwidereApplication extends Application implements Constants,
|
|||
ATE.registerViewProcessor(TabPagerIndicator.class, new TabPagerIndicatorViewProcessor());
|
||||
ATE.registerViewProcessor(FloatingActionButton.class, new FloatingActionButtonViewProcessor());
|
||||
ATE.registerViewProcessor(ActionBarContextView.class, new ActionBarContextViewViewProcessor());
|
||||
ATE.registerViewProcessor(ExtendedSwipeRefreshLayout.class, new ExtendedSwipeRefreshLayoutViewProcessor());
|
||||
final SharedPreferences preferences = getSharedPreferences();
|
||||
if (!ATE.config(this, null).isConfigured()) {
|
||||
final int themeColor = preferences.getInt(KEY_THEME_COLOR, ContextCompat.getColor(this,
|
||||
|
|
|
@ -49,7 +49,7 @@ import org.mariotaku.twidere.util.TwidereColorUtils;
|
|||
import org.mariotaku.twidere.util.Utils;
|
||||
import org.mariotaku.twidere.view.HeaderDrawerLayout;
|
||||
import org.mariotaku.twidere.view.iface.IExtendedView;
|
||||
import org.mariotaku.twidere.view.themed.AccentSwipeRefreshLayout;
|
||||
import org.mariotaku.twidere.view.themed.ExtendedSwipeRefreshLayout;
|
||||
|
||||
/**
|
||||
* Created by mariotaku on 15/10/26.
|
||||
|
@ -225,8 +225,8 @@ public abstract class AbsContentRecyclerViewFragment<A extends LoadMoreSupportAd
|
|||
mLayoutManager = onCreateLayoutManager(context);
|
||||
mRecyclerView.setLayoutManager(mLayoutManager);
|
||||
mRecyclerView.setHasFixedSize(true);
|
||||
if (mSwipeRefreshLayout instanceof AccentSwipeRefreshLayout) {
|
||||
((AccentSwipeRefreshLayout) mSwipeRefreshLayout).setTouchInterceptor(new IExtendedView.TouchInterceptor() {
|
||||
if (mSwipeRefreshLayout instanceof ExtendedSwipeRefreshLayout) {
|
||||
((ExtendedSwipeRefreshLayout) mSwipeRefreshLayout).setTouchInterceptor(new IExtendedView.TouchInterceptor() {
|
||||
@Override
|
||||
public boolean dispatchTouchEvent(View view, MotionEvent event) {
|
||||
return false;
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
package org.mariotaku.twidere.util.theme;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.annotation.NonNull;
|
||||
|
||||
import com.afollestad.appthemeengine.Config;
|
||||
import com.afollestad.appthemeengine.viewprocessors.ViewProcessor;
|
||||
|
||||
import org.mariotaku.twidere.view.themed.ExtendedSwipeRefreshLayout;
|
||||
|
||||
/**
|
||||
* Created by mariotaku on 16/3/18.
|
||||
*/
|
||||
public class ExtendedSwipeRefreshLayoutViewProcessor implements ViewProcessor<ExtendedSwipeRefreshLayout, Object> {
|
||||
@Override
|
||||
public void process(@NonNull Context context, String key, ExtendedSwipeRefreshLayout target, Object extra) {
|
||||
target.setColorSchemeColors(Config.accentColor(context, key));
|
||||
}
|
||||
}
|
|
@ -20,7 +20,6 @@
|
|||
package org.mariotaku.twidere.view.themed;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.Rect;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.widget.SwipeRefreshLayout;
|
||||
|
@ -28,30 +27,24 @@ import android.util.AttributeSet;
|
|||
import android.view.MotionEvent;
|
||||
|
||||
import org.mariotaku.twidere.view.iface.IExtendedView;
|
||||
import org.mariotaku.twidere.view.iface.IThemeAccentView;
|
||||
|
||||
/**
|
||||
* Created by mariotaku on 15/4/25.
|
||||
*/
|
||||
public class AccentSwipeRefreshLayout extends SwipeRefreshLayout implements IThemeAccentView, IExtendedView {
|
||||
public class ExtendedSwipeRefreshLayout extends SwipeRefreshLayout implements IExtendedView {
|
||||
|
||||
private TouchInterceptor mTouchInterceptor;
|
||||
private OnSizeChangedListener mOnSizeChangedListener;
|
||||
private OnFitSystemWindowsListener mOnFitSystemWindowsListener;
|
||||
|
||||
public AccentSwipeRefreshLayout(Context context, AttributeSet attrs) {
|
||||
public ExtendedSwipeRefreshLayout(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
public AccentSwipeRefreshLayout(Context context) {
|
||||
public ExtendedSwipeRefreshLayout(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAccentTintColor(@NonNull ColorStateList color) {
|
||||
setColorSchemeColors(color.getDefaultColor());
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean dispatchTouchEvent(@NonNull final MotionEvent event) {
|
||||
if (mTouchInterceptor != null) {
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
<include layout="@layout/layout_content_fragment_common"/>
|
||||
|
||||
<org.mariotaku.twidere.view.themed.AccentSwipeRefreshLayout
|
||||
<org.mariotaku.twidere.view.themed.ExtendedSwipeRefreshLayout
|
||||
android:id="@+id/swipe_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
@ -42,5 +42,5 @@
|
|||
android:focusable="true"
|
||||
android:listSelector="?selectableItemBackground"/>
|
||||
|
||||
</org.mariotaku.twidere.view.themed.AccentSwipeRefreshLayout>
|
||||
</org.mariotaku.twidere.view.themed.ExtendedSwipeRefreshLayout>
|
||||
</FrameLayout>
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
<include layout="@layout/layout_content_fragment_common"/>
|
||||
|
||||
<org.mariotaku.twidere.view.themed.AccentSwipeRefreshLayout
|
||||
<org.mariotaku.twidere.view.themed.ExtendedSwipeRefreshLayout
|
||||
android:id="@+id/swipe_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
@ -39,5 +39,5 @@
|
|||
android:focusable="true"
|
||||
android:scrollbars="vertical"/>
|
||||
|
||||
</org.mariotaku.twidere.view.themed.AccentSwipeRefreshLayout>
|
||||
</org.mariotaku.twidere.view.themed.ExtendedSwipeRefreshLayout>
|
||||
</FrameLayout>
|
|
@ -33,8 +33,8 @@
|
|||
<color name="branding_color">@color/material_cyan</color>
|
||||
<color name="bg_color_tab_pressed">#40808080</color>
|
||||
<color name="bg_color_media_viewer">#cc000000</color>
|
||||
<color name="background_color_card_item_dark">#303030</color>
|
||||
<color name="background_color_card_item_light">#fafafa</color>
|
||||
<color name="background_color_card_item_dark">#424242</color>
|
||||
<color name="background_color_card_item_light">#ffffff</color>
|
||||
<color name="background_color_action_bar_dark">#212121</color>
|
||||
<color name="bg_color_video_playback_progress">#A0000000</color>
|
||||
<color name="drawer_banner_foreground">#80000000</color>
|
||||
|
|
Loading…
Reference in New Issue