プラグインアプリの紹介を外部Webページに移動
This commit is contained in:
parent
49bd10561d
commit
861dae6de1
|
@ -281,8 +281,8 @@ fun ActPost.performMore() {
|
|||
openDraftPicker()
|
||||
}
|
||||
|
||||
action(getString(R.string.recommended_plugin)) {
|
||||
showRecommendedPlugin(null)
|
||||
action(getString(R.string.plugin_app_intro)) {
|
||||
openPluginList()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,19 +2,21 @@ package jp.juggler.subwaytooter.actpost
|
|||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import android.text.Spannable
|
||||
import android.text.SpannableStringBuilder
|
||||
import android.text.TextPaint
|
||||
import android.text.method.LinkMovementMethod
|
||||
import android.text.style.ClickableSpan
|
||||
import android.view.View
|
||||
import android.widget.EditText
|
||||
import android.widget.TextView
|
||||
import androidx.annotation.RawRes
|
||||
import androidx.annotation.StringRes
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import jp.juggler.subwaytooter.ActPost
|
||||
import jp.juggler.subwaytooter.R
|
||||
import jp.juggler.subwaytooter.util.DecodeOptions
|
||||
import jp.juggler.subwaytooter.util.LinkHelper
|
||||
import jp.juggler.util.data.decodeUTF8
|
||||
import jp.juggler.util.data.loadRawResource
|
||||
import jp.juggler.subwaytooter.databinding.DlgPluginMissingBinding
|
||||
import jp.juggler.util.log.LogCategory
|
||||
import jp.juggler.util.ui.attrColor
|
||||
|
||||
private val log = LogCategory("ActPostMushroom")
|
||||
|
||||
|
@ -24,42 +26,38 @@ fun ActPost.resetMushroom() {
|
|||
states.mushroomEnd = 0
|
||||
}
|
||||
|
||||
@SuppressLint("InflateParams")
|
||||
suspend fun ActPost.showRecommendedPlugin(title: String?) {
|
||||
|
||||
@RawRes val resId = when (getString(R.string.language_code)) {
|
||||
"ja" -> R.raw.recommended_plugin_ja
|
||||
"fr" -> R.raw.recommended_plugin_fr
|
||||
else -> R.raw.recommended_plugin_en
|
||||
}
|
||||
|
||||
this.loadRawResource(resId).let { data ->
|
||||
val text = data.decodeUTF8()
|
||||
val viewRoot = layoutInflater.inflate(R.layout.dlg_plugin_missing, null, false)
|
||||
|
||||
val tvText = viewRoot.findViewById<TextView>(R.id.tvText)
|
||||
|
||||
val sv = DecodeOptions(this, linkHelper = LinkHelper.unknown).decodeHTML(text)
|
||||
|
||||
tvText.text = sv
|
||||
tvText.movementMethod = LinkMovementMethod.getInstance()
|
||||
|
||||
val tvTitle = viewRoot.findViewById<TextView>(R.id.tvTitle)
|
||||
if (title?.isEmpty() != false) {
|
||||
tvTitle.visibility = View.GONE
|
||||
} else {
|
||||
tvTitle.text = title
|
||||
}
|
||||
|
||||
AlertDialog.Builder(this)
|
||||
.setView(viewRoot)
|
||||
.setCancelable(true)
|
||||
.setNeutralButton(R.string.close, null)
|
||||
.show()
|
||||
}
|
||||
fun ActPost.openPluginList(){
|
||||
val url = "https://github.com/tateisu/SubwayTooter/wiki/Simeji-Mushroom-Plugins"
|
||||
startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(url)))
|
||||
}
|
||||
|
||||
suspend fun ActPost.openMushroom() {
|
||||
fun ActPost.showRecommendedPlugin(@StringRes titleId: Int) {
|
||||
val linkCaption = getString(R.string.plugin_app_intro)
|
||||
val linkSpan = object : ClickableSpan() {
|
||||
override fun onClick(view: View) = openPluginList()
|
||||
override fun updateDrawState(ds: TextPaint) {
|
||||
super.updateDrawState(ds)
|
||||
ds.color = attrColor(R.attr.colorLink)
|
||||
}
|
||||
}
|
||||
|
||||
val views = DlgPluginMissingBinding.inflate(layoutInflater)
|
||||
views.tvText.movementMethod = LinkMovementMethod.getInstance()
|
||||
views.tvText.text = SpannableStringBuilder().apply {
|
||||
val spanStart = length
|
||||
append(linkCaption)
|
||||
val spanEnd = length
|
||||
setSpan(linkSpan, spanStart, spanEnd, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
|
||||
}
|
||||
AlertDialog.Builder(this).apply {
|
||||
setTitle(titleId)
|
||||
setView(views.root)
|
||||
setCancelable(true)
|
||||
setPositiveButton(R.string.ok, null)
|
||||
}.show()
|
||||
}
|
||||
|
||||
fun ActPost.openMushroom() {
|
||||
try {
|
||||
var text: String? = null
|
||||
when {
|
||||
|
@ -94,14 +92,14 @@ suspend fun ActPost.openMushroom() {
|
|||
|
||||
// Verify the intent will resolve to at least one activity
|
||||
if (intent.resolveActivity(packageManager) == null) {
|
||||
showRecommendedPlugin(getString(R.string.plugin_not_installed))
|
||||
showRecommendedPlugin(R.string.plugin_not_installed)
|
||||
return
|
||||
}
|
||||
|
||||
arMushroom.launch(chooser)
|
||||
} catch (ex: Throwable) {
|
||||
log.e(ex, "openMushroom failed.")
|
||||
showRecommendedPlugin(getString(R.string.plugin_not_installed))
|
||||
showRecommendedPlugin(R.string.plugin_not_installed)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,40 +1,17 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ScrollView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:scrollbarStyle="outsideOverlay"
|
||||
>
|
||||
<LinearLayout
|
||||
android:clipToPadding="false"
|
||||
android:fadeScrollbars="false"
|
||||
android:padding="12dp"
|
||||
android:scrollbarStyle="outsideOverlay">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="12dp"
|
||||
android:id="@+id/tvTitle"
|
||||
android:textStyle="bold"
|
||||
android:textSize="20sp"
|
||||
tools:text="tvTitle"
|
||||
/>
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="12dp"
|
||||
android:text="@string/recommended_plugin"
|
||||
android:textSize="16sp"
|
||||
/>
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="12dp"
|
||||
android:id="@+id/tvText"
|
||||
android:textSize="16sp"
|
||||
tools:text="tvText"
|
||||
/>
|
||||
</LinearLayout>
|
||||
android:textSize="16sp"
|
||||
tools:text="tvText" />
|
||||
</ScrollView>
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
<html lang="en"><ul
|
||||
><li>SupportText Free <a href="https://play.google.com/store/apps/details?id=com.z589.supporttext">https://play.google.com/store/apps/details?id=com.z589.supporttext</a></li
|
||||
><li>ANdClip Free <a href="https://play.google.com/store/apps/details?id=com.amazing_create.android.andclipfree">https://play.google.com/store/apps/details?id=com.amazing_create.android.andclipfree</a></li
|
||||
><li>Contact Picker <a href="https://play.google.com/store/apps/details?id=jp.narikitic.android.mushroom.contactPicker">https://play.google.com/store/apps/details?id=jp.narikitic.android.mushroom.contactPicker</a></li
|
||||
><li>Facemark Generator Mushroom <a href="https://play.google.com/store/apps/details?id=jp.rgfx_currentdir_ozero.facegenmush">https://play.google.com/store/apps/details?id=jp.rgfx_currentdir_ozero.facegenmush</a></li
|
||||
></ul></html>
|
|
@ -1,9 +0,0 @@
|
|||
<html lang="fr"><ul
|
||||
><li>SupportText Free <a href="https://play.google.com/store/apps/details?id=com.z589.supporttext">https://play.google.com/store/apps/details?id=com.z589.supporttext</a></li
|
||||
><li>ANdClip Free <a href="https://play.google.com/store/apps/details?id=com.amazing_create.android.andclipfree">https://play.google.com/store/apps/details?id=com.amazing_create.android.andclipfree</a></li
|
||||
><li>Contact Picker <a href="https://play.google.com/store/apps/details?id=jp.narikitic.android.mushroom.contactPicker">https://play.google.com/store/apps/details?id=jp.narikitic.android.mushroom.contactPicker</a></li
|
||||
><li>AntiSearchEngine <a href="https://play.google.com/store/apps/details?id=jp.Keshigoto.AntiSearchEngine">https://play.google.com/store/apps/details?id=jp.Keshigoto.AntiSearchEngine</a></li
|
||||
><li>Emoji Mush <a href="https://play.google.com/store/apps/details?id=jp.mstssk.emoji_mush">https://play.google.com/store/apps/details?id=jp.mstssk.emoji_mush</a></li
|
||||
><li>Facemark Generator Mushroom <a href="https://play.google.com/store/apps/details?id=jp.rgfx_currentdir_ozero.facegenmush">https://play.google.com/store/apps/details?id=jp.rgfx_currentdir_ozero.facegenmush</a></li
|
||||
><li>Tagifier <a href="https://play.google.com/store/apps/details?id=jp.wktk.tagifier">https://play.google.com/store/apps/details?id=jp.wktk.tagifier</a></li
|
||||
></ul></html>
|
|
@ -1,6 +0,0 @@
|
|||
<html lang="ja"><ul
|
||||
><li>SupportText Free <a href="https://play.google.com/store/apps/details?id=com.z589.supporttext">https://play.google.com/store/apps/details?id=com.z589.supporttext</a></li
|
||||
><li>ANdClip Free <a href="https://play.google.com/store/apps/details?id=com.amazing_create.android.andclipfree">https://play.google.com/store/apps/details?id=com.amazing_create.android.andclipfree</a></li
|
||||
><li>Contact Picker <a href="https://play.google.com/store/apps/details?id=jp.narikitic.android.mushroom.contactPicker">https://play.google.com/store/apps/details?id=jp.narikitic.android.mushroom.contactPicker</a></li
|
||||
><li>顔文字コピー <a href="https://play.google.com/store/apps/details?id=jp.neoscorp.android.kaomoji">https://play.google.com/store/apps/details?id=jp.neoscorp.android.kaomoji</a></li
|
||||
></ul></html>
|
|
@ -473,7 +473,6 @@
|
|||
<string name="copy_account_id">انسح معرّف الحساب %1$s</string>
|
||||
<string name="open_in_admin_ui">افتحه على واجهة الويب الإدارية</string>
|
||||
<string name="visibility_account_setting">تتبّع إعداد الحساب</string>
|
||||
<string name="recommended_plugin">الإضافات المستحسَنة</string>
|
||||
<string name="not_blocked">غير محجوب.</string>
|
||||
<string name="profile_directory">دليل الحسابات</string>
|
||||
<string name="unspecified">غير محدد</string>
|
||||
|
|
|
@ -378,7 +378,6 @@
|
|||
<string name="select_plugin">Selecciona el connector</string>
|
||||
<string name="plugin_not_installed">El connector no s\'ha instal·lat.</string>
|
||||
<string name="language_code">ca</string>
|
||||
<string name="recommended_plugin">Connector recomanat</string>
|
||||
<string name="tablet_mode">Mode de tauleta</string>
|
||||
<string name="appearance">Aspecte</string>
|
||||
<string name="performance">Rendiment</string>
|
||||
|
|
|
@ -1009,7 +1009,6 @@
|
|||
<string name="performance">Leistung</string>
|
||||
<string name="appearance">Aussehen</string>
|
||||
<string name="tablet_mode">Tabletmodus</string>
|
||||
<string name="recommended_plugin">Empfohlenes Plugin</string>
|
||||
<string name="language_code">en</string>
|
||||
<string name="plugin_not_installed">Plugin ist nicht installiert.</string>
|
||||
<string name="select_plugin">Plugin auswählen</string>
|
||||
|
|
|
@ -352,7 +352,6 @@
|
|||
<string name="select_plugin">Sélection du plugin</string>
|
||||
<string name="plugin_not_installed">Plugin non installé.</string>
|
||||
<string name="language_code">fr</string>
|
||||
<string name="recommended_plugin">Plugins recommandés</string>
|
||||
<string name="appearance">Apparence</string>
|
||||
<string name="behavior">Comportement</string>
|
||||
<string name="notification_on_off_desc">Il existe également un paramètre de compte pour activer ou désactiver les notifications.</string>
|
||||
|
|
|
@ -412,7 +412,6 @@
|
|||
<string name="plugin">תוסף</string>
|
||||
<string name="select_plugin">בחר תוסף</string>
|
||||
<string name="plugin_not_installed">התוסף לא הותקן.</string>
|
||||
<string name="recommended_plugin">תוסף מומלץ</string>
|
||||
<string name="tablet_mode">מצב מחשב לוח</string>
|
||||
<string name="appearance">מראה</string>
|
||||
<string name="performance">ביצועים</string>
|
||||
|
|
|
@ -583,7 +583,6 @@
|
|||
<string name="reaction_remove">リアクションの削除</string>
|
||||
<string name="read_gap">ギャップを読む</string>
|
||||
<string name="reading_api">読込中: %1$s %2$s</string>
|
||||
<string name="recommended_plugin">おすすめプラグイン</string>
|
||||
<string name="redraft_and_delete">削除して再編集</string>
|
||||
<string name="refresh_after_toot">投稿後の更新</string>
|
||||
<string name="refresh_no_scroll">更新するがスクロールしない</string>
|
||||
|
@ -1271,4 +1270,5 @@
|
|||
<string name="disabled">無効</string>
|
||||
<string name="emoji_texture_pixels">絵文字テクスチャの最大ピクセル数(単位:ピクセル、デフォルト: 128。 タスクキルが必要。端末のRAMが少ない場合は64程度まで下げることをお勧めします)</string>
|
||||
<string name="emoji_picker_category_collapse">絵文字ピッカーのカテゴリを折りたたむ(サーバーに多くの絵文字がある場合はオフにすると非常に遅くなります)</string>
|
||||
<string name="plugin_app_intro">プラグインアプリの紹介</string>
|
||||
</resources>
|
||||
|
|
|
@ -361,7 +361,6 @@
|
|||
<string name="select_plugin">플러그인 선택</string>
|
||||
<string name="plugin_not_installed">플러그인 설치 안 됨.</string>
|
||||
<string name="language_code">ko</string>
|
||||
<string name="recommended_plugin">추천 플러그인</string>
|
||||
<string name="tablet_mode">태블릿 모드</string>
|
||||
<string name="appearance">모양새</string>
|
||||
<string name="performance">성능</string>
|
||||
|
|
|
@ -287,7 +287,6 @@
|
|||
<string name="plugin">Programtillegg</string>
|
||||
<string name="select_plugin">Velg programtillegg</string>
|
||||
<string name="plugin_not_installed">Programtillegg ikke installert.</string>
|
||||
<string name="recommended_plugin">Anbefalt programtillegg</string>
|
||||
<string name="tablet_mode">Nettbrettsmodus</string>
|
||||
<string name="appearance">Utseende</string>
|
||||
<string name="performance">Ytelse</string>
|
||||
|
|
|
@ -368,7 +368,6 @@
|
|||
<string name="select_plugin">Selecteer plugin</string>
|
||||
<string name="plugin_not_installed">Plugin is niet geïnstalleerd.</string>
|
||||
<string name="language_code">nl</string>
|
||||
<string name="recommended_plugin">Aanbevolen plugin</string>
|
||||
<string name="tablet_mode">Tabletmodus</string>
|
||||
<string name="appearance">Vormgeving</string>
|
||||
<string name="performance">Prestaties</string>
|
||||
|
|
|
@ -109,7 +109,6 @@
|
|||
<string name="performance">性能</string>
|
||||
<string name="appearance">外观</string>
|
||||
<string name="tablet_mode">平板模式</string>
|
||||
<string name="recommended_plugin">推荐的插件</string>
|
||||
<string name="plugin_not_installed">插件未安装。</string>
|
||||
<string name="select_plugin">选择插件</string>
|
||||
<string name="plugin">插件</string>
|
||||
|
|
|
@ -381,7 +381,6 @@
|
|||
<string name="select_plugin">Select plugin</string>
|
||||
<string name="plugin_not_installed">Plugin not installed.</string>
|
||||
<string name="language_code">en</string>
|
||||
<string name="recommended_plugin">Recommended plugin</string>
|
||||
<string name="tablet_mode">Tablet mode</string>
|
||||
<string name="appearance">Appearance</string>
|
||||
<string name="performance">Performance</string>
|
||||
|
@ -1279,4 +1278,5 @@
|
|||
<string name="emoji_texture_pixels">Emoji texture max pixels(Unix:pixels, default: 128. task kill required. reduce to 64 if your device\'s RAM is not enough)</string>
|
||||
<string name="emoji_picker_category_collapse">Collapse emoji picker categories (turning off it will very slow if your servers has a lot of emojis)</string>
|
||||
<string name="unfollow_hashtag_confirm">unfollow hashtag \"%1$s\"?</string>
|
||||
<string name="plugin_app_intro">Introduction to plug-in apps</string>
|
||||
</resources>
|
||||
|
|
|
@ -30,3 +30,5 @@ android.enableJetifier=true
|
|||
android.debug.obsoleteApi=true
|
||||
|
||||
org.gradle.unsafe.configuration-cache=false
|
||||
android.defaults.buildfeatures.buildconfig=true
|
||||
android.enableBuildConfigAsBytecode=true
|
||||
|
|
Loading…
Reference in New Issue