Java Code Examples for android.view.ContextThemeWrapper

The following are top voted examples for showing how to use android.view.ContextThemeWrapper. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: https-github.com-hyb1996-NoRootScriptDroid   File: ScriptListNavigatorContent.java   View source code 6 votes vote down vote up
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));
        }

    });
}
 
Example 2
Project: LaunchEnr   File: PendingAppWidgetHostView.java   View source code 6 votes vote down vote up
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);
}
 
Example 3
Project: LaunchEnr   File: IconPackPreference.java   View source code 6 votes vote down vote up
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;
        }
 
Example 4
Project: DownloadableCalligraphy   File: CalligraphyUtils.java   View source code 6 votes vote down vote up
/**
 * 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;
}
 
Example 5
Project: MyCalendar   File: FloatingActionsMenu.java   View source code 6 votes vote down vote up
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);
  }
}
 
Example 6
Project: TestChat   File: FloatingActionsMenu.java   View source code 6 votes vote down vote up
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);
        }
}
 
Example 7
Project: Auto.js   File: LayoutBoundsFloatyWindow.java   View source code 6 votes vote down vote up
@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;
}
 
Example 8
Project: Auto.js   File: LayoutHierarchyFloatyWindow.java   View source code 6 votes vote down vote up
@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;
}
 
Example 9
Project: Auto.js   File: CircularMenu.java   View source code 6 votes vote down vote up
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);
}
 
Example 10
Project: BBSSDK-for-Android   File: Theme1ForumThreadPullToRequestView.java   View source code 6 votes vote down vote up
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();
}
 
Example 11
Project: chromium-for-android-56-debug-video   File: AboutChromePreferences.java   View source code 6 votes vote down vote up
@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));
}
 
Example 12
Project: VirtualAPK   File: VAInstrumentation.java   View source code 6 votes vote down vote up
@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);
}
 
Example 13
Project: ChromeLikeTabSwitcher   File: AbstractTabSwitcherLayout.java   View source code 6 votes vote down vote up
/**
 * 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();
    }
}
 
Example 14
Project: superglue   File: TelescopeViewContainer.java   View source code 6 votes vote down vote up
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();
}
 
Example 15
Project: superglue   File: TelescopeViewContainer.java   View source code 6 votes vote down vote up
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();
}
 
Example 16
Project: firefox-tv   File: OpenWithFragment.java   View source code 6 votes vote down vote up
@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;
}
 
Example 17
Project: boohee_v5.6   File: ToolbarActionBar.java   View source code 6 votes vote down vote up
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);
    }
}
 
Example 18
Project: Android_watch_magpie   File: MainActivity.java   View source code 6 votes vote down vote up
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();
}
 
Example 19
Project: GravityBox   File: UnlockActivity.java   View source code 6 votes vote down vote up
@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();
}
 
Example 20
Project: GravityBox   File: UnlockActivity.java   View source code 6 votes vote down vote up
@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);
}
 
Example 21
Project: SimpleUILauncher   File: PendingAppWidgetHostView.java   View source code 6 votes vote down vote up
@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));
    }
}
 
Example 22
Project: FlickLauncher   File: PendingAppWidgetHostView.java   View source code 6 votes vote down vote up
@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));
    }
}
 
Example 23
Project: https-github.com-hyb1996-NoRootScriptDroid   File: RecordNavigatorContent.java   View source code 5 votes vote down vote up
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);
}
 
Example 24
Project: https-github.com-hyb1996-NoRootScriptDroid   File: HoverMenuService.java   View source code 5 votes vote down vote up
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);
}
 
Example 25
Project: https-github.com-hyb1996-NoRootScriptDroid   File: GlobalRecorder.java   View source code 5 votes vote down vote up
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);
}
 
Example 26
Project: SkinFramework   File: SkinResource.java   View source code 5 votes vote down vote up
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);
}
 
Example 27
Project: LaunchEnr   File: PopupContainerWithArrow.java   View source code 5 votes vote down vote up
/**
 * 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;
}
 
Example 28
Project: adyen-android   File: IssuerSelectionFragment.java   View source code 5 votes vote down vote up
@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;
}
 
Example 29
Project: mobile-store   File: InstallExtensionDialogActivity.java   View source code 5 votes vote down vote up
@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();
}
 
Example 30
Project: mobile-store   File: InstallExtensionDialogActivity.java   View source code 5 votes vote down vote up
@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();
    }
}
 
Example 31
Project: mobile-store   File: InstallExtensionDialogActivity.java   View source code 5 votes vote down vote up
@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();
}
 
Example 32
Project: mobile-store   File: InstallExtensionDialogActivity.java   View source code 5 votes vote down vote up
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!");
    }
}
 
Example 33
Project: mobile-store   File: InstallExtensionDialogActivity.java   View source code 5 votes vote down vote up
@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();
}
 
Example 34
Project: SOS-The-Healthcare-Companion   File: LoginFragment.java   View source code 5 votes vote down vote up
@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;
}
 
Example 35
Project: CSipSimple   File: IcsListPopupWindow.java   View source code 5 votes vote down vote up
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);
}
 
Example 36
Project: react-native-recyclerview-list   File: RecyclerViewBackedScrollView.java   View source code 5 votes vote down vote up
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));
}
 
Example 37
Project: sctalk   File: IMUIHelper.java   View source code 5 votes vote down vote up
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();
}
 
Example 38
Project: Auto.js   File: CircularMenu.java   View source code 5 votes vote down vote up
public CircularMenu(Context context) {
    mContext = new ContextThemeWrapper(context, R.style.AppTheme);
    initFloaty();
    setupListeners();
    mRecorder = GlobalActionRecorder.getSingleton(context);
    mRecorder.addOnStateChangedListener(this);
}
 
Example 39
Project: Auto.js   File: GlobalActionRecorder.java   View source code 5 votes vote down vote up
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();
        }
    };
}
 
Example 40
Project: atlas   File: AtlasHacks.java   View source code 5 votes vote down vote up
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;
}