summaryrefslogtreecommitdiffstats
path: root/quickstep/src/com/android/quickstep
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2018-11-30 19:32:02 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2018-11-30 19:32:02 +0000
commitd5edac3d31fab3867c5a19ec78b3f30341173251 (patch)
tree71a1f6728d7b511eef34f05e0e20a9f2d6a929fd /quickstep/src/com/android/quickstep
parent35903e1d9d53cf0363b3882bfa77fa42dafe3cbe (diff)
parent49db73a7c13de1a2d2573773955e0ca7a536032a (diff)
downloadandroid_packages_apps_Trebuchet-d5edac3d31fab3867c5a19ec78b3f30341173251.tar.gz
android_packages_apps_Trebuchet-d5edac3d31fab3867c5a19ec78b3f30341173251.tar.bz2
android_packages_apps_Trebuchet-d5edac3d31fab3867c5a19ec78b3f30341173251.zip
Merge "Moving composing task content description to resources" into ub-launcher3-master
Diffstat (limited to 'quickstep/src/com/android/quickstep')
-rw-r--r--quickstep/src/com/android/quickstep/views/DigitalWellBeingToast.java17
-rw-r--r--quickstep/src/com/android/quickstep/views/TaskView.java9
2 files changed, 17 insertions, 9 deletions
diff --git a/quickstep/src/com/android/quickstep/views/DigitalWellBeingToast.java b/quickstep/src/com/android/quickstep/views/DigitalWellBeingToast.java
index 4e8935310..4e7a0c415 100644
--- a/quickstep/src/com/android/quickstep/views/DigitalWellBeingToast.java
+++ b/quickstep/src/com/android/quickstep/views/DigitalWellBeingToast.java
@@ -34,7 +34,7 @@ import com.android.systemui.shared.recents.model.Task;
public final class DigitalWellBeingToast extends LinearLayout {
public interface InitializeCallback {
- void call(long t, boolean b);
+ void call(long remainingTimeMs, boolean isGroupLimit, String contentDescription);
}
private static final String TAG = DigitalWellBeingToast.class.getSimpleName();
@@ -66,7 +66,10 @@ public final class DigitalWellBeingToast extends LinearLayout {
final boolean isGroupLimit = true;
post(() -> {
setRemainingTime(appRemainingTimeMs, isGroupLimit);
- callback.call(appRemainingTimeMs, isGroupLimit);
+ callback.call(
+ appRemainingTimeMs,
+ isGroupLimit,
+ getContentDescriptionForTask(task, appRemainingTimeMs, isGroupLimit));
});
});
}
@@ -94,4 +97,14 @@ public final class DigitalWellBeingToast extends LinearLayout {
+ mTask.getTopComponent().getPackageName(), e);
}
}
+
+ private String getContentDescriptionForTask(
+ Task task, long appRemainingTimeMs, boolean isGroupLimit) {
+ return appRemainingTimeMs > 0 ?
+ getResources().getString(
+ R.string.task_contents_description_with_remaining_time,
+ task.titleDescription,
+ getText(appRemainingTimeMs, isGroupLimit)) :
+ task.titleDescription;
+ }
}
diff --git a/quickstep/src/com/android/quickstep/views/TaskView.java b/quickstep/src/com/android/quickstep/views/TaskView.java
index a6a3b8530..9b26d08d7 100644
--- a/quickstep/src/com/android/quickstep/views/TaskView.java
+++ b/quickstep/src/com/android/quickstep/views/TaskView.java
@@ -268,14 +268,9 @@ public class TaskView extends FrameLayout implements PageCallbacks {
setIcon(task.icon);
mDigitalWellBeingToast.initialize(
mTask,
- (appRemainingTimeMs, isGroupLimit) -> {
+ (appRemainingTimeMs, isGroupLimit, contentDescription) -> {
mAppRemainingTimeMs = appRemainingTimeMs;
- setContentDescription(
- hasRemainingTime() ?
- task.titleDescription + ". "
- + DigitalWellBeingToast.getText(
- appRemainingTimeMs, isGroupLimit) :
- task.titleDescription);
+ setContentDescription(contentDescription);
});
});
} else {