Skip to content

Commit

Permalink
show Loading ProgressBar
Browse files Browse the repository at this point in the history
  • Loading branch information
androidlover5842 committed Dec 20, 2016
1 parent 47ed77b commit 7c568b8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ public class BootReceiver extends BroadcastReceiver {
private static final String TAG = "UpdateCheckReceiver";
@Override
public void onReceive(Context context, Intent intent) {
Intent startServiceIntent = new Intent(context, CheckUpdate.class);
context.startService(startServiceIntent);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean bootCheckCompleted = prefs.getBoolean(Constants.BOOT_CHECK_COMPLETED, false);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import android.support.v4.app.ActivityCompat;
import android.util.Log;
import android.view.View;
import android.widget.ProgressBar;

import com.eminayar.panter.PanterDialog;
import com.eminayar.panter.enums.Animation;
Expand All @@ -24,10 +25,12 @@
public class MainActivity extends Activity {
private PanterDialog UpdaterDialog;
private DownloadManager downloadManager;
private ProgressBar mProgressBar;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mProgressBar=(ProgressBar)findViewById(R.id.progressBar);
ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, 100);
RomUpdaterUtils romUpdaterUtils = new RomUpdaterUtils(this)
.setUpdateFrom(UpdateFrom.XML)
Expand All @@ -42,6 +45,7 @@ public void onSuccess(final Update update, Boolean isUpdateAvailable) {
}
if(isUpdateAvailable==true)
{
mProgressBar.setVisibility(View.GONE);
UpdaterDialog = new PanterDialog(MainActivity.this);
UpdaterDialog= new PanterDialog(MainActivity.this);
UpdaterDialog.setTitle("Update Found")
Expand Down
7 changes: 7 additions & 0 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,11 @@
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="io.github.otaupdater.otaupdater.MainActivity">

<ProgressBar
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true"
android:id="@+id/progressBar" />
</RelativeLayout>

0 comments on commit 7c568b8

Please sign in to comment.