|
|
@ -13,7 +13,7 @@ import io.legado.app.utils.toast |
|
|
|
class AboutFragment : PreferenceFragmentCompat() { |
|
|
|
class AboutFragment : PreferenceFragmentCompat() { |
|
|
|
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) { |
|
|
|
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) { |
|
|
|
addPreferencesFromResource(R.xml.about) |
|
|
|
addPreferencesFromResource(R.xml.about) |
|
|
|
findPreference<Preference>("version")?.summary = App.INSTANCE.versionName |
|
|
|
findPreference<Preference>("check_update")?.summary = getString(R.string.version) + " " + App.INSTANCE.versionName |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { |
|
|
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { |
|
|
@ -23,8 +23,11 @@ class AboutFragment : PreferenceFragmentCompat() { |
|
|
|
|
|
|
|
|
|
|
|
override fun onPreferenceTreeClick(preference: Preference?): Boolean { |
|
|
|
override fun onPreferenceTreeClick(preference: Preference?): Boolean { |
|
|
|
when (preference?.key) { |
|
|
|
when (preference?.key) { |
|
|
|
|
|
|
|
"check_update" -> openIntent(Intent.ACTION_VIEW, getString(R.string.latest_release_url)) |
|
|
|
"mail" -> openIntent(Intent.ACTION_SENDTO, "mailto:kunfei.ge@gmail.com") |
|
|
|
"mail" -> openIntent(Intent.ACTION_SENDTO, "mailto:kunfei.ge@gmail.com") |
|
|
|
"git" -> openIntent(Intent.ACTION_VIEW, getString(R.string.this_github_url)) |
|
|
|
"git" -> openIntent(Intent.ACTION_VIEW, getString(R.string.this_github_url)) |
|
|
|
|
|
|
|
"home_page" -> openIntent(Intent.ACTION_VIEW, getString(R.string.home_page_url)) |
|
|
|
|
|
|
|
"share_app" -> shareText("App Share",getString(R.string.app_share_description)) |
|
|
|
} |
|
|
|
} |
|
|
|
return super.onPreferenceTreeClick(preference) |
|
|
|
return super.onPreferenceTreeClick(preference) |
|
|
|
} |
|
|
|
} |
|
|
@ -37,6 +40,16 @@ class AboutFragment : PreferenceFragmentCompat() { |
|
|
|
} catch (e: Exception) { |
|
|
|
} catch (e: Exception) { |
|
|
|
toast(R.string.can_not_open) |
|
|
|
toast(R.string.can_not_open) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private fun shareText(title: String, text: String) { |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
val textIntent = Intent(Intent.ACTION_SEND) |
|
|
|
|
|
|
|
textIntent.setType("text/plain") |
|
|
|
|
|
|
|
textIntent.putExtra(Intent.EXTRA_TEXT, text) |
|
|
|
|
|
|
|
startActivity(Intent.createChooser(textIntent, title)) |
|
|
|
|
|
|
|
} catch (e: Exception) { |
|
|
|
|
|
|
|
toast(R.string.can_not_share) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |