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

Commit 1add38f8 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add onDestroyView to allow clock plugins to clean up resources."

parents 9ced4908 3358cfbe
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -28,7 +28,7 @@ import java.util.TimeZone;
public interface ClockPlugin extends Plugin {

    String ACTION = "com.android.systemui.action.PLUGIN_CLOCK";
    int VERSION = 3;
    int VERSION = 4;

    /**
     * Get the name of the clock face.
@@ -71,6 +71,14 @@ public interface ClockPlugin extends Plugin {
        return null;
    }

    /**
     * Allows the plugin to clean up resources when no longer needed.
     *
     * Called when the view previously created by {@link ClockPlugin#getView()} has been detached
     * from the view hierarchy.
     */
    void onDestroyView();

    /**
     * Set clock paint style.
     * @param style The new style to set in the paint.
+1 −0
Original line number Diff line number Diff line
@@ -187,6 +187,7 @@ public class KeyguardClockSwitch extends RelativeLayout {
                mBigClockContainer.removeAllViews();
                updateBigClockVisibility();
            }
            mClockPlugin.onDestroyView();
            mClockPlugin = null;
        }
        if (plugin == null) {
+10 −0
Original line number Diff line number Diff line
@@ -101,6 +101,16 @@ public class BubbleClockController implements ClockPlugin {
        mDarkController = new CrossFadeDarkController(mDigitalClock, mLockClock);
    }

    @Override
    public void onDestroyView() {
        mView = null;
        mDigitalClock = null;
        mAnalogClock = null;
        mLockClockContainer = null;
        mLockClock = null;
        mDarkController = null;
    }

    @Override
    public String getName() {
        return "bubble";
+7 −0
Original line number Diff line number Diff line
@@ -92,6 +92,13 @@ public class DefaultClockController implements ClockPlugin {
        mTextDate = mView.findViewById(R.id.date);
    }

    @Override
    public void onDestroyView() {
        mView = null;
        mTextTime = null;
        mTextDate = null;
    }

    @Override
    public String getName() {
        return "default";
+11 −0
Original line number Diff line number Diff line
@@ -101,6 +101,17 @@ public class StretchAnalogClockController implements ClockPlugin {
        mDarkController = new CrossFadeDarkController(mDigitalClock, mLockClock);
    }


    @Override
    public void onDestroyView() {
        mBigClockView = null;
        mDigitalClock = null;
        mAnalogClock = null;
        mView = null;
        mLockClock = null;
        mDarkController = null;
    }

    @Override
    public String getName() {
        return "stretch";
Loading