From 0cf7b19349be2819c955b69a060f75437d695ffb Mon Sep 17 00:00:00 2001 From: SlaVcE <102253539+SlaVcE14@users.noreply.github.com> Date: Fri, 2 Feb 2024 01:14:18 +0100 Subject: [PATCH 1/5] Update material library to 1.12.0-alpha03 - update progress bar --- app/build.gradle | 2 +- .../java/com/sjapps/jsonlist/MainActivity.java | 14 ++++++++------ app/src/main/res/layout/activity_main.xml | 11 +++++------ 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 467fc4a..e8e4763 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -34,7 +34,7 @@ android { dependencies { implementation 'androidx.appcompat:appcompat:1.6.1' - implementation 'com.google.android.material:material:1.10.0' + implementation 'com.google.android.material:material:1.12.0-alpha03' implementation 'androidx.constraintlayout:constraintlayout:2.1.4' testImplementation 'junit:junit:4.+' diff --git a/app/src/main/java/com/sjapps/jsonlist/MainActivity.java b/app/src/main/java/com/sjapps/jsonlist/MainActivity.java index ea1519f..afab2a3 100644 --- a/app/src/main/java/com/sjapps/jsonlist/MainActivity.java +++ b/app/src/main/java/com/sjapps/jsonlist/MainActivity.java @@ -37,11 +37,11 @@ import android.widget.ImageButton; import android.widget.ImageView; import android.widget.LinearLayout; -import android.widget.ProgressBar; import android.widget.RelativeLayout; import android.widget.TextView; import android.widget.Toast; +import com.google.android.material.progressindicator.LinearProgressIndicator; import com.google.android.material.snackbar.BaseTransientBottomBar; import com.google.android.material.snackbar.Snackbar; import com.google.gson.JsonArray; @@ -72,7 +72,7 @@ public class MainActivity extends AppCompatActivity { RecyclerView list; JsonData data = new JsonData(); LinearLayout progressView; - ProgressBar progressBar; + LinearProgressIndicator progressBar; boolean isMenuOpen; ListAdapter adapter; View menu, dim_bg; @@ -335,7 +335,7 @@ private void LoadData(String Data) { return; } - loadingStarted("creating list"); + handler.post(()-> loadingStarted("creating list")); try { if (element instanceof JsonObject) { Log.d(TAG, "run: Json object"); @@ -491,8 +491,10 @@ void loadingStarted(String txt){ } public void updateProgress(int val){ - progressBar.setIndeterminate(false); - progressBar.setProgress(val); + handler.post(()->{ + progressBar.setProgressCompat(val,true); + }); + } void loadingFinished(boolean isFinished){ @@ -506,7 +508,7 @@ void loadingFinished(boolean isFinished){ } progressBar.setIndeterminate(false); - progressBar.setProgress(100); + progressBar.setProgressCompat(100,true); TextView text = progressView.findViewById(R.id.loadingTxt); handler.postDelayed(() -> text.setText( "finished"),500); diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 15c5013..4ae4348 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -134,6 +134,7 @@ android:padding="10dp" android:layout_marginBottom="20dp" android:visibility="invisible" + android:gravity="center" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent" @@ -149,16 +150,14 @@ android:textColor="#ffffff" /> - From f8b10af6e776b7b8d2767aca037bed160abd6450 Mon Sep 17 00:00:00 2001 From: SlaVcE <102253539+SlaVcE14@users.noreply.github.com> Date: Fri, 2 Feb 2024 01:23:04 +0100 Subject: [PATCH 2/5] move shortcuts.xml to xml-v25 --- app/src/main/res/{xml => xml-v25}/shortcuts.xml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename app/src/main/res/{xml => xml-v25}/shortcuts.xml (100%) diff --git a/app/src/main/res/xml/shortcuts.xml b/app/src/main/res/xml-v25/shortcuts.xml similarity index 100% rename from app/src/main/res/xml/shortcuts.xml rename to app/src/main/res/xml-v25/shortcuts.xml From bfaef29aff02ccc7491a7c511f4cdeb4f3ed8391 Mon Sep 17 00:00:00 2001 From: SlaVcE <102253539+SlaVcE14@users.noreply.github.com> Date: Fri, 2 Feb 2024 01:23:49 +0100 Subject: [PATCH 3/5] Update build.gradle --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index e8e4763..2ed8ff8 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -9,7 +9,7 @@ android { applicationId "com.sjapps.jsonlist" minSdk 23 targetSdk 34 - versionCode 8 + versionCode 9 versionName "1.4" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" From b3b6a23690df20e2df88702af0793b622dd10e71 Mon Sep 17 00:00:00 2001 From: SlaVcE <102253539+SlaVcE14@users.noreply.github.com> Date: Fri, 2 Feb 2024 18:57:30 +0100 Subject: [PATCH 4/5] Update buttons --- app/src/main/res/drawable/ic_back.xml | 2 +- app/src/main/res/drawable/ic_close.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/res/drawable/ic_back.xml b/app/src/main/res/drawable/ic_back.xml index 4d4019e..d2ad538 100644 --- a/app/src/main/res/drawable/ic_back.xml +++ b/app/src/main/res/drawable/ic_back.xml @@ -6,5 +6,5 @@ android:tint="?attr/colorControlNormal"> + android:pathData="M15.5 7.5c.5-.5.3-1.2 0-1.5s-1-.5-1.5 0L9 11C8.5 11.5 8.5 11.9 8.5 12S8.5 12.5 9 13L14 18c.5.5 1.2.3 1.5 0s.5-1 0-1.5L12 13C11.5 12.5 11.5 12.1 11.5 12S11.5 11.5 12 11z"/> diff --git a/app/src/main/res/drawable/ic_close.xml b/app/src/main/res/drawable/ic_close.xml index aea55ad..e483926 100644 --- a/app/src/main/res/drawable/ic_close.xml +++ b/app/src/main/res/drawable/ic_close.xml @@ -6,5 +6,5 @@ android:tint="?attr/colorControlNormal"> + android:pathData="M18.295 7.115C18.6475 6.7625 18.6475 6.0575 18.295 5.705S17.2375 5.3525 16.885 5.705L12.7 9.885c-.3525.3525-.5.4-.705.4s-.465-.165-.7-.4L7.115 5.705C6.7625 5.3525 6.0575 5.3525 5.705 5.705S5.3525 6.7625 5.705 7.115L9.885 11.295c.3525.3525.4.5.4.705S10.2375 12.3525 9.885 12.705L5.7 16.885C5.3475 17.2375 5.3525 17.9425 5.705 18.295S6.7625 18.6475 7.115 18.295L11.295 14.115c.3525-.3525.5-.4.705-.4S12.3525 13.7625 12.705 14.115L16.885 18.295C17.2375 18.6475 17.9425 18.6475 18.295 18.295S18.6475 17.2375 18.295 16.885L14.115 12.705c-.3525-.3525-.4-.5-.4-.705S13.7625 11.6475 14.115 11.295z"/> From 50a60d3a6996b8d0d65c047ad8355d0c7e013f1c Mon Sep 17 00:00:00 2001 From: SlaVcE <102253539+SlaVcE14@users.noreply.github.com> Date: Fri, 2 Feb 2024 20:37:53 +0100 Subject: [PATCH 5/5] Fix some visual bugs --- app/src/main/java/com/sjapps/jsonlist/MainActivity.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/sjapps/jsonlist/MainActivity.java b/app/src/main/java/com/sjapps/jsonlist/MainActivity.java index afab2a3..e6a98a2 100644 --- a/app/src/main/java/com/sjapps/jsonlist/MainActivity.java +++ b/app/src/main/java/com/sjapps/jsonlist/MainActivity.java @@ -106,7 +106,9 @@ protected void onCreate(Bundle savedInstanceState) { autoTransition.setDuration(150); menuBtn.setOnClickListener(view -> open_closeMenu()); - backBtn.setOnClickListener(view -> getOnBackPressedDispatcher().onBackPressed()); + backBtn.setOnClickListener(view -> { + if(!data.isEmptyPath()) getOnBackPressedDispatcher().onBackPressed(); + }); openFileBtn.setOnClickListener(view -> ImportFromFile()); menu.findViewById(R.id.openFileBtn2).setOnClickListener(view -> { @@ -262,7 +264,7 @@ public void handleOnBackPressed() { .show(); return; } - + TransitionManager.endTransitions(viewGroup); TransitionManager.beginDelayedTransition(viewGroup, autoTransition); data.goBack(); open(JsonData.getPathFormat(data.getPath()), data.getPath(),-1); @@ -378,6 +380,7 @@ private void LoadData(String Data) { } public void open(String Title, String path, int previousPosition) { + TransitionManager.endTransitions(viewGroup); TransitionManager.beginDelayedTransition(viewGroup, autoTransition); if (isMenuOpen)