添加帮助文本,修改bug。
This commit is contained in:
parent
1fa923b235
commit
2222ba6fec
|
@ -4,8 +4,11 @@ import com.coldmint.rust.pro.base.BaseActivity
|
|||
import android.os.Bundle
|
||||
import android.content.Intent
|
||||
import android.view.LayoutInflater
|
||||
import android.view.Menu
|
||||
import android.view.MenuItem
|
||||
import android.widget.*
|
||||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
import com.coldmint.dialog.CoreDialog
|
||||
import com.coldmint.rust.pro.adapters.CreateUnitPageAdapter
|
||||
import com.coldmint.rust.pro.databinding.ActivityCreateUnitBinding
|
||||
import com.google.android.material.tabs.TabLayoutMediator
|
||||
|
@ -21,6 +24,23 @@ class CreateUnitActivity : BaseActivity<ActivityCreateUnitBinding>() {
|
|||
}
|
||||
}
|
||||
|
||||
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
||||
menuInflater.inflate(R.menu.menu_create_unit, menu)
|
||||
return true
|
||||
}
|
||||
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
if (item.itemId == R.id.help) {
|
||||
val dialog =
|
||||
CoreDialog(this).setTitle(R.string.help).setMessage(R.string.template_help_message)
|
||||
dialog.setPositiveButton(R.string.dialog_ok) {
|
||||
|
||||
}
|
||||
dialog.show()
|
||||
}
|
||||
return super.onOptionsItemSelected(item)
|
||||
}
|
||||
|
||||
fun initView() {
|
||||
val intent = intent
|
||||
val bundle = intent.getBundleExtra("data")
|
||||
|
|
|
@ -12,6 +12,7 @@ import android.widget.Toast
|
|||
import androidx.appcompat.app.AppCompatDelegate
|
||||
import androidx.preference.*
|
||||
import com.bumptech.glide.Glide
|
||||
import com.coldmint.rust.core.tool.AppOperator
|
||||
import com.coldmint.rust.core.tool.FileOperator
|
||||
import com.coldmint.rust.pro.databinding.ActivitySettingsBinding
|
||||
import com.coldmint.rust.pro.tool.GlobalMethod
|
||||
|
@ -76,6 +77,12 @@ class SettingsActivity : BaseActivity<ActivitySettingsBinding>() {
|
|||
true
|
||||
}
|
||||
|
||||
val obtainSourceCode = manager.findPreference<PreferenceScreen>(requireContext().getString(R.string.setting_obtain_source_code))
|
||||
obtainSourceCode!!.onPreferenceClickListener = Preference.OnPreferenceClickListener {
|
||||
AppOperator.useBrowserAccessWebPage(requireContext(),"https://github.com/Cold-Mint/RustAssistant")
|
||||
true
|
||||
}
|
||||
|
||||
val game = manager.findPreference<PreferenceScreen>("set_game_pack")
|
||||
game!!.onPreferenceClickListener = Preference.OnPreferenceClickListener {
|
||||
startActivity(Intent(context, ApplicationListActivity::class.java))
|
||||
|
|
|
@ -87,7 +87,7 @@ class AllUnitsFragment(
|
|||
addFileToHistory(file, handler = handler, whenAddComplete = {
|
||||
val intent = Intent(requireContext(), EditActivity::class.java)
|
||||
intent.putExtra("data", bundle)
|
||||
fragmentActivity?.startActivityForResult(intent, 2)
|
||||
requireActivity().startActivity(intent)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
5
app/src/main/res/drawable/baseline_help_outline_24.xml
Normal file
5
app/src/main/res/drawable/baseline_help_outline_24.xml
Normal file
|
@ -0,0 +1,5 @@
|
|||
<vector android:autoMirrored="true" android:height="24dp"
|
||||
android:tint="#000000" android:viewportHeight="24"
|
||||
android:viewportWidth="24" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="@android:color/white" android:pathData="M11,18h2v-2h-2v2zM12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,20c-4.41,0 -8,-3.59 -8,-8s3.59,-8 8,-8 8,3.59 8,8 -3.59,8 -8,8zM12,6c-2.21,0 -4,1.79 -4,4h2c0,-1.1 0.9,-2 2,-2s2,0.9 2,2c0,2 -3,1.75 -3,5h2c0,-2.25 3,-2.5 3,-5 0,-2.21 -1.79,-4 -4,-4z"/>
|
||||
</vector>
|
9
app/src/main/res/menu/menu_create_unit.xml
Normal file
9
app/src/main/res/menu/menu_create_unit.xml
Normal file
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<item
|
||||
android:id="@+id/help"
|
||||
android:title="@string/help"
|
||||
android:icon="@drawable/baseline_help_outline_24"
|
||||
app:showAsAction="always"/>
|
||||
</menu>
|
|
@ -550,7 +550,6 @@
|
|||
<string name="location_info">位于%1$s第%2$d行:</string>
|
||||
<string name="covers_the_import">您正在尝试导入低版本的模板包(%1$s),当前版本(%2$s),这将覆盖更新的内容。要继续嘛?</string>
|
||||
<string name="covers_the_import_mod">%1$s已存在,这将覆盖旧的内容。要继续嘛?</string>
|
||||
<string name="help">使用文档</string>
|
||||
<string name="empty_text">无法为空文件制作模板。</string>
|
||||
<string name="value_selector_array_describe">使用\",\"分割参数,也可以使用\"[\"和\"]\"注解参数。例如:[喜欢:like],喜欢将被显示给用户,选中后,写入like。</string>
|
||||
<string name="template_save_complete">模板添加完成,请现在退出模板制作器嘛?</string>
|
||||
|
@ -947,5 +946,9 @@
|
|||
<string name="compile_error">编译错误</string>
|
||||
<string name="compile_error_message">很抱歉,源文件编译失败了。错误信息为:\n%1$s</string>
|
||||
<string name="follow_introduction">登录后即可解锁关注系统</string>
|
||||
|
||||
<string name="help">帮助</string>
|
||||
<string name="template_help_message">助手使用模板创建单位,模板的本质是一段json描述。助手模板解析器会解析json,构建出用户界面。您可以在\"模板社区\"订阅您感兴趣的模板。订阅后会随时保持更新。</string>
|
||||
<string name="obtain_source_code_msg">在Github上查看铁锈助手的源代码,助手已开源,欢迎二次开发。</string>
|
||||
<string name="obtain_source_code">获取源代码</string>
|
||||
<string name="setting_obtain_source_code" translatable="false">ObtainSourceCode</string>
|
||||
</resources>
|
|
@ -266,6 +266,11 @@
|
|||
app:key="developerModeGroup"
|
||||
app:title="@string/sync_header">
|
||||
|
||||
<PreferenceScreen
|
||||
app:key="@string/setting_obtain_source_code"
|
||||
android:summary="@string/obtain_source_code_msg"
|
||||
app:title="@string/obtain_source_code"/>
|
||||
|
||||
<PreferenceScreen
|
||||
app:key="@string/setting_see_error_info"
|
||||
app:summary="@string/see_error_info_tip"
|
||||
|
|
|
@ -40,8 +40,13 @@ data class WebTemplateData(
|
|||
private lateinit var jsonObject: JSONObject
|
||||
|
||||
override fun getJson(): JSONObject {
|
||||
if (!this::jsonObject.isInitialized) {
|
||||
jsonObject = JSONObject(content)
|
||||
try {
|
||||
if (!this::jsonObject.isInitialized) {
|
||||
jsonObject = JSONObject(content)
|
||||
}
|
||||
}catch (e:Exception){
|
||||
e.printStackTrace()
|
||||
jsonObject = JSONObject()
|
||||
}
|
||||
return jsonObject
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user