Skip to content

Commit b397b83

Browse files
authored
Merge pull request #9 from jkas-dbt/dev
Fix dialog Attr value parser
2 parents 15769eb + 3930d4f commit b397b83

File tree

17 files changed

+712
-640
lines changed

17 files changed

+712
-640
lines changed

app/src/main/java/jkas/androidpe/activities/MainActivity.java

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,10 @@
55
import android.content.res.ColorStateList;
66
import android.graphics.Color;
77
import android.graphics.drawable.GradientDrawable;
8+
import com.google.android.material.elevation.SurfaceColors;
89
import android.os.Build;
910
import android.os.Bundle;
10-
import android.os.Handler;
11-
import android.os.Looper;
1211
import android.view.View;
13-
import android.widget.Toast;
1412
import androidx.activity.result.ActivityResultLauncher;
1513
import androidx.activity.result.contract.ActivityResultContracts;
1614
import androidx.annotation.IntDef;
@@ -77,12 +75,8 @@ public static int getPermissionStatus(
7775
if (!ActivityCompat.shouldShowRequestPermissionRationale(
7876
activity, androidPermissionName)) {
7977
return BLOCKED_OR_NEVER_ASKED;
80-
} else {
81-
return DENIED;
82-
}
83-
} else {
84-
return GRANTED;
85-
}
78+
} else return DENIED;
79+
} else return GRANTED;
8680
}
8781

8882
@Override
@@ -294,5 +288,25 @@ private void viewGradientBottom() {
294288
private void initInstances() {
295289
SP = new SearchingProjects(C);
296290
newProject = new NewProject(C);
291+
292+
if (CodeUtil.isScreenLandscape(this)) {
293+
GradientDrawable gradient = new GradientDrawable();
294+
gradient.setColor(SurfaceColors.SURFACE_3.getColor(this));
295+
gradient.setCornerRadii(new float[] {0, 0, 43, 43, 43, 43, 0, 0});
296+
binding.navRailView.setBackground(gradient);
297+
binding.navRailView.setOnItemSelectedListener(
298+
item -> {
299+
return false;
300+
});
301+
} else {
302+
CodeUtil.setNavigationBarColor(this, SurfaceColors.SURFACE_3.getColor(this));
303+
binding.bottomAppBar.setBackgroundColor(SurfaceColors.SURFACE_3.getColor(this));
304+
binding.bottomAppBar
305+
.getMenu()
306+
.getItem(0)
307+
.setIconTintList(
308+
ColorStateList.valueOf(
309+
ResourcesValuesFixer.getColor(C, "?colorPrimary")));
310+
}
297311
}
298312
}

app/src/main/java/jkas/androidpe/preferences/AboutCategory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ private void addData() {
5050
new Intent(
5151
Intent.ACTION_VIEW,
5252
Uri.parse(
53-
"https://github.com/jkas-dbt/AndroidPE/releases/tag/v1.5")));
53+
"https://github.com/jkas-dbt/AndroidPE/releases/tag/v1.6")));
5454
return true;
5555
});
5656
aboutCategory.addPreference(changelog);

