List of usage examples for android.view ContextThemeWrapper ContextThemeWrapper
public ContextThemeWrapper(Context base, Resources.Theme theme)
From source file:com.nextgis.maplibui.dialog.NGDialog.java
@NonNull @Override//from w w w .j a v a 2 s . co m public Dialog onCreateDialog(Bundle savedInstanceState) { mActivity = getActivity(); mContext = new ContextThemeWrapper(mActivity, mTheme); int[] attrs = { android.R.attr.alertDialogStyle }; TypedArray ta = mContext.obtainStyledAttributes(mTheme, attrs); mDialogTheme = ta.getResourceId(0, R.style.Theme_NextGIS_AppCompat_Light_Dialog); ta.recycle(); if (savedInstanceState != null) { mTitle = savedInstanceState.getString(KEY_TITLE); setTheme(savedInstanceState.getInt(KEY_THEME)); } return super.onCreateDialog(savedInstanceState); }
From source file:com.koushikdutta.superuser.PolicyFragmentInternal.java
@Override public Context getContext() { if (mWrapper != null) return mWrapper; TypedValue value = new TypedValue(); super.getContext().getTheme().resolveAttribute(R.attr.largeIconTheme, value, true); mWrapper = new ContextThemeWrapper(super.getContext(), value.resourceId); return mWrapper; }
From source file:com.esminis.server.library.activity.DrawerFragment.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Context context = getActivity(); ((LibraryApplication) context.getApplicationContext()).getComponent().inject(this); PreferenceScreen screen = getPreferenceManager().createPreferenceScreen(context); setPreferenceScreen(screen);// w ww. j ava 2 s .c o m context = new ContextThemeWrapper(getActivity(), R.style.Preference); setupPreferences(screen, context); setupPreferencesValues(screen, context); }
From source file:be.evias.cloudLogin.FragmentProfile.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mContext = new ContextThemeWrapper(getActivity(), R.style.AppTheme); LayoutInflater localInflater = inflater.cloneInContext(mContext); View rootView = localInflater.inflate(R.layout.fragment_profile, container, false); TextView email_field = (TextView) rootView.findViewById(R.id.profileEmail); TextView name_field = (TextView) rootView.findViewById(R.id.profileName); email_field.setText(getCurrentUser().getEmail()); name_field.setText(getCurrentUser().getName()); return rootView; }
From source file:com.mishiranu.dashchan.content.service.AudioPlayerActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); context = new ContextThemeWrapper(this, Preferences.getThemeResource()); setVolumeControlStream(AudioManager.STREAM_MUSIC); float density = ResourceUtils.obtainDensity(this); LinearLayout linearLayout = new LinearLayout(context); linearLayout.setOrientation(LinearLayout.VERTICAL); int padding = getResources().getDimensionPixelSize(R.dimen.dialog_padding_view); linearLayout.setPadding(padding, padding, padding, C.API_LOLLIPOP ? (int) (8f * density) : padding); textView = new TextView(context, null, android.R.attr.textAppearanceListItem); linearLayout.addView(textView, LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); textView.setPadding(0, 0, 0, 0);//from w w w .j a v a2 s. c o m textView.setEllipsize(TextUtils.TruncateAt.END); textView.setSingleLine(true); LinearLayout horizontal = new LinearLayout(context); horizontal.setOrientation(LinearLayout.HORIZONTAL); horizontal.setGravity(Gravity.CENTER_VERTICAL); horizontal.setPadding(0, (int) (16f * density), 0, 0); linearLayout.addView(horizontal, LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); seekBar = new SeekBar(context); horizontal.addView(seekBar, new LinearLayout.LayoutParams(0, LinearLayout.LayoutParams.WRAP_CONTENT, 1)); seekBar.setPadding((int) (8f * density), 0, (int) (16f * density), 0); seekBar.setOnSeekBarChangeListener(this); button = new ImageButton(context); horizontal.addView(button, (int) (48f * density), (int) (48f * density)); button.setBackgroundResource( ResourceUtils.getResourceId(context, android.R.attr.listChoiceBackgroundIndicator, 0)); setPlayState(false); button.setOnClickListener(this); alertDialog = new AlertDialog.Builder(context).setView(linearLayout).setOnCancelListener(this) .setPositiveButton(R.string.action_stop, this).show(); IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction(AudioPlayerService.ACTION_TOGGLE); intentFilter.addAction(AudioPlayerService.ACTION_CANCEL); LocalBroadcastManager.getInstance(this).registerReceiver(audioPlayerReceiver, intentFilter); bindService(new Intent(this, AudioPlayerService.class), this, 0); }
From source file:org.cyanogenmod.designertools.ui.DualColorPickerDialog.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { View v = View.inflate(getContext(), R.layout.dialog_color_picker, null); initColorPickerViews();/* w ww. j a v a 2s . c o m*/ mViewPager = (ViewPager) v.findViewById(R.id.view_pager); mAdapter = new ColorPickerPagerAdapter(); mViewPager.setAdapter(mAdapter); mPageIndicator = (CirclePageIndicator) v.findViewById(R.id.view_pager_indicator); mPageIndicator.setViewPager(mViewPager); mPageIndicator.setFillColor(getContext().getColor(R.color.colorGridOverlayCardTint)); AlertDialog.Builder builder = new AlertDialog.Builder( new ContextThemeWrapper(getContext(), R.style.AppDialog)); builder.setView(v).setTitle(R.string.color_picker_title) .setPositiveButton(R.string.color_picker_accept, mClickListener) .setNegativeButton(R.string.color_picker_cancel, mClickListener); return builder.create(); }
From source file:butter.droid.fragments.dialog.LoadingBeamingDialogFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = LayoutInflater.from(new ContextThemeWrapper(getActivity(), R.style.Theme_Butter)) .inflate(R.layout.fragment_loading_detail, container, false); ButterKnife.bind(this, v); mTextView.setText(R.string.starting_beam); return v;//from w w w .j a v a2 s .c o m }
From source file:pct.droid.fragments.dialog.LoadingBeamingDialogFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = LayoutInflater.from(new ContextThemeWrapper(getActivity(), R.style.Theme_PopcornTime)) .inflate(R.layout.fragment_loading_detail, container, false); ButterKnife.bind(this, v); mTextView.setText(R.string.starting_beam); return v;// w ww . ja v a2 s .c o m }
From source file:pct.droid.dialogfragments.LoadingBeamingDialogFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = LayoutInflater.from(new ContextThemeWrapper(getActivity(), R.style.Theme_PopcornTime)) .inflate(R.layout.fragment_loading_detail, container, false); ButterKnife.inject(this, v); mTextView.setText(R.string.starting_beam); return v;/*from w ww. ja va 2 s .c om*/ }
From source file:android.support.v7ox.widget.AbsActionBarView.java
AbsActionBarView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); final TypedValue tv = new TypedValue(); if (context.getTheme().resolveAttribute(R.attr.actionBarPopupTheme_ox, tv, true) && tv.resourceId != 0) { mPopupContext = new ContextThemeWrapper(context, tv.resourceId); } else {/*from w w w. j a v a 2s . c o m*/ mPopupContext = context; } }