mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-02 08:56:55 +00:00
Add unit testing to workkUtilityView
Testing inflate and visibility states (with both flag states) bug: 361589193 Test: manually screenshot: https://screenshot.googleplex.com/45HDsyfQfNbgjiE Flag: com.android.launcher3.work_scheduler_in_work_profile Change-Id: I57cff03fe3b362e304f52984a2699f8d5b6e653e
This commit is contained in:
@@ -33,6 +33,7 @@ import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import androidx.core.graphics.Insets;
|
||||
import androidx.core.view.WindowInsetsCompat;
|
||||
|
||||
@@ -126,6 +127,7 @@ public class WorkUtilityView extends LinearLayout implements Insettable,
|
||||
setInsets(mActivityContext.getDeviceProfile().getInsets());
|
||||
updateStringFromCache();
|
||||
mSchedulerButton.setVisibility(GONE);
|
||||
mSchedulerButton.setOnClickListener(null);
|
||||
if (shouldUseScheduler()) {
|
||||
mSchedulerButton.setVisibility(VISIBLE);
|
||||
mSchedulerButton.setOnClickListener(view ->
|
||||
@@ -393,7 +395,13 @@ public class WorkUtilityView extends LinearLayout implements Insettable,
|
||||
}
|
||||
}
|
||||
|
||||
private boolean shouldUseScheduler() {
|
||||
@VisibleForTesting
|
||||
boolean shouldUseScheduler() {
|
||||
return Flags.workSchedulerInWorkProfile() && !mWorkSchedulerIntentAction.isEmpty();
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
ImageButton getSchedulerButton() {
|
||||
return mSchedulerButton;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user