Java Code Examples for android.widget.ProgressBar

The following are top voted examples for showing how to use android.widget.ProgressBar. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: MuslimMateAndroid   File: AboutActivity.java   View source code 7 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_about);

    getSupportActionBar().setTitle(getString(R.string.about));
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    progressBar = (ProgressBar) findViewById(R.id.progress);
    progressBar.getIndeterminateDrawable()
            .setColorFilter(ContextCompat.getColor(this, R.color.colorPrimary), PorterDuff.Mode.SRC_IN);
    info_web = (WebView) findViewById(R.id.webview_company_info);
    info_web.setBackgroundColor(Color.TRANSPARENT);
    info_web.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
    info_web.setWebViewClient(new myWebClient());
    info_web.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
    info_web.getSettings().setJavaScriptEnabled(true);
    info_web.getSettings().setDefaultFontSize((int) getResources().getDimension(R.dimen.about_text_size));

    String infoText = getString(R.string.company_info_web);
    info_web.loadDataWithBaseURL("file:///android_asset/fonts/", getWebViewText(infoText), "text/html", "utf-8", null);

}
 
Example 2
Project: Hillffair17   File: EventActivity.java   View source code 7 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    SharedPref pref= new SharedPref(this);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_event);
    Toolbar toolbar= (Toolbar) findViewById(R.id.my_toolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    recyclerView = (RecyclerView) findViewById(R.id.recycler_view);
    progressBar= (ProgressBar) findViewById(R.id.progress);
    adapter=new ClubEventAdapter(this);
    recyclerView.setAdapter(adapter);
    recyclerView.setLayoutManager(new GridLayoutManager(this,2));
    recyclerView.addOnItemTouchListener(new RecyclerItemClickListener(this, new RecyclerItemClickListener.OnItemClickListener() {
        @Override
        public void onItemClick(View view, int position) {
            Intent i=new Intent(EventActivity.this,ClubActivity.class);
            i.putExtra(CLUB_ID,list.get(position).getId());
            startActivity(i);
        }
    }));
    showData();
}
 
Example 3
Project: GitHub   File: BoxingViewActivity.java   View source code 6 votes vote down vote up
private void initView() {
    mAdapter = new ImagesAdapter(getSupportFragmentManager());
    mOkBtn = (Button) findViewById(R.id.image_items_ok);
    mGallery = (HackyViewPager) findViewById(R.id.pager);
    mProgressBar = (ProgressBar) findViewById(R.id.loading);
    mGallery.setAdapter(mAdapter);
    mGallery.addOnPageChangeListener(new OnPagerChangeListener());
    if (!mNeedEdit) {
        View chooseLayout = findViewById(R.id.item_choose_layout);
        chooseLayout.setVisibility(View.GONE);
    } else {
        setOkTextNumber();
        mOkBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finishByBackPressed(false);
            }
        });
    }
}
 
Example 4
Project: letv   File: MyDownloadActivity.java   View source code 6 votes vote down vote up
private void initView() {
    this.mCapacityRoot = findViewById(2131361935);
    this.mCapacityTextView = (TextView) findViewById(2131361937);
    this.mCapacityPBar = (ProgressBar) findViewById(2131361936);
    this.mTipLayout = findViewById(R.id.download_vip_layout);
    this.mVipTipTV = (TextView) findViewById(R.id.download_vip_tip);
    this.mOpenVipTV = (TextView) findViewById(R.id.download_open_vip_btn);
    this.mOpenVipTV.setOnClickListener(new OnClickListener(this) {
        final /* synthetic */ MyDownloadActivity this$0;

        {
            if (HotFix.PREVENT_VERIFY) {
                System.out.println(VerifyLoad.class);
            }
            this.this$0 = this$0;
        }

        public void onClick(View v) {
            LetvVipActivity.launch(this.this$0.mContext, this.this$0.mContext.getResources().getString(2131100645));
            StatisticsUtils.statisticsActionInfo(this.this$0.mContext, PageIdConstant.downloadingPage, "0", "vp13", "开通会员", 1, PreferencesManager.getInstance().isVip() ? "vip=1" : "vip=0");
        }
    });
    initNavigationBar();
    initViewPager();
}
 
Example 5
Project: RoomDemo2017   File: ListFragment.java   View source code 6 votes vote down vote up
public CustomViewHolder(View itemView) {
    super(itemView);
    this.coloredCircle = (CircleImageView) itemView.findViewById(R.id.imv_list_item_circle);
    this.dateAndTime = (TextView) itemView.findViewById(R.id.lbl_date_and_time);
    this.message = (TextView) itemView.findViewById(R.id.lbl_message);
    this.loading = (ProgressBar) itemView.findViewById(R.id.pro_item_data);

    this.container = (ViewGroup) itemView.findViewById(R.id.root_list_item);
    /*
    We can pass "this" as an Argument, because "this", which refers to the Current
    Instance of type CustomViewHolder currently conforms to (implements) the
    View.OnClickListener interface. I have a Video on my channel which goes into
    Interfaces with Detailed Examples.

    Search "Android WTF: Java Interfaces by Example"
     */
    this.container.setOnClickListener(this);
}
 
