Compare commits

...

5 commits

Author SHA1 Message Date
9e0f2306a8 ui: Handle system bar insets using AppBarLayout 2024-10-05 17:47:58 -04:00
1c4101ba2f ui: Handle system bar insets in SetupWizardActivity 2024-10-05 17:37:53 -04:00
c06e64ffe8 [WIP] Disable time picker temporarily
We need to rework this to use the MDC version
2024-10-05 17:14:45 -04:00
7db88df146 chore: Update targetSDK and dependencies 2024-10-05 17:10:52 -04:00
8bd864c895 chore: Upgrade AGP plugin 2024-10-05 16:57:13 -04:00
11 changed files with 79 additions and 23 deletions

10
.idea/deploymentTargetSelector.xml generated Normal file
View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="deploymentTargetSelector">
<selectionStates>
<SelectionState runConfigName="app">
<option name="selectionMode" value="DROPDOWN" />
</SelectionState>
</selectionStates>
</component>
</project>

10
.idea/migrations.xml generated Normal file
View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectMigrations">
<option name="MigrateToGradleLocalJavaHome">
<set>
<option value="$PROJECT_DIR$" />
</set>
</option>
</component>
</project>

View file

@ -38,12 +38,12 @@ def getVersionName = { ->
}
android {
compileSdk 34
buildToolsVersion = '34.0.0'
compileSdk 35
buildToolsVersion = '35.0.0'
defaultConfig {
applicationId "net.typeblog.shelter"
minSdkVersion 24
targetSdkVersion 34
targetSdkVersion 35
versionCode getVersionCode()
versionName getVersionName()
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@ -76,13 +76,12 @@ android {
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.legacy:legacy-support-core-ui:1.0.0'
implementation 'androidx.fragment:fragment:1.6.1'
implementation 'androidx.appcompat:appcompat:1.7.0-alpha03'
implementation 'androidx.fragment:fragment:1.8.4'
implementation 'androidx.appcompat:appcompat:1.7.0'
implementation 'androidx.preference:preference:1.2.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'com.google.android.material:material:1.10.0'
implementation 'com.google.android.material:material:1.12.0'
implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.1.0'
implementation 'mobi.upod:time-duration-picker:1.1.3'
debugImplementation project(path: ':setup-wizard-lib', configuration: 'gingerbreadCompatDebugRuntimeElements')
releaseImplementation project(path: ':setup-wizard-lib', configuration: 'gingerbreadCompatReleaseRuntimeElements')
testImplementation 'junit:junit:4.13.2'

View file

@ -20,10 +20,6 @@ import net.typeblog.shelter.services.IShelterService;
import net.typeblog.shelter.util.SettingsManager;
import net.typeblog.shelter.util.Utility;
import mobi.upod.timedurationpicker.TimeDurationPicker;
import mobi.upod.timedurationpicker.TimeDurationPickerDialogFragment;
import mobi.upod.timedurationpicker.TimeDurationUtil;
public class SettingsFragment extends PreferenceFragmentCompat implements Preference.OnPreferenceChangeListener {
private static final String SETTINGS_VERSION = "settings_version";
private static final String SETTINGS_SOURCE_CODE = "settings_source_code";
@ -120,9 +116,9 @@ public class SettingsFragment extends PreferenceFragmentCompat implements Prefer
}
private void updateAutoFreezeDelay() {
mPrefAutoFreezeDelay.setSummary(TimeDurationUtil.formatMinutesSeconds(
/*mPrefAutoFreezeDelay.setSummary(TimeDurationUtil.formatMinutesSeconds(
((long) mManager.getAutoFreezeDelay()) * 1000
));
));*/
}
private boolean openSummaryUrl(Preference pref) {
@ -133,7 +129,7 @@ public class SettingsFragment extends PreferenceFragmentCompat implements Prefer
}
private boolean openAutoFreezeDelayPicker(Preference pref) {
new AutoFreezeDelayPickerFragment().show(getActivity().getFragmentManager(), "dialog");
//new AutoFreezeDelayPickerFragment().show(getActivity().getFragmentManager(), "dialog");
return true;
}
@ -235,7 +231,7 @@ public class SettingsFragment extends PreferenceFragmentCompat implements Prefer
}
}
public static class AutoFreezeDelayPickerFragment extends TimeDurationPickerDialogFragment {
/*public static class AutoFreezeDelayPickerFragment extends TimeDurationPickerDialogFragment {
@Override
protected long getInitialDuration() {
return ((long) SettingsManager.getInstance().getAutoFreezeDelay()) * 1000;
@ -252,5 +248,5 @@ public class SettingsFragment extends PreferenceFragmentCompat implements Prefer
if (seconds >= Integer.MAX_VALUE) return;
SettingsManager.getInstance().setAutoFreezeDelay((int) seconds);
}
}
}*/
}

View file

@ -1,11 +1,15 @@
package net.typeblog.shelter.ui;
import androidx.activity.EdgeToEdge;
import androidx.activity.result.ActivityResultLauncher;
import androidx.activity.result.contract.ActivityResultContract;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.ContextCompat;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;
import androidx.fragment.app.Fragment;
import android.app.admin.DevicePolicyManager;
@ -44,6 +48,7 @@ public class SetupWizardActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
EdgeToEdge.enable(this);
super.onCreate(savedInstanceState);
// The user could click on the "finish provisioning" notification while having removed
// this activity from the recents stack, in which case the notification will start a new
@ -219,6 +224,25 @@ public class SetupWizardActivity extends AppCompatActivity {
mWizard.setLayoutBackground(ContextCompat.getDrawable(inflater.getContext(), R.color.colorAccent));
return view;
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
ViewCompat.setOnApplyWindowInsetsListener(mWizard, (v, windowInsets) -> {
Insets insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars());
mWizard.setDecorPaddingTop(insets.top);
NavigationBar nav = mWizard.getNavigationBar();
ViewGroup.LayoutParams params = nav.getLayoutParams();
params.height += insets.bottom;
nav.setLayoutParams(params);
nav.setPadding(nav.getPaddingLeft(), nav.getPaddingTop(), nav.getPaddingRight(), insets.bottom);
return WindowInsetsCompat.CONSUMED;
});
}
}
protected static abstract class TextWizardFragment extends BaseWizardFragment {

View file

@ -8,6 +8,7 @@
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/main_appbar"
android:fitsSystemWindows="true"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:elevation="0dp"

View file

@ -5,8 +5,10 @@
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/settings_appbar"
android:fitsSystemWindows="true"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent">

View file

@ -1,8 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto">
<View
android:id="@+id/status_bar_spacer"
android:background="?attr/colorAccent"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@id/setup_wizard_container"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
<FrameLayout
android:id="@+id/setup_wizard_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.SetupWizardActivity" />
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -7,7 +7,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:8.1.2'
classpath 'com.android.tools.build:gradle:8.6.0'
// NOTE: Do not place your application dependencies here; they belong

View file

@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip

@ -1 +1 @@
Subproject commit 0fe8340267b8824d98bf0a923a77662efbed171a
Subproject commit ae5ee4b4a0fb380c99e05f53b753cc86b212f1dd