Java 类android.view.ContextThemeWrapper 实例源码

项目:https-github.com-hyb1996-NoRootScriptDroid    文件:ScriptListNavigatorContent.java   
public ScriptListNavigatorContent(Context context) {
    mScriptListWithProgressBarView = new ScriptListWithProgressBarView(new ContextThemeWrapper(context, R.style.AppTheme));
    mFloatingScriptFileListView = mScriptListWithProgressBarView.getScriptAndFolderListRecyclerView();
    mFloatingScriptFileListView.setViewHolderSupplier(mViewHolderSupplier);
    mFloatingScriptFileListView.setLayoutManager(new WrapContentLinearLayoutManager(context));
    mFloatingScriptFileListView.setStorageScriptProvider(StorageScriptProvider.getDefault());
    mFloatingScriptFileListView.setOnItemClickListener(new ScriptAndFolderListRecyclerView.OnScriptFileClickListener() {

        @Override
        public void onClick(ScriptFile file, int position) {
            Scripts.run(file);
            HoverMenuService.postIntent(new Intent(HoverMenuService.ACTION_COLLAPSE_MENU));
        }

    });
}
项目:LaunchEnr    文件:PendingAppWidgetHostView.java   
public PendingAppWidgetHostView(Context context, LauncherAppWidgetInfo info,
                                IconCache cache, boolean disabledForSafeMode) {
    super(new ContextThemeWrapper(context, R.style.WidgetContainerTheme));

    mLauncher = Launcher.getLauncher(context);
    mInfo = info;
    mStartState = info.restoreStatus;
    mDisabledForSafeMode = disabledForSafeMode;

    mPaint = new TextPaint();
    mPaint.setColor(ThemeUtils.getAttrColor(getContext(), android.R.attr.textColorPrimary));
    mPaint.setTextSize(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_PX,
            mLauncher.getDeviceProfile().iconTextSizePx, getResources().getDisplayMetrics()));
    setBackgroundResource(R.drawable.pending_widget_bg);
    setWillNotDraw(false);

    setElevation(getResources().getDimension(R.dimen.pending_widget_elevation));
    updateAppWidget(null);
    setOnClickListener(mLauncher);

    // Load icon
    PackageItemInfo item = new PackageItemInfo(info.providerName.getPackageName());
    item.user = info.user;
    cache.updateIconInBackground(this, item);
}
项目:LaunchEnr    文件:IconPackPreference.java   
IconAdapter(Context context, Map<String, IconPackInfo> supportedPackages, String currentPack) {

            int theme = PreferencesState.isDarkThemeEnabled(context)? R.style.DialogStyleDark : R.style.DialogStyle;
            ContextThemeWrapper contextThemeWrapper = new ContextThemeWrapper(context, theme);
            mLayoutInflater = LayoutInflater.from(contextThemeWrapper);
            mSupportedPackages = new ArrayList<>(supportedPackages.values());
            Collections.sort(mSupportedPackages, new Comparator<IconPackInfo>() {
                @Override
                public int compare(IconPackInfo lhs, IconPackInfo rhs) {
                    return lhs.label.toString().compareToIgnoreCase(rhs.label.toString());
                }
            });

            Resources res = context.getResources();
            String defaultLabel = res.getString(R.string.default_iconpack_title);
            Drawable icon = ContextCompat.getDrawable(context, R.mipmap.ic_default_icon_pack);
            mSupportedPackages.add(0, new IconPackInfo(defaultLabel, icon, ""));
            mCurrentIconPack = currentPack;
        }
项目:DownloadableCalligraphy    文件:CalligraphyUtils.java   
/**
 * Tries to pull the Font Path from the Text Appearance.
 *
 * @param context     Activity Context
 * @param attrs       View Attributes
 * @param attributeId if -1 returns null.
 * @return returns null if attribute is not defined or if no TextAppearance is found.
 */