Example 6
Project: AndroidSDK2.0   File: FwUpdateDialog.java   View source code 6 votes vote down vote up
private void onUpgrading( final int total, final int progress )
{
    if(!isShowing() || isDisconnect)
        return;
    activity.runOnUiThread( new Runnable()
    {
        @Override
        public void run ()
        {
            int percent = progress*100/total;
            if(percent > 100)
                percent = 100;
            ((TextView)fw_loading_layout.findViewById( R.id.fw_loading_text )).setText( "Sending Fw to Pen.. ");
            ((TextView)fw_loading_layout.findViewById( R.id.fw_loading_progress_text )).setText( percent+"%");

            ((ProgressBar)fw_loading_layout.findViewById( R.id.fw_loading_progressbar )).setProgress( percent );
            ((ProgressBar)fw_loading_layout.findViewById( R.id.fw_loading_progressbar )).setIndeterminate( false );
            mBuilder.setContentText( "Sending" ).setProgress( total, progress, false );
            mNotifyManager.notify( 0, mBuilder.build() );

        }
    } );

}
 
Example 7
Project: CXJPadProject   File: ImageMessageHolder.java   View source code 6 votes vote down vote up
public ImageMessageHolder(Context context, View convertView){
    super(context,convertView);
    isGif = (TextView) convertView.findViewById(ResourceUtils
            .getIdByName(context, "id", "sobot_pic_isgif"));
    image = (ImageView) convertView.findViewById(ResourceUtils
            .getIdByName(context, "id", "sobot_iv_picture"));

    pic_send_status = (ImageView) convertView
            .findViewById(ResourceUtils.getIdByName(context, "id",
                    "sobot_pic_send_status"));
    pic_progress = (ProgressBar) convertView
            .findViewById(ResourceUtils.getIdByName(context, "id",
                    "sobot_pic_progress"));
    sobot_pic_progress_round = (RoundProgressBar) convertView.findViewById(ResourceUtils.getIdByName(context, "id",
            "sobot_pic_progress_round"));

    sobot_pic_progress_rl = (RelativeLayout) convertView.findViewById(ResourceUtils.getIdByName(context, "id", "sobot_pic_progress_rl"));
}
 
Example 8
Project: TestChat   File: WeiXinNewsActivity.java   View source code 6 votes vote down vote up
@Override
public void initView() {
        mFloatingActionsMenu = (FloatingActionsMenu) findViewById(R.id.fam_wei_xin_news_menu);
        browser = (FloatingActionButton) findViewById(R.id.fab_wei_xin_news_browser);
        share = (FloatingActionButton) findViewById(R.id.fab_wei_xin_news_share);
        display = (WebView) findViewById(R.id.wv_wei_xin_news_display);
        mProgressBar = (ProgressBar) findViewById(R.id.pb_wei_xin_news_load);
        findViewById(R.id.rl_wei_xin_news_container).setOnTouchListener(new View.OnTouchListener() {
                @Override
                public boolean onTouch(View v, MotionEvent event) {
                        if (mFloatingActionsMenu.isExpanded()) {
                                mFloatingActionsMenu.collapse();
                                return true;
                        } else {
                                return false;
                        }
                }
        });
        browser.setOnClickListener(this);
        share.setOnClickListener(this);
}
 
Example 9
Project: Phoenix-for-VK   File: GifPagerFragment.java   View source code 6 votes vote down vote up
Holder(int adapterPosition, View rootView) {
    super(adapterPosition, rootView);
    FlingRelativeLayout flingRelativeLayout = (FlingRelativeLayout) rootView.findViewById(R.id.fling_root_view);
    flingRelativeLayout.setOnClickListener(v -> toggleFullscreen());
    flingRelativeLayout.setOnSingleFlingListener(new CloseOnFlingListener(rootView.getContext()) {
        @Override
        public boolean onVerticalFling(float distanceByY) {
            goBack();
            return true;
        }
    });

    mSurfaceView = (SurfaceView) rootView.findViewById(R.id.surface_view);
    mSurfaceHolder = mSurfaceView.getHolder();
    mSurfaceHolder.addCallback(this);

    mAspectRatioLayout = (AlternativeAspectRatioFrameLayout) rootView.findViewById(R.id.aspect_ratio_layout);
    mProgressBar = (ProgressBar) rootView.findViewById(R.id.preparing_progress_bar);
}
 
