com.actionbarsherlock.internal.widget.IcsProgressBar Java Examples

The following examples show how to use com.actionbarsherlock.internal.widget.IcsProgressBar. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ActionBarSherlockCompat.java    From CSipSimple with GNU General Public License v3.0 5 votes vote down vote up
private void showProgressBars(IcsProgressBar horizontalProgressBar, IcsProgressBar spinnyProgressBar) {
    final int features = mFeatures;//getLocalFeatures();
    if ((features & (1 << Window.FEATURE_INDETERMINATE_PROGRESS)) != 0 &&
            spinnyProgressBar.getVisibility() == View.INVISIBLE) {
        spinnyProgressBar.setVisibility(View.VISIBLE);
    }
    // Only show the progress bars if the primary progress is not complete
    if ((features & (1 << Window.FEATURE_PROGRESS)) != 0 &&
            horizontalProgressBar.getProgress() < 10000) {
        horizontalProgressBar.setVisibility(View.VISIBLE);
    }
}
 
Example #2
Source File: ActionBarSherlockCompat.java    From Libraries-for-Android-Developers with MIT License 5 votes vote down vote up
private void hideProgressBars(IcsProgressBar horizontalProgressBar, IcsProgressBar spinnyProgressBar) {
    final int features = mFeatures;//getLocalFeatures();
    Animation anim = AnimationUtils.loadAnimation(mActivity, android.R.anim.fade_out);
    anim.setDuration(1000);
    if ((features & (1 << Window.FEATURE_INDETERMINATE_PROGRESS)) != 0 &&
            spinnyProgressBar.getVisibility() == View.VISIBLE) {
        spinnyProgressBar.startAnimation(anim);
        spinnyProgressBar.setVisibility(View.INVISIBLE);
    }
    if ((features & (1 << Window.FEATURE_PROGRESS)) != 0 &&
            horizontalProgressBar.getVisibility() == View.VISIBLE) {
        horizontalProgressBar.startAnimation(anim);
        horizontalProgressBar.setVisibility(View.INVISIBLE);
    }
}
 
Example #3
Source File: ActionBarSherlockCompat.java    From Libraries-for-Android-Developers with MIT License 5 votes vote down vote up
private void showProgressBars(IcsProgressBar horizontalProgressBar, IcsProgressBar spinnyProgressBar) {
    final int features = mFeatures;//getLocalFeatures();
    if ((features & (1 << Window.FEATURE_INDETERMINATE_PROGRESS)) != 0 &&
            spinnyProgressBar.getVisibility() == View.INVISIBLE) {
        spinnyProgressBar.setVisibility(View.VISIBLE);
    }
    // Only show the progress bars if the primary progress is not complete
    if ((features & (1 << Window.FEATURE_PROGRESS)) != 0 &&
            horizontalProgressBar.getProgress() < 10000) {
        horizontalProgressBar.setVisibility(View.VISIBLE);
    }
}
 
Example #4
Source File: ActionBarSherlockCompat.java    From zhangshangwuda with Apache License 2.0 5 votes vote down vote up
private void hideProgressBars(IcsProgressBar horizontalProgressBar, IcsProgressBar spinnyProgressBar) {
    final int features = mFeatures;//getLocalFeatures();
    Animation anim = AnimationUtils.loadAnimation(mActivity, android.R.anim.fade_out);
    anim.setDuration(1000);
    if ((features & (1 << Window.FEATURE_INDETERMINATE_PROGRESS)) != 0 &&
            spinnyProgressBar.getVisibility() == View.VISIBLE) {
        spinnyProgressBar.startAnimation(anim);
        spinnyProgressBar.setVisibility(View.INVISIBLE);
    }
    if ((features & (1 << Window.FEATURE_PROGRESS)) != 0 &&
            horizontalProgressBar.getVisibility() == View.VISIBLE) {
        horizontalProgressBar.startAnimation(anim);
        horizontalProgressBar.setVisibility(View.INVISIBLE);
    }
}
 
