Example usage for android.view Window PROGRESS_START

List of usage examples for android.view Window PROGRESS_START

Introduction

In this page you can find the example usage for android.view Window PROGRESS_START.

Prototype

int PROGRESS_START

To view the source code for android.view Window PROGRESS_START.

Click Source Link

Document

Starting value for the (primary) progress.

Usage

From source file:com.andrewshu.android.reddit.reddits.PickSubredditActivity.java

private void enableLoadingScreen() {
    if (Util.isLightTheme(mSettings.getTheme())) {
        findViewById(R.id.loading_light).setVisibility(View.VISIBLE);
        findViewById(R.id.loading_dark).setVisibility(View.GONE);
    } else {/*from w  w w  .j  a v  a 2 s  . com*/
        findViewById(R.id.loading_light).setVisibility(View.GONE);
        findViewById(R.id.loading_dark).setVisibility(View.VISIBLE);
    }
    synchronized (ADAPTER_LOCK) {
        if (mSubredditsAdapter != null)
            mSubredditsAdapter.mLoading = true;
    }
    getWindow().setFeatureInt(Window.FEATURE_PROGRESS, Window.PROGRESS_START);
}

From source file:android.support.v7.app.ActionBarActivityDelegateBase.java

@Override
void setSupportProgress(int progress) {
    updateProgressBars(Window.PROGRESS_START + progress);
}

From source file:android.support.v7.app.ActionBarActivityDelegateBase.java

/**
 * Progress Bar function. Mostly extracted from PhoneWindow.java
 *//*from   w  w  w.ja va  2  s.  c o m*/
private void updateProgressBars(int value) {
    ProgressBar circularProgressBar = getCircularProgressBar();
    ProgressBar horizontalProgressBar = getHorizontalProgressBar();

    if (value == Window.PROGRESS_VISIBILITY_ON) {
        if (mFeatureProgress) {
            int level = horizontalProgressBar.getProgress();
            int visibility = (horizontalProgressBar.isIndeterminate() || level < 10000) ? View.VISIBLE
                    : View.INVISIBLE;
            horizontalProgressBar.setVisibility(visibility);
        }
        if (mFeatureIndeterminateProgress) {
            circularProgressBar.setVisibility(View.VISIBLE);
        }
    } else if (value == Window.PROGRESS_VISIBILITY_OFF) {
        if (mFeatureProgress) {
            horizontalProgressBar.setVisibility(View.GONE);
        }
        if (mFeatureIndeterminateProgress) {
            circularProgressBar.setVisibility(View.GONE);
        }
    } else if (value == Window.PROGRESS_INDETERMINATE_ON) {
        horizontalProgressBar.setIndeterminate(true);
    } else if (value == Window.PROGRESS_INDETERMINATE_OFF) {
        horizontalProgressBar.setIndeterminate(false);
    } else if (Window.PROGRESS_START <= value && value <= Window.PROGRESS_END) {
        // We want to set the progress value before testing for visibility
        // so that when the progress bar becomes visible again, it has the
        // correct level.
        horizontalProgressBar.setProgress(value - Window.PROGRESS_START);

        if (value < Window.PROGRESS_END) {
            showProgressBars(horizontalProgressBar, circularProgressBar);
        } else {
            hideProgressBars(horizontalProgressBar, circularProgressBar);
        }
    }
}

From source file:com.andrewshu.android.reddit.mail.InboxListActivity.java

private void enableLoadingScreen() {
    if (Util.isLightTheme(mSettings.getTheme())) {
        findViewById(R.id.loading_light).setVisibility(View.VISIBLE);
        findViewById(R.id.loading_dark).setVisibility(View.GONE);
    } else {/*from   w  w w .  j av  a2  s . co  m*/
        findViewById(R.id.loading_light).setVisibility(View.GONE);
        findViewById(R.id.loading_dark).setVisibility(View.VISIBLE);
    }
    synchronized (MESSAGE_ADAPTER_LOCK) {
        if (mMessagesAdapter != null)
            mMessagesAdapter.mIsLoading = true;
    }
    getWindow().setFeatureInt(Window.FEATURE_PROGRESS, Window.PROGRESS_START);
}

From source file:com.andrewshu.android.reddit.user.ProfileActivity.java

private void enableLoadingScreen() {
    if (Util.isLightTheme(mSettings.getTheme())) {
        findViewById(R.id.loading_light).setVisibility(View.VISIBLE);
        findViewById(R.id.loading_dark).setVisibility(View.GONE);
    } else {//from  www  . j  a v  a  2s .  c  o  m
        findViewById(R.id.loading_light).setVisibility(View.GONE);
        findViewById(R.id.loading_dark).setVisibility(View.VISIBLE);
    }
    synchronized (MESSAGE_ADAPTER_LOCK) {
        if (mThingsAdapter != null)
            mThingsAdapter.mIsLoading = true;
    }
    getWindow().setFeatureInt(Window.FEATURE_PROGRESS, Window.PROGRESS_START);
}

From source file:nl.sogeti.android.gpstracker.viewer.TrackList.java

@Override
public void started() {
    setProgressBarVisibility(true);
    setProgress(Window.PROGRESS_START);
}

From source file:com.fsck.k9.activity.Accounts.java