Example 10
Project: NeiHanDuanZiTV   File: BoxingViewActivity.java   View source code 6 votes vote down vote up
private void initView() {
    mAdapter = new ImagesAdapter(getSupportFragmentManager());
    mOkBtn = (Button) findViewById(R.id.image_items_ok);
    mGallery = (HackyViewPager) findViewById(R.id.pager);
    mProgressBar = (ProgressBar) findViewById(R.id.loading);
    mGallery.setAdapter(mAdapter);
    mGallery.addOnPageChangeListener(new OnPagerChangeListener());
    if (!mNeedEdit) {
        View chooseLayout = findViewById(R.id.item_choose_layout);
        chooseLayout.setVisibility(View.GONE);
    } else {
        setOkTextNumber();
        mOkBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finishByBackPressed(false);
            }
        });
    }
}
 
Example 11
Project: BrewBook   File: user.java   View source code 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_user);
    SubjectListView = (ListView) findViewById(R.id.listview1);

    progressBarSubject = (ProgressBar) findViewById(R.id.progressBar);

    new GetHttpResponse(user.this).execute();


    trendingBtm = (ImageButton) findViewById(R.id.imageBtmtrending);
    userBtm = (ImageButton) findViewById(R.id.imageBtmuser);
    locationBtm = (ImageButton) findViewById(R.id.imageBtmlocation);
    settingsBtm = (ImageButton) findViewById(R.id.imageBtmSettings);
    addReviewBtm = (FloatingActionButton) findViewById(R.id.addReview);
    trendingBtm.setOnClickListener(btTrending);
    userBtm.setOnClickListener(btUser);
    locationBtm.setOnClickListener(btlocation);
    settingsBtm.setOnClickListener(btSettings);
    addReviewBtm.setOnClickListener(btAdd);
    userid = Users.userID;



}
 
Example 12
Project: MyFire   File: LoadingTip.java   View source code 6 votes vote down vote up
private void initView(Context context) {
    View.inflate(context, R.layout.dialog_loading_tip, this);
    img_tip_logo = (ImageView) findViewById(R.id.img_tip_logo);
    progress = (ProgressBar) findViewById(R.id.progress);
    tv_tips = (TextView) findViewById(R.id.tv_tips);
    bt_operate = (Button) findViewById(R.id.bt_operate);
    //重新尝试
    bt_operate.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View view) {
            if(onReloadListener!=null){
                onReloadListener.reload();
            }
        }
    });
    setVisibility(View.GONE);
}
 
Example 13
Project: ThunderMusic   File: AudioPreview.java   View source code 6 votes vote down vote up
private void showPostPrepareUI() {
    ProgressBar pb = (ProgressBar) findViewById(R.id.spinner);
    pb.setVisibility(View.GONE);
    mDuration = mPlayer.getDuration();
    if (mDuration != 0) {
        mSeekBar.setMax(mDuration);
        mSeekBar.setVisibility(View.VISIBLE);
    }
    mSeekBar.setOnSeekBarChangeListener(mSeekListener);
    mLoadingText.setVisibility(View.GONE);
    View v = findViewById(R.id.titleandbuttons);
    v.setVisibility(View.VISIBLE);
    mAudioManager.requestAudioFocus(mAudioFocusListener, AudioManager.STREAM_MUSIC,
            AudioManager.AUDIOFOCUS_GAIN_TRANSIENT);
    mProgressRefresher.postDelayed(new ProgressRefresher(), 200);
    updatePlayPause();
}
 
Example 14
Project: Make-A-Pede-Android-App   File: DeviceListActivity.java   View source code 6 votes vote down vote up
@Override
public boolean onCreateOptionsMenu(Menu menu) {
	getMenuInflater().inflate(R.menu.device_list_activity_menu, menu);
	if (!btScanner.isScanning()) {
		menu.findItem(R.id.menu_stop).setVisible(false);
		menu.findItem(R.id.menu_scan).setVisible(true);
		menu.findItem(R.id.menu_refresh).setActionView(null);
	} else {
		menu.findItem(R.id.menu_stop).setVisible(true);
		menu.findItem(R.id.menu_scan).setVisible(false);

		View indicatorLayout = getLayoutInflater().inflate(R.layout.actionbar_indeterminate_progress, null);
		ProgressBar indicator = indicatorLayout.findViewById(R.id.loading_indicator);

		indicator.setVisibility(View.VISIBLE);
		indicator.setIndeterminate(true);
		indicator.getIndeterminateDrawable().setColorFilter(0xFF323232, PorterDuff.Mode.MULTIPLY);

		menu.findItem(R.id.menu_refresh).setActionView(indicatorLayout);
	}

	return true;
}
 
Example 15
Project: RxTransfer   File: ListenerSample.java   View source code 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_listener_sample);
    mLayout = findViewById(R.id.mainLayout);

    final ProgressBar progressBar = findViewById(R.id.progress);
    final TextView progressText = findViewById(R.id.progressText);

    String path = Environment.getExternalStorageDirectory().getAbsolutePath();
    String testFilePath = path + "/testFile";
    String url = "http://ipv4.download.thinkbroadband.com/200MB.zip";

    new RxDownload(this, 1)
        .saveTo(testFilePath)
        .listener(progress -> {
            progressBar.setProgress(progress);
            progressText.setText(Integer.toString(progress));

            if(progress == 100)
                DialogBuilder.showMessage("Operation Completed", mLayout);
        })
        .url(url)
        .start();
}
 
