Пример #1
0
 public ThemedSwitch(final Context context, final AttributeSet attrs, final int defStyle) {
   super(context, attrs, defStyle);
   if (!isInEditMode()) {
     setLinkTextColor(ThemeUtils.getUserLinkTextColor(context));
     setHighlightColor(ThemeUtils.getUserHighlightColor(context));
     setTypeface(ThemeUtils.getUserTypeface(context, getTypeface()));
   }
 }
 @Override
 public void setTheme(final int resid) {
   super.setTheme(mCurrentThemeResource = getThemeResourceId());
   ThemeUtils.applyWindowBackground(
       this,
       getWindow(),
       mCurrentThemeResource,
       mCurrentThemeBackgroundOption,
       mCurrentThemeBackgroundAlpha);
 }
 @Override
 public void onCreate(final Bundle icicle) {
   if (Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT) {
     getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
   }
   super.onCreate(icicle);
   final int themeColor = getThemeColor();
   final int themeResId = getCurrentThemeResourceId();
   final String backgroundOption = getCurrentThemeBackgroundOption();
   mMainContent.setDrawColor(true);
   mMainContent.setDrawShadow(false);
   mMainContent.setColor(themeColor);
   ViewSupport.setBackground(
       mDoneCancelBar,
       ThemeUtils.getActionBarBackground(this, themeResId, themeColor, backgroundOption, true));
   ViewCompat.setElevation(mDoneCancelBar, ThemeUtils.getSupportActionBarElevation(this));
   final View windowOverlay = findViewById(R.id.window_overlay);
   ViewSupport.setBackground(
       windowOverlay, ThemeUtils.getNormalWindowContentOverlay(this, themeResId));
 }
 @NonNull
 @Override
 public Dialog onCreateDialog(final Bundle savedInstanceState) {
   final Context wrapped = ThemeUtils.getDialogThemedContext(getActivity());
   final AlertDialog.Builder builder = new AlertDialog.Builder(wrapped);
   final ParcelableUserList userList = getUserList();
   if (userList != null) {
     builder.setTitle(getString(R.string.delete_user_list, userList.name));
     builder.setMessage(getString(R.string.delete_user_list_confirm_message, userList.name));
   }
   builder.setPositiveButton(android.R.string.ok, this);
   builder.setNegativeButton(android.R.string.cancel, null);
   return builder.create();
 }
 @NonNull
 @Override
 public Dialog onCreateDialog(final Bundle savedInstanceState) {
   final Context wrapped = ThemeUtils.getDialogThemedContext(getActivity());
   final AlertDialog.Builder builder = new AlertDialog.Builder(wrapped);
   final View view =
       LayoutInflater.from(wrapped).inflate(R.layout.dialog_auto_complete_textview, null);
   builder.setView(view);
   mEditText = (AutoCompleteTextView) view.findViewById(R.id.edit_text);
   if (savedInstanceState != null) {
     mEditText.setText(savedInstanceState.getCharSequence(EXTRA_TEXT));
   }
   mUserAutoCompleteAdapter = new ComposeAutoCompleteAdapter(wrapped);
   final Bundle args = getArguments();
   mUserAutoCompleteAdapter.setAccountId(args.getLong(EXTRA_ACCOUNT_ID));
   mEditText.setAdapter(mUserAutoCompleteAdapter);
   mEditText.setThreshold(1);
   mEditText.setFilters(new InputFilter[] {new InputFilter.LengthFilter(20)});
   builder.setTitle(R.string.screen_name);
   builder.setPositiveButton(android.R.string.ok, this);
   builder.setNegativeButton(android.R.string.cancel, this);
   return builder.create();
 }
 @NonNull
 @Override
 public Dialog onCreateDialog(final Bundle savedInstanceState) {
   final FragmentActivity activity = getActivity();
   final Context wrapped = ThemeUtils.getDialogThemedContext(activity);
   final AlertDialog.Builder builder = new AlertDialog.Builder(wrapped);
   final ParcelableUser user = getUser();
   if (user != null) {
     final UserColorNameManager manager = UserColorNameManager.getInstance(activity);
     final SharedPreferencesWrapper prefs =
         SharedPreferencesWrapper.getInstance(
             activity,
             SharedPreferencesWrapper.SHARED_PREFERENCES_NAME,
             Context.MODE_PRIVATE,
             SharedPreferenceConstants.class);
     final boolean nameFirst = prefs.getBoolean(KEY_NAME_FIRST);
     final String displayName = manager.getDisplayName(user, nameFirst, false);
     builder.setTitle(getString(R.string.report_user, displayName));
     builder.setMessage(getString(R.string.report_user_confirm_message, displayName));
   }
   builder.setPositiveButton(android.R.string.ok, this);
   builder.setNegativeButton(android.R.string.cancel, null);
   return builder.create();
 }
Пример #7
0
 public HighlightImageView(final Context context, final AttributeSet attrs, final int defStyle) {
   super(context, attrs, defStyle);
   if (isInEditMode()) return;
   setForeground(ThemeUtils.getImageHighlightDrawable(context));
 }
 @Override
 public int getActionBarColor() {
   return ThemeUtils.getActionBarColor(this);
 }
 @Override
 public int getThemeColor() {
   return ThemeUtils.getUserAccentColor(this);
 }
 @Override
 public String getThemeFontFamily() {
   return ThemeUtils.getThemeFontFamily(this);
 }
 @Override
 public String getThemeBackgroundOption() {
   return ThemeUtils.getThemeBackgroundOption(this);
 }
 @Override
 public int getThemeBackgroundAlpha() {
   return ThemeUtils.getUserThemeBackgroundAlpha(this);
 }
 @Override
 public int getThemeResourceId() {
   return ThemeUtils.getNoActionBarThemeResource(this);
 }