Пример #1
0
    @Override
    public View getDropDownView(int position, View convertView, ViewGroup parent) {
      View v = convertView;
      if (v == null)
        v = LayoutInflater.from(getContext()).inflate(R.layout.rd_item_dropdown_end, parent, false);

      ((TextView) v).setText(mDropDownItems[position]);
      return v;
    }
Пример #2
0
 private void updatePeriodUnit() {
   switch (mRecurring.getRepeatMode()) {
     case Recurring.REPEAT_DAILY:
       mPeriodUnitTextView.setText(
           mRecurring.getPeriod() == 1 ? R.string.rd_day : R.string.rd_days);
       break;
     case Recurring.REPEAT_WEEKLY:
       mPeriodUnitTextView.setText(
           mRecurring.getPeriod() == 1 ? R.string.rd_week : R.string.rd_weeks);
       break;
     case Recurring.REPEAT_MONTHLY:
       mPeriodUnitTextView.setText(
           mRecurring.getPeriod() == 1 ? R.string.rd_month : R.string.rd_months);
       break;
     case Recurring.REPEAT_YEARLY:
       mPeriodUnitTextView.setText(
           mRecurring.getPeriod() == 1 ? R.string.rd_year : R.string.rd_years);
       break;
   }
 }
Пример #3
0
  private void init(Context context, int style) {
    mContentPadding = ThemeUtil.dpToPx(context, 24);
    mActionMinWidth = ThemeUtil.dpToPx(context, 64);
    mActionHeight = ThemeUtil.dpToPx(context, 36);
    mActionOuterHeight = ThemeUtil.dpToPx(context, 48);
    mActionPadding = ThemeUtil.dpToPx(context, 8);
    mActionOuterPadding = ThemeUtil.dpToPx(context, 16);
    mDialogHorizontalPadding = ThemeUtil.dpToPx(context, 40);
    mDialogVerticalPadding = ThemeUtil.dpToPx(context, 24);

    mCardView = new DialogCardView(context);
    mContainer = new ContainerFrameLayout(context);
    mTitle = new TextView(context);
    mPositiveAction = new Button(context);
    mNegativeAction = new Button(context);
    mNeutralAction = new Button(context);

    mCardView.setPreventCornerOverlap(false);
    mCardView.setUseCompatPadding(true);

    mTitle.setPadding(
        mContentPadding, mContentPadding, mContentPadding, mContentPadding - mActionPadding);
    mPositiveAction.setId(ACTION_POSITIVE);
    mPositiveAction.setPadding(mActionPadding, 0, mActionPadding, 0);
    mPositiveAction.setBackgroundResource(0);
    mNegativeAction.setId(ACTION_NEGATIVE);
    mNegativeAction.setPadding(mActionPadding, 0, mActionPadding, 0);
    mNegativeAction.setBackgroundResource(0);
    mNeutralAction.setId(ACTION_NEUTRAL);
    mNeutralAction.setPadding(mActionPadding, 0, mActionPadding, 0);
    mNeutralAction.setBackgroundResource(0);

    mContainer.addView(mCardView);
    mCardView.addView(mTitle);
    mCardView.addView(mPositiveAction);
    mCardView.addView(mNegativeAction);
    mCardView.addView(mNeutralAction);

    cancelable(true);
    canceledOnTouchOutside(true);
    clearContent();
    onCreate();
    applyStyle(style);

    super.setContentView(mContainer);
  }
Пример #4
0
 public Dialog titleTextAppearance(int resId) {
   mTitle.setTextAppearance(getContext(), resId);
   return this;
 }
Пример #5
0
 public Dialog titleColor(int color) {
   mTitle.setTextColor(color);
   return this;
 }
Пример #6
0
 public Dialog title(CharSequence title) {
   mTitle.setText(title);
   mTitle.setVisibility(TextUtils.isEmpty(title) ? View.GONE : View.VISIBLE);
   return this;
 }
Пример #7
0
 private void updateNumberUnit() {
   mEndNumUnitTextView.setText(
       mRecurring.getEventNumber() == 1 ? R.string.rd_event : R.string.rd_events);
 }