Example 16
Project: AndroidUIExtentions   File: UCPaginatedList.java   View source code 6 votes vote down vote up
private void inflateUI() {
    setLayoutParams(new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));

    LayoutInflater inflater = (LayoutInflater)
            getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);

    View view = inflater.inflate(
            R.layout.paginated_recycler, this, true);

    mSwipeRefreshLayout = (SwipeRefreshLayout) view.findViewById(R.id.swipe_container);
    mRecyclerView = (RecyclerView) view.findViewById(R.id.list);
    mProgressBar = (ProgressBar) view.findViewById(R.id.progress_bar);
    mEmptyView = (SwipeRefreshLayout) view.findViewById(R.id.empty_view);
    mEmptyViewTextView = (TextView) mEmptyView.findViewById(R.id.no_data_message);
}
 
Example 17
Project: EsperantoRadio   File: Basisaktivitet.java   View source code 6 votes vote down vote up
@Override
public void setContentView(int layoutResID) {
  setTitle(R.string.D_R_Radio); // til blinde, for at undgå at "DR Radio" bliver udtalt som "Doktor Radio"
  super.setContentView(layoutResID);
  Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
  if (toolbar != null) {
    toolbar.setLogo(R.drawable.appikon);
    setSupportActionBar(toolbar);
    ActionBar ab = getSupportActionBar();
    ab.setDisplayShowTitleEnabled(false);
    ab.setDisplayHomeAsUpEnabled(true);
    ab.setHomeButtonEnabled(true);

    //actionBar.setTitle(""); // tom - vi bruger logo
    progressBar = (ProgressBar) findViewById(R.id.progressBar);
  }
}
 
Example 18
Project: ucar-weex-core   File: WXWebView.java   View source code 6 votes vote down vote up
@Override
public View getView() {
    FrameLayout root = new FrameLayout(mContext);
    root.setBackgroundColor(Color.WHITE);

    mWebView = new WebView(mContext);//mContext.getApplicationContext();
    FrameLayout.LayoutParams wvLayoutParams =
            new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT,
                    FrameLayout.LayoutParams.MATCH_PARENT);
    wvLayoutParams.gravity = Gravity.CENTER;
    mWebView.setLayoutParams(wvLayoutParams);
    root.addView(mWebView);
    initWebView(mWebView);

    mProgressBar = new ProgressBar(mContext);
    showProgressBar(false);
    FrameLayout.LayoutParams pLayoutParams =
            new FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT,
                    FrameLayout.LayoutParams.WRAP_CONTENT);
    mProgressBar.setLayoutParams(pLayoutParams);
    pLayoutParams.gravity = Gravity.CENTER;
    root.addView(mProgressBar);
    return root;
}
 
Example 19
Project: AndroidSDK2.0   File: FwUpdateDialog.java   View source code 6 votes vote down vote up
@Override
public void onDownloading ( final int percent, final long downloadBytes )
{
    if(!isShowing() || isDisconnect)
        return;
    activity.runOnUiThread( new Runnable()
    {
        @Override
        public void run ()
        {
            NLog.d( "AsyncFirmDownloadTask onDownloading percent=" +percent+" ,downloadBytes="+downloadBytes);
            ((TextView)fw_loading_layout.findViewById( R.id.fw_loading_progress_text )).setText( downloadBytes+" byte : "+percent+"%");
            ((ProgressBar)fw_loading_layout.findViewById( R.id.fw_loading_progressbar )).setIndeterminate( false );
            ((ProgressBar)fw_loading_layout.findViewById( R.id.fw_loading_progressbar )).setProgress( percent );
        }
    } );

}
 
Example 20
Project: RNLearn_Project1   File: ProgressBarTestCase.java   View source code 6 votes vote down vote up
/**
 * Test that the sizes of the progressBars are setup correctly
 */
public void testProgressBarSizes() {
  for (String style : styleList) {
    ProgressBar newProgressBar =
        new ProgressBar(getContext(), null, styles.get(style));
    final int spec = View.MeasureSpec.makeMeasureSpec(
        ViewGroup.LayoutParams.WRAP_CONTENT,
        View.MeasureSpec.UNSPECIFIED);
    newProgressBar.measure(spec, spec);
    final int expectedHeight = newProgressBar.getMeasuredHeight();

    // verify correct size of view containing ProgressBar
    View viewContainingProgressBar = getViewByTestId(mRootView, style);
    assertEquals(expectedHeight, viewContainingProgressBar.getHeight());

    assertTrue(((ViewGroup) viewContainingProgressBar).getChildAt(0) instanceof ProgressBar);
  }
}
 
