• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java ThemeUtils类的典型用法和代码示例

java 2次浏览

本文整理汇总了Java中com.bilibili.magicasakura.utils.ThemeUtils的典型用法代码示例。如果您正苦于以下问题:Java ThemeUtils类的具体用法?Java ThemeUtils怎么用?Java ThemeUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

ThemeUtils类属于com.bilibili.magicasakura.utils包,在下文中一共展示了ThemeUtils类的24个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: onConfirm

点赞 3

import com.bilibili.magicasakura.utils.ThemeUtils; //导入依赖的package包/类
@Override
public void onConfirm(int currentTheme) {
    if (ThemeHelper.getTheme(RxBaseActivity.this) != currentTheme){
        ThemeHelper.setTheme(RxBaseActivity.this, currentTheme);
        ThemeUtils.refreshUI(RxBaseActivity.this, new ThemeUtils.ExtraRefreshable() {
            @Override
            public void refreshGlobal(Activity activity) {
                RxBaseActivity context = RxBaseActivity.this;
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
                    ActivityManager.TaskDescription taskDescription = new ActivityManager
                            .TaskDescription(null, null, ThemeUtils.getThemeAttrColor(context, android.R.attr.colorPrimary));
                    setTaskDescription(taskDescription);
                    getWindow().setStatusBarColor(ThemeUtils.getColorById(context, R.color.theme_color_primary_dark));
                }
            }

            @Override
            public void refreshSpecificView(View view) {

            }
        });
    }
}
 

开发者ID:MUFCRyan,
项目名称:BilibiliClient,
代码行数:24,
代码来源:RxBaseActivity.java

示例2: onConfirm

点赞 3

import com.bilibili.magicasakura.utils.ThemeUtils; //导入依赖的package包/类
@Override public void onConfirm(int currentTheme) {
    if (ThemeHelper.getTheme() != currentTheme) {
        ThemeHelper.setTheme(currentTheme);
        ThemeUtils.refreshUI(mContext, new ExtraRefreshable() {
            @Override public void refreshGlobal(Activity activity) {
                if (VERSION.SDK_INT >= 21) {
                    mContext.getWindow().setStatusBarColor(ThemeUtils.getColorById(mContext,R.color.theme_color_primary_dark));
                }
            }
            @Override public void refreshSpecificView(View view) {
                mContext.findViewById(R.id.BottomNavigation)
                    .setBackgroundColor(
                        ThemeUtils.getColorById(mContext, R.color.theme_color_primary));
            }
        });
    }
}
 

开发者ID:wavever,
项目名称:GankLock,
代码行数:18,
代码来源:MoreFragment.java

示例3: init

点赞 2

import com.bilibili.magicasakura.utils.ThemeUtils; //导入依赖的package包/类
private void init() {
    // 初始化主题切换
    ThemeUtils.setSwitchColor(this);
    //初始化Leak内存泄露检测工具
    LeakCanary.install(this);
    //初始化Stetho调试工具
    Stetho.initialize(
            Stetho.newInitializerBuilder(this)
                    .enableDumpapp(Stetho.defaultDumperPluginsProvider(this))
                    .enableWebKitInspector(Stetho.defaultInspectorModulesProvider(this))
                    .build());
}
 

开发者ID:WeDevelopTeam,
项目名称:HeroVideo-master,
代码行数:13,
代码来源:HeroVideoApp.java

示例4: initStatusBar

点赞 2

import com.bilibili.magicasakura.utils.ThemeUtils; //导入依赖的package包/类
protected void initStatusBar(){
    if (Build.VERSION.SDK_INT >= 21) {
        Window window = getWindow();
        window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
        window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        window.setStatusBarColor(ThemeUtils.getColorById(this, R.color.theme_color_primary));
        ActivityManager.TaskDescription description = new ActivityManager.TaskDescription(null, null, ThemeUtils.getThemeAttrColor(this, android.R.attr.colorPrimary));
        setTaskDescription(description);
    }
}
 

开发者ID:WeDevelopTeam,
项目名称:HeroVideo-master,
代码行数:11,
代码来源:RxBaseActivity.java

示例5: onConfirm

点赞 2

import com.bilibili.magicasakura.utils.ThemeUtils; //导入依赖的package包/类
@Override
public void onConfirm(int currentTheme) {
    LogUtil.d("onConfirm = " + currentTheme);

    if (ThemeHelper.getTheme(RxBaseActivity.this) != currentTheme) {
        ThemeHelper.setTheme(RxBaseActivity.this, currentTheme);
        ThemeUtils.refreshUI(RxBaseActivity.this, new ThemeUtils.ExtraRefreshable() {
                    @Override
                    public void refreshGlobal(Activity activity) {
                        //for global setting, just do once
                        if (Build.VERSION.SDK_INT >= 21) {
                            final RxBaseActivity context = RxBaseActivity.this;
                            ActivityManager.TaskDescription taskDescription = new ActivityManager.TaskDescription(null, null, ThemeUtils.getThemeAttrColor(context, android.R.attr.colorPrimary));
                            setTaskDescription(taskDescription);
                            getWindow().setStatusBarColor(ThemeUtils.getColorById(context, R.color.theme_color_primary));
                        }
                        // post主题切换的消息,方便Fragment等完成主题切换
                        mRxBaseViewPresenter.onGlobalThemeChange();
                    }

                    @Override
                    public void refreshSpecificView(View view) {
                        //TODO: will do this for each traversal
                        // post主题切换的消息
                        mRxBaseViewPresenter.onSpecificThemeChange(view);
                    }
                }
        );
    }


}
 

开发者ID:WeDevelopTeam,
项目名称:HeroVideo-master,
代码行数:33,
代码来源:RxBaseActivity.java

示例6: onThemeChange

点赞 2

import com.bilibili.magicasakura.utils.ThemeUtils; //导入依赖的package包/类
@Override
public void onThemeChange(ThemeChangeEvent themeChangeEvent) {
    super.onThemeChange(themeChangeEvent);
    switch (themeChangeEvent.eventType) {
        case ThemeChangeEvent.GLOBLE_CHANGE:
        case ThemeChangeEvent.INIT_CHANGE:
            mBtnTest2.setBackgroundColor(ThemeUtils.getColorById(getActivity(), R.color.theme_color_primary));
            break;
    }

}
 

开发者ID:WeDevelopTeam,
项目名称:HeroVideo-master,
代码行数:12,
代码来源:TestFragment.java

示例7: onConfirm

点赞 2

import com.bilibili.magicasakura.utils.ThemeUtils; //导入依赖的package包/类
@Override
public void onConfirm(int currentTheme) {

  if (ThemeHelper.getTheme(RxBaseActivity.this) != currentTheme) {
    ThemeHelper.setTheme(RxBaseActivity.this, currentTheme);
    ThemeUtils.refreshUI(RxBaseActivity.this, new ThemeUtils.ExtraRefreshable() {

          @Override
          public void refreshGlobal(Activity activity) {

            if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
              final RxBaseActivity context = RxBaseActivity.this;
              ActivityManager.TaskDescription taskDescription = new ActivityManager.TaskDescription(
                  null,
                  null, ThemeUtils.getThemeAttrColor(context, android.R.attr.colorPrimary));
              setTaskDescription(taskDescription);
              getWindow().setStatusBarColor(ThemeUtils.getColorById(context,
                  R.color.theme_color_primary_dark));
            }
          }


          @Override
          public void refreshSpecificView(View view) {

          }
        }
    );
  }
}
 

开发者ID:MUFCRyan,
项目名称:BilibiliClient,
代码行数:31,
代码来源:RxBaseActivity.java

示例8: onPostCreate

点赞 2

import com.bilibili.magicasakura.utils.ThemeUtils; //导入依赖的package包/类
@Override
public void onPostCreate(Bundle savedInstanceState, PersistableBundle persistentState) {

  super.onPostCreate(savedInstanceState);
  if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
    Window window = getWindow();
    window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
    window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
    window.setStatusBarColor(ThemeUtils.getColorById(this, R.color.theme_color_primary_dark));
    ActivityManager.TaskDescription description = new ActivityManager.TaskDescription(null, null,
        ThemeUtils.getThemeAttrColor(this, android.R.attr.colorPrimary));
    setTaskDescription(description);
  }
}
 

开发者ID:MUFCRyan,
项目名称:BilibiliClient,
代码行数:15,
代码来源:RxBaseActivity.java

示例9: init

点赞 2

import com.bilibili.magicasakura.utils.ThemeUtils; //导入依赖的package包/类
private void init() {
  // 初始化主题切换
  ThemeUtils.setSwitchColor(this);
  //初始化Leak内存泄露检测工具
  LeakCanary.install(this);
  //初始化Stetho调试工具
  Stetho.initialize(
      Stetho.newInitializerBuilder(this)
          .enableDumpapp(Stetho.defaultDumperPluginsProvider(this))
          .enableWebKitInspector(Stetho.defaultInspectorModulesProvider(this))
          .build());
}
 

开发者ID:MUFCRyan,
项目名称:BilibiliClient,
代码行数:13,
代码来源:BilibiliApp.java

示例10: onPostCreate

点赞 2

import com.bilibili.magicasakura.utils.ThemeUtils; //导入依赖的package包/类
@Override
public void onPostCreate(@Nullable Bundle savedInstanceState, @Nullable PersistableBundle persistentState) {
    super.onPostCreate(savedInstanceState, persistentState);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        Window window = getWindow();
        window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
        window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        window.setStatusBarColor(ThemeUtils.getColorById(this, R.color.theme_color_primary_dark));
        ActivityManager.TaskDescription taskDescription = new ActivityManager.TaskDescription
                (null, null, ThemeUtils.getThemeAttrColor(this, android.R.attr.colorPrimary));
        setTaskDescription(taskDescription);
    }
}
 

开发者ID:MUFCRyan,
项目名称:BilibiliClient,
代码行数:14,
代码来源:RxBaseActivity.java

示例11: init

点赞 2

import com.bilibili.magicasakura.utils.ThemeUtils; //导入依赖的package包/类
private void init() {
    ThemeUtils.setSwitchColor(this); // 初始化主题切换
    LeakCanary.install(this);
    Stetho.initialize(Stetho.newInitializerBuilder(this)
                    .enableDumpapp(Stetho.defaultDumperPluginsProvider(this))
                    .enableWebKitInspector(Stetho.defaultInspectorModulesProvider(this))
                    .build());
}
 

开发者ID:MUFCRyan,
项目名称:BilibiliClient,
代码行数:9,
代码来源:BilibiliApp.java

示例12: setDrawableTintList

点赞 2

import com.bilibili.magicasakura.utils.ThemeUtils; //导入依赖的package包/类
public void setDrawableTintList(ColorStateList origin) {
    ColorStateList tint = ThemeUtils.getThemeColorStateList(mSwitchCompat.getContext(), origin);
    if (mTintInfo == null) {
        mTintInfo = new TintInfo();
    }
    mTintInfo.mHasTintList = true;
    mTintInfo.mTintList = tint;
    applySupportDrawableTint();
}
 

开发者ID:Bilibili,
项目名称:MagicaSakura,
代码行数:10,
代码来源:AppCompatSwitchHelper.java

示例13: drawableStateChanged

点赞 2

import com.bilibili.magicasakura.utils.ThemeUtils; //导入依赖的package包/类
@Override
protected void drawableStateChanged() {
    super.drawableStateChanged();
    if (ThemeUtils.isSkipAnimatedSelector()) {
        Drawable drawable = CompoundButtonCompat.getButtonDrawable(this);
        try {
            if (ThemeUtils.getWrapperDrawable(drawable) instanceof AnimatedStateListDrawable) {
                drawable.jumpToCurrentState();
            }
        } catch (NoClassDefFoundError error) {
            error.printStackTrace();
        }
    }
}
 

开发者ID:Bilibili,
项目名称:MagicaSakura,
代码行数:15,
代码来源:TintRadioButton.java

示例14: TintAppAlertDialogDividingView

点赞 2

import com.bilibili.magicasakura.utils.ThemeUtils; //导入依赖的package包/类
public TintAppAlertDialogDividingView(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    TypedArray a = context.obtainStyledAttributes(attrs, TINT_ATTRS);
    if (a.hasValue(0)) {
        if (a.getResourceId(0, 0) == android.R.color.holo_blue_light) {
            setBackgroundColor(ThemeUtils.getThemeAttrColor(context, R.attr.themeColorSecondary));
        }
    }
}
 

开发者ID:Bilibili,
项目名称:MagicaSakura,
代码行数:10,
代码来源:TintAppAlertDialogDividingView.java

示例15: onPostCreate

点赞 2

import com.bilibili.magicasakura.utils.ThemeUtils; //导入依赖的package包/类
@Override
protected void onPostCreate(@Nullable Bundle savedInstanceState) {
    super.onPostCreate(savedInstanceState);
    if (Build.VERSION.SDK_INT >= 21) {
        Window window = getWindow();
        window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
        window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        window.setStatusBarColor(ThemeUtils.getColorById(this, R.color.theme_color_primary_dark));
        ActivityManager.TaskDescription description = new ActivityManager.TaskDescription(null, null,
                ThemeUtils.getThemeAttrColor(this, android.R.attr.colorPrimary));
        setTaskDescription(description);
    }
}
 

开发者ID:Bilibili,
项目名称:MagicaSakura,
代码行数:14,
代码来源:MainActivity.java

示例16: onCreate

点赞 2

import com.bilibili.magicasakura.utils.ThemeUtils; //导入依赖的package包/类
@Override public void onCreate() {
    super.onCreate();
    context = getApplicationContext();
    if (PreferenceUtil.getBoolean(Config.GANK_LOCK_IS_OPEN)) {
        context.startService(new Intent(context, LockService.class));
    }
    ThemeUtils.setSwitchColor(this);
    Bugtags.start("9201c17d6c7e7073dbf19f42bceb5f0e", this, Bugtags.BTGInvocationEventNone);
}
 

开发者ID:wavever,
项目名称:GankLock,
代码行数:10,
代码来源:MyApplication.java

示例17: refreshTheme

点赞 2

import com.bilibili.magicasakura.utils.ThemeUtils; //导入依赖的package包/类
private void refreshTheme(CheckBox s) {
    final Context context = s.getContext();
    if (mThemeId == ThemeHelper.CARD_NIGHT) {
        mThemeId = ThemeHelper.CARD_SAKURA;
        ThemeHelper.setTheme(context, ThemeHelper.CARD_SAKURA);
        ThemeUtils.updateNightMode(context.getResources(), false);
        s.setChecked(false);
    } else {
        mThemeId = ThemeHelper.CARD_NIGHT;
        ThemeHelper.setTheme(context, ThemeHelper.CARD_NIGHT);
        ThemeUtils.updateNightMode(context.getResources(), true);
        s.setChecked(true);
    }
    ThemeUtils.refreshUI(context, new ThemeUtils.ExtraRefreshable() {
        @Override
        public void refreshGlobal(Activity activity) {
            if (Build.VERSION.SDK_INT >= 21) {
                Window window = activity.getWindow();
                window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
                window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
                window.setStatusBarColor(ThemeUtils.getColorById(activity, R.color.theme_color_primary_dark));
                ActivityManager.TaskDescription description = new ActivityManager.TaskDescription(null, null, ThemeUtils.getThemeAttrColor(activity, android.R.attr.colorPrimary));
                activity.setTaskDescription(description);
            }
        }

        @Override
        public void refreshSpecificView(View view) {

        }
    });
}
 

开发者ID:succlz123,
项目名称:S1-Go,
代码行数:33,
代码来源:MyRvAdapter.java

示例18: onGlobalThemeChange

点赞 2

import com.bilibili.magicasakura.utils.ThemeUtils; //导入依赖的package包/类
@Override
public void onGlobalThemeChange() {
    mSlidingTab.setBackgroundColor(ThemeUtils.getColorById(getActivity(),R.color.theme_color_primary));
}
 

开发者ID:WeDevelopTeam,
项目名称:HeroVideo-master,
代码行数:5,
代码来源:HomePageFragment.java

示例19: onGlobalThemeChange

点赞 2

import com.bilibili.magicasakura.utils.ThemeUtils; //导入依赖的package包/类
@Override
public void onGlobalThemeChange() {
    super.onGlobalThemeChange();
    mSwipeRefreshLayout.setColorSchemeColors(ThemeUtils.getColorById(getActivity(),R.color.theme_color_primary));
}
 

开发者ID:WeDevelopTeam,
项目名称:HeroVideo-master,
代码行数:6,
代码来源:HomeRecommendFragment.java

示例20: setBackgroundColor

点赞 2

import com.bilibili.magicasakura.utils.ThemeUtils; //导入依赖的package包/类
public void setBackgroundColor(int color) {
    if (skipNextApply()) return;

    resetTintResource(0);
    mView.setBackgroundColor(ThemeUtils.getColor(mView.getContext(), color));
}
 

开发者ID:Bilibili,
项目名称:MagicaSakura,
代码行数:7,
代码来源:AppCompatBackgroundHelper.java

示例21: recoverPadding

点赞 2

import com.bilibili.magicasakura.utils.ThemeUtils; //导入依赖的package包/类
private void recoverPadding(Drawable background) {
    if (ThemeUtils.containsNinePatch(background) && hasPadding()) {
        mView.setPadding(mPaddingLeft, mPaddingTop, mPaddingRight, mPaddingBottom);
    }
}
 

开发者ID:Bilibili,
项目名称:MagicaSakura,
代码行数:6,
代码来源:AppCompatBackgroundHelper.java

示例22: onCreate

点赞 2

import com.bilibili.magicasakura.utils.ThemeUtils; //导入依赖的package包/类
@Override
public void onCreate() {
    super.onCreate();
    ThemeUtils.setSwitchColor(this);
}
 

开发者ID:Bilibili,
项目名称:MagicaSakura,
代码行数:6,
代码来源:MyApplication.java

示例23: onCreate

点赞 2

import com.bilibili.magicasakura.utils.ThemeUtils; //导入依赖的package包/类
@Override
    public void onCreate() {
        super.onCreate();
        if (LeakCanary.isInAnalyzerProcess(this)) {
            return;
        }
        sInstance = this;
        registerActivityLifecycleCallbacks(new MainActivityLifecycleCallback());
        refWatcher = LeakCanary.install(this);

        ImagePipelineConfig build = ImagePipelineConfig.newBuilder(this).setDownsampleEnabled(true).build();
        Fresco.initialize(this, build);
        CrashHelper.init(this);

        ImageLoader.init();
        ThemeUtils.setSwitchColor(this);

        Observable.fromCallable(new Callable<UserInfo.Variables>() {
            @Override
            public UserInfo.Variables call() throws Exception {
//                S1Emoticon.initEmoticon();
                CrashReport.initCrashReport(MainApplication.getInstance(), "900017373", BuildConfig.DEBUG);
                return getUserInfo();
            }
        }).subscribeOn(Schedulers.io()).subscribe(new Action1<UserInfo.Variables>() {
            @Override
            public void call(UserInfo.Variables variables) {
                if (variables != null) {
                    Observable<UserInfo> observable = RetrofitManager.apiService().login(variables.member_username, variables.password);
                    observable.subscribeOn(Schedulers.io())
                            .observeOn(AndroidSchedulers.mainThread())
                            .subscribe(new Action1<UserInfo>() {
                                @Override
                                public void call(UserInfo loginInfo) {
                                    String messageVal = loginInfo.Message.messageval;
                                    if ((TextUtils.equals(messageVal, BuildConfig.LOGIN_SUCCEED))) {
                                        loginInfo.Variables.password = getUserInfo().password;
                                        MainApplication.getInstance().addUserInfo(loginInfo);
                                    } else if ((TextUtils.equals(messageVal, BuildConfig.LOGIN_FAILED))) {
                                        logout();
                                    }
                                }
                            }, new Action1<Throwable>() {
                                @Override
                                public void call(Throwable throwable) {
                                    logout();
                                }
                            });
                }
            }
        });
        BlockAnalyzer.install(this);
    }
 

开发者ID:succlz123,
项目名称:S1-Go,
代码行数:54,
代码来源:MainApplication.java

示例24: onCreate

点赞 2

import com.bilibili.magicasakura.utils.ThemeUtils; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    ensureToolbar();
    setTitle(R.string.app_name);
    getToolbar().setTitleMarginStart(MyUtils.dip2px(20));
    ViewPager viewPager = ViewUtils.f(this, R.id.viewpager);
    MainVpAdapter mainVpAdapter = new MainVpAdapter(getSupportFragmentManager());
    viewPager.setAdapter(mainVpAdapter);

    final BottomNavigationBar bottomNavigationBar = ViewUtils.f(this, R.id.bottom_bar);
    bottomNavigationBar.addItem("节点", R.drawable.ic_panorama_fish_eye_white_48dp);
    bottomNavigationBar.addItem("热帖", R.drawable.ic_hdr_weak_white_48dp);
    bottomNavigationBar.addItem("我的", R.drawable.ic_all_inclusive_white_48dp);
    bottomNavigationBar.bindViewPager(viewPager);
    bottomNavigationBar.getChildAt(0).performClick();
    bottomNavigationBar.addOnLayoutChangeListener(
            new View.OnLayoutChangeListener() {
                @Override
                public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) {
                    bottomNavigationBar.removeOnLayoutChangeListener(this);
                    boolean isNightTheme = ThemeHelper.isNightTheme(MainActivity.this);
                    if (isNightTheme) {
                        ThemeUtils.updateNightMode(getResources(), true);
                    }
                    ThemeUtils.refreshUI(MainActivity.this, new ThemeUtils.ExtraRefreshable() {
                        @Override
                        public void refreshGlobal(Activity activity) {
                            if (SDK_INT >= 21) {
                                Window window = activity.getWindow();
                                window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
                                window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
                                window.setStatusBarColor(ThemeUtils.getColorById(activity, R.color.theme_color_primary_dark));
                                ActivityManager.TaskDescription description = new ActivityManager.TaskDescription(null, null, ThemeUtils.getThemeAttrColor(activity, android.R.attr.colorPrimary));
                                activity.setTaskDescription(description);
                            }
                        }

                        @Override
                        public void refreshSpecificView(View view) {

                        }
                    });
                }
            }
    );
}
 

开发者ID:succlz123,
项目名称:S1-Go,
代码行数:49,
代码来源:MainActivity.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)