com.daimajia.numberprogressbar.NumberProgressBar Java Examples

The following examples show how to use com.daimajia.numberprogressbar.NumberProgressBar. 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: UpdateDialog.java    From AppSmartUpdate with Apache License 2.0 6 votes vote down vote up
private void init() {
        View view = View.inflate(getContext(), R.layout.lib_update_dialog, null);
        mProgressBar = (NumberProgressBar) view.findViewById(R.id.progressbar);
        mTitleTV = (TextView) view.findViewById(R.id.title_tv);
        mUpdateInfoTV = (TextView) view.findViewById(R.id.update_info_tv);
        mOKBtn = (Button) view.findViewById(R.id.ok_btn);
        mIgnoreTV = (TextView) view.findViewById(R.id.ignore_tv);
        mCloseIV = (ImageView) view.findViewById(R.id.close_iv);
        mCloseLLT = (LinearLayout) view.findViewById(R.id.close_llt);
        mIgnoreTV.setOnClickListener(this);
        mCloseIV.setOnClickListener(this);
        mOKBtn.setOnClickListener(this);
        setContentView(view);
        WindowManager.LayoutParams params = getWindow().getAttributes();
        params.gravity = Gravity.CENTER;

        mIgnoreTV.setOnClickListener(this);

//        WindowManager m = (WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE);
//        Display display = m.getDefaultDisplay(); // 获取屏幕宽、高用
//        params.width = (int) (display.getWidth() * 0.7); // 宽度设置为屏幕的0.7
        getWindow().setAttributes(params);
//        dialog.setCanceledOnTouchOutside(false);
//        dialog.setCancelable(isCancel);
//        dialog.show();
    }
 
Example #2
Source File: NowPlayingFragment.java    From Prodigal with Apache License 2.0 6 votes vote down vote up
@Override
public View onCreateView(LayoutInflater layoutInflater,
                         ViewGroup parent,
                         Bundle savedInstanceState
                         ){
    View ret = layoutInflater.inflate(R.layout.layout_now_playing,parent,false);
    view = ret;
    contentView = view.findViewById(R.id.id_now_playing_wrapper);
    seekView = view.findViewById(R.id.id_seeker_wrapper);
    progressView = (NumberProgressBar) view.findViewById(R.id.id_progress_view);
    seeker = (NumberProgressBar) view.findViewById(R.id.id_seeker);
    seekerTitle = (TextView) view.findViewById(R.id.id_seeker_title);
    seekerHint = (TextView) view.findViewById(R.id.id_seeker_hint);
    currentTime = (TextView) view.findViewById(R.id.current_time);
    totalTime = (TextView) view.findViewById(R.id.total_time);
    title = (TextView) view.findViewById(R.id.id_now_playing_text_view_title);
    album = (TextView) view.findViewById(R.id.id_now_playing_text_view_album);
    artist = (TextView) view.findViewById(R.id.id_now_playing_text_view_artist);
    volume = VolumeUtil.getStaticInstance(getActivity());

    loadTheme();
    return ret;
}
 
Example #3
Source File: DownloadingListAdapter.java    From AndroidDownload with Apache License 2.0 5 votes vote down vote up
public TaskHolder(View itemView) {
    super(itemView);
    fileNameText = (TextView) itemView.findViewById(R.id.file_name);
    downSize = (TextView) itemView.findViewById(R.id.down_size);
    downSpeed = (TextView) itemView.findViewById(R.id.down_speed);
    downCDNSpeed = (TextView) itemView.findViewById(R.id.down_cdnspeed);
    RemainingTime = (TextView) itemView.findViewById(R.id.remaining_time);
    startTask = (ImageView) itemView.findViewById(R.id.start_task);
    deleTask = (ImageView) itemView.findViewById(R.id.dele_task);
    fileIcon = (ImageView) itemView.findViewById(R.id.file_icon);
    fileIcon2 = (ImageView) itemView.findViewById(R.id.file_icon2);
    progressBar = (NumberProgressBar)itemView.findViewById(R.id.number_progress_bar);
    downStatus = (SuperTextView)itemView.findViewById(R.id.down_status);
}
 
Example #4
Source File: FindVideoDetailAty.java    From myapplication with Apache License 2.0 5 votes vote down vote up
private void initView() {
        titleBackIBtn = (ImageButton) findViewById(R.id.video_detail_back_imv);
        mWebView = (WebView) findViewById(R.id.video_item_webview);
        mNumberProgressBar = (NumberProgressBar) findViewById(R.id.progressbar);
//        mVideoDescTv = (TextView) findViewById(R.id.video_detail_desc_tv);
//        mVideoPublishedAtTv = (TextView) findViewById(R.id.video_detail_publish_time_tv);
//        mVideoCreateAtTv = (TextView) findViewById(R.id.video_detail_create_time_tv);
//        mVideoSourceTv = (TextView) findViewById(R.id.video_detail_source_tv);
//        mVideoWhoTv = (TextView) findViewById(R.id.video_detail_who_tv);
    }
 
