Skip to content

Commit

Permalink
Merge pull request #25 from SlaVcE14/UI-update
Browse files Browse the repository at this point in the history
UI update
  • Loading branch information
SlaVcE14 authored Feb 2, 2024
2 parents 039575b + 50a60d3 commit 68e9c80
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 18 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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.+'
Expand Down
21 changes: 13 additions & 8 deletions app/src/main/java/com/sjapps/jsonlist/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 -> {
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -335,7 +337,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");
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -491,8 +494,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){
Expand All @@ -506,7 +511,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);
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/drawable/ic_back.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M15.41,7.41L14,6l-6,6 6,6 1.41,-1.41L10.83,12z"/>
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"/>
</vector>
2 changes: 1 addition & 1 deletion app/src/main/res/drawable/ic_close.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M19,6.41L17.59,5 12,10.59 6.41,5 5,6.41 10.59,12 5,17.59 6.41,19 12,13.41 17.59,19 19,17.59 13.41,12z"/>
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"/>
</vector>
11 changes: 5 additions & 6 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -149,16 +150,14 @@
android:textColor="#ffffff"

/>
<ProgressBar
<com.google.android.material.progressindicator.LinearProgressIndicator
android:id="@+id/progressBar"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="5dp"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:indeterminate="true"
android:layout_marginTop="5dp"
android:max="100"
android:progressTint="#ffffff"
android:indeterminateTint="#ffffff"
app:indicatorColor="#ffffff"
/>
</LinearLayout>
</RelativeLayout>
Expand Down
File renamed without changes.

0 comments on commit 68e9c80

Please sign in to comment.