AppClone: Add animation and description text in Cloned Apps page.

Bug: 265251138
Test: manual and robo
Change-Id: I623c01fc74c1ac162917fce8b2fda9754b0a2b4b
This commit is contained in:
Ankita Vyas
2023-01-12 08:38:44 +00:00
parent 8fce459806
commit 7bad1241a4
5 changed files with 89 additions and 2 deletions

View File

@@ -0,0 +1,61 @@
<?xml version="1.0" encoding="utf-8"?><!--
~ Copyright (C) 2023 The Android Open Source Project
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
android:paddingBottom="16dp"
android:paddingTop="8dp">
<TextView
android:id="@+id/apps_top_intro_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textDirection="locale"
android:clickable="false"
android:longClickable="false"
android:textAppearance="@style/TextAppearance.TopIntroText"/>
<com.airbnb.lottie.LottieAnimationView
android:id="@+id/illustration_lottie"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scaleType="centerInside"
android:visibility="visible"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
app:lottie_autoPlay="true"
app:lottie_loop="true"
app:lottie_speed="1.5"/>
<TextView
android:id="@+id/app_list_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:textDirection="locale"
android:clickable="false"
android:longClickable="false"
android:textAppearance="@style/TextAppearance.TopIntroText"/>
</LinearLayout>

1
res/raw/app_cloning.json Normal file

File diff suppressed because one or more lines are too long

View File

@@ -6577,6 +6577,9 @@
<string name="cloned_apps_dashboard_title">Cloned Apps</string>
<!-- Description for introduction of the cloned apps page [CHAR LIMIT=NONE]-->
<string name="desc_cloned_apps_intro_text">Create a second instance of an app so that you can use two accounts at the same time.</string>
<!-- Description while displaying cloneable app list in Cloned Apps page [CHAR LIMIT=NONE]-->
<string name="desc_cloneable_app_list_text">Apps that can be cloned.</string>
<!-- Summary for Cloned Apps menu [CHAR LIMIT=40] -->
<string name="cloned_apps_summary"><xliff:g id="cloned_apps_count">%1$s</xliff:g> cloned, <xliff:g id="allowed_apps_count">%2$d</xliff:g> available to clone</string>
<!-- Description for cloned apps removal title [CHAR LIMIT=40]-->
<string name="delete_all_app_clones">Delete all App clones</string>

View File

@@ -46,6 +46,9 @@ import com.android.settings.overlay.FeatureFactory;
import com.android.settingslib.applications.ApplicationsState;
import com.android.settingslib.applications.ApplicationsState.AppEntry;
import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
import com.android.settingslib.widget.LottieColorUtils;
import com.airbnb.lottie.LottieAnimationView;
public class ApplicationViewHolder extends RecyclerView.ViewHolder {
@@ -113,6 +116,24 @@ public class ApplicationViewHolder extends RecyclerView.ViewHolder {
return view;
}
static View newHeaderWithAnimation(Context context, ViewGroup parent, int resIntroText,
int resAnimation, int resAppListText) {
ViewGroup view = (ViewGroup) LayoutInflater.from(parent.getContext())
.inflate(R.layout.preference_app_header_animation, parent, false);
TextView introText = view.findViewById(R.id.apps_top_intro_text);
introText.setText(resIntroText);
LottieAnimationView illustrationLottie = view.findViewById(R.id.illustration_lottie);
illustrationLottie.setAnimation(resAnimation);
illustrationLottie.setVisibility(View.VISIBLE);
LottieColorUtils.applyDynamicColors(context, illustrationLottie);
TextView appListText = view.findViewById(R.id.app_list_text);
appListText.setText(resAppListText);
return view;
}
void setSummary(CharSequence summary) {
mSummary.setText(summary);
updateSummaryVisibility();

View File

@@ -1376,8 +1376,9 @@ public class ManageApplications extends InstrumentedFragment
LIST_TYPE_NOTIFICATION);
} else if (mManageApplications.mListType == LIST_TYPE_CLONED_APPS
&& viewType == VIEW_TYPE_APP_HEADER) {
view = ApplicationViewHolder.newHeader(parent,
R.string.desc_cloned_apps_intro_text);
view = ApplicationViewHolder.newHeaderWithAnimation(mContext, parent,
R.string.desc_cloned_apps_intro_text, R.raw.app_cloning,
R.string.desc_cloneable_app_list_text);
} else if (mManageApplications.mListType == LIST_TYPE_CLONED_APPS
&& viewType == VIEW_TYPE_TWO_TARGET) {
view = ApplicationViewHolder.newView(