Example #5
Source File: ActionBarSherlockCompat.java    From zhangshangwuda with Apache License 2.0 5 votes vote down vote up
private void showProgressBars(IcsProgressBar horizontalProgressBar, IcsProgressBar spinnyProgressBar) {
    final int features = mFeatures;//getLocalFeatures();
    if ((features & (1 << Window.FEATURE_INDETERMINATE_PROGRESS)) != 0 &&
            spinnyProgressBar.getVisibility() == View.INVISIBLE) {
        spinnyProgressBar.setVisibility(View.VISIBLE);
    }
    // Only show the progress bars if the primary progress is not complete
    if ((features & (1 << Window.FEATURE_PROGRESS)) != 0 &&
            horizontalProgressBar.getProgress() < 10000) {
        horizontalProgressBar.setVisibility(View.VISIBLE);
    }
}
 
Example #6
Source File: ActionBarSherlockCompat.java    From zen4android with MIT License 5 votes vote down vote up
private void hideProgressBars(IcsProgressBar horizontalProgressBar, IcsProgressBar spinnyProgressBar) {
    final int features = mFeatures;//getLocalFeatures();
    Animation anim = AnimationUtils.loadAnimation(mActivity, android.R.anim.fade_out);
    anim.setDuration(1000);
    if ((features & (1 << Window.FEATURE_INDETERMINATE_PROGRESS)) != 0 &&
            spinnyProgressBar.getVisibility() == View.VISIBLE) {
        spinnyProgressBar.startAnimation(anim);
        spinnyProgressBar.setVisibility(View.INVISIBLE);
    }
    if ((features & (1 << Window.FEATURE_PROGRESS)) != 0 &&
            horizontalProgressBar.getVisibility() == View.VISIBLE) {
        horizontalProgressBar.startAnimation(anim);
        horizontalProgressBar.setVisibility(View.INVISIBLE);
    }
}
 
Example #7
Source File: ActionBarSherlockCompat.java    From zen4android with MIT License 5 votes vote down vote up
private void showProgressBars(IcsProgressBar horizontalProgressBar, IcsProgressBar spinnyProgressBar) {
    final int features = mFeatures;//getLocalFeatures();
    if ((features & (1 << Window.FEATURE_INDETERMINATE_PROGRESS)) != 0 &&
            spinnyProgressBar.getVisibility() == View.INVISIBLE) {
        spinnyProgressBar.setVisibility(View.VISIBLE);
    }
    // Only show the progress bars if the primary progress is not complete
    if ((features & (1 << Window.FEATURE_PROGRESS)) != 0 &&
            horizontalProgressBar.getProgress() < 10000) {
        horizontalProgressBar.setVisibility(View.VISIBLE);
    }
}
 
Example #8
Source File: ActionBarSherlockCompat.java    From android-apps with MIT License 5 votes vote down vote up
private void hideProgressBars(IcsProgressBar horizontalProgressBar, IcsProgressBar spinnyProgressBar) {
    final int features = mFeatures;//getLocalFeatures();
    Animation anim = AnimationUtils.loadAnimation(mActivity, android.R.anim.fade_out);
    anim.setDuration(1000);
    if ((features & (1 << Window.FEATURE_INDETERMINATE_PROGRESS)) != 0 &&
            spinnyProgressBar.getVisibility() == View.VISIBLE) {
        spinnyProgressBar.startAnimation(anim);
        spinnyProgressBar.setVisibility(View.INVISIBLE);
    }
    if ((features & (1 << Window.FEATURE_PROGRESS)) != 0 &&
            horizontalProgressBar.getVisibility() == View.VISIBLE) {
        horizontalProgressBar.startAnimation(anim);
        horizontalProgressBar.setVisibility(View.INVISIBLE);
    }
}
 
Example #9
Source File: ActionBarSherlockCompat.java    From android-apps with MIT License 5 votes vote down vote up
private void showProgressBars(IcsProgressBar horizontalProgressBar, IcsProgressBar spinnyProgressBar) {
    final int features = mFeatures;//getLocalFeatures();
    if ((features & (1 << Window.FEATURE_INDETERMINATE_PROGRESS)) != 0 &&
            spinnyProgressBar.getVisibility() == View.INVISIBLE) {
        spinnyProgressBar.setVisibility(View.VISIBLE);
    }
    // Only show the progress bars if the primary progress is not complete
    if ((features & (1 << Window.FEATURE_PROGRESS)) != 0 &&
            horizontalProgressBar.getProgress() < 10000) {
        horizontalProgressBar.setVisibility(View.VISIBLE);
    }
}
 
