From 79fe9608c0f9e2b66e71ff00e8234094ff8a1bcf Mon Sep 17 00:00:00 2001 From: tateisu Date: Thu, 10 Oct 2019 00:21:58 +0900 Subject: [PATCH] =?UTF-8?q?=E3=80=8C=E3=82=A2=E3=83=97=E3=83=AA=E8=A8=AD?= =?UTF-8?q?=E5=AE=9A/=E3=82=BF=E3=83=96=E3=83=AC=E3=83=83=E3=83=88?= =?UTF-8?q?=E3=83=A2=E3=83=BC=E3=83=89/=E7=B0=A1=E6=98=93=E6=8A=95?= =?UTF-8?q?=E7=A8=BF=E3=81=A7=E3=82=82=E5=8F=AF=E8=83=BD=E3=81=AA=E3=82=89?= =?UTF-8?q?=E3=82=A2=E3=82=AB=E3=82=A6=E3=83=B3=E3=83=88=E9=81=B8=E6=8A=9E?= =?UTF-8?q?=E3=82=92=E7=9C=81=E7=95=A5=E3=81=99=E3=82=8B=E3=80=8D=E3=82=92?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/jp/juggler/subwaytooter/ActMain.kt | 21 ++++++++++++------- .../main/java/jp/juggler/subwaytooter/Pref.kt | 6 ++++++ .../res/layout/act_app_setting_tablet.xml | 18 ++++++++++++++++ app/src/main/res/values-ja/strings.xml | 1 + app/src/main/res/values/strings.xml | 1 + 5 files changed, 40 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/jp/juggler/subwaytooter/ActMain.kt b/app/src/main/java/jp/juggler/subwaytooter/ActMain.kt index 04cc4de3..bece6866 100644 --- a/app/src/main/java/jp/juggler/subwaytooter/ActMain.kt +++ b/app/src/main/java/jp/juggler/subwaytooter/ActMain.kt @@ -337,7 +337,7 @@ class ActMain : AppCompatActivity() ) private val TabletEnv.visibleColumnsIndices : IntRange - get(){ + get() { var vs = tablet_layout_manager.findFirstVisibleItemPosition() var ve = tablet_layout_manager.findLastVisibleItemPosition() if(vs == RecyclerView.NO_POSITION || ve == RecyclerView.NO_POSITION) { @@ -356,10 +356,10 @@ class ActMain : AppCompatActivity() private val TabletEnv.visibleColumns : List get() = visibleColumnsIndices - .mapNotNull{ - try{ + .mapNotNull { + try { app_state.column_list[it] - } catch(ex:Throwable){ + } catch(ex : Throwable) { null } } @@ -872,7 +872,14 @@ class ActMain : AppCompatActivity() private fun performQuickPost(account : SavedAccount?) { if(account == null) { - val a = currentPostTarget + val a = if(tabletEnv != null && ! Pref.bpQuickTootOmitAccountSelection(pref)) { + // タブレットモードでオプションが無効なら + // 簡易投稿は常にアカウント選択する + null + } else { + currentPostTarget + } + if(a != null && ! a.isPseudo) { performQuickPost(a) } else { @@ -1084,7 +1091,7 @@ class ActMain : AppCompatActivity() } catch(ex : Throwable) { } }, { env -> - visibleColumnList.addAll( env.visibleColumns ) + visibleColumnList.addAll(env.visibleColumns) }) return visibleColumnList.filter { ! it.dont_close } @@ -1522,7 +1529,7 @@ class ActMain : AppCompatActivity() val ve = env.tablet_layout_manager.findLastVisibleItemPosition() val vr = if(vs == RecyclerView.NO_POSITION || ve == RecyclerView.NO_POSITION) { IntRange(- 1, - 2) // empty and less than zero - }else{ + } else { IntRange(vs, min(ve, vs + nScreenColumn - 1)) } var slide_ratio = 0f diff --git a/app/src/main/java/jp/juggler/subwaytooter/Pref.kt b/app/src/main/java/jp/juggler/subwaytooter/Pref.kt index 8fbe7fbb..5df28bce 100644 --- a/app/src/main/java/jp/juggler/subwaytooter/Pref.kt +++ b/app/src/main/java/jp/juggler/subwaytooter/Pref.kt @@ -436,6 +436,12 @@ object Pref { R.id.swEnablePixelfed ) + val bpQuickTootOmitAccountSelection = BooleanPref( + "QuickTootOmitAccountSelection", + false, + R.id.swQuickTootOmitAccountSelection + ) + // int val ipBackButtonAction = IntPref("back_button_action", 0) diff --git a/app/src/main/res/layout/act_app_setting_tablet.xml b/app/src/main/res/layout/act_app_setting_tablet.xml index e764a701..6b9c7ddc 100644 --- a/app/src/main/res/layout/act_app_setting_tablet.xml +++ b/app/src/main/res/layout/act_app_setting_tablet.xml @@ -76,6 +76,24 @@ + + + + + + + + + + + diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index b05a2eb5..dd7c6760 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -954,5 +954,6 @@ 追加のアクション ドメイン全体をブロック \"%1$s\" サーバへのアクション + 簡易投稿でも可能ならアカウント選択を省略する diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 6607491f..c20921cf 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -949,4 +949,5 @@ Extra actions Block whole domain Actions for the server \"%1$s\" + When using quick toot, omit account selection if possible \ No newline at end of file