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

Commit 7357ea8a authored by David van Tonder's avatar David van Tonder Committed by Gerrit Code Review
Browse files

Merge "4.2 Transition: Notification Header datetime click" into cm-10.1

parents 9eb5b7a9 809a7202
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;
@@ -281,14 +282,17 @@ public class Clock extends TextView implements OnClickListener, OnLongClickListe

    @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
+20 −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.text.format.DateFormat;
@@ -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;
@@ -40,6 +42,8 @@ import java.util.Date;
public class DateView extends TextView implements OnClickListener, OnLongClickListener {
    private static final String TAG = "DateView";

    private RelativeLayout mParent;

    private boolean mAttachedToWindow;
    private boolean mWindowVisible;
    private boolean mUpdating;
@@ -73,9 +77,25 @@ public class DateView extends TextView implements OnClickListener, OnLongClickLi
    protected void onDetachedFromWindow() {
        super.onDetachedFromWindow();
        mAttachedToWindow = false;
        if (mParent != null) {
            mParent.setOnClickListener(null);
            mParent.setOnLongClickListener(null);
            mParent = null;
        }
        setUpdates();
    }

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

        super.onDraw(canvas);
    }

    @Override
    protected void onWindowVisibilityChanged(int visibility) {
        super.onWindowVisibilityChanged(visibility);