feat: 适配Tab10CPro的5x5网格布局并优化对话框与上滑把手显示

This commit is contained in:
2026-10-20 16:59:18 +08:00
parent 7458216cbc
commit 449fed287e
15 changed files with 204 additions and 52 deletions

View File

@@ -75,8 +75,8 @@ android {
minSdkVersion 26 minSdkVersion 26
targetSdkVersion 28 targetSdkVersion 28
versionCode 215 versionCode 216
versionName "1.6.0930" versionName "1.6.1016"
ndk { ndk {
//选择要添加的对应 cpu 类型的 .so 库。 //选择要添加的对应 cpu 类型的 .so 库。

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@@ -2,8 +2,8 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"> <shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#ffffff" /> <solid android:color="#ffffff" />
<stroke <stroke
android:width="0.8dp" android:width="1dp"
android:color="#ffffff" /> android:color="#000000" />
<!-- 圆角 --> <!-- 圆角 -->
<corners android:radius="6dp" /> <corners android:radius="6dp" />
</shape> </shape>

View File

@@ -53,6 +53,17 @@
tools:text="请输入密码" /> tools:text="请输入密码" />
</LinearLayout> </LinearLayout>
<ImageView
android:id="@+id/iv_close"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_alignParentEnd="true"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:layout_marginTop="4dp"
android:layout_marginEnd="12dp"
android:src="@drawable/icon_close" />
<EditText <EditText
android:id="@+id/message" android:id="@+id/message"
android:layout_width="match_parent" android:layout_width="match_parent"

View File

@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="utf-8"?><!-- Copyright (C) 2009 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.
-->
<!-- Tab10CPro_GK exclusive 5x5 layout (5 columns / 5 rows, 5 hotseat icons) -->
<favorites xmlns:launcher="http://schemas.android.com/apk/res-auto/com.android.uiuios">
<!-- Hotseat (screen 0..4 for 5x5, without com.aoleyun.info) -->
<favorite
launcher:className="com.aoleyun.sn.activity.SplashActivity"
launcher:container="-101"
launcher:packageName="com.aoleyun.sn"
launcher:screen="0"
launcher:x="0"
launcher:y="0" />
<favorite
launcher:className="com.aoleyun.appstore.activity.SplashActivity"
launcher:container="-101"
launcher:packageName="com.aoleyun.appstore"
launcher:screen="1"
launcher:x="1"
launcher:y="0" />
<favorite
launcher:className="com.android.settings.Settings"
launcher:container="-101"
launcher:packageName="com.android.settings"
launcher:screen="2"
launcher:x="2"
launcher:y="0" />
<favorite
launcher:className="com.aoleyun.browser.activity.main.MainActivity"
launcher:container="-101"
launcher:packageName="com.aoleyun.browser"
launcher:screen="3"
launcher:x="3"
launcher:y="0" />
<favorite
launcher:className="com.aoleyun.sn.activity.EyeProtectionActivity"
launcher:container="-101"
launcher:packageName="com.aoleyun.sn"
launcher:screen="4"
launcher:x="4"
launcher:y="0" />
</favorites>

View File

@@ -176,4 +176,24 @@
</grid-option> </grid-option>
<!-- Tab10CPro_GK (1860x2480, density 300) exclusive 5x5 profile with larger icons -->
<grid-option
launcher:name="tab10cpro_5x5"
launcher:numRows="5"
launcher:numColumns="5"
launcher:numFolderRows="4"
launcher:numFolderColumns="4"
launcher:numHotseatIcons="5"
launcher:defaultLayoutId="@xml/default_workspace_tab10cpro_5x5" >
<display-option
launcher:name="Tab10CPro 5x5"
launcher:minWidthDps="992"
launcher:minHeightDps="1323"
launcher:iconImageSize="100"
launcher:iconTextSize="15.0"
launcher:canBeDefault="true" />
</grid-option>
</profiles> </profiles>

View File

@@ -224,19 +224,6 @@ public class DeviceProfile {
updateAvailableDimensions(dm, res); updateAvailableDimensions(dm, res);
// Now that we have all of the variables calculated, we can tune certain sizes. // Now that we have all of the variables calculated, we can tune certain sizes.
if (!isVerticalBarLayout() && isPhone && isTallDevice) {
// We increase the hotseat size when there is extra space.
// ie. For a display with a large aspect ratio, we can keep the icons on the workspace
// in portrait mode closer together by adding more height to the hotseat.
// Note: This calculation was created after noticing a pattern in the design spec.
int extraSpace = getCellSize().y - iconSizePx - iconDrawablePaddingPx * 2
- verticalDragHandleSizePx;
hotseatBarSizePx += extraSpace;
hotseatBarBottomPaddingPx += extraSpace;
// Recalculate the available dimensions using the new hotseat size.
updateAvailableDimensions(dm, res);
}
updateWorkspacePadding(); updateWorkspacePadding();
// This is done last, after iconSizePx is calculated above. // This is done last, after iconSizePx is calculated above.
@@ -473,11 +460,8 @@ public class DeviceProfile {
((inv.numColumns - 1) * cellWidthPx))); ((inv.numColumns - 1) * cellWidthPx)));
availablePaddingX = (int) Math.min(availablePaddingX, availablePaddingX = (int) Math.min(availablePaddingX,
widthPx * MAX_HORIZONTAL_PADDING_PERCENT); widthPx * MAX_HORIZONTAL_PADDING_PERCENT);
int availablePaddingY = Math.max(0, heightPx - edgeMarginPx - paddingBottom padding.set(availablePaddingX / 2, edgeMarginPx,
- (2 * inv.numRows * cellHeightPx) - hotseatBarTopPaddingPx availablePaddingX / 2, paddingBottom);
- hotseatBarBottomPaddingPx);
padding.set(availablePaddingX / 2, edgeMarginPx + availablePaddingY / 2,
availablePaddingX / 2, paddingBottom + availablePaddingY / 2);
} else { } else {
// Pad the top and bottom of the workspace with search/hotseat bar sizes // Pad the top and bottom of the workspace with search/hotseat bar sizes
padding.set(desiredWorkspaceLeftRightMarginPx, padding.set(desiredWorkspaceLeftRightMarginPx,

View File

@@ -24,6 +24,9 @@ import android.annotation.TargetApi;
import android.appwidget.AppWidgetHostView; import android.appwidget.AppWidgetHostView;
import android.content.BroadcastReceiver; import android.content.BroadcastReceiver;
import android.content.ComponentName; import android.content.ComponentName;
import android.content.SharedPreferences;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.res.Configuration; import android.content.res.Configuration;
@@ -56,7 +59,6 @@ import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.function.Predicate; import java.util.function.Predicate;
import java.util.stream.Collectors;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting; import androidx.annotation.VisibleForTesting;
@@ -69,6 +71,7 @@ public class InvariantDeviceProfile {
new MainThreadInitializedObject<>(InvariantDeviceProfile::new); new MainThreadInitializedObject<>(InvariantDeviceProfile::new);
private static final String KEY_IDP_GRID_NAME = "idp_grid_name"; private static final String KEY_IDP_GRID_NAME = "idp_grid_name";
private static final String KEY_LAST_VERSION = "idp_last_version";
private static final float ICON_SIZE_DEFINED_IN_APP_DP = 48; private static final float ICON_SIZE_DEFINED_IN_APP_DP = 48;
@@ -127,7 +130,8 @@ public class InvariantDeviceProfile {
private OverlayMonitor mOverlayMonitor; private OverlayMonitor mOverlayMonitor;
@VisibleForTesting @VisibleForTesting
public InvariantDeviceProfile() {} public InvariantDeviceProfile() {
}
private InvariantDeviceProfile(InvariantDeviceProfile p) { private InvariantDeviceProfile(InvariantDeviceProfile p) {
numRows = p.numRows; numRows = p.numRows;
@@ -147,6 +151,9 @@ public class InvariantDeviceProfile {
@TargetApi(23) @TargetApi(23)
private InvariantDeviceProfile(Context context) { private InvariantDeviceProfile(Context context) {
// On app upgrade, drop the previously saved grid for Tab10CPro_GK so the dedicated
// 5x5 profile (icon size / grid / default layout) is re-selected.
maybeResetGridOnUpgrade(context);
initGrid(context, Utilities.getPrefs(context).getString(KEY_IDP_GRID_NAME, null)); initGrid(context, Utilities.getPrefs(context).getString(KEY_IDP_GRID_NAME, null));
mConfigMonitor = new ConfigMonitor(context, mConfigMonitor = new ConfigMonitor(context,
APPLY_CONFIG_AT_RUNTIME.get() ? this::onConfigChanged : this::killProcess); APPLY_CONFIG_AT_RUNTIME.get() ? this::onConfigChanged : this::killProcess);
@@ -163,6 +170,41 @@ public class InvariantDeviceProfile {
} }
} }
/**
* When the app's versionCode is raised, clear the previously saved grid name for
* Tab10CPro_GK so that {@link #initGrid} re-selects the dedicated 5x5 profile
* (icon size / grid / default layout) instead of keeping a stale saved configuration.
* A same-version reinstall does NOT trigger a reset. Other models are unaffected.
*/
private static void maybeResetGridOnUpgrade(Context context) {
if (!"Tab10CPro_GK".equals(Build.MODEL)) {
return;
}
SharedPreferences prefs = Utilities.getPrefs(context);
long currentVersion = getCurrentVersionCode(context);
long lastVersion = prefs.getLong(KEY_LAST_VERSION, -1);
if (lastVersion != -1 && lastVersion < currentVersion) {
Log.e(TAG, "maybeResetGridOnUpgrade: version raised " + lastVersion
+ " -> " + currentVersion + ", reset saved grid: "
+ prefs.getString(KEY_IDP_GRID_NAME, null));
prefs.edit().remove(KEY_IDP_GRID_NAME).apply();
}
prefs.edit().putLong(KEY_LAST_VERSION, currentVersion).apply();
}
private static long getCurrentVersionCode(Context context) {
try {
PackageInfo info = context.getPackageManager()
.getPackageInfo(context.getPackageName(), 0);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
return info.getLongVersionCode();
}
return info.versionCode;
} catch (PackageManager.NameNotFoundException e) {
return -1;
}
}
/** /**
* Retrieve system defined or RRO overriden icon shape. * Retrieve system defined or RRO overriden icon shape.
*/ */
@@ -185,8 +227,8 @@ public class InvariantDeviceProfile {
display.getCurrentSizeRange(smallestSize, largestSize); display.getCurrentSizeRange(smallestSize, largestSize);
ArrayList<DisplayOption> allOptions = getPredefinedDeviceProfiles(context, gridName); ArrayList<DisplayOption> allOptions = getPredefinedDeviceProfiles(context, gridName);
for (DisplayOption displayOption:allOptions){ for (DisplayOption displayOption : allOptions) {
Log.e(TAG, "initGrid: "+displayOption.grid.name); Log.e(TAG, "initGrid: " + displayOption.grid.name);
} }
// This guarantees that width < height // This guarantees that width < height
float minWidthDps = Utilities.dpiFromPx(Math.min(smallestSize.x, smallestSize.y), dm); float minWidthDps = Utilities.dpiFromPx(Math.min(smallestSize.x, smallestSize.y), dm);
@@ -196,18 +238,35 @@ public class InvariantDeviceProfile {
Float.compare(dist(minWidthDps, minHeightDps, a.minWidthDps, a.minHeightDps), Float.compare(dist(minWidthDps, minHeightDps, a.minWidthDps, a.minHeightDps),
dist(minWidthDps, minHeightDps, b.minWidthDps, b.minHeightDps))); dist(minWidthDps, minHeightDps, b.minWidthDps, b.minHeightDps)));
DisplayOption interpolatedDisplayOption = DisplayOption interpolatedDisplayOption =
invDistWeightedInterpolate(minWidthDps, minHeightDps, allOptions); invDistWeightedInterpolate(minWidthDps, minHeightDps, allOptions);
GridOption closestProfile; GridOption closestProfile = allOptions.stream()
if ("Aiud_A8_ag_1095".equals(Build.MODEL)) { .filter(new Predicate<DisplayOption>() {
closestProfile = allOptions.stream().filter(new Predicate<DisplayOption>() { @Override
@Override public boolean test(DisplayOption displayOption) {
public boolean test(DisplayOption displayOption) { if ("Aiud_A8_ag_1095".equals(Build.MODEL)) {
return "aiudu".equals(displayOption.grid.name); return "aiudu".equals(displayOption.grid.name);
} } else if ("Tab10CPro_GK".equals(Build.MODEL)) {
}).collect(Collectors.toList()).get(0).grid; // Tab10CPro_GK (1860x2480, density 300) exclusive 5x5 profile
}else { return "tab10cpro_5x5".equals(displayOption.grid.name);
closestProfile = allOptions.get(0).grid; }
} return false;
}
})
.map(new java.util.function.Function<DisplayOption, GridOption>() {
@Override
public GridOption apply(DisplayOption displayOption) {
return displayOption.grid;
}
})
.findFirst()
.orElse(allOptions.get(0).grid);
Log.e(TAG, "initGrid: deviceModel=" + Build.MODEL
+ ", minWidthDps=" + minWidthDps + ", minHeightDps=" + minHeightDps
+ ", selectedGrid=" + closestProfile.name
+ ", numRows=" + closestProfile.numRows
+ ", numColumns=" + closestProfile.numColumns
+ ", numHotseatIcons=" + closestProfile.numHotseatIcons
+ ", defaultLayoutId=" + closestProfile.defaultLayoutId);
numRows = closestProfile.numRows; numRows = closestProfile.numRows;
numColumns = closestProfile.numColumns; numColumns = closestProfile.numColumns;
numHotseatIcons = closestProfile.numHotseatIcons; numHotseatIcons = closestProfile.numHotseatIcons;
@@ -360,7 +419,7 @@ public class InvariantDeviceProfile {
} }
} }
} }
} catch (IOException|XmlPullParserException e) { } catch (IOException | XmlPullParserException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
@@ -388,7 +447,7 @@ public class InvariantDeviceProfile {
private int getLauncherIconDensity(int requiredSize) { private int getLauncherIconDensity(int requiredSize) {
// Densities typically defined by an app. // Densities typically defined by an app.
int[] densityBuckets = new int[] { int[] densityBuckets = new int[]{
DisplayMetrics.DENSITY_LOW, DisplayMetrics.DENSITY_LOW,
DisplayMetrics.DENSITY_MEDIUM, DisplayMetrics.DENSITY_MEDIUM,
DisplayMetrics.DENSITY_TV, DisplayMetrics.DENSITY_TV,
@@ -412,7 +471,7 @@ public class InvariantDeviceProfile {
/** /**
* Apply any Partner customization grid overrides. * Apply any Partner customization grid overrides.
* * <p>
* Currently we support: all apps row / column count. * Currently we support: all apps row / column count.
*/ */
private void applyPartnerDeviceProfileOverrides(Context context, DisplayMetrics dm) { private void applyPartnerDeviceProfileOverrides(Context context, DisplayMetrics dm) {
@@ -428,7 +487,7 @@ public class InvariantDeviceProfile {
@VisibleForTesting @VisibleForTesting
static DisplayOption invDistWeightedInterpolate(float width, float height, static DisplayOption invDistWeightedInterpolate(float width, float height,
ArrayList<DisplayOption> points) { ArrayList<DisplayOption> points) {
float weights = 0; float weights = 0;
DisplayOption p = points.get(0); DisplayOption p = points.get(0);
@@ -471,8 +530,8 @@ public class InvariantDeviceProfile {
// We will use these two data points to extrapolate how much the wallpaper parallax effect // We will use these two data points to extrapolate how much the wallpaper parallax effect
// to span (ie travel) at any aspect ratio: // to span (ie travel) at any aspect ratio:
final float ASPECT_RATIO_LANDSCAPE = 16/10f; final float ASPECT_RATIO_LANDSCAPE = 16 / 10f;
final float ASPECT_RATIO_PORTRAIT = 10/16f; final float ASPECT_RATIO_PORTRAIT = 10 / 16f;
final float WALLPAPER_WIDTH_TO_SCREEN_RATIO_LANDSCAPE = 1.5f; final float WALLPAPER_WIDTH_TO_SCREEN_RATIO_LANDSCAPE = 1.5f;
final float WALLPAPER_WIDTH_TO_SCREEN_RATIO_PORTRAIT = 1.2f; final float WALLPAPER_WIDTH_TO_SCREEN_RATIO_PORTRAIT = 1.2f;

View File

@@ -114,7 +114,7 @@ public class IconCache extends BaseIconCache {
false /*replace existing*/); false /*replace existing*/);
} }
} catch (NameNotFoundException e) { } catch (NameNotFoundException e) {
Log.d(TAG, "Package not found", e); Log.d(TAG, "Package not found: " + packageName);
} }
} }
@@ -233,16 +233,20 @@ public class IconCache extends BaseIconCache {
private List<String> appClassNameList = new ArrayList<String>() {{ private List<String> appClassNameList = new ArrayList<String>() {{
this.add("com.android.calculator2.Calculator");//计算器 this.add("com.android.calculator2.Calculator");//计算器
this.add("com.onyx.calculator.Calculator");//计算器
this.add("com.android.calendar.AllInOneActivity");//日历 this.add("com.android.calendar.AllInOneActivity");//日历
this.add("com.onyx.mail.calendar.ui.CalendarActivity");//日历
this.add("com.android.camera.CameraLauncher");//相机 this.add("com.android.camera.CameraLauncher");//相机
this.add("com.mediatek.camera.CameraLauncher");//相机 this.add("com.mediatek.camera.CameraLauncher");//相机
this.add("com.android.contacts.activities.PeopleActivity");//通讯录 this.add("com.android.contacts.activities.PeopleActivity");//通讯录
this.add("com.android.deskclock.DeskClock");//时钟 this.add("com.android.deskclock.DeskClock");//时钟
this.add("com.simplemobiletools.clock.activities.SplashActivity");//时钟
this.add("com.android.dialer.DialtactsActivity");//电话 this.add("com.android.dialer.DialtactsActivity");//电话
this.add("com.android.dialer.app.DialtactsActivity");//电话 this.add("com.android.dialer.app.DialtactsActivity");//电话
this.add("com.android.dialer.main.impl.MainActivity");//电话 this.add("com.android.dialer.main.impl.MainActivity");//电话
this.add("com.android.gallery3d.v2.app.GalleryActivity2");//图库 this.add("com.android.gallery3d.v2.app.GalleryActivity2");//图库
this.add("com.android.gallery3d.app.GalleryActivity");//图库 this.add("com.android.gallery3d.app.GalleryActivity");//图库
this.add("com.onyx.gallery.activities.NewMainActivity");//图库
this.add("com.android.messaging.ui.conversationlist.ConversationListActivity");//信息 this.add("com.android.messaging.ui.conversationlist.ConversationListActivity");//信息
this.add("com.android.mms.ui.BootActivity");//信息 this.add("com.android.mms.ui.BootActivity");//信息
this.add("com.android.music.MusicBrowserActivity");//音乐 this.add("com.android.music.MusicBrowserActivity");//音乐
@@ -262,20 +266,28 @@ public class IconCache extends BaseIconCache {
this.add("com.aoleyun.sn.activity.EyeProtectionActivity");//护眼模式 this.add("com.aoleyun.sn.activity.EyeProtectionActivity");//护眼模式
this.add("com.aoleyun.sn.activity.CleanupActivity");//一键加速 this.add("com.aoleyun.sn.activity.CleanupActivity");//一键加速
this.add("com.aoleyun.sn.activity.update.UpdateActivity");//检查更新 this.add("com.aoleyun.sn.activity.update.UpdateActivity");//检查更新
this.add("com.onyx.easytransfer.main.MainActivity");//互传
this.add("com.onyx.easytransfer.wechat.ui.WeChatDropActivity");//微信互传
this.add("com.onyx.floatingbutton.FloatButtonSettingActivity");//互传
}}; }};
private List<String> appIconList = new ArrayList<String>() {{ private List<String> appIconList = new ArrayList<String>() {{
this.add("com_android_calculator2"); this.add("com_android_calculator2");
this.add("com_android_calculator2");
this.add("com_android_calendar");
this.add("com_android_calendar"); this.add("com_android_calendar");
this.add("com_android_camera"); this.add("com_android_camera");
this.add("com_android_camera"); this.add("com_android_camera");
this.add("com_android_contacts"); this.add("com_android_contacts");
this.add("com_android_deskclock"); this.add("com_android_deskclock");
this.add("com_android_deskclock");
this.add("com_android_dialer"); this.add("com_android_dialer");
this.add("com_android_dialer"); this.add("com_android_dialer");
this.add("com_android_dialer"); this.add("com_android_dialer");
this.add("com_android_gallery3d_app"); this.add("com_android_gallery3d_app");
this.add("com_android_gallery3d_app"); this.add("com_android_gallery3d_app");
this.add("com_android_gallery3d_app");
this.add("com_android_mms_ui"); this.add("com_android_mms_ui");
this.add("com_android_mms_ui"); this.add("com_android_mms_ui");
this.add("com_android_music"); this.add("com_android_music");
@@ -295,6 +307,9 @@ public class IconCache extends BaseIconCache {
this.add("com_system_huyan"); this.add("com_system_huyan");
this.add("com_system_clean"); this.add("com_system_clean");
this.add("com_aoleyun_update"); this.add("com_aoleyun_update");
this.add("com_onyx_easytransfer");
this.add("com_onyx_easytransfer_wechat");
this.add("com_onyx_floatingbutton");
}}; }};
public Drawable getFullResIcon(LauncherActivityInfo info) { public Drawable getFullResIcon(LauncherActivityInfo info) {

View File

@@ -132,7 +132,7 @@ public class ItemClickHandler {
} }
//获取本地密码 //获取本地密码
String ApplicationLock = mMMKV.decodeString("ApplicationLock"); String ApplicationLock = mMMKV.decodeString("ApplicationLock");
Log.e("onClick", "onClick: " + ApplicationLock); Log.e("ItemClickHandler", "onClick: " + ApplicationLock);
Type type = new TypeToken<List<AppPasswdBean>>() { Type type = new TypeToken<List<AppPasswdBean>>() {
}.getType(); }.getType();
List<AppPasswdBean> appPasswdBeans = new Gson().fromJson(ApplicationLock, type); List<AppPasswdBean> appPasswdBeans = new Gson().fromJson(ApplicationLock, type);

View File

@@ -24,7 +24,7 @@ public class CustomDialog extends AlertDialog {
/** /**
* 显示的图片 * 显示的图片
*/ */
private ImageView imageIv; private ImageView imageIv, ivClose;
/** /**
* 显示的标题 * 显示的标题
@@ -103,6 +103,12 @@ public class CustomDialog extends AlertDialog {
} }
} }
}); });
ivClose.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dismiss();
}
});
} }
/** /**
@@ -176,6 +182,7 @@ public class CustomDialog extends AlertDialog {
} }
}); });
imageIv = findViewById(R.id.image); imageIv = findViewById(R.id.image);
ivClose= findViewById(R.id.iv_close);
columnLineView = findViewById(R.id.column_line); columnLineView = findViewById(R.id.column_line);
} }

View File

@@ -174,6 +174,7 @@ public class ScrimView extends View implements Insettable, WallpaperColorInfo.On
onExtractedColorsChanged(mWallpaperColorInfo); onExtractedColorsChanged(mWallpaperColorInfo);
mAM.addAccessibilityStateChangeListener(this); mAM.addAccessibilityStateChangeListener(this);
mLauncher.getStateManager().addStateListener(this);
onAccessibilityStateChanged(mAM.isEnabled()); onAccessibilityStateChanged(mAM.isEnabled());
} }
@@ -182,6 +183,7 @@ public class ScrimView extends View implements Insettable, WallpaperColorInfo.On
super.onDetachedFromWindow(); super.onDetachedFromWindow();
mWallpaperColorInfo.removeOnChangeListener(this); mWallpaperColorInfo.removeOnChangeListener(this);
mAM.removeAccessibilityStateChangeListener(this); mAM.removeAccessibilityStateChangeListener(this);
mLauncher.getStateManager().removeStateListener(this);
} }
@Override @Override
@@ -320,11 +322,7 @@ public class ScrimView extends View implements Insettable, WallpaperColorInfo.On
@Override @Override
public void onAccessibilityStateChanged(boolean enabled) { public void onAccessibilityStateChanged(boolean enabled) {
LauncherStateManager stateManager = mLauncher.getStateManager();
stateManager.removeStateListener(this);
if (enabled) { if (enabled) {
stateManager.addStateListener(this);
handleStateChangedComplete(mLauncher.getStateManager().getState()); handleStateChangedComplete(mLauncher.getStateManager().getState());
} else { } else {
setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS); setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS);
@@ -333,7 +331,9 @@ public class ScrimView extends View implements Insettable, WallpaperColorInfo.On
} }
private void updateDragHandleVisibility(Drawable recycle) { private void updateDragHandleVisibility(Drawable recycle) {
boolean visible = mLauncher.getDeviceProfile().isVerticalBarLayout() || mAM.isEnabled(); // 桌面主屏(NORMAL)状态下隐藏上滑把手(drag handle),由分页指示器(PageIndicatorDots)展示页面信息
boolean visible = (mLauncher.getDeviceProfile().isVerticalBarLayout() || mAM.isEnabled())
&& !mLauncher.isInState(NORMAL);
boolean wasVisible = mDragHandle != null; boolean wasVisible = mDragHandle != null;
if (visible != wasVisible) { if (visible != wasVisible) {
if (visible) { if (visible) {
@@ -378,6 +378,7 @@ public class ScrimView extends View implements Insettable, WallpaperColorInfo.On
setImportantForAccessibility(finalState == ALL_APPS setImportantForAccessibility(finalState == ALL_APPS
? IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS ? IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS
: IMPORTANT_FOR_ACCESSIBILITY_AUTO); : IMPORTANT_FOR_ACCESSIBILITY_AUTO);
updateDragHandleVisibility(null);
} }
protected class AccessibilityHelper extends ExploreByTouchHelper { protected class AccessibilityHelper extends ExploreByTouchHelper {