Example usage for android.app ProgressDialog ProgressDialog

List of usage examples for android.app ProgressDialog ProgressDialog

Introduction

In this page you can find the example usage for android.app ProgressDialog ProgressDialog.

Prototype

public ProgressDialog(Context context) 

Source Link

Document

Creates a Progress dialog.

Usage

From source file:com.dedipower.portal.android.CreateTicket.java

public void onCreate(Bundle savedInstanceState) {
    API.SessionID = getIntent().getStringExtra("sessionid");
    dialog = new ProgressDialog(this);
    dialog.setMessage("Loading...");

    super.onCreate(savedInstanceState);
    setContentView(R.layout.createticket);

    final Handler handler = new Handler() {
        public void handleMessage(Message msg) {
            dialog.dismiss();/*from  ww  w . j  a va  2 s . c  o m*/
            if (TicketID == 0) {
                Toast.makeText(CreateTicket.this,
                        "Ticket Creation Failed. Please try again later or email request@dedipower.com",
                        Toast.LENGTH_LONG).show();
            } else {
                Toast.makeText(CreateTicket.this, "Ticket Created! Returning to main screen...",
                        Toast.LENGTH_SHORT).show();
                finish();
            }
        }
    };

    final Thread submitTicket = new Thread() {
        public void run() {
            try {
                TicketID = API.CreateTicket(Subject, Message);
            } catch (JSONException e) {
                TicketID = 0;
            }

            handler.sendEmptyMessage(0);
        }
    };

    Button CreateTicketButton = (Button) findViewById(R.id.CreateTicketButton);
    CreateTicketButton.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            dialog.show();
            EditText SubjectET = (EditText) findViewById(R.id.Subject);
            EditText MessageET = (EditText) findViewById(R.id.Message);
            Subject = SubjectET.getText().toString();
            Message = MessageET.getText().toString();

            submitTicket.start();
            /*EditText Subject = (EditText) findViewById(R.id.Subject);
            EditText Message = (EditText) findViewById(R.id.Message);
                    
            try 
            {
            TicketID = API.CreateTicket(Subject.getText().toString() , Message.getText().toString());
            } 
            catch (JSONException e) 
            {
               Toast.makeText(CreateTicket.this, "Ticket Creation Failed. Please try again later or email request@dedipower.com", Toast.LENGTH_LONG).show();
            }
                    
                    
            if(TicketID == 0)
            {
               Toast.makeText(CreateTicket.this, "Ticket Creation Failed. Please try again later or email request@dedipower.com", Toast.LENGTH_LONG).show();
            }
            else
            {
               Toast.makeText(CreateTicket.this, "Ticket Created! Returning to main screen...", Toast.LENGTH_SHORT).show();
               finish();
            }*/
        }
    });
}

From source file:com.dedipower.portal.android.AddTicketReply.java

public void onCreate(Bundle savedInstanceState) {
    API.SessionID = getIntent().getStringExtra("sessionid");
    ticketid = getIntent().getStringExtra("ticketid");
    dialog = new ProgressDialog(this);
    dialog.setMessage("Loading...");

    super.onCreate(savedInstanceState);
    setContentView(R.layout.addticketreply);

    final Handler handler = new Handler() {
        public void handleMessage(Message msg) {
            dialog.dismiss();//  ww w  .j av a 2s  .co  m
            if (TicketID == 0) {
                Toast.makeText(AddTicketReply.this,
                        "Ticket Reply Failed. Please try again later or email request@dedipower.com",
                        Toast.LENGTH_LONG).show();
            } else {
                Toast.makeText(AddTicketReply.this, "Reply added! Returning to main screen...",
                        Toast.LENGTH_SHORT).show();
                finish();
            }
        }
    };

    final Thread submitReply = new Thread() {
        public void run() {
            try {
                TicketID = API.ReplyToTicket(ticketid, Message);
            } catch (JSONException e) {
                TicketID = 0;
            }

            handler.sendEmptyMessage(0);
        }
    };

    Button AddReplyButton = (Button) findViewById(R.id.AddReplyButton);
    AddReplyButton.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            dialog.show();
            EditText MessageET = (EditText) findViewById(R.id.Message);
            Message = MessageET.getText().toString();

            submitReply.start();
        }
    });
}

From source file:net.networksaremadeofstring.pulsant.portal.CreateTicket.java

