Skip to content
This repository was archived by the owner on May 4, 2023. It is now read-only.

Commit d675e67

Browse files
Fix some weird layout issues
Signed-off-by: androidacy-user <opensource@androidacy.com>
1 parent 9e9793d commit d675e67

File tree

4 files changed

+62
-60
lines changed

4 files changed

+62
-60
lines changed

app/src/main/java/com/fox2code/mmm/MainActivity.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ protected void onCreate(Bundle savedInstanceState) {
139139
}
140140
setContentView(R.layout.activity_main);
141141
this.setTitle(R.string.app_name);
142-
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION, WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
142+
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION, 0);
143143
setActionBarBackground(null);
144144
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
145145
WindowManager.LayoutParams layoutParams = this.getWindow().getAttributes();
@@ -749,6 +749,7 @@ private void checkShowInitialSetup() {
749749
View view = getLayoutInflater().inflate(R.layout.setup_box, null);
750750
// Make the setup_box linear layout the sole child of the root_container constraint layout
751751
setContentView(view);
752+
updateScreenInsets();
752753
// Handle action bar. Set it to setup_title and make it visible
753754
ActionBar actionBar = getSupportActionBar();
754755
if (actionBar != null) {

app/src/main/java/com/fox2code/mmm/androidacy/AndroidacyRepoData.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package com.fox2code.mmm.androidacy;
22

33
import android.content.SharedPreferences;
4-
import android.database.sqlite.SQLiteDatabase;
54
import android.os.Looper;
65
import android.util.Log;
76
import android.widget.Toast;
@@ -58,8 +57,17 @@ public final class AndroidacyRepoData extends RepoData {
5857

5958
public AndroidacyRepoData(File cacheRoot, SharedPreferences cachedPreferences, boolean testMode) {
6059
super(testMode ? RepoManager.ANDROIDACY_TEST_MAGISK_REPO_ENDPOINT : RepoManager.ANDROIDACY_MAGISK_REPO_ENDPOINT, cacheRoot, cachedPreferences);
61-
// make sure the metadata db exists
62-
SQLiteDatabase.openOrCreateDatabase(new File(cacheRoot, "modules.db"), null);
60+
// make sure the modules.json exists
61+
File modulesJson = new File(cacheRoot, "modules.json");
62+
if (!modulesJson.exists()) {
63+
try {
64+
if (!modulesJson.createNewFile()) {
65+
throw new IOException("Failed to create modules.json");
66+
}
67+
} catch (IOException e) {
68+
e.printStackTrace();
69+
}
70+
}
6371
this.defaultName = "Androidacy Modules Repo";
6472
this.defaultWebsite = RepoManager.ANDROIDACY_MAGISK_REPO_HOMEPAGE;
6573
this.defaultSupport = "https://t.me/androidacy_discussions";

app/src/main/java/com/fox2code/mmm/markdown/MarkdownActivity.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,7 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
106106
}
107107
setActionBarBackground(null);
108108
this.getWindow().setFlags(
109-
WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION,
110-
WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
109+
WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION, 0);
111110
if (config != null && !config.isEmpty()) {
112111
String configPkg = IntentHelper.getPackageOfConfig(config);
113112
try {

app/src/main/res/layout/setup_box.xml

Lines changed: 48 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,42 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<RelativeLayout
2+
3+
<!-- App name as subheader -->
4+
5+
<ScrollView
36
xmlns:android="http://schemas.android.com/apk/res/android"
47
xmlns:app="http://schemas.android.com/apk/res-auto"
8+
xmlns:tools="http://schemas.android.com/tools"
9+
android:id="@+id/setup_scroll"
510
android:layout_width="match_parent"
611
android:layout_height="match_parent"
7-
android:gravity="fill_vertical"
12+
android:layout_gravity="fill"
813
android:orientation="vertical"
9-
android:padding="16dp"
10-
android:scrollbars="vertical">
14+
android:fillViewport="true"
15+
android:padding="6dp"
16+
app:layout_behavior="@string/appbar_scrolling_view_behavior"
17+
app:layout_constraintBottom_toBottomOf="parent"
18+
app:layout_constraintEnd_toEndOf="parent"
19+
app:layout_constraintStart_toStartOf="parent"
20+
app:layout_constraintTop_toTopOf="parent">
21+
22+
<LinearLayout
23+
android:layout_width="match_parent"
24+
android:layout_height="wrap_content"
25+
android:orientation="vertical">
26+
1127

12-
<!-- App name as subheader -->
1328
<TextView
1429
android:id="@+id/setup_title"
15-
android:layout_width="match_parent"
30+
android:layout_width="wrap_content"
1631
android:layout_height="wrap_content"
17-
android:layout_marginTop="56dp"
18-
android:text="@string/setup_title"
19-
android:textAppearance="@style/TextAppearance.Material3.HeadlineSmall" />
32+
android:text="@string/setup_title" android:textAppearance="@style/TextAppearance.Material3.HeadlineSmall" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="@+id/setup_scroll" />
2033

2134
<com.google.android.material.textview.MaterialTextView
2235
android:id="@+id/setup_summary"
2336
android:layout_width="wrap_content"
2437
android:layout_height="wrap_content"
25-
android:layout_below="@+id/setup_title"
2638
android:text="@string/setup_message" />
2739

28-
<ScrollView
29-
android:id="@+id/setup_scroll"
30-
android:layout_width="match_parent"
31-
android:layout_height="match_parent"
32-
android:layout_below="@id/setup_summary"
33-
android:fillViewport="true"
34-
app:layout_behavior="@string/appbar_scrolling_view_behavior">
35-
36-
<LinearLayout
37-
android:layout_width="match_parent"
38-
android:layout_height="wrap_content"
39-
android:orientation="vertical">
40-
4140
<!-- Theme radio select. Options are system, light, dark, black, transparent_light -->
4241
<!-- First, choose theme header -->
4342
<TextView
@@ -51,7 +50,7 @@
5150
<!-- Button to trigger theme selection -->
5251
<com.google.android.material.button.MaterialButton
5352
android:id="@+id/setup_theme_button"
54-
android:layout_width="match_parent"
53+
android:layout_width="320dp"
5554
android:layout_height="wrap_content"
5655
android:layout_marginTop="4dp"
5756
android:backgroundTint="@color/gray_900"
@@ -66,18 +65,16 @@
6665
app:iconPadding="8dp"
6766
app:iconTint="@color/white"
6867
app:iconTintMode="src_in"
69-
app:rippleColor="@color/gray_800" />
68+
app:rippleColor="@color/gray_800" tools:ignore="DuplicateSpeakableTextCheck" />
7069

7170
<com.google.android.material.textview.MaterialTextView
7271
android:layout_width="match_parent"
7372
android:layout_height="wrap_content"
7473
android:layout_margin="4dp"
7574
android:text="@string/repos"
76-
android:textAppearance="@android:style/TextAppearance.Material.Headline" />
77-
78-
<com.google.android.material.materialswitch.MaterialSwitch
75+
android:textAppearance="@android:style/TextAppearance.Material.Headline" /><com.google.android.material.materialswitch.MaterialSwitch
7976
android:id="@+id/setup_androidacy_repo"
80-
android:layout_width="match_parent"
77+
android:layout_width="320dp"
8178
android:layout_height="wrap_content"
8279
android:layout_margin="4dp"
8380
android:checked="false"
@@ -97,7 +94,7 @@
9794

9895
<com.google.android.material.materialswitch.MaterialSwitch
9996
android:id="@+id/setup_magisk_alt_repo"
100-
android:layout_width="match_parent"
97+
android:layout_width="320dp"
10198
android:layout_height="wrap_content"
10299
android:layout_margin="4dp"
103100
android:checked="false"
@@ -131,7 +128,7 @@
131128

132129
<com.google.android.material.materialswitch.MaterialSwitch
133130
android:id="@+id/setup_crash_reporting"
134-
android:layout_width="match_parent"
131+
android:layout_width="320dp"
135132
android:layout_height="wrap_content"
136133
android:layout_margin="4dp"
137134
android:checked="false"
@@ -150,7 +147,7 @@
150147

151148
<com.google.android.material.materialswitch.MaterialSwitch
152149
android:id="@+id/setup_background_update_check"
153-
android:layout_width="match_parent"
150+
android:layout_width="320dp"
154151
android:layout_height="wrap_content"
155152
android:layout_margin="4dp"
156153
android:checked="false"
@@ -178,31 +175,28 @@
178175
android:key="pref_app_analytics"
179176
android:textAppearance="@android:style/TextAppearance.Material.Small"
180177
android:text="@string/setup_app_analytics" />-->
181-
</LinearLayout>
182-
</ScrollView>
183-
<!-- setup_cancel and setup_continue side by side buttons, stuck to bottom right, with a small space in between -->
184-
<LinearLayout
185-
android:layout_width="wrap_content"
186-
android:layout_height="wrap_content"
187-
android:layout_alignEnd="@+id/setup_scroll"
188-
android:layout_alignParentBottom="true"
189-
android:layout_gravity="bottom|end"
190-
android:layout_margin="4dp"
191-
android:orientation="horizontal">
192178

193-
<com.google.android.material.button.MaterialButton
194-
android:id="@+id/setup_cancel"
195-
android:layout_width="wrap_content"
196-
android:layout_height="wrap_content"
197-
android:layout_marginEnd="2dp"
198-
android:layout_weight="1"
199-
android:text="@string/cancel" />
179+
<!-- Linear layout for the finish and cancel buttons -->
180+
<LinearLayout
181+
android:layout_width="wrap_content"
182+
android:layout_height="wrap_content"
183+
android:layout_gravity="bottom|end"
184+
android:layout_margin="4dp"
185+
android:orientation="horizontal">
186+
<com.google.android.material.button.MaterialButton
187+
android:id="@+id/setup_cancel"
188+
android:layout_width="120dp"
189+
android:layout_height="wrap_content"
190+
android:layout_marginEnd="2dp"
191+
android:layout_weight="1"
192+
android:text="@string/cancel" android:textColor="#5D4037" />
200193

201194
<com.google.android.material.button.MaterialButton
202195
android:id="@+id/setup_continue"
203-
android:layout_width="wrap_content"
196+
android:layout_width="120dp"
204197
android:layout_height="wrap_content"
205198
android:layout_weight="1"
206-
android:text="@string/finish" />
207-
</LinearLayout>
208-
</RelativeLayout>
199+
android:text="@string/finish" android:textColor="#5D4037" />
200+
</LinearLayout>
201+
</LinearLayout>
202+
</ScrollView>

0 commit comments

Comments
 (0)