3

I had this ProgressDialog working fine when my device was in 4.4.4 and I was not working on this app recently and device is upgraded to Lillipop mean while. I am not sure if this has caused anything to this issue but just mentioning.

Question 1. ProgressDialog shows on top left of the screen. See the attached pic. And below is the code. Also how to get transparent background ?

        progressDialog = new ProgressDialog(this, android.R.style.Theme_DeviceDefault_Light_Dialog_Alert);
    progressDialog.setTitle(title);
    progressDialog.setMessage(getResources().getString((R.string.progress_please_wait)));
    progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    progressDialog.setIndeterminate(true);
    progressDialog.setCanceledOnTouchOutside(false);
    progressDialog.getWindow().setGravity(Gravity.CENTER);
    progressDialog.show();

enter image description here

Question 2. I have gone through the material design docs and support docs. I could not find but is there any built in Material Designed ProgressDialog. Or we should depend on the libraries like https://github.com/rahatarmanahmed/CircularProgressView. ?

EDIT :
ClarkXP's answer, in fact more relevant, for another question mentioned below:
Question 3. I tried to use the material-dialogs but my gradle has thrown as error "Failed to resolve: compile com.afollestad:material-dialogs:0.8.5.1".

cgr
  • 4,578
  • 2
  • 28
  • 52

2 Answers2

1

To show progressDialogs with material design style, I use Material-Dialogs library.

Greetings

UPDATE

The app build.gradle must have the next configuration for repositories and dependencies in the same file:

  1. In Android closure:

    android {    
        compileSdkVersion 23
        buildToolsVersion "23.0.2"
        ...[your configuration]
    }
    
  2. And Repositories/Dependencies closure:

    repositories {
        maven {
            url "https://jitpack.io"
        }   
    }
    dependencies {   
        compile('com.github.afollestad.material-dialogs:core:0.8.5.1@aar'){
            transitive = true
        }
    }
    
ClarkXP
  • 1,223
  • 10
  • 23
  • Hello ClarkXP, thanks ! I tried to use it but I get "Failed to resolve ... 0.8.5.1" while gralde sync. Any clue on this ? I don't find an answer for this in github too. I tried JitPack repo too. – cgr Nov 19 '15 at 22:28
  • Can you post your app build.gradle file? – ClarkXP Nov 20 '15 at 16:11
  • When I updated my Build tools 23.0.2, I get: Error:Execution failed for task ':app:dexDebug'. > com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.7.0_75.jdk/Contents/Home/bin/java'' finished with non-zero exit value 3 I posted a question here http://stackoverflow.com/questions/32824788/processexception-when-buildtoolsversion-is-changed-from-22-0-1-to-23-0-1 long back but did not get any response: – cgr Nov 20 '15 at 16:48
  • @cgr please tell me if now works Material-Dialogs for you – ClarkXP Nov 20 '15 at 23:32
  • Hi ClarkXP, yes it worked now and +1 for answer. ;-) – cgr Nov 22 '15 at 12:03
  • I could not do that because there is the first question that is not answered yet and that was my main question. So, it may confuse people. – cgr Nov 23 '15 at 15:37
0

For 1),

This worked instead of the code in question:

mProgressDialog = ProgressDialog.show(this, title, getResources().getString((R.string.progress_please_wait)), true);  

I did not explore what difference it makes technically.

cgr
  • 4,578
  • 2
  • 28
  • 52