public void onCreate(Bundle savedInstanceState) {
    API.SessionID = getIntent().getStringExtra("sessionid");
    dialog = new ProgressDialog(this);
    dialog.setMessage("Loading...");

    super.onCreate(savedInstanceState);
    setContentView(R.layout.createticket);

    final Handler handler = new Handler() {
        public void handleMessage(Message msg) {
            dialog.dismiss();//from w  ww.java2s .  co m
            if (TicketID == 0) {
                Toast.makeText(CreateTicket.this,
                        "Ticket Creation Failed. Please try again later or email request@Pulsant.com",
                        Toast.LENGTH_LONG).show();
            } else {
                Toast.makeText(CreateTicket.this, "Ticket Created! Returning to main screen...",
                        Toast.LENGTH_SHORT).show();
                finish();
            }
        }
    };

    final Thread submitTicket = new Thread() {
        public void run() {
            try {
                TicketID = API.CreateTicket(Subject, Message);
            } catch (JSONException e) {
                TicketID = 0;
            }

            handler.sendEmptyMessage(0);
        }
    };

    Button CreateTicketButton = (Button) findViewById(R.id.CreateTicketButton);
    CreateTicketButton.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            dialog.show();
            EditText SubjectET = (EditText) findViewById(R.id.Subject);
            EditText MessageET = (EditText) findViewById(R.id.Message);
            Subject = SubjectET.getText().toString();
            Message = MessageET.getText().toString();

            submitTicket.start();
            /*EditText Subject = (EditText) findViewById(R.id.Subject);
            EditText Message = (EditText) findViewById(R.id.Message);
                    
            try 
            {
            TicketID = API.CreateTicket(Subject.getText().toString() , Message.getText().toString());
            } 
            catch (JSONException e) 
            {
               Toast.makeText(CreateTicket.this, "Ticket Creation Failed. Please try again later or email request@Pulsant.com", Toast.LENGTH_LONG).show();
            }
                    
                    
            if(TicketID == 0)
            {
               Toast.makeText(CreateTicket.this, "Ticket Creation Failed. Please try again later or email request@Pulsant.com", Toast.LENGTH_LONG).show();
            }
            else
            {
               Toast.makeText(CreateTicket.this, "Ticket Created! Returning to main screen...", Toast.LENGTH_SHORT).show();
               finish();
            }*/
        }
    });
}

From source file:net.networksaremadeofstring.pulsant.portal.AddTicketReply.java

public void onCreate(Bundle savedInstanceState) {
    API.SessionID = getIntent().getStringExtra("sessionid");
    ticketid = getIntent().getStringExtra("ticketid");
    dialog = new ProgressDialog(this);
    dialog.setMessage("Loading...");

    super.onCreate(savedInstanceState);
    setContentView(R.layout.addticketreply);

    final Handler handler = new Handler() {
        public void handleMessage(Message msg) {
            dialog.dismiss();/*ww w.jav  a 2 s.  c  o m*/
            if (TicketID == 0) {
                Toast.makeText(AddTicketReply.this,
                        "Ticket Reply Failed. Please try again later or email request@Pulsant.com",
                        Toast.LENGTH_LONG).show();
            } else {
                Toast.makeText(AddTicketReply.this, "Reply added! Returning to main screen...",
                        Toast.LENGTH_SHORT).show();
                finish();
            }
        }
    };

    final Thread submitReply = new Thread() {
        public void run() {
            try {
                TicketID = API.ReplyToTicket(ticketid, Message);
            } catch (JSONException e) {
                TicketID = 0;
            }

            handler.sendEmptyMessage(0);
        }
    };

    Button AddReplyButton = (Button) findViewById(R.id.AddReplyButton);
    AddReplyButton.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            dialog.show();
            EditText MessageET = (EditText) findViewById(R.id.Message);
            Message = MessageET.getText().toString();

            submitReply.start();
        }
    });
}

From source file:com.ilearnrw.reader.tasks.UserDetailsTask.java

@Override
protected void onPreExecute() {
    dialog = new ProgressDialog(context);
    dialog.setTitle(context.getString(R.string.dialog_fetch_user_title));
    dialog.setMessage(context.getString(R.string.dialog_fetch_user_message));
    dialog.setCancelable(true);/*from   w  w  w  .j a  v a  2  s  .com*/
    dialog.setCanceledOnTouchOutside(false);
    dialog.setButton(DialogInterface.BUTTON_NEGATIVE, context.getString(android.R.string.cancel),
            new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    cancel(true);
                    dialog.dismiss();
                }
            });
    dialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
        @Override
        public void onCancel(DialogInterface dialog) {
            cancel(true);
            dialog.dismiss();
        }
    });
    dialog.show();
    super.onPreExecute();
}

From source file:com.aniruddhc.acemusic.player.AsyncTasks.AsyncDeleteTask.java

protected void onPreExecute() {
    pd = new ProgressDialog(mContext);
    pd.setCancelable(false);// w  ww.  j a va 2s .c  om
    pd.setIndeterminate(false);
    pd.setTitle(R.string.delete);
    pd.setMessage(mContext.getResources().getString(R.string.deleting_files));
    pd.setButton(DialogInterface.BUTTON_NEUTRAL, mContext.getResources().getString(R.string.run_in_background),
            new OnClickListener() {

                @Override
                public void onClick(DialogInterface arg0, int arg1) {
                    pd.dismiss();

                }

            });

    pd.show();

}

