Exemplo n.º 1
0
 public ZenModePanel(Context context, AttributeSet attrs) {
   super(context, attrs);
   mContext = context;
   mPrefs = new Prefs();
   mInflater = LayoutInflater.from(mContext.getApplicationContext());
   mIconPulser = new IconPulser(mContext);
   final Resources res = mContext.getResources();
   mSubheadWarningColor = res.getColor(R.color.system_warning_color);
   mSubheadColor = res.getColor(R.color.qs_subhead);
   mInterpolator =
       AnimationUtils.loadInterpolator(
           mContext, com.android.internal.R.interpolator.fast_out_slow_in);
   mCountdownConditionSupported =
       NotificationManager.from(mContext)
           .isSystemConditionProviderEnabled(ZenModeConfig.COUNTDOWN_PATH);
   final int countdownDelta = mCountdownConditionSupported ? 1 : 0;
   mFirstConditionIndex = COUNTDOWN_CONDITION_INDEX + countdownDelta;
   final int minConditions = 1 /*forever*/ + countdownDelta;
   mMaxConditions =
       MathUtils.constrain(res.getInteger(R.integer.zen_mode_max_conditions), minConditions, 100);
   mMaxOptionalConditions = mMaxConditions - minConditions;
   mForeverId = Condition.newId(mContext).appendPath("forever").build();
   if (DEBUG) Log.d(mTag, "new ZenModePanel");
 }
Exemplo n.º 2
0
 private static Condition copy(Condition condition) {
   return condition == null ? null : condition.copy();
 }