ProgressBar now shows actual progress
This commit is contained in:
parent
20598f8f53
commit
99fa3b6e58
|
@ -14,6 +14,7 @@ import android.net.Uri;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
|
import android.os.Handler;
|
||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.provider.MediaStore;
|
import android.provider.MediaStore;
|
||||||
|
@ -80,6 +81,8 @@ public class MainActivity extends AppCompatActivity implements View.OnLongClickL
|
||||||
private String mCameraPhotoPath;
|
private String mCameraPhotoPath;
|
||||||
ValueCallback<Uri[]> chooserPathUri;
|
ValueCallback<Uri[]> chooserPathUri;
|
||||||
private ProgressBar progressBar;
|
private ProgressBar progressBar;
|
||||||
|
private int progressStatus = 0;
|
||||||
|
private Handler handler = new Handler();
|
||||||
|
|
||||||
public static final int REQUEST_ID_MULTIPLE_PERMISSIONS = 1;
|
public static final int REQUEST_ID_MULTIPLE_PERMISSIONS = 1;
|
||||||
|
|
||||||
|
@ -95,7 +98,7 @@ public class MainActivity extends AppCompatActivity implements View.OnLongClickL
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_main);
|
setContentView(R.layout.activity_main);
|
||||||
FrameLayout frameLayoutContainer = (FrameLayout) findViewById(R.id.framelayout_container);
|
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);
|
setupWebView(savedInstanceState, frameLayoutContainer);
|
||||||
firstStart = getSharedPreferences("org.disroot.disrootap", MODE_PRIVATE);//fisrt start
|
firstStart = getSharedPreferences("org.disroot.disrootap", MODE_PRIVATE);//fisrt start
|
||||||
// enables the activity icon as a 'home' button. required if "android:targetSdkVersion" > 14
|
// 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);
|
setSupportActionBar(toolbar);
|
||||||
final ScrollView dashboard = (ScrollView)findViewById(R.id.dashboard);
|
final ScrollView dashboard = (ScrollView)findViewById(R.id.dashboard);
|
||||||
|
|
||||||
|
//progressbarLoading
|
||||||
progressBar = (ProgressBar)findViewById(R.id.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
|
//ckCangelog library
|
||||||
ChangeLog cl = new ChangeLog(this);
|
ChangeLog cl = new ChangeLog(this);
|
||||||
|
|
|
@ -13,9 +13,12 @@
|
||||||
style="@android:style/Widget.ProgressBar.Horizontal"
|
style="@android:style/Widget.ProgressBar.Horizontal"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="10dp"
|
android:layout_height="10dp"
|
||||||
|
android:progressBackgroundTint="#ffffff"
|
||||||
|
android:progressTint="@color/bg_primary_blue_dark"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
android:indeterminate="true"
|
android:indeterminate="false"
|
||||||
android:indeterminateTintMode="add"/>
|
android:max="100"
|
||||||
|
android:progress="1"/>
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:id="@+id/framelayout_container"
|
android:id="@+id/framelayout_container"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
|
@ -1,5 +1,14 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<changelog>
|
<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" >
|
<release version="0.0.3" versioncode="3" >
|
||||||
<change>If Pix-art is installed then it will be launched as chat app</change>
|
<change>If Pix-art is installed then it will be launched as chat app</change>
|
||||||
<change>Download is possible</change>
|
<change>Download is possible</change>
|
||||||
|
|
Loading…
Reference in New Issue