From source file:com.paramedic.mobshaman.activities.ActualizarInformacionActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getSupportActionBar().setHomeButtonEnabled(true);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    setContentView(R.layout.activity_actualizar_informacion);

    configuration = Configuration.getInstance(this);

    pDialog = new ProgressDialog(this);
    pDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);

    btnActualizarDiagnosticos = (Button) findViewById(R.id.btn_actualizar_diagnosticos);
    btnActualizarMotivos = (Button) findViewById(R.id.btn_actualizar_motivos_no_realizacion);
    btnLogout = (Button) findViewById(R.id.btn_logout);
    tvVersion = (TextView) findViewById(R.id.tv_version_system);
    session = new SessionManager(getApplicationContext());

    String URL_DIAGNOSTICOS = configuration.getUrl() + "/api/diagnosis?licencia=" + configuration.getLicense();
    String URL_MOTIVOS = configuration.getUrl() + "/api/reasons?licencia=" + configuration.getLicense();

    setButtonsForDownloadInformation(btnActualizarDiagnosticos, "Cargando Diagnsticos...", URL_DIAGNOSTICOS,
            "diagnosticos", "Los diagnsticos han sido actualizados");

    setButtonsForDownloadInformation(btnActualizarMotivos, "Cargando Motivos...", URL_MOTIVOS, "motivos",
            "Los motivos han sido actualizados");
    try {//www .  j a v  a2s.co m
        String versionName = getPackageManager().getPackageInfo(this.getPackageName(), 0).versionName;
        tvVersion.setText("Versin del sistema: " + versionName);

        btnLogout.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                session.logoutUser();
            }
        });

    } catch (Exception exception) {
        //No se encontro la version
    }

}

From source file:com.paramedic.mobshaman.activities.LoginActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_login);

    // Session Manager
    session = new SessionManager(getApplicationContext());
    configuration = configuration.getInstance(this);

    /** Muestro un dialogo spinner (no dejo que usuario use UI) **/
    progressDialog = new ProgressDialog(this);
    progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    progressDialog.setCancelable(true);/*from ww w  . j a  v  a  2s.c  om*/

    // Email, Password input text
    txtUsername = (EditText) findViewById(R.id.txtUsername);
    txtPassword = (EditText) findViewById(R.id.txtPassword);
    btnLogin = (Button) findViewById(R.id.btnLogin);
    btnLogin.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View arg0) {
            login();
        }
    });
}

From source file:ru.orangesoftware.financisto2.export.flowzr.FlowzrSyncTask.java

public FlowzrSyncTask(FlowzrSyncActivity flowzrSyncActivity, FlowzrSyncEngine _flowzrSyncEngine,
        FlowzrSyncOptions options, DefaultHttpClient pHttp_client) {
    this.options = options;
    this.http_client = pHttp_client;
    this.context = flowzrSyncActivity;
    this.flowzrSyncActivity = flowzrSyncActivity;
    this.flowzrSync = _flowzrSyncEngine;
    mProgress = new ProgressDialog(this.flowzrSyncActivity);
    mProgress.setIcon(R.drawable.icon);//from  ww  w  . j a v  a2s. co  m
    mProgress.setTitle(flowzrSyncActivity.getString(R.string.flowzr_sync));
    mProgress.setMessage(flowzrSyncActivity.getString(R.string.flowzr_sync_inprogress));
    mProgress.setCancelable(true);
    mProgress.setCanceledOnTouchOutside(false);
    mProgress.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
    try {
        mProgress.show();
    } catch (Exception e) {
        Log.e(TAG, "avoid a leaked window");
    }

}

From source file:com.aniruddhc.acemusic.player.AsyncTasks.AsyncCopyMoveTask.java

protected void onPreExecute() {
    pd = new ProgressDialog(mFragment.getActivity());
    pd.setCancelable(false);/*from w  w  w.  j a  va  2  s  .c  o  m*/
    pd.setIndeterminate(false);

    if (mShouldMove) {
        pd.setTitle(R.string.move);
        pd.setMessage(mContext.getResources().getString(R.string.moving_file));
    } else {
        pd.setTitle(R.string.copy);
        pd.setMessage(mContext.getResources().getString(R.string.copying_file));
    }

    pd.setButton(DialogInterface.BUTTON_NEUTRAL, mContext.getResources().getString(R.string.run_in_background),
            new OnClickListener() {

                @Override
                public void onClick(DialogInterface arg0, int arg1) {
                    pd.dismiss();

                }

            });

    pd.show();

}