feat: 适配Tab10CPro的5x5网格布局并优化对话框与上滑把手显示
This commit is contained in:
@@ -75,8 +75,8 @@ android {
|
||||
minSdkVersion 26
|
||||
targetSdkVersion 28
|
||||
|
||||
versionCode 215
|
||||
versionName "1.6.0930"
|
||||
versionCode 216
|
||||
versionName "1.6.1016"
|
||||
|
||||
ndk {
|
||||
//选择要添加的对应 cpu 类型的 .so 库。
|
||||
|
||||
BIN
res/drawable-hdpi/com_onyx_easytransfer.png
Normal file
BIN
res/drawable-hdpi/com_onyx_easytransfer.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 19 KiB |
BIN
res/drawable-hdpi/com_onyx_easytransfer_wechat.png
Normal file
BIN
res/drawable-hdpi/com_onyx_easytransfer_wechat.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 22 KiB |
BIN
res/drawable-hdpi/com_onyx_floatingbutton.png
Normal file
BIN
res/drawable-hdpi/com_onyx_floatingbutton.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 24 KiB |
BIN
res/drawable-hdpi/icon_close.png
Normal file
BIN
res/drawable-hdpi/icon_close.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.7 KiB |
@@ -2,8 +2,8 @@
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="#ffffff" />
|
||||
<stroke
|
||||
android:width="0.8dp"
|
||||
android:color="#ffffff" />
|
||||
android:width="1dp"
|
||||
android:color="#000000" />
|
||||
<!-- 圆角 -->
|
||||
<corners android:radius="6dp" />
|
||||
</shape>
|
||||
|
||||
@@ -53,6 +53,17 @@
|
||||
tools:text="请输入密码" />
|
||||
</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
|
||||
android:id="@+id/message"
|
||||
android:layout_width="match_parent"
|
||||
|
||||
55
res/xml/default_workspace_tab10cpro_5x5.xml
Normal file
55
res/xml/default_workspace_tab10cpro_5x5.xml
Normal 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>
|
||||
@@ -176,4 +176,24 @@
|
||||
|
||||
</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>
|
||||
@@ -224,19 +224,6 @@ public class DeviceProfile {
|
||||
updateAvailableDimensions(dm, res);
|
||||
|
||||
// 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();
|
||||
|
||||
// This is done last, after iconSizePx is calculated above.
|
||||
@@ -473,11 +460,8 @@ public class DeviceProfile {
|
||||
((inv.numColumns - 1) * cellWidthPx)));
|
||||
availablePaddingX = (int) Math.min(availablePaddingX,
|
||||
widthPx * MAX_HORIZONTAL_PADDING_PERCENT);
|
||||
int availablePaddingY = Math.max(0, heightPx - edgeMarginPx - paddingBottom
|
||||
- (2 * inv.numRows * cellHeightPx) - hotseatBarTopPaddingPx
|
||||
- hotseatBarBottomPaddingPx);
|
||||
padding.set(availablePaddingX / 2, edgeMarginPx + availablePaddingY / 2,
|
||||
availablePaddingX / 2, paddingBottom + availablePaddingY / 2);
|
||||
padding.set(availablePaddingX / 2, edgeMarginPx,
|
||||
availablePaddingX / 2, paddingBottom);
|
||||
} else {
|
||||
// Pad the top and bottom of the workspace with search/hotseat bar sizes
|
||||
padding.set(desiredWorkspaceLeftRightMarginPx,
|
||||
|
||||
@@ -24,6 +24,9 @@ import android.annotation.TargetApi;
|
||||
import android.appwidget.AppWidgetHostView;
|
||||
import android.content.BroadcastReceiver;
|
||||
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.Intent;
|
||||
import android.content.res.Configuration;
|
||||
@@ -56,7 +59,6 @@ import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
@@ -69,6 +71,7 @@ public class InvariantDeviceProfile {
|
||||
new MainThreadInitializedObject<>(InvariantDeviceProfile::new);
|
||||
|
||||
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;
|
||||
|
||||
@@ -127,7 +130,8 @@ public class InvariantDeviceProfile {
|
||||
private OverlayMonitor mOverlayMonitor;
|
||||
|
||||
@VisibleForTesting
|
||||
public InvariantDeviceProfile() {}
|
||||
public InvariantDeviceProfile() {
|
||||
}
|
||||
|
||||
private InvariantDeviceProfile(InvariantDeviceProfile p) {
|
||||
numRows = p.numRows;
|
||||
@@ -147,6 +151,9 @@ public class InvariantDeviceProfile {
|
||||
|
||||
@TargetApi(23)
|
||||
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));
|
||||
mConfigMonitor = new ConfigMonitor(context,
|
||||
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.
|
||||
*/
|
||||
@@ -185,8 +227,8 @@ public class InvariantDeviceProfile {
|
||||
display.getCurrentSizeRange(smallestSize, largestSize);
|
||||
|
||||
ArrayList<DisplayOption> allOptions = getPredefinedDeviceProfiles(context, gridName);
|
||||
for (DisplayOption displayOption:allOptions){
|
||||
Log.e(TAG, "initGrid: "+displayOption.grid.name);
|
||||
for (DisplayOption displayOption : allOptions) {
|
||||
Log.e(TAG, "initGrid: " + displayOption.grid.name);
|
||||
}
|
||||
// This guarantees that width < height
|
||||
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),
|
||||
dist(minWidthDps, minHeightDps, b.minWidthDps, b.minHeightDps)));
|
||||
DisplayOption interpolatedDisplayOption =
|
||||
invDistWeightedInterpolate(minWidthDps, minHeightDps, allOptions);
|
||||
GridOption closestProfile;
|
||||
if ("Aiud_A8_ag_1095".equals(Build.MODEL)) {
|
||||
closestProfile = allOptions.stream().filter(new Predicate<DisplayOption>() {
|
||||
@Override
|
||||
public boolean test(DisplayOption displayOption) {
|
||||
return "aiudu".equals(displayOption.grid.name);
|
||||
}
|
||||
}).collect(Collectors.toList()).get(0).grid;
|
||||
}else {
|
||||
closestProfile = allOptions.get(0).grid;
|
||||
}
|
||||
invDistWeightedInterpolate(minWidthDps, minHeightDps, allOptions);
|
||||
GridOption closestProfile = allOptions.stream()
|
||||
.filter(new Predicate<DisplayOption>() {
|
||||
@Override
|
||||
public boolean test(DisplayOption displayOption) {
|
||||
if ("Aiud_A8_ag_1095".equals(Build.MODEL)) {
|
||||
return "aiudu".equals(displayOption.grid.name);
|
||||
} else if ("Tab10CPro_GK".equals(Build.MODEL)) {
|
||||
// Tab10CPro_GK (1860x2480, density 300) exclusive 5x5 profile
|
||||
return "tab10cpro_5x5".equals(displayOption.grid.name);
|
||||
}
|
||||
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;
|
||||
numColumns = closestProfile.numColumns;
|
||||
numHotseatIcons = closestProfile.numHotseatIcons;
|
||||
@@ -360,7 +419,7 @@ public class InvariantDeviceProfile {
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (IOException|XmlPullParserException e) {
|
||||
} catch (IOException | XmlPullParserException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
@@ -388,7 +447,7 @@ public class InvariantDeviceProfile {
|
||||
|
||||
private int getLauncherIconDensity(int requiredSize) {
|
||||
// Densities typically defined by an app.
|
||||
int[] densityBuckets = new int[] {
|
||||
int[] densityBuckets = new int[]{
|
||||
DisplayMetrics.DENSITY_LOW,
|
||||
DisplayMetrics.DENSITY_MEDIUM,
|
||||
DisplayMetrics.DENSITY_TV,
|
||||
@@ -412,7 +471,7 @@ public class InvariantDeviceProfile {
|
||||
|
||||
/**
|
||||
* Apply any Partner customization grid overrides.
|
||||
*
|
||||
* <p>
|
||||
* Currently we support: all apps row / column count.
|
||||
*/
|
||||
private void applyPartnerDeviceProfileOverrides(Context context, DisplayMetrics dm) {
|
||||
@@ -428,7 +487,7 @@ public class InvariantDeviceProfile {
|
||||
|
||||
@VisibleForTesting
|
||||
static DisplayOption invDistWeightedInterpolate(float width, float height,
|
||||
ArrayList<DisplayOption> points) {
|
||||
ArrayList<DisplayOption> points) {
|
||||
float weights = 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
|
||||
// to span (ie travel) at any aspect ratio:
|
||||
|
||||
final float ASPECT_RATIO_LANDSCAPE = 16/10f;
|
||||
final float ASPECT_RATIO_PORTRAIT = 10/16f;
|
||||
final float ASPECT_RATIO_LANDSCAPE = 16 / 10f;
|
||||
final float ASPECT_RATIO_PORTRAIT = 10 / 16f;
|
||||
final float WALLPAPER_WIDTH_TO_SCREEN_RATIO_LANDSCAPE = 1.5f;
|
||||
final float WALLPAPER_WIDTH_TO_SCREEN_RATIO_PORTRAIT = 1.2f;
|
||||
|
||||
|
||||
@@ -114,7 +114,7 @@ public class IconCache extends BaseIconCache {
|
||||
false /*replace existing*/);
|
||||
}
|
||||
} 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>() {{
|
||||
this.add("com.android.calculator2.Calculator");//计算器
|
||||
this.add("com.onyx.calculator.Calculator");//计算器
|
||||
this.add("com.android.calendar.AllInOneActivity");//日历
|
||||
this.add("com.onyx.mail.calendar.ui.CalendarActivity");//日历
|
||||
this.add("com.android.camera.CameraLauncher");//相机
|
||||
this.add("com.mediatek.camera.CameraLauncher");//相机
|
||||
this.add("com.android.contacts.activities.PeopleActivity");//通讯录
|
||||
this.add("com.android.deskclock.DeskClock");//时钟
|
||||
this.add("com.simplemobiletools.clock.activities.SplashActivity");//时钟
|
||||
this.add("com.android.dialer.DialtactsActivity");//电话
|
||||
this.add("com.android.dialer.app.DialtactsActivity");//电话
|
||||
this.add("com.android.dialer.main.impl.MainActivity");//电话
|
||||
this.add("com.android.gallery3d.v2.app.GalleryActivity2");//图库
|
||||
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.mms.ui.BootActivity");//信息
|
||||
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.CleanupActivity");//一键加速
|
||||
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>() {{
|
||||
this.add("com_android_calculator2");
|
||||
this.add("com_android_calculator2");
|
||||
this.add("com_android_calendar");
|
||||
this.add("com_android_calendar");
|
||||
this.add("com_android_camera");
|
||||
this.add("com_android_camera");
|
||||
this.add("com_android_contacts");
|
||||
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_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_music");
|
||||
@@ -295,6 +307,9 @@ public class IconCache extends BaseIconCache {
|
||||
this.add("com_system_huyan");
|
||||
this.add("com_system_clean");
|
||||
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) {
|
||||
|
||||
@@ -132,7 +132,7 @@ public class ItemClickHandler {
|
||||
}
|
||||
//获取本地密码
|
||||
String ApplicationLock = mMMKV.decodeString("ApplicationLock");
|
||||
Log.e("onClick", "onClick: " + ApplicationLock);
|
||||
Log.e("ItemClickHandler", "onClick: " + ApplicationLock);
|
||||
Type type = new TypeToken<List<AppPasswdBean>>() {
|
||||
}.getType();
|
||||
List<AppPasswdBean> appPasswdBeans = new Gson().fromJson(ApplicationLock, type);
|
||||
|
||||
@@ -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);
|
||||
ivClose= findViewById(R.id.iv_close);
|
||||
columnLineView = findViewById(R.id.column_line);
|
||||
}
|
||||
|
||||
|
||||
@@ -174,6 +174,7 @@ public class ScrimView extends View implements Insettable, WallpaperColorInfo.On
|
||||
onExtractedColorsChanged(mWallpaperColorInfo);
|
||||
|
||||
mAM.addAccessibilityStateChangeListener(this);
|
||||
mLauncher.getStateManager().addStateListener(this);
|
||||
onAccessibilityStateChanged(mAM.isEnabled());
|
||||
}
|
||||
|
||||
@@ -182,6 +183,7 @@ public class ScrimView extends View implements Insettable, WallpaperColorInfo.On
|
||||
super.onDetachedFromWindow();
|
||||
mWallpaperColorInfo.removeOnChangeListener(this);
|
||||
mAM.removeAccessibilityStateChangeListener(this);
|
||||
mLauncher.getStateManager().removeStateListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -320,11 +322,7 @@ public class ScrimView extends View implements Insettable, WallpaperColorInfo.On
|
||||
|
||||
@Override
|
||||
public void onAccessibilityStateChanged(boolean enabled) {
|
||||
LauncherStateManager stateManager = mLauncher.getStateManager();
|
||||
stateManager.removeStateListener(this);
|
||||
|
||||
if (enabled) {
|
||||
stateManager.addStateListener(this);
|
||||
handleStateChangedComplete(mLauncher.getStateManager().getState());
|
||||
} else {
|
||||
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) {
|
||||
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;
|
||||
if (visible != wasVisible) {
|
||||
if (visible) {
|
||||
@@ -378,6 +378,7 @@ public class ScrimView extends View implements Insettable, WallpaperColorInfo.On
|
||||
setImportantForAccessibility(finalState == ALL_APPS
|
||||
? IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS
|
||||
: IMPORTANT_FOR_ACCESSIBILITY_AUTO);
|
||||
updateDragHandleVisibility(null);
|
||||
}
|
||||
|
||||
protected class AccessibilityHelper extends ExploreByTouchHelper {
|
||||
|
||||
Reference in New Issue
Block a user