本文整理了Java中android.support.v7.app.AppCompatActivity.getDelegate()
方法的一些代码示例,展示了AppCompatActivity.getDelegate()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AppCompatActivity.getDelegate()
方法的具体详情如下:
包路径:android.support.v7.app.AppCompatActivity
类名称:AppCompatActivity
方法名:getDelegate
暂无
代码示例来源:origin: JavaNoober/BackgroundLibrary
public static LayoutInflater inject(Context context) {
LayoutInflater inflater;
if (context instanceof Activity) {
inflater = ((Activity) context).getLayoutInflater();
} else {
inflater = LayoutInflater.from(context);
}
BackgroundFactory factory = new BackgroundFactory();
if (context instanceof AppCompatActivity) {
final AppCompatDelegate delegate = ((AppCompatActivity) context).getDelegate();
factory.setInterceptFactory(new LayoutInflater.Factory() {
@Override
public View onCreateView(String name, Context context, AttributeSet attrs) {
return delegate.createView(null, name, context, attrs);
}
});
}
inflater.setFactory2(factory);
return inflater;
}
代码示例来源:origin: nekocode/JarFilterPlugin
@Override
public void setContentView(View view, ViewGroup.LayoutParams params) {
getDelegate().setContentView(view, params);
}
代码示例来源:origin: nekocode/JarFilterPlugin
@Nullable
@Override
public ActionBarDrawerToggle.Delegate getDrawerToggleDelegate() {
return getDelegate().getDrawerToggleDelegate();
}
代码示例来源:origin: nekocode/JarFilterPlugin
/**
* Support library version of {@link android.app.Activity#getActionBar}.
*
* <p>Retrieve a reference to this activity's ActionBar.
*
* @return The Activity's ActionBar, or null if it does not have one.
*/
@Nullable
public ActionBar getSupportActionBar() {
return getDelegate().getSupportActionBar();
}
代码示例来源:origin: nekocode/JarFilterPlugin
@SuppressWarnings("TypeParameterUnusedInFormals")
@Override
public <T extends View> T findViewById(@IdRes int id) {
return getDelegate().findViewById(id);
}
代码示例来源:origin: nekocode/JarFilterPlugin
/**
* Start an action mode.
*
* @param callback Callback that will manage lifecycle events for this context mode
* @return The ContextMode that was started, or null if it was canceled
*/
@Nullable
public ActionMode startSupportActionMode(@NonNull ActionMode.Callback callback) {
return getDelegate().startSupportActionMode(callback);
}
代码示例来源:origin: nekocode/JarFilterPlugin
@Override
public void setContentView(@LayoutRes int layoutResID) {
getDelegate().setContentView(layoutResID);
}
代码示例来源:origin: nekocode/JarFilterPlugin
@Override
protected void onPostCreate(@Nullable Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
getDelegate().onPostCreate(savedInstanceState);
}
代码示例来源:origin: nekocode/JarFilterPlugin
@Override
protected void onPostResume() {
super.onPostResume();
getDelegate().onPostResume();
}
代码示例来源:origin: nekocode/JarFilterPlugin
@Override
protected void onTitleChanged(CharSequence title, int color) {
super.onTitleChanged(title, color);
getDelegate().setTitle(title);
}
代码示例来源:origin: nekocode/JarFilterPlugin
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
getDelegate().onSaveInstanceState(outState);
}
代码示例来源:origin: nekocode/JarFilterPlugin
@Override
protected void onStart() {
super.onStart();
getDelegate().onStart();
}
代码示例来源:origin: nekocode/JarFilterPlugin
@Override
protected void onStop() {
super.onStop();
getDelegate().onStop();
}
代码示例来源:origin: garretyoder/app-theme-engine
public static void setInflaterFactory(LayoutInflater li, Activity activity) {
LayoutInflaterCompat.setFactory(li, new InflationInterceptor(
activity instanceof ATEActivity ? (ATEActivity) activity : null,
li,
activity instanceof AppCompatActivity ? ((AppCompatActivity) activity).getDelegate() : null));
}
代码示例来源:origin: nekocode/JarFilterPlugin
@Override
protected void onDestroy() {
super.onDestroy();
getDelegate().onDestroy();
}
代码示例来源:origin: w568w/fuckView
public static void setActionBarTextColor(AppCompatActivity activity, int color) {
try {
Object actionbar = ReflectionUtils.getField(activity.getDelegate(), "mActionBar");
View actionBarContent = (View) ReflectionUtils.getField(actionbar, "mContainerView");
View actionBarView = (View) ReflectionUtils.getField(actionBarContent, "mActionBarView");
TextView textView = (TextView) ReflectionUtils.getField(actionBarView, "mTitleTextView");
textView.setTextColor(color);
} catch (Throwable e) {
e.printStackTrace();
}
}
}
代码示例来源:origin: nekocode/JarFilterPlugin
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
getDelegate().onConfigurationChanged(newConfig);
if (mResources != null) {
// The real (and thus managed) resources object was already updated
// by ResourcesManager, so pull the current metrics from there.
final DisplayMetrics newMetrics = super.getResources().getDisplayMetrics();
mResources.updateConfiguration(newConfig, newMetrics);
}
}
代码示例来源:origin: leelit/STUer-client
public static boolean isNightMode(AppCompatActivity activity) {
int uiMode = activity.getResources().getConfiguration().uiMode;
int dayNightUiMode = uiMode & Configuration.UI_MODE_NIGHT_MASK;
if (SPUtils.getBoolean(MainActivity.CURRENT_NIGHT_MODE) && dayNightUiMode != Configuration.UI_MODE_NIGHT_YES) {
activity.getDelegate().setLocalNightMode(AppCompatDelegate.MODE_NIGHT_YES);
activity.recreate();
return true;
}
return false;
}
}
代码示例来源:origin: achenglike/NightModel
public void applyNightModel(AppCompatActivity activity){
invokeResources(activity);
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
activity.getDelegate().applyDayNight();
applyNewModel();
PersistenceUtils.setNightModel(activity.getApplicationContext(), true);
ModelChangeManager.getInstance().notifyChange(true);
}
代码示例来源:origin: achenglike/NightModel
public void applyDayModel(AppCompatActivity activity) {
invokeResources(activity);
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
activity.getDelegate().applyDayNight();
applyNewModel();
PersistenceUtils.setNightModel(activity.getApplicationContext(), false);
ModelChangeManager.getInstance().notifyChange(false);
}
内容来源于网络,如有侵权,请联系作者删除!