mirror of
https://github.com/tateisu/SubwayTooter
synced 2025-02-01 11:26:48 +01:00
カラム一覧画面で、保護されたカラムをスワイプしたら確認ダイアログを出して削除する
This commit is contained in:
parent
3d880896e5
commit
63a9a666e9
@ -13,11 +13,14 @@ import com.woxthebox.draglistview.DragListView
|
||||
import com.woxthebox.draglistview.swipe.ListSwipeHelper
|
||||
import com.woxthebox.draglistview.swipe.ListSwipeItem
|
||||
import jp.juggler.subwaytooter.api.entity.Acct
|
||||
import jp.juggler.subwaytooter.api.showApiError
|
||||
import jp.juggler.subwaytooter.column.ColumnEncoder
|
||||
import jp.juggler.subwaytooter.column.ColumnType
|
||||
import jp.juggler.subwaytooter.databinding.ActColumnListBinding
|
||||
import jp.juggler.subwaytooter.databinding.LvColumnListBinding
|
||||
import jp.juggler.subwaytooter.dialog.DlgConfirm.confirm
|
||||
import jp.juggler.util.backPressed
|
||||
import jp.juggler.util.coroutine.launchMain
|
||||
import jp.juggler.util.data.JsonObject
|
||||
import jp.juggler.util.data.notZero
|
||||
import jp.juggler.util.data.toJsonArray
|
||||
@ -113,13 +116,22 @@ class ActColumnList : AppCompatActivity() {
|
||||
) {
|
||||
// 左にスワイプした(右端に青が見えた) なら要素を削除する
|
||||
if (swipedDirection == ListSwipeItem.SwipeDirection.LEFT) {
|
||||
val adapterItem = (item.tag as MyViewHolder).lastItem!!
|
||||
if (adapterItem.json.optBoolean(ColumnEncoder.KEY_DONT_CLOSE, false)) {
|
||||
showToast(false, R.string.column_has_dont_close_option)
|
||||
views.listView.resetSwipedViews(null)
|
||||
return
|
||||
val adapterItem = (item.tag as MyViewHolder).lastItem ?:return
|
||||
launchMain {
|
||||
try{
|
||||
if (adapterItem.json.optBoolean(ColumnEncoder.KEY_DONT_CLOSE, false)) {
|
||||
confirm(R.string.confirm_remove_column_mark_as_dont_close)
|
||||
}
|
||||
listAdapter.removeItem(listAdapter.getPositionForItem(adapterItem))
|
||||
}catch(ex:Throwable){
|
||||
showApiError(ex)
|
||||
}finally {
|
||||
try {
|
||||
views.listView.resetSwipedViews(null)
|
||||
}catch(_:Throwable) {
|
||||
}
|
||||
}
|
||||
}
|
||||
listAdapter.removeItem(listAdapter.getPositionForItem(adapterItem))
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -1188,6 +1188,7 @@
|
||||
<string name="server_host_name_cant_contains_it">ホスト名に使えない文字が含まれています。[%1$s]</string>
|
||||
<string name="next_step">次へ</string>
|
||||
<string name="user_creation_not_supported">[%1$s, %2$s] サーバ種別はアプリからのユーザ登録に対応していません。</string>
|
||||
<string name="confirm_remove_column_mark_as_dont_close">保護されたカラムですが、削除しますか?</string>
|
||||
|
||||
</resources>
|
||||
|
||||
|
@ -1195,4 +1195,5 @@
|
||||
<string name="server_host_name_cant_contains_it">host name can\'t contains [%1$s].</string>
|
||||
<string name="next_step">Next step</string>
|
||||
<string name="user_creation_not_supported">[%1$s, %2$s] server type does not support user registration from app.</string>
|
||||
<string name="confirm_remove_column_mark_as_dont_close">Remove column that mark as \"don\'t close\" ?</string>
|
||||
</resources>
|
||||
|
Loading…
x
Reference in New Issue
Block a user