kotlin 1.2.51, サイドメニューに「全てのカラムを閉じる」を追加。カラムを閉じるボタンの長押しでもいけます
This commit is contained in:
parent
1cc875f1f3
commit
ca4b0eb59b
|
@ -27,7 +27,6 @@ import android.support.design.widget.NavigationView
|
|||
import android.support.v4.view.GravityCompat
|
||||
import android.support.v4.widget.DrawerLayout
|
||||
import android.support.v7.app.AppCompatActivity
|
||||
import android.view.Menu
|
||||
import android.view.MenuItem
|
||||
import android.view.Window
|
||||
import android.view.WindowManager
|
||||
|
@ -555,7 +554,7 @@ class ActMain : AppCompatActivity()
|
|||
val posted_acct = this.posted_acct
|
||||
if(posted_acct?.isNotEmpty() == true) {
|
||||
|
||||
if( posted_redraft_id != 0L ) {
|
||||
if(posted_redraft_id != 0L) {
|
||||
val delm = posted_acct.indexOf('@')
|
||||
if(delm != - 1) {
|
||||
val host = posted_acct.substring(delm + 1)
|
||||
|
@ -565,7 +564,7 @@ class ActMain : AppCompatActivity()
|
|||
}
|
||||
posted_redraft_id = 0L
|
||||
}
|
||||
|
||||
|
||||
val refresh_after_toot = Pref.ipRefreshAfterToot(pref)
|
||||
if(refresh_after_toot != Pref.RAT_DONT_REFRESH) {
|
||||
for(column in app_state.column_list) {
|
||||
|
@ -751,7 +750,7 @@ class ActMain : AppCompatActivity()
|
|||
posted_acct = data.getStringExtra(ActPost.EXTRA_POSTED_ACCT)
|
||||
posted_status_id = data.getLongExtra(ActPost.EXTRA_POSTED_STATUS_ID, 0L)
|
||||
posted_reply_id = data.getStringExtra(ActPost.EXTRA_POSTED_REPLY_ID)
|
||||
posted_redraft_id= data.getLongExtra(ActPost.EXTRA_POSTED_REDRAFT_ID, 0L)
|
||||
posted_redraft_id = data.getLongExtra(ActPost.EXTRA_POSTED_REDRAFT_ID, 0L)
|
||||
|
||||
}
|
||||
|
||||
|
@ -944,6 +943,9 @@ class ActMain : AppCompatActivity()
|
|||
|
||||
// カラム
|
||||
R.id.nav_column_list -> Action_App.columnList(this)
|
||||
|
||||
R.id.nav_close_all_columns -> closeColumnAll()
|
||||
|
||||
R.id.nav_add_tl_home -> Action_Account.timeline(
|
||||
this,
|
||||
defaultInsertPosition,
|
||||
|
@ -1025,18 +1027,18 @@ class ActMain : AppCompatActivity()
|
|||
false,
|
||||
Column.TYPE_FOLLOW_REQUESTS
|
||||
)
|
||||
R.id.nav_follow_suggestion-> Action_Account.timeline(
|
||||
R.id.nav_follow_suggestion -> Action_Account.timeline(
|
||||
this,
|
||||
defaultInsertPosition,
|
||||
false,
|
||||
Column.TYPE_FOLLOW_SUGGESTION
|
||||
)
|
||||
// R.id.nav_add_trend_tag ->Action_Account.timeline(
|
||||
// this,
|
||||
// defaultInsertPosition,
|
||||
// true,
|
||||
// Column.TYPE_TREND_TAG
|
||||
// )
|
||||
// R.id.nav_add_trend_tag ->Action_Account.timeline(
|
||||
// this,
|
||||
// defaultInsertPosition,
|
||||
// true,
|
||||
// Column.TYPE_TREND_TAG
|
||||
// )
|
||||
|
||||
// トゥート検索
|
||||
R.id.mastodon_search_portal -> addColumn(
|
||||
|
@ -1101,7 +1103,7 @@ class ActMain : AppCompatActivity()
|
|||
|
||||
}
|
||||
|
||||
fun parseIconSize(stringPref: Pref.StringPref) : Int {
|
||||
fun parseIconSize(stringPref : Pref.StringPref) : Int {
|
||||
var icon_size_dp = stringPref.defVal.toFloat()
|
||||
try {
|
||||
sv = stringPref(pref)
|
||||
|
@ -1586,9 +1588,9 @@ class ActMain : AppCompatActivity()
|
|||
// subwaytooter://oauth/?...
|
||||
TootTaskRunner(this@ActMain).run(object : TootTask {
|
||||
|
||||
internal var ta : TootAccount? = null
|
||||
internal var sa : SavedAccount? = null
|
||||
internal var host : String? = null
|
||||
var ta : TootAccount? = null
|
||||
var sa : SavedAccount? = null
|
||||
var host : String? = null
|
||||
|
||||
override fun background(client : TootApiClient) : TootApiResult? {
|
||||
|
||||
|
@ -1781,7 +1783,7 @@ class ActMain : AppCompatActivity()
|
|||
|
||||
TootTaskRunner(this@ActMain).run(host, object : TootTask {
|
||||
|
||||
internal var ta : TootAccount? = null
|
||||
var ta : TootAccount? = null
|
||||
|
||||
override fun background(client : TootApiClient) : TootApiResult? {
|
||||
val result = client.getUserCredential(access_token)
|
||||
|
@ -1901,6 +1903,54 @@ class ActMain : AppCompatActivity()
|
|||
})
|
||||
}
|
||||
|
||||
fun closeColumnAll(
|
||||
_lastColumnIndex : Int = - 1,
|
||||
bConfirmed : Boolean = false
|
||||
) {
|
||||
|
||||
if(! bConfirmed) {
|
||||
AlertDialog.Builder(this)
|
||||
.setMessage(R.string.confirm_close_column_all)
|
||||
.setNegativeButton(R.string.cancel, null)
|
||||
.setPositiveButton(R.string.ok) { _, _ -> closeColumnAll(_lastColumnIndex, true) }
|
||||
.show()
|
||||
return
|
||||
}
|
||||
|
||||
var lastColumnIndex = when(_lastColumnIndex) {
|
||||
- 1 -> phoneTab(
|
||||
{ pe -> pe.pager.currentItem },
|
||||
{ _ -> 0 }
|
||||
)
|
||||
else -> _lastColumnIndex
|
||||
}
|
||||
|
||||
phoneOnly { env -> env.pager.adapter = null }
|
||||
|
||||
for(i in (0 until app_state.column_list.size).reversed()) {
|
||||
val column = app_state.column_list[i]
|
||||
if(column.dont_close) continue
|
||||
app_state.column_list.removeAt(i).dispose()
|
||||
if(lastColumnIndex >= i) -- lastColumnIndex
|
||||
}
|
||||
|
||||
phoneTab(
|
||||
{ env -> env.pager.adapter = env.pager_adapter },
|
||||
{ env -> resizeColumnWidth(env) }
|
||||
)
|
||||
|
||||
app_state.saveColumnList()
|
||||
updateColumnStrip()
|
||||
|
||||
if(app_state.column_list.isNotEmpty() && lastColumnIndex >= 0 && lastColumnIndex < app_state.column_list.size) {
|
||||
scrollToColumn(lastColumnIndex)
|
||||
val c = app_state.column_list[lastColumnIndex]
|
||||
if(! c.bFirstInitialized) {
|
||||
c.startLoading()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
// カラム追加系
|
||||
|
||||
|
@ -2312,7 +2362,7 @@ class ActMain : AppCompatActivity()
|
|||
val task = @SuppressLint("StaticFieldLeak") object :
|
||||
AsyncTask<Void, String, ArrayList<Column>?>() {
|
||||
|
||||
internal fun setProgressMessage(sv : String) {
|
||||
fun setProgressMessage(sv : String) {
|
||||
runOnMainLooper { progress.setMessage(sv) }
|
||||
}
|
||||
|
||||
|
|
|
@ -1452,15 +1452,15 @@ class Column(
|
|||
|
||||
val task = @SuppressLint("StaticFieldLeak")
|
||||
object : ColumnTask(ColumnTaskType.LOADING) {
|
||||
internal var parser = TootParser(context, access_info, highlightTrie = highlight_trie)
|
||||
var parser = TootParser(context, access_info, highlightTrie = highlight_trie)
|
||||
|
||||
internal var instance_tmp : TootInstance? = null
|
||||
var instance_tmp : TootInstance? = null
|
||||
|
||||
internal var list_pinned : ArrayList<TimelineItem>? = null
|
||||
var list_pinned : ArrayList<TimelineItem>? = null
|
||||
|
||||
internal var list_tmp : ArrayList<TimelineItem>? = null
|
||||
var list_tmp : ArrayList<TimelineItem>? = null
|
||||
|
||||
internal fun getInstanceInformation(
|
||||
fun getInstanceInformation(
|
||||
client : TootApiClient,
|
||||
instance_name : String?
|
||||
) : TootApiResult? {
|
||||
|
@ -1478,7 +1478,7 @@ class Column(
|
|||
return result
|
||||
}
|
||||
|
||||
internal fun getStatusesPinned(client : TootApiClient, path_base : String) {
|
||||
fun getStatusesPinned(client : TootApiClient, path_base : String) {
|
||||
val result = client.request(path_base)
|
||||
val jsonArray = result?.jsonArray
|
||||
if(jsonArray != null) {
|
||||
|
@ -1497,7 +1497,7 @@ class Column(
|
|||
log.d("getStatusesPinned: list size=%s", list_pinned?.size ?: - 1)
|
||||
}
|
||||
|
||||
internal fun getStatuses(client : TootApiClient, path_base : String) : TootApiResult? {
|
||||
fun getStatuses(client : TootApiClient, path_base : String) : TootApiResult? {
|
||||
|
||||
val time_start = SystemClock.elapsedRealtime()
|
||||
val result = client.request(path_base)
|
||||
|
@ -1556,7 +1556,7 @@ class Column(
|
|||
return result
|
||||
}
|
||||
|
||||
internal fun parseAccountList(
|
||||
fun parseAccountList(
|
||||
client : TootApiClient,
|
||||
path_base : String,
|
||||
emptyMessage : String? = null
|
||||
|
@ -1604,7 +1604,7 @@ class Column(
|
|||
return result
|
||||
}
|
||||
|
||||
internal fun parseDomainList(
|
||||
fun parseDomainList(
|
||||
client : TootApiClient,
|
||||
path_base : String
|
||||
) : TootApiResult? {
|
||||
|
@ -1616,7 +1616,7 @@ class Column(
|
|||
return result
|
||||
}
|
||||
|
||||
internal fun parseReports(client : TootApiClient, path_base : String) : TootApiResult? {
|
||||
fun parseReports(client : TootApiClient, path_base : String) : TootApiResult? {
|
||||
val result = client.request(path_base)
|
||||
if(result != null) {
|
||||
saveRange(result, true, true)
|
||||
|
@ -1625,7 +1625,7 @@ class Column(
|
|||
return result
|
||||
}
|
||||
|
||||
internal fun parseListList(
|
||||
fun parseListList(
|
||||
client : TootApiClient,
|
||||
path_base : String
|
||||
) : TootApiResult? {
|
||||
|
@ -1639,7 +1639,7 @@ class Column(
|
|||
return result
|
||||
}
|
||||
|
||||
internal fun parseNotifications(client : TootApiClient) : TootApiResult? {
|
||||
fun parseNotifications(client : TootApiClient) : TootApiResult? {
|
||||
val path_base = makeNotificationUrl()
|
||||
|
||||
val time_start = SystemClock.elapsedRealtime()
|
||||
|
@ -2218,11 +2218,11 @@ class Column(
|
|||
else -> ColumnTaskType.REFRESH_TOP
|
||||
}
|
||||
) {
|
||||
internal var parser = TootParser(context, access_info, highlightTrie = highlight_trie)
|
||||
var parser = TootParser(context, access_info, highlightTrie = highlight_trie)
|
||||
|
||||
internal var list_tmp : ArrayList<TimelineItem>? = null
|
||||
var list_tmp : ArrayList<TimelineItem>? = null
|
||||
|
||||
internal fun getAccountList(
|
||||
fun getAccountList(
|
||||
client : TootApiClient,
|
||||
path_base : String
|
||||
) : TootApiResult? {
|
||||
|
@ -2287,7 +2287,7 @@ class Column(
|
|||
return result
|
||||
}
|
||||
|
||||
internal fun getDomainList(
|
||||
fun getDomainList(
|
||||
client : TootApiClient,
|
||||
path_base : String
|
||||
) : TootApiResult? {
|
||||
|
@ -2339,7 +2339,7 @@ class Column(
|
|||
return result
|
||||
}
|
||||
|
||||
internal fun getListList(client : TootApiClient, path_base : String) : TootApiResult? {
|
||||
fun getListList(client : TootApiClient, path_base : String) : TootApiResult? {
|
||||
val time_start = SystemClock.elapsedRealtime()
|
||||
val delimiter = if(- 1 != path_base.indexOf('?')) '&' else '?'
|
||||
val last_since_id = since_id
|
||||
|
@ -2402,7 +2402,7 @@ class Column(
|
|||
return result
|
||||
}
|
||||
|
||||
internal fun getReportList(
|
||||
fun getReportList(
|
||||
client : TootApiClient,
|
||||
path_base : String
|
||||
) : TootApiResult? {
|
||||
|
@ -2466,7 +2466,7 @@ class Column(
|
|||
return result
|
||||
}
|
||||
|
||||
internal fun getNotificationList(client : TootApiClient) : TootApiResult? {
|
||||
fun getNotificationList(client : TootApiClient) : TootApiResult? {
|
||||
val path_base = makeNotificationUrl()
|
||||
val time_start = SystemClock.elapsedRealtime()
|
||||
val delimiter = if(- 1 != path_base.indexOf('?')) '&' else '?'
|
||||
|
@ -2586,7 +2586,7 @@ class Column(
|
|||
return result
|
||||
}
|
||||
|
||||
internal fun getStatusList(
|
||||
fun getStatusList(
|
||||
client : TootApiClient,
|
||||
path_base : String
|
||||
) : TootApiResult? {
|
||||
|
@ -3024,13 +3024,13 @@ class Column(
|
|||
|
||||
val task = @SuppressLint("StaticFieldLeak")
|
||||
object : ColumnTask(ColumnTaskType.GAP) {
|
||||
internal var max_id = gap.max_id
|
||||
internal val since_id = gap.since_id
|
||||
internal var list_tmp : ArrayList<TimelineItem>? = null
|
||||
var max_id = gap.max_id
|
||||
val since_id = gap.since_id
|
||||
var list_tmp : ArrayList<TimelineItem>? = null
|
||||
|
||||
internal var parser = TootParser(context, access_info, highlightTrie = highlight_trie)
|
||||
var parser = TootParser(context, access_info, highlightTrie = highlight_trie)
|
||||
|
||||
internal fun getAccountList(
|
||||
fun getAccountList(
|
||||
client : TootApiClient,
|
||||
path_base : String
|
||||
) : TootApiResult? {
|
||||
|
@ -3082,7 +3082,7 @@ class Column(
|
|||
return result
|
||||
}
|
||||
|
||||
internal fun getReportList(
|
||||
fun getReportList(
|
||||
client : TootApiClient,
|
||||
path_base : String
|
||||
) : TootApiResult? {
|
||||
|
@ -3132,7 +3132,7 @@ class Column(
|
|||
return result
|
||||
}
|
||||
|
||||
internal fun getNotificationList(client : TootApiClient) : TootApiResult? {
|
||||
fun getNotificationList(client : TootApiClient) : TootApiResult? {
|
||||
val path_base = makeNotificationUrl()
|
||||
|
||||
val time_start = SystemClock.elapsedRealtime()
|
||||
|
@ -3189,7 +3189,7 @@ class Column(
|
|||
return result
|
||||
}
|
||||
|
||||
internal fun getStatusList(
|
||||
fun getStatusList(
|
||||
client : TootApiClient,
|
||||
path_base : String
|
||||
) : TootApiResult? {
|
||||
|
|
|
@ -29,6 +29,7 @@ import android.support.v7.widget.ListRecyclerView
|
|||
import android.support.v7.widget.LinearLayoutManager
|
||||
import android.support.v7.widget.RecyclerView
|
||||
import android.text.SpannableStringBuilder
|
||||
import jp.juggler.subwaytooter.action.Action_App
|
||||
import jp.juggler.subwaytooter.util.*
|
||||
import jp.juggler.subwaytooter.view.ListDivider
|
||||
import java.io.Closeable
|
||||
|
@ -39,7 +40,7 @@ class ColumnViewHolder(
|
|||
viewRoot : View
|
||||
) : View.OnClickListener,
|
||||
SwipyRefreshLayout.OnRefreshListener,
|
||||
CompoundButton.OnCheckedChangeListener {
|
||||
CompoundButton.OnCheckedChangeListener, View.OnLongClickListener {
|
||||
|
||||
companion object {
|
||||
private val log = LogCategory("ColumnViewHolder")
|
||||
|
@ -256,6 +257,7 @@ class ColumnViewHolder(
|
|||
btnColumnSetting.setOnClickListener(this)
|
||||
btnColumnReload.setOnClickListener(this)
|
||||
btnColumnClose.setOnClickListener(this)
|
||||
btnColumnClose.setOnLongClickListener(this)
|
||||
btnDeleteNotification.setOnClickListener(this)
|
||||
|
||||
viewRoot.findViewById<View>(R.id.btnColor).setOnClickListener(this)
|
||||
|
@ -913,6 +915,18 @@ class ColumnViewHolder(
|
|||
|
||||
}
|
||||
|
||||
override fun onLongClick(v : View) : Boolean {
|
||||
return when(v.id){
|
||||
R.id.btnColumnClose-> {
|
||||
val idx = activity.app_state.column_list.indexOf(column)
|
||||
activity.closeColumnAll( idx )
|
||||
true
|
||||
}
|
||||
else->false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private fun showError(message : String) {
|
||||
tvLoading.visibility = View.VISIBLE
|
||||
tvLoading.text = message
|
||||
|
|
|
@ -23,6 +23,11 @@
|
|||
android:icon="?attr/ic_list"
|
||||
android:title="@string/column_list"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/nav_close_all_columns"
|
||||
android:icon="?attr/btn_close"
|
||||
android:title="@string/close_all_columns"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/nav_add_tl_home"
|
||||
android:icon="?attr/btn_home"
|
||||
|
|
|
@ -690,8 +690,10 @@
|
|||
<string name="post_button_tapped_repeatly">Post button was tapped repeatedly</string>
|
||||
<string name="regex_filter_matches_empty_string">regex filter matches to empty string.</string>
|
||||
<string name="follow_suggestion">Follow suggestion</string>
|
||||
<string name="close_all_columns">Close all columns</string>
|
||||
<string name="confirm_close_column_all">All columns (exclude protected) will be closed. Are tou sure?</string>
|
||||
|
||||
<!--<string name="abc_action_bar_home_description">Revenir à l\'accueil</string>-->
|
||||
<!--<string name="abc_action_bar_home_description">Revenir à l\'accueil</string>-->
|
||||
<!--<string name="abc_action_bar_home_description_format">%1$s, %2$s</string>-->
|
||||
<!--<string name="abc_action_bar_home_subtitle_description_format">%1$s, %2$s, %3$s</string>-->
|
||||
<!--<string name="abc_action_bar_up_description">Revenir en haut de la page</string>-->
|
||||
|
|
|
@ -968,5 +968,7 @@
|
|||
<string name="post_button_tapped_repeatly">投稿ボタンの連打を検出</string>
|
||||
<string name="regex_filter_matches_empty_string">正規表現フィルタは空文字列にマッチしてしまいます</string>
|
||||
<string name="follow_suggestion">フォロー推奨ユーザ</string>
|
||||
<string name="close_all_columns">全てのカラムを閉じる</string>
|
||||
<string name="confirm_close_column_all">(保護されていない)全てのカラムが閉じられます。よろしいですか?</string>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -675,4 +675,6 @@
|
|||
<string name="post_button_tapped_repeatly">Post button was tapped repeatedly</string>
|
||||
<string name="regex_filter_matches_empty_string">regex filter matches to empty string.</string>
|
||||
<string name="follow_suggestion">Follow suggestion</string>
|
||||
<string name="close_all_columns">Close all columns</string>
|
||||
<string name="confirm_close_column_all">All columns (exclude protected) will be closed. Are tou sure?</string>
|
||||
</resources>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
buildscript {
|
||||
|
||||
ext.kotlin_version = '1.2.50'
|
||||
ext.kotlin_version = '1.2.51'
|
||||
ext.kotlin_coroutines_version = '0.21.2'
|
||||
ext.anko_version='0.10.4'
|
||||
ext.asl_version='27.1.1'
|
||||
|
|
Loading…
Reference in New Issue