blob: c1c5714548f1e5b267e58ca6e20ec89e3d187162 [file] [log] [blame]
Mady Mellor87d79452017-01-10 11:52:52 -08001/*
2 * Copyright (C) 2017 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License
15 */
16
Geoffrey Pitschdf44b602017-02-03 13:31:50 -050017package com.android.systemui.statusbar;
18
Julia Reynolds3aedded2017-03-31 14:42:09 -040019import static android.app.NotificationManager.IMPORTANCE_NONE;
20
Mady Mellor87d79452017-01-10 11:52:52 -080021import android.app.INotificationManager;
Julia Reynolds3aedded2017-03-31 14:42:09 -040022import android.app.Notification;
Mady Mellor87d79452017-01-10 11:52:52 -080023import android.app.NotificationChannel;
Geoffrey Pitschdf44b602017-02-03 13:31:50 -050024import android.app.NotificationChannelGroup;
Mady Mellor87d79452017-01-10 11:52:52 -080025import android.content.Context;
Julia Reynolds3aedded2017-03-31 14:42:09 -040026import android.content.Intent;
27import android.content.pm.ActivityInfo;
Mady Mellor87d79452017-01-10 11:52:52 -080028import android.content.pm.ApplicationInfo;
29import android.content.pm.PackageInfo;
30import android.content.pm.PackageManager;
Julia Reynolds3aedded2017-03-31 14:42:09 -040031import android.content.pm.ResolveInfo;
Mady Mellor87d79452017-01-10 11:52:52 -080032import android.graphics.drawable.Drawable;
Mady Mellor87d79452017-01-10 11:52:52 -080033import android.os.RemoteException;
Julia Reynolds3aedded2017-03-31 14:42:09 -040034import android.service.notification.StatusBarNotification;
35import android.text.TextUtils;
Mady Mellor87d79452017-01-10 11:52:52 -080036import android.util.AttributeSet;
Mady Mellor87d79452017-01-10 11:52:52 -080037import android.view.View;
Mady Mellor87d79452017-01-10 11:52:52 -080038import android.widget.ImageView;
39import android.widget.LinearLayout;
Mady Mellor87d79452017-01-10 11:52:52 -080040import android.widget.Switch;
41import android.widget.TextView;
42
43import com.android.internal.logging.MetricsLogger;
44import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
45import com.android.settingslib.Utils;
Mady Mellor87d79452017-01-10 11:52:52 -080046import com.android.systemui.R;
Mady Mellor87d79452017-01-10 11:52:52 -080047
Geoffrey Pitschd0856f02017-02-16 10:51:18 -050048import java.lang.IllegalArgumentException;
49import java.util.List;
Mady Mellor87d79452017-01-10 11:52:52 -080050import java.util.Set;
51
52/**
53 * The guts of a notification revealed when performing a long press.
54 */
Mady Mellor95d743c2017-01-10 12:05:27 -080055public class NotificationInfo extends LinearLayout implements NotificationGuts.GutsContent {
Mady Mellor87d79452017-01-10 11:52:52 -080056 private static final String TAG = "InfoGuts";
57
58 private INotificationManager mINotificationManager;
Geoffrey Pitschd0856f02017-02-16 10:51:18 -050059 private String mPkg;
60 private int mAppUid;
61 private List<NotificationChannel> mNotificationChannels;
62 private NotificationChannel mSingleNotificationChannel;
Julia Reynolds3aedded2017-03-31 14:42:09 -040063 private StatusBarNotification mSbn;
Mady Mellor87d79452017-01-10 11:52:52 -080064 private int mStartingUserImportance;
Mady Mellor87d79452017-01-10 11:52:52 -080065
Geoffrey Pitschdf44b602017-02-03 13:31:50 -050066 private TextView mNumChannelsView;
67 private View mChannelDisabledView;
Julia Reynolds3aedded2017-03-31 14:42:09 -040068 private TextView mSettingsLinkView;
Mady Mellor87d79452017-01-10 11:52:52 -080069 private Switch mChannelEnabledSwitch;
Geoffrey Pitsch5278d3d2017-03-29 13:39:10 -040070 private CheckSaveListener mCheckSaveListener;
Julia Reynolds3aedded2017-03-31 14:42:09 -040071 private OnAppSettingsClickListener mAppSettingsClickListener;
72 private PackageManager mPm;
Mady Mellor87d79452017-01-10 11:52:52 -080073
Mady Mellor95d743c2017-01-10 12:05:27 -080074 private NotificationGuts mGutsContainer;
Mady Mellor87d79452017-01-10 11:52:52 -080075
76 public NotificationInfo(Context context, AttributeSet attrs) {
77 super(context, attrs);
78 }
79
Geoffrey Pitsch5278d3d2017-03-29 13:39:10 -040080 // Specify a CheckSaveListener to override when/if the user's changes are committed.
81 public interface CheckSaveListener {
82 // Invoked when importance has changed and the NotificationInfo wants to try to save it.
83 // Listener should run saveImportance unless the change should be canceled.
84 void checkSave(Runnable saveImportance);
85 }
86
Jason Monk2a6ea9c2017-01-26 11:14:51 -050087 public interface OnSettingsClickListener {
Geoffrey Pitschd0856f02017-02-16 10:51:18 -050088 void onClick(View v, NotificationChannel channel, int appUid);
Mady Mellor87d79452017-01-10 11:52:52 -080089 }
90
Julia Reynolds3aedded2017-03-31 14:42:09 -040091 public interface OnAppSettingsClickListener {
92 void onClick(View v, Intent intent);
93 }
94
Jason Monk2a6ea9c2017-01-26 11:14:51 -050095 public void bindNotification(final PackageManager pm,
96 final INotificationManager iNotificationManager,
Geoffrey Pitschd0856f02017-02-16 10:51:18 -050097 final String pkg,
98 final List<NotificationChannel> notificationChannels,
Julia Reynolds3aedded2017-03-31 14:42:09 -040099 int startingUserImportance,
100 final StatusBarNotification sbn,
Mady Mellor87d79452017-01-10 11:52:52 -0800101 OnSettingsClickListener onSettingsClick,
Julia Reynolds3aedded2017-03-31 14:42:09 -0400102 OnAppSettingsClickListener onAppSettingsClick,
Geoffrey Pitsch5278d3d2017-03-29 13:39:10 -0400103 OnClickListener onDoneClick,
104 CheckSaveListener checkSaveListener,
105 final Set<String> nonBlockablePkgs)
Geoffrey Pitschd0856f02017-02-16 10:51:18 -0500106 throws RemoteException {
Mady Mellor87d79452017-01-10 11:52:52 -0800107 mINotificationManager = iNotificationManager;
Geoffrey Pitschd0856f02017-02-16 10:51:18 -0500108 mPkg = pkg;
109 mNotificationChannels = notificationChannels;
Geoffrey Pitsch5278d3d2017-03-29 13:39:10 -0400110 mCheckSaveListener = checkSaveListener;
Julia Reynolds3aedded2017-03-31 14:42:09 -0400111 mSbn = sbn;
112 mPm = pm;
113 mAppSettingsClickListener = onAppSettingsClick;
Geoffrey Pitschee8c81e2017-03-23 11:38:56 -0400114 boolean isSingleDefaultChannel = false;
Julia Reynolds3aedded2017-03-31 14:42:09 -0400115 mStartingUserImportance = startingUserImportance;
Geoffrey Pitschd0856f02017-02-16 10:51:18 -0500116 if (mNotificationChannels.isEmpty()) {
117 throw new IllegalArgumentException("bindNotification requires at least one channel");
Julia Reynolds3aedded2017-03-31 14:42:09 -0400118 } else {
119 if (mNotificationChannels.size() == 1) {
120 mSingleNotificationChannel = mNotificationChannels.get(0);
121 isSingleDefaultChannel = mSingleNotificationChannel.getId()
122 .equals(NotificationChannel.DEFAULT_CHANNEL_ID);
123 } else {
124 mSingleNotificationChannel = null;
125 }
Geoffrey Pitschd0856f02017-02-16 10:51:18 -0500126 }
Mady Mellor87d79452017-01-10 11:52:52 -0800127
Geoffrey Pitschd0856f02017-02-16 10:51:18 -0500128 String appName = mPkg;
Mady Mellor87d79452017-01-10 11:52:52 -0800129 Drawable pkgicon = null;
Julia Reynolds5a311932017-03-01 16:33:44 -0500130 CharSequence channelNameText = "";
131 ApplicationInfo info = null;
Mady Mellor87d79452017-01-10 11:52:52 -0800132 try {
Geoffrey Pitschd0856f02017-02-16 10:51:18 -0500133 info = pm.getApplicationInfo(mPkg,
Mady Mellor87d79452017-01-10 11:52:52 -0800134 PackageManager.MATCH_UNINSTALLED_PACKAGES
135 | PackageManager.MATCH_DISABLED_COMPONENTS
136 | PackageManager.MATCH_DIRECT_BOOT_UNAWARE
137 | PackageManager.MATCH_DIRECT_BOOT_AWARE);
138 if (info != null) {
Geoffrey Pitschd0856f02017-02-16 10:51:18 -0500139 mAppUid = info.uid;
Geoffrey Pitsch1f7fb1a2017-02-13 16:57:40 -0500140 appName = String.valueOf(pm.getApplicationLabel(info));
Mady Mellor87d79452017-01-10 11:52:52 -0800141 pkgicon = pm.getApplicationIcon(info);
142 }
143 } catch (PackageManager.NameNotFoundException e) {
144 // app is gone, just show package name and generic icon
145 pkgicon = pm.getDefaultActivityIcon();
146 }
Geoffrey Pitschdf44b602017-02-03 13:31:50 -0500147 ((ImageView) findViewById(R.id.pkgicon)).setImageDrawable(pkgicon);
148
149 int numChannels = 1;
Geoffrey Pitschd0856f02017-02-16 10:51:18 -0500150 numChannels = iNotificationManager.getNumNotificationChannelsForPackage(
151 pkg, mAppUid, false /* includeDeleted */);
Geoffrey Pitschdf44b602017-02-03 13:31:50 -0500152
Geoffrey Pitschd0856f02017-02-16 10:51:18 -0500153 String channelsDescText;
Alan Viverette51efddb2017-04-05 10:00:01 -0400154 mNumChannelsView = findViewById(R.id.num_channels_desc);
Geoffrey Pitschee8c81e2017-03-23 11:38:56 -0400155 if (isSingleDefaultChannel) {
156 channelsDescText = mContext.getString(R.string.notification_default_channel_desc);
157 } else {
158 switch (mNotificationChannels.size()) {
159 case 1:
160 channelsDescText = String.format(mContext.getResources().getQuantityString(
161 R.plurals.notification_num_channels_desc, numChannels), numChannels);
162 break;
163 case 2:
164 channelsDescText = mContext.getString(
165 R.string.notification_channels_list_desc_2,
166 mNotificationChannels.get(0).getName(),
167 mNotificationChannels.get(1).getName());
168 break;
169 default:
170 final int numOthers = mNotificationChannels.size() - 2;
171 channelsDescText = String.format(
172 mContext.getResources().getQuantityString(
173 R.plurals.notification_channels_list_desc_2_and_others,
174 numOthers),
175 mNotificationChannels.get(0).getName(),
176 mNotificationChannels.get(1).getName(),
177 numOthers);
178 }
Geoffrey Pitschd0856f02017-02-16 10:51:18 -0500179 }
180 mNumChannelsView.setText(channelsDescText);
Mady Mellor87d79452017-01-10 11:52:52 -0800181
Geoffrey Pitschd0856f02017-02-16 10:51:18 -0500182 if (mSingleNotificationChannel == null) {
183 // Multiple channels don't use a channel name for the title.
184 channelNameText = mContext.getString(R.string.notification_num_channels,
185 mNotificationChannels.size());
Geoffrey Pitschee8c81e2017-03-23 11:38:56 -0400186 } else if (isSingleDefaultChannel) {
187 // If this is the default channel, don't use our channel-specific text.
Mady Mellor87d79452017-01-10 11:52:52 -0800188 channelNameText = mContext.getString(R.string.notification_header_default_channel);
189 } else {
Geoffrey Pitschd0856f02017-02-16 10:51:18 -0500190 channelNameText = mSingleNotificationChannel.getName();
Mady Mellor87d79452017-01-10 11:52:52 -0800191 }
Geoffrey Pitsch1f7fb1a2017-02-13 16:57:40 -0500192 ((TextView) findViewById(R.id.pkgname)).setText(appName);
Mady Mellor87d79452017-01-10 11:52:52 -0800193 ((TextView) findViewById(R.id.channel_name)).setText(channelNameText);
194
Geoffrey Pitschdf44b602017-02-03 13:31:50 -0500195 // Set group information if this channel has an associated group.
196 CharSequence groupName = null;
Geoffrey Pitschd0856f02017-02-16 10:51:18 -0500197 if (mSingleNotificationChannel != null && mSingleNotificationChannel.getGroup() != null) {
198 final NotificationChannelGroup notificationChannelGroup =
199 iNotificationManager.getNotificationChannelGroupForPackage(
200 mSingleNotificationChannel.getGroup(), pkg, mAppUid);
201 if (notificationChannelGroup != null) {
202 groupName = notificationChannelGroup.getName();
Geoffrey Pitschdf44b602017-02-03 13:31:50 -0500203 }
Mady Mellor87d79452017-01-10 11:52:52 -0800204 }
Geoffrey Pitschdf44b602017-02-03 13:31:50 -0500205 TextView groupNameView = ((TextView) findViewById(R.id.group_name));
206 TextView groupDividerView = ((TextView) findViewById(R.id.pkg_group_divider));
207 if (groupName != null) {
208 groupNameView.setText(groupName);
209 groupNameView.setVisibility(View.VISIBLE);
210 groupDividerView.setVisibility(View.VISIBLE);
211 } else {
212 groupNameView.setVisibility(View.GONE);
213 groupDividerView.setVisibility(View.GONE);
214 }
Mady Mellor87d79452017-01-10 11:52:52 -0800215
216 boolean nonBlockable = false;
217 try {
Julia Reynolds5a311932017-03-01 16:33:44 -0500218 final PackageInfo pkgInfo = pm.getPackageInfo(pkg, PackageManager.GET_SIGNATURES);
219 nonBlockable = Utils.isSystemPackage(getResources(), pm, pkgInfo);
Mady Mellor87d79452017-01-10 11:52:52 -0800220 } catch (PackageManager.NameNotFoundException e) {
221 // unlikely.
222 }
223 if (nonBlockablePkgs != null) {
224 nonBlockable |= nonBlockablePkgs.contains(pkg);
225 }
226
Geoffrey Pitschdf44b602017-02-03 13:31:50 -0500227 bindButtons(nonBlockable);
Mady Mellor87d79452017-01-10 11:52:52 -0800228
229 // Top-level importance group
Geoffrey Pitschdf44b602017-02-03 13:31:50 -0500230 mChannelDisabledView = findViewById(R.id.channel_disabled);
Geoffrey Pitschd0856f02017-02-16 10:51:18 -0500231 updateSecondaryText();
Geoffrey Pitschdf44b602017-02-03 13:31:50 -0500232
233 // Settings button.
234 final TextView settingsButton = (TextView) findViewById(R.id.more_settings);
Geoffrey Pitschd0856f02017-02-16 10:51:18 -0500235 if (mAppUid >= 0 && onSettingsClick != null) {
Geoffrey Pitsch029a3fa2017-03-30 13:01:57 -0400236 settingsButton.setVisibility(View.VISIBLE);
Geoffrey Pitschd0856f02017-02-16 10:51:18 -0500237 final int appUidF = mAppUid;
Geoffrey Pitschdf44b602017-02-03 13:31:50 -0500238 settingsButton.setOnClickListener(
239 (View view) -> {
Geoffrey Pitschd0856f02017-02-16 10:51:18 -0500240 onSettingsClick.onClick(view, mSingleNotificationChannel, appUidF);
Geoffrey Pitschdf44b602017-02-03 13:31:50 -0500241 });
242 if (numChannels > 1) {
243 settingsButton.setText(R.string.notification_all_categories);
244 } else {
245 settingsButton.setText(R.string.notification_more_settings);
246 }
247
248 } else {
249 settingsButton.setVisibility(View.GONE);
250 }
251
252 // Done button.
253 final TextView doneButton = (TextView) findViewById(R.id.done);
254 doneButton.setText(R.string.notification_done);
255 doneButton.setOnClickListener(onDoneClick);
Julia Reynolds3aedded2017-03-31 14:42:09 -0400256
257 // Optional settings link
258 updateAppSettingsLink();
Mady Mellor87d79452017-01-10 11:52:52 -0800259 }
260
Geoffrey Pitsch5278d3d2017-03-29 13:39:10 -0400261 private boolean hasImportanceChanged() {
Geoffrey Pitschd0856f02017-02-16 10:51:18 -0500262 return mSingleNotificationChannel != null &&
263 mStartingUserImportance != getSelectedImportance();
Mady Mellor87d79452017-01-10 11:52:52 -0800264 }
265
Geoffrey Pitschdf44b602017-02-03 13:31:50 -0500266 private void saveImportance() {
Geoffrey Pitschd0856f02017-02-16 10:51:18 -0500267 if (mSingleNotificationChannel == null) {
268 return;
269 }
Mady Mellor87d79452017-01-10 11:52:52 -0800270 int selectedImportance = getSelectedImportance();
271 if (selectedImportance == mStartingUserImportance) {
272 return;
273 }
274 MetricsLogger.action(mContext, MetricsEvent.ACTION_SAVE_IMPORTANCE,
275 selectedImportance - mStartingUserImportance);
Geoffrey Pitschd0856f02017-02-16 10:51:18 -0500276 mSingleNotificationChannel.setImportance(selectedImportance);
Julia Reynolds8ceb5792017-04-11 11:32:44 -0400277 mSingleNotificationChannel.lockFields(NotificationChannel.USER_LOCKED_IMPORTANCE);
Mady Mellor87d79452017-01-10 11:52:52 -0800278 try {
279 mINotificationManager.updateNotificationChannelForPackage(
Geoffrey Pitschd0856f02017-02-16 10:51:18 -0500280 mPkg, mAppUid, mSingleNotificationChannel);
Mady Mellor87d79452017-01-10 11:52:52 -0800281 } catch (RemoteException e) {
282 // :(
283 }
284 }
285
286 private int getSelectedImportance() {
287 if (!mChannelEnabledSwitch.isChecked()) {
Julia Reynolds3aedded2017-03-31 14:42:09 -0400288 return IMPORTANCE_NONE;
Mady Mellor87d79452017-01-10 11:52:52 -0800289 } else {
Geoffrey Pitschdf44b602017-02-03 13:31:50 -0500290 return mStartingUserImportance;
Mady Mellor87d79452017-01-10 11:52:52 -0800291 }
292 }
293
Geoffrey Pitschdf44b602017-02-03 13:31:50 -0500294 private void bindButtons(final boolean nonBlockable) {
Mady Mellor87d79452017-01-10 11:52:52 -0800295 // Enabled Switch
296 mChannelEnabledSwitch = (Switch) findViewById(R.id.channel_enabled_switch);
Geoffrey Pitschdf44b602017-02-03 13:31:50 -0500297 mChannelEnabledSwitch.setChecked(
Julia Reynolds3aedded2017-03-31 14:42:09 -0400298 mStartingUserImportance != IMPORTANCE_NONE);
Geoffrey Pitschd0856f02017-02-16 10:51:18 -0500299 final boolean visible = !nonBlockable && mSingleNotificationChannel != null;
300 mChannelEnabledSwitch.setVisibility(visible ? View.VISIBLE : View.INVISIBLE);
Mady Mellor87d79452017-01-10 11:52:52 -0800301
Mady Mellor87d79452017-01-10 11:52:52 -0800302 // Callback when checked.
303 mChannelEnabledSwitch.setOnCheckedChangeListener((buttonView, isChecked) -> {
Mady Mellor95d743c2017-01-10 12:05:27 -0800304 if (mGutsContainer != null) {
305 mGutsContainer.resetFalsingCheck();
Geoffrey Pitschdf44b602017-02-03 13:31:50 -0500306 }
Geoffrey Pitschd0856f02017-02-16 10:51:18 -0500307 updateSecondaryText();
Julia Reynolds3aedded2017-03-31 14:42:09 -0400308 updateAppSettingsLink();
Mady Mellor87d79452017-01-10 11:52:52 -0800309 });
Mady Mellor87d79452017-01-10 11:52:52 -0800310 }
311
Geoffrey Pitschd0856f02017-02-16 10:51:18 -0500312 private void updateSecondaryText() {
Geoffrey Pitschd0856f02017-02-16 10:51:18 -0500313 final boolean disabled = mSingleNotificationChannel != null &&
Julia Reynolds3aedded2017-03-31 14:42:09 -0400314 getSelectedImportance() == IMPORTANCE_NONE;
Geoffrey Pitschee8c81e2017-03-23 11:38:56 -0400315 if (disabled) {
Geoffrey Pitschd0856f02017-02-16 10:51:18 -0500316 mChannelDisabledView.setVisibility(View.VISIBLE);
317 mNumChannelsView.setVisibility(View.GONE);
Geoffrey Pitschdf44b602017-02-03 13:31:50 -0500318 } else {
Geoffrey Pitschd0856f02017-02-16 10:51:18 -0500319 mChannelDisabledView.setVisibility(View.GONE);
Geoffrey Pitschdf44b602017-02-03 13:31:50 -0500320 mNumChannelsView.setVisibility(View.VISIBLE);
Mady Mellor87d79452017-01-10 11:52:52 -0800321 }
322 }
323
Julia Reynolds3aedded2017-03-31 14:42:09 -0400324 private void updateAppSettingsLink() {
325 mSettingsLinkView = findViewById(R.id.app_settings);
326 Intent settingsIntent = getAppSettingsIntent(mPm, mPkg, mSingleNotificationChannel,
327 mSbn.getId(), mSbn.getTag());
328 if (settingsIntent != null && getSelectedImportance() != IMPORTANCE_NONE
329 && !TextUtils.isEmpty(mSbn.getNotification().getSettingsText())) {
330 mSettingsLinkView.setVisibility(View.VISIBLE);
331 mSettingsLinkView.setText(mContext.getString(R.string.notification_app_settings,
332 mSbn.getNotification().getSettingsText()));
333 mSettingsLinkView.setOnClickListener((View view) -> {
334 mAppSettingsClickListener.onClick(view, settingsIntent);
335 });
336 } else {
337 mSettingsLinkView.setVisibility(View.GONE);
338 }
339 }
340
341 private Intent getAppSettingsIntent(PackageManager pm, String packageName,
342 NotificationChannel channel, int id, String tag) {
343 Intent intent = new Intent(Intent.ACTION_MAIN)
344 .addCategory(Notification.INTENT_CATEGORY_NOTIFICATION_PREFERENCES)
345 .setPackage(packageName);
346 final List<ResolveInfo> resolveInfos = pm.queryIntentActivities(
347 intent,
348 PackageManager.MATCH_DEFAULT_ONLY
349 );
350 if (resolveInfos == null || resolveInfos.size() == 0 || resolveInfos.get(0) == null) {
351 return null;
352 }
353 final ActivityInfo activityInfo = resolveInfos.get(0).activityInfo;
354 intent.setClassName(activityInfo.packageName, activityInfo.name);
355 if (channel != null) {
356 intent.putExtra(Notification.EXTRA_CHANNEL_ID, channel.getId());
357 }
358 intent.putExtra(Notification.EXTRA_NOTIFICATION_ID, id);
359 intent.putExtra(Notification.EXTRA_NOTIFICATION_TAG, tag);
360 return intent;
361 }
362
Mady Mellor87d79452017-01-10 11:52:52 -0800363 @Override
Mady Mellor95d743c2017-01-10 12:05:27 -0800364 public void setGutsParent(NotificationGuts guts) {
365 mGutsContainer = guts;
Mady Mellor87d79452017-01-10 11:52:52 -0800366 }
367
368 @Override
Mady Mellor434180c2017-02-13 11:29:42 -0800369 public boolean willBeRemoved() {
370 return !mChannelEnabledSwitch.isChecked();
371 }
372
373 @Override
Mady Mellor87d79452017-01-10 11:52:52 -0800374 public View getContentView() {
375 return this;
376 }
377
378 @Override
Geoffrey Pitschdf44b602017-02-03 13:31:50 -0500379 public boolean handleCloseControls(boolean save) {
Geoffrey Pitsch5278d3d2017-03-29 13:39:10 -0400380 if (save && hasImportanceChanged()) {
381 if (mCheckSaveListener != null) {
382 mCheckSaveListener.checkSave(() -> { saveImportance(); });
383 } else {
384 saveImportance();
385 }
Geoffrey Pitschdf44b602017-02-03 13:31:50 -0500386 }
Mady Mellor87d79452017-01-10 11:52:52 -0800387 return false;
388 }
Mady Mellore09fb702017-03-30 13:23:29 -0700389
390 @Override
391 public int getActualHeight() {
392 return getHeight();
393 }
Mady Mellor87d79452017-01-10 11:52:52 -0800394}