Example 21
Project: MangoBloggerAndroidApp   File: FirebaseListFragment.java   View source code 6 votes vote down vote up
@Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        View view = inflater.inflate(R.layout.fragment_recycler_view, container ,false);

        recyclerView = (RecyclerView) view.findViewById(R.id.recycler_view);
//        mShimmerView = (ListShimmerView) view.findViewById(R.id.shimmer_view);
        mProgressBar = (ProgressBar) view.findViewById(R.id.progress_bar);
//        mShimmerView.setVisibility(View.VISIBLE);
        final GridLayoutManager gridLayoutManager = new GridLayoutManager(getActivity(), 1);

        recyclerView.setLayoutManager(gridLayoutManager);
        recyclerView.addItemDecoration(new GridSpacingItemDecoration(1, 20, true));


        mBlogList = new ArrayList<>();
        FirebaseDatabase.getInstance().setPersistenceEnabled(true);
        mFirebaseRef = new Firebase(mUrl); /* connect to firebase*/


        return view;
    }
 
Example 22
Project: filepicker   File: ImageEditActivity.java   View source code 6 votes vote down vote up
private void showProgressDialog() {
    if (mProgressDialog == null) {
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        LinearLayout dialogView = new LinearLayout(this);
        dialogView.setOrientation(LinearLayout.VERTICAL);
        ProgressBar progressBar = new ProgressBar(this);
        dialogView.addView(progressBar);
        TextView tvMessage = new TextView(this);
        tvMessage.setTextSize(TypedValue.COMPLEX_UNIT_SP, 14);
        tvMessage.setTextColor(Color.WHITE);
        tvMessage.setText(R.string.saving);
        tvMessage.setGravity(Gravity.CENTER);
        tvMessage.setPadding(0, Util.dip2px(5), 0, Util.dip2px(5));
        tvMessage.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
        dialogView.addView(tvMessage);
        builder.setView(dialogView);
        mProgressDialog = builder.create();
        mProgressDialog.setCancelable(false);
    }
    mProgressDialog.show();
    WindowManager.LayoutParams params = mProgressDialog.getWindow().getAttributes();
    params.width = (int) (Util.getScreenWidth()*0.4);
    mProgressDialog.getWindow().setAttributes(params);
    mProgressDialog.getWindow().getDecorView().setBackgroundColor(getResources().getColor(R.color.BgToolBar));
}
 
Example 23
Project: KUtils   File: Buildable.java   View source code 6 votes vote down vote up
protected BuildBean buildMdLoadingVertical(BuildBean bean) {
    AlertDialog.Builder builder = new AlertDialog.Builder(bean.mContext);
    View root = View.inflate(bean.mContext, R.layout.dialogui_loading_vertical, null);
    View llBg = (View) root.findViewById(R.id.dialogui_ll_bg);
    ProgressBar pbBg = (ProgressBar) root.findViewById(R.id.pb_bg);
    TextView tvMsg = (TextView) root.findViewById(R.id.dialogui_tv_msg);
    tvMsg.setText(bean.msg);
    if (bean.isWhiteBg) {
        llBg.setBackgroundResource(R.drawable.dialogui_shape_wihte_round_corner);
        pbBg.setIndeterminateDrawable(bean.mContext.getResources().getDrawable(R.drawable.dialogui_rotate_mum));
        tvMsg.setTextColor(bean.mContext.getResources().getColor(R.color.text_black));
    } else {
        llBg.setBackgroundResource(R.drawable.dialogui_shape_gray_round_corner);
        pbBg.setIndeterminateDrawable(bean.mContext.getResources().getDrawable(R.drawable.dialogui_rotate_mum_light));
        tvMsg.setTextColor(Color.WHITE);
    }
    builder.setView(root);
    AlertDialog dialog = builder.create();
    bean.alertDialog = dialog;
    return bean;
}
 
Example 24
Project: MusicX-music-player   File: TintHelper.java   View source code 6 votes vote down vote up
public static void setTint(@NonNull ProgressBar progressBar, @ColorInt int color, boolean skipIndeterminate) {
    ColorStateList sl = ColorStateList.valueOf(color);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        progressBar.setProgressTintList(sl);
        progressBar.setSecondaryProgressTintList(sl);
        if (!skipIndeterminate)
            progressBar.setIndeterminateTintList(sl);
    } else {
        PorterDuff.Mode mode = PorterDuff.Mode.SRC_IN;
        if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD_MR1) {
            mode = PorterDuff.Mode.MULTIPLY;
        }
        if (!skipIndeterminate && progressBar.getIndeterminateDrawable() != null)
            progressBar.getIndeterminateDrawable().setColorFilter(color, mode);
        if (progressBar.getProgressDrawable() != null)
            progressBar.getProgressDrawable().setColorFilter(color, mode);
    }
}
 