Example #10
Source File: ActionBarSherlockCompat.java    From CSipSimple with GNU General Public License v3.0 5 votes vote down vote up
private void hideProgressBars(IcsProgressBar horizontalProgressBar, IcsProgressBar spinnyProgressBar) {
    final int features = mFeatures;//getLocalFeatures();
    Animation anim = AnimationUtils.loadAnimation(mActivity, android.R.anim.fade_out);
    anim.setDuration(1000);
    if ((features & (1 << Window.FEATURE_INDETERMINATE_PROGRESS)) != 0 &&
            spinnyProgressBar.getVisibility() == View.VISIBLE) {
        spinnyProgressBar.startAnimation(anim);
        spinnyProgressBar.setVisibility(View.INVISIBLE);
    }
    if ((features & (1 << Window.FEATURE_PROGRESS)) != 0 &&
            horizontalProgressBar.getVisibility() == View.VISIBLE) {
        horizontalProgressBar.startAnimation(anim);
        horizontalProgressBar.setVisibility(View.INVISIBLE);
    }
}
 
Example #11
Source File: ActionBarSherlockCompat.java    From android-apps with MIT License 4 votes vote down vote up
private ViewGroup generateLayout() {
    if (DEBUG) Log.d(TAG, "[generateLayout]");

    // Apply data from current theme.

    TypedArray a = mActivity.getTheme().obtainStyledAttributes(R.styleable.SherlockTheme);

    mIsFloating = a.getBoolean(R.styleable.SherlockTheme_android_windowIsFloating, false);

    if (!a.hasValue(R.styleable.SherlockTheme_windowActionBar)) {
        throw new IllegalStateException("You must use Theme.Sherlock, Theme.Sherlock.Light, Theme.Sherlock.Light.DarkActionBar, or a derivative.");
    }

    if (a.getBoolean(R.styleable.SherlockTheme_windowNoTitle, false)) {
        requestFeature(Window.FEATURE_NO_TITLE);
    } else if (a.getBoolean(R.styleable.SherlockTheme_windowActionBar, false)) {
        // Don't allow an action bar if there is no title.
        requestFeature(Window.FEATURE_ACTION_BAR);
    }

    if (a.getBoolean(R.styleable.SherlockTheme_windowActionBarOverlay, false)) {
        requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
    }

    if (a.getBoolean(R.styleable.SherlockTheme_windowActionModeOverlay, false)) {
        requestFeature(Window.FEATURE_ACTION_MODE_OVERLAY);
    }

    a.recycle();

    int layoutResource;
    if (!hasFeature(Window.FEATURE_NO_TITLE)) {
        if (mIsFloating) {
            //Trash original dialog LinearLayout
            mDecor = (ViewGroup)mDecor.getParent();
            mDecor.removeAllViews();

            layoutResource = R.layout.abs__dialog_title_holo;
        } else {
            if (hasFeature(Window.FEATURE_ACTION_BAR_OVERLAY)) {
                layoutResource = R.layout.abs__screen_action_bar_overlay;
            } else {
                layoutResource = R.layout.abs__screen_action_bar;
            }
        }
    } else if (hasFeature(Window.FEATURE_ACTION_MODE_OVERLAY) && !hasFeature(Window.FEATURE_NO_TITLE)) {
        layoutResource = R.layout.abs__screen_simple_overlay_action_mode;
    } else {
        layoutResource = R.layout.abs__screen_simple;
    }

    if (DEBUG) Log.d(TAG, "[generateLayout] using screen XML " + mActivity.getResources().getString(layoutResource));
    View in = mActivity.getLayoutInflater().inflate(layoutResource, null);
    mDecor.addView(in, new ViewGroup.LayoutParams(MATCH_PARENT, MATCH_PARENT));

    ViewGroup contentParent = (ViewGroup)mDecor.findViewById(R.id.abs__content);
    if (contentParent == null) {
        throw new RuntimeException("Couldn't find content container view");
    }

    //Make our new child the true content view (for fragments). VERY VOLATILE!
    mDecor.setId(View.NO_ID);
    contentParent.setId(android.R.id.content);

    if (hasFeature(Window.FEATURE_INDETERMINATE_PROGRESS)) {
        IcsProgressBar progress = getCircularProgressBar(false);
        if (progress != null) {
            progress.setIndeterminate(true);
        }
    }

    return contentParent;
}
 
