use of android.widget.ProgressBar in project AntennaPod by AntennaPod.
the class OnlineFeedViewActivity method setLoadingLayout.
/**
* Displays a progress indicator.
*/
private void setLoadingLayout() {
RelativeLayout rl = new RelativeLayout(this);
RelativeLayout.LayoutParams rlLayoutParams = new RelativeLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT);
ProgressBar pb = new ProgressBar(this);
pb.setIndeterminate(true);
RelativeLayout.LayoutParams pbLayoutParams = new RelativeLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
pbLayoutParams.addRule(RelativeLayout.CENTER_IN_PARENT);
rl.addView(pb, pbLayoutParams);
addContentView(rl, rlLayoutParams);
}
use of android.widget.ProgressBar in project AntennaPod by AntennaPod.
the class GpodnetAuthenticationActivity method setupLoginView.
private void setupLoginView(View view) {
final EditText username = (EditText) view.findViewById(R.id.etxtUsername);
final EditText password = (EditText) view.findViewById(R.id.etxtPassword);
final Button login = (Button) view.findViewById(R.id.butLogin);
final TextView txtvError = (TextView) view.findViewById(R.id.txtvError);
final ProgressBar progressBar = (ProgressBar) view.findViewById(R.id.progBarLogin);
password.setOnEditorActionListener((v, actionID, event) -> actionID == EditorInfo.IME_ACTION_GO && login.performClick());
login.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
final String usernameStr = username.getText().toString();
final String passwordStr = password.getText().toString();
if (BuildConfig.DEBUG)
Log.d(TAG, "Checking login credentials");
AsyncTask<GpodnetService, Void, Void> authTask = new AsyncTask<GpodnetService, Void, Void>() {
volatile Exception exception;
@Override
protected void onPreExecute() {
super.onPreExecute();
login.setEnabled(false);
progressBar.setVisibility(View.VISIBLE);
txtvError.setVisibility(View.GONE);
// hide the keyboard
InputMethodManager inputManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
inputManager.hideSoftInputFromWindow(login.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
}
@Override
protected void onPostExecute(Void aVoid) {
super.onPostExecute(aVoid);
login.setEnabled(true);
progressBar.setVisibility(View.GONE);
if (exception == null) {
advance();
} else {
txtvError.setText(exception.getCause().getMessage());
txtvError.setVisibility(View.VISIBLE);
}
}
@Override
protected Void doInBackground(GpodnetService... params) {
try {
params[0].authenticate(usernameStr, passwordStr);
GpodnetAuthenticationActivity.this.username = usernameStr;
GpodnetAuthenticationActivity.this.password = passwordStr;
} catch (GpodnetServiceException e) {
e.printStackTrace();
exception = e;
}
return null;
}
};
if (android.os.Build.VERSION.SDK_INT > android.os.Build.VERSION_CODES.GINGERBREAD_MR1) {
authTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, service);
} else {
authTask.execute();
}
}
});
}
use of android.widget.ProgressBar in project hubroid by EddieRingle.
the class IdleList method setupIdleList.
private void setupIdleList() {
Context context = getContext();
mFooterView = new LinearLayout(context);
mFooterView.setId(INTERNAL_FOOTER_ID);
mFooterView.setGravity(Gravity.CENTER);
mFooterView.setLayoutParams(new LayoutParams(MATCH_PARENT, WRAP_CONTENT));
mProgress = new ProgressBar(context, null, android.R.attr.progressBarStyle);
mProgress.setId(INTERNAL_PROGRESS_ID);
mProgress.setIndeterminate(true);
mProgress.setVisibility(View.GONE);
final LayoutParams progressLayoutParams = new LayoutParams(WRAP_CONTENT, WRAP_CONTENT);
mProgress.setLayoutParams(progressLayoutParams);
mFooterView.addView(mProgress);
mStandardEmptyView = new TextView(context);
mStandardEmptyView.setId(INTERNAL_EMPTY_ID);
mStandardEmptyView.setGravity(Gravity.CENTER);
mStandardEmptyView.setVisibility(View.GONE);
mStandardEmptyView.setPadding(10, 15, 10, 15);
mStandardEmptyView.setText("That's all, folks!");
mFooterView.addView(mStandardEmptyView, new LayoutParams(MATCH_PARENT, MATCH_PARENT));
setLayoutParams(new LayoutParams(MATCH_PARENT, WRAP_CONTENT));
setFooterDividersEnabled(true);
addFooterView(mFooterView, null, false);
setItemsCanFocus(true);
setDrawSelectorOnTop(true);
/* A tiny hack to get the ProgressBar to show */
mListShown = true;
setListShown(true);
setFooterShown(true);
}
use of android.widget.ProgressBar in project android_frameworks_base by DirtyUnicorns.
the class ActionBarView method initProgress.
public void initProgress() {
mProgressView = new ProgressBar(mContext, null, 0, mProgressStyle);
mProgressView.setId(R.id.progress_horizontal);
mProgressView.setMax(10000);
mProgressView.setVisibility(GONE);
addView(mProgressView);
}
use of android.widget.ProgressBar in project android_frameworks_base by DirtyUnicorns.
the class ActionBarView method initIndeterminateProgress.
public void initIndeterminateProgress() {
mIndeterminateProgressView = new ProgressBar(mContext, null, 0, mIndeterminateProgressStyle);
mIndeterminateProgressView.setId(R.id.progress_circular);
mIndeterminateProgressView.setVisibility(GONE);
addView(mIndeterminateProgressView);
}
Aggregations