ProgressBar now shows actual progress

This commit is contained in:
massimiliano 2018-09-14 09:44:30 +02:00
parent 20598f8f53
commit 99fa3b6e58
3 changed files with 41 additions and 5 deletions

View File

@ -14,6 +14,7 @@ import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.os.Parcelable;
import android.preference.PreferenceManager;
import android.provider.MediaStore;
@ -80,6 +81,8 @@ public class MainActivity extends AppCompatActivity implements View.OnLongClickL
private String mCameraPhotoPath;
ValueCallback<Uri[]> chooserPathUri;
private ProgressBar progressBar;
private int progressStatus = 0;
private Handler handler = new Handler();
public static final int REQUEST_ID_MULTIPLE_PERMISSIONS = 1;
@ -95,7 +98,7 @@ public class MainActivity extends AppCompatActivity implements View.OnLongClickL
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
FrameLayout frameLayoutContainer = (FrameLayout) findViewById(R.id.framelayout_container);
ViewGroup viewLoading = (ViewGroup) findViewById(R.id.linearlayout_view_loading_container);
//ViewGroup viewLoading = (ViewGroup) findViewById(R.id.linearlayout_view_loading_container);
setupWebView(savedInstanceState, frameLayoutContainer);
firstStart = getSharedPreferences("org.disroot.disrootap", MODE_PRIVATE);//fisrt start
// enables the activity icon as a 'home' button. required if "android:targetSdkVersion" > 14
@ -105,8 +108,29 @@ public class MainActivity extends AppCompatActivity implements View.OnLongClickL
setSupportActionBar(toolbar);
final ScrollView dashboard = (ScrollView)findViewById(R.id.dashboard);
//progressbarLoading
progressBar = (ProgressBar)findViewById(R.id.progressbarLoading);
// Start long running operation in a background thread
new Thread(new Runnable() {
public void run() {
while (progressStatus < 100) {
progressStatus += 1;
// Update the progress bar and display the
//current value in the text view
handler.post(new Runnable() {
public void run() {
progressBar.setProgress(progressStatus);
}
});
try {
// Sleep for 200 milliseconds.
Thread.sleep(200);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}).start();
//ckCangelog library
ChangeLog cl = new ChangeLog(this);

View File

@ -13,9 +13,12 @@
style="@android:style/Widget.ProgressBar.Horizontal"
android:layout_width="match_parent"
android:layout_height="10dp"
android:progressBackgroundTint="#ffffff"
android:progressTint="@color/bg_primary_blue_dark"
android:visibility="gone"
android:indeterminate="true"
android:indeterminateTintMode="add"/>
android:indeterminate="false"
android:max="100"
android:progress="1"/>
<FrameLayout
android:id="@+id/framelayout_container"
android:layout_width="match_parent"

View File

@ -1,5 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<changelog>
<release version="0.0.4" versioncode="3" >
<change>Fixed Download issue when tryng to download a file for the first time</change>
<change>Changed layout of the about activity</change>
<change>Floating mail icon makes you send mail to Disroot</change>
<change>Corrected some typos</change>
<change>ProgressBar shows actual progress</change>
<change></change>
<change></change>
</release>
<release version="0.0.3" versioncode="3" >
<change>If Pix-art is installed then it will be launched as chat app</change>
<change>Download is possible</change>
@ -30,4 +39,4 @@
<change>menu background changed to dark</change>
<change>Added all icons</change>
</release>
</changelog>
</changelog>