Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7138ee9f authored by Ricardo Cerqueira's avatar Ricardo Cerqueira
Browse files

4.2 Transition: Notification Header datetime click

- Fixes tiny clickable area for much smaller 4.2 date string
- remaps clock behavior:
  - click does open deskclock now - same as clicking clock widgets now does
  - long click jumps directly to alarm setup

Change-Id: Ib196ad45681ce3563eca2a1d353f45f4f68867d2

Conflicts:
	packages/SystemUI/src/com/android/systemui/statusbar/policy/DateView.java
parent 9c1ca71f
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.systemui.statusbar.policy;
import android.app.ActivityManagerNative;
import android.app.StatusBarManager;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
@@ -312,14 +313,17 @@ public class Clock extends TextView implements DemoMode, OnClickListener, OnLong

    @Override
    public void onClick(View v) {
        Intent intent = new Intent(AlarmClock.ACTION_SET_ALARM);
        // start com.android.deskclock/.DeskClock
        ComponentName clock = new ComponentName("com.android.deskclock",
                "com.android.deskclock.DeskClock");
        Intent intent = new Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_LAUNCHER)
                .setComponent(clock);
        collapseStartActivity(intent);
    }

    @Override
    public boolean onLongClick(View v) {
        Intent intent = new Intent("android.settings.DATE_SETTINGS");
        intent.addCategory(Intent.CATEGORY_DEFAULT);
        Intent intent = new Intent(AlarmClock.ACTION_SET_ALARM);
        collapseStartActivity(intent);

        // consume event
+19 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import android.content.ContentUris;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.graphics.Canvas;
import android.net.Uri;
import android.provider.CalendarContract;
import android.util.AttributeSet;
@@ -31,6 +32,7 @@ import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnLongClickListener;
import android.view.ViewParent;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.android.systemui.R;
@@ -48,6 +50,7 @@ public class DateView extends TextView implements OnClickListener, OnLongClickLi

    private SimpleDateFormat mDateFormat;
    private String mLastText;
    private RelativeLayout mParent;

    private BroadcastReceiver mIntentReceiver = new BroadcastReceiver() {
        @Override
@@ -91,10 +94,26 @@ public class DateView extends TextView implements OnClickListener, OnLongClickLi
    protected void onDetachedFromWindow() {
        super.onDetachedFromWindow();

        if (mParent != null) {
            mParent.setOnClickListener(null);
            mParent.setOnLongClickListener(null);
            mParent = null;
        }
        mDateFormat = null; // reload the locale next time
        mContext.unregisterReceiver(mIntentReceiver);
    }

    @Override
    protected void onDraw(Canvas canvas) {
        if (mParent == null) {
            mParent = (RelativeLayout) getParent();
            mParent.setOnClickListener(this);
            mParent.setOnLongClickListener(this);
        }

        super.onDraw(canvas);
    }

    protected void updateClock() {
        if (mDateFormat == null) {
            final String dateFormat = getContext().getString(R.string.system_ui_date_pattern);