diff --git a/app/build.gradle b/app/build.gradle index 53bb925..80cb81d 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -2,23 +2,23 @@ apply plugin: 'com.android.application' android { namespace 'com.ginkage.wearmouse' - compileSdkVersion 33 + compileSdk 33 defaultConfig { applicationId "com.ginkage.wearmouse" - minSdkVersion 28 + minSdkVersion 26 targetSdkVersion 33 - versionCode 31 - versionName "1.23" + versionCode 36 + versionName "1.24" externalNativeBuild { cmake { arguments "-DANDROID_ARM_NEON=TRUE", "-DANDROID_TOOLCHAIN=clang" cppFlags.addAll([ - "-std=c++11", - "-Os", - "-ffunction-sections", - "-fdata-sections", - "-fvisibility=hidden", + "-std=c++11", + "-Os", + "-ffunction-sections", + "-fdata-sections", + "-fvisibility=hidden", ]) } } @@ -39,8 +39,8 @@ android { } } compileOptions { - targetCompatibility JavaVersion.VERSION_11 - sourceCompatibility JavaVersion.VERSION_11 + targetCompatibility JavaVersion.VERSION_17 + sourceCompatibility JavaVersion.VERSION_17 } lint { checkReleaseBuilds false @@ -67,7 +67,8 @@ dependencies { implementation 'com.google.guava:guava:31.1-android' implementation 'com.google.code.findbugs:jsr305:3.0.2' implementation 'androidx.constraintlayout:constraintlayout:2.1.4' - implementation "androidx.lifecycle:lifecycle-extensions:2.2.0" - implementation "androidx.lifecycle:lifecycle-common-java8:2.5.1" + implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0' + implementation 'androidx.lifecycle:lifecycle-common-java8:2.5.1' implementation 'androidx.wear:wear:1.2.0' + implementation 'androidx.core:core-splashscreen:1.0.1' } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index a6758dd..178b2e9 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -46,7 +46,7 @@ tools:ignore="DataExtractionRules,GoogleAppIndexingWarning" tools:targetApi="31"> - + @@ -58,7 +58,8 @@ + android:launchMode="singleTop" + android:theme="@style/Theme.App.Starting" > diff --git a/app/src/main/java/com/ginkage/wearmouse/ui/devices/AboutFragment.java b/app/src/main/java/com/ginkage/wearmouse/ui/devices/AboutFragment.java index 1a76a30..a80962b 100644 --- a/app/src/main/java/com/ginkage/wearmouse/ui/devices/AboutFragment.java +++ b/app/src/main/java/com/ginkage/wearmouse/ui/devices/AboutFragment.java @@ -62,6 +62,12 @@ public View onCreateView( return root; } + @Override + public void onResume() { + super.onResume(); + getView().requestFocus(); + } + private static void createLicenseDialog(Context context) { Dialog dialog = new Dialog(context); dialog.setContentView(R.layout.dialog_open_source); @@ -70,6 +76,7 @@ private static void createLicenseDialog(Context context) { getTextFromInputStream( context.getResources().openRawResource(R.raw.apache_license))); dialog.show(); + dialog.findViewById(R.id.root_view).requestFocus(); } private static String getTextFromInputStream(InputStream stream) { diff --git a/app/src/main/java/com/ginkage/wearmouse/ui/devices/AvailableDevicesFragment.java b/app/src/main/java/com/ginkage/wearmouse/ui/devices/AvailableDevicesFragment.java index e25a35a..7098c2b 100644 --- a/app/src/main/java/com/ginkage/wearmouse/ui/devices/AvailableDevicesFragment.java +++ b/app/src/main/java/com/ginkage/wearmouse/ui/devices/AvailableDevicesFragment.java @@ -116,6 +116,12 @@ public void onCreate(Bundle savedInstanceState) { FULL_WAKE_LOCK | ACQUIRE_CAUSES_WAKEUP, "WearMouse:PokeScreen"); } + @Override + public void onResume() { + super.onResume(); + getView().requestFocus(); + } + @Override public void onRequestPermissionsResult( int requestCode, String[] permissions, int[] grantResults) { diff --git a/app/src/main/java/com/ginkage/wearmouse/ui/devices/PairedDevicesFragment.java b/app/src/main/java/com/ginkage/wearmouse/ui/devices/PairedDevicesFragment.java index 9482347..f49a855 100644 --- a/app/src/main/java/com/ginkage/wearmouse/ui/devices/PairedDevicesFragment.java +++ b/app/src/main/java/com/ginkage/wearmouse/ui/devices/PairedDevicesFragment.java @@ -83,6 +83,7 @@ public void onStart() { public void onResume() { super.onResume(); updateBluetoothStateAndDevices(); + getView().requestFocus(); } @Override diff --git a/app/src/main/java/com/ginkage/wearmouse/ui/devices/WelcomeActivity.java b/app/src/main/java/com/ginkage/wearmouse/ui/devices/WelcomeActivity.java index 1c75bb7..94a541b 100644 --- a/app/src/main/java/com/ginkage/wearmouse/ui/devices/WelcomeActivity.java +++ b/app/src/main/java/com/ginkage/wearmouse/ui/devices/WelcomeActivity.java @@ -25,6 +25,9 @@ import android.os.Build; import android.os.Bundle; import android.support.wearable.preference.WearablePreferenceActivity; + +import androidx.core.splashscreen.SplashScreen; + import com.ginkage.wearmouse.ui.onboarding.OnboardingController.ScreenKey; import com.ginkage.wearmouse.ui.onboarding.OnboardingRequest; import com.google.common.collect.ImmutableList; @@ -44,7 +47,7 @@ public void onRequestPermissionsResult( super.onRequestPermissionsResult(requestCode, permissions, grantResults); if (requestCode == 1) { if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { - startPreferenceFragment(new PairedDevicesFragment(), false); + maybeStartOnboarding(); return; } finish(); @@ -53,6 +56,7 @@ public void onRequestPermissionsResult( @Override protected void onCreate(Bundle savedInstanceState) { + SplashScreen.installSplashScreen(this); super.onCreate(savedInstanceState); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { @@ -68,12 +72,7 @@ protected void onCreate(Bundle savedInstanceState) { } } - onboardingRequest = new OnboardingRequest(this, ScreenKey.WELCOME); - if (onboardingRequest.isComplete()) { - startPreferenceFragment(new PairedDevicesFragment(), false); - } else { - onboardingRequest.start(); - } + maybeStartOnboarding(); } @Override @@ -87,4 +86,17 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) { } super.onActivityResult(requestCode, resultCode, data); } + + private void maybeStartOnboarding() { + onboardingRequest = new OnboardingRequest(this, ScreenKey.WELCOME); + if (onboardingRequest.isComplete()) { + startDevicesFragment(); + } else { + onboardingRequest.start(); + } + } + + private void startDevicesFragment() { + startPreferenceFragment(new PairedDevicesFragment(), false); + } } diff --git a/app/src/main/java/com/ginkage/wearmouse/ui/input/InputActivity.java b/app/src/main/java/com/ginkage/wearmouse/ui/input/InputActivity.java index 680d5c8..82064a6 100644 --- a/app/src/main/java/com/ginkage/wearmouse/ui/input/InputActivity.java +++ b/app/src/main/java/com/ginkage/wearmouse/ui/input/InputActivity.java @@ -107,6 +107,7 @@ public void onEnterAmbient(Bundle ambientDetails) { protected void onResume() { super.onResume(); keyboardController.onResume(); + getFragment().getView().requestFocus(); } @Override diff --git a/app/src/main/java/com/ginkage/wearmouse/ui/input/InputSettingsFragment.java b/app/src/main/java/com/ginkage/wearmouse/ui/input/InputSettingsFragment.java index 380f83d..a02eae0 100644 --- a/app/src/main/java/com/ginkage/wearmouse/ui/input/InputSettingsFragment.java +++ b/app/src/main/java/com/ginkage/wearmouse/ui/input/InputSettingsFragment.java @@ -80,6 +80,12 @@ public void onCreate(Bundle savedInstanceState) { }); } + @Override + public void onResume() { + super.onResume(); + getView().requestFocus(); + } + private void initBooleanPref(@SettingKey final String key) { final SwitchPreference pref = (SwitchPreference) findPreference(key); pref.setChecked(settings.getBoolean(key)); diff --git a/app/src/main/java/com/ginkage/wearmouse/ui/input/KeypadFragment.java b/app/src/main/java/com/ginkage/wearmouse/ui/input/KeypadFragment.java index a96e951..7a29061 100644 --- a/app/src/main/java/com/ginkage/wearmouse/ui/input/KeypadFragment.java +++ b/app/src/main/java/com/ginkage/wearmouse/ui/input/KeypadFragment.java @@ -137,6 +137,7 @@ private boolean onTouchHint(View v, MotionEvent event) { public void onResume() { super.onResume(); controller.onResume(); + getView().requestFocus(); } @Override diff --git a/app/src/main/java/com/ginkage/wearmouse/ui/input/ModeSelectFragment.java b/app/src/main/java/com/ginkage/wearmouse/ui/input/ModeSelectFragment.java index 35bbf22..5a5d895 100644 --- a/app/src/main/java/com/ginkage/wearmouse/ui/input/ModeSelectFragment.java +++ b/app/src/main/java/com/ginkage/wearmouse/ui/input/ModeSelectFragment.java @@ -69,6 +69,7 @@ public void onCreate(Bundle savedInstanceState) { public void onResume() { super.onResume(); keyboardController.onResume(); + getView().requestFocus(); } @Override diff --git a/app/src/main/java/com/ginkage/wearmouse/ui/input/MouseFragment.java b/app/src/main/java/com/ginkage/wearmouse/ui/input/MouseFragment.java index 3b01eb0..f89cf30 100644 --- a/app/src/main/java/com/ginkage/wearmouse/ui/input/MouseFragment.java +++ b/app/src/main/java/com/ginkage/wearmouse/ui/input/MouseFragment.java @@ -171,6 +171,7 @@ public void onResume() { super.onResume(); navigationDrawer.getController().peekDrawer(); actionDrawer.getController().peekDrawer(); + getView().requestFocus(); } @Override diff --git a/app/src/main/java/com/ginkage/wearmouse/ui/input/TouchpadFragment.java b/app/src/main/java/com/ginkage/wearmouse/ui/input/TouchpadFragment.java index 96d5f38..b089fab 100644 --- a/app/src/main/java/com/ginkage/wearmouse/ui/input/TouchpadFragment.java +++ b/app/src/main/java/com/ginkage/wearmouse/ui/input/TouchpadFragment.java @@ -67,6 +67,12 @@ public void onDestroy() { super.onDestroy(); } + @Override + public void onResume() { + super.onResume(); + getView().requestFocus(); + } + public boolean onTouchEvent(MotionEvent e) { if (e.getActionMasked() == MotionEvent.ACTION_DOWN) { // Prevent Swipe-To-Dismiss diff --git a/app/src/main/java/com/ginkage/wearmouse/ui/onboarding/OnboardingActivity.java b/app/src/main/java/com/ginkage/wearmouse/ui/onboarding/OnboardingActivity.java index c556dd0..dfba3ad 100644 --- a/app/src/main/java/com/ginkage/wearmouse/ui/onboarding/OnboardingActivity.java +++ b/app/src/main/java/com/ginkage/wearmouse/ui/onboarding/OnboardingActivity.java @@ -53,6 +53,12 @@ protected void onCreate(@Nullable Bundle savedInstanceState) { findViewById(R.id.roundbutton_image).setOnClickListener(this::onClick); } + @Override + protected void onResume() { + super.onResume(); + findViewById(R.id.root_view).requestFocus(); + } + private void onClick(View v) { setResult(RESULT_OK, getIntent()); finish(); diff --git a/app/src/main/res/drawable/button_left.xml b/app/src/main/res/drawable/button_left.xml new file mode 100644 index 0000000..a5f0c8b --- /dev/null +++ b/app/src/main/res/drawable/button_left.xml @@ -0,0 +1,11 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/button_right.xml b/app/src/main/res/drawable/button_right.xml new file mode 100644 index 0000000..7f981cb --- /dev/null +++ b/app/src/main/res/drawable/button_right.xml @@ -0,0 +1,11 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/splash_screen.xml b/app/src/main/res/drawable/splash_screen.xml new file mode 100644 index 0000000..b85aa8b --- /dev/null +++ b/app/src/main/res/drawable/splash_screen.xml @@ -0,0 +1,8 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_bt_state.xml b/app/src/main/res/layout/activity_bt_state.xml index 2bb690b..87818c1 100644 --- a/app/src/main/res/layout/activity_bt_state.xml +++ b/app/src/main/res/layout/activity_bt_state.xml @@ -20,6 +20,7 @@ android:layout_height="match_parent" android:orientation="vertical" android:gravity="center" + android:background="@color/black" > diff --git a/app/src/main/res/layout/activity_onboarding.xml b/app/src/main/res/layout/activity_onboarding.xml index e29067d..88469f8 100644 --- a/app/src/main/res/layout/activity_onboarding.xml +++ b/app/src/main/res/layout/activity_onboarding.xml @@ -20,8 +20,8 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:fillViewport="true" - android:overScrollMode="never" - android:scrollbars="none" + android:background="@color/black" + android:id="@+id/root_view" tools:context=".ui.onboarding.OnboardingActivity" > + android:background="@color/black"> + android:layout_height="match_parent" + android:background="@color/black" + > + app:layout_constraintTop_toTopOf="@id/top_guideline" />