Example #5
Source File: FindGankDetailAty.java    From myapplication with Apache License 2.0 5 votes vote down vote up
private void initView() {
    titlBackIbtn = (ImageButton) findViewById(R.id.title_gank_detail_back_ibtn);
    mMarqueeTextView = (MarqueeTextView) findViewById(R.id.title_detail_gank_class_tv);
    mMarqueeTextView.setEllipsize(TextUtils.TruncateAt.MARQUEE);
    mMarqueeTextView.setSingleLine(true);
    mShareIbtn = (ImageButton) findViewById(R.id.title_detail_gank_share_ibtn);
    mNumberProgressBar = (NumberProgressBar) findViewById(R.id.find_gank_detail_numpbar);
    mWebView = (WebView) findViewById(R.id.find_gank_detail_wv);
}
 
Example #6
Source File: MainActivity.java    From RxjavaRetrofitDemo-master with MIT License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    tvMsg = (TextView) findViewById(R.id.tv_msg);
    findViewById(R.id.btn_simple).setOnClickListener(this);
    findViewById(R.id.btn_rx).setOnClickListener(this);
    findViewById(R.id.btn_rx_mu_down).setOnClickListener(this);
    findViewById(R.id.btn_rx_uploade).setOnClickListener(this);
    img = (ImageView) findViewById(R.id.img);
    progressBar = (NumberProgressBar) findViewById(R.id.number_progress_bar);
    verifyStoragePermissions(this);
}
 
Example #7
Source File: MainActivity.java    From Rx-Retrofit with MIT License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    tvMsg = (TextView) findViewById(R.id.tv_msg);
    findViewById(R.id.btn_rx).setOnClickListener(this);
    findViewById(R.id.btn_rx_mu_down).setOnClickListener(this);
    findViewById(R.id.btn_rx_uploade).setOnClickListener(this);
    img = (ImageView) findViewById(R.id.img);
    progressBar = (NumberProgressBar) findViewById(R.id.number_progress_bar);


    /*初始化数据*/
    manager = new HttpManager(this, this);

    postEntity = new SubjectPostApi();
    postEntity.setAll(true);

    /*上传接口内部接口有token验证,所以需要换成自己的接口测试,检查file文件是否手机存在*/
    uplaodApi = new UploadApi();
    File file = new File("/storage/emulated/0/Download/11.jpg");
    RequestBody requestBody = RequestBody.create(MediaType.parse("image/jpeg"), file);
    MultipartBody.Part part = MultipartBody.Part.createFormData("file_name", file.getName(), new ProgressRequestBody
            (requestBody,
                    new UploadProgressListener() {
                        @Override
                        public void onProgress(long currentBytesCount, long totalBytesCount) {
                            tvMsg.setText("提示:上传中");
                            progressBar.setMax((int) totalBytesCount);
                            progressBar.setProgress((int) currentBytesCount);
                        }
                    }));
    uplaodApi.setPart(part);
}
 
Example #8
Source File: MainActivity.java    From RxjavaRetrofitDemo-string-master with MIT License 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    tvMsg = (TextView) findViewById(R.id.tv_msg);
    findViewById(R.id.btn_rx).setOnClickListener(this);
    findViewById(R.id.btn_rx_all).setOnClickListener(this);
    findViewById(R.id.btn_rx_mu_down).setOnClickListener(this);
    findViewById(R.id.btn_rx_uploade).setOnClickListener(this);
    img = (ImageView) findViewById(R.id.img);
    progressBar = (NumberProgressBar) findViewById(R.id.number_progress_bar);

    /*初始化数据*/
    manager = new HttpManager(this, this);

    postEntity = new SubjectPostApi();
    postEntity.setAll(true);

    /*上传接口内部接口有token验证,所以需要换成自己的接口测试,检查file文件是否手机存在*/
    uplaodApi = new UploadApi();
    File file = new File("/storage/emulated/0/Download/11.jpg");
    RequestBody requestBody = RequestBody.create(MediaType.parse("image/jpeg"), file);
    MultipartBody.Part part = MultipartBody.Part.createFormData("file_name", file.getName(), new ProgressRequestBody
            (requestBody, new UploadProgressListener() {
                @Override
                public void onProgress(final long currentBytesCount, final long totalBytesCount) {

                    /*回到主线程中,可通过timer等延迟或者循环避免快速刷新数据*/
                    Observable.just(currentBytesCount).observeOn(AndroidSchedulers.mainThread()).subscribe(new Action1<Long>() {

                        @Override
                        public void call(Long aLong) {
                            tvMsg.setText("提示:上传中");
                            progressBar.setMax((int) totalBytesCount);
                            progressBar.setProgress((int) currentBytesCount);
                        }
                    });

                }
            }));
    uplaodApi.setPart(part);
}
 
