当前位置: 首页>>代码示例>>Java>>正文


Java ContextThemeWrapper类代码示例

本文整理汇总了Java中android.view.ContextThemeWrapper的典型用法代码示例。如果您正苦于以下问题:Java ContextThemeWrapper类的具体用法?Java ContextThemeWrapper怎么用?Java ContextThemeWrapper使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ContextThemeWrapper类属于android.view包,在下文中一共展示了ContextThemeWrapper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: ScriptListNavigatorContent

import android.view.ContextThemeWrapper; //导入依赖的package包/类
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));
        }

    });
}
 
开发者ID:feifadaima,项目名称:https-github.com-hyb1996-NoRootScriptDroid,代码行数:17,代码来源:ScriptListNavigatorContent.java

示例2: PendingAppWidgetHostView

import android.view.ContextThemeWrapper; //导入依赖的package包/类
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);
}
 
开发者ID:enricocid,项目名称:LaunchEnr,代码行数:26,代码来源:PendingAppWidgetHostView.java

示例3: IconAdapter

import android.view.ContextThemeWrapper; //导入依赖的package包/类
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;
        }
 
开发者ID:enricocid,项目名称:LaunchEnr,代码行数:20,代码来源:IconPackPreference.java

示例4: pullFontPathFromTextAppearance

import android.view.ContextThemeWrapper; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:takahirom,项目名称:DownloadableCalligraphy,代码行数:32,代码来源:CalligraphyUtils.java

示例5: createLabels

import android.view.ContextThemeWrapper; //导入依赖的package包/类
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);
  }
}
 
开发者ID:nhocga1995s,项目名称:MyCalendar,代码行数:19,代码来源:FloatingActionsMenu.java

示例6: createLabels

import android.view.ContextThemeWrapper; //导入依赖的package包/类
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);
        }
}
 
开发者ID:HelloChenJinJun,项目名称:TestChat,代码行数:19,代码来源:FloatingActionsMenu.java

示例7: inflateView

import android.view.ContextThemeWrapper; //导入依赖的package包/类
@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;
}
 
开发者ID:hyb1996,项目名称:Auto.js,代码行数:17,代码来源:LayoutBoundsFloatyWindow.java

示例8: inflateView

import android.view.ContextThemeWrapper; //导入依赖的package包/类
@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;
}
 
开发者ID:hyb1996,项目名称:Auto.js,代码行数:17,代码来源:LayoutHierarchyFloatyWindow.java

示例9: initFloaty

import android.view.ContextThemeWrapper; //导入依赖的package包/类
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);
}
 
开发者ID:hyb1996,项目名称:Auto.js,代码行数:21,代码来源:CircularMenu.java

示例10: popFilterMenu

import android.view.ContextThemeWrapper; //导入依赖的package包/类
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();
}
 
开发者ID:MobClub,项目名称:BBSSDK-for-Android,代码行数:25,代码来源:Theme1ForumThreadPullToRequestView.java

示例11: onCreate

import android.view.ContextThemeWrapper; //导入依赖的package包/类
@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));
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:27,代码来源:AboutChromePreferences.java

示例12: callActivityOnCreate

import android.view.ContextThemeWrapper; //导入依赖的package包/类
@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);
}
 
开发者ID:didi,项目名称:VirtualAPK,代码行数:26,代码来源:VAInstrumentation.java

示例13: inflateLayout

import android.view.ContextThemeWrapper; //导入依赖的package包/类
/**
 * 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();
    }
}
 
开发者ID:michael-rapp,项目名称:ChromeLikeTabSwitcher,代码行数:23,代码来源:AbstractTabSwitcherLayout.java

示例14: showTelescopeDialog

import android.view.ContextThemeWrapper; //导入依赖的package包/类
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();
}
 
开发者ID:rogues-dev,项目名称:superglue,代码行数:24,代码来源:TelescopeViewContainer.java

示例15: onCreateDialog

import android.view.ContextThemeWrapper; //导入依赖的package包/类
@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;
}
 
开发者ID:mozilla-mobile,项目名称:firefox-tv,代码行数:24,代码来源:OpenWithFragment.java


注:本文中的android.view.ContextThemeWrapper类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。