diff --git a/build.gradle b/build.gradle index f75a86b..34e87b4 100644 --- a/build.gradle +++ b/build.gradle @@ -75,8 +75,8 @@ android { minSdkVersion 26 targetSdkVersion 28 - versionCode 215 - versionName "1.6.0930" + versionCode 216 + versionName "1.6.1016" ndk { //选择要添加的对应 cpu 类型的 .so 库。 diff --git a/res/drawable-hdpi/com_onyx_easytransfer.png b/res/drawable-hdpi/com_onyx_easytransfer.png new file mode 100644 index 0000000..97a9f4a Binary files /dev/null and b/res/drawable-hdpi/com_onyx_easytransfer.png differ diff --git a/res/drawable-hdpi/com_onyx_easytransfer_wechat.png b/res/drawable-hdpi/com_onyx_easytransfer_wechat.png new file mode 100644 index 0000000..e6b725a Binary files /dev/null and b/res/drawable-hdpi/com_onyx_easytransfer_wechat.png differ diff --git a/res/drawable-hdpi/com_onyx_floatingbutton.png b/res/drawable-hdpi/com_onyx_floatingbutton.png new file mode 100644 index 0000000..431a060 Binary files /dev/null and b/res/drawable-hdpi/com_onyx_floatingbutton.png differ diff --git a/res/drawable-hdpi/icon_close.png b/res/drawable-hdpi/icon_close.png new file mode 100644 index 0000000..9ebcb0b Binary files /dev/null and b/res/drawable-hdpi/icon_close.png differ diff --git a/res/drawable/bg_dialog.xml b/res/drawable/bg_dialog.xml index 470ebb3..3ac3070 100644 --- a/res/drawable/bg_dialog.xml +++ b/res/drawable/bg_dialog.xml @@ -2,8 +2,8 @@ + android:width="1dp" + android:color="#000000" /> diff --git a/res/layout/custom_dialog.xml b/res/layout/custom_dialog.xml index c71c5c9..23e29e5 100644 --- a/res/layout/custom_dialog.xml +++ b/res/layout/custom_dialog.xml @@ -53,6 +53,17 @@ tools:text="请输入密码" /> + + + + + + + + + + + + + diff --git a/res/xml/device_profiles.xml b/res/xml/device_profiles.xml index cf86326..5cdaba2 100644 --- a/res/xml/device_profiles.xml +++ b/res/xml/device_profiles.xml @@ -176,4 +176,24 @@ + + + + + + + \ No newline at end of file diff --git a/src/com/aoleyun/os/DeviceProfile.java b/src/com/aoleyun/os/DeviceProfile.java index 7b8d7c5..c49e311 100644 --- a/src/com/aoleyun/os/DeviceProfile.java +++ b/src/com/aoleyun/os/DeviceProfile.java @@ -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, diff --git a/src/com/aoleyun/os/InvariantDeviceProfile.java b/src/com/aoleyun/os/InvariantDeviceProfile.java index ba67d30..46089cd 100644 --- a/src/com/aoleyun/os/InvariantDeviceProfile.java +++ b/src/com/aoleyun/os/InvariantDeviceProfile.java @@ -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 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() { - @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() { + @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() { + @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. - * + *

* 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 points) { + ArrayList 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; diff --git a/src/com/aoleyun/os/icons/IconCache.java b/src/com/aoleyun/os/icons/IconCache.java index 10ef410..4656e19 100644 --- a/src/com/aoleyun/os/icons/IconCache.java +++ b/src/com/aoleyun/os/icons/IconCache.java @@ -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 appClassNameList = new ArrayList() {{ 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 appIconList = new ArrayList() {{ 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) { diff --git a/src/com/aoleyun/os/touch/ItemClickHandler.java b/src/com/aoleyun/os/touch/ItemClickHandler.java index 8c360dc..6231ad0 100644 --- a/src/com/aoleyun/os/touch/ItemClickHandler.java +++ b/src/com/aoleyun/os/touch/ItemClickHandler.java @@ -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>() { }.getType(); List appPasswdBeans = new Gson().fromJson(ApplicationLock, type); diff --git a/src/com/aoleyun/os/uiuiutils/CustomDialog.java b/src/com/aoleyun/os/uiuiutils/CustomDialog.java index 9613ba1..ed45fba 100644 --- a/src/com/aoleyun/os/uiuiutils/CustomDialog.java +++ b/src/com/aoleyun/os/uiuiutils/CustomDialog.java @@ -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); } diff --git a/src/com/aoleyun/os/views/ScrimView.java b/src/com/aoleyun/os/views/ScrimView.java index 5fe4959..986048c 100644 --- a/src/com/aoleyun/os/views/ScrimView.java +++ b/src/com/aoleyun/os/views/ScrimView.java @@ -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 {