diff --git a/.gradle/7.3.3/checksums/checksums.lock b/.gradle/7.3.3/checksums/checksums.lock index 719934a..c187048 100644 Binary files a/.gradle/7.3.3/checksums/checksums.lock and b/.gradle/7.3.3/checksums/checksums.lock differ diff --git a/.gradle/7.3.3/checksums/sha1-checksums.bin b/.gradle/7.3.3/checksums/sha1-checksums.bin index 27303ea..7d09a6e 100644 Binary files a/.gradle/7.3.3/checksums/sha1-checksums.bin and b/.gradle/7.3.3/checksums/sha1-checksums.bin differ diff --git a/.gradle/7.3.3/executionHistory/executionHistory.bin b/.gradle/7.3.3/executionHistory/executionHistory.bin index 47008fa..1c5f887 100644 Binary files a/.gradle/7.3.3/executionHistory/executionHistory.bin and b/.gradle/7.3.3/executionHistory/executionHistory.bin differ diff --git a/.gradle/7.3.3/executionHistory/executionHistory.lock b/.gradle/7.3.3/executionHistory/executionHistory.lock index 47d7876..89f1b29 100644 Binary files a/.gradle/7.3.3/executionHistory/executionHistory.lock and b/.gradle/7.3.3/executionHistory/executionHistory.lock differ diff --git a/.gradle/7.3.3/fileHashes/fileHashes.bin b/.gradle/7.3.3/fileHashes/fileHashes.bin index 56bf472..fac1c38 100644 Binary files a/.gradle/7.3.3/fileHashes/fileHashes.bin and b/.gradle/7.3.3/fileHashes/fileHashes.bin differ diff --git a/.gradle/7.3.3/fileHashes/fileHashes.lock b/.gradle/7.3.3/fileHashes/fileHashes.lock index e9d48d7..ce7a6b5 100644 Binary files a/.gradle/7.3.3/fileHashes/fileHashes.lock and b/.gradle/7.3.3/fileHashes/fileHashes.lock differ diff --git a/.gradle/7.3.3/fileHashes/resourceHashesCache.bin b/.gradle/7.3.3/fileHashes/resourceHashesCache.bin index 9ef7760..44c1cf3 100644 Binary files a/.gradle/7.3.3/fileHashes/resourceHashesCache.bin and b/.gradle/7.3.3/fileHashes/resourceHashesCache.bin differ diff --git a/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/.gradle/buildOutputCleanup/buildOutputCleanup.lock index 6084011..fd30116 100644 Binary files a/.gradle/buildOutputCleanup/buildOutputCleanup.lock and b/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ diff --git a/.gradle/buildOutputCleanup/outputFiles.bin b/.gradle/buildOutputCleanup/outputFiles.bin index 396d7e5..f4bbed8 100644 Binary files a/.gradle/buildOutputCleanup/outputFiles.bin and b/.gradle/buildOutputCleanup/outputFiles.bin differ diff --git a/.gradle/file-system.probe b/.gradle/file-system.probe index 77461d8..9a03c0c 100644 Binary files a/.gradle/file-system.probe and b/.gradle/file-system.probe differ diff --git a/app/build.gradle b/app/build.gradle index 19be278..3bddf36 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -69,8 +69,6 @@ android { dependencies { - //视频播放器 -// implementation 'com.github.CarGuo.GSYVideoPlayer:GSYVideoPlayer:v8.2.0-release-jitpack' //权限申请 implementation 'com.guolindev.permissionx:permissionx:1.6.1' implementation "androidx.room:room-runtime:2.4.0" @@ -89,7 +87,7 @@ dependencies { implementation 'io.github.youth5201314:banner:2.2.2' implementation 'androidx.core:core-ktx:1.7.0' implementation 'com.github.deano2390:MaterialShowcaseView:1.3.4' - implementation 'com.google.code.gson:gson:2.8.8' + implementation 'com.google.code.gson:gson:2.8.9' implementation 'com.github.yalantis:ucrop:2.2.6-native' implementation 'com.kongzue.stacklabel:stacklabelview:1.1.9' implementation files('libs/editor_0.8.aar') @@ -112,7 +110,7 @@ dependencies { implementation 'androidx.preference:preference-ktx:1.1.1' testImplementation 'junit:junit:4.13.2' - androidTestImplementation 'androidx.test.ext:junit:1.1.2' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' + androidTestImplementation 'androidx.test.ext:junit:1.1.3' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' } \ No newline at end of file diff --git a/app/src/androidTest/java/com/coldmint/rust/pro/ExampleInstrumentedTest.java b/app/src/androidTest/java/com/coldmint/rust/pro/ExampleInstrumentedTest.java index 248c33c..f4f58b2 100644 --- a/app/src/androidTest/java/com/coldmint/rust/pro/ExampleInstrumentedTest.java +++ b/app/src/androidTest/java/com/coldmint/rust/pro/ExampleInstrumentedTest.java @@ -11,7 +11,7 @@ import org.junit.runner.RunWith; import static org.junit.Assert.*; /** - * Instrumented test, which will execute on an Android device. + * 仪器测试,将在Android设备上执行。 * * @see Testing documentation */ @@ -19,7 +19,7 @@ import static org.junit.Assert.*; public class ExampleInstrumentedTest { @Test public void useAppContext() { - // Context of the app under test. + // 被测试应用程序的上下文。 Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); assertEquals("com.coldmint.rust.pro", appContext.getPackageName()); } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 0928761..4950e86 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -23,16 +23,17 @@ android:supportsRtl="true" android:theme="@style/Theme.rust.Concept" android:usesCleartextTraffic="true"> - - - + android:grantUriPermissions="true" + tools:ignore="WrongManifestParent"> + + + @@ -42,6 +43,19 @@ + + + - - - diff --git a/app/src/main/java/com/coldmint/rust/pro/EditActivity.kt b/app/src/main/java/com/coldmint/rust/pro/EditActivity.kt index 5335972..9b3a62a 100644 --- a/app/src/main/java/com/coldmint/rust/pro/EditActivity.kt +++ b/app/src/main/java/com/coldmint/rust/pro/EditActivity.kt @@ -58,6 +58,8 @@ import com.coldmint.rust.pro.viewmodel.EditStartViewModel import com.coldmint.rust.pro.viewmodel.EditViewModel import com.flask.colorpicker.ColorPickerView import com.flask.colorpicker.builder.ColorPickerDialogBuilder +import com.google.android.material.dialog.MaterialAlertDialogBuilder +import com.google.android.material.divider.MaterialDividerItemDecoration import com.google.android.material.snackbar.Snackbar import io.github.rosemoe.sora.data.CompletionItem import java.io.File @@ -109,29 +111,55 @@ class EditActivity : BaseActivity() { EditEndBinding.bind(viewBinding.root) } - fun loadRenewalCard() { - val debugKey = "续费卡片" + fun showRenewalTip() { + val debugKey = "续费提示" val account = appSettings.getValue(AppSettings.Setting.Account, "") val time = appSettings.getValue(AppSettings.Setting.ExpirationTime, 0.toLong()) if (time == 0.toLong() || account.isBlank()) { - DebugHelper.printLog(debugKey, "没有账号或续费信息,隐藏按钮,显示登录。") - viewBinding.editTip.text = getString(R.string.please_login_first) - viewBinding.renewalButton.isVisible = false + DebugHelper.printLog(debugKey, "没有账号或续费信息,关闭界面。") + Toast.makeText(this, "请先登录", Toast.LENGTH_SHORT).show() + finish() } else { val stringTime = ServerConfiguration.toStringTime(time) if (stringTime == ServerConfiguration.ForeverTime) { - DebugHelper.printLog(debugKey, "永久用户无需显示卡片。") - viewBinding.tipCardView.isVisible = false + DebugHelper.printLog(debugKey, "永久用户无需处理续费提示。") } else { - DebugHelper.printLog(debugKey, "普通用户,显示到期时间。") - val tip = String.format( - getString(R.string.edit_tip), account, - stringTime - ) - viewBinding.editTip.text = tip - viewBinding.renewalButton.setOnClickListener { - val intent = Intent(this, ActivateActivity::class.java) - startActivity(intent) + val difference = time - System.currentTimeMillis() + if (difference < 0) { + //已经过期 + DebugHelper.printLog(debugKey, "此用户的助手已经过期。") + MaterialAlertDialogBuilder(this).setTitle(R.string.activation_app) + .setMessage( + R.string.activation_app_tip + ).setPositiveButton(R.string.activate) { i, i2 -> + finish() + val intent = Intent(this, ActivateActivity::class.java) + startActivity(intent) + }.setNegativeButton(R.string.dialog_cancel) { i, i2 -> + finish() + }.setCancelable(false).show() + } else if (difference < 604800000) { + //如果在7天内到期 + val day = difference / 86400000 + 1 + DebugHelper.printLog( + debugKey, + "显示续费提醒(" + difference + "/86400000)" + day + "天。" + ) + MaterialAlertDialogBuilder(this).setTitle(R.string.renewal_tip_title) + .setMessage( + String.format( + getString(R.string.renewal_tip_msg), + account, + day + ) + ).setPositiveButton(R.string.renewal) { i, i2 -> + val intent = Intent(this, ActivateActivity::class.java) + startActivity(intent) + }.setNegativeButton(R.string.dialog_cancel) { i, i2 -> + }.setCancelable(false).show() + } else { + DebugHelper.printLog(debugKey, "还剩余7天以上,无需提示。") + } } } @@ -457,7 +485,7 @@ class EditActivity : BaseActivity() { initCodeToolbar() initStartView() initEndView() - loadRenewalCard() + showRenewalTip() } else { val thisIntent = intent val bundle = thisIntent.getBundleExtra("data") diff --git a/app/src/main/java/com/coldmint/rust/pro/LibraryActivity.kt b/app/src/main/java/com/coldmint/rust/pro/LibraryActivity.kt index f4a6b42..b712a9b 100644 --- a/app/src/main/java/com/coldmint/rust/pro/LibraryActivity.kt +++ b/app/src/main/java/com/coldmint/rust/pro/LibraryActivity.kt @@ -1,6 +1,7 @@ package com.coldmint.rust.pro import android.os.Bundle +import androidx.recyclerview.widget.DividerItemDecoration import com.coldmint.rust.pro.base.BaseActivity import androidx.recyclerview.widget.LinearLayoutManager import com.coldmint.rust.pro.adapters.LibAdapter @@ -137,14 +138,14 @@ class LibraryActivity : BaseActivity() { "Apache License 2.0" ) ) - libInfoArrayList.add( - LibInfo( - "material-dialogs", - "A beautiful, fluid, and extensible dialogs API for Kotlin & Android.", - "https://github.com/afollestad/material-dialogs", - "Apache License 2.0" - ) - ) +// libInfoArrayList.add( +// LibInfo( +// "material-dialogs", +// "A beautiful, fluid, and extensible dialogs API for Kotlin & Android.", +// "https://github.com/afollestad/material-dialogs", +// "Apache License 2.0" +// ) +// ) return libInfoArrayList } @@ -154,9 +155,14 @@ class LibraryActivity : BaseActivity() { override fun whenCreateActivity(savedInstanceState: Bundle?, canUseView: Boolean) { if (canUseView) { - viewBinding.toolbar.setTitle(R.string.libs) - //android:label="@string/mod_action1" setReturnButton() + title = getString(R.string.libs) + viewBinding.libsView.addItemDecoration( + DividerItemDecoration( + this, + DividerItemDecoration.VERTICAL + ) + ) viewBinding.libsView.layoutManager = LinearLayoutManager(this@LibraryActivity) val libAdapter = LibAdapter(this@LibraryActivity, getLibInfoList()) viewBinding.libsView.adapter = libAdapter diff --git a/app/src/main/java/com/coldmint/rust/pro/ThanksActivity.kt b/app/src/main/java/com/coldmint/rust/pro/ThanksActivity.kt index ca1a605..75a1a90 100644 --- a/app/src/main/java/com/coldmint/rust/pro/ThanksActivity.kt +++ b/app/src/main/java/com/coldmint/rust/pro/ThanksActivity.kt @@ -1,6 +1,7 @@ package com.coldmint.rust.pro import android.os.Bundle +import androidx.recyclerview.widget.DividerItemDecoration import androidx.recyclerview.widget.LinearLayoutManager import com.coldmint.rust.pro.adapters.ThanksAdapter import com.coldmint.rust.pro.base.BaseActivity @@ -19,8 +20,14 @@ class ThanksActivity : BaseActivity() { override fun whenCreateActivity(savedInstanceState: Bundle?, canUseView: Boolean) { if (canUseView) { - viewBinding.toolbar.setTitle(R.string.special_thanks_to) + title = getString(R.string.special_thanks_to) setReturnButton() + viewBinding.recyclerView.addItemDecoration( + DividerItemDecoration( + this, + DividerItemDecoration.VERTICAL + ) + ) viewBinding.recyclerView.layoutManager = LinearLayoutManager(this) val list = ArrayList() list.add(ThanksDataBean("空调大郎", "帮助翻译俄语版本。", 1491779490)) diff --git a/app/src/main/java/com/coldmint/rust/pro/adapters/LibAdapter.kt b/app/src/main/java/com/coldmint/rust/pro/adapters/LibAdapter.kt index dd22430..7f5fcf5 100644 --- a/app/src/main/java/com/coldmint/rust/pro/adapters/LibAdapter.kt +++ b/app/src/main/java/com/coldmint/rust/pro/adapters/LibAdapter.kt @@ -14,24 +14,25 @@ import android.widget.TextView import androidx.core.view.isVisible import com.coldmint.rust.pro.base.BaseAdapter import com.coldmint.rust.pro.databean.LibInfo -import com.coldmint.rust.pro.databinding.LibItemBinding +import com.coldmint.rust.pro.databinding.ItemLibBinding +import com.google.android.material.dialog.MaterialAlertDialogBuilder import java.util.ArrayList class LibAdapter(val context: Context, dataList: ArrayList) : - BaseAdapter(context, dataList) { + BaseAdapter(context, dataList) { override fun getViewBindingObject( layoutInflater: LayoutInflater, parent: ViewGroup, viewType: Int - ): LibItemBinding { - return LibItemBinding.inflate(layoutInflater, parent, false) + ): ItemLibBinding { + return ItemLibBinding.inflate(layoutInflater, parent, false) } override fun onBingView( data: LibInfo, - viewBinding: LibItemBinding, - viewHolder: BaseAdapter.ViewHolder, + viewBinding: ItemLibBinding, + viewHolder: BaseAdapter.ViewHolder, position: Int ) { viewBinding.titleView.text = data.title @@ -53,9 +54,9 @@ class LibAdapter(val context: Context, dataList: ArrayList) : if (tip != null) { viewBinding.tipView.isVisible = true viewBinding.tipView.setOnClickListener { - MaterialDialog(context).show { - title(R.string.about).message(text = tip).negativeButton(R.string.close) - } + MaterialAlertDialogBuilder(context).setTitle(R.string.about).setMessage(tip) + .setPositiveButton(R.string.close) { i, tab -> + }.show() } } } diff --git a/app/src/main/java/com/coldmint/rust/pro/fragments/MapFragment.kt b/app/src/main/java/com/coldmint/rust/pro/fragments/MapFragment.kt index 96eb0ee..b19e4b1 100644 --- a/app/src/main/java/com/coldmint/rust/pro/fragments/MapFragment.kt +++ b/app/src/main/java/com/coldmint/rust/pro/fragments/MapFragment.kt @@ -10,6 +10,7 @@ import android.view.LayoutInflater import android.view.View import androidx.core.content.FileProvider import androidx.core.view.isVisible +import androidx.recyclerview.widget.DividerItemDecoration import androidx.recyclerview.widget.LinearLayoutManager import com.afollestad.materialdialogs.MaterialDialog import com.coldmint.rust.core.MapClass @@ -135,6 +136,12 @@ class MapFragment : BaseFragment() { override fun whenViewCreated(inflater: LayoutInflater, savedInstanceState: Bundle?) { viewBinding.mapList.layoutManager = LinearLayoutManager(requireContext()) + viewBinding.mapList.addItemDecoration( + DividerItemDecoration( + requireContext(), + DividerItemDecoration.VERTICAL + ) + ) val path = appSettings.getValue(AppSettings.Setting.MapFolder, "") if (path.isNotBlank()) { loadPath(File(path)) diff --git a/app/src/main/java/com/coldmint/rust/pro/fragments/ModFragment.kt b/app/src/main/java/com/coldmint/rust/pro/fragments/ModFragment.kt index 552985b..2f4f417 100644 --- a/app/src/main/java/com/coldmint/rust/pro/fragments/ModFragment.kt +++ b/app/src/main/java/com/coldmint/rust/pro/fragments/ModFragment.kt @@ -17,6 +17,7 @@ import android.os.Handler import android.view.View import android.widget.* import androidx.core.view.isVisible +import androidx.recyclerview.widget.DividerItemDecoration import com.coldmint.rust.core.tool.FileOperator import com.coldmint.rust.pro.MainActivity import com.coldmint.rust.pro.adapters.ModActionAdapter @@ -107,6 +108,7 @@ class ModFragment : BaseFragment() { viewBinding.modError.isVisible = false viewBinding.modErrorIcon.isVisible = false viewBinding.progressBar.isVisible = false + viewBinding.modList.adapter = modAdapter }, MainActivity.hideViewDelay) } else { @@ -351,5 +353,11 @@ class ModFragment : BaseFragment() { override fun whenViewCreated(inflater: LayoutInflater, savedInstanceState: Bundle?) { viewBinding.modList.layoutManager = LinearLayoutManager(context) + viewBinding.modList.addItemDecoration( + DividerItemDecoration( + requireContext(), + DividerItemDecoration.VERTICAL + ) + ) } } \ No newline at end of file diff --git a/app/src/main/res/layout/activity_about.xml b/app/src/main/res/layout/activity_about.xml index a5cc0a4..08affd7 100644 --- a/app/src/main/res/layout/activity_about.xml +++ b/app/src/main/res/layout/activity_about.xml @@ -4,12 +4,15 @@ xmlns:card_view="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" + android:fitsSystemWindows="true" android:orientation="vertical"> + android:layout_height="?attr/actionBarSize" + android:fitsSystemWindows="true" /> + - + android:layout_height="wrap_content"> - + - + android:layout_marginTop="8dp"> - + + android:layout_height="match_parent" + android:fitsSystemWindows="true" + tools:context=".ActivateActivity"> - + android:layout_height="?attr/actionBarSize" /> diff --git a/app/src/main/res/layout/activity_bookmark_manager.xml b/app/src/main/res/layout/activity_bookmark_manager.xml index 4d6aa96..48148d1 100644 --- a/app/src/main/res/layout/activity_bookmark_manager.xml +++ b/app/src/main/res/layout/activity_bookmark_manager.xml @@ -1,24 +1,22 @@ - + android:layout_height="match_parent" + android:fitsSystemWindows="true" + tools:context=".ActivateActivity"> - + android:layout_height="?attr/actionBarSize" /> @@ -61,7 +59,6 @@ android:layout_height="wrap_content" android:layout_gravity="bottom|end" android:layout_margin="16dp" - android:src="@drawable/add" - app:tint="@color/white" /> + android:src="@drawable/add"/> diff --git a/app/src/main/res/layout/activity_code_table.xml b/app/src/main/res/layout/activity_code_table.xml index 763ca2a..b164318 100644 --- a/app/src/main/res/layout/activity_code_table.xml +++ b/app/src/main/res/layout/activity_code_table.xml @@ -1,31 +1,55 @@ - + android:fitsSystemWindows="true" + tools:context=".ActivateActivity"> - - - + android:fitsSystemWindows="true"> - + + + + + - \ No newline at end of file + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_create_template.xml b/app/src/main/res/layout/activity_create_template.xml index 544b680..2f3da8d 100644 --- a/app/src/main/res/layout/activity_create_template.xml +++ b/app/src/main/res/layout/activity_create_template.xml @@ -1,136 +1,158 @@ - + android:fitsSystemWindows="true" + tools:context=".ActivateActivity"> - + android:fitsSystemWindows="true"> - + + + + + + + android:orientation="vertical"> - + app:counterEnabled="true" + app:counterMaxLength="20"> - + + + - - - + android:paddingTop="8dp" + app:counterEnabled="true" + app:counterMaxLength="500"> - + - + - + android:paddingTop="8dp" + app:counterEnabled="true" + app:counterMaxLength="20"> - + + + - - - + android:paddingTop="8dp" + app:counterEnabled="true" + app:counterMaxLength="200"> - + - + - + android:paddingTop="8dp" + app:counterEnabled="true" + app:counterMaxLength="20"> - + - + - + android:paddingTop="8dp" + app:counterEnabled="true" + app:counterMaxLength="9"> - + -