修改dialogfragment实现

pull/709/head
laoyuyu 4 years ago
parent 023f648d07
commit 981917fa52
  1. 4
      AppFrame/build.gradle
  2. 4
      Aria/src/main/java/com/arialyy/aria/core/download/DownloadReceiver.java
  3. 4
      FtpComponent/build.gradle
  4. 4
      HttpComponent/build.gradle
  5. 4
      M3U8Component/build.gradle
  6. 5
      PublicComponent/build.gradle
  7. 4
      SFtpComponent/build.gradle
  8. 2
      app/build.gradle
  9. 4
      app/src/main/java/com/arialyy/simple/core/download/ComponentActivity.java
  10. 10
      app/src/main/java/com/arialyy/simple/core/download/DownloadDialog.java
  11. 11
      app/src/main/java/com/arialyy/simple/core/download/DownloadDialogFragment.java
  12. 3
      app/src/main/java/com/arialyy/simple/modlue/CommonModule.java
  13. 1
      app/src/main/res/values/strings.xml

@ -23,6 +23,10 @@ android {
dataBinding {
enabled = true
}
lintOptions {
abortOnError false
}
}
dependencies {

@ -166,7 +166,7 @@ public class DownloadReceiver extends AbsReceiver {
public void register() {
Object obj = OBJ_MAP.get(getKey());
if (obj == null) {
ALog.e(TAG, String.format("【%s】观察者为空", getTargetName()));
ALog.e(TAG, String.format("register【%s】观察者为空", getTargetName()));
return;
}
Set<Integer> set = ProxyHelper.getInstance().checkProxyType(obj.getClass());
@ -212,7 +212,7 @@ public class DownloadReceiver extends AbsReceiver {
@Override protected void unRegisterListener() {
Object obj = OBJ_MAP.get(getKey());
if (obj == null) {
ALog.e(TAG, String.format("【%s】观察者为空", getTargetName()));
ALog.e(TAG, String.format("unRegister【%s】观察者为空", getTargetName()));
return;
}
Set<Integer> set = ProxyHelper.getInstance().mProxyCache.get(obj.getClass().getName());

@ -20,6 +20,10 @@ android {
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
lintOptions {
abortOnError false
}
}
dependencies {

@ -19,6 +19,10 @@ android {
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
lintOptions {
abortOnError false
}
}
dependencies {

@ -20,6 +20,10 @@ android {
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
lintOptions {
abortOnError false
}
}
dependencies {

@ -20,6 +20,11 @@ android {
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
lintOptions {
abortOnError false
}
}
dependencies {

@ -20,6 +20,10 @@ android {
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
lintOptions {
abortOnError false
}
}
dependencies {

@ -66,7 +66,7 @@ dependencies {
implementation 'com.google.android.material:material:1.0.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib:${rootProject.ext.kotlin_version}"
api 'com.github.PhilJay:MPAndroidChart:v3.0.3'
debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.5.4'
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.4'
implementation 'com.github.bumptech.glide:glide:3.7.0'
implementation 'com.pddstudio:highlightjs-android:1.5.0'
implementation 'org.greenrobot:eventbus:3.1.1'

@ -71,6 +71,10 @@ public class ComponentActivity extends BaseActivity<ActivityComponentBinding> {
DownloadDialog dialog = new DownloadDialog(ComponentActivity.this);
dialog.show();
break;
case 2:
new DownloadDialogFragment(ComponentActivity.this).show(getSupportFragmentManager(),
"df");
break;
}
}
});

@ -66,10 +66,7 @@ public class DownloadDialog extends AbsDialog implements View.OnClickListener {
int p = (int) (entity.getCurrentProgress() * 100 / entity.getFileSize());
mPb.setProgress(p);
int state = entity.getState();
setBtState(state != DownloadEntity.STATE_RUNNING);
mTaskId = entity.getId();
} else {
setBtState(true);
}
mStart.setOnClickListener(this);
mCancel.setOnClickListener(this);
@ -106,16 +103,13 @@ public class DownloadDialog extends AbsDialog implements View.OnClickListener {
@Download.onTaskPre public void onTaskPre(DownloadTask task) {
mSize.setText(CommonUtil.formatFileSize(task.getFileSize()));
setBtState(false);
}
@Download.onTaskStop public void onTaskStop(DownloadTask task) {
setBtState(true);
mSpeed.setText(task.getConvertSpeed());
}
@Download.onTaskCancel public void onTaskCancel(DownloadTask task) {
setBtState(true);
mPb.setProgress(0);
mSpeed.setText(task.getConvertSpeed());
}
@ -131,8 +125,4 @@ public class DownloadDialog extends AbsDialog implements View.OnClickListener {
}
private void setBtState(boolean startEnable) {
mStart.setEnabled(startEnable);
mCancel.setEnabled(!startEnable);
}
}

@ -33,8 +33,8 @@ import com.arialyy.simple.util.AppUtil;
@Override protected void init(Bundle savedInstanceState) {
super.init(savedInstanceState);
Aria.download(getContext()).register();
mEntity = Aria.download(getContext()).getFirstDownloadEntity(DOWNLOAD_URL);
Aria.download(this).register();
mEntity = Aria.download(this).getFirstDownloadEntity(DOWNLOAD_URL);
if (mEntity != null) {
if (mEntity.getState() == IEntity.STATE_RUNNING) {
getBinding().setStateStr(getString(R.string.stop));
@ -46,7 +46,6 @@ import com.arialyy.simple.util.AppUtil;
getBinding().setProgress((int) (mEntity.getCurrentProgress() * 100 / mEntity.getFileSize()));
}
mRootView.findViewById(R.id.start).setOnClickListener(this);
mRootView.findViewById(R.id.stop).setOnClickListener(this);
mRootView.findViewById(R.id.cancel).setOnClickListener(this);
}
@ -56,7 +55,7 @@ import com.arialyy.simple.util.AppUtil;
@Override public void onDestroy() {
super.onDestroy();
Aria.download(getContext()).unRegister();
Aria.download(this).unRegister();
}
@Download.onPre(DOWNLOAD_URL) protected void onPre(DownloadTask task) {
@ -103,7 +102,7 @@ import com.arialyy.simple.util.AppUtil;
switch (view.getId()) {
case R.id.start:
if (!AppUtil.chekEntityValid(mEntity)) {
Aria.download(getContext())
Aria.download(this)
.load(DOWNLOAD_URL)
.setFilePath(Environment.getExternalStorageDirectory().getPath() + "/放置江湖.apk")
.create();
@ -121,7 +120,7 @@ import com.arialyy.simple.util.AppUtil;
case R.id.cancel:
if (AppUtil.chekEntityValid(mEntity)) {
Aria.download(getContext()).load(mEntity.getId()).cancel();
Aria.download(this).load(mEntity.getId()).cancel();
}
break;
}

@ -48,7 +48,8 @@ public class CommonModule extends BaseViewModule {
String[] titles = context.getResources().getStringArray(R.array.component_items);
int[] icons = new int[] {
R.drawable.ic_fragment,
R.drawable.ic_dialog
R.drawable.ic_dialog,
R.drawable.ic_fragment
};
int i = 0;
for (String title : titles) {

@ -75,6 +75,7 @@
<string-array name="component_items">
<item>fragment中使用</item>
<item>dialog中使用</item>
<item>dialogFragment中使用</item>
</string-array>

Loading…
Cancel
Save