@FontRes
static int pullFontPathFromTextAppearance(final Context context, AttributeSet attrs, int[] attributeId) {
    if (attributeId == null || attrs == null)
        return 0;
    int textAppearanceId = -1;
    // For prevent using default component font
    final ContextThemeWrapper contextThemeWrapper = new ContextThemeWrapper(context, android.R.style.Theme_NoDisplay);
    final TypedArray typedArrayAttr = contextThemeWrapper.obtainStyledAttributes(attrs, ANDROID_ATTR_TEXT_APPEARANCE);
    if (typedArrayAttr != null) {
        try {
            textAppearanceId = typedArrayAttr.getResourceId(0, 0);
        } catch (Exception ignored) {
            // Failed for some reason
            return 0;
        } finally {
            typedArrayAttr.recycle();
        }
    }

    final Integer textAppearanceAttrs = getFontFromTextAppearance(context, attributeId, textAppearanceId);
    if (textAppearanceAttrs != null) return textAppearanceAttrs;
    return 0;
}
项目:MyCalendar    文件:FloatingActionsMenu.java   
private void createLabels() {
  Context context = new ContextThemeWrapper(getContext(), mLabelsStyle);

  for (int i = 0; i < mButtonsCount; i++) {
    FloatingActionButtonLibrary button = (FloatingActionButtonLibrary) getChildAt(i);
    String title = button.getTitle();

    if (button == mAddButton || title == null ||
        button.getTag(R.id.fab_label) != null) continue;

    TextView label = new TextView(context);
    label.setTextAppearance(getContext(), mLabelsStyle);
    label.setText(button.getTitle());
    addView(label);

    button.setTag(R.id.fab_label, label);
  }
}
项目:TestChat    文件:FloatingActionsMenu.java   
private void createLabels() {
        Context context = new ContextThemeWrapper(getContext(), mLabelsStyle);

        for (int i = 0; i < mButtonsCount; i++) {
                FloatingActionButton button = (FloatingActionButton) getChildAt(i);
                String title = button.getTitle();

                if (button == mAddButton || title == null ||
                        button.getTag(R.id.fab_label) != null) continue;

                TextView label = new TextView(context);
                label.setTextAppearance(getContext(), mLabelsStyle);
                label.setText(button.getTitle());
                addView(label);

                button.setTag(R.id.fab_label, label);
        }
}
项目:Auto.js    文件:LayoutBoundsFloatyWindow.java   
@Override
protected View inflateView(FloatyService service) {
    mContext = new ContextThemeWrapper(service, R.style.AppTheme);
    mLayoutBoundsView = new LayoutBoundsView(mContext) {
        @Override
        public boolean dispatchKeyEvent(KeyEvent event) {
            if (event.getKeyCode() == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_UP) {
                close();
                return true;
            }
            return super.dispatchKeyEvent(event);
        }
    };
    setupView();
    return mLayoutBoundsView;
}
项目:Auto.js    文件:LayoutHierarchyFloatyWindow.java   
@Override
protected View inflateView(FloatyService service) {
    mContext = new ContextThemeWrapper(service, R.style.AppTheme);
    mLayoutHierarchyView = new LayoutHierarchyView(mContext) {
        @Override
        public boolean dispatchKeyEvent(KeyEvent event) {
            if (event.getKeyCode() == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_UP) {
                close();
                return true;
            }
            return super.dispatchKeyEvent(event);
        }
    };
    setupView();
    return mLayoutHierarchyView;
}
项目:Auto.js    文件:CircularMenu.java   
private void initFloaty() {
    mWindow = new CircularActionMenuFloatingWindow(new CircularActionMenuFloaty() {

        @Override
        public View inflateActionView(FloatyService service, CircularActionMenuFloatingWindow window) {
            View actionView = View.inflate(service, R.layout.circular_action_view, null);
            mActionViewIcon = (ImageView) actionView.findViewById(R.id.icon);
            return actionView;
        }

        @Override
        public CircularActionMenu inflateMenuItems(FloatyService service, CircularActionMenuFloatingWindow window) {
            CircularActionMenu menu = (CircularActionMenu) View.inflate(new ContextThemeWrapper(service, R.style.AppTheme), R.layout.circular_action_menu, null);
            ButterKnife.bind(CircularMenu.this, menu);
            return menu;
        }
    });
    mWindow.setKeepToSideHiddenWidthRadio(0.25f);
    FloatyService.addWindow(mWindow);
}
项目:BBSSDK-for-Android    文件:Theme1ForumThreadPullToRequestView.java   
public void popFilterMenu(View rootview) {
    int style = ResHelper.getStyleRes(getContext(), "BBS_PopupMenu");
    Context wrapper = new ContextThemeWrapper(getContext(), style);
    //Creating the instance of PopupMenu
    PopupMenu popup = new PopupMenu(wrapper, rootview);
    //Inflating the Popup using xml file
    popup.getMenuInflater().inflate(PageForumThreadDetail.getMenuRes(getContext(), "bbs_popup_forumthread"), popup.getMenu());

    //registering popup with OnMenuItemClickListener
    popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
        public boolean onMenuItemClick(MenuItem item) {
            //only one menu item.
            if (item.getItemId() == ResHelper.getIdRes(getContext(), "action_arrangebycomment")) {
                orderType = ThreadListOrderType.LAST_POST;
                performPullingDown(true);
            } else if (item.getItemId() == ResHelper.getIdRes(getContext(), "action_arrangebypost")) {
                orderType = ThreadListOrderType.CREATE_ON;
                performPullingDown(true);
            }
            return true;
        }
    });
    popup.show();
}
项目:chromium-for-android-56-debug-video    文件:AboutChromePreferences.java   
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getActivity().setTitle(R.string.prefs_about_chrome);
    addPreferencesFromResource(R.xml.about_chrome_preferences);

    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
        ChromeBasePreference deprecationWarning = new ChromeBasePreference(
                new ContextThemeWrapper(getActivity(),
                        R.style.DeprecationWarningPreferenceTheme));
        deprecationWarning.setOrder(-1);
        deprecationWarning.setTitle(R.string.deprecation_warning);
        deprecationWarning.setIcon(R.drawable.exclamation_triangle);
        getPreferenceScreen().addPreference(deprecationWarning);
    }

    PrefServiceBridge prefServiceBridge = PrefServiceBridge.getInstance();
    AboutVersionStrings versionStrings = prefServiceBridge.getAboutVersionStrings();
    Preference p = findPreference(PREF_APPLICATION_VERSION);
    p.setSummary(getApplicationVersion(getActivity(), versionStrings.getApplicationVersion()));
    p = findPreference(PREF_OS_VERSION);
    p.setSummary(versionStrings.getOSVersion());
    p = findPreference(PREF_LEGAL_INFORMATION);
    int currentYear = Calendar.getInstance().get(Calendar.YEAR);
    p.setSummary(getString(R.string.legal_information_summary, currentYear));
}
项目:VirtualAPK    文件:VAInstrumentation.java   
@Override
public void callActivityOnCreate(Activity activity, Bundle icicle) {
    final Intent intent = activity.getIntent();
    if (PluginUtil.isIntentFromPlugin(intent)) {
        Context base = activity.getBaseContext();
        try {
            LoadedPlugin plugin = this.mPluginManager.getLoadedPlugin(intent);
            ReflectUtil.setField(base.getClass(), base, "mResources", plugin.getResources());
            ReflectUtil.setField(ContextWrapper.class, activity, "mBase", plugin.getPluginContext());
            ReflectUtil.setField(Activity.class, activity, "mApplication", plugin.getApplication());
            ReflectUtil.setFieldNoException(ContextThemeWrapper.class, activity, "mBase", plugin.getPluginContext());

            // set screenOrientation
            ActivityInfo activityInfo = plugin.getActivityInfo(PluginUtil.getComponent(intent));
            if (activityInfo.screenOrientation != ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED) {
                activity.setRequestedOrientation(activityInfo.screenOrientation);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }

    }

    mBase.callActivityOnCreate(activity, icicle);
}
项目:ChromeLikeTabSwitcher    文件:AbstractTabSwitcherLayout.java   
/**
 * Inflates the layout.
 *
 * @param tabsOnly
 *         True, if only the tabs should be inflated, false otherwise
 */
public final void inflateLayout(final boolean tabsOnly) {
    int themeResourceId = style.getThemeHelper().getThemeResourceId(tabSwitcher.getLayout());
    LayoutInflater inflater =
            LayoutInflater.from(new ContextThemeWrapper(getContext(), themeResourceId));
    onInflateLayout(inflater, tabsOnly);
    registerEventHandlerCallbacks();
    adaptDecorator();
    adaptLogLevel();

    if (!tabsOnly) {
        adaptToolbarVisibility();
        adaptToolbarTitle();
        adaptToolbarNavigationIcon();
        inflateToolbarMenu();
    }
}
项目:superglue    文件:TelescopeViewContainer.java   
public void showTelescopeDialog(final Activity activity) {
  LayoutInflater inflater = LayoutInflater.from(activity);
  TelescopeLayout content =
      (TelescopeLayout) inflater.inflate(R.layout.telescope_tutorial_dialog, null);
  final AlertDialog dialog =
      new AlertDialog.Builder(activity).setView(content).setCancelable(false).create();

  content.setLens(new Lens() {
    @Override public void onCapture(File file) {
      dialog.dismiss();

      Context toastContext = new ContextThemeWrapper(activity, android.R.style.Theme_DeviceDefault_Dialog);
      LayoutInflater toastInflater = LayoutInflater.from(toastContext);
      Toast toast = Toast.makeText(toastContext, "", Toast.LENGTH_SHORT);
      View toastView = toastInflater.inflate(R.layout.telescope_tutorial_toast, null);
      toast.setView(toastView);
      toast.setGravity(Gravity.CENTER, 0, 0);
      toast.show();
    }
  });

  dialog.show();
}
项目:superglue    文件:TelescopeViewContainer.java   
public void showTelescopeDialog(final Activity activity) {
  LayoutInflater inflater = LayoutInflater.from(activity);
  TelescopeLayout content =
      (TelescopeLayout) inflater.inflate(R.layout.telescope_tutorial_dialog, null);
  final AlertDialog dialog =
      new AlertDialog.Builder(activity).setView(content).setCancelable(false).create();

  content.setLens(new Lens() {
    @Override public void onCapture(File file) {
      dialog.dismiss();

      Context toastContext = new ContextThemeWrapper(activity, android.R.style.Theme_DeviceDefault_Dialog);
      LayoutInflater toastInflater = LayoutInflater.from(toastContext);
      Toast toast = Toast.makeText(toastContext, "", Toast.LENGTH_SHORT);
      View toastView = toastInflater.inflate(R.layout.telescope_tutorial_toast, null);
      toast.setView(toastView);
      toast.setGravity(Gravity.CENTER, 0, 0);
      toast.show();
    }
  });

  dialog.show();
}
项目:firefox-tv    文件:OpenWithFragment.java   
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    ContextThemeWrapper wrapper = new ContextThemeWrapper(getContext(), android.R.style.Theme_Material_Light);

    @SuppressLint("InflateParams") // This View will have it's params ignored anyway:
    final View view = LayoutInflater.from(wrapper).inflate(R.layout.fragment_open_with, null);

    final Dialog dialog = new CustomWidthBottomSheetDialog(wrapper);
    dialog.setContentView(view);

    final RecyclerView appList = view.findViewById(R.id.apps);
    appList.setLayoutManager(new LinearLayoutManager(wrapper, LinearLayoutManager.VERTICAL, false));

    AppAdapter adapter = new AppAdapter(
            wrapper,
            (ActivityInfo[]) getArguments().getParcelableArray(ARGUMENT_KEY_APPS),
            (ActivityInfo) getArguments().getParcelable(ARGUMENT_STORE));
    adapter.setOnAppSelectedListener(this);
    appList.setAdapter(adapter);

    return dialog;
}
项目:boohee_v5.6    文件:ToolbarActionBar.java   
private void ensureListMenuPresenter(Menu menu) {
    if (this.mListMenuPresenter == null && (menu instanceof MenuBuilder)) {
        MenuBuilder mb = (MenuBuilder) menu;
        Context context = this.mDecorToolbar.getContext();
        TypedValue outValue = new TypedValue();
        Theme widgetTheme = context.getResources().newTheme();
        widgetTheme.setTo(context.getTheme());
        widgetTheme.resolveAttribute(R.attr.actionBarPopupTheme, outValue, true);
        if (outValue.resourceId != 0) {
            widgetTheme.applyStyle(outValue.resourceId, true);
        }
        widgetTheme.resolveAttribute(R.attr.panelMenuListTheme, outValue, true);
        if (outValue.resourceId != 0) {
            widgetTheme.applyStyle(outValue.resourceId, true);
        } else {
            widgetTheme.applyStyle(R.style.Theme_AppCompat_CompactMenu, true);
        }
        Context context2 = new ContextThemeWrapper(context, 0);
        context2.getTheme().setTo(widgetTheme);
        this.mListMenuPresenter = new ListMenuPresenter(context2, R.layout.abc_list_menu_item_layout);
        this.mListMenuPresenter.setCallback(new PanelMenuPresenterCallback());
        mb.addMenuPresenter(this.mListMenuPresenter);
    }
}
项目:Android_watch_magpie    文件:MainActivity.java   
private void showAboutDialog() {
    // Transform text into URL link
    View aboutView = getLayoutInflater().inflate(R.layout.dialog_about, null, false);
    TextView txtView = (TextView) aboutView.findViewById(R.id.aboutTxtView);
    Pattern pattern = Pattern.compile("here");
    Linkify.addLinks(txtView, pattern, getString(R.string.magpie_url));
    // Create and show the dialog
    AlertDialog.Builder builder = new AlertDialog.Builder(
            new ContextThemeWrapper(
                    this,
                    android.R.style.Theme_Material_Light_NoActionBar_Fullscreen));
    builder.setTitle(getString(R.string.about_app))
            .setView(aboutView)
            .create()
            .show();
}
项目:GravityBox    文件:UnlockActivity.java   
@Override
public void run() {
    dismissProgressDialog();
    AlertDialog.Builder builder = new AlertDialog.Builder(
            new ContextThemeWrapper(UnlockActivity.this, mDlgThemeId))
        .setTitle(R.string.app_name)
        .setMessage(R.string.gb_startup_error)
        .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                dialog.dismiss();
                finish();
            }
        });
    mAlertDialog = builder.create();
    mAlertDialog.show();
}
项目:GravityBox    文件:UnlockActivity.java   
@Override
public void onCreate(Bundle savedInstanceState) {
    File file = new File(getFilesDir() + "/" + GravityBoxSettings.FILE_THEME_DARK_FLAG);
    mDlgThemeId = file.exists() ? android.R.style.Theme_Material_Dialog :
        android.R.style.Theme_Material_Light_Dialog;
    super.onCreate(savedInstanceState);

    mHandler = new Handler();
    mReceiver = new GravityBoxResultReceiver(mHandler);
    mReceiver.setReceiver(this);
    Intent intent = new Intent();
    intent.setAction(SystemPropertyProvider.ACTION_GET_SYSTEM_PROPERTIES);
    intent.putExtra("receiver", mReceiver);
    intent.putExtra("settings_uuid", SettingsManager.getInstance(this).getOrCreateUuid());
    mProgressDialog = new ProgressDialog(
            new ContextThemeWrapper(UnlockActivity.this, mDlgThemeId));
    mProgressDialog.setIndeterminate(true);
    mProgressDialog.setTitle(R.string.app_name);
    mProgressDialog.setMessage(getString(R.string.gb_startup_progress));
    mProgressDialog.setCancelable(false);
    mProgressDialog.show();
    mHandler.postDelayed(mGetSystemPropertiesTimeout, 5000);
    sendBroadcast(intent);
}
项目:SimpleUILauncher    文件:PendingAppWidgetHostView.java   
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public PendingAppWidgetHostView(Context context, LauncherAppWidgetInfo info,
        boolean disabledForSafeMode) {
    super(new ContextThemeWrapper(context, R.style.WidgetContainerTheme));

    mLauncher = Launcher.getLauncher(context);
    mInfo = info;
    mStartState = info.restoreStatus;
    mIconLookupIntent = new Intent().setComponent(info.providerName);
    mDisabledForSafeMode = disabledForSafeMode;

    mPaint = new TextPaint();
    mPaint.setColor(0xFFFFFFFF);
    mPaint.setTextSize(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_PX,
            mLauncher.getDeviceProfile().iconTextSizePx, getResources().getDisplayMetrics()));
    setBackgroundResource(R.drawable.quantum_panel_dark);
    setWillNotDraw(false);

    if (Utilities.ATLEAST_LOLLIPOP) {
        setElevation(getResources().getDimension(R.dimen.pending_widget_elevation));
    }
}
项目:FlickLauncher    文件:PendingAppWidgetHostView.java   
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public PendingAppWidgetHostView(Context context, LauncherAppWidgetInfo info,
        boolean disabledForSafeMode) {
    super(new ContextThemeWrapper(context, R.style.WidgetContainerTheme));

    mLauncher = Launcher.getLauncher(context);
    mInfo = info;
    mStartState = info.restoreStatus;
    mIconLookupIntent = new Intent().setComponent(info.providerName);
    mDisabledForSafeMode = disabledForSafeMode;

    mPaint = new TextPaint();
    mPaint.setColor(0xFFFFFFFF);
    mPaint.setTextSize(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_PX,
            mLauncher.getDeviceProfile().iconTextSizePx, getResources().getDisplayMetrics()));
    setBackgroundResource(R.drawable.quantum_panel_dark);
    setWillNotDraw(false);

    if (Utilities.ATLEAST_LOLLIPOP) {
        setElevation(getResources().getDimension(R.dimen.pending_widget_elevation));
    }
}
项目:https-github.com-hyb1996-NoRootScriptDroid    文件:RecordNavigatorContent.java   
public RecordNavigatorContent(Context context) {
    mContext = new ContextThemeWrapper(context, R.style.AppTheme);
    mView = View.inflate(mContext, R.layout.floating_window_record, null);
    ButterKnife.bind(this, mView);
    HoverMenuService.getEventBus().register(this);
    mRecorder = GlobalRecorder.getSingleton(context);
    mRecorder.addOnStateChangedListener(this);
    setState(mRecorder.getState());
    GlobalKeyObserver.getSingleton().addVolumeDownListener(this);
}
项目:https-github.com-hyb1996-NoRootScriptDroid    文件:HoverMenuService.java   
private void initViews() {
    mThemeWrapper = new ContextThemeWrapper(this, R.style.AppTheme);
    mFloatingLayoutHierarchyView = new FloatingLayoutHierarchyView(mThemeWrapper);
    mFloatingLayoutBoundsView = new FloatingLayoutBoundsView(mThemeWrapper);
    initWindowMenu();
    mWindowViewController.addView(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT, true, mFloatingLayoutHierarchyView);
    mWindowViewController.addView(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT, true, mFloatingLayoutBoundsView);
}
项目:https-github.com-hyb1996-NoRootScriptDroid    文件:GlobalRecorder.java   
public GlobalRecorder(Context context) {
    mContext = new ContextThemeWrapper(context.getApplicationContext(), R.style.AppTheme);
    mTouchRecorder = new TouchRecorder(context) {
        @Override
        protected InputEventRecorder createInputEventRecorder() {
            if (Pref.rootRecordGeneratesBinary())
                return new InputEventToAutoFileRecorder(mContext);
            else
                return new InputEventToRootAutomatorRecorder();
        }
    };
    EventBus.getDefault().register(this);
}
项目:SkinFramework    文件:SkinResource.java   
public SkinThemeContext(Context base) {
    super();
    if (base instanceof ContextThemeWrapper) {
        attachBaseContext(((ContextThemeWrapper) base).getBaseContext());
        mContextRef = new WeakReference<Context>(base);
    } else {
        attachBaseContext(base);
    }
    int themeRes = getThemeRes();
    if (themeRes <= 0) {
        themeRes = android.R.style.Theme_Light;
    }
    setTheme(themeRes);
}
项目:LaunchEnr    文件:PopupContainerWithArrow.java   
/**
 * Shows the notifications and deep shortcuts associated with {@param icon}.
 * @return the container if shown or null.
 */
public static PopupContainerWithArrow showForIcon(BubbleTextView icon) {
    Launcher launcher = Launcher.getLauncher(icon.getContext());
    if (getOpen(launcher) != null) {
        // There is already an items container open, so don't open this one.
        icon.clearFocus();
        return null;
    }
    ItemInfo itemInfo = (ItemInfo) icon.getTag();
    if (!DeepShortcutManager.supportsShortcuts(itemInfo)) {
        return null;
    }

    PopupDataProvider popupDataProvider = launcher.getPopupDataProvider();
    List<String> shortcutIds = popupDataProvider.getShortcutIdsForItem(itemInfo);
    List<NotificationKeyData> notificationKeys = popupDataProvider
            .getNotificationKeysForItem(itemInfo);
    List<SystemShortcut> systemShortcuts = popupDataProvider
            .getEnabledSystemShortcutsForItem(itemInfo);

    final PopupContainerWithArrow container =
            (PopupContainerWithArrow) LayoutInflater.from(new ContextThemeWrapper(launcher, R.style.Base_Theme)).inflate(
                    R.layout.popup_container, launcher.getDragLayer(), false);
    container.setVisibility(View.INVISIBLE);
    launcher.getDragLayer().addView(container);
    container.populateAndShow(icon, shortcutIds, notificationKeys, systemShortcuts);
    return container;
}
项目:adyen-android    文件:IssuerSelectionFragment.java   
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    Log.d(TAG, "onCreateView()");
    final View fragmentView;
    final Context contextThemeWrapper = new ContextThemeWrapper(getActivity(), theme);
    LayoutInflater localInflater = inflater.cloneInContext(contextThemeWrapper);
    fragmentView = localInflater.inflate(R.layout.issuer_selection_fragment, container, false);

    for (InputDetail inputDetail : paymentMethod.getInputDetails()) {
        if (inputDetail.getKey().equals("idealIssuer") || inputDetail.getKey().equals("issuer")) {
            issuers = inputDetail.getItems();
            break;
        }
    }

    final IssuerListAdapter issuerListAdapter = new IssuerListAdapter(getActivity(), issuers);
    final ListView listView = (ListView) fragmentView.findViewById(R.id.issuer_methods_list);
    listView.setAdapter(issuerListAdapter);
    listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(final AdapterView<?> adapterView, final View view, final int i, final long l) {
            String selectedIssuer = issuers.get(i).getId();
            issuerSelectionListener.onIssuerSelected(selectedIssuer);
        }
    });

    if (getActivity() instanceof CheckoutActivity) {
        ((CheckoutActivity) getActivity()).setActionBarTitle(paymentMethod.getName());
    }
    return fragmentView;
}
项目:mobile-store    文件:InstallExtensionDialogActivity.java   
@Override
protected void onPreExecute() {
    super.onPreExecute();

    // hack to get theme applied (which is not automatically applied due to activity's Theme.NoDisplay
    ContextThemeWrapper theme = new ContextThemeWrapper(InstallExtensionDialogActivity.this,
            FDroidApp.getCurThemeResId());

    progressDialog = new ProgressDialog(theme);
    progressDialog.setMessage(getString(R.string.requesting_root_access_body));
    progressDialog.setIndeterminate(true);
    progressDialog.setCancelable(false);
    progressDialog.show();
}
项目:mobile-store    文件:InstallExtensionDialogActivity.java   
@Override
protected void onPostExecute(Boolean rootGranted) {
    super.onPostExecute(rootGranted);

    progressDialog.dismiss();

    if (rootGranted) {
        // root access granted

        switch (getIntent().getAction()) {
            case ACTION_UNINSTALL:
                uninstallTask.execute();
                break;
            case ACTION_INSTALL:
                installTask.execute();
                break;
        }
    } else {
        // root access denied
        // hack to get theme applied (which is not automatically applied due to activity's Theme.NoDisplay
        ContextThemeWrapper theme = new ContextThemeWrapper(InstallExtensionDialogActivity.this,
                FDroidApp.getCurThemeResId());

        AlertDialog.Builder alertBuilder = new AlertDialog.Builder(theme)
                .setTitle(R.string.root_access_denied_title)
                .setMessage(getString(R.string.root_access_denied_body))
                .setNeutralButton(android.R.string.ok, new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        InstallExtensionDialogActivity.this.setResult(Activity.RESULT_CANCELED);
                        InstallExtensionDialogActivity.this.finish();
                    }
                });
        alertBuilder.create().show();
    }
}
项目:mobile-store    文件:InstallExtensionDialogActivity.java   
@Override
protected void onPreExecute() {
    super.onPreExecute();

    // hack to get theme applied (which is not automatically applied due to activity's Theme.NoDisplay
    ContextThemeWrapper theme = new ContextThemeWrapper(InstallExtensionDialogActivity.this,
            FDroidApp.getCurThemeResId());

    progressDialog = new ProgressDialog(theme);
    progressDialog.setMessage(InstallExtension.create(getApplicationContext()).getInstallingString());
    progressDialog.setIndeterminate(true);
    progressDialog.setCancelable(false);
    progressDialog.show();
}
项目:mobile-store    文件:InstallExtensionDialogActivity.java   
private void uninstall() {
    // hack to get theme applied (which is not automatically applied due to activity's Theme.NoDisplay
    ContextThemeWrapper theme = new ContextThemeWrapper(this, FDroidApp.getCurThemeResId());

    final boolean isInstalled = PrivilegedInstaller.isExtensionInstalled(this);

    if (isInstalled) {
        String message = InstallExtension.create(getApplicationContext()).getWarningString();

        AlertDialog.Builder builder = new AlertDialog.Builder(theme)
                .setTitle(R.string.system_uninstall)
                .setMessage(Html.fromHtml(message))
                .setPositiveButton(R.string.system_uninstall_button, new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialogInterface, int i) {
                        checkRootTask.execute();
                    }
                })
                .setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        InstallExtensionDialogActivity.this.setResult(Activity.RESULT_CANCELED);
                        InstallExtensionDialogActivity.this.finish();
                    }
                });
        builder.create().show();
    } else {
        throw new RuntimeException("Uninstall invoked, but extension is not installed!");
    }
}
项目:mobile-store    文件:InstallExtensionDialogActivity.java   
@Override
protected void onPreExecute() {
    super.onPreExecute();

    // hack to get theme applied (which is not automatically applied due to activity's Theme.NoDisplay
    ContextThemeWrapper theme = new ContextThemeWrapper(InstallExtensionDialogActivity.this,
            FDroidApp.getCurThemeResId());

    progressDialog = new ProgressDialog(theme);
    progressDialog.setMessage(getString(R.string.system_install_uninstalling));
    progressDialog.setIndeterminate(true);
    progressDialog.setCancelable(false);
    progressDialog.show();
}
项目:SOS-The-Healthcare-Companion    文件:LoginFragment.java   
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    final Context contextThemeWrapper = new ContextThemeWrapper(getActivity(), R.style.DarkTheme);
    LayoutInflater localInflater = inflater.cloneInContext(contextThemeWrapper);
    View view = localInflater.inflate(R.layout.fragment_login, container, false);
    ButterKnife.bind(this, view);

    sharedPreferences = getActivity().getSharedPreferences("Profile", MODE_PRIVATE);
    return view;
}
项目:CSipSimple    文件:IcsListPopupWindow.java   
public IcsListPopupWindow(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
    mContext = context;
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
        Context wrapped = new ContextThemeWrapper(context, defStyleRes);
        mPopup = new PopupWindowCompat(wrapped, attrs, defStyleAttr);
    } else {
        mPopup = new PopupWindowCompat(context, attrs, defStyleAttr, defStyleRes);
    }
    mPopup.setInputMethodMode(PopupWindow.INPUT_METHOD_NEEDED);
}
项目:react-native-recyclerview-list    文件:RecyclerViewBackedScrollView.java   
public RecyclerViewBackedScrollView(Context context) {
    super(new ContextThemeWrapper(context, R.style.ScrollbarRecyclerView));
    setHasFixedSize(true);
    ((DefaultItemAnimator)getItemAnimator()).setSupportsChangeAnimations(false);
    setLayoutManager(new LinearLayoutManager(context));
    setAdapter(new ReactListAdapter(this));
}
项目:sctalk    文件:IMUIHelper.java   
public static void showCustomDialog(Context context,int visibale,String title, final dialogCallback callback)
{
    AlertDialog.Builder builder = new AlertDialog.Builder(new ContextThemeWrapper(context, android.R.style.Theme_Holo_Light_Dialog));
    LayoutInflater inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View dialog_view = inflater.inflate(R.layout.tt_custom_dialog, null);
    final EditText editText = (EditText)dialog_view.findViewById(R.id.dialog_edit_content);
    editText.setVisibility(visibale);
    TextView textText = (TextView)dialog_view.findViewById(R.id.dialog_title);
    textText.setText(title);
    builder.setView(dialog_view);

    builder.setPositiveButton(context.getString(R.string.tt_ok), new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            callback.callback();
            dialog.dismiss();
        }
    });

    builder.setNegativeButton(context.getString(R.string.tt_cancel), new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialogInterface, int i) {
            dialogInterface.dismiss();
        }
    });
    builder.show();
}
项目:Auto.js    文件:CircularMenu.java   
public CircularMenu(Context context) {
    mContext = new ContextThemeWrapper(context, R.style.AppTheme);
    initFloaty();
    setupListeners();
    mRecorder = GlobalActionRecorder.getSingleton(context);
    mRecorder.addOnStateChangedListener(this);
}
项目:Auto.js    文件:GlobalActionRecorder.java   
public GlobalActionRecorder(Context context) {
    mContext = new ContextThemeWrapper(context.getApplicationContext(), R.style.AppTheme);
    mTouchRecorder = new TouchRecorder(context) {
        @Override
        protected InputEventRecorder createInputEventRecorder() {
            if (Pref.rootRecordGeneratesBinary())
                return new InputEventToAutoFileRecorder(mContext);
            else
                return new InputEventToRootAutomatorRecorder();
        }
    };
}
项目:atlas    文件:AtlasHacks.java   
public static void allClasses() throws HackAssertionException {
    if (android.os.Build.VERSION.SDK_INT <= 8) {
        LoadedApk = Hack.into("android.app.ActivityThread$PackageInfo");
    } else {
        LoadedApk = Hack.into("android.app.LoadedApk");
    }
    ActivityThread = Hack.into("android.app.ActivityThread");
    Resources = Hack.into(Resources.class);
    Application = Hack.into(Application.class);
    AssetManager = Hack.into(android.content.res.AssetManager.class);
    IPackageManager = Hack.into("android.content.pm.IPackageManager");
    Service = Hack.into(android.app.Service.class);
    ContextImpl = Hack.into("android.app.ContextImpl");
    ContextThemeWrapper = Hack.into(ContextThemeWrapper.class);
    ContextWrapper = Hack.into("android.content.ContextWrapper");
    sIsIgnoreFailure = true;
    ClassLoader = Hack.into(java.lang.ClassLoader.class);
    DexClassLoader = Hack.into(dalvik.system.DexClassLoader.class);
    LexFile = Hack.into("dalvik.system.LexFile");
    PackageParser$Component = Hack.into("android.content.pm.PackageParser$Component");
    PackageParser$Activity = Hack.into("android.content.pm.PackageParser$Activity");
    PackageParser$Service = Hack.into("android.content.pm.PackageParser$Service");
    PackageParser$Provider = Hack.into("android.content.pm.PackageParser$Provider");

    PackageParser = Hack.into("android.content.pm.PackageParser");
    PackageParser$Package = Hack.into("android.content.pm.PackageParser$Package");
    PackageParser$ActivityIntentInfo = Hack.into("android.content.pm.PackageParser$ActivityIntentInfo");
    PackageParser$ServiceIntentInfo = Hack.into("android.content.pm.PackageParser$ServiceIntentInfo");
    PackageParser$ProviderIntentInfo = Hack.into("android.content.pm.PackageParser$ProviderIntentInfo");

    ActivityManagerNative = Hack.into("android.app.ActivityManagerNative");
    Singleton = Hack.into("android.util.Singleton");
    ActivityThread$AppBindData = Hack.into("android.app.ActivityThread$AppBindData");
    ActivityManager = Hack.into("android.app.ActivityManager");
    StringBlock=Hack.into("android.content.res.StringBlock");
    sIsIgnoreFailure = false;
}