解决了不登录无法编辑代码的问题。
This commit is contained in:
parent
0bccf2b997
commit
af32d1e970
|
@ -106,59 +106,6 @@ class EditActivity : BaseActivity<ActivityEditBinding>() {
|
|||
// EditEndBinding.bind(viewBinding.root)
|
||||
// }
|
||||
|
||||
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, "没有账号或续费信息,关闭界面。")
|
||||
Toast.makeText(this, "请先登录", Toast.LENGTH_SHORT).show()
|
||||
finish()
|
||||
} else {
|
||||
val stringTime = ServerConfiguration.toStringTime(time)
|
||||
if (stringTime == ServerConfiguration.ForeverTime) {
|
||||
DebugHelper.printLog(debugKey, "永久用户无需处理续费提示。")
|
||||
} else {
|
||||
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天以上,无需提示。")
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载主要的观察者
|
||||
|
@ -496,7 +443,6 @@ class EditActivity : BaseActivity<ActivityEditBinding>() {
|
|||
initCodeEditor()
|
||||
initStartView()
|
||||
// initEndView()
|
||||
showRenewalTip()
|
||||
loadCustomStyle()
|
||||
loadSearchLayout()
|
||||
turretCoordinateResults =
|
||||
|
|
|
@ -14,11 +14,7 @@ import com.google.firebase.ktx.Firebase
|
|||
|
||||
abstract class BaseFragment<T : ViewBinding> : Fragment() {
|
||||
protected lateinit var firebaseAnalytics: FirebaseAnalytics
|
||||
|
||||
val viewBinding: T by lazy {
|
||||
val layoutInflater = LayoutInflater.from(requireActivity())
|
||||
getViewBindingObject(layoutInflater)
|
||||
}
|
||||
protected lateinit var viewBinding: T
|
||||
|
||||
|
||||
/**
|
||||
|
@ -52,6 +48,7 @@ abstract class BaseFragment<T : ViewBinding> : Fragment() {
|
|||
container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View? {
|
||||
viewBinding = getViewBindingObject(inflater)
|
||||
return viewBinding.root
|
||||
}
|
||||
|
||||
|
|
|
@ -153,8 +153,9 @@ class AllUnitsFragment(
|
|||
*/
|
||||
fun loadFiles(file: File? = modClass?.modFile) {
|
||||
if (file == null) {
|
||||
Snackbar.make(viewBinding.unitList, R.string.file_not_exist, Snackbar.LENGTH_SHORT)
|
||||
.show()
|
||||
if (isAdded) {
|
||||
Toast.makeText(requireContext(), R.string.file_not_exist, Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
return
|
||||
}
|
||||
val handler = Handler(Looper.getMainLooper())
|
||||
|
|
|
@ -17,11 +17,7 @@ import com.google.android.material.tabs.TabLayout
|
|||
import com.google.android.material.tabs.TabLayoutMediator
|
||||
|
||||
class CommunityFragment : BaseFragment<FragmentCommunityBinding>() {
|
||||
// 当请求时,此适配器返回一个
|
||||
// representing an object in the collection.
|
||||
private val communityAdapter: CommunityAdapter by lazy {
|
||||
CommunityAdapter(this)
|
||||
}
|
||||
|
||||
|
||||
|
||||
fun loadTab() {
|
||||
|
@ -60,7 +56,7 @@ class CommunityFragment : BaseFragment<FragmentCommunityBinding>() {
|
|||
}
|
||||
|
||||
override fun whenViewCreated(inflater: LayoutInflater, savedInstanceState: Bundle?) {
|
||||
viewBinding.pager.adapter = communityAdapter
|
||||
viewBinding.pager.adapter = CommunityAdapter(this)
|
||||
viewBinding.pager.isSaveEnabled = false
|
||||
loadTab()
|
||||
}
|
||||
|
|
|
@ -35,13 +35,12 @@
|
|||
android:animateLayoutChanges="true"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:id="@+id/packCard"
|
||||
style="@style/Widget.Material3.CardView.Elevated"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
app:cardElevation="2dp"
|
||||
card_view:cardCornerRadius="2dp">
|
||||
android:visibility="gone">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
|
@ -51,13 +50,14 @@
|
|||
|
||||
<TextView
|
||||
android:id="@+id/packingTitle"
|
||||
style="@style/TextAppearance.Material3.HeadlineSmall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/packmod"
|
||||
android:textSize="16sp" />
|
||||
android:text="@string/packmod" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/packingState"
|
||||
style="@style/TextAppearance.Material3.BodyMedium"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
|
@ -65,7 +65,7 @@
|
|||
|
||||
|
||||
</LinearLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
|
|
Loading…
Reference in New Issue
Block a user