Example 25
Project: SimpleAvatarPicker   File: MainActivity.java   View source code 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    if (savedInstanceState == null) {
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        toolbar.setTitle(getResources().getString(R.string.app_name));
        setSupportActionBar(toolbar);
    }

    mAvatarPicker = AvatarPickBuilder.build(this, AVATAR_FILE_PROVIDER_AUTHORITY);
    mProfileThumbnail = (ImageView) findViewById(R.id.user_profile_thumbnail);
    mProgressBar = (ProgressBar) findViewById(R.id.loading_bar);

    RxView
          .clicks(mProfileThumbnail)
          .throttleFirst(1, TimeUnit.SECONDS, AndroidSchedulers.mainThread())
          .subscribe(o -> showPicturePickerMenuDialog());

    renderImage("http://cfile25.uf.tistory.com/image/262EA640568FDABE08957B");
}
 
Example 26
Project: Nird2   File: BasePostFragment.java   View source code 6 votes vote down vote up
@CallSuper
@Nullable
@Override
public View onCreateView(LayoutInflater inflater,
		@Nullable ViewGroup container,
		@Nullable Bundle savedInstanceState) {
	// retrieve MessageId of blog post from arguments
	byte[] p = getArguments().getByteArray(POST_ID);
	if (p == null) throw new IllegalStateException("No post ID in args");
	postId = new MessageId(p);

	View view = inflater.inflate(R.layout.fragment_blog_post, container,
			false);
	progressBar = (ProgressBar) view.findViewById(R.id.progressBar);
	progressBar.setVisibility(VISIBLE);
	ui = new BlogPostViewHolder(view);
	return view;
}
 
Example 27
Project: immersify   File: ExcludeAppsActivity.java   View source code 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_exclude_apps);

    getSupportActionBar().setTitle(R.string.exclude_apps_activity_title);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);


    mProgressBar = (ProgressBar) findViewById(R.id.progressBar);
    mListView = (ListView) findViewById(R.id.appListView);

    mAdapter = new AppAdapter(getApplicationContext());
    mListView.setAdapter(mAdapter);

    setListShown(false);

    // Prepare the loader.  Either re-connect with an existing one,
    // or start a new one.
    getSupportLoaderManager().initLoader(0, null, this).forceLoad();
}
 
Example 28
Project: mobile-store   File: SwapAppsView.java   View source code 6 votes vote down vote up
@Override
public View newView(Context context, Cursor cursor, ViewGroup parent) {
    View view = getInflater(context).inflate(R.layout.swap_app_list_item, parent, false);

    ViewHolder holder = new ViewHolder();

    holder.progressView = (ProgressBar) view.findViewById(R.id.progress);
    holder.nameView = (TextView) view.findViewById(R.id.name);
    holder.iconView = (ImageView) view.findViewById(android.R.id.icon);
    holder.btnInstall = (Button) view.findViewById(R.id.btn_install);
    holder.statusInstalled = (TextView) view.findViewById(R.id.status_installed);
    holder.statusIncompatible = (TextView) view.findViewById(R.id.status_incompatible);

    view.setTag(holder);
    bindView(view, context, cursor);
    return view;
}
 
Example 29
Project: NeiHanDuanZiTV   File: LoadingView.java   View source code 6 votes vote down vote up
public LoadingView showLoading(CharSequence msg, boolean cancleabl) {

        mDialog = new Dialog(mContext);// TODO: 2017/8/28 内存泄露时这里也修改为弱引用
        mDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);

        rootView = View.inflate(mContext, R.layout.dialogui_loading_horizontal, null);
        mLinearLayout = (LinearLayout) rootView.findViewById(R.id.dialogui_ll_bg);
        mProgressBar = (ProgressBar) rootView.findViewById(R.id.pb_bg);
        mTextView = (TextView) rootView.findViewById(R.id.dialogui_tv_msg);
        mTextView.setText(msg);
        mLinearLayout.setBackgroundResource(R.drawable.dialogui_shape_wihte_round_corner);
        mProgressBar.setIndeterminateDrawable(mContext.getResources().getDrawable(R.drawable.dialogui_shape_progress));
        mTextView.setTextColor(mContext.getResources().getColor(R.color.text_black));
        mDialog.setContentView(rootView);

        if (mDialog != null) {
            if (mDialog.isShowing()) {
                mDialog.dismiss();
            }
            mDialog.setCancelable(cancleabl);
            mDialog.setOnCancelListener(this);
            mDialog.show();
        }
        return this;
    }
 
Example 30
Project: TapIn   File: HubMain.java   View source code 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState)
{
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_hub_main);

    nfcAdapter = NfcAdapter.getDefaultAdapter(this);
    setTitle("Tap In Hub");


    yeeid = (TextView)findViewById(R.id.yeeid);
    spinner = (ProgressBar)findViewById(R.id.progressBar);
    gifImageView = (GifImageView)findViewById(R.id.gifImageView);

    try
    {
        InputStream inputStream = getAssets().open("nfc.gif");

        byte[] bytes = IOUtils.toByteArray(inputStream);
        gifImageView.setBytes(bytes);
        gifImageView.startAnimation();
    }
    catch (IOException e)
    {}
    gifImageView.setVisibility(View.VISIBLE);
    spinner.setVisibility(View.INVISIBLE);

}
 