Example #12
Source File: ActionBarSherlockCompat.java    From zen4android with MIT License 4 votes vote down vote up
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);
        }
        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);
    }
}
 
Example #13
Source File: ActionBarSherlockCompat.java    From zen4android with MIT License 4 votes vote down vote up
private ViewGroup generateLayout() {
    if (ActionBarSherlock.DEBUG) Log.d(TAG, "[generateLayout]");

    // Apply data from current theme.

    TypedArray a = mActivity.getTheme().obtainStyledAttributes(R.styleable.SherlockTheme);

    if (!a.hasValue(R.styleable.SherlockTheme_windowActionBar)) {
        throw new IllegalStateException("You must use Theme.Sherlock, Theme.Sherlock.Light, Theme.Sherlock.Light.DarkActionBar, or a derivative.");
    }

    if (a.getBoolean(R.styleable.SherlockTheme_windowNoTitle, false)) {
        requestFeature(Window.FEATURE_NO_TITLE);
    } else if (a.getBoolean(R.styleable.SherlockTheme_windowActionBar, false)) {
        // Don't allow an action bar if there is no title.
        requestFeature(Window.FEATURE_ACTION_BAR);
    }

    if (a.getBoolean(R.styleable.SherlockTheme_windowActionBarOverlay, false)) {
        requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
    }

    if (a.getBoolean(R.styleable.SherlockTheme_windowActionModeOverlay, false)) {
        requestFeature(Window.FEATURE_ACTION_MODE_OVERLAY);
    }

    a.recycle();

    int layoutResource;
    if (!hasFeature(Window.FEATURE_NO_TITLE)) {
        if (hasFeature(Window.FEATURE_ACTION_BAR_OVERLAY)) {
            layoutResource = R.layout.abs__screen_action_bar_overlay;
        } else {
            layoutResource = R.layout.abs__screen_action_bar;
        }
    } else if (hasFeature(Window.FEATURE_ACTION_MODE_OVERLAY) && !hasFeature(Window.FEATURE_NO_TITLE)) {
        layoutResource = R.layout.abs__screen_simple_overlay_action_mode;
    } else {
        layoutResource = R.layout.abs__screen_simple;
    }

    if (ActionBarSherlock.DEBUG) Log.d(TAG, "[generateLayout] using screen XML " + mActivity.getResources().getString(layoutResource));
    View in = mActivity.getLayoutInflater().inflate(layoutResource, null);
    mDecor.addView(in, new ViewGroup.LayoutParams(MATCH_PARENT, MATCH_PARENT));

    ViewGroup contentParent = (ViewGroup)mDecor.findViewById(R.id.abs__content);
    if (contentParent == null) {
        throw new RuntimeException("Couldn't find content container view");
    }

    //Make our new child the true content view (for fragments). VERY VOLATILE!
    mDecor.setId(View.NO_ID);
    contentParent.setId(android.R.id.content);

    if (hasFeature(Window.FEATURE_INDETERMINATE_PROGRESS)) {
        IcsProgressBar progress = getCircularProgressBar(false);
        if (progress != null) {
            progress.setIndeterminate(true);
        }
    }

    return contentParent;
}
 
Example #14
Source File: ActionBarSherlockCompat.java    From zhangshangwuda with Apache License 2.0 4 votes vote down vote up
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);
        }
        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);
    }
}
 
Example #15
Source File: ActionBarSherlockCompat.java    From android-apps with MIT License 4 votes vote down vote up
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);
        }
        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);
    }
}
 