Example #9
Source File: LoaderActivity.java    From EasyVPN-Free with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_loader);

    progressBar = (NumberProgressBar)findViewById(R.id.number_progress_bar);
    commentsText = (TextView)findViewById(R.id.commentsText);

    if (getIntent().getBooleanExtra("firstPremiumLoad", false))
        ((TextView)findViewById(R.id.loaderPremiumText)).setVisibility(View.VISIBLE);

    progressBar.setMax(100);

    updateHandler = new Handler(new Handler.Callback() {
        @Override
        public boolean handleMessage(Message msg) {
            switch (msg.arg1) {
                case LOAD_ERROR: {
                    commentsText.setText(msg.arg2);
                    progressBar.setProgress(100);
                } break;
                case DOWNLOAD_PROGRESS: {
                    commentsText.setText(R.string.downloading_csv_text);
                    progressBar.setProgress(msg.arg2);

                } break;
                case PARSE_PROGRESS: {
                    commentsText.setText(R.string.parsing_csv_text);
                    progressBar.setProgress(msg.arg2);
                } break;
                case LOADING_SUCCESS: {
                    commentsText.setText(R.string.successfully_loaded);
                    progressBar.setProgress(100);
                    Message end = new Message();
                    end.arg1 = SWITCH_TO_RESULT;
                    updateHandler.sendMessageDelayed(end,500);
                } break;
                case SWITCH_TO_RESULT: {
                    if (!BuildConfig.DEBUG)
                        Answers.getInstance().logCustom(new CustomEvent("Time servers loading")
                            .putCustomAttribute("Time servers loading", stopwatch.getElapsedTime()));

                    if (PropertiesService.getConnectOnStart()) {
                        Server randomServer = getRandomServer();
                        if (randomServer != null) {
                            newConnecting(randomServer, true, true);
                        } else {
                            startActivity(new Intent(LoaderActivity.this, HomeActivity.class));
                        }
                    } else {
                        startActivity(new Intent(LoaderActivity.this, HomeActivity.class));
                    }
                }
            }
            return true;
        }
    });
    progressBar.setProgress(0);


}
 
Example #10
Source File: LoginActivity.java    From android2048 with Apache License 2.0 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    //初始化一个intent(传递 谁  启动  谁)
    i = new Intent(this, BackGroundMusicService.class);
    setContentView(R.layout.activity_login);
    //打开服务
    startService(i);
    //绑定服务
    bindService(i, conn, Context.BIND_AUTO_CREATE);

    //两个动画按钮
    final TitanicTextView mTvStartGame = (TitanicTextView) findViewById(R.id.startGame);
    final TitanicTextView mTvStartCharts = (TitanicTextView) findViewById(R.id.startCharts);

    //设置点击监听
    mTvStartCharts.setOnClickListener(this);
    mTvStartGame.setOnClickListener(this);

    //先隐藏了
    mTvStartGame.setVisibility(View.INVISIBLE);
    mTvStartCharts.setVisibility(View.INVISIBLE);

    //开启动画

    //首先创建一个显示器
    Titanic startGameAnim = new Titanic();
    //然后传进一个  按钮对象  给显示器  开启动画
    startGameAnim.start(mTvStartGame);
    Titanic startChartsAnim = new Titanic();
    startChartsAnim.start(mTvStartCharts);

    //进度条
    final NumberProgressBar bnp = (NumberProgressBar) findViewById(R.id.number_progress_bar);

    //开始加载
    counter = 0;
    timer = new Timer();

    //进度条线程
    timer.schedule(new TimerTask() {
        //重写线程的run方法
        @Override
        public void run() {
            runOnUiThread(new Runnable() {
                @Override
                public void run() {

                    //一次加载几个百分比
                    bnp.incrementProgressBy(1);
                    counter++;
                    //当进度条到达100时候进度条结束加载
                    if (counter == 100) {
                        //设置progress样式
                        bnp.setProgress(0);
                        counter = 0;
                        //隐藏进度条   显示两个按钮
                        bnp.setVisibility(View.INVISIBLE);
                        mTvStartCharts.setVisibility(View.VISIBLE);
                        mTvStartGame.setVisibility(View.VISIBLE);
                    }
                }
            });
        }
    }, 500, 50);
}
 
Example #11
Source File: DownLoadFragment.java    From ting with Apache License 2.0 3 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
                         @Nullable Bundle savedInstanceState) {

    if (isDownLoad) {
        view = inflater.inflate(R.layout.fragment_download, container, false);
        registerReceiver();

        downLoadControl = (ImageView) view.findViewById(R.id.download_control);
        cancelDownLoad = (ImageView) view.findViewById(R.id.delete_download);
        progressBar = (NumberProgressBar) view.findViewById(R.id.progressBar);
        songTitle = (TextView) view.findViewById(R.id.song_title);

        ViewOnClickListener viewOnClickListener = new ViewOnClickListener();
        downLoadControl.setOnClickListener(viewOnClickListener);
        cancelDownLoad.setOnClickListener(viewOnClickListener);

    } else {
        view = inflater.inflate(R.layout.fragment_not_download, container, false);
    }





    return view;
}