app/src/main/java/jkas/androidpe/projectAnalyzer/ProjectView.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import androidx.appcompat.widget.PopupMenu;
1313
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
1414
import com.google.android.material.elevation.SurfaceColors;
15+
import java.util.concurrent.Executors;
1516
import jkas.androidpe.activities.ProjectEditorActivity;
1617
import jkas.androidpe.resources.R;
1718
import jkas.androidpe.resourcesUtils.dataInitializer.DataRefManager;
@@ -118,7 +119,7 @@ private void deleteProject() {
118119
R.string.delete,
119120
(b1, b2) -> {
120121
try {
121-
Files.deleteDir(path);
122+
Executors.newSingleThreadExecutor().execute(() -> Files.deleteDir(path));
122123
view.setVisibility(View.GONE);
123124
} catch (Exception e) {
124125
Toast.makeText(
@@ -200,4 +201,4 @@ public void setBgView() {
200201
view.setBackground(ripple);
201202
view.setElevation(5);
202203
}
203-
}
204+
}

app/src/main/res/layout-land/activity_main.xml

Lines changed: 81 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -93,109 +93,125 @@
9393

9494
</LinearLayout>
9595

96-
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
96+
<LinearLayout
9797
android:layout_height="match_parent"
9898
android:layout_width="match_parent"
99-
android:id="@+id/swipeRefreshLayout">
99+
android:orientation="horizontal"
100+
android:layout_marginTop="8dp">
101+
102+
<com.google.android.material.navigationrail.NavigationRailView
103+
android:layout_height="match_parent"
104+
android:layout_width="wrap_content"
105+
android:id="@+id/navRailView"
106+
app:menu="@menu/main_project_type"
107+
android:padding="14dp"
108+
android:layout_marginBottom="16dp"/>
100109

101-
<ViewSwitcher
110+
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
102111
android:layout_height="match_parent"
103112
android:layout_width="match_parent"
104-
android:id="@+id/viewSwitcher">
113+
android:id="@+id/swipeRefreshLayout">
105114

106-
<LinearLayout
115+
<ViewSwitcher
107116
android:layout_height="match_parent"
108117
android:layout_width="match_parent"
109-
android:gravity="center"
110-
android:padding="8dp"
111-
android:orientation="vertical">
118+
android:id="@+id/viewSwitcher">
112119

113120
<LinearLayout
114-
android:layout_height="wrap_content"
115-
android:layout_width="wrap_content"
121+
android:layout_height="match_parent"
122+
android:layout_width="match_parent"
116123
android:gravity="center"
124+
android:padding="8dp"
117125
android:orientation="vertical">
118126

119-
<TextView
120-
android:layout_height="wrap_content"
121-
android:layout_width="250dp"
122-
android:gravity="center"
123-
android:alpha="0.43"
124-
android:textSize="10dp"
125-
android:typeface="serif"
126-
android:text="@string/swipe_refresh_data_or_create_new_project"/>
127-
128127
<LinearLayout
129128
android:layout_height="wrap_content"
130129
android:layout_width="wrap_content"
131130
android:gravity="center"
132-
android:orientation="horizontal">
131+
android:orientation="vertical">
133132

134133
<TextView
135134
android:layout_height="wrap_content"
136-
android:layout_width="wrap_content"
135+
android:layout_width="250dp"
136+
android:gravity="center"
137+
android:alpha="0.43"
137138
android:textSize="10dp"
138-
android:textColor="?colorTertiary"
139139
android:typeface="serif"
140-
android:text="Storage Access Status : "/>
140+
android:text="@string/swipe_refresh_data_or_create_new_project"/>
141141

142-
<TextView
142+
<LinearLayout
143143
android:layout_height="wrap_content"
144144
android:layout_width="wrap_content"
145-
android:textSize="10dp"
146-
android:textColor="?colorPrimary"
147-
android:typeface="serif"
148-
android:textStyle="bold"
149-
android:id="@+id/tvStatusPermission"
150-
android:text="Loading ..."/>
145+
android:gravity="center"
146+
android:orientation="horizontal">
147+
148+
<TextView
149+
android:layout_height="wrap_content"
150+
android:layout_width="wrap_content"
151+
android:textSize="10dp"
152+
android:textColor="?colorTertiary"
153+
android:typeface="serif"
154+
android:text="Storage Access Status : "/>
155+
156+
<TextView
157+
android:layout_height="wrap_content"
158+
android:layout_width="wrap_content"
159+
android:textSize="10dp"
160+
android:textColor="?colorPrimary"
161+
android:typeface="serif"
162+
android:textStyle="bold"
163+
android:id="@+id/tvStatusPermission"
164+
android:text="Loading ..."/>
165+
166+
</LinearLayout>
151167

152168
</LinearLayout>
153169

154170
</LinearLayout>
155171

156-
</LinearLayout>
172+
<RelativeLayout
173+
android:layout_height="match_parent"
174+
android:layout_width="match_parent"
175+
android:gravity="center_horizontal"
176+
android:padding="4dp">
157177

158-
<RelativeLayout
159-
android:layout_height="match_parent"
160-
android:layout_width="match_parent"
161-
android:gravity="center_horizontal"
162-
android:padding="4dp">
178+
<androidx.core.widget.NestedScrollView
179+
android:layout_height="match_parent"
180+
android:layout_width="match_parent">
163181

164-
<androidx.core.widget.NestedScrollView
165-
android:layout_height="match_parent"
166-
android:layout_width="match_parent">
182+
<GridLayout
183+
android:layout_height="wrap_content"
184+
android:layout_width="match_parent"
185+
android:scrollbars="vertical"
186+
android:layout_marginBottom="143dp"
187+
android:horizontalSpacing="8dp"
188+
android:layout_marginLeft="76dp"
189+
android:layout_marginRight="76dp"
190+
android:layout_marginTop="15dp"
191+
android:verticalSpacing="8dp"
192+
android:columnCount="2"
193+
android:id="@+id/gridLayoutListProjects"/>
194+
195+
</androidx.core.widget.NestedScrollView>
196+
197+
<View
198+
android:layout_height="20dp"
199+
android:layout_width="match_parent"
200+
android:id="@+id/viewGradientTop"/>
167201

168-
<GridLayout
169-
android:layout_height="wrap_content"
202+
<View
203+
android:layout_height="76dp"
170204
android:layout_width="match_parent"
171-
android:scrollbars="vertical"
172-
android:layout_marginBottom="143dp"
173-
android:horizontalSpacing="8dp"
174-
android:layout_marginLeft="76dp"
175-
android:layout_marginRight="76dp"
176-
android:layout_marginTop="15dp"
177-
android:verticalSpacing="8dp"
178-
android:columnCount="2"
179-
android:id="@+id/gridLayoutListProjects"/>
180-
181-
</androidx.core.widget.NestedScrollView>
182-
183-
<View
184-
android:layout_height="20dp"
185-
android:layout_width="match_parent"
186-
android:id="@+id/viewGradientTop"/>
205+
android:layout_alignParentBottom="true"
206+
android:id="@+id/viewGradientBottom"/>
187207

188-
<View
189-
android:layout_height="76dp"
190-
android:layout_width="match_parent"
191-
android:layout_alignParentBottom="true"
192-
android:id="@+id/viewGradientBottom"/>
208+
</RelativeLayout>
193209

194-
</RelativeLayout>
210+
</ViewSwitcher>
195211

196-
</ViewSwitcher>
212+
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
197213

198-
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
214+
</LinearLayout>
199215

200216
</LinearLayout>
201217

0 commit comments

Comments
 (0)