Example #16
Source File: ActionBarSherlockCompat.java    From CSipSimple with GNU General Public License v3.0 4 votes vote down vote up
private ViewGroup generateLayout() {
    if (ActionBarSherlock.DEBUG) Log.d(TAG, "[generateLayout]");

    // Apply data from current theme.

    TypedArray a = mActivity.getTheme().obtainStyledAttributes(R.styleable.SherlockTheme);

    if (!a.hasValue(R.styleable.SherlockTheme_windowActionBar)) {
        throw new IllegalStateException("You must use Theme.Sherlock, Theme.Sherlock.Light, Theme.Sherlock.Light.DarkActionBar, or a derivative.");
    }

    if (a.getBoolean(R.styleable.SherlockTheme_windowNoTitle, false)) {
        requestFeature(Window.FEATURE_NO_TITLE);
    } else if (a.getBoolean(R.styleable.SherlockTheme_windowActionBar, false)) {
        // Don't allow an action bar if there is no title.
        requestFeature(Window.FEATURE_ACTION_BAR);
    }

    if (a.getBoolean(R.styleable.SherlockTheme_windowActionBarOverlay, false)) {
        requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
    }

    if (a.getBoolean(R.styleable.SherlockTheme_windowActionModeOverlay, false)) {
        requestFeature(Window.FEATURE_ACTION_MODE_OVERLAY);
    }

    a.recycle();

    int layoutResource;
    if (!hasFeature(Window.FEATURE_NO_TITLE)) {
        if (hasFeature(Window.FEATURE_ACTION_BAR_OVERLAY)) {
            layoutResource = R.layout.abs__screen_action_bar_overlay;
        } else {
            layoutResource = R.layout.abs__screen_action_bar;
        }
    } else if (hasFeature(Window.FEATURE_ACTION_MODE_OVERLAY) && !hasFeature(Window.FEATURE_NO_TITLE)) {
        layoutResource = R.layout.abs__screen_simple_overlay_action_mode;
    } else {
        layoutResource = R.layout.abs__screen_simple;
    }

    if (ActionBarSherlock.DEBUG) Log.d(TAG, "[generateLayout] using screen XML " + mActivity.getResources().getString(layoutResource));
    View in = mActivity.getLayoutInflater().inflate(layoutResource, null);
    mDecor.addView(in, new ViewGroup.LayoutParams(MATCH_PARENT, MATCH_PARENT));

    ViewGroup contentParent = (ViewGroup)mDecor.findViewById(R.id.abs__content);
    if (contentParent == null) {
        throw new RuntimeException("Couldn't find content container view");
    }

    //Make our new child the true content view (for fragments). VERY VOLATILE!
    mDecor.setId(View.NO_ID);
    contentParent.setId(android.R.id.content);

    if (hasFeature(Window.FEATURE_INDETERMINATE_PROGRESS)) {
        IcsProgressBar progress = getCircularProgressBar(false);
        if (progress != null) {
            progress.setIndeterminate(true);
        }
    }

    return contentParent;
}
 
Example #17
Source File: ActionBarSherlockCompat.java    From zhangshangwuda with Apache License 2.0 4 votes vote down vote up
private ViewGroup generateLayout() {
    if (ActionBarSherlock.DEBUG) Log.d(TAG, "[generateLayout]");

    // Apply data from current theme.

    TypedArray a = mActivity.getTheme().obtainStyledAttributes(R.styleable.SherlockTheme);

    if (!a.hasValue(R.styleable.SherlockTheme_windowActionBar)) {
        throw new IllegalStateException("You must use Theme.Sherlock, Theme.Sherlock.Light, Theme.Sherlock.Light.DarkActionBar, or a derivative.");
    }

    if (a.getBoolean(R.styleable.SherlockTheme_windowNoTitle, false)) {
        requestFeature(Window.FEATURE_NO_TITLE);
    } else if (a.getBoolean(R.styleable.SherlockTheme_windowActionBar, false)) {
        // Don't allow an action bar if there is no title.
        requestFeature(Window.FEATURE_ACTION_BAR);
    }

    if (a.getBoolean(R.styleable.SherlockTheme_windowActionBarOverlay, false)) {
        requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
    }

    if (a.getBoolean(R.styleable.SherlockTheme_windowActionModeOverlay, false)) {
        requestFeature(Window.FEATURE_ACTION_MODE_OVERLAY);
    }

    a.recycle();

    int layoutResource;
    if (!hasFeature(Window.FEATURE_NO_TITLE)) {
        if (hasFeature(Window.FEATURE_ACTION_BAR_OVERLAY)) {
            layoutResource = R.layout.abs__screen_action_bar_overlay;
        } else {
            layoutResource = R.layout.abs__screen_action_bar;
        }
    } else if (hasFeature(Window.FEATURE_ACTION_MODE_OVERLAY) && !hasFeature(Window.FEATURE_NO_TITLE)) {
        layoutResource = R.layout.abs__screen_simple_overlay_action_mode;
    } else {
        layoutResource = R.layout.abs__screen_simple;
    }

    if (ActionBarSherlock.DEBUG) Log.d(TAG, "[generateLayout] using screen XML " + mActivity.getResources().getString(layoutResource));
    View in = mActivity.getLayoutInflater().inflate(layoutResource, null);
    mDecor.addView(in, new ViewGroup.LayoutParams(MATCH_PARENT, MATCH_PARENT));

    ViewGroup contentParent = (ViewGroup)mDecor.findViewById(R.id.abs__content);
    if (contentParent == null) {
        throw new RuntimeException("Couldn't find content container view");
    }

    //Make our new child the true content view (for fragments). VERY VOLATILE!
    mDecor.setId(View.NO_ID);
    contentParent.setId(android.R.id.content);

    if (hasFeature(Window.FEATURE_INDETERMINATE_PROGRESS)) {
        IcsProgressBar progress = getCircularProgressBar(false);
        if (progress != null) {
            progress.setIndeterminate(true);
        }
    }

    return contentParent;
}
 