private void refresh() {
    accounts = Preferences.getPreferences(this).getAccounts();

    // see if we should show the welcome message
    //        if (accounts.length < 1) {
    //            WelcomeMessage.showWelcomeMessage(this);
    //            finish();
    //        }/*from   www  . j  av a  2s  .com*/

    List<BaseAccount> newAccounts;
    if (!K9.isHideSpecialAccounts() && accounts.length > 0) {
        if (mUnifiedInboxAccount == null || mAllMessagesAccount == null) {
            createSpecialAccounts();
        }

        newAccounts = new ArrayList<BaseAccount>(accounts.length + SPECIAL_ACCOUNTS_COUNT);
        newAccounts.add(mUnifiedInboxAccount);
        newAccounts.add(mAllMessagesAccount);
    } else {
        newAccounts = new ArrayList<BaseAccount>(accounts.length);
    }

    newAccounts.addAll(Arrays.asList(accounts));

    mAdapter = new AccountsAdapter(newAccounts.toArray(EMPTY_BASE_ACCOUNT_ARRAY));
    getListView().setAdapter(mAdapter);
    if (!newAccounts.isEmpty()) {
        mHandler.progress(Window.PROGRESS_START);
    }
    pendingWork.clear();
    mHandler.refreshTitle();

    MessagingController controller = MessagingController.getInstance(getApplication());

    for (BaseAccount account : newAccounts) {
        pendingWork.put(account, "true");

        if (account instanceof Account) {
            Account realAccount = (Account) account;
            controller.getAccountStats(this, realAccount, mListener);
        } else if (K9.countSearchMessages() && account instanceof SearchAccount) {
            final SearchAccount searchAccount = (SearchAccount) account;
            controller.getSearchAccountStats(searchAccount, mListener);
        }
    }
}

From source file:com.actionbarsherlock.internal.ActionBarSherlockCompat.java

@Override
public void setProgress(int progress) {
    if (DEBUG)//from   w w w  .  java 2 s .co  m
        Log.d(TAG, "[setProgress] progress: " + progress);

    setFeatureInt(Window.FEATURE_PROGRESS, progress + Window.PROGRESS_START);
}

From source file:com.andrewshu.android.reddit.comments.CommentsListActivity.java

void enableLoadingScreen() {
    if (Util.isLightTheme(mSettings.getTheme())) {
        findViewById(R.id.loading_light).setVisibility(View.VISIBLE);
        findViewById(R.id.loading_dark).setVisibility(View.GONE);
    } else {/*from w  ww .ja v a  2 s  .c  om*/
        findViewById(R.id.loading_light).setVisibility(View.GONE);
        findViewById(R.id.loading_dark).setVisibility(View.VISIBLE);
    }
    if (mCommentsAdapter != null)
        mCommentsAdapter.mIsLoading = true;
    getWindow().setFeatureInt(Window.FEATURE_PROGRESS, Window.PROGRESS_START);
}

From source file:com.actionbarsherlock.internal.ActionBarSherlockCompat.java

private void updateProgressBars(int value) {
    IcsProgressBar circularProgressBar = getCircularProgressBar(true);
    IcsProgressBar horizontalProgressBar = getHorizontalProgressBar(true);

    final int features = mFeatures;//getLocalFeatures();
    if (value == Window.PROGRESS_VISIBILITY_ON) {
        if ((features & (1 << Window.FEATURE_PROGRESS)) != 0) {
            int level = horizontalProgressBar.getProgress();
            int visibility = (horizontalProgressBar.isIndeterminate() || level < 10000) ? View.VISIBLE
                    : View.INVISIBLE;
            horizontalProgressBar.setVisibility(visibility);
        }/*w  ww  .ja va 2s  .c  o  m*/
        if ((features & (1 << Window.FEATURE_INDETERMINATE_PROGRESS)) != 0) {
            circularProgressBar.setVisibility(View.VISIBLE);
        }
    } else if (value == Window.PROGRESS_VISIBILITY_OFF) {
        if ((features & (1 << Window.FEATURE_PROGRESS)) != 0) {
            horizontalProgressBar.setVisibility(View.GONE);
        }
        if ((features & (1 << Window.FEATURE_INDETERMINATE_PROGRESS)) != 0) {
            circularProgressBar.setVisibility(View.GONE);
        }
    } else if (value == Window.PROGRESS_INDETERMINATE_ON) {
        horizontalProgressBar.setIndeterminate(true);
    } else if (value == Window.PROGRESS_INDETERMINATE_OFF) {
        horizontalProgressBar.setIndeterminate(false);
    } else if (Window.PROGRESS_START <= value && value <= Window.PROGRESS_END) {
        // We want to set the progress value before testing for visibility
        // so that when the progress bar becomes visible again, it has the
        // correct level.
        horizontalProgressBar.setProgress(value - Window.PROGRESS_START);

        if (value < Window.PROGRESS_END) {
            showProgressBars(horizontalProgressBar, circularProgressBar);
        } else {
            hideProgressBars(horizontalProgressBar, circularProgressBar);
        }
    } else if (Window.PROGRESS_SECONDARY_START <= value && value <= Window.PROGRESS_SECONDARY_END) {
        horizontalProgressBar.setSecondaryProgress(value - Window.PROGRESS_SECONDARY_START);

        showProgressBars(horizontalProgressBar, circularProgressBar);
    }
}