Browse Source

增加进度条2312312

master
fyf 1 year ago
parent
commit
6962ce88d8
5 changed files with 20 additions and 10 deletions
  1. +1
    -1
      app/build.gradle
  2. +6
    -2
      app/src/main/java/com/example/bpa/helper/UpdateManager.java
  3. +2
    -1
      app/src/main/java/com/example/bpa/view/from/lsjy_activity.java
  4. +9
    -5
      app/src/main/res/layout/Dialog/layout/common_dialog_progress.xml
  5. +2
    -1
      gradle.properties

+ 1
- 1
app/build.gradle View File

@@ -67,7 +67,7 @@ dependencies {
compileOnly files('libs/sdkapi.jar')
implementation files('libs/modbus4Android-1.2.jar')
implementation 'com.contrarywind:Android-PickerView:3.2.6'
implementation 'com.github.Ccapton:Android-ColorfulProgressBar:1.0.5'
// implementation 'androidx.databinding:databinding-runtime:4.1.4'
// implementation 'androidx.appcompat:appcompat:1.3.1'
// implementation 'androidx.core:core-ktx:1.6.0'


+ 6
- 2
app/src/main/java/com/example/bpa/helper/UpdateManager.java View File

@@ -17,6 +17,7 @@ import android.widget.TextView;

import androidx.core.content.FileProvider;

import com.capton.colorfulprogressbar.ColorfulProgressbar;
import com.example.bpa.R;
import com.example.bpa.config.ConfigName;

@@ -50,7 +51,7 @@ public class UpdateManager {
private static final int DOWN_OVER = 2;

/* 刷新的进度条 */
private ProgressBar mProgress;
private ColorfulProgressbar mProgress;

/* 新版本apk的远程路径 */
private String apkUrl ;
@@ -173,6 +174,7 @@ public class UpdateManager {
public void showProgress()
{
mProgress.setProgress(progress);
mProgress.setSecondProgress(progress);
}

/*
@@ -226,7 +228,9 @@ public class UpdateManager {
alg.show();
Window win = alg.getWindow();
win.setContentView(R.layout.common_dialog_progress);
mProgress = (ProgressBar)win.findViewById(R.id.update_progress);
mProgress = (ColorfulProgressbar)win.findViewById(R.id.update_progress);
mProgress.showPercentText(true);
mProgress.setAnimation(true);
Button negativeButton = (Button)win.findViewById(R.id.NegativeButton);
negativeButton.setOnClickListener(new View.OnClickListener() {
@Override


+ 2
- 1
app/src/main/java/com/example/bpa/view/from/lsjy_activity.java View File

@@ -15,6 +15,7 @@ import android.widget.TextView;

import com.example.bpa.Model.IWriteCallBack;
import com.example.bpa.R;
import com.example.bpa.helper.MessageLog;
import com.example.bpa.service.DeviceData;
import com.example.bpa.config.DataBus;
import com.example.bpa.helper.T;
@@ -395,7 +396,7 @@ public class lsjy_activity extends AppCompatActivity implements View.OnClickList
try {
zhongliang.setText(String.valueOf(DeviceData.Get().getCallCurrentWeight(9)/10.0)+" g");
} catch (Exception e) {
MessageLog.ShowInfo("重量解析显示异常!"+e.getMessage());
}
}
});


+ 9
- 5
app/src/main/res/layout/Dialog/layout/common_dialog_progress.xml View File

@@ -16,15 +16,19 @@
android:layout_marginBottom="5.0dip"
android:text="正在下载新版本"/>

<ProgressBar
<com.capton.colorfulprogressbar.ColorfulProgressbar
android:id="@+id/update_progress"
app:style="@string/style_colorful"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="10.0dip"
style="?android:attr/progressBarStyleHorizontal"
android:layout_height="50dp"
android:layout_gravity="center"
android:visibility="visible"
android:layout_centerInParent="true"
android:duration="3000"
android:indeterminate="true"
android:max="100"
android:progress="0"
/>

<Button
android:id="@+id/NegativeButton"
android:layout_width="match_parent"


+ 2
- 1
gradle.properties View File

@@ -19,4 +19,5 @@ android.useAndroidX=true
# resources declared in the library itself and none from the library's dependencies,
# thereby reducing the size of the R class for that library
android.nonTransitiveRClass=true
#android.enableJetifier=true
#android.enableJetifier=true
android.enableJetifier=true

Loading…
Cancel
Save