Example #18
Source File: ActionBarSherlockCompat.java    From Libraries-for-Android-Developers with MIT License 4 votes vote down vote up
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);
        }
        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);
    }
}
 
Example #19
Source File: ActionBarSherlockCompat.java    From CSipSimple with GNU General Public License v3.0 4 votes vote down vote up
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);
        }
        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);
    }
}
 
Example #20
Source File: ActionBarSherlockCompat.java    From Libraries-for-Android-Developers with MIT License 4 votes vote down vote up
private ViewGroup generateLayout() {
    if (ActionBarSherlock.DEBUG) Log.d(TAG, "[generateLayout]");

    // Apply data from current theme.

    TypedArray a = mActivity.getTheme().obtainStyledAttributes(R.styleable.SherlockTheme);

    if (!a.hasValue(R.styleable.SherlockTheme_windowActionBar)) {
        throw new IllegalStateException("You must use Theme.Sherlock, Theme.Sherlock.Light, Theme.Sherlock.Light.DarkActionBar, or a derivative.");
    }

    if (a.getBoolean(R.styleable.SherlockTheme_windowNoTitle, false)) {
        requestFeature(Window.FEATURE_NO_TITLE);
    } else if (a.getBoolean(R.styleable.SherlockTheme_windowActionBar, false)) {
        // Don't allow an action bar if there is no title.
        requestFeature(Window.FEATURE_ACTION_BAR);
    }

    if (a.getBoolean(R.styleable.SherlockTheme_windowActionBarOverlay, false)) {
        requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
    }

    if (a.getBoolean(R.styleable.SherlockTheme_windowActionModeOverlay, false)) {
        requestFeature(Window.FEATURE_ACTION_MODE_OVERLAY);
    }

    a.recycle();

    int layoutResource;
    if (!hasFeature(Window.FEATURE_NO_TITLE)) {
        if (hasFeature(Window.FEATURE_ACTION_BAR_OVERLAY)) {
            layoutResource = R.layout.abs__screen_action_bar_overlay;
        } else {
            layoutResource = R.layout.abs__screen_action_bar;
        }
    } else if (hasFeature(Window.FEATURE_ACTION_MODE_OVERLAY) && !hasFeature(Window.FEATURE_NO_TITLE)) {
        layoutResource = R.layout.abs__screen_simple_overlay_action_mode;
    } else {
        layoutResource = R.layout.abs__screen_simple;
    }

    if (ActionBarSherlock.DEBUG) Log.d(TAG, "[generateLayout] using screen XML " + mActivity.getResources().getString(layoutResource));
    View in = mActivity.getLayoutInflater().inflate(layoutResource, null);
    mDecor.addView(in, new ViewGroup.LayoutParams(MATCH_PARENT, MATCH_PARENT));

    ViewGroup contentParent = (ViewGroup)mDecor.findViewById(R.id.abs__content);
    if (contentParent == null) {
        throw new RuntimeException("Couldn't find content container view");
    }

    //Make our new child the true content view (for fragments). VERY VOLATILE!
    mDecor.setId(View.NO_ID);
    contentParent.setId(android.R.id.content);

    if (hasFeature(Window.FEATURE_INDETERMINATE_PROGRESS)) {
        IcsProgressBar progress = getCircularProgressBar(false);
        if (progress != null) {
            progress.setIndeterminate(true);
        }
    }

    return contentParent;
}