me.zhanghai.android.materialprogressbar.MaterialProgressBar Java Examples

The following examples show how to use me.zhanghai.android.materialprogressbar.MaterialProgressBar. 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: InvisibleActivityBase.java    From FirebaseUI-Android with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.fui_activity_invisible);

    // Create an indeterminate, circular progress bar in the app's theme
    mProgressBar = new MaterialProgressBar(new ContextThemeWrapper(this, getFlowParams().themeId));
    mProgressBar.setIndeterminate(true);
    mProgressBar.setVisibility(View.GONE);

    // Set bar to float in the center
    FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(
            ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    params.gravity = Gravity.CENTER;

    // Add to the container
    FrameLayout container = findViewById(R.id.invisible_frame);
    container.addView(mProgressBar, params);
}
 
Example #2
Source File: InvisibleFragmentBase.java    From FirebaseUI-Android with Apache License 2.0 6 votes vote down vote up
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {

    // Create an indeterminate, circular progress bar in the app's theme
    mProgressBar = new MaterialProgressBar(new ContextThemeWrapper(getContext(),
            getFlowParams().themeId));
    mProgressBar.setIndeterminate(true);
    mProgressBar.setVisibility(View.GONE);

    // Set bar to float in the center
    FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(
            ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    params.gravity = Gravity.CENTER;

    // Add to the container
    mFrameLayout = view.findViewById(R.id.invisible_frame);
    mFrameLayout.addView(mProgressBar, params);
}
 
Example #3
Source File: ExploreFragment.java    From FriendBook with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    viewPager = (ViewPager) view.findViewById(R.id.vp_explore);
    tab = (TabLayout) view.findViewById(R.id.tab_explore);
    progress = (MaterialProgressBar) view.findViewById(R.id.progress);
    ivBookTypeRetry = (AppCompatImageView) view.findViewById(R.id.iv_book_type_retry);
    ivBookTypeMore = view.findViewById(R.id.iv_book_type_more);
    view.findViewById(R.id.view_search).setOnClickListener(this);
    view.findViewById(R.id.fl_action).setOnClickListener(this);

}
 
Example #4
Source File: MultiRecyclerView.java    From Aurora with Apache License 2.0 5 votes vote down vote up
public void init(Context context, AttributeSet attrs) {
    View layout = inflate(context, R.layout.layout_multi_recyclerview, this);
    fl_emptyView = (FrameLayout) layout.findViewById(R.id.fl_empty_view);
    fl_loadingView = (FrameLayout) layout.findViewById(R.id.fl_loading_view);
    fl_errorView = (FrameLayout) layout.findViewById(R.id.fl_error_view);
    recyclerview = (RecyclerView) layout.findViewById(R.id.recyclerView);
    indicatorView = (MaterialProgressBar) fl_loadingView.findViewById(R.id.loading);
}
 
Example #5
Source File: AutoCompleteSearchView.java    From autocomplete-toolbar-search-view with MIT License 5 votes vote down vote up
private ProgressBar initProgressBar(Context context) {
    XmlPullParser parser = getResources().getXml(R.xml.progressbar_raw_layout);

    try {
        parser.next();
        parser.nextTag();
    } catch (Exception e) {
        e.printStackTrace();
    }

    AttributeSet attr = Xml.asAttributeSet(parser);

    MaterialProgressBar progressBar = new MaterialProgressBar(context, attr, 0, me.zhanghai.android.materialprogressbar.R.style.Widget_MaterialProgressBar_ProgressBar_Horizontal_NoPadding);
    progressBar.setTag(getClass().getName());
    progressBar.setVisibility(GONE);

    int progressBarHeight = (int) pxFromDp(getContext(), 4);

    FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, progressBarHeight);
    int extraMargin = 0;

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
        extraMargin = (int) pxFromDp(getContext(), 1); //margin on newer devices

    layoutParams.topMargin = (int) (statusBarHeight + appBar.getHeight() - progressBarHeight - extraMargin);
    progressBar.setLayoutParams(layoutParams);

    FrameLayout decorView = (FrameLayout) activity.getWindow().getDecorView();
    decorView.addView(progressBar, layoutParams);

    return progressBar;
}
 
Example #6
Source File: DownloadViewHolder.java    From OneTapVideoDownload with GNU General Public License v3.0 5 votes vote down vote up
DownloadViewHolder(View v) {
    super(v);
    mApplicationImageView = (ImageView)itemView.findViewById(R.id.application_icon);
    mDownloadTitle = (TextView)itemView.findViewById(R.id.download_title);
    mDownloadUrl = (TextView)itemView.findViewById(R.id.download_url);
    mPercentageTextView = (TextView)itemView.findViewById(R.id.percentage);
    mProgressBar = (MaterialProgressBar) itemView.findViewById(R.id.download_progress);
    mIndeterminateProgressBar = (MaterialProgressBar) itemView.findViewById(R.id.indeterminate_progress_bar);
    mStatusStopped = (ImageView) itemView.findViewById(R.id.status_stopped);
    mStatusCompleted = (ImageView) itemView.findViewById(R.id.status_completed);
    mStatusDownloading = (RelativeLayout) itemView.findViewById(R.id.status_downloading);
    mSelectedTick = (ImageView) itemView.findViewById(R.id.tick);
}
 
Example #7
Source File: FollowButton.java    From Aurora with Apache License 2.0 4 votes vote down vote up
private void init() {
    View layout = inflate(mContext, R.layout.view_followbutton, this);
    mBtnFollow = (Button) layout.findViewById(R.id.btn_follow);
    mProgressBar = (MaterialProgressBar) layout.findViewById(R.id.loading);
    mProgressBar.bringToFront();
}