Change icon for Private Space unlocked and setup success toast
Change is made to show customised icon in Toast message shown by using Toast.makeCustomToastWithIcon() Screenshots : go/ss/AcaRQUJQfh79wDw.png go/ss/5j4oD8xydwX7HTX.png Bug: 329391204 Bug: 309575523 Test: Manual Change-Id: I336d7d0419b1de60024e584e943a725662b446a9
This commit is contained in:
25
res/drawable/ic_private_space_unlock_icon.xml
Normal file
25
res/drawable/ic_private_space_unlock_icon.xml
Normal file
@@ -0,0 +1,25 @@
|
||||
<!--
|
||||
~ Copyright (C) 2024 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.
|
||||
-->
|
||||
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M6,20H18V10H6V20ZM12,17C12.55,17 13.017,16.808 13.4,16.425C13.8,16.025 14,15.55 14,15C14,14.45 13.8,13.983 13.4,13.6C13.017,13.2 12.55,13 12,13C11.45,13 10.975,13.2 10.575,13.6C10.192,13.983 10,14.45 10,15C10,15.55 10.192,16.025 10.575,16.425C10.975,16.808 11.45,17 12,17ZM6,20V10V20ZM6,22C5.45,22 4.975,21.808 4.575,21.425C4.192,21.025 4,20.55 4,20V10C4,9.45 4.192,8.983 4.575,8.6C4.975,8.2 5.45,8 6,8H13V6C13,4.617 13.483,3.442 14.45,2.475C15.433,1.492 16.617,1 18,1C19.383,1 20.558,1.492 21.525,2.475C22.508,3.442 23,4.617 23,6H21C21,5.167 20.708,4.458 20.125,3.875C19.542,3.292 18.833,3 18,3C17.167,3 16.458,3.292 15.875,3.875C15.292,4.458 15,5.167 15,6V8H18C18.55,8 19.017,8.2 19.4,8.6C19.8,8.983 20,9.45 20,10V20C20,20.55 19.8,21.025 19.4,21.425C19.017,21.808 18.55,22 18,22H6Z"
|
||||
android:fillColor="?android:attr/colorAccent"/>
|
||||
</vector>
|
@@ -19,6 +19,7 @@ package com.android.settings.privatespace;
|
||||
import static com.android.settings.privatespace.PrivateSpaceAuthenticationActivity.EXTRA_SHOW_PRIVATE_SPACE_UNLOCKED;
|
||||
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
@@ -38,7 +39,14 @@ public class PrivateSpaceDashboardFragment extends DashboardFragment {
|
||||
if (icicle == null
|
||||
&& getIntent().getBooleanExtra(EXTRA_SHOW_PRIVATE_SPACE_UNLOCKED, false)) {
|
||||
Log.i(TAG, "Private space unlocked showing toast");
|
||||
Toast.makeText(getContext(), R.string.private_space_unlocked, Toast.LENGTH_SHORT)
|
||||
Drawable drawable =
|
||||
getContext().getDrawable(R.drawable.ic_private_space_unlock_icon);
|
||||
Toast.makeCustomToastWithIcon(
|
||||
getContext(),
|
||||
null /* looper */,
|
||||
getContext().getString(R.string.private_space_unlocked),
|
||||
Toast.LENGTH_SHORT,
|
||||
drawable)
|
||||
.show();
|
||||
}
|
||||
}
|
||||
|
@@ -21,6 +21,7 @@ import android.app.settings.SettingsEnums;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.ResolveInfo;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
@@ -100,6 +101,7 @@ public class SetupSuccessFragment extends InstrumentedFragment {
|
||||
allAppsIntent.setPackage(resolveInfo.activityInfo.packageName);
|
||||
allAppsIntent.setComponent(resolveInfo.activityInfo.getComponentName());
|
||||
}
|
||||
activity.setTheme(R.style.Theme_SubSettings);
|
||||
accessPrivateSpaceToast();
|
||||
startActivity(allAppsIntent);
|
||||
Log.i(TAG, "Private space setup complete");
|
||||
@@ -109,7 +111,13 @@ public class SetupSuccessFragment extends InstrumentedFragment {
|
||||
}
|
||||
|
||||
private void accessPrivateSpaceToast() {
|
||||
Toast.makeText(getContext(), R.string.private_space_scrolldown_to_access,
|
||||
Toast.LENGTH_SHORT).show();
|
||||
Drawable drawable = getContext().getDrawable(R.drawable.ic_private_space_icon);
|
||||
Toast.makeCustomToastWithIcon(
|
||||
getContext(),
|
||||
null /* looper */ ,
|
||||
getContext().getString(R.string.private_space_scrolldown_to_access),
|
||||
Toast.LENGTH_SHORT,
|
||||
drawable)
|
||||
.show();
|
||||
}
|
||||
}
|
||||
|
@@ -21,6 +21,7 @@ import static com.android.settings.privatespace.PrivateSpaceMaintainer.ErrorDele
|
||||
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
@@ -132,13 +133,23 @@ public class PrivateSpaceDeletionProgressFragment extends InstrumentedFragment {
|
||||
/** Shows a toast saying that the private space was deleted */
|
||||
@VisibleForTesting
|
||||
public void showSuccessfulDeletionToast() {
|
||||
Toast.makeText(getContext(), R.string.private_space_deleted, Toast.LENGTH_SHORT).show();
|
||||
showToastWithCustomIcon(R.string.private_space_deleted);
|
||||
}
|
||||
|
||||
/** Shows a toast saying that the private space could not be deleted */
|
||||
@VisibleForTesting
|
||||
public void showDeletionInternalErrorToast() {
|
||||
Toast.makeText(getContext(), R.string.private_space_delete_failed, Toast.LENGTH_SHORT)
|
||||
showToastWithCustomIcon(R.string.private_space_delete_failed);
|
||||
}
|
||||
|
||||
private void showToastWithCustomIcon(int stringRes) {
|
||||
Drawable drawable = getContext().getDrawable(R.drawable.ic_private_space_icon);
|
||||
Toast.makeCustomToastWithIcon(
|
||||
getContext(),
|
||||
null /* looper */ ,
|
||||
getContext().getString(stringRes),
|
||||
Toast.LENGTH_SHORT,
|
||||
drawable)
|
||||
.show();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user