forked from CodingGay/BlackDex
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request CodingGay#17 from wukaicheng/main
New Feature
- Loading branch information
Showing
11 changed files
with
167 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 0 additions & 30 deletions
30
app/src/main/java/top/niunaijun/blackdex/util/LoadingUtil.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
app/src/main/java/top/niunaijun/blackdex/view/widget/ProgressDialog.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package top.niunaijun.blackdex.view.widget | ||
|
||
import android.app.Dialog | ||
import android.os.Bundle | ||
import android.util.Log | ||
import android.view.KeyEvent | ||
import android.view.View | ||
import androidx.appcompat.app.AlertDialog | ||
import androidx.fragment.app.DialogFragment | ||
import top.niunaijun.blackdex.R | ||
import top.niunaijun.blackdex.databinding.DialogProgressBinding | ||
import top.niunaijun.blackdex.util.inflate | ||
|
||
/** | ||
* | ||
* @Description: progress dialog | ||
* @Author: wukaicheng | ||
* @CreateDate: 2021/6/7 21:16 | ||
*/ | ||
class ProgressDialog : DialogFragment() { | ||
|
||
private val TAG = "ProgressDialog" | ||
|
||
private val viewBinding: DialogProgressBinding by inflate() | ||
|
||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { | ||
val dialog = AlertDialog.Builder(requireContext()) | ||
.setView(viewBinding.root) | ||
.setTitle(getString(R.string.classes_progress,1,1)) | ||
.setCancelable(false) | ||
.show() | ||
|
||
dialog.setCanceledOnTouchOutside(false) | ||
dialog.setOnKeyListener { _, keyCode, _ -> | ||
return@setOnKeyListener keyCode == KeyEvent.KEYCODE_BACK | ||
} | ||
|
||
return dialog | ||
} | ||
|
||
|
||
fun setProgress(progress: Int, maxProgress: Int) { | ||
requireActivity().runOnUiThread { | ||
if (progress == 0) { | ||
viewBinding.progress.max = maxProgress | ||
} | ||
viewBinding.progress.progress = progress | ||
dialog?.setTitle(getString(R.string.classes_progress,progress,maxProgress)) | ||
|
||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:layout_width="match_parent" | ||
android:paddingStart="24dp" | ||
android:paddingEnd="24dp" | ||
android:paddingTop="12dp" | ||
android:paddingBottom="12dp" | ||
android:orientation="vertical" | ||
android:layout_height="wrap_content"> | ||
|
||
<TextView | ||
android:id="@+id/title" | ||
android:text="@string/dumping" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content"/> | ||
<ProgressBar | ||
android:id="@+id/progress" | ||
style="?android:attr/progressBarStyleHorizontal" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="12dp" | ||
android:layout_marginBottom="12dp"/> | ||
|
||
</LinearLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters