Java Code Examples for android.content.res.Resources#selectSystemTheme()

The following examples show how to use android.content.res.Resources#selectSystemTheme() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: InputMethodService.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
@Override public void onCreate() {
    mTheme = Resources.selectSystemTheme(mTheme,
            getApplicationInfo().targetSdkVersion,
            android.R.style.Theme_InputMethod,
            android.R.style.Theme_Holo_InputMethod,
            android.R.style.Theme_DeviceDefault_InputMethod,
            android.R.style.Theme_DeviceDefault_InputMethod);
    super.setTheme(mTheme);
    super.onCreate();
    mImm = (InputMethodManager)getSystemService(INPUT_METHOD_SERVICE);
    mSettingsObserver = SettingsObserver.createAndRegister(this);
    // If the previous IME has occupied non-empty inset in the screen, we need to decide whether
    // we continue to use the same size of the inset or update it
    mShouldClearInsetOfPreviousIme = (mImm.getInputMethodWindowVisibleHeight() > 0);
    mInflater = (LayoutInflater)getSystemService(
            Context.LAYOUT_INFLATER_SERVICE);
    mWindow = new SoftInputWindow(this, "InputMethod", mTheme, null, null, mDispatcherState,
            WindowManager.LayoutParams.TYPE_INPUT_METHOD, Gravity.BOTTOM, false);
    // For ColorView in DecorView to work, FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS needs to be set
    // by default (but IME developers can opt this out later if they want a new behavior).
    mWindow.getWindow().setFlags(
            FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS, FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);

    initViews();
    mWindow.getWindow().setLayout(MATCH_PARENT, WRAP_CONTENT);
}
 
Example 2
Source File: ContextImpl.java    From AndroidComponentPlugin with Apache License 2.0 5 votes vote down vote up
public Object createService(ContextImpl ctx) {
    final Context outerContext = ctx.getOuterContext();
    return new NotificationManager(
        new ContextThemeWrapper(outerContext,
                Resources.selectSystemTheme(0,
                        outerContext.getApplicationInfo().targetSdkVersion,
                        com.android.internal.R.style.Theme_Dialog,
                        com.android.internal.R.style.Theme_Holo_Dialog,
                        com.android.internal.R.style.Theme_DeviceDefault_Dialog)),
        ctx.mMainThread.getHandler());
}
 
Example 3
Source File: ContextImpl.java    From AndroidComponentPlugin with Apache License 2.0 5 votes vote down vote up
public Object createService(ContextImpl ctx) {
    final Context outerContext = ctx.getOuterContext();
    return new NotificationManager(
        new ContextThemeWrapper(outerContext,
                Resources.selectSystemTheme(0,
                        outerContext.getApplicationInfo().targetSdkVersion,
                        com.android.internal.R.style.Theme_Dialog,
                        com.android.internal.R.style.Theme_Holo_Dialog,
                        com.android.internal.R.style.Theme_DeviceDefault_Dialog)),
        ctx.mMainThread.getHandler());
}
 
Example 4
Source File: ContextImpl.java    From AndroidComponentPlugin with Apache License 2.0 5 votes vote down vote up
public Object createService(ContextImpl ctx) {
    final Context outerContext = ctx.getOuterContext();
    return new NotificationManager(
        new ContextThemeWrapper(outerContext,
                Resources.selectSystemTheme(0,
                        outerContext.getApplicationInfo().targetSdkVersion,
                        com.android.internal.R.style.Theme_Dialog,
                        com.android.internal.R.style.Theme_Holo_Dialog,
                        com.android.internal.R.style.Theme_DeviceDefault_Dialog,
                        com.android.internal.R.style.Theme_DeviceDefault_Light_Dialog)),
        ctx.mMainThread.getHandler());
}
 
Example 5
Source File: ContextImpl.java    From AndroidComponentPlugin with Apache License 2.0 5 votes vote down vote up
public Object createService(ContextImpl ctx) {
    final Context outerContext = ctx.getOuterContext();
    return new NotificationManager(
        new ContextThemeWrapper(outerContext,
                Resources.selectSystemTheme(0,
                        outerContext.getApplicationInfo().targetSdkVersion,
                        com.android.internal.R.style.Theme_Dialog,
                        com.android.internal.R.style.Theme_Holo_Dialog,
                        com.android.internal.R.style.Theme_DeviceDefault_Dialog,
                        com.android.internal.R.style.Theme_DeviceDefault_Light_Dialog)),
        ctx.mMainThread.getHandler());
}
 
Example 6
Source File: ContextImpl.java    From AndroidComponentPlugin with Apache License 2.0 5 votes vote down vote up
public Object createService(ContextImpl ctx) {
    final Context outerContext = ctx.getOuterContext();
    return new NotificationManager(
        new ContextThemeWrapper(outerContext,
                Resources.selectSystemTheme(0,
                        outerContext.getApplicationInfo().targetSdkVersion,
                        com.android.internal.R.style.Theme_Dialog,
                        com.android.internal.R.style.Theme_Holo_Dialog,
                        com.android.internal.R.style.Theme_DeviceDefault_Dialog)),
        ctx.mMainThread.getHandler());
}
 
Example 7
Source File: ContextImpl.java    From AndroidComponentPlugin with Apache License 2.0 5 votes vote down vote up
public Object createService(ContextImpl ctx) {
    final Context outerContext = ctx.getOuterContext();
    return new NotificationManager(
        new ContextThemeWrapper(outerContext,
                Resources.selectSystemTheme(0,
                        outerContext.getApplicationInfo().targetSdkVersion,
                        com.android.internal.R.style.Theme_Dialog,
                        com.android.internal.R.style.Theme_Holo_Dialog,
                        com.android.internal.R.style.Theme_DeviceDefault_Dialog)),
        ctx.mMainThread.getHandler());
}
 
Example 8
Source File: ContextImpl.java    From AndroidComponentPlugin with Apache License 2.0 5 votes vote down vote up
public Object createService(ContextImpl ctx) {
    final Context outerContext = ctx.getOuterContext();
    return new NotificationManager(
        new ContextThemeWrapper(outerContext,
                Resources.selectSystemTheme(0,
                        outerContext.getApplicationInfo().targetSdkVersion,
                        com.android.internal.R.style.Theme_Dialog,
                        com.android.internal.R.style.Theme_Holo_Dialog,
                        com.android.internal.R.style.Theme_DeviceDefault_Dialog)),
        ctx.mMainThread.getHandler());
}
 
Example 9
Source File: SystemServiceRegistry.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
@Override
public NotificationManager createService(ContextImpl ctx) {
    final Context outerContext = ctx.getOuterContext();
    return new NotificationManager(
        new ContextThemeWrapper(outerContext,
                Resources.selectSystemTheme(0,
                        outerContext.getApplicationInfo().targetSdkVersion,
                        com.android.internal.R.style.Theme_Dialog,
                        com.android.internal.R.style.Theme_Holo_Dialog,
                        com.android.internal.R.style.Theme_DeviceDefault_Dialog,
                        com.android.internal.R.style.Theme_DeviceDefault_Light_Dialog)),
        ctx.mMainThread.getHandler());
}