Loading src/com/android/launcher3/Launcher.java +1 −0 Original line number Diff line number Diff line Loading @@ -3053,6 +3053,7 @@ public class Launcher extends StatefulActivity<LauncherState> @Override public void bindStringCache(StringCache cache) { mStringCache = cache; mAppsView.updateWorkUI(); } @Override Loading src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java +27 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.launcher3.allapps; import static com.android.launcher3.allapps.ActivityAllAppsContainerView.AdapterHolder.SEARCH; import static com.android.launcher3.allapps.BaseAllAppsAdapter.VIEW_TYPE_WORK_DISABLED_CARD; import static com.android.launcher3.allapps.BaseAllAppsAdapter.VIEW_TYPE_WORK_EDU_CARD; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ALLAPPS_COUNT; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ALLAPPS_TAP_ON_PERSONAL_TAB; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ALLAPPS_TAP_ON_WORK_TAB; Loading Loading @@ -77,6 +79,7 @@ import com.android.launcher3.keyboard.FocusedItemDecorator; import com.android.launcher3.model.StringCache; import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.testing.shared.TestProtocol; import com.android.launcher3.util.Executors; import com.android.launcher3.util.ItemInfoMatcher; import com.android.launcher3.util.Themes; import com.android.launcher3.views.ActivityContext; Loading Loading @@ -1110,6 +1113,30 @@ public class ActivityAllAppsContainerView<T extends Context & ActivityContext> return view.getGlobalVisibleRect(new Rect()); } /** Called in Launcher#bindStringCache() to update the UI when cache is updated. */ public void updateWorkUI() { setDeviceManagementResources(); if (mWorkManager.getWorkModeSwitch() != null) { mWorkManager.getWorkModeSwitch().updateStringFromCache(); } inflateWorkCardsIfNeeded(); } private void inflateWorkCardsIfNeeded() { AllAppsRecyclerView workRV = mAH.get(AdapterHolder.WORK).mRecyclerView; if (workRV != null) { for (int i = 0; i < workRV.getChildCount(); i++) { View currentView = workRV.getChildAt(i); int currentItemViewType = workRV.getChildViewHolder(currentView).getItemViewType(); if (currentItemViewType == VIEW_TYPE_WORK_EDU_CARD) { ((WorkEduCard) currentView).updateStringFromCache(); } else if (currentItemViewType == VIEW_TYPE_WORK_DISABLED_CARD) { ((WorkPausedCard) currentView).updateStringFromCache(); } } } } @VisibleForTesting public boolean isPersonalTabVisible() { return isDescendantViewVisible(R.id.tab_personal); Loading src/com/android/launcher3/allapps/WorkEduCard.java +9 −5 Original line number Diff line number Diff line Loading @@ -76,11 +76,7 @@ public class WorkEduCard extends FrameLayout implements super.onFinishInflate(); findViewById(R.id.action_btn).setOnClickListener(this); StringCache cache = mActivityContext.getStringCache(); if (cache != null) { TextView title = findViewById(R.id.work_apps_paused_title); title.setText(cache.workProfileEdu); } updateStringFromCache(); } @Override Loading Loading @@ -121,4 +117,12 @@ public class WorkEduCard extends FrameLayout implements public void setPosition(int position) { mPosition = position; } public void updateStringFromCache() { StringCache cache = mActivityContext.getStringCache(); if (cache != null) { TextView title = findViewById(R.id.work_apps_paused_title); title.setText(cache.workProfileEdu); } } } src/com/android/launcher3/allapps/WorkModeSwitch.java +8 −4 Original line number Diff line number Diff line Loading @@ -92,10 +92,7 @@ public class WorkModeSwitch extends LinearLayout implements Insettable, } setInsets(mActivityContext.getDeviceProfile().getInsets()); StringCache cache = mActivityContext.getStringCache(); if (cache != null) { mTextView.setText(cache.workProfilePauseButton); } updateStringFromCache(); getLayoutTransition().enableTransitionType(LayoutTransition.CHANGING); } Loading Loading @@ -213,4 +210,11 @@ public class WorkModeSwitch extends LinearLayout implements Insettable, public int getScrollThreshold() { return mScrollThreshold; } public void updateStringFromCache(){ StringCache cache = mActivityContext.getStringCache(); if (cache != null) { mTextView.setText(cache.workProfilePauseButton); } } } src/com/android/launcher3/allapps/WorkPausedCard.java +4 −0 Original line number Diff line number Diff line Loading @@ -57,6 +57,10 @@ public class WorkPausedCard extends LinearLayout implements View.OnClickListener mBtn = findViewById(R.id.enable_work_apps); mBtn.setOnClickListener(this); updateStringFromCache(); } public void updateStringFromCache() { StringCache cache = mActivityContext.getStringCache(); if (cache != null) { setWorkProfilePausedResources(cache); Loading Loading
src/com/android/launcher3/Launcher.java +1 −0 Original line number Diff line number Diff line Loading @@ -3053,6 +3053,7 @@ public class Launcher extends StatefulActivity<LauncherState> @Override public void bindStringCache(StringCache cache) { mStringCache = cache; mAppsView.updateWorkUI(); } @Override Loading
src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java +27 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.launcher3.allapps; import static com.android.launcher3.allapps.ActivityAllAppsContainerView.AdapterHolder.SEARCH; import static com.android.launcher3.allapps.BaseAllAppsAdapter.VIEW_TYPE_WORK_DISABLED_CARD; import static com.android.launcher3.allapps.BaseAllAppsAdapter.VIEW_TYPE_WORK_EDU_CARD; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ALLAPPS_COUNT; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ALLAPPS_TAP_ON_PERSONAL_TAB; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ALLAPPS_TAP_ON_WORK_TAB; Loading Loading @@ -77,6 +79,7 @@ import com.android.launcher3.keyboard.FocusedItemDecorator; import com.android.launcher3.model.StringCache; import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.testing.shared.TestProtocol; import com.android.launcher3.util.Executors; import com.android.launcher3.util.ItemInfoMatcher; import com.android.launcher3.util.Themes; import com.android.launcher3.views.ActivityContext; Loading Loading @@ -1110,6 +1113,30 @@ public class ActivityAllAppsContainerView<T extends Context & ActivityContext> return view.getGlobalVisibleRect(new Rect()); } /** Called in Launcher#bindStringCache() to update the UI when cache is updated. */ public void updateWorkUI() { setDeviceManagementResources(); if (mWorkManager.getWorkModeSwitch() != null) { mWorkManager.getWorkModeSwitch().updateStringFromCache(); } inflateWorkCardsIfNeeded(); } private void inflateWorkCardsIfNeeded() { AllAppsRecyclerView workRV = mAH.get(AdapterHolder.WORK).mRecyclerView; if (workRV != null) { for (int i = 0; i < workRV.getChildCount(); i++) { View currentView = workRV.getChildAt(i); int currentItemViewType = workRV.getChildViewHolder(currentView).getItemViewType(); if (currentItemViewType == VIEW_TYPE_WORK_EDU_CARD) { ((WorkEduCard) currentView).updateStringFromCache(); } else if (currentItemViewType == VIEW_TYPE_WORK_DISABLED_CARD) { ((WorkPausedCard) currentView).updateStringFromCache(); } } } } @VisibleForTesting public boolean isPersonalTabVisible() { return isDescendantViewVisible(R.id.tab_personal); Loading
src/com/android/launcher3/allapps/WorkEduCard.java +9 −5 Original line number Diff line number Diff line Loading @@ -76,11 +76,7 @@ public class WorkEduCard extends FrameLayout implements super.onFinishInflate(); findViewById(R.id.action_btn).setOnClickListener(this); StringCache cache = mActivityContext.getStringCache(); if (cache != null) { TextView title = findViewById(R.id.work_apps_paused_title); title.setText(cache.workProfileEdu); } updateStringFromCache(); } @Override Loading Loading @@ -121,4 +117,12 @@ public class WorkEduCard extends FrameLayout implements public void setPosition(int position) { mPosition = position; } public void updateStringFromCache() { StringCache cache = mActivityContext.getStringCache(); if (cache != null) { TextView title = findViewById(R.id.work_apps_paused_title); title.setText(cache.workProfileEdu); } } }
src/com/android/launcher3/allapps/WorkModeSwitch.java +8 −4 Original line number Diff line number Diff line Loading @@ -92,10 +92,7 @@ public class WorkModeSwitch extends LinearLayout implements Insettable, } setInsets(mActivityContext.getDeviceProfile().getInsets()); StringCache cache = mActivityContext.getStringCache(); if (cache != null) { mTextView.setText(cache.workProfilePauseButton); } updateStringFromCache(); getLayoutTransition().enableTransitionType(LayoutTransition.CHANGING); } Loading Loading @@ -213,4 +210,11 @@ public class WorkModeSwitch extends LinearLayout implements Insettable, public int getScrollThreshold() { return mScrollThreshold; } public void updateStringFromCache(){ StringCache cache = mActivityContext.getStringCache(); if (cache != null) { mTextView.setText(cache.workProfilePauseButton); } } }
src/com/android/launcher3/allapps/WorkPausedCard.java +4 −0 Original line number Diff line number Diff line Loading @@ -57,6 +57,10 @@ public class WorkPausedCard extends LinearLayout implements View.OnClickListener mBtn = findViewById(R.id.enable_work_apps); mBtn.setOnClickListener(this); updateStringFromCache(); } public void updateStringFromCache() { StringCache cache = mActivityContext.getStringCache(); if (cache != null) { setWorkProfilePausedResources(cache); Loading