Example 31
Project: uob-timetable-android   File: TermDatesFragment.java   View source code 6 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {

    triedLoad = false;

    View view = inflater.inflate(R.layout.fragment_term_dates, container, false);

    pbLoad = (ProgressBar)view.findViewById(R.id.pbLoad);
    pbLoad.setVisibility(View.GONE);

    // Load WebView content
    // We do not get an error if this fails for some reason
    wvContent = (WebView)view.findViewById(R.id.wvContent);

    // Set custom WebChromeClient for reporting progress
    wvContent.setWebChromeClient(new TermDateWebChromeClient(this));

    if (getArguments().getBoolean(Args.loadOnStart.name()))
        tryLoad();

    return view;
}
 
Example 32
Project: Nimbus   File: Workshops.java   View source code 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_workshops);
     workshopsRv = (RecyclerView) findViewById(R.id.workshops_view);
    workshopsAdapter = new WorkshopsAdapter(Workshops.this);
    workshopsRv.setAdapter(workshopsAdapter);
    bar=(ProgressBar)findViewById(R.id.progress);
    errorView= (TextView) findViewById(R.id.errorView);
    if(new Connection(this).isInternet()){
        retrofit();
    }
    else {
        errorView.setVisibility(View.VISIBLE);
        errorView.setText("Please Check Your Internet Connection");
        bar.setVisibility(View.GONE);
    }

    workshopstb = (Toolbar) findViewById(R.id.workshops_toolbar);
    workshopstb.setTitle("Special Events");
 setSupportActionBar(workshopstb);
 getSupportActionBar().setDisplayHomeAsUpEnabled(true);


}
 
Example 33
Project: BrewBook   File: MainActivity.java   View source code 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main1);
    SubjectListView = (ListView) findViewById(R.id.listview1);
    //this.feeditems = new ArrayList();
    progressBarSubject = (ProgressBar) findViewById(R.id.progressBar);

    new GetHttpResponse(MainActivity.this).execute();


    trendingBtm = (ImageButton) findViewById(R.id.imageBtmtrending);
    userBtm = (ImageButton) findViewById(R.id.imageBtmuser);
    locationBtm = (ImageButton) findViewById(R.id.imageBtmlocation);
    settingsBtm = (ImageButton) findViewById(R.id.imageBtmSettings);
    addReviewBtm = (FloatingActionButton) findViewById(R.id.addReview);
    trendingBtm.setOnClickListener(btTrending);
    userBtm.setOnClickListener(btUser);
    locationBtm.setOnClickListener(btlocation);
    settingsBtm.setOnClickListener(btSettings);
    addReviewBtm.setOnClickListener(btAdd);
}
 
Example 34
Project: cordova-plugin-x5-webview   File: X5WebChromeClient.java   View source code 6 votes vote down vote up
/**
 * Ask the host application for a custom progress view to show while
 * a <video> is loading.
 * @return View The progress view.
 */
public View getVideoLoadingProgressView() {

    if (mVideoProgressView == null) {
        // Create a new Loading view programmatically.

        // create the linear layout
        LinearLayout layout = new LinearLayout(parentEngine.getView().getContext());
        layout.setOrientation(LinearLayout.VERTICAL);
        RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
        layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT);
        layout.setLayoutParams(layoutParams);
        // the proress bar
        ProgressBar bar = new ProgressBar(parentEngine.getView().getContext());
        LinearLayout.LayoutParams barLayoutParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
        barLayoutParams.gravity = Gravity.CENTER;
        bar.setLayoutParams(barLayoutParams);
        layout.addView(bar);

        mVideoProgressView = layout;
    }
return mVideoProgressView;
}
 
Example 35
Project: cat-is-a-dog   File: ViewHabitActivity.java   View source code 6 votes vote down vote up
/**
 * OnCreate method to setup the UI and fill TextView values with habit data
 * @param savedInstanceState
 */
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_view_habit);

    Intent intent = getIntent();
    Bundle bundle = intent.getExtras();

    habitKey = bundle.getString(getString(R.string.VIEW_HABIT_HABIT_KEY), "invalid");
    habitOwner = bundle.getString(getString(R.string.VIEW_HABIT_USER_ID), "invalid");

    mHabitViewGroup = (Group) findViewById(R.id.habitViewGroup);
    mLoadingBar = (ProgressBar) findViewById(R.id.habitViewLoadingBar);

    habitRepository = new HabitRepository(habitOwner);
}
 
