Search in sources :

Example 51 with ProgressBar

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);
}
Also used : RelativeLayout(android.widget.RelativeLayout) ProgressBar(android.widget.ProgressBar)

Example 52 with ProgressBar

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();
            }
        }
    });
}
Also used : EditText(android.widget.EditText) GpodnetServiceException(de.danoeh.antennapod.core.gpoddernet.GpodnetServiceException) AsyncTask(android.os.AsyncTask) InputMethodManager(android.view.inputmethod.InputMethodManager) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) GpodnetServiceException(de.danoeh.antennapod.core.gpoddernet.GpodnetServiceException) GpodnetService(de.danoeh.antennapod.core.gpoddernet.GpodnetService) Button(android.widget.Button) TextView(android.widget.TextView) ProgressBar(android.widget.ProgressBar)

Example 53 with ProgressBar

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);
}
Also used : Context(android.content.Context) TextView(android.widget.TextView) ProgressBar(android.widget.ProgressBar) LinearLayout(android.widget.LinearLayout)

Example 54 with ProgressBar

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);
}
Also used : ProgressBar(android.widget.ProgressBar)

Example 55 with ProgressBar

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);
}
Also used : ProgressBar(android.widget.ProgressBar)

Aggregations

ProgressBar (android.widget.ProgressBar)193 TextView (android.widget.TextView)66 View (android.view.View)63 ImageView (android.widget.ImageView)41 LinearLayout (android.widget.LinearLayout)30 Context (android.content.Context)18 ViewGroup (android.view.ViewGroup)16 WindowManager (android.view.WindowManager)14 FrameLayout (android.widget.FrameLayout)14 Drawable (android.graphics.drawable.Drawable)13 Dialog (android.app.Dialog)12 Button (android.widget.Button)12 RelativeLayout (android.widget.RelativeLayout)12 LayoutInflater (android.view.LayoutInflater)11 SuppressLint (android.annotation.SuppressLint)10 LayoutParams (android.widget.LinearLayout.LayoutParams)9 Intent (android.content.Intent)8 LayoutParams (android.view.ViewGroup.LayoutParams)8 AlertDialog (android.app.AlertDialog)7 TypedArray (android.content.res.TypedArray)7