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

Commit 69ba4ed9 authored by Isaac Katzenelson's avatar Isaac Katzenelson
Browse files

Do not launch clock when touching the clock on the lockscreen

Bug: 7640566

On the lock screen:
Do not launch clock at all, launch CitiesActivity when clicking on the world clock.
On the home screen:
Launch the clock app when touching the clock, launch CitiesActivity when
clicking on the world clock.

Change-Id: I09302f35c7c585bfd1db010eb3f14feea84e34af
parent 4df16b69
Loading
Loading
Loading
Loading
+11 −3
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.alarmclock;
import android.app.PendingIntent;
import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProvider;
import android.appwidget.AppWidgetProviderInfo;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
@@ -37,6 +38,7 @@ import com.android.deskclock.Alarms;
import com.android.deskclock.DeskClock;
import com.android.deskclock.R;
import com.android.deskclock.Utils;
import com.android.deskclock.worldclock.CitiesActivity;

import java.util.Calendar;

@@ -72,8 +74,14 @@ public class DigitalAppWidgetProvider extends AppWidgetProvider {
    private void updateClock(
            Context c, AppWidgetManager appWidgetManager, int appWidgetId, float ratio) {
        RemoteViews widget = new RemoteViews(c.getPackageName(), R.layout.digital_appwidget);
        // launch clock when clicking on the time in the widget only if not a lock screen widget
        Bundle newOptions = appWidgetManager.getAppWidgetOptions(appWidgetId);
        if (newOptions != null &&
                newOptions.getInt(AppWidgetManager.OPTION_APPWIDGET_HOST_CATEGORY, -1)
                != AppWidgetProviderInfo.WIDGET_CATEGORY_KEYGUARD) {
            widget.setOnClickPendingIntent(R.id.digital_appwidget,
                    PendingIntent.getActivity(c, 0, new Intent(c, DeskClock.class), 0));
        }
        refreshAlarm(c, widget);
        WidgetUtils.setClockSize(c, widget, ratio);
        final Intent intent = new Intent(c, DigitalAppWidgetService.class);
@@ -81,7 +89,7 @@ public class DigitalAppWidgetProvider extends AppWidgetProvider {
        intent.setData(Uri.parse(intent.toUri(Intent.URI_INTENT_SCHEME)));
        widget.setRemoteAdapter(appWidgetId, R.id.digital_appwidget_listview, intent);
        widget.setPendingIntentTemplate(R.id.digital_appwidget_listview,
                PendingIntent.getActivity(c, 0, new Intent(c, DeskClock.class), 0));
                PendingIntent.getActivity(c, 0, new Intent(c, CitiesActivity.class), 0));
        appWidgetManager.notifyAppWidgetViewDataChanged(
                appWidgetId, R.id.digital_appwidget_listview);
        appWidgetManager.updateAppWidget(appWidgetId, widget);
+4 −4
Original line number Diff line number Diff line
@@ -53,9 +53,9 @@ public class CountingTimerView extends View {
    private final Paint mPaintMed = new Paint();
    private final Paint mPaintLabel = new Paint();
    private final float mBigFontSize, mSmallFontSize;
    private SignedTime mBigHours, mBigMinutes;
    private UnsignedTime mBigThinSeconds;
    private Hundredths mMedHundredths;
    private final SignedTime mBigHours, mBigMinutes;
    private final UnsignedTime mBigThinSeconds;
    private final Hundredths mMedHundredths;
    private float mTextHeight = 0;
    private float mTotalTextWidth;
    private static final String HUNDREDTH_SEPERATOR = ".";
@@ -87,7 +87,7 @@ public class CountingTimerView extends View {
        protected Paint mPaint;
        protected float mEm;
        protected float mWidth = 0;
        private String mWidest;
        private final String mWidest;
        protected String mLabel;
        private float mLabelWidth = 0;