android.view.ContextThemeWrapper Java Examples
The following examples show how to use
android.view.ContextThemeWrapper.
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: TreeNodeWrapperView.java From java-n-IDE-for-Android with Apache License 2.0 | 6 votes |
private void init() { setOrientation(LinearLayout.VERTICAL); nodeContainer = new RelativeLayout(getContext()); nodeContainer.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); nodeContainer.setId(R.id.node_header); ContextThemeWrapper newContext = new ContextThemeWrapper(getContext(), containerStyle); nodeItemsContainer = new LinearLayout(newContext, null, containerStyle); nodeItemsContainer.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); nodeItemsContainer.setId(R.id.node_items); nodeItemsContainer.setOrientation(LinearLayout.VERTICAL); nodeItemsContainer.setVisibility(View.GONE); addView(nodeContainer); addView(nodeItemsContainer); }
Example #2
Source File: WorldMapDialog.java From SuntimesWidget with GNU General Public License v3.0 | 6 votes |
@Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup parent, @Nullable Bundle savedState) { ContextThemeWrapper contextWrapper = new ContextThemeWrapper(getActivity(), AppSettings.loadTheme(getContext())); // hack: contextWrapper required because base theme is not properly applied dialogContent = inflater.cloneInContext(contextWrapper).inflate(R.layout.layout_dialog_worldmap, parent, false); initLocale(getContext()); initViews(getContext(), dialogContent); if (savedState != null) { Log.d(LOGTAG, "WorldMapDialog onCreate (restoreState)"); worldmap.loadSettings(getContext(), savedState); } themeViews(dialogContent.getContext()); return dialogContent; }
Example #3
Source File: UIHelper.java From ans-android-sdk with GNU General Public License v3.0 | 6 votes |
private static boolean isDialogBelongActivity(Context dialogContext, Context activityContext) { int limit = 0; while (true) { if (dialogContext == activityContext) { return true; } if (!(dialogContext instanceof ContextThemeWrapper)) { return false; } //防止极端情况 if (limit++ > 10) { return false; } dialogContext = ((ContextThemeWrapper) dialogContext).getBaseContext(); } }
Example #4
Source File: TreeNodeWrapperView.java From javaide with GNU General Public License v3.0 | 6 votes |
private void init() { setOrientation(LinearLayout.VERTICAL); nodeContainer = new RelativeLayout(getContext()); nodeContainer.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); nodeContainer.setId(R.id.node_header); ContextThemeWrapper newContext = new ContextThemeWrapper(getContext(), containerStyle); nodeItemsContainer = new LinearLayout(newContext, null, containerStyle); nodeItemsContainer.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); nodeItemsContainer.setId(R.id.node_items); nodeItemsContainer.setOrientation(LinearLayout.VERTICAL); nodeItemsContainer.setVisibility(View.GONE); addView(nodeContainer); addView(nodeItemsContainer); }
Example #5
Source File: SelectInstallModeFragment.java From commcare-android with Apache License 2.0 | 6 votes |
private void showLocalAppDialog() { ContextThemeWrapper wrapper = new ContextThemeWrapper(getContext(), R.style.DialogBaseTheme); final PaneledChoiceDialog chooseApp = new PaneledChoiceDialog(wrapper, Localization.get("install.choose.local.app")); DialogChoiceItem[] items = new DialogChoiceItem[mLocalApps.size()]; int count = 0; for (final MicroNode.AppManifest app : mLocalApps) { DialogChoiceItem item = new DialogChoiceItem(app.getName(), -1, v -> { Activity currentActivity = getActivity(); if (currentActivity instanceof CommCareSetupActivity) { ((CommCareSetupActivity)currentActivity).onURLChosen(app.getLocalUrl()); } ((CommCareActivity)getActivity()).dismissAlertDialog(); }); items[count] = item; count++; } chooseApp.setChoiceItems(items); ((CommCareActivity)getActivity()).showAlertDialog(chooseApp); }
Example #6
Source File: DropDown.java From Carbon with Apache License 2.0 | 6 votes |
private void initDropDown(AttributeSet attrs, @AttrRes int defStyleAttr, @StyleRes int defStyleRes) { TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.DropDown, defStyleAttr, defStyleRes); int theme = a.getResourceId(R.styleable.DropDown_carbon_popupTheme, -1); dropDownMenu = new DropDownMenu(new ContextThemeWrapper(getContext(), theme)); dropDownMenu.setOnDismissListener(() -> isShowingPopup = false); dropDownMenu.setPopupMode(PopupMode.values()[a.getInt(R.styleable.DropDown_carbon_popupMode, PopupMode.Over.ordinal())]); setMode(Mode.values()[a.getInt(R.styleable.DropDown_carbon_mode, Mode.SingleSelect.ordinal())]); dropDownMenu.setOnItemClickedListener(onItemClickedListener); setButtonDrawable(Carbon.getDrawable(this, a, R.styleable.DropDown_android_button, R.drawable.carbon_dropdown)); for (int i = 0; i < a.getIndexCount(); i++) { int attr = a.getIndex(i); if (attr == R.styleable.DropDown_android_drawablePadding) { drawablePadding = a.getDimension(attr, 0); } else if (attr == R.styleable.DropDown_carbon_buttonGravity) { buttonGravity = ButtonGravity.values()[a.getInt(attr, 0)]; } } a.recycle(); }
Example #7
Source File: AbstractTabSwitcherLayout.java From ChromeLikeTabSwitcher with Apache License 2.0 | 6 votes |
/** * 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 #8
Source File: OSFragment.java From DeviceInfo with Apache License 2.0 | 6 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final Context contextThemeWrapper = new ContextThemeWrapper(getActivity(), R.style.OSTheme); LayoutInflater localInflater = inflater.cloneInContext(contextThemeWrapper); View view = localInflater.inflate(R.layout.fragment_os, container, false); unbinder = ButterKnife.bind(this, view); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { Window window = getActivity().getWindow(); window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); window.setStatusBarColor(getResources().getColor(R.color.dark_blue)); window.setNavigationBarColor(getResources().getColor(R.color.dark_blue)); } /* View view = inflater.inflate(R.layout.fragment_os, container, false); unbinder = ButterKnife.bind(this, view); */ return view; }
Example #9
Source File: ThemeView.java From SAI with GNU General Public License v3.0 | 6 votes |
public void setTheme(Theme.ThemeDescriptor theme) { mThemeTitle.setText(theme.getName(getContext())); Context themedContext = new ContextThemeWrapper(getContext(), theme.getTheme()); setCardBackgroundColor(Utils.getThemeColor(themedContext, R.attr.colorPrimary)); int accentColor = Utils.getThemeColor(themedContext, R.attr.colorAccent); setStrokeColor(accentColor); mThemeTitle.setTextColor(accentColor); if (Utils.apiIsAtLeast(Build.VERSION_CODES.M)) { setRippleColor(themedContext.getColorStateList(R.color.selector_theme_card_ripple)); } mThemeMessage.setTextColor(Utils.getThemeColor(themedContext, android.R.attr.textColorPrimary)); }
Example #10
Source File: DetailedActivity.java From 1Rramp-Android with MIT License | 6 votes |
private void showPopup() { int menu_res_id = R.menu.popup_post; String currentLoggedInUser = HaprampPreferenceManager.getInstance().getCurrentSteemUsername(); ContextThemeWrapper contextThemeWrapper = new ContextThemeWrapper(this, R.style.PopupMenuOverlapAnchor); PopupMenu popup = new PopupMenu(contextThemeWrapper, overflowBtn); //customize menu items //add Share popup.getMenu().add(PostMenu.Share); popup.getMenu().add(PostMenu.Repost); popup.getMenuInflater().inflate(menu_res_id, popup.getMenu()); popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { if (item.getTitle().equals(PostMenu.Share)) { ShareUtils.shareMixedContent(DetailedActivity.this, post); return true; } else if (item.getTitle().equals(PostMenu.Repost)) { showAlertDialogForRepost(); } return false; } }); popup.show(); }
Example #11
Source File: ActionController.java From science-journal with Apache License 2.0 | 6 votes |
/** * Updates the add note button for {@link TextNoteFragment} and {@link GalleryNoteFragment} when * a recording starts/stops. */ public void attachAddButton(FloatingActionButton button) { recordingStatus .takeUntil(RxView.detaches(button)) .subscribe( status -> { Theme theme = button.getContext().getTheme(); if (status.state.shouldShowStopButton()) { theme = new ContextThemeWrapper( button.getContext(), R.style.RecordingProgressBarColor).getTheme(); } button.setImageDrawable( ResourcesCompat.getDrawable( button.getResources(), R.drawable.ic_send_24dp, theme)); TypedValue iconColor = new TypedValue(); theme.resolveAttribute(R.attr.icon_color, iconColor, true); TypedValue iconBackground = new TypedValue(); theme.resolveAttribute(R.attr.icon_background, iconBackground, true); button.setBackgroundTintList(ColorStateList.valueOf( button.getResources().getColor(iconBackground.resourceId))); button.setRippleColor(button.getResources().getColor(iconColor.resourceId)); }); }
Example #12
Source File: VideoCardPresenter.java From leanback-showcase with Apache License 2.0 | 6 votes |
CardViewHolder(ImageCardView view, Context context) { super(view); mContext = context; Context wrapper = new ContextThemeWrapper(mContext, R.style.MyPopupMenu); mPopupMenu = new PopupMenu(wrapper, view); mPopupMenu.inflate(R.menu.popup_menu); mPopupMenu.setOnMenuItemClickListener(this); view.setOnLongClickListener(this); mOwner = (LifecycleOwner) mContext; mDefaultBackground = mContext.getResources().getDrawable(R.drawable.no_cache_no_internet, null); mDefaultPlaceHolder = new RequestOptions(). placeholder(mDefaultBackground); mCardView = (ImageCardView) CardViewHolder.this.view; Resources resources = mCardView.getContext().getResources(); mCardView.setMainImageDimensions(Math.round( resources.getDimensionPixelSize(R.dimen.card_width)), resources.getDimensionPixelSize(R.dimen.card_height)); mFragmentActivity = (FragmentActivity) context; mViewModel = ViewModelProviders.of(mFragmentActivity).get(VideosViewModel.class); }
Example #13
Source File: SetupWizardTicTacToeController.java From talkback with Apache License 2.0 | 6 votes |
private void displayFinishDialog(String outcome) { setGameButtonsEnabled(false); resetButton.setEnabled(true); AlertDialog.Builder gameOverBuilder = new AlertDialog.Builder( new ContextThemeWrapper(context, R.style.SetupGuideAlertDialogStyle)); gameOverBuilder.setTitle(outcome); gameOverBuilder.setMessage(context.getString(R.string.game_outcome_body_text)); gameOverBuilder.setNegativeButton( context.getString(R.string.game_outcome_negative_response), (dialogInterface, viewId) -> { ((Activity) context).recreate(); KeyAssignmentUtils.clearAllKeyPrefs(context); dialogInterface.cancel(); }); gameOverBuilder.setPositiveButton( context.getString(R.string.game_outcome_positive_response), (dialogInterface, viewId) -> dialogInterface.cancel()); AlertDialog gameOverDialog = gameOverBuilder.create(); gameOverDialog.show(); }
Example #14
Source File: MyTripFriendNameAdapter.java From Travel-Mate with MIT License | 5 votes |
/** * @param friendFirstName first name of friend to be removed * to display in alert dialog's message */ private void showFriendRemoveDialog(String friendFirstName) { ContextThemeWrapper crt = new ContextThemeWrapper(mContext, R.style.AlertDialog); AlertDialog.Builder builder = new AlertDialog.Builder(crt); builder.setMessage(String.format(mContext.getString(R.string.remove_friend_message), friendFirstName)) .setPositiveButton(R.string.positive_button, (dialog, which) -> removeFriend()) .setNegativeButton(android.R.string.cancel, (dialog, which) -> { }); builder.create().show(); }
Example #15
Source File: SplashActivity.java From guanggoo-android with Apache License 2.0 | 5 votes |
private void showPrivacyPolicy() { View v = LayoutInflater.from(this).inflate(R.layout.dialog_privacy_policy, null); AlertDialog alertDialog = new AlertDialog.Builder(new ContextThemeWrapper(this, R.style.AppTheme_AlertDialog)) .setTitle(R.string.privacy_policy_title) .setView(v) .setPositiveButton(R.string.agree, (dialog, which) -> { PrefsUtil.putInt(SplashActivity.this, ConstantUtil.KEY_PRIVACY_POLICY_AGREED_VERSION, 1); dialog.dismiss(); doAuthCheck(); }) .setNegativeButton(R.string.not_agree_now, (dialog, which) -> SplashActivity.this.finish()) .setCancelable(false) .create(); TextView tvAlreadyRead = v.findViewById(R.id.privacy_policy_tip); SpannableString spannableString = new SpannableString("请您务必审慎阅读、充分理解用户信息保护及隐私政策各条款,包括但不限于:个人信息收集及使用、信息使用方式和信息的保护等,您可以在「关于我们」界面随时查看用户信息保护及隐私政策。\n\n您可阅读《用户信息保护及隐私政策》了解详细信息。如您同意,请点击「同意」开始接受我们的服务。"); ClickableSpan clickableSpan = new ClickableSpan() { @Override public void onClick(View view) { startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(ConstantUtil.PRIVACY_URL))); } @Override public void updateDrawState(TextPaint ds) { ds.setColor(ContextCompat.getColor(SplashActivity.this, R.color.colorPrimary));//设置颜色 ds.setUnderlineText(false);//去掉下划线 } }; spannableString.setSpan(clickableSpan, 93, 106, Spannable.SPAN_EXCLUSIVE_INCLUSIVE); ForegroundColorSpan colorSpan = new ForegroundColorSpan(ContextCompat.getColor(this, R.color.colorPrimary)); spannableString.setSpan(colorSpan, 93, 106, Spannable.SPAN_EXCLUSIVE_INCLUSIVE); tvAlreadyRead.setText(spannableString); tvAlreadyRead.setMovementMethod(LinkMovementMethod.getInstance()); alertDialog.show(); }
Example #16
Source File: MaterialSuggestionsSearchView.java From QuickLyric with GNU General Public License v3.0 | 5 votes |
public void refreshSuggestions() { Editable text; if (getContext() instanceof Activity) text = ((EditText) ((Activity) getContext()).findViewById(R.id.searchTextView)).getText(); else if (getContext() instanceof ContextThemeWrapper) text = ((EditText) ((Activity) ((ContextThemeWrapper) getContext()).getBaseContext()).findViewById(R.id.searchTextView)).getText(); else if (getContext() instanceof android.support.v7.view.ContextThemeWrapper) text = ((EditText) ((Activity) ((android.support.v7.view.ContextThemeWrapper) getContext()).getBaseContext()).findViewById(R.id.searchTextView)).getText(); else return; setQuery(text, false); }
Example #17
Source File: IcsListPopupWindow.java From CSipSimple with GNU General Public License v3.0 | 5 votes |
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 #18
Source File: ShortcutGeneratorDialogs.java From TvAppRepo with Apache License 2.0 | 5 votes |
public static void initWebBookmarkDialog(final Activity activity) { new MaterialDialog.Builder(new ContextThemeWrapper(activity, R.style.dialog_theme)) .title(R.string.generate_web_bookmark) .customView(R.layout.dialog_web_bookmark, false) .onPositive(new MaterialDialog.SingleButtonCallback() { @Override public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) { String tag = ((EditText) dialog.getCustomView().findViewById(R.id.tag)).getText().toString(); if (!tag.contains("http://") && !tag.contains("https://")) { tag = "http://" + tag; Log.w(TAG, "URL added without http..."); } String label = tag.replaceAll("(http://)|(https://)", ""); Log.d(TAG, IntentUriGenerator.generateWebBookmark(tag)); try { AdvancedOptions options = new AdvancedOptions(activity) .setIntentUri(IntentUriGenerator.generateWebBookmark(tag)) .setIconUrl("https://raw.githubusercontent.com/ITVlab/TvAppRepo/master/promo/graphics/icon.png") // TODO Replace icon url .setCustomLabel(label); GenerateShortcutHelper.begin(activity, label, options); } catch (AdvancedOptions.StringLengthException exception) { Toast.makeText(activity, exception.getMessage(), Toast.LENGTH_SHORT) .show(); } } }) .positiveText(R.string.generate_shortcut) .show(); }
Example #19
Source File: UberButtonTest.java From rides-android-sdk with MIT License | 5 votes |
@Test public void getActivity_whenContextWrapper_shouldReturnActivity() { final Activity testActivity = Robolectric.setupActivity(Activity.class); final ContextThemeWrapper contextThemeWrapper = new ContextThemeWrapper(testActivity, 0); UberButton uberButton = new UberButton(contextThemeWrapper, null, 0, 0) { }; assertThat(uberButton.getActivity()).isSameAs(testActivity); }
Example #20
Source File: HealthManager.java From Small with Apache License 2.0 | 5 votes |
private static void dumpAssets(Object obj, boolean isThemeError) { if (!(obj instanceof Activity)) { return; } Activity activity = (Activity) obj; int themeId = 0; String err = ""; if (isThemeError) { try { Field f = ContextThemeWrapper.class.getDeclaredField("mThemeResource"); f.setAccessible(true); themeId = (int) f.get(activity); err += "Failed to link theme " + String.format("0x%08x", themeId) + "!\n"; } catch (Exception ignored) { } } AssetManager assets = activity.getAssets(); AssetManager appAssets = activity.getApplication().getAssets(); if (!assets.equals(appAssets)) { err += "The activity assets are different from application.\n"; err += getAssetPathsDebugInfo(appAssets, themeId, "Application") + "\n"; err += getAssetPathsDebugInfo(assets, themeId, "Activity"); } else { err += getAssetPathsDebugInfo(assets, themeId, "Activity"); } Log.e(TAG, err); }
Example #21
Source File: IcsListPopupWindow.java From Libraries-for-Android-Developers with MIT License | 5 votes |
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 #22
Source File: ListMovieInterestsFragment.java From Movie-Check with Apache License 2.0 | 5 votes |
@Override public void showMovieInterests(List<MovieInterest> movieInterestList) { this.movieInterestList = movieInterestList; linearLayoutAnyFounded.setVisibility(View.GONE); recyclerViewMovieInterests.setVisibility(View.VISIBLE); final GridLayoutManager layoutManager = new GridLayoutManager(getActivity(), 1, GridLayoutManager.VERTICAL, false); recyclerViewMovieInterests.setLayoutManager(layoutManager); recyclerViewMovieInterests.setItemAnimator(new DefaultItemAnimator()); movieInterestListAdapter = new MovieInterestListAdapter(movieInterestList, new OnItemClickListener<MovieInterest>() { @Override public void onClick(MovieInterest movieInterest, View view) { startActivity(MovieProfileActivity.newIntent(getActivity(), movieInterest.getMovie())); } @Override public void onLongClick(final MovieInterest movieInterest, View view) { new AlertDialog.Builder(new ContextThemeWrapper(getActivity(), R.style.DialogLight)).setItems(new CharSequence[]{getActivity().getString(R.string.listmovieinterestfragment_remove)}, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { switch (which) { case 0: removeMovieInterest(movieInterest); break; } } }).create().show(); } }); recyclerViewMovieInterests.setAdapter(movieInterestListAdapter); }
Example #23
Source File: CustomProfilesAdapter.java From Aria2App with GNU General Public License v3.0 | 5 votes |
public CustomProfilesAdapter(Context context, List<MultiProfile> profiles, @StyleRes int overrideStyle, DrawerManager.ProfilesDrawerListener<MultiProfile> listener) { super(context, profiles, listener); if (overrideStyle == 0) this.inflater = LayoutInflater.from(context); else this.inflater = LayoutInflater.from(new ContextThemeWrapper(context, overrideStyle)); forceWhite = overrideStyle == R.style.ForceWhite; }
Example #24
Source File: AlertDialogFactory.java From Common with Apache License 2.0 | 5 votes |
/** * LoadingDialog */ public Dialog getLoadingDialog(String text) { final AlertDialog dlg = new AlertDialog .Builder(new ContextThemeWrapper(mContext, R.style.lib_pub_dialog_style)) .create(); if (mContext instanceof Activity && !((Activity) mContext).isFinishing()) { dlg.show(); } dlg.setContentView(R.layout.lib_pub_dialog_loading); TextView tips = (TextView) dlg.findViewById(R.id.tv_tips); if (text != null) { tips.setText(text); } return dlg; }
Example #25
Source File: AtlasHacks.java From atlas with Apache License 2.0 | 5 votes |
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"); ApplicationLoaders = Hack.into("android.app.ApplicationLoaders"); sIsIgnoreFailure = false; }
Example #26
Source File: DatabaseMenu.java From DataInspector with Apache License 2.0 | 5 votes |
@SuppressWarnings("ConstantConditions") public DatabaseMenu(final Context context) { super(context); DataInspector.runtimeComponentMap.get(context).inject(this); inflate(context, R.layout.data_inspector_database_menu, this); View openPreferenceEditor = findViewById(R.id.open_database_editor); openPreferenceEditor.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { new DatabaseEditorDialog( new ContextThemeWrapper(context, BaseDialog.getDialogTheme(context))).show(); } }); }
Example #27
Source File: OverlayInfoButtonView.java From oversec with GNU General Public License v3.0 | 5 votes |
public OverlayInfoButtonView(Core core, String encryptedText, Rect boundsInScreen, String packageName) { super(core, packageName); mEncryptedText = encryptedText; mBoundsInScreen = new Rect(boundsInScreen); mHeight = core.dipToPixels(HEIGHT_DP); //noinspection SuspiciousNameCombination mWidth = mHeight; updateLayoutParams(); ContextThemeWrapper ctw = new ContextThemeWrapper(core.getCtx(), R.style.AppTheme); mView = (ImageButton) LayoutInflater.from(ctw) .inflate(R.layout.overlay_info_button, null); //noinspection deprecation addView(mView, new AbsoluteLayout.LayoutParams(mWidth, mHeight, 0, 0)); calcPosition(); mView.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { mCore.removeOverlayDecrypt(false); EncryptionInfoActivity.Companion.show(getContext(), mPackageName, mEncryptedText, mView); } }); }
Example #28
Source File: BaseDialog.java From ViewInspector with Apache License 2.0 | 5 votes |
public BaseDialog(Context context) { super(context); ViewInspector.runtimeComponentMap.get(((ContextThemeWrapper) context).getBaseContext()) .inject(this); setCancelable(true); setCanceledOnTouchOutside(true); setOnCancelListener(new OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { restoreOpenedMenu(); } }); }
Example #29
Source File: ChatFragment.java From sctalk with Apache License 2.0 | 5 votes |
private void handleContactItemLongClick(final Context ctx, final RecentInfo recentInfo) { AlertDialog.Builder builder = new AlertDialog.Builder(new ContextThemeWrapper(ctx, android.R.style.Theme_Holo_Light_Dialog)); builder.setTitle(recentInfo.getName()); final boolean isTop = imService.getConfigSp().isTopSession(recentInfo.getSessionKey()); int topMessageRes = isTop?R.string.cancel_top_message:R.string.top_message; String[] items = new String[]{ctx.getString(R.string.check_profile), ctx.getString(R.string.delete_session), ctx.getString(topMessageRes)}; builder.setItems(items, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { switch (which) { case 0 : IMUIHelper.openUserProfileActivity(ctx, recentInfo.getPeerId()); break; case 1 : imService.getSessionManager().reqRemoveSession(recentInfo); break; case 2:{ imService.getConfigSp().setSessionTop(recentInfo.getSessionKey(),!isTop); }break; } } }); AlertDialog alertDialog = builder.create(); alertDialog.setCanceledOnTouchOutside(true); alertDialog.show(); }
Example #30
Source File: BaseFragment.java From PocketEOS-Android with GNU Lesser General Public License v3.0 | 5 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (mView == null) { boolean isLight = Utils.getSpUtils().getString("loginmode").equals("phone"); Context contextThemeWrapper = new ContextThemeWrapper(getActivity(), isLight ? R.style.ThemeLight : R.style.ThemeDark); LayoutInflater localInflater = inflater.cloneInContext(contextThemeWrapper); mView = localInflater.inflate(getContentViewLayoutID(), null); } ViewGroup parent = (ViewGroup) mView.getParent(); if (parent != null) { parent.removeView(mView); } return mView; }