コード例 #1
0
 @Override
 public void showProgressBar(int progress) {
   if (progressbar == null) return;
   progressbar.setProgress(progress);
   if (progress == 100) {
     progressbar.setVisibility(View.GONE);
   } else {
     progressbar.setVisibility(View.VISIBLE);
   }
 }
コード例 #2
0
  /**
   * onCreate之后调用,可以用来初始化view
   *
   * @param savedInstanceState the saved instance state
   */
  @Override
  public final void onCreateAfter(Bundle savedInstanceState) {
    parseIntent();

    enableJavascript();
    enableCaching();
    enableClient();
    enableAdjust();
    zoomedOut();
    // 网页标题
    mTextSwitcher.setFactory(
        () -> {
          TextView textView = new TextView(this);
          textView.setTextAppearance(this, R.style.WebTitle);
          textView.setSingleLine(true);
          textView.setEllipsize(TextUtils.TruncateAt.MARQUEE);
          textView.postDelayed(() -> textView.setSelected(true), 1738);
          return textView;
        });
    mTextSwitcher.setInAnimation(this, android.R.anim.fade_in);
    mTextSwitcher.setOutAnimation(this, android.R.anim.fade_out);
    if (title != null) setTitle(title);

    if (mProgressBar != null)
      mProgressBar.setReachedBarColor(BaseApplication.color(R.color.colorPrimary));

    // 设置滑动监听
    mWebView.setOnScrollChangedCallback(
        (dx, dy, x, y) -> { // 滑动监听
        });

    onCreateAfterLater();
  }
コード例 #3
0
  @Override
  protected void onPreExecute() {

    Utilities.deleteAllFilesFromFolder(myDir.getPath());
    FragmentManager fm = myAct.getSupportFragmentManager();
    // FragmentManager fm = myAct.getFragmentManager();
    smsesNumber = Utilities.getElementsNumber(myContext, Constants.smsBaseUri);
    smsBar = (UI_ProgressBar_Fragment) fm.findFragmentById(R.id.smsFragment);
    // Log.d(TAG, "corProcessedMMSes number : "+corProcessedSMSes);
    smsBar.setNumber(myAct.getResources().getString(R.string.smses), smsesNumber);
    // Log.d(TAG, "fragment ");
    mySMSBar = (NumberProgressBar) smsBar.getView().findViewById(R.id.progressBar);
    mySMSBar.setMax(smsesNumber);

    mmsesNumber = Utilities.getElementsNumber(myContext, Constants.mmsBaseUri);
    mmsBar = (UI_ProgressBar_Fragment) fm.findFragmentById(R.id.mmsFragment);
    // Log.d(TAG, "corProcessedMMSes number : "+corProcessedMMSes);
    mmsBar.setNumber(myAct.getResources().getString(R.string.mmses), mmsesNumber);
    // Log.d(TAG, "fragment ");
    myMMSBar = (NumberProgressBar) mmsBar.getView().findViewById(R.id.progressBar);
    myMMSBar.setMax(mmsesNumber);

    /*JAVA 1.7 VERSION
    try (Cursor cur = myContext.getContentResolver().query(Uri.parse(Constants.smsBaseUri), null, null, null, null)) {
        smsesNumber = cur.getCount();
        smsBar = (UI_ProgressBar_Fragment) fm.findFragmentById(R.id.smsFragment);
        //Log.d(TAG, "corProcessedMMSes number : "+corProcessedSMSes);
        smsBar.setNumber(myAct.getResources().getString(R.string.smses), smsesNumber);
        //Log.d(TAG, "fragment ");
        mySMSBar = (NumberProgressBar) smsBar.getView().findViewById(R.id.progressBar);
        mySMSBar.setMax(smsesNumber);
    }
    try (Cursor cur = myContext.getContentResolver().query(Uri.parse(Constants.mmsBaseUri), null, null, null, null)){
        mmsesNumber = cur.getCount();
        mmsBar = (UI_ProgressBar_Fragment) fm.findFragmentById(R.id.mmsFragment);
        //Log.d(TAG, "corProcessedMMSes number : "+corProcessedMMSes);
        mmsBar.setNumber(myAct.getResources().getString(R.string.mmses), mmsesNumber);
        //Log.d(TAG, "fragment ");
        myMMSBar = (NumberProgressBar) mmsBar.getView().findViewById(R.id.progressBar);
        myMMSBar.setMax(mmsesNumber);
    }*/
  }