Example 36
Project: RecyclerViewTutorial2017   File: ListActivity.java   View source code 6 votes vote down vote up
public CustomViewHolder(View itemView) {
    super(itemView);
    this.coloredCircle = (CircleImageView) itemView.findViewById(R.id.imv_list_item_circle);
    this.dateAndTime = (TextView) itemView.findViewById(R.id.lbl_date_and_time);
    this.message = (TextView) itemView.findViewById(R.id.lbl_message);
    this.loading = (ProgressBar) itemView.findViewById(R.id.pro_item_data);

    this.container = (ViewGroup) itemView.findViewById(R.id.root_list_item);
    /*
    We can pass "this" as an Argument, because "this", which refers to the Current
    Instance of type CustomViewHolder currently conforms to (implements) the
    View.OnClickListener interface. I have a Video on my channel which goes into
    Interfaces with Detailed Examples.

    Search "Android WTF: Java Interfaces by Example"
     */
    this.container.setOnClickListener(this);
}
 
Example 37
Project: Hotspot-master-devp   File: MediaGalleryActivity.java   View source code 5 votes vote down vote up
public void getViews() {
    mTitleTv = (TextView) findViewById(R.id.tv_center);
    mBackIv = (ImageView) findViewById(R.id.iv_left);
    mLeftTv = (TextView) findViewById(R.id.tv_left);
    mRightTv = (TextView) findViewById(R.id.tv_right);
    mMediasGv = (GridView) findViewById(R.id.gv_medias);
    mProgressBar = (ProgressBar) findViewById(R.id.progressbar);
    mMediaListLayout = (LinearLayout) findViewById(R.id.ll_media_list);
    mMediaLv = (ListView) findViewById(R.id.listview);
    mProBtn = (RelativeLayout) findViewById(R.id.rl_toscreen);
    toscreen = (ImageView) findViewById(R.id.toscreen);
}
 
Example 38
Project: AliZhiBoHao   File: WebActivity.java   View source code 5 votes vote down vote up
private void initViews() {
    versionCode = BuildConfig.VERSION_CODE;
    mFrameLayout = (FrameLayout) findViewById(R.id.frame_layout);
    mWebView = new WebView(this);
    LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
    mWebView.setLayoutParams(layoutParams);
    mFrameLayout.addView(mWebView);
    tv_url_title = (TextView) findViewById(R.id.tv_url_title);
    rl_back = (RelativeLayout) findViewById(R.id.rl_back);
    rl_option = (RelativeLayout) findViewById(R.id.rl_option);
    mProgressBar = (ProgressBar) findViewById(R.id.progressBar);
}
 
Example 39
Project: deepenlib-android-sample   File: MainActivity.java   View source code 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    FloatingActionButton mFloatingActionButton = (FloatingActionButton) findViewById(R.id.fab);
    mFloatingActionButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            fabAction();
        }
    });

    mGenderTextView = (TextView) findViewById(R.id.text_view_gender);
    mCustomObjectTextView = (TextView) findViewById(R.id.text_view_custom_object);
    mGenderImageView = (ImageView) findViewById(R.id.image_view_gender);
    mCustomObjectImageView = (ImageView) findViewById(R.id.image_view_custom_object);

    mProgressBar = (ProgressBar) findViewById(R.id.progressbar);
    mProgressBar.getIndeterminateDrawable().setColorFilter(getResources().getColor(
            R.color.colorPrimaryDark),
            PorterDuff.Mode.MULTIPLY);
    mImageView = (ImageView) findViewById(R.id.image_view);
    Picasso.with(this).load("file://" + getImagePath(Prefs.getMode(this))).into(mImageView);
    mCustomObjectLinearLayout = (LinearLayout) findViewById(R.id.linear_layout_custom_object);
    mGenderLinearLayout = (LinearLayout) findViewById(R.id.linear_layout_gender);
    mGeneralClassesListView = (ListView) findViewById(R.id.list_view_general_classes);
    mGeneralClassesListViewAdapter = new ClassifierArrayAdapter(this);
    mGeneralClassesListView.setAdapter(mGeneralClassesListViewAdapter);
    mInferenceTime = (TextView) findViewById(R.id.text_view_inference_time);

    if (!PermissionUtil.hasPermission(this)) {
        PermissionUtil.requestPermission(this);
    }
    refreshResults();
}
 
Example 40
Project: LoRaWAN-Smart-Parking   File: CordovaChromeClient.java   View source code 5 votes vote down vote up
@Override
/**
 * Ask the host application for a custom progress view to show while
 * a <video> is loading.
 * @return View The progress view.
 */
public View getVideoLoadingProgressView() {

    if (mVideoProgressView == null) {            
        // Create a new Loading view programmatically.
        
        // create the linear layout
        LinearLayout layout = new LinearLayout(this.appView.getContext());
        layout.setOrientation(LinearLayout.VERTICAL);
        RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
        layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT);
        layout.setLayoutParams(layoutParams);
        // the proress bar
        ProgressBar bar = new ProgressBar(this.appView.getContext());
        LinearLayout.LayoutParams barLayoutParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
        barLayoutParams.gravity = Gravity.CENTER;
        bar.setLayoutParams(barLayoutParams);   
        layout.addView(bar);
        
        mVideoProgressView = layout;
    }
return mVideoProgressView; 
}