子画面のタイトルバーのandroidx Toolbar移行

This commit is contained in:
tateisu 2023-01-15 05:37:23 +09:00
parent 4e17ba14fa
commit 60bb5f7e7a
102 changed files with 3463 additions and 3618 deletions

View File

@ -293,7 +293,7 @@
<activity
android:name=".ActNickname"
android:exported="false"
android:label="@string/nickname_and_color_and_notification_sound"
android:label="@string/acct_customize"
android:windowSoftInputMode="adjustResize|stateAlwaysHidden" />
<activity
@ -305,7 +305,7 @@
<activity
android:name=".ActMediaViewer"
android:exported="false"
android:theme="@style/AppTheme.Dark.NoActionBar" />
android:theme="@style/AppTheme.Dark" />
<activity
android:name=".ActExitReasons"
@ -323,7 +323,7 @@
<meta-data
android:name="com.google.firebase.messaging.default_notification_color"
android:resource="@color/Light_colorAccent" />
android:resource="@color/Light_colorAppCompatAccent" />
<meta-data
android:name="android.allow_multiple_resumed_activities"

View File

@ -6,12 +6,13 @@ import android.os.Bundle
import android.view.Gravity
import android.widget.Button
import android.widget.LinearLayout
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.widget.AppCompatButton
import jp.juggler.subwaytooter.databinding.ActAboutBinding
import jp.juggler.subwaytooter.util.openBrowser
import jp.juggler.util.getPackageInfoCompat
import jp.juggler.util.log.LogCategory
import jp.juggler.util.ui.setNavigationBack
class ActAbout : AppCompatActivity() {
@ -70,25 +71,27 @@ class ActAbout : AppCompatActivity() {
)
}
private val views by lazy {
ActAboutBinding.inflate(layoutInflater)
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
App1.setActivityTheme(this)
setContentView(R.layout.act_about)
App1.initEdgeToEdge(this)
fixHorizontalPadding(findViewById(R.id.svContent))
setContentView(views.root)
setSupportActionBar(views.toolbar)
setNavigationBack(views.toolbar)
fixHorizontalMargin(views.svContent)
try {
packageManager.getPackageInfoCompat(packageName)?.let { pInfo ->
findViewById<TextView>(R.id.tvVersion)
?.text = getString(R.string.version_is, pInfo.versionName)
views.tvVersion.text = getString(R.string.version_is, pInfo.versionName)
}
} catch (ex: Throwable) {
log.e(ex, "can't get app version.")
}
fun setButton(btnId: Int, caption: String, onClick: () -> Unit) {
val b: Button = findViewById(btnId)
fun setButton(b: Button, caption: String, onClick: () -> Unit) {
b.text = caption
b.setOnClickListener { onClick() }
}
@ -99,29 +102,28 @@ class ActAbout : AppCompatActivity() {
}
setButton(
R.id.btnDeveloper,
views.btnDeveloper,
getString(R.string.search_for, developer_acct)
) { searchAcct(developer_acct) }
setButton(
R.id.btnOfficialAccount,
views.btnOfficialAccount,
getString(R.string.search_for, official_acct)
) {
searchAcct(official_acct)
}
) { searchAcct(official_acct) }
setButton(R.id.btnReleaseNote, url_release) {
openBrowser(url_release)
}
setButton(
views.btnReleaseNote,
url_release
) { openBrowser(url_release) }
// setButton(R.id.btnIconDesign, url_futaba)
// { openUrl(url_futaba) }
setButton(R.id.btnWeblate, getString(R.string.please_help_translation)) {
setButton(views.btnWeblate, getString(R.string.please_help_translation)) {
openBrowser(url_weblate)
}
val ll = findViewById<LinearLayout>(R.id.llContributors)
val ll = views.llContributors
val density = resources.displayMetrics.density
val marginTop = (0.5f + density * 8).toInt()
val padding = (0.5f + density * 8).toInt()

View File

@ -61,7 +61,6 @@ class ActAccountSetting : AppCompatActivity(),
View.OnClickListener,
CompoundButton.OnCheckedChangeListener,
AdapterView.OnItemSelectedListener {
companion object {
internal val log = LogCategory("ActAccountSetting")
@ -122,7 +121,9 @@ class ActAccountSetting : AppCompatActivity(),
lateinit var account: SavedAccount
private lateinit var viewBinding: ActAccountSettingBinding
private val viewBinding by lazy {
ActAccountSettingBinding.inflate(layoutInflater, null, false)
}
private lateinit var nameInvalidator: NetworkEmojiInvalidator
private lateinit var noteInvalidator: NetworkEmojiInvalidator
@ -218,11 +219,13 @@ class ActAccountSetting : AppCompatActivity(),
initUI()
val a = SavedAccount.loadAccount(this, intent.getLongExtra(KEY_ACCOUNT_DB_ID, -1L))
val a = intent.long(KEY_ACCOUNT_DB_ID)
?.let { SavedAccount.loadAccount(this, it) }
if (a == null) {
finish()
return
}
supportActionBar?.subtitle = a.acct.pretty
loadUIFromData(a)
@ -248,11 +251,9 @@ class ActAccountSetting : AppCompatActivity(),
private fun initUI() {
this.density = resources.displayMetrics.density
this.handler = App1.getAppState(this).handler
this.viewBinding = ActAccountSettingBinding.inflate(layoutInflater, null, false)
setContentView(viewBinding.root)
App1.initEdgeToEdge(this)
fixHorizontalPadding(viewBinding.root)
setSupportActionBar(viewBinding.toolbar)
fixHorizontalPadding(viewBinding.svContent)
setSwitchColor(viewBinding.root)
viewBinding.apply {

View File

@ -152,7 +152,7 @@ class ActAppSetting : AppCompatActivity(), ColorPickerDialogListener, View.OnCli
arTimelineFont.register(this)
arTimelineFontBold.register(this)
App1.setActivityTheme(this, noActionBar = true)
App1.setActivityTheme(this)
this.handler = App1.getAppState(this).handler
this.pref = pref()
@ -180,7 +180,6 @@ class ActAppSetting : AppCompatActivity(), ColorPickerDialogListener, View.OnCli
private fun initUi() {
setContentView(views.root)
App1.initEdgeToEdge(this)
fixHorizontalPadding0(views.llContent)

View File

@ -107,10 +107,10 @@ class ActCallback : AppCompatActivity() {
private fun copyExtraTexts(dst: Intent, src: Intent) {
var sv: String?
//
sv = src.getStringExtra(Intent.EXTRA_TEXT)
sv = src.string(Intent.EXTRA_TEXT)
if (sv != null) dst.putExtra(Intent.EXTRA_TEXT, sv)
//
sv = src.getStringExtra(Intent.EXTRA_SUBJECT)
sv = src.string(Intent.EXTRA_SUBJECT)
if (sv != null) dst.putExtra(Intent.EXTRA_SUBJECT, sv)
}
@ -175,7 +175,7 @@ class ActCallback : AppCompatActivity() {
// Swarmアプリから送られたインテントは getType()==null だが EXTRA_TEXT は含まれている
// EXTRA_TEXT の存在を確認してからtypeがnullもしくは text/plain なら受け取る
val sv = src.getStringExtra(Intent.EXTRA_TEXT)
val sv = src.string(Intent.EXTRA_TEXT)
if (sv?.isNotEmpty() == true && (type == null || type.startsWith("text/"))) {
val dst = Intent(action)
dst.type = "text/plain"

View File

@ -10,10 +10,8 @@ import android.text.Editable
import android.text.TextWatcher
import android.view.View
import android.view.inputmethod.EditorInfo
import android.widget.EditText
import android.widget.ImageView
import android.widget.SeekBar
import android.widget.TextView
import androidx.annotation.ColorInt
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.ViewCompat
@ -22,9 +20,11 @@ import com.jrummyapps.android.colorpicker.ColorPickerDialogListener
import jp.juggler.subwaytooter.api.TootApiResult
import jp.juggler.subwaytooter.api.runApiTask
import jp.juggler.subwaytooter.column.*
import jp.juggler.subwaytooter.databinding.ActColumnCustomizeBinding
import jp.juggler.util.backPressed
import jp.juggler.util.coroutine.launchMain
import jp.juggler.util.data.*
import jp.juggler.util.int
import jp.juggler.util.log.LogCategory
import jp.juggler.util.log.showToast
import jp.juggler.util.log.withCaption
@ -32,6 +32,7 @@ import jp.juggler.util.media.createResizedBitmap
import jp.juggler.util.ui.ActivityResultHandler
import jp.juggler.util.ui.hideKeyboard
import jp.juggler.util.ui.isNotOk
import jp.juggler.util.ui.setNavigationBack
import org.jetbrains.anko.textColor
import java.io.File
import java.io.FileOutputStream
@ -65,15 +66,9 @@ class ActColumnCustomize : AppCompatActivity(), View.OnClickListener, ColorPicke
internal lateinit var appState: AppState
internal var density: Float = 0f
private lateinit var flColumnBackground: View
internal lateinit var ivColumnBackground: ImageView
internal lateinit var sbColumnBackgroundAlpha: SeekBar
private lateinit var llColumnHeader: View
private lateinit var ivColumnHeader: ImageView
private lateinit var tvColumnName: TextView
internal lateinit var etAlpha: EditText
private lateinit var tvSampleAcct: TextView
private lateinit var tvSampleContent: TextView
private val views by lazy {
ActColumnCustomizeBinding.inflate(layoutInflater)
}
internal var loadingBusy: Boolean = false
@ -104,7 +99,7 @@ class ActColumnCustomize : AppCompatActivity(), View.OnClickListener, ColorPicke
appState = App1.getAppState(this)
density = appState.density
columnIndex = intent.getIntExtra(EXTRA_COLUMN_INDEX, 0)
columnIndex = intent.int(EXTRA_COLUMN_INDEX) ?: 0
column = appState.column(columnIndex)!!
show()
}
@ -294,36 +289,31 @@ class ActColumnCustomize : AppCompatActivity(), View.OnClickListener, ColorPicke
}
private fun initUI() {
setContentView(R.layout.act_column_customize)
App1.initEdgeToEdge(this)
setContentView(views.root)
setSupportActionBar(views.toolbar)
setNavigationBack(views.toolbar)
fixHorizontalMargin(views.svContent)
fixHorizontalPadding(findViewById(R.id.svContent))
arrayOf(
views.btnHeaderBackgroundEdit,
views.btnHeaderBackgroundReset,
views.btnHeaderTextEdit,
views.btnHeaderTextReset,
views.btnColumnBackgroundColor,
views.btnColumnBackgroundColorReset,
views.btnColumnBackgroundImage,
views.btnColumnBackgroundImageReset,
views.btnAcctColor,
views.btnAcctColorReset,
views.btnContentColor,
views.btnContentColorReset,
).forEach {
it.setOnClickListener(this)
}
llColumnHeader = findViewById(R.id.llColumnHeader)
ivColumnHeader = findViewById(R.id.ivColumnHeader)
tvColumnName = findViewById(R.id.tvColumnName)
flColumnBackground = findViewById(R.id.flColumnBackground)
ivColumnBackground = findViewById(R.id.ivColumnBackground)
tvSampleAcct = findViewById(R.id.tvSampleAcct)
tvSampleContent = findViewById(R.id.tvSampleContent)
views.sbColumnBackgroundAlpha.max = PROGRESS_MAX
findViewById<View>(R.id.btnHeaderBackgroundEdit).setOnClickListener(this)
findViewById<View>(R.id.btnHeaderBackgroundReset).setOnClickListener(this)
findViewById<View>(R.id.btnHeaderTextEdit).setOnClickListener(this)
findViewById<View>(R.id.btnHeaderTextReset).setOnClickListener(this)
findViewById<View>(R.id.btnColumnBackgroundColor).setOnClickListener(this)
findViewById<View>(R.id.btnColumnBackgroundColorReset).setOnClickListener(this)
findViewById<View>(R.id.btnColumnBackgroundImage).setOnClickListener(this)
findViewById<View>(R.id.btnColumnBackgroundImageReset).setOnClickListener(this)
findViewById<View>(R.id.btnAcctColor).setOnClickListener(this)
findViewById<View>(R.id.btnAcctColorReset).setOnClickListener(this)
findViewById<View>(R.id.btnContentColor).setOnClickListener(this)
findViewById<View>(R.id.btnContentColorReset).setOnClickListener(this)
sbColumnBackgroundAlpha = findViewById(R.id.sbColumnBackgroundAlpha)
sbColumnBackgroundAlpha.max = PROGRESS_MAX
sbColumnBackgroundAlpha.setOnSeekBarChangeListener(object :
views.sbColumnBackgroundAlpha.setOnSeekBarChangeListener(object :
SeekBar.OnSeekBarChangeListener {
override fun onStartTrackingTouch(seekBar: SeekBar) {}
@ -333,8 +323,8 @@ class ActColumnCustomize : AppCompatActivity(), View.OnClickListener, ColorPicke
if (loadingBusy) return
if (!fromUser) return
column.columnBgImageAlpha = progress / PROGRESS_MAX.toFloat()
ivColumnBackground.alpha = column.columnBgImageAlpha
etAlpha.setText(
views.ivColumnBackground.alpha = column.columnBgImageAlpha
views.etAlpha.setText(
String.format(
defaultLocale(this@ActColumnCustomize),
"%.4f",
@ -344,8 +334,7 @@ class ActColumnCustomize : AppCompatActivity(), View.OnClickListener, ColorPicke
}
})
etAlpha = findViewById(R.id.etAlpha)
etAlpha.addTextChangedListener(object : TextWatcher {
views.etAlpha.addTextChangedListener(object : TextWatcher {
override fun beforeTextChanged(s: CharSequence, start: Int, count: Int, after: Int) {}
override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) {}
@ -355,14 +344,14 @@ class ActColumnCustomize : AppCompatActivity(), View.OnClickListener, ColorPicke
try {
var f = NumberFormat.getInstance(defaultLocale(this@ActColumnCustomize))
.parse(etAlpha.text.toString())?.toFloat()
.parse(views.etAlpha.text.toString())?.toFloat()
if (f != null && !f.isNaN()) {
if (f < 0f) f = 0f
if (f > 1f) f = 1f
column.columnBgImageAlpha = f
ivColumnBackground.alpha = column.columnBgImageAlpha
sbColumnBackgroundAlpha.progress = (0.5f + f * PROGRESS_MAX).toInt()
views.ivColumnBackground.alpha = column.columnBgImageAlpha
views.sbColumnBackgroundAlpha.progress = (0.5f + f * PROGRESS_MAX).toInt()
}
} catch (ex: Throwable) {
log.e(ex, "alpha parse failed.")
@ -370,10 +359,10 @@ class ActColumnCustomize : AppCompatActivity(), View.OnClickListener, ColorPicke
}
})
etAlpha.setOnEditorActionListener { _, actionId, _ ->
views.etAlpha.setOnEditorActionListener { _, actionId, _ ->
when (actionId) {
EditorInfo.IME_ACTION_DONE -> {
etAlpha.hideKeyboard()
views.etAlpha.hideKeyboard()
true
}
@ -386,19 +375,19 @@ class ActColumnCustomize : AppCompatActivity(), View.OnClickListener, ColorPicke
try {
loadingBusy = true
column.setHeaderBackground(llColumnHeader)
column.setHeaderBackground(views.llColumnHeader)
val c = column.getHeaderNameColor()
tvColumnName.textColor = c
ivColumnHeader.setImageResource(column.getIconId())
ivColumnHeader.imageTintList = ColorStateList.valueOf(c)
views.tvColumnName.textColor = c
views.ivColumnHeader.setImageResource(column.getIconId())
views.ivColumnHeader.imageTintList = ColorStateList.valueOf(c)
tvColumnName.text = column.getColumnName(false)
views.tvColumnName.text = column.getColumnName(false)
if (column.columnBgColor != 0) {
flColumnBackground.setBackgroundColor(column.columnBgColor)
views.flColumnBackground.setBackgroundColor(column.columnBgColor)
} else {
ViewCompat.setBackground(flColumnBackground, null)
ViewCompat.setBackground(views.flColumnBackground, null)
}
var alpha = column.columnBgImageAlpha
@ -406,10 +395,10 @@ class ActColumnCustomize : AppCompatActivity(), View.OnClickListener, ColorPicke
alpha = 1f
column.columnBgImageAlpha = alpha
}
ivColumnBackground.alpha = alpha
sbColumnBackgroundAlpha.progress = (0.5f + alpha * PROGRESS_MAX).toInt()
views.ivColumnBackground.alpha = alpha
views.sbColumnBackgroundAlpha.progress = (0.5f + alpha * PROGRESS_MAX).toInt()
etAlpha.setText(
views.etAlpha.setText(
String.format(
defaultLocale(this@ActColumnCustomize),
"%.4f",
@ -417,10 +406,10 @@ class ActColumnCustomize : AppCompatActivity(), View.OnClickListener, ColorPicke
)
)
loadImage(ivColumnBackground, column.columnBgImage)
loadImage(views.ivColumnBackground, column.columnBgImage)
tvSampleAcct.setTextColor(column.getAcctColor())
tvSampleContent.setTextColor(column.getContentColor())
views.tvSampleAcct.setTextColor(column.getAcctColor())
views.tvSampleContent.setTextColor(column.getContentColor())
} finally {
loadingBusy = false
}
@ -428,7 +417,7 @@ class ActColumnCustomize : AppCompatActivity(), View.OnClickListener, ColorPicke
private fun closeBitmaps() {
try {
ivColumnBackground.setImageDrawable(null)
views.ivColumnBackground.setImageDrawable(null)
lastImageUri = null
lastImageBitmap?.recycle()

View File

@ -6,8 +6,6 @@ import android.content.Intent
import android.os.Bundle
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import com.woxthebox.draglistview.DragItem
import com.woxthebox.draglistview.DragItemAdapter
@ -17,22 +15,27 @@ import com.woxthebox.draglistview.swipe.ListSwipeItem
import jp.juggler.subwaytooter.api.entity.Acct
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.util.backPressed
import jp.juggler.util.data.JsonObject
import jp.juggler.util.data.notZero
import jp.juggler.util.data.toJsonArray
import jp.juggler.util.int
import jp.juggler.util.log.LogCategory
import jp.juggler.util.log.showToast
import jp.juggler.util.ui.activity
import jp.juggler.util.ui.attrColor
import jp.juggler.util.ui.setNavigationBack
import jp.juggler.util.ui.vg
class ActColumnList : AppCompatActivity() {
companion object {
private val log = LogCategory("ActColumnList")
internal const val TMP_FILE_COLUMN_LIST = "tmp_column_list"
private const val TMP_FILE_COLUMN_LIST = "tmp_column_list"
// リザルトに使うのでpublic
const val EXTRA_ORDER = "order"
const val EXTRA_SELECTION = "selection"
@ -44,90 +47,76 @@ class ActColumnList : AppCompatActivity() {
}
}
private lateinit var listView: DragListView
private lateinit var listAdapter: MyListAdapter
private val views by lazy {
ActColumnListBinding.inflate(layoutInflater)
}
private val listAdapter by lazy { MyListAdapter() }
private val defaultNameColor by lazy {
attrColor(R.attr.colorColumnListItemText)
}
private var oldSelection: Int = 0
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
backPressed {
makeResult(-1)
finish()
}
super.onCreate(savedInstanceState)
App1.setActivityTheme(this)
initUI()
if (savedInstanceState != null) {
restoreData(savedInstanceState.getInt(EXTRA_SELECTION))
restoreData(savedInstanceState.int(EXTRA_SELECTION) ?: -1)
} else {
val intent = intent
restoreData(intent.getIntExtra(EXTRA_SELECTION, -1))
restoreData(intent?.int(EXTRA_SELECTION) ?: -1)
}
}
override fun onSaveInstanceState(outState: Bundle) {
super.onSaveInstanceState(outState)
outState.putInt(EXTRA_SELECTION, oldSelection)
val array = listAdapter.itemList.map { it.json }.toJsonArray()
AppState.saveColumnList(this, TMP_FILE_COLUMN_LIST, array)
}
private fun initUI() {
setContentView(R.layout.act_column_list)
App1.initEdgeToEdge(this)
fixHorizontalPadding0(findViewById(R.id.llContent))
// リストのアダプター
listAdapter = MyListAdapter()
setContentView(views.root)
setSupportActionBar(views.toolbar)
setNavigationBack(views.toolbar)
fixHorizontalMargin(views.llContent)
// ハンドル部分をドラッグで並べ替えできるRecyclerView
listView = findViewById(R.id.drag_list_view)
listView.setLayoutManager(androidx.recyclerview.widget.LinearLayoutManager(this))
listView.setAdapter(listAdapter, true)
listView.setCanDragHorizontally(false)
listView.setCustomDragItem(MyDragItem(this, R.layout.lv_column_list))
views.listView.setLayoutManager(androidx.recyclerview.widget.LinearLayoutManager(this))
views.listView.setAdapter(listAdapter, true)
views.listView.setCanDragHorizontally(false)
views.listView.setCustomDragItem(MyDragItem(this))
listView.recyclerView.isVerticalScrollBarEnabled = true
listView.setDragListListener(object : DragListView.DragListListenerAdapter() {
override fun onItemDragStarted(position: Int) {
// 操作中はリフレッシュ禁止
// mRefreshLayout.setEnabled( false );
}
override fun onItemDragEnded(fromPosition: Int, toPosition: Int) {
// 操作完了でリフレッシュ許可
// mRefreshLayout.setEnabled( USE_SWIPE_REFRESH );
// if( fromPosition != toPosition ){
// // 並べ替えが発生した
// }
}
views.listView.recyclerView.isVerticalScrollBarEnabled = true
views.listView.setDragListListener(object : DragListView.DragListListenerAdapter() {
override fun onItemDragStarted(position: Int) = Unit
override fun onItemDragEnded(fromPosition: Int, toPosition: Int) = Unit
})
// リストを左右スワイプした
listView.setSwipeListener(object : ListSwipeHelper.OnSwipeListenerAdapter() {
override fun onItemSwipeStarted(item: ListSwipeItem) {
// 操作中はリフレッシュ禁止
// mRefreshLayout.setEnabled( false );
}
views.listView.setSwipeListener(object : ListSwipeHelper.OnSwipeListenerAdapter() {
override fun onItemSwipeStarted(item: ListSwipeItem) = Unit
override fun onItemSwipeEnded(
item: ListSwipeItem,
swipedDirection: ListSwipeItem.SwipeDirection?,
) {
// 操作完了でリフレッシュ許可
// mRefreshLayout.setEnabled( USE_SWIPE_REFRESH );
// 左にスワイプした(右端に青が見えた) なら要素を削除する
if (swipedDirection == ListSwipeItem.SwipeDirection.LEFT) {
val adapterItem = item.tag as MyItem
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)
listView.resetSwipedViews(null)
views.listView.resetSwipedViews(null)
return
}
listAdapter.removeItem(listAdapter.getPositionForItem(adapterItem))
@ -137,29 +126,27 @@ class ActColumnList : AppCompatActivity() {
}
private fun restoreData(ivSelection: Int) {
this.oldSelection = ivSelection
val tmpList = ArrayList<MyItem>()
try {
AppState.loadColumnList(this, TMP_FILE_COLUMN_LIST)
?.objectList()
?.forEachIndexed { index, src ->
try {
val item = MyItem(src, index.toLong(), this)
tmpList.add(item)
if (oldSelection == item.oldIndex) {
item.setOldSelection(true)
oldSelection = ivSelection
// DragItemAdapter はMutableListを要求する
listAdapter.itemList = ArrayList<MyItem>().apply {
try {
AppState.loadColumnList(applicationContext, TMP_FILE_COLUMN_LIST)
?.objectList()
?.forEachIndexed { index, src ->
try {
val item = MyItem(src, index.toLong(), defaultNameColor)
add(item)
if (oldSelection == item.oldIndex) {
item.setOldSelection(true)
}
} catch (ex: Throwable) {
log.e(ex, "restoreData: item decode failed.")
}
} catch (ex: Throwable) {
log.e(ex, "restoreData: item decode failed.")
}
}
} catch (ex: Throwable) {
log.e(ex, "restoreData failed.")
} catch (ex: Throwable) {
log.e(ex, "restoreData failed.")
}
}
listAdapter.itemList = tmpList
}
private fun makeResult(newSelection: Int) {
@ -190,14 +177,15 @@ class ActColumnList : AppCompatActivity() {
setResult(Activity.RESULT_OK, intent)
}
private fun performItemSelected(item: MyItem) {
private fun performItemSelected(item: MyItem?) {
item ?: return
val idx = listAdapter.getPositionForItem(item)
makeResult(idx)
finish()
}
// リスト要素のデータ
internal class MyItem(val json: JsonObject, val id: Long, context: Context) {
internal class MyItem(val json: JsonObject, val id: Long, defaultNameColor: Int) {
val name: String = json.optString(ColumnEncoder.KEY_COLUMN_NAME)
val acct: Acct = Acct.parse(json.optString(ColumnEncoder.KEY_COLUMN_ACCESS_ACCT))
@ -206,7 +194,7 @@ class ActColumnList : AppCompatActivity() {
val type = ColumnType.parse(json.optInt(ColumnEncoder.KEY_TYPE))
val acctColorBg = json.optInt(ColumnEncoder.KEY_COLUMN_ACCESS_COLOR_BG, 0)
val acctColorFg = json.optInt(ColumnEncoder.KEY_COLUMN_ACCESS_COLOR, 0)
.notZero() ?: context.attrColor(R.attr.colorColumnListItemText)
.notZero() ?: defaultNameColor
var bOldSelection: Boolean = false
fun setOldSelection(b: Boolean) {
@ -215,88 +203,73 @@ class ActColumnList : AppCompatActivity() {
}
// リスト要素のViewHolder
internal inner class MyViewHolder(viewRoot: View) : DragItemAdapter.ViewHolder(
viewRoot,
private inner class MyViewHolder(
parent: ViewGroup?,
val views: LvColumnListBinding =
LvColumnListBinding.inflate(layoutInflater, parent, false),
) : DragItemAdapter.ViewHolder(
views.root,
R.id.ivDragHandle, // View ID。 ここを押すとドラッグ操作をすぐに開始する
true, // 長押しでドラッグ開始するなら真
) {
private val ivBookmark: View = viewRoot.findViewById(R.id.ivBookmark)
private val tvAccess: TextView = viewRoot.findViewById(R.id.tvAccess)
private val tvName: TextView = viewRoot.findViewById(R.id.tvName)
private val ivColumnIcon: ImageView = viewRoot.findViewById(R.id.ivColumnIcon)
private val acctPadLr = (0.5f + 4f * viewRoot.resources.displayMetrics.density).toInt()
var lastItem: MyItem? = null
val acctPadLr = (0.5f + 4f * views.root.resources.displayMetrics.density).toInt()
init {
// リスト要素のビューが ListSwipeItem だった場合、Swipe操作を制御できる
if (viewRoot is ListSwipeItem) {
viewRoot.setSwipeInStyle(ListSwipeItem.SwipeInStyle.SLIDE)
viewRoot.supportedSwipeDirection = ListSwipeItem.SwipeDirection.LEFT
}
views.root.tag = this
views.root.setSwipeInStyle(ListSwipeItem.SwipeInStyle.SLIDE)
views.root.supportedSwipeDirection = ListSwipeItem.SwipeDirection.LEFT
}
fun bind(item: MyItem) {
itemView.tag = item // itemView は親クラスのメンバ変数
ivBookmark.visibility = if (item.bOldSelection) View.VISIBLE else View.INVISIBLE
tvAccess.text = item.acctName
tvAccess.setTextColor(item.acctColorFg)
tvAccess.setBackgroundColor(item.acctColorBg)
tvAccess.setPaddingRelative(acctPadLr, 0, acctPadLr, 0)
tvName.text = item.name
ivColumnIcon.setImageResource(item.type.iconId(item.acct))
fun bind(item: MyItem?) {
item ?: return
lastItem = item
views.ivSelected.vg(item.bOldSelection)
views.tvAccess.text = item.acctName
views.tvAccess.setTextColor(item.acctColorFg)
views.tvAccess.setBackgroundColor(item.acctColorBg)
views.tvAccess.setPaddingRelative(acctPadLr, 0, acctPadLr, 0)
views.tvName.text = item.name
views.ivColumnIcon.setImageResource(item.type.iconId(item.acct))
// 背景色がテーマ次第なので、カラム設定の色を反映するとアイコンが見えなくなる可能性がある
// よってアイコンやテキストにカラム設定の色を反映しない
}
// @Override
// public boolean onItemLongClicked( View view ){
// return false;
// }
override fun onItemClicked(view: View?) {
val item = itemView.tag as MyItem // itemView は親クラスのメンバ変数
(view.activity as? ActColumnList)?.performItemSelected(item)
performItemSelected(lastItem)
}
}
// ドラッグ操作中のデータ
private inner class MyDragItem(context: Context, layoutId: Int) :
DragItem(context, layoutId) {
private inner class MyDragItem(context: Context) : DragItem(context, R.layout.lv_column_list) {
override fun onBindDragView(clickedView: View, dragView: View) {
val item = clickedView.tag as MyItem
val dragViews = LvColumnListBinding.bind(dragView)
val clickVh = clickedView.tag as MyViewHolder
val clickViews = clickVh.views
val item = clickVh.lastItem!!
var tv: TextView = dragView.findViewById(R.id.tvAccess)
tv.text = item.acctName
tv.setTextColor(item.acctColorFg)
tv.setBackgroundColor(item.acctColorBg)
dragViews.tvAccess.run {
text = item.acctName
setTextColor(item.acctColorFg)
setBackgroundColor(item.acctColorBg)
}
tv = dragView.findViewById(R.id.tvName)
tv.text = item.name
val ivColumnIcon: ImageView = dragView.findViewById(R.id.ivColumnIcon)
ivColumnIcon.setImageResource(item.type.iconId(item.acct))
dragView.findViewById<View>(R.id.ivBookmark).visibility =
clickedView.findViewById<View>(R.id.ivBookmark).visibility
dragView.findViewById<View>(R.id.item_layout)
.setBackgroundColor(attrColor(R.attr.list_item_bg_pressed_dragged))
dragViews.tvName.text = item.name
dragViews.ivColumnIcon.setImageResource(item.type.iconId(item.acct))
dragViews.ivSelected.visibility = clickViews.ivSelected.visibility
dragViews.itemLayout.setBackgroundColor(attrColor(R.attr.list_item_bg_pressed_dragged))
}
}
private inner class MyListAdapter :
DragItemAdapter<MyItem, MyViewHolder>() {
private inner class MyListAdapter : DragItemAdapter<MyItem, MyViewHolder>() {
init {
setHasStableIds(true)
itemList = ArrayList()
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MyViewHolder {
val view = layoutInflater.inflate(R.layout.lv_column_list, parent, false)
return MyViewHolder(view)
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MyViewHolder =
MyViewHolder(parent)
override fun onBindViewHolder(holder: MyViewHolder, position: Int) {
super.onBindViewHolder(holder, position)

View File

@ -5,12 +5,13 @@ import android.view.View
import android.view.ViewGroup
import android.widget.BaseAdapter
import android.widget.ImageView
import android.widget.ListView
import android.widget.TextView
import jp.juggler.subwaytooter.databinding.ActDrawableListBinding
import jp.juggler.util.coroutine.AppDispatchers
import jp.juggler.util.coroutine.AsyncActivity
import jp.juggler.util.data.asciiPattern
import jp.juggler.util.log.LogCategory
import jp.juggler.util.ui.setNavigationBack
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
@ -25,7 +26,10 @@ class ActDrawableList : AsyncActivity(), CoroutineScope {
private val drawableList = ArrayList<MyItem>()
private lateinit var adapter: MyAdapter
private lateinit var listView: ListView
private val views by lazy {
ActDrawableListBinding.inflate(layoutInflater)
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
@ -35,13 +39,13 @@ class ActDrawableList : AsyncActivity(), CoroutineScope {
}
private fun initUI() {
setContentView(R.layout.act_drawable_list)
App1.initEdgeToEdge(this)
fixHorizontalPadding(findViewById(R.id.llContent))
setContentView(views.root)
setSupportActionBar(views.toolbar)
fixHorizontalMargin(views.listView)
setNavigationBack(views.toolbar)
listView = findViewById(R.id.listView)
adapter = MyAdapter()
listView.adapter = adapter
views.listView.adapter = adapter
}
private fun load() = launch {

View File

@ -8,14 +8,15 @@ import android.os.Bundle
import android.view.View
import android.view.ViewGroup
import android.widget.BaseAdapter
import android.widget.ListView
import android.widget.TextView
import androidx.annotation.RequiresApi
import androidx.appcompat.app.AppCompatActivity
import jp.juggler.subwaytooter.api.entity.TootStatus
import jp.juggler.util.log.LogCategory
import jp.juggler.subwaytooter.databinding.ActExitReasonsBinding
import jp.juggler.util.data.decodeUTF8
import jp.juggler.util.log.LogCategory
import jp.juggler.util.log.withCaption
import jp.juggler.util.ui.setNavigationBack
@RequiresApi(Build.VERSION_CODES.R)
class ActExitReasons : AppCompatActivity() {
@ -71,14 +72,19 @@ class ActExitReasons : AppCompatActivity() {
}
}
private lateinit var listView: ListView
private val views by lazy {
ActExitReasonsBinding.inflate(layoutInflater)
}
private lateinit var adapter: MyAdapter
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
App1.setActivityTheme(this)
setContentView(R.layout.act_exit_reasons)
App1.initEdgeToEdge(this)
setContentView(views.root)
setSupportActionBar(views.toolbar)
setNavigationBack(views.toolbar)
fixHorizontalPadding(views.listView)
val am = getSystemService(ActivityManager::class.java)
if (am == null) {
@ -87,13 +93,12 @@ class ActExitReasons : AppCompatActivity() {
return
}
this.listView = findViewById(R.id.listView)
this.adapter = MyAdapter()
adapter.list = am.getHistoricalProcessExitReasons(null, 0, 200)
.filterNotNull()
.toList()
listView.adapter = adapter
views.listView.adapter = adapter
}
class MyViewHolder(val viewRoot: View) {

View File

@ -1,21 +1,20 @@
package jp.juggler.subwaytooter
import android.content.Context
import android.os.Bundle
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import android.widget.BaseAdapter
import androidx.appcompat.app.AppCompatActivity
import com.woxthebox.draglistview.DragItem
import com.woxthebox.draglistview.DragItemAdapter
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.databinding.ActWordListBinding
import jp.juggler.subwaytooter.databinding.LvMuteAppBinding
import jp.juggler.subwaytooter.dialog.DlgConfirm.confirm
import jp.juggler.subwaytooter.table.FavMute
import jp.juggler.util.backPressed
import jp.juggler.util.coroutine.launchAndShowError
import jp.juggler.util.data.cast
import jp.juggler.util.log.LogCategory
import jp.juggler.util.ui.attrColor
import jp.juggler.util.ui.setNavigationBack
class ActFavMute : AppCompatActivity() {
@ -23,8 +22,11 @@ class ActFavMute : AppCompatActivity() {
private val log = LogCategory("ActFavMute")
}
private lateinit var listView: DragListView
private lateinit var listAdapter: MyListAdapter
private val views by lazy {
ActWordListBinding.inflate(layoutInflater)
}
private val listAdapter by lazy { MyListAdapter() }
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
@ -38,160 +40,83 @@ class ActFavMute : AppCompatActivity() {
}
private fun initUI() {
setContentView(R.layout.act_word_list)
App1.initEdgeToEdge(this)
setContentView(views.root)
setSupportActionBar(views.toolbar)
setNavigationBack(views.toolbar)
fixHorizontalMargin(views.llContent)
views.tvFooterDesc.text = getString(R.string.fav_muted_user_desc)
views.listView.adapter = listAdapter
}
fixHorizontalPadding0(findViewById(R.id.llContent))
// リストのアダプター
listAdapter = MyListAdapter()
// ハンドル部分をドラッグで並べ替えできるRecyclerView
listView = findViewById(R.id.drag_list_view)
listView.setLayoutManager(androidx.recyclerview.widget.LinearLayoutManager(this))
listView.setAdapter(listAdapter, false)
listView.setCanDragHorizontally(true)
listView.isDragEnabled = false
listView.setCustomDragItem(MyDragItem(this, R.layout.lv_mute_app))
listView.recyclerView.isVerticalScrollBarEnabled = true
// listView.setDragListListener( new DragListView.DragListListenerAdapter() {
// @Override
// public void onItemDragStarted( int position ){
// // 操作中はリフレッシュ禁止
// // mRefreshLayout.setEnabled( false );
// }
//
// @Override
// public void onItemDragEnded( int fromPosition, int toPosition ){
// // 操作完了でリフレッシュ許可
// // mRefreshLayout.setEnabled( USE_SWIPE_REFRESH );
//
//// if( fromPosition != toPosition ){
//// // 並べ替えが発生した
//// }
// }
// } );
// リストを左右スワイプした
listView.setSwipeListener(object : ListSwipeHelper.OnSwipeListenerAdapter() {
override fun onItemSwipeStarted(item: ListSwipeItem?) {
// 操作中はリフレッシュ禁止
// mRefreshLayout.setEnabled( false );
}
override fun onItemSwipeEnded(
item: ListSwipeItem?,
swipedDirection: ListSwipeItem.SwipeDirection?,
) {
// 操作完了でリフレッシュ許可
// mRefreshLayout.setEnabled( USE_SWIPE_REFRESH );
// 左にスワイプした(右端に青が見えた) なら要素を削除する
if (swipedDirection == ListSwipeItem.SwipeDirection.LEFT) {
val o = item?.tag
if (o is MyItem) {
FavMute.delete(o.name)
listAdapter.removeItem(listAdapter.getPositionForItem(o))
}
}
}
})
private fun delete(item: MyItem?) {
item ?: return
launchAndShowError {
confirm(R.string.delete_confirm, item.acct.pretty)
FavMute.delete(item.acct)
listAdapter.remove(item)
}
}
private fun loadData() {
val tmpList = ArrayList<MyItem>()
try {
FavMute.createCursor().use { cursor ->
val idxId = cursor.getColumnIndex(FavMute.COL_ID)
val idxName = cursor.getColumnIndex(FavMute.COL_ACCT)
while (cursor.moveToNext()) {
val id = cursor.getLong(idxId)
val name = cursor.getString(idxName)
val item = MyItem(id, Acct.parse(name))
tmpList.add(item)
listAdapter.items = buildList {
try {
FavMute.createCursor().use { cursor ->
val idxId = cursor.getColumnIndex(FavMute.COL_ID)
val idxName = cursor.getColumnIndex(FavMute.COL_ACCT)
while (cursor.moveToNext()) {
val item = MyItem(
id = cursor.getLong(idxId),
acct = Acct.parse(cursor.getString(idxName)),
)
add(item)
}
}
} catch (ex: Throwable) {
log.e(ex, "loadData failed.")
}
} catch (ex: Throwable) {
log.e(ex, "loadData failed.")
}
listAdapter.itemList = tmpList
}
// リスト要素のデータ
internal class MyItem(val id: Long, val name: Acct)
internal class MyItem(val id: Long, val acct: Acct)
// リスト要素のViewHolder
internal class MyViewHolder(viewRoot: View) :
DragItemAdapter.ViewHolder(viewRoot, R.id.ivDragHandle, false) {
private inner class MyViewHolder(parent: ViewGroup?) {
val views = LvMuteAppBinding.inflate(layoutInflater, parent, false)
val tvName: TextView
private var lastItem: MyItem? = null
init {
views.root.tag = this
views.btnDelete.setOnClickListener { delete(lastItem) }
}
tvName = viewRoot.findViewById(R.id.tvName)
fun bind(item: MyItem?) {
item ?: return
lastItem = item
views.tvName.text = item.acct.pretty
}
}
// リスト要素のビューが ListSwipeItem だった場合、Swipe操作を制御できる
if (viewRoot is ListSwipeItem) {
viewRoot.setSwipeInStyle(ListSwipeItem.SwipeInStyle.SLIDE)
viewRoot.supportedSwipeDirection = ListSwipeItem.SwipeDirection.LEFT
private inner class MyListAdapter : BaseAdapter() {
var items: List<MyItem> = emptyList()
set(value) {
field = value
notifyDataSetChanged()
}
} // View ID。 ここを押すとドラッグ操作をすぐに開始する
// 長押しでドラッグ開始するなら真
fun bind(item: MyItem) {
itemView.tag = item // itemView は親クラスのメンバ変数
tvName.text = item.name.pretty
fun remove(item: MyItem) {
items = items.filter { it != item }
}
// @Override
// public boolean onItemLongClicked( View view ){
// return false;
// }
override fun getCount() = items.size
override fun getItem(position: Int) = items.elementAtOrNull(position)
override fun getItemId(position: Int) = 0L
override fun getView(position: Int, convertView: View?, parent: ViewGroup?) =
(convertView?.tag?.cast() ?: MyViewHolder(parent))
.also { it.bind(items.elementAtOrNull(position)) }
.views.root
// @Override
// public void onItemClicked( View view ){
// }
}
// ドラッグ操作中のデータ
private inner class MyDragItem(context: Context, layoutId: Int) :
DragItem(context, layoutId) {
override fun onBindDragView(clickedView: View, dragView: View) {
dragView.findViewById<TextView>(R.id.tvName).text =
clickedView.findViewById<TextView>(R.id.tvName).text
dragView.findViewById<View>(R.id.item_layout)
.setBackgroundColor(attrColor(R.attr.list_item_bg_pressed_dragged))
}
}
private inner class MyListAdapter :
DragItemAdapter<MyItem, MyViewHolder>() {
init {
setHasStableIds(true)
itemList = ArrayList()
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MyViewHolder {
val view = layoutInflater.inflate(R.layout.lv_mute_app, parent, false)
return MyViewHolder(view)
}
override fun onBindViewHolder(holder: MyViewHolder, position: Int) {
super.onBindViewHolder(holder, position)
holder.bind(itemList[position])
}
override fun getUniqueItemId(position: Int): Long {
val item = mItemList[position] // mItemList は親クラスのメンバ変数
return item.id
}
override fun isEnabled(position: Int) = false
}
}

View File

@ -6,13 +6,11 @@ import android.content.Intent
import android.graphics.Color
import android.media.RingtoneManager
import android.os.Bundle
import android.view.View
import android.widget.CompoundButton
import android.widget.EditText
import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.widget.SwitchCompat
import com.jrummyapps.android.colorpicker.ColorPickerDialog
import com.jrummyapps.android.colorpicker.ColorPickerDialogListener
import jp.juggler.subwaytooter.databinding.ActHighlightEditBinding
import jp.juggler.subwaytooter.table.HighlightWord
import jp.juggler.util.backPressed
import jp.juggler.util.data.decodeJsonObject
@ -21,14 +19,13 @@ import jp.juggler.util.data.notEmpty
import jp.juggler.util.data.notZero
import jp.juggler.util.log.LogCategory
import jp.juggler.util.log.showToast
import jp.juggler.util.ui.ActivityResultHandler
import jp.juggler.util.ui.attrColor
import jp.juggler.util.ui.decodeRingtonePickerResult
import jp.juggler.util.long
import jp.juggler.util.string
import jp.juggler.util.ui.*
import org.jetbrains.anko.textColor
class ActHighlightWordEdit
: AppCompatActivity(),
View.OnClickListener,
ColorPickerDialogListener,
CompoundButton.OnCheckedChangeListener {
@ -56,9 +53,9 @@ class ActHighlightWordEdit
internal lateinit var item: HighlightWord
private lateinit var etName: EditText
private lateinit var swSound: SwitchCompat
private lateinit var swSpeech: SwitchCompat
private val views by lazy {
ActHighlightEditBinding.inflate(layoutInflater)
}
private var bBusy = false
@ -87,18 +84,14 @@ class ActHighlightWordEdit
setResult(RESULT_CANCELED)
fun loadData(): HighlightWord? {
savedInstanceState
?.getString(STATE_ITEM)
savedInstanceState?.getString(STATE_ITEM)
?.decodeJsonObject()
?.let { return HighlightWord(it) }
intent
?.getStringExtra(EXTRA_INITIAL_TEXT)
intent?.string(EXTRA_INITIAL_TEXT)
?.let { return HighlightWord(it) }
intent
?.getLongExtra(EXTRA_ITEM_ID, -1L)
?.takeIf { it > 0L }
intent?.long(EXTRA_ITEM_ID)
?.let { return HighlightWord.load(it) }
return null
@ -113,7 +106,7 @@ class ActHighlightWordEdit
this.item = item
etName.setText(item.name)
views.etName.setText(item.name)
showSound()
showColor()
}
@ -130,74 +123,57 @@ class ActHighlightWordEdit
}
private fun initUI() {
setContentView(R.layout.act_highlight_edit)
App1.initEdgeToEdge(this)
setContentView(views.root)
setSupportActionBar(views.toolbar)
setNavigationBack(views.toolbar)
fixHorizontalMargin(views.llContent)
etName = findViewById(R.id.etName)
swSound = findViewById(R.id.swSound)
swSound.setOnCheckedChangeListener(this)
views.swSound.setOnCheckedChangeListener(this)
views.swSpeech.setOnCheckedChangeListener(this)
swSpeech = findViewById(R.id.swSpeech)
swSpeech.setOnCheckedChangeListener(this)
setSwitchColor(views.swSound)
setSwitchColor(views.swSpeech)
setSwitchColor(swSound)
setSwitchColor(swSpeech)
intArrayOf(
R.id.btnTextColorEdit,
R.id.btnTextColorReset,
R.id.btnBackgroundColorEdit,
R.id.btnBackgroundColorReset,
R.id.btnNotificationSoundEdit,
R.id.btnNotificationSoundReset,
R.id.btnDiscard,
R.id.btnSave,
).forEach {
findViewById<View>(it)?.setOnClickListener(this)
views.btnDiscard.setOnClickListener { finish() }
views.btnSave.setOnClickListener { save() }
views.btnTextColorEdit.setOnClickListener {
openColorPicker(
COLOR_DIALOG_ID_TEXT,
item.color_fg
)
}
}
override fun onClick(v: View) {
when (v.id) {
R.id.btnDiscard ->
finish()
R.id.btnSave ->
save()
R.id.btnTextColorEdit ->
openColorPicker(COLOR_DIALOG_ID_TEXT, item.color_fg)
R.id.btnTextColorReset -> {
item.color_fg = 0
showColor()
}
R.id.btnBackgroundColorEdit ->
openColorPicker(COLOR_DIALOG_ID_BACKGROUND, item.color_bg)
R.id.btnBackgroundColorReset -> {
item.color_bg = 0
showColor()
}
R.id.btnNotificationSoundEdit ->
openNotificationSoundPicker()
R.id.btnNotificationSoundReset -> {
item.sound_uri = null
item.sound_type = when {
swSound.isChecked -> HighlightWord.SOUND_TYPE_DEFAULT
else -> HighlightWord.SOUND_TYPE_NONE
}
showSound()
views.btnTextColorReset.setOnClickListener {
item.color_fg = 0
showColor()
}
views.btnBackgroundColorEdit.setOnClickListener {
openColorPicker(
COLOR_DIALOG_ID_BACKGROUND,
item.color_bg
)
}
views.btnBackgroundColorReset.setOnClickListener {
item.color_bg = 0
showColor()
}
views.btnNotificationSoundEdit.setOnClickListener { openNotificationSoundPicker() }
views.btnNotificationSoundReset.setOnClickListener {
item.sound_uri = null
item.sound_type = when {
views.swSound.isChecked -> HighlightWord.SOUND_TYPE_DEFAULT
else -> HighlightWord.SOUND_TYPE_NONE
}
showSound()
}
views.btnNotificationSoundTest.setOnClickListener {
ActHighlightWordList.sound(this, item)
}
}
override fun onCheckedChanged(buttonView: CompoundButton, isChecked: Boolean) {
if (bBusy) return
uiToData()
showSound()
}
private fun openColorPicker(id: Int, initialColor: Int) {
@ -227,8 +203,10 @@ class ActHighlightWordEdit
private fun showSound() {
bBusy = true
try {
swSound.isChecked = item.sound_type != HighlightWord.SOUND_TYPE_NONE
swSpeech.isChecked = item.speech != 0
val isSoundEnabled = item.sound_type != HighlightWord.SOUND_TYPE_NONE
views.btnNotificationSoundTest.isEnabledAlpha = isSoundEnabled
views.swSound.isChecked = isSoundEnabled
views.swSpeech.isChecked = item.speech != 0
} finally {
bBusy = false
}
@ -237,8 +215,9 @@ class ActHighlightWordEdit
private fun showColor() {
bBusy = true
try {
etName.setBackgroundColor(item.color_bg) // may 0
etName.textColor = item.color_fg.notZero() ?: attrColor(android.R.attr.textColorPrimary)
views.etName.setBackgroundColor(item.color_bg) // may 0
views.etName.textColor =
item.color_fg.notZero() ?: attrColor(android.R.attr.textColorPrimary)
} finally {
bBusy = false
}
@ -260,15 +239,15 @@ class ActHighlightWordEdit
}
private fun uiToData() {
item.name = etName.text.toString().trim { it <= ' ' || it == ' ' }
item.name = views.etName.text.toString().trim { it <= ' ' || it == ' ' }
item.sound_type = when {
!swSound.isChecked -> HighlightWord.SOUND_TYPE_NONE
!views.swSound.isChecked -> HighlightWord.SOUND_TYPE_NONE
item.sound_uri?.notEmpty() == null -> HighlightWord.SOUND_TYPE_DEFAULT
else -> HighlightWord.SOUND_TYPE_CUSTOM
}
item.speech = when (swSpeech.isChecked) {
item.speech = when (views.swSpeech.isChecked) {
false -> 0
else -> 1
}

View File

@ -7,45 +7,91 @@ import android.net.Uri
import android.os.Bundle
import android.view.View
import android.view.ViewGroup
import android.widget.ImageButton
import android.widget.TextView
import android.widget.AdapterView
import android.widget.BaseAdapter
import androidx.appcompat.app.AppCompatActivity
import androidx.recyclerview.widget.LinearLayoutManager
import com.woxthebox.draglistview.DragItem
import com.woxthebox.draglistview.DragItemAdapter
import com.woxthebox.draglistview.DragListView
import com.woxthebox.draglistview.swipe.ListSwipeHelper
import com.woxthebox.draglistview.swipe.ListSwipeItem
import jp.juggler.subwaytooter.databinding.ActHighlightListBinding
import jp.juggler.subwaytooter.databinding.LvHighlightWordBinding
import jp.juggler.subwaytooter.dialog.DlgConfirm.confirm
import jp.juggler.subwaytooter.table.HighlightWord
import jp.juggler.util.coroutine.launchAndShowError
import jp.juggler.util.data.cast
import jp.juggler.util.data.mayUri
import jp.juggler.util.data.notZero
import jp.juggler.util.log.LogCategory
import jp.juggler.util.log.errorEx
import jp.juggler.util.ui.ActivityResultHandler
import jp.juggler.util.ui.attrColor
import jp.juggler.util.ui.isNotOk
import jp.juggler.util.ui.vg
import jp.juggler.util.ui.*
import java.lang.ref.WeakReference
class ActHighlightWordList : AppCompatActivity(), View.OnClickListener {
class ActHighlightWordList : AppCompatActivity() {
companion object {
private val log = LogCategory("ActHighlightWordList")
private var lastRingtone: WeakReference<Ringtone>? = null
private fun stopLastRingtone() {
try {
lastRingtone?.get()?.stop()
} catch (ex: Throwable) {
log.e(ex, "stopLastRingtone failed.")
} finally {
lastRingtone = null
}
}
fun tryRingTone(context: Context, uri: Uri?): Boolean {
try {
uri?.let { RingtoneManager.getRingtone(context, it) }
?.let { ringtone ->
stopLastRingtone()
lastRingtone = WeakReference(ringtone)
ringtone.play()
return true
}
} catch (ex: Throwable) {
log.e(ex, "tryRingTone failed.")
}
// fall null case
return false
}
fun sound(context: Context, item: HighlightWord?) {
if (lastRingtone?.get()?.isPlaying == true) {
stopLastRingtone()
return
}
item ?: return
val soundType = item.sound_type
when {
// サウンドなし
soundType == HighlightWord.SOUND_TYPE_NONE -> Unit
// カスタムサウンドを鳴らせた
soundType == HighlightWord.SOUND_TYPE_CUSTOM && tryRingTone(
context,
item.sound_uri.mayUri()
) -> Unit
// 失敗した場合も通常の音を鳴らす
else -> tryRingTone(
context,
RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION)
)
}
}
}
private lateinit var listView: DragListView
private lateinit var listAdapter: MyListAdapter
private val views by lazy {
ActHighlightListBinding.inflate(layoutInflater)
}
private var lastRingtone: WeakReference<Ringtone>? = null
private lateinit var listAdapter: MyListAdapter
private val arEdit = ActivityResultHandler(log) { r ->
if (r.isNotOk) return@ActivityResultHandler
try {
loadData()
} catch (ex: Throwable) {
errorEx(ex, "can't load data")
}
loadData()
}
// @Override public void onBackPressed(){
@ -67,249 +113,124 @@ class ActHighlightWordList : AppCompatActivity(), View.OnClickListener {
}
private fun initUI() {
setContentView(R.layout.act_highlight_list)
App1.initEdgeToEdge(this)
fixHorizontalPadding0(findViewById(R.id.llContent))
setContentView(views.root)
setSupportActionBar(views.toolbar)
setNavigationBack(views.toolbar)
fixHorizontalMargin(views.llContent)
// リストのアダプター
listAdapter = MyListAdapter()
// ハンドル部分をドラッグで並べ替えできるRecyclerView
listView = findViewById(R.id.drag_list_view)
listView.setLayoutManager(LinearLayoutManager(this))
listView.setAdapter(listAdapter, false)
listView.setCanDragHorizontally(true)
listView.isDragEnabled = false
listView.setCustomDragItem(MyDragItem(this, R.layout.lv_highlight_word))
listView.recyclerView.isVerticalScrollBarEnabled = true
// リストを左右スワイプした
listView.setSwipeListener(object : ListSwipeHelper.OnSwipeListenerAdapter() {
override fun onItemSwipeStarted(
item: ListSwipeItem,
) {
// 操作中はリフレッシュ禁止
// mRefreshLayout.setEnabled( false );
}
override fun onItemSwipeEnded(
item: ListSwipeItem,
swipedDirection: ListSwipeItem.SwipeDirection?,
) {
// 操作完了でリフレッシュ許可
// mRefreshLayout.setEnabled( USE_SWIPE_REFRESH );
// 左にスワイプした(右端にBGが見えた) なら要素を削除する
if (swipedDirection == ListSwipeItem.SwipeDirection.LEFT) {
val o = item.tag
if (o is HighlightWord) {
o.delete(this@ActHighlightWordList)
listAdapter.removeItem(listAdapter.getPositionForItem(o))
}
}
}
})
findViewById<View>(R.id.btnAdd).setOnClickListener(this)
views.listView.adapter = listAdapter
views.listView.onItemClickListener = listAdapter
views.btnAdd.setOnClickListener { create() }
}
private fun loadData() {
val tmpList = ArrayList<HighlightWord>()
try {
HighlightWord.createCursor().use { cursor ->
while (cursor.moveToNext()) {
val item = HighlightWord(cursor)
tmpList.add(item)
listAdapter.items = buildList {
HighlightWord.createCursor().use { cursor ->
val colIdx = HighlightWord.ColIdx(cursor)
while (cursor.moveToNext()) {
try {
add(HighlightWord(cursor, colIdx))
} catch (ex: Throwable) {
log.e(ex, "load error.")
}
}
}
}
} catch (ex: Throwable) {
log.e(ex, "loadData failed.")
}
listAdapter.itemList = tmpList
}
override fun onClick(v: View) {
when (v.id) {
R.id.btnAdd -> create()
}
}
// リスト要素のViewHolder
internal inner class MyViewHolder(viewRoot: View) :
DragItemAdapter.ViewHolder(viewRoot, R.id.ivDragHandle, false), View.OnClickListener {
val tvName: TextView
private val btnSound: View
private val ivSpeech: ImageButton
init {
tvName = viewRoot.findViewById(R.id.tvName)
btnSound = viewRoot.findViewById(R.id.btnSound)
ivSpeech = viewRoot.findViewById(R.id.ivSpeech)
// リスト要素のビューが ListSwipeItem だった場合、Swipe操作を制御できる
if (viewRoot is ListSwipeItem) {
viewRoot.setSwipeInStyle(ListSwipeItem.SwipeInStyle.SLIDE)
viewRoot.supportedSwipeDirection = ListSwipeItem.SwipeDirection.LEFT
}
} // View ID。 ここを押すとドラッグ操作をすぐに開始する
// 長押しでドラッグ開始するなら真
fun bind(item: HighlightWord) {
itemView.tag = item // itemView は親クラスのメンバ変数
tvName.text = item.name
tvName.setBackgroundColor(item.color_bg)
tvName.setTextColor(
item.color_fg.notZero()
?: attrColor(android.R.attr.textColorPrimary)
)
btnSound.vg(item.sound_type != HighlightWord.SOUND_TYPE_NONE)?.apply {
setOnClickListener(this@MyViewHolder)
tag = item
}
ivSpeech.vg(item.speech != 0)?.apply {
setOnClickListener(this@MyViewHolder)
tag = item
}
}
// @Override
// public boolean onItemLongClicked( View view ){
// return false;
// }
override fun onItemClicked(view: View) {
val o = view.tag
if (o is HighlightWord) {
edit(o)
}
}
override fun onClick(v: View) {
val o = v.tag
if (o is HighlightWord) {
when (v.id) {
R.id.btnSound -> {
sound(o)
}
R.id.ivSpeech -> {
App1.getAppState(this@ActHighlightWordList)
.addSpeech(o.name, dedupMode = DedupMode.None)
}
}
}
}
}
// ドラッグ操作中のデータ
private inner class MyDragItem(context: Context, layoutId: Int) :
DragItem(context, layoutId) {
override fun onBindDragView(clickedView: View, dragView: View) {
dragView.findViewById<TextView>(R.id.tvName).text =
clickedView.findViewById<TextView>(R.id.tvName).text
dragView.findViewById<View>(R.id.btnSound).visibility =
clickedView.findViewById<View>(R.id.btnSound).visibility
dragView.findViewById<View>(R.id.ivSpeech).visibility =
clickedView.findViewById<View>(R.id.ivSpeech).visibility
dragView.findViewById<View>(R.id.item_layout)
.setBackgroundColor(attrColor(R.attr.list_item_bg_pressed_dragged))
}
}
private inner class MyListAdapter :
DragItemAdapter<HighlightWord, MyViewHolder>() {
init {
setHasStableIds(true)
itemList = ArrayList()
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MyViewHolder {
val view = layoutInflater.inflate(R.layout.lv_highlight_word, parent, false)
return MyViewHolder(view)
}
override fun onBindViewHolder(holder: MyViewHolder, position: Int) {
super.onBindViewHolder(holder, position)
holder.bind(itemList[position])
}
override fun getUniqueItemId(position: Int): Long {
val item = mItemList[position] // mItemList は親クラスのメンバ変数
return item.id
errorEx(ex, "query error.")
}
}
private fun create() {
arEdit.launch(
ActHighlightWordEdit.createIntent(this, "")
)
arEdit.launch(ActHighlightWordEdit.createIntent(this, ""))
}
private fun edit(oldItem: HighlightWord) {
arEdit.launch(
ActHighlightWordEdit.createIntent(this, oldItem.id)
)
private fun edit(item: HighlightWord?) {
item ?: return
arEdit.launch(ActHighlightWordEdit.createIntent(this, item.id))
}
private fun stopLastRingtone() {
val r = lastRingtone?.get()
if (r != null) {
try {
r.stop()
} catch (ex: Throwable) {
log.e(ex, "stopLastRingtone failed.")
} finally {
lastRingtone = null
}
private fun delete(item: HighlightWord?) {
item ?: return
val activity = this
launchAndShowError {
confirm(getString(R.string.delete_confirm, item.name))
item.delete(activity)
listAdapter.remove(item)
}
}
private fun sound(item: HighlightWord) {
private fun speech(item: HighlightWord?) {
item ?: return
App1.getAppState(this@ActHighlightWordList)
.addSpeech(item.name, dedupMode = DedupMode.None)
}
val soundType = item.sound_type
if (soundType == HighlightWord.SOUND_TYPE_NONE) return
// リスト要素のViewHolder
private inner class MyViewHolder(
parent: ViewGroup?,
) {
val views = LvHighlightWordBinding.inflate(layoutInflater, parent, false)
fun Uri?.tryRingTone(): Boolean {
try {
if (this != null) {
val ringtone = RingtoneManager.getRingtone(this@ActHighlightWordList, this)
if (ringtone != null) {
stopLastRingtone()
lastRingtone = WeakReference(ringtone)
ringtone.play()
return true
}
}
} catch (ex: Throwable) {
log.e(ex, "tryRingTone failed.")
}
private var lastItem: HighlightWord? = null
return false
init {
views.root.tag = this
views.btnSound.setOnClickListener { sound(this@ActHighlightWordList, lastItem) }
views.btnSpeech.setOnClickListener { speech(lastItem) }
views.btnDelete.setOnClickListener { delete(lastItem) }
}
if (soundType == HighlightWord.SOUND_TYPE_CUSTOM &&
item.sound_uri.mayUri().tryRingTone()
) return
fun bind(item: HighlightWord?) {
item ?: return
lastItem = item
// fall thru 失敗したら通常の音を鳴らす
RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION).tryRingTone()
views.tvName.text = item.name
views.tvName.setBackgroundColor(item.color_bg)
views.tvName.setTextColor(
item.color_fg.notZero()
?: attrColor(android.R.attr.textColorPrimary)
)
views.btnSound.isEnabledAlpha = item.sound_type != HighlightWord.SOUND_TYPE_NONE
views.btnSpeech.isEnabledAlpha = item.speech != 0
}
}
private inner class MyListAdapter : BaseAdapter(), AdapterView.OnItemClickListener {
var items: List<HighlightWord> = emptyList()
set(value) {
field = value
notifyDataSetChanged()
}
fun remove(item: HighlightWord) {
items = items.filter { it != item }
}
override fun getCount() = items.size
override fun getItem(position: Int) = items.elementAtOrNull(position)
override fun getItemId(position: Int) = 0L
override fun getView(position: Int, convertView: View?, parent: ViewGroup?) =
(convertView?.tag?.cast() ?: MyViewHolder(parent))
.also { it.bind(items.elementAtOrNull(position)) }
.views.root
override fun onItemClick(
parent: AdapterView<*>?,
view: View?,
position: Int,
id: Long,
) {
edit(items.elementAtOrNull(position))
}
}
}

View File

@ -5,6 +5,7 @@ import android.content.Intent
import android.os.Bundle
import android.widget.ArrayAdapter
import android.widget.CheckBox
import androidx.appcompat.app.AlertDialog
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.children
import jp.juggler.subwaytooter.api.ApiPath
@ -16,13 +17,18 @@ import jp.juggler.subwaytooter.databinding.ActKeywordFilterBinding
import jp.juggler.subwaytooter.databinding.LvKeywordFilterBinding
import jp.juggler.subwaytooter.table.AcctColor
import jp.juggler.subwaytooter.table.SavedAccount
import jp.juggler.util.backPressed
import jp.juggler.util.coroutine.launchMain
import jp.juggler.util.data.*
import jp.juggler.util.int
import jp.juggler.util.log.LogCategory
import jp.juggler.util.log.showToast
import jp.juggler.util.long
import jp.juggler.util.network.toPostRequestBuilder
import jp.juggler.util.network.toPut
import jp.juggler.util.network.toRequestBody
import jp.juggler.util.string
import jp.juggler.util.ui.setNavigationBack
class ActKeywordFilter : AppCompatActivity() {
@ -93,6 +99,7 @@ class ActKeywordFilter : AppCompatActivity() {
///////////////////////////////////////////////////
override fun onCreate(savedInstanceState: Bundle?) {
backPressed { confirmBack() }
super.onCreate(savedInstanceState)
App1.setActivityTheme(this)
@ -101,7 +108,8 @@ class ActKeywordFilter : AppCompatActivity() {
// filter ID の有無はUIに影響するのでinitUIより先に初期化する
this.filterId = EntityId.from(intent, EXTRA_FILTER_ID)
val a = SavedAccount.loadAccount(this, intent.getLongExtra(EXTRA_ACCOUNT_DB_ID, -1L))
val a = intent.long(EXTRA_ACCOUNT_DB_ID)
?.let { SavedAccount.loadAccount(this, it) }
if (a == null) {
finish()
return
@ -117,7 +125,7 @@ class ActKeywordFilter : AppCompatActivity() {
startLoading()
} else {
views.spExpire.setSelection(1)
val initialText = intent.getStringExtra(EXTRA_INITIAL_PHRASE)?.trim() ?: ""
val initialText = intent.string(EXTRA_INITIAL_PHRASE)?.trim() ?: ""
views.etTitle.setText(initialText)
addKeywordArea(TootFilterKeyword(keyword = initialText))
}
@ -135,11 +143,12 @@ class ActKeywordFilter : AppCompatActivity() {
log.e(ex, "can't decode TootFilterKeyword")
}
}
val iv = savedInstanceState.getInt(STATE_EXPIRE_SPINNER, -1)
if (iv != -1) {
views.spExpire.setSelection(iv)
}
filterExpire = savedInstanceState.getLong(STATE_EXPIRE_AT, filterExpire)
savedInstanceState.int(STATE_EXPIRE_SPINNER)
?.let { views.spExpire.setSelection(it) }
savedInstanceState.long(STATE_EXPIRE_AT)
?.let { filterExpire = it }
}
}
@ -159,6 +168,13 @@ class ActKeywordFilter : AppCompatActivity() {
}
private fun initUI() {
setContentView(views.root)
setSupportActionBar(views.toolbar)
setNavigationBack(views.toolbar)
fixHorizontalMargin(views.llContent)
this.density = resources.displayMetrics.density
title = getString(
when (filterId) {
null -> R.string.keyword_filter_new
@ -166,12 +182,6 @@ class ActKeywordFilter : AppCompatActivity() {
}
)
this.density = resources.displayMetrics.density
setContentView(views.root)
App1.initEdgeToEdge(this)
fixHorizontalPadding(findViewById(R.id.svContent))
views.btnSave.setOnClickListener { save() }
views.btnAddKeyword.setOnClickListener {
val ti = TootInstance.getCached(account)
@ -199,6 +209,14 @@ class ActKeywordFilter : AppCompatActivity() {
views.spExpire.adapter = adapter
}
private fun confirmBack() {
AlertDialog.Builder(this)
.setMessage(R.string.keyword_filter_quit_waring)
.setPositiveButton(R.string.ok) { _, _ -> finish() }
.setNegativeButton(R.string.cancel, null)
.show()
}
private fun showAccount() {
views.tvAccount.text = AcctColor.getNicknameWithColor(account.acct)
}
@ -299,7 +317,7 @@ class ActKeywordFilter : AppCompatActivity() {
launchMain {
var result = saveV2(vhList)
var result = saveV2(vhList, title)
if (result?.response?.code == 404) {
result = saveV1(vhList)
}
@ -378,13 +396,12 @@ class ActKeywordFilter : AppCompatActivity() {
}
}
private suspend fun saveV2(vhList: List<VhKeyword>): TootApiResult? {
private suspend fun saveV2(vhList: List<VhKeyword>, title: String): TootApiResult? {
val params = filterParamBase().apply {
put("title", title)
put(
"filter_action", when {
views.rbHide.isChecked -> "hide"
else -> "warn"
}
"filter_action",
if (views.rbHide.isChecked) "hide" else "warn"
)
put("keywords_attributes", buildJsonArray {
vhList.forEach { vh ->

View File

@ -16,6 +16,7 @@ import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.FileProvider
import jp.juggler.subwaytooter.api.entity.TootStatus
import jp.juggler.subwaytooter.column.Column
import jp.juggler.subwaytooter.databinding.ActLanguageFilterBinding
import jp.juggler.subwaytooter.dialog.ActionsDialog
import jp.juggler.util.*
import jp.juggler.util.coroutine.launchProgress
@ -117,12 +118,15 @@ class ActLanguageFilter : AppCompatActivity(), View.OnClickListener {
internal lateinit var appState: AppState
internal var density: Float = 0f
private lateinit var listView: ListView
private val views by lazy {
ActLanguageFilterBinding.inflate(layoutInflater)
}
private lateinit var adapter: MyAdapter
private val languageList = ArrayList<MyItem>()
private var loadingBusy: Boolean = false
private val arExport = ActivityResultHandler(log) { }
private val arExport = ActivityResultHandler(log) {
}
private val arImport = ActivityResultHandler(log) { r ->
if (r.isNotOk) return@ActivityResultHandler
@ -132,17 +136,7 @@ class ActLanguageFilter : AppCompatActivity(), View.OnClickListener {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
backPressed {
if (equalsLanguageList(column.languageFilter, encodeLanguageList())) {
finish()
} else {
AlertDialog.Builder(this)
.setMessage(R.string.language_filter_quit_waring)
.setPositiveButton(R.string.ok) { _, _ -> finish() }
.setNegativeButton(R.string.cancel, null)
.show()
}
}
backPressed { confirmBack() }
arExport.register(this)
arImport.register(this)
@ -151,7 +145,7 @@ class ActLanguageFilter : AppCompatActivity(), View.OnClickListener {
appState = App1.getAppState(this)
density = appState.density
columnIndex = intent.getIntExtra(EXTRA_COLUMN_INDEX, 0)
columnIndex = intent.int(EXTRA_COLUMN_INDEX) ?: 0
column = appState.column(columnIndex)!!
if (savedInstanceState != null) {
@ -175,22 +169,22 @@ class ActLanguageFilter : AppCompatActivity(), View.OnClickListener {
}
private fun initUI() {
setContentView(R.layout.act_language_filter)
App1.initEdgeToEdge(this)
fixHorizontalPadding(findViewById(R.id.llContent))
setContentView(views.root)
setSupportActionBar(views.toolbar)
setNavigationBack(views.toolbar)
fixHorizontalMargin(views.llContent)
for (id in intArrayOf(
R.id.btnAdd,
R.id.btnSave,
R.id.btnMore
)) {
findViewById<View>(id)?.setOnClickListener(this)
arrayOf(
views.btnAdd,
views.btnSave,
views.btnMore,
).forEach {
it.setOnClickListener(this)
}
listView = findViewById(R.id.listView)
adapter = MyAdapter()
listView.adapter = adapter
listView.onItemClickListener = adapter
views.listView.adapter = adapter
views.listView.onItemClickListener = adapter
}
// UIのデータをJsonObjectにエンコード
@ -244,7 +238,7 @@ class ActLanguageFilter : AppCompatActivity(), View.OnClickListener {
"${item.code} ${getDesc(item)} : ${getString(if (item.allow) R.string.language_show else R.string.language_hide)}"
tv.textColor = attrColor(
when (item.allow) {
true -> R.attr.colorContentText
true -> R.attr.colorTextContent
false -> R.attr.colorRegexFilterError
}
)
@ -373,7 +367,7 @@ class ActLanguageFilter : AppCompatActivity(), View.OnClickListener {
btnPresets.setEnabledColor(
activity,
R.drawable.ic_edit,
activity.attrColor(R.attr.colorVectorDrawable),
activity.attrColor(R.attr.colorTextContent),
false
)
}
@ -461,4 +455,16 @@ class ActLanguageFilter : AppCompatActivity(), View.OnClickListener {
afterProc = { load(it) }
)
}
private fun confirmBack() {
if (equalsLanguageList(column.languageFilter, encodeLanguageList())) {
finish()
} else {
AlertDialog.Builder(this)
.setMessage(R.string.language_filter_quit_waring)
.setPositiveButton(R.string.ok) { _, _ -> finish() }
.setNegativeButton(R.string.cancel, null)
.show()
}
}
}

View File

@ -48,6 +48,8 @@ import jp.juggler.util.int
import jp.juggler.util.log.LogCategory
import jp.juggler.util.log.benchmark
import jp.juggler.util.log.showToast
import jp.juggler.util.long
import jp.juggler.util.string
import jp.juggler.util.ui.ActivityResultHandler
import jp.juggler.util.ui.attrColor
import jp.juggler.util.ui.isNotOk
@ -270,7 +272,7 @@ class ActMain : AppCompatActivity(),
val arAbout = ActivityResultHandler(log) { r ->
if (r.isNotOk) return@ActivityResultHandler
r.data?.getStringExtra(ActAbout.EXTRA_SEARCH)?.notEmpty()?.let { search ->
r.data?.string(ActAbout.EXTRA_SEARCH)?.notEmpty()?.let { search ->
timeline(
defaultInsertPosition,
ColumnType.SEARCH,
@ -286,8 +288,7 @@ class ActMain : AppCompatActivity(),
RESULT_OK -> r.data?.data?.let { openBrowser(it) }
ActAccountSetting.RESULT_INPUT_ACCESS_TOKEN ->
r.data?.getLongExtra(ActAccountSetting.EXTRA_DB_ID, -1L)
?.takeIf { it != -1L }
r.data?.long(ActAccountSetting.EXTRA_DB_ID)
?.let { checkAccessToken2(it) }
}
}
@ -346,7 +347,7 @@ class ActMain : AppCompatActivity(),
arActPost.register(this)
arActText.register(this)
App1.setActivityTheme(this, noActionBar = true)
App1.setActivityTheme(this)
appState = App1.getAppState(this)
handler = appState.handler
@ -696,7 +697,6 @@ class ActMain : AppCompatActivity(),
internal fun initUI() {
setContentView(R.layout.act_main)
App1.initEdgeToEdge(this)
quickPostVisibility =
TootVisibility.parseSavedVisibility(PrefS.spQuickTootVisibility(pref))

View File

@ -257,24 +257,22 @@ class ActMediaViewer : AppCompatActivity(), View.OnClickListener {
supportRequestWindowFeature(Window.FEATURE_NO_TITLE)
super.onCreate(savedInstanceState)
prDownload.register(this)
App1.setActivityTheme(this, noActionBar = true, forceDark = true)
App1.setActivityTheme(this, forceDark = true)
this.showDescription = intent.getBooleanExtra(EXTRA_SHOW_DESCRIPTION, showDescription)
this.serviceType = ServiceType.values()[
savedInstanceState?.getInt(EXTRA_SERVICE_TYPE)
?: intent.getIntExtra(EXTRA_SERVICE_TYPE, 0)
savedInstanceState?.int(EXTRA_SERVICE_TYPE)
?: intent.int(EXTRA_SERVICE_TYPE) ?: 0
]
this.mediaList = decodeMediaList(
savedInstanceState?.getString(EXTRA_DATA)
?: intent.getStringExtra(EXTRA_DATA)
?: intent.string(EXTRA_DATA)
)
this.idx = (savedInstanceState?.getInt(EXTRA_IDX)
?: intent.getIntExtra(EXTRA_IDX, 0))
.takeIf { it in mediaList.indices }
?: 0
this.idx = (savedInstanceState?.int(EXTRA_IDX) ?: intent.int(EXTRA_IDX))
?.takeIf { it in mediaList.indices } ?: 0
initUI()
@ -304,7 +302,6 @@ class ActMediaViewer : AppCompatActivity(), View.OnClickListener {
internal fun initUI() {
setContentView(views.root)
App1.initEdgeToEdge(this)
views.pbvImage.background = MediaBackgroundDrawable(
context = views.root.context,

View File

@ -1,30 +1,31 @@
package jp.juggler.subwaytooter
import android.content.Context
import android.os.Bundle
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import android.widget.BaseAdapter
import androidx.appcompat.app.AppCompatActivity
import com.woxthebox.draglistview.DragItem
import com.woxthebox.draglistview.DragItemAdapter
import com.woxthebox.draglistview.DragListView
import com.woxthebox.draglistview.swipe.ListSwipeHelper
import com.woxthebox.draglistview.swipe.ListSwipeItem
import jp.juggler.subwaytooter.databinding.ActWordListBinding
import jp.juggler.subwaytooter.databinding.LvMuteAppBinding
import jp.juggler.subwaytooter.dialog.DlgConfirm.confirm
import jp.juggler.subwaytooter.table.MutedApp
import jp.juggler.util.backPressed
import jp.juggler.util.coroutine.launchAndShowError
import jp.juggler.util.data.cast
import jp.juggler.util.log.LogCategory
import jp.juggler.util.ui.attrColor
import jp.juggler.util.ui.setNavigationBack
class ActMutedApp : AppCompatActivity() {
companion object {
private val log = LogCategory("ActMutedApp")
}
internal lateinit var listView: DragListView
private lateinit var listAdapter: MyListAdapter
private val views by lazy {
ActWordListBinding.inflate(layoutInflater)
}
private val listAdapter by lazy { MyListAdapter() }
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
@ -38,149 +39,81 @@ class ActMutedApp : AppCompatActivity() {
}
private fun initUI() {
setContentView(R.layout.act_word_list)
App1.initEdgeToEdge(this)
fixHorizontalPadding0(findViewById(R.id.llContent))
// リストのアダプター
listAdapter = MyListAdapter()
// ハンドル部分をドラッグで並べ替えできるRecyclerView
listView = findViewById(R.id.drag_list_view)
listView.setLayoutManager(androidx.recyclerview.widget.LinearLayoutManager(this))
listView.setAdapter(listAdapter, false)
listView.setCanDragHorizontally(true)
listView.isDragEnabled = false
listView.setCustomDragItem(MyDragItem(this, R.layout.lv_mute_app))
listView.recyclerView.isVerticalScrollBarEnabled = true
// listView.setDragListListener( new DragListView.DragListListenerAdapter() {
// @Override
// public void onItemDragStarted( int position ){
// // 操作中はリフレッシュ禁止
// // mRefreshLayout.setEnabled( false );
// }
//
// @Override
// public void onItemDragEnded( int fromPosition, int toPosition ){
// // 操作完了でリフレッシュ許可
// // mRefreshLayout.setEnabled( USE_SWIPE_REFRESH );
//
//// if( fromPosition != toPosition ){
//// // 並べ替えが発生した
//// }
// }
// } );
// リストを左右スワイプした
listView.setSwipeListener(object : ListSwipeHelper.OnSwipeListenerAdapter() {
override fun onItemSwipeStarted(item: ListSwipeItem?) {
// 操作中はリフレッシュ禁止
// mRefreshLayout.setEnabled( false );
}
override fun onItemSwipeEnded(
item: ListSwipeItem?,
swipedDirection: ListSwipeItem.SwipeDirection?,
) {
// 操作完了でリフレッシュ許可
// mRefreshLayout.setEnabled( USE_SWIPE_REFRESH );
// 左にスワイプした(右端に青が見えた) なら要素を削除する
if (swipedDirection == ListSwipeItem.SwipeDirection.LEFT) {
val o = item?.tag
if (o is MyItem) {
MutedApp.delete(o.name)
listAdapter.removeItem(listAdapter.getPositionForItem(o))
}
}
}
})
setContentView(views.root)
setSupportActionBar(views.toolbar)
setNavigationBack(views.toolbar)
fixHorizontalMargin(views.llContent)
views.listView.adapter = listAdapter
}
private fun loadData() {
val tmpList = ArrayList<MyItem>()
try {
MutedApp.createCursor().use { cursor ->
val idxId = cursor.getColumnIndex(MutedApp.COL_ID)
val idxName = cursor.getColumnIndex(MutedApp.COL_NAME)
while (cursor.moveToNext()) {
val id = cursor.getLong(idxId)
val name = cursor.getString(idxName)
val item = MyItem(id, name)
tmpList.add(item)
listAdapter.items = buildList {
try {
MutedApp.createCursor().use { cursor ->
val idxId = cursor.getColumnIndex(MutedApp.COL_ID)
val idxName = cursor.getColumnIndex(MutedApp.COL_NAME)
while (cursor.moveToNext()) {
val item = MyItem(
id = cursor.getLong(idxId),
name = cursor.getString(idxName)
)
add(item)
}
}
} catch (ex: Throwable) {
log.e(ex, "loadData failed.")
}
} catch (ex: Throwable) {
log.e(ex, "loadData failed.")
}
}
listAdapter.itemList = tmpList
private fun delete(item: MyItem?) {
item ?: return
launchAndShowError {
confirm(R.string.delete_confirm, item.name)
MutedApp.delete(item.name)
listAdapter.remove(item)
}
}
// リスト要素のデータ
internal class MyItem(val id: Long, val name: String)
private class MyItem(val id: Long, val name: String)
// リスト要素のViewHolder
internal class MyViewHolder(viewRoot: View) :
DragItemAdapter.ViewHolder(viewRoot, R.id.ivDragHandle, false) {
val tvName: TextView
private inner class MyViewHolder(parent: ViewGroup?) {
val views = LvMuteAppBinding.inflate(layoutInflater, parent, false)
var lastItem: MyItem? = null
init {
views.root.tag = this
views.btnDelete.setOnClickListener { delete(lastItem) }
}
tvName = viewRoot.findViewById(R.id.tvName)
fun bind(item: MyItem?) {
item ?: return
lastItem = item
views.tvName.text = item.name
}
}
// リスト要素のビューが ListSwipeItem だった場合、Swipe操作を制御できる
if (viewRoot is ListSwipeItem) {
viewRoot.setSwipeInStyle(ListSwipeItem.SwipeInStyle.SLIDE)
viewRoot.supportedSwipeDirection = ListSwipeItem.SwipeDirection.LEFT
private inner class MyListAdapter : BaseAdapter() {
var items: List<MyItem> = emptyList()
set(value) {
field = value
notifyDataSetChanged()
}
fun remove(item: MyItem) {
items = items.filter { it != item }
}
fun bind(item: MyItem) {
itemView.tag = item // itemView は親クラスのメンバ変数
tvName.text = item.name
}
}
override fun getCount() = items.size
override fun getItem(position: Int) = items.elementAtOrNull(position)
override fun getItemId(position: Int) = 0L
override fun getView(position: Int, convertView: View?, parent: ViewGroup?) =
(convertView?.tag?.cast() ?: MyViewHolder(parent))
.also { it.bind(items.elementAtOrNull(position)) }
.views.root
// ドラッグ操作中のデータ
private inner class MyDragItem(context: Context, layoutId: Int) :
DragItem(context, layoutId) {
override fun onBindDragView(clickedView: View, dragView: View) {
dragView.findViewById<TextView>(R.id.tvName).text =
clickedView.findViewById<TextView>(R.id.tvName).text
dragView.findViewById<View>(R.id.item_layout)
.setBackgroundColor(attrColor(R.attr.list_item_bg_pressed_dragged))
}
}
private inner class MyListAdapter : DragItemAdapter<MyItem, MyViewHolder>() {
init {
setHasStableIds(true)
itemList = ArrayList()
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MyViewHolder {
val view = layoutInflater.inflate(R.layout.lv_mute_app, parent, false)
return MyViewHolder(view)
}
override fun onBindViewHolder(holder: MyViewHolder, position: Int) {
super.onBindViewHolder(holder, position)
holder.bind(itemList[position])
}
override fun getUniqueItemId(position: Int): Long {
val item = mItemList[position] // mItemList は親クラスのメンバ変数
return item.id
}
override fun isEnabled(position: Int) = false
}
}

View File

@ -1,20 +1,19 @@
package jp.juggler.subwaytooter
import android.content.Context
import android.os.Bundle
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import android.widget.BaseAdapter
import androidx.appcompat.app.AppCompatActivity
import com.woxthebox.draglistview.DragItem
import com.woxthebox.draglistview.DragItemAdapter
import com.woxthebox.draglistview.DragListView
import com.woxthebox.draglistview.swipe.ListSwipeHelper
import com.woxthebox.draglistview.swipe.ListSwipeItem
import jp.juggler.subwaytooter.databinding.ActWordListBinding
import jp.juggler.subwaytooter.databinding.LvMuteAppBinding
import jp.juggler.subwaytooter.dialog.DlgConfirm.confirm
import jp.juggler.subwaytooter.table.UserRelation
import jp.juggler.util.backPressed
import jp.juggler.util.coroutine.launchAndShowError
import jp.juggler.util.data.cast
import jp.juggler.util.log.LogCategory
import jp.juggler.util.ui.attrColor
import jp.juggler.util.ui.setNavigationBack
class ActMutedPseudoAccount : AppCompatActivity() {
@ -22,8 +21,11 @@ class ActMutedPseudoAccount : AppCompatActivity() {
private val log = LogCategory("ActMutedPseudoAccount")
}
internal lateinit var listView: DragListView
private lateinit var listAdapter: MyListAdapter
private val views by lazy {
ActWordListBinding.inflate(layoutInflater)
}
private val listAdapter by lazy { MyListAdapter() }
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
@ -37,160 +39,81 @@ class ActMutedPseudoAccount : AppCompatActivity() {
}
private fun initUI() {
setContentView(R.layout.act_word_list)
App1.initEdgeToEdge(this)
fixHorizontalPadding0(findViewById(R.id.llContent))
// リストのアダプター
listAdapter = MyListAdapter()
// ハンドル部分をドラッグで並べ替えできるRecyclerView
listView = findViewById(R.id.drag_list_view)
listView.setLayoutManager(androidx.recyclerview.widget.LinearLayoutManager(this))
listView.setAdapter(listAdapter, false)
listView.setCanDragHorizontally(true)
listView.isDragEnabled = false
listView.setCustomDragItem(MyDragItem(this, R.layout.lv_mute_app))
listView.recyclerView.isVerticalScrollBarEnabled = true
// listView.setDragListListener( new DragListView.DragListListenerAdapter() {
// @Override
// public void onItemDragStarted( int position ){
// // 操作中はリフレッシュ禁止
// // mRefreshLayout.setEnabled( false );
// }
//
// @Override
// public void onItemDragEnded( int fromPosition, int toPosition ){
// // 操作完了でリフレッシュ許可
// // mRefreshLayout.setEnabled( USE_SWIPE_REFRESH );
//
//// if( fromPosition != toPosition ){
//// // 並べ替えが発生した
//// }
// }
// } );
// リストを左右スワイプした
listView.setSwipeListener(object : ListSwipeHelper.OnSwipeListenerAdapter() {
override fun onItemSwipeStarted(item: ListSwipeItem?) {
// 操作中はリフレッシュ禁止
// mRefreshLayout.setEnabled( false );
}
override fun onItemSwipeEnded(
item: ListSwipeItem?,
swipedDirection: ListSwipeItem.SwipeDirection?,
) {
// 操作完了でリフレッシュ許可
// mRefreshLayout.setEnabled( USE_SWIPE_REFRESH );
// 左にスワイプした(右端に青が見えた) なら要素を削除する
if (swipedDirection == ListSwipeItem.SwipeDirection.LEFT) {
val o = item?.tag
if (o is MyItem) {
UserRelation.deletePseudo(o.id)
listAdapter.removeItem(listAdapter.getPositionForItem(o))
}
}
}
})
setContentView(views.root)
setSupportActionBar(views.toolbar)
setNavigationBack(views.toolbar)
fixHorizontalMargin(views.llContent)
views.listView.adapter = listAdapter
}
private fun loadData() {
val tmpList = ArrayList<MyItem>()
try {
UserRelation.createCursorPseudo().use { cursor ->
val idxId = UserRelation.COL_ID.getIndex(cursor)
val idxName = UserRelation.COL_WHO_ID.getIndex(cursor)
while (cursor.moveToNext()) {
val id = cursor.getLong(idxId)
val name = cursor.getString(idxName)
val item = MyItem(id, name)
tmpList.add(item)
listAdapter.items = buildList {
try {
UserRelation.createCursorPseudoMuted().use { cursor ->
val idxId = UserRelation.COL_ID.getIndex(cursor)
val idxName = UserRelation.COL_WHO_ID.getIndex(cursor)
while (cursor.moveToNext()) {
val item = MyItem(
id = cursor.getLong(idxId),
name = cursor.getString(idxName)
)
add(item)
}
}
} catch (ex: Throwable) {
log.e(ex, "loadData failed.")
}
} catch (ex: Throwable) {
log.e(ex, "loadData failed.")
}
}
listAdapter.itemList = tmpList
private fun delete(item: MyItem?) {
item ?: return
launchAndShowError {
confirm(R.string.delete_confirm, item.name)
UserRelation.deletePseudo(item.id)
listAdapter.remove(item)
}
}
// リスト要素のデータ
internal class MyItem(val id: Long, val name: String)
private class MyItem(val id: Long, val name: String)
// リスト要素のViewHolder
internal class MyViewHolder(viewRoot: View) :
DragItemAdapter.ViewHolder(viewRoot, R.id.ivDragHandle, false) {
val tvName: TextView
private inner class MyViewHolder(parent: ViewGroup?) {
val views = LvMuteAppBinding.inflate(layoutInflater, parent, false)
private var lastItem: MyItem? = null
init {
views.root.tag = this
views.btnDelete.setOnClickListener { delete(lastItem) }
}
tvName = viewRoot.findViewById(R.id.tvName)
fun bind(item: MyItem?) {
item ?: return
lastItem = item
views.tvName.text = item.name
}
}
// リスト要素のビューが ListSwipeItem だった場合、Swipe操作を制御できる
if (viewRoot is ListSwipeItem) {
viewRoot.setSwipeInStyle(ListSwipeItem.SwipeInStyle.SLIDE)
viewRoot.supportedSwipeDirection = ListSwipeItem.SwipeDirection.LEFT
private inner class MyListAdapter : BaseAdapter() {
var items: List<MyItem> = emptyList()
set(value) {
field = value
notifyDataSetChanged()
}
} // View ID。 ここを押すとドラッグ操作をすぐに開始する
// 長押しでドラッグ開始するなら真
fun bind(item: MyItem) {
itemView.tag = item // itemView は親クラスのメンバ変数
tvName.text = item.name
fun remove(item: MyItem) {
items = items.filter { it != item }
}
// @Override
// public boolean onItemLongClicked( View view ){
// return false;
// }
override fun getCount() = items.size
override fun getItem(position: Int) = items.elementAtOrNull(position)
override fun getItemId(position: Int) = 0L
override fun getView(position: Int, convertView: View?, parent: ViewGroup?) =
(convertView?.tag?.cast() ?: MyViewHolder(parent))
.also { it.bind(items.elementAtOrNull(position)) }
.views.root
// @Override
// public void onItemClicked( View view ){
// }
}
// ドラッグ操作中のデータ
private inner class MyDragItem(context: Context, layoutId: Int) :
DragItem(context, layoutId) {
override fun onBindDragView(clickedView: View, dragView: View) {
dragView.findViewById<TextView>(R.id.tvName).text =
clickedView.findViewById<TextView>(R.id.tvName).text
dragView.findViewById<View>(R.id.item_layout)
.setBackgroundColor(attrColor(R.attr.list_item_bg_pressed_dragged))
}
}
private inner class MyListAdapter :
DragItemAdapter<MyItem, MyViewHolder>() {
init {
setHasStableIds(true)
itemList = ArrayList()
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MyViewHolder {
val view = layoutInflater.inflate(R.layout.lv_mute_app, parent, false)
return MyViewHolder(view)
}
override fun onBindViewHolder(holder: MyViewHolder, position: Int) {
super.onBindViewHolder(holder, position)
holder.bind(itemList[position])
}
override fun getUniqueItemId(position: Int): Long {
val item = mItemList[position] // mItemList は親クラスのメンバ変数
return item.id
}
override fun isEnabled(position: Int) = false
}
}

View File

@ -1,20 +1,19 @@
package jp.juggler.subwaytooter
import android.content.Context
import android.os.Bundle
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import android.widget.BaseAdapter
import androidx.appcompat.app.AppCompatActivity
import com.woxthebox.draglistview.DragItem
import com.woxthebox.draglistview.DragItemAdapter
import com.woxthebox.draglistview.DragListView
import com.woxthebox.draglistview.swipe.ListSwipeHelper
import com.woxthebox.draglistview.swipe.ListSwipeItem
import jp.juggler.subwaytooter.databinding.ActWordListBinding
import jp.juggler.subwaytooter.databinding.LvMuteAppBinding
import jp.juggler.subwaytooter.dialog.DlgConfirm.confirm
import jp.juggler.subwaytooter.table.MutedWord
import jp.juggler.util.backPressed
import jp.juggler.util.coroutine.launchAndShowError
import jp.juggler.util.data.cast
import jp.juggler.util.log.LogCategory
import jp.juggler.util.ui.attrColor
import jp.juggler.util.ui.setNavigationBack
class ActMutedWord : AppCompatActivity() {
@ -22,8 +21,11 @@ class ActMutedWord : AppCompatActivity() {
private val log = LogCategory("ActMutedWord")
}
private lateinit var listView: DragListView
private lateinit var listAdapter: MyListAdapter
private val views by lazy {
ActWordListBinding.inflate(layoutInflater)
}
private val listAdapter by lazy { MyListAdapter() }
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
@ -37,159 +39,81 @@ class ActMutedWord : AppCompatActivity() {
}
private fun initUI() {
setContentView(R.layout.act_word_list)
App1.initEdgeToEdge(this)
fixHorizontalPadding0(findViewById(R.id.llContent))
// リストのアダプター
listAdapter = MyListAdapter()
// ハンドル部分をドラッグで並べ替えできるRecyclerView
listView = findViewById(R.id.drag_list_view)
listView.setLayoutManager(androidx.recyclerview.widget.LinearLayoutManager(this))
listView.setAdapter(listAdapter, false)
listView.setCanDragHorizontally(true)
listView.isDragEnabled = false
listView.setCustomDragItem(MyDragItem(this, R.layout.lv_mute_app))
listView.recyclerView.isVerticalScrollBarEnabled = true
// listView.setDragListListener( new DragListView.DragListListenerAdapter() {
// @Override
// public void onItemDragStarted( int position ){
// // 操作中はリフレッシュ禁止
// // mRefreshLayout.setEnabled( false );
// }
//
// @Override
// public void onItemDragEnded( int fromPosition, int toPosition ){
// // 操作完了でリフレッシュ許可
// // mRefreshLayout.setEnabled( USE_SWIPE_REFRESH );
//
//// if( fromPosition != toPosition ){
//// // 並べ替えが発生した
//// }
// }
// } );
// リストを左右スワイプした
listView.setSwipeListener(object : ListSwipeHelper.OnSwipeListenerAdapter() {
override fun onItemSwipeStarted(item: ListSwipeItem?) {
// 操作中はリフレッシュ禁止
// mRefreshLayout.setEnabled( false );
}
override fun onItemSwipeEnded(
item: ListSwipeItem?,
swipedDirection: ListSwipeItem.SwipeDirection?,
) {
// 操作完了でリフレッシュ許可
// mRefreshLayout.setEnabled( USE_SWIPE_REFRESH );
// 左にスワイプした(右端に青が見えた) なら要素を削除する
if (swipedDirection == ListSwipeItem.SwipeDirection.LEFT) {
val o = item?.tag
if (o is MyItem) {
MutedWord.delete(o.name)
listAdapter.removeItem(listAdapter.getPositionForItem(o))
}
}
}
})
setContentView(views.root)
setSupportActionBar(views.toolbar)
setNavigationBack(views.toolbar)
fixHorizontalMargin(views.llContent)
views.listView.adapter = listAdapter
}
private fun loadData() {
val tmpList = ArrayList<MyItem>()
try {
MutedWord.createCursor().use { cursor ->
val idxId = cursor.getColumnIndex(MutedWord.COL_ID)
val idxName = cursor.getColumnIndex(MutedWord.COL_NAME)
while (cursor.moveToNext()) {
val id = cursor.getLong(idxId)
val name = cursor.getString(idxName)
val item = MyItem(id, name)
tmpList.add(item)
listAdapter.items = buildList {
try {
MutedWord.createCursor().use { cursor ->
val idxId = cursor.getColumnIndex(MutedWord.COL_ID)
val idxName = cursor.getColumnIndex(MutedWord.COL_NAME)
while (cursor.moveToNext()) {
val item = MyItem(
id = cursor.getLong(idxId),
name = cursor.getString(idxName)
)
add(item)
}
}
} catch (ex: Throwable) {
log.e(ex, "loadData failed.")
}
} catch (ex: Throwable) {
log.e(ex, "loadData failed.")
}
}
listAdapter.itemList = tmpList
private fun delete(item: MyItem?) {
item ?: return
launchAndShowError {
confirm(R.string.delete_confirm, item.name)
MutedWord.delete(item.name)
listAdapter.remove(item)
}
}
// リスト要素のデータ
internal class MyItem(val id: Long, val name: String)
private class MyItem(val id: Long, val name: String)
// リスト要素のViewHolder
internal class MyViewHolder(viewRoot: View) :
DragItemAdapter.ViewHolder(viewRoot, R.id.ivDragHandle, false) {
val tvName: TextView
private inner class MyViewHolder(parent: ViewGroup?) {
val views = LvMuteAppBinding.inflate(layoutInflater, parent, false)
private var lastItem: MyItem? = null
init {
views.root.tag = this
views.btnDelete.setOnClickListener { delete(lastItem) }
}
tvName = viewRoot.findViewById(R.id.tvName)
fun bind(item: MyItem?) {
item ?: return
lastItem = item
views.tvName.text = item.name
}
}
// リスト要素のビューが ListSwipeItem だった場合、Swipe操作を制御できる
if (viewRoot is ListSwipeItem) {
viewRoot.setSwipeInStyle(ListSwipeItem.SwipeInStyle.SLIDE)
viewRoot.supportedSwipeDirection = ListSwipeItem.SwipeDirection.LEFT
private inner class MyListAdapter : BaseAdapter() {
var items: List<MyItem> = emptyList()
set(value) {
field = value
notifyDataSetChanged()
}
} // View ID。 ここを押すとドラッグ操作をすぐに開始する
// 長押しでドラッグ開始するなら真
fun bind(item: MyItem) {
itemView.tag = item // itemView は親クラスのメンバ変数
tvName.text = item.name
fun remove(item: MyItem?) {
items = items.filter { it != item }
}
// @Override
// public boolean onItemLongClicked( View view ){
// return false;
// }
override fun getCount() = items.size
override fun getItem(position: Int) = items.elementAtOrNull(position)
override fun getItemId(position: Int) = 0L
override fun getView(position: Int, convertView: View?, parent: ViewGroup?) =
(convertView?.tag?.cast() ?: MyViewHolder(parent))
.also { it.bind(items.elementAtOrNull(position)) }
.views.root
// @Override
// public void onItemClicked( View view ){
// }
}
// ドラッグ操作中のデータ
private inner class MyDragItem(context: Context, layoutId: Int) :
DragItem(context, layoutId) {
override fun onBindDragView(clickedView: View, dragView: View) {
dragView.findViewById<TextView>(R.id.tvName).text =
clickedView.findViewById<TextView>(R.id.tvName).text
dragView.findViewById<View>(R.id.item_layout)
.setBackgroundColor(attrColor(R.attr.list_item_bg_pressed_dragged))
}
}
private inner class MyListAdapter : DragItemAdapter<MyItem, MyViewHolder>() {
init {
setHasStableIds(true)
itemList = ArrayList()
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MyViewHolder {
val view = layoutInflater.inflate(R.layout.lv_mute_app, parent, false)
return MyViewHolder(view)
}
override fun onBindViewHolder(holder: MyViewHolder, position: Int) {
super.onBindViewHolder(holder, position)
holder.bind(itemList[position])
}
override fun getUniqueItemId(position: Int): Long {
val item = mItemList[position] // mItemList は親クラスのメンバ変数
return item.id
}
override fun isEnabled(position: Int) = false
}
}

View File

@ -15,10 +15,12 @@ import jp.juggler.subwaytooter.api.entity.Acct
import jp.juggler.subwaytooter.databinding.ActNicknameBinding
import jp.juggler.subwaytooter.table.AcctColor
import jp.juggler.util.backPressed
import jp.juggler.util.boolean
import jp.juggler.util.data.mayUri
import jp.juggler.util.data.notEmpty
import jp.juggler.util.data.notZero
import jp.juggler.util.log.LogCategory
import jp.juggler.util.string
import jp.juggler.util.ui.*
import org.jetbrains.anko.backgroundColor
import org.jetbrains.anko.textColor
@ -47,9 +49,16 @@ class ActNickname : AppCompatActivity(), View.OnClickListener, ColorPickerDialog
ActNicknameBinding.inflate(layoutInflater)
}
private var showNotificationSound = false
private lateinit var acctAscii: String
private lateinit var acctPretty: String
private val acctAscii by lazy {
intent?.string(EXTRA_ACCT_ASCII)!!
}
private val acctPretty by lazy {
intent?.string(EXTRA_ACCT_PRETTY)!!
}
private val showNotificationSound by lazy {
intent?.boolean(EXTRA_SHOW_NOTIFICATION_SOUND) ?: false
}
private var colorFg = 0
private var colorBg = 0
private var notificationSoundUri: String? = null
@ -70,28 +79,22 @@ class ActNickname : AppCompatActivity(), View.OnClickListener, ColorPickerDialog
arNotificationSound.register(this)
App1.setActivityTheme(this)
val intent = intent
this.acctAscii = intent.getStringExtra(EXTRA_ACCT_ASCII)!!
this.acctPretty = intent.getStringExtra(EXTRA_ACCT_PRETTY)!!
this.showNotificationSound = intent.getBooleanExtra(EXTRA_SHOW_NOTIFICATION_SOUND, false)
initUI()
load()
}
private fun initUI() {
setContentView(views.root)
setSupportActionBar(views.toolbar)
setNavigationBack(views.toolbar)
title = getString(
supportActionBar?.subtitle = getString(
when {
showNotificationSound -> R.string.nickname_and_color_and_notification_sound
else -> R.string.nickname_and_color
}
)
setContentView(views.root)
App1.initEdgeToEdge(this)
fixHorizontalPadding(findViewById(R.id.llContent))
fixHorizontalMargin(views.llContent)
views.btnTextColorEdit.setOnClickListener(this)
views.btnTextColorReset.setOnClickListener(this)
@ -127,8 +130,7 @@ class ActNickname : AppCompatActivity(), View.OnClickListener, ColorPickerDialog
private fun load() {
loadingBusy = true
findViewById<View>(R.id.llNotificationSound).visibility =
if (showNotificationSound) View.VISIBLE else View.GONE
views.llNotificationSound.vg(showNotificationSound)
views.tvAcct.text = acctPretty

View File

@ -1,11 +1,12 @@
package jp.juggler.subwaytooter
import android.os.Bundle
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import jp.juggler.subwaytooter.databinding.ActOssLicenseBinding
import jp.juggler.util.data.decodeUTF8
import jp.juggler.util.data.loadRawResource
import jp.juggler.util.log.LogCategory
import jp.juggler.util.ui.setNavigationBack
class ActOSSLicense : AppCompatActivity() {
@ -13,15 +14,20 @@ class ActOSSLicense : AppCompatActivity() {
private val log = LogCategory("ActOSSLicense")
}
private val views by lazy {
ActOssLicenseBinding.inflate(layoutInflater)
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
App1.setActivityTheme(this, noActionBar = true)
setContentView(R.layout.act_oss_license)
App1.initEdgeToEdge(this)
App1.setActivityTheme(this)
setContentView(views.root)
setSupportActionBar(views.toolbar)
setNavigationBack(views.toolbar)
fixHorizontalMargin(views.svContent)
try {
findViewById<TextView>(R.id.tvText)
?.text = loadRawResource(R.raw.oss_license).decodeUTF8()
views.tvText.text = loadRawResource(R.raw.oss_license).decodeUTF8()
} catch (ex: Throwable) {
log.e(ex, "can't show license text.")
}

View File

@ -151,7 +151,7 @@ class ActPost : AppCompatActivity(),
val arMushroom = ActivityResultHandler(log) { r ->
if (r.isNotOk) return@ActivityResultHandler
r.data?.getStringExtra("replace_key")?.let { text ->
r.data?.string("replace_key")?.let { text ->
when (states.mushroomInput) {
0 -> applyMushroomText(views.etContent, text)
1 -> applyMushroomText(views.etContentWarning, text)
@ -175,7 +175,7 @@ class ActPost : AppCompatActivity(),
saveDraft()
}
if (isMultiWindowPost) ActMain.refActMain?.get()?.closeList?.add(WeakReference(this))
App1.setActivityTheme(this, noActionBar = true)
App1.setActivityTheme(this)
appState = App1.getAppState(this)
handler = appState.handler
pref = appState.pref
@ -316,7 +316,6 @@ class ActPost : AppCompatActivity(),
fun initUI() {
setContentView(views.root)
App1.initEdgeToEdge(this)
if (PrefB.bpPostButtonBarTop(pref)) {
val bar = findViewById<View>(R.id.llFooterBar)

View File

@ -6,10 +6,10 @@ import android.os.Build
import android.os.Bundle
import android.view.Menu
import android.view.MenuItem
import android.widget.EditText
import androidx.appcompat.app.AppCompatActivity
import jp.juggler.subwaytooter.api.entity.TootAccount
import jp.juggler.subwaytooter.api.entity.TootStatus
import jp.juggler.subwaytooter.databinding.ActTextBinding
import jp.juggler.subwaytooter.dialog.pickAccount
import jp.juggler.subwaytooter.table.MutedWord
import jp.juggler.subwaytooter.table.SavedAccount
@ -59,13 +59,17 @@ class ActText : AppCompatActivity() {
}
private var account: SavedAccount? = null
private lateinit var etText: EditText
private val views by lazy {
ActTextBinding.inflate(layoutInflater)
}
private val selection: String
get() {
val s = etText.selectionStart
val e = etText.selectionEnd
val text = etText.text.toString()
val et = views.etText
val s = et.selectionStart
val e = et.selectionEnd
val text = et.text.toString()
return if (s == e) {
text
} else {
@ -112,41 +116,34 @@ class ActText : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
App1.setActivityTheme(this, noActionBar = true)
App1.setActivityTheme(this)
val intent = intent
account = SavedAccount.loadAccount(this, intent.getLongExtra(EXTRA_ACCOUNT_DB_ID, -1L))
account = intent.long(EXTRA_ACCOUNT_DB_ID)
?.let { SavedAccount.loadAccount(this, it) }
initUI()
if (savedInstanceState == null) {
val sv = intent.getStringExtra(EXTRA_TEXT) ?: ""
val contentStart = intent.getIntExtra(EXTRA_CONTENT_START, 0)
val contentEnd = intent.getIntExtra(EXTRA_CONTENT_END, sv.length)
etText.setText(sv)
val sv = intent.string(EXTRA_TEXT) ?: ""
val contentStart = intent.int(EXTRA_CONTENT_START) ?: 0
val contentEnd = intent.int(EXTRA_CONTENT_END) ?: sv.length
views.etText.setText(sv)
// Android 9 以降ではフォーカスがないとsetSelectionできない
if (Build.VERSION.SDK_INT >= 28) {
etText.requestFocus()
etText.hideKeyboard()
views.etText.requestFocus()
views.etText.hideKeyboard()
}
etText.setSelection(contentStart, contentEnd)
views.etText.setSelection(contentStart, contentEnd)
}
}
internal fun initUI() {
setContentView(R.layout.act_text)
etText = findViewById(R.id.etText)
App1.initEdgeToEdge(this)
fixHorizontalMargin(etText)
setSupportActionBar(findViewById(R.id.toolbar))
supportActionBar?.apply {
setDisplayHomeAsUpEnabled(false)
setHomeButtonEnabled(false)
}
setContentView(views.root)
setSupportActionBar(views.toolbar)
setNavigationBack(views.toolbar)
fixHorizontalMargin(views.etText)
}
private fun send() {

View File

@ -1,7 +1,6 @@
package jp.juggler.subwaytooter
import android.annotation.SuppressLint
import android.app.Activity
import android.app.Application
import android.content.Context
import android.os.Build
@ -418,22 +417,19 @@ class App1 : Application() {
fun setActivityTheme(
activity: AppCompatActivity,
noActionBar: Boolean = false,
forceDark: Boolean = false,
) {
prepare(activity.applicationContext, "setActivityTheme")
var nTheme = PrefI.ipUiTheme(appPref)
if (forceDark && nTheme == 0) nTheme = 1
activity.setTheme(
when (nTheme) {
2 -> if (noActionBar) R.style.AppTheme_Mastodon_NoActionBar else R.style.AppTheme_Dark
1 -> if (noActionBar) R.style.AppTheme_Dark_NoActionBar else R.style.AppTheme_Mastodon
else -> if (noActionBar) R.style.AppTheme_Light_NoActionBar else R.style.AppTheme_Light
2 -> R.style.AppTheme_Mastodon
1 -> R.style.AppTheme_Dark
else -> R.style.AppTheme_Light
}
)
activity.setStatusBarColor(forceDark = forceDark)
}
@ -514,19 +510,6 @@ class App1 : Application() {
null
}
}
// https://developer.android.com/preview/features/gesturalnav?hl=ja
fun initEdgeToEdge(@Suppress("UNUSED_PARAMETER") activity: Activity) {
//if(Build.VERSION.SDK_INT >= 29){
// val viewRoot = activity.findViewById<ViewGroup>(android.R.id.content).getChildAt(0)
// viewRoot.systemUiVisibility = (viewRoot.systemUiVisibility
// or View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
// or View.SYSTEM_UI_FLAG_LAYOUT_STABLE)
// viewRoot.setOnApplyWindowInsetsListener { v, insets ->
// insets.consumeSystemWindowInsets()
// }
//}
}
}
}

View File

@ -8,6 +8,7 @@ import jp.juggler.util.data.getIntOrNull
import jp.juggler.util.data.getStringOrNull
import jp.juggler.util.log.LogCategory
import jp.juggler.util.log.showToast
import jp.juggler.util.long
class DownloadReceiver : BroadcastReceiver() {
@ -24,7 +25,9 @@ class DownloadReceiver : BroadcastReceiver() {
context.getSystemService(Context.DOWNLOAD_SERVICE) as DownloadManager
try {
val id = intent.getLongExtra(DownloadManager.EXTRA_DOWNLOAD_ID, 0L)
val id = intent.long(DownloadManager.EXTRA_DOWNLOAD_ID)
?: error("missing download id")
val query = DownloadManager.Query().setFilterById(id)
downloadManager.query(query)?.use { cursor ->

View File

@ -39,7 +39,7 @@ private val log = LogCategory("Styler")
fun defaultColorIcon(context: Context, iconId: Int): Drawable? =
ContextCompat.getDrawable(context, iconId)?.also {
it.setTint(context.attrColor(R.attr.colorVectorDrawable))
it.setTint(context.attrColor(R.attr.colorTextContent))
it.setTintMode(PorterDuff.Mode.SRC_IN)
}
@ -146,7 +146,7 @@ fun getVisibilityCaption(
val iconId = getVisibilityIconId(isMisskeyData, visibility)
val sv = getVisibilityString(context, isMisskeyData, visibility)
val color = context.attrColor(R.attr.colorVectorDrawable)
val color = context.attrColor(R.attr.colorTextContent)
val sb = SpannableStringBuilder()
// アイコン部分
@ -181,14 +181,16 @@ fun setFollowIcon(
defaultColor: Int,
alphaMultiplier: Float,
) {
fun colorAccent() =
val colorFollowed =
PrefI.ipButtonFollowingColor(context.pref()).notZero()
?: context.attrColor(R.attr.colorButtonAccentFollow)
fun colorError() =
val colorFollowRequest =
PrefI.ipButtonFollowRequestColor(context.pref()).notZero()
?: context.attrColor(R.attr.colorButtonAccentFollowRequest)
val colorError = context.attrColor(R.attr.colorRegexFilterError)
// 被フォロー状態
when {
@ -198,7 +200,7 @@ fun setFollowIcon(
context,
ivDot,
R.drawable.ic_blocked_by,
color = colorError(),
color = colorError,
alphaMultiplier = alphaMultiplier
)
}
@ -209,7 +211,7 @@ fun setFollowIcon(
context,
ivDot,
R.drawable.ic_requested_by,
color = colorError(),
color = colorFollowRequest,
alphaMultiplier = alphaMultiplier
)
}
@ -220,7 +222,7 @@ fun setFollowIcon(
context,
ivDot,
R.drawable.ic_follow_dot,
color = colorAccent(),
color = colorFollowed,
alphaMultiplier = alphaMultiplier
)
// 被フォローリクエスト状態の時に followed_by が 真と偽の両方がありえるようなので
@ -254,13 +256,13 @@ fun setFollowIcon(
relation.getFollowing(who) -> {
iconId = R.drawable.ic_follow_cross
color = colorAccent()
color = colorFollowed
contentDescription = context.getString(R.string.unfollow)
}
relation.getRequested(who) -> {
iconId = R.drawable.ic_follow_wait
color = colorError()
color = colorFollowRequest
contentDescription = context.getString(R.string.unfollow)
}
@ -358,13 +360,13 @@ fun fixHorizontalMargin(v: View) {
}
// ActMainの初期化時に更新される
var round_ratio: Float = 0.33f * 0.5f
var boostAlpha: Float = 1f
var stylerRoundRatio: Float = 0.33f * 0.5f
var stylerBoostAlpha: Float = 1f
fun calcIconRound(wh: Int) = wh.toFloat() * round_ratio
fun calcIconRound(wh: Int) = wh.toFloat() * stylerRoundRatio
fun calcIconRound(lp: ViewGroup.LayoutParams) =
min(lp.width, lp.height).toFloat() * round_ratio
min(lp.width, lp.height).toFloat() * stylerRoundRatio
fun SpannableStringBuilder.appendColorShadeIcon(
context: Context,

View File

@ -8,6 +8,7 @@ import jp.juggler.subwaytooter.api.entity.EntityId
import jp.juggler.subwaytooter.column.*
import jp.juggler.subwaytooter.pref.PrefI
import jp.juggler.util.data.decodeJsonObject
import jp.juggler.util.string
import jp.juggler.util.ui.isLiveActivity
// マルチウィンドウモードでは投稿画面から直接呼ばれる
@ -15,14 +16,14 @@ import jp.juggler.util.ui.isLiveActivity
fun ActMain.onCompleteActPost(data: Intent) {
if (!isLiveActivity) return
this.postedAcct = data.getStringExtra(ActPost.EXTRA_POSTED_ACCT)?.let { Acct.parse(it) }
this.postedAcct = data.string(ActPost.EXTRA_POSTED_ACCT)?.let { Acct.parse(it) }
if (data.extras?.containsKey(ActPost.EXTRA_POSTED_STATUS_ID) == true) {
postedStatusId = EntityId.from(data, ActPost.EXTRA_POSTED_STATUS_ID)
postedReplyId = EntityId.from(data, ActPost.EXTRA_POSTED_REPLY_ID)
postedRedraftId = EntityId.from(data, ActPost.EXTRA_POSTED_REDRAFT_ID)
val postedStatusId = postedStatusId
val statusJson = data.getStringExtra(ActPost.KEY_EDIT_STATUS)
val statusJson = data.string(ActPost.KEY_EDIT_STATUS)
?.decodeJsonObject()
if (statusJson != null && postedStatusId != null) {
appState.columnList

View File

@ -336,7 +336,7 @@ fun ActMain.setColumnsOrder(newOrder: List<Int>) {
}
fun ActMain.searchFromActivityResult(data: Intent?, columnType: ColumnType) =
data?.getStringExtra(Intent.EXTRA_TEXT)?.let {
data?.string(Intent.EXTRA_TEXT)?.let {
addColumn(
false,
defaultInsertPosition,

View File

@ -8,14 +8,14 @@ import android.widget.LinearLayout
import jp.juggler.subwaytooter.ActMain
import jp.juggler.subwaytooter.R
import jp.juggler.subwaytooter.api.entity.TootStatus
import jp.juggler.subwaytooter.boostAlpha
import jp.juggler.subwaytooter.stylerBoostAlpha
import jp.juggler.subwaytooter.itemviewholder.ItemViewHolder
import jp.juggler.subwaytooter.pref.PrefB
import jp.juggler.subwaytooter.pref.PrefF
import jp.juggler.subwaytooter.pref.PrefI
import jp.juggler.subwaytooter.pref.PrefS
import jp.juggler.subwaytooter.pref.impl.StringPref
import jp.juggler.subwaytooter.round_ratio
import jp.juggler.subwaytooter.stylerRoundRatio
import jp.juggler.subwaytooter.span.MyClickableSpan
import jp.juggler.subwaytooter.util.CustomShare
import jp.juggler.subwaytooter.view.ListDivider
@ -98,12 +98,12 @@ fun ActMain.reloadRoundRatio() {
?.takeIf { it.isFinite() }
?: 33f
}
round_ratio = (sizeDp / 100f).clip(0f, 1f) * 0.5f
stylerRoundRatio = (sizeDp / 100f).clip(0f, 1f) * 0.5f
}
// initUI から呼ばれる
fun ActMain.reloadBoostAlpha() {
boostAlpha = PrefS.spBoostAlpha(pref)
stylerBoostAlpha = PrefS.spBoostAlpha(pref)
.toIntOrNull()
?.toFloat()
?.let { (it + 0.5f) / 100f }
@ -243,7 +243,7 @@ fun ActMain.showFooterColor() {
getAdaptiveRippleDrawableRound(this, colorButtonBg, colorButtonFg)
val csl = ColorStateList.valueOf(
footerButtonFgColor.notZero() ?: attrColor(R.attr.colorVectorDrawable)
footerButtonFgColor.notZero() ?: attrColor(R.attr.colorTextContent)
)
btnToot.imageTintList = csl
btnMenu.imageTintList = csl
@ -255,7 +255,7 @@ fun ActMain.showFooterColor() {
vFooterDivider2.setBackgroundColor(c)
llColumnStrip.indicatorColor =
footerTabIndicatorColor.notZero() ?: attrColor(R.attr.colorAccent)
footerTabIndicatorColor.notZero() ?: attrColor(R.attr.colorTextHelp)
}
fun ActMain.closePopup() {

View File

@ -19,11 +19,9 @@ import jp.juggler.subwaytooter.util.DecodeOptions
import jp.juggler.subwaytooter.util.PostAttachment
import jp.juggler.subwaytooter.util.PostImpl
import jp.juggler.subwaytooter.util.PostResult
import jp.juggler.util.*
import jp.juggler.util.coroutine.launchAndShowError
import jp.juggler.util.data.CharacterGroup
import jp.juggler.util.getIntentExtra
import jp.juggler.util.getStreamUriExtra
import jp.juggler.util.getStreamUriListExtra
import jp.juggler.util.log.LogCategory
import jp.juggler.util.log.showToast
import jp.juggler.util.ui.vg
@ -81,9 +79,9 @@ fun ActPost.appendContentText(src: Intent) {
val list = ArrayList<String>()
var sv: String?
sv = src.getStringExtra(Intent.EXTRA_SUBJECT)
sv = src.string(Intent.EXTRA_SUBJECT)
if (sv?.isNotEmpty() == true) list.add(sv)
sv = src.getStringExtra(Intent.EXTRA_TEXT)
sv = src.string(Intent.EXTRA_TEXT)
if (sv?.isNotEmpty() == true) list.add(sv)
if (list.isNotEmpty()) {
@ -183,8 +181,9 @@ fun ActPost.updateText(
if (resetAccount) {
states.visibility = null
this.account = null
val accountDbId = intent.getLongExtra(ActPost.KEY_ACCOUNT_DB_ID, SavedAccount.INVALID_DB_ID)
accountList.find { it.db_id == accountDbId }?.let { selectAccount(it) }
intent.long(ActPost.KEY_ACCOUNT_DB_ID)
?.let { dbId -> accountList.find { it.db_id == dbId } }
?.let { selectAccount(it) }
}
val sharedIntent = intent.getIntentExtra(ActPost.KEY_SHARED_INTENT)
@ -193,12 +192,12 @@ fun ActPost.updateText(
initializeFromSharedIntent(sharedIntent)
}
appendContentText(intent.getStringExtra(ActPost.KEY_INITIAL_TEXT))
appendContentText(intent.string(ActPost.KEY_INITIAL_TEXT))
val account = this.account
if (account != null) {
intent.getStringExtra(ActPost.KEY_REPLY_STATUS)
intent.string(ActPost.KEY_REPLY_STATUS)
?.let { initializeFromReplyStatus(account, it) }
}
@ -207,15 +206,15 @@ fun ActPost.updateText(
if (account != null) {
// 再編集
intent.getStringExtra(ActPost.KEY_REDRAFT_STATUS)
intent.string(ActPost.KEY_REDRAFT_STATUS)
?.let { initializeFromRedraftStatus(account, it) }
// 再編集
intent.getStringExtra(ActPost.KEY_EDIT_STATUS)
intent.string(ActPost.KEY_EDIT_STATUS)
?.let { initializeFromEditStatus(account, it) }
// 予約編集の再編集
intent.getStringExtra(ActPost.KEY_SCHEDULED_STATUS)
intent.string(ActPost.KEY_SCHEDULED_STATUS)
?.let { initializeFromScheduledStatus(account, it) }
}

View File

@ -7,6 +7,7 @@ import android.os.Bundle
import jp.juggler.util.data.JsonObject
import jp.juggler.util.data.getStringOrNull
import jp.juggler.util.data.notZero
import jp.juggler.util.string
import kotlinx.serialization.KSerializer
import kotlinx.serialization.descriptors.PrimitiveKind
import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor
@ -36,10 +37,10 @@ class EntityId(val x: String) : Comparable<EntityId> {
}
fun from(intent: Intent?, key: String) =
intent?.getStringExtra(key)?.decode()
intent?.string(key)?.decode()
fun from(bundle: Bundle?, key: String) =
bundle?.getString(key)?.decode()
bundle?.string(key)?.decode()
// 内部保存データのデコード用。APIレスポンスのパースに使ってはいけない
fun from(data: JsonObject?, key: String): EntityId? {

View File

@ -885,7 +885,7 @@ val appSettingRoot = AppSettingItem(null, SettingType.Section, R.string.app_sett
tvSampleContent.setTextColor(
colorColumnText.notZero()
?: activity.attrColor(R.attr.colorContentText)
?: activity.attrColor(R.attr.colorTextContent)
)
}
@ -937,7 +937,7 @@ val appSettingRoot = AppSettingItem(null, SettingType.Section, R.string.app_sett
val csl = ColorStateList.valueOf(
footerButtonFgColor.notZero()
?: activity.attrColor(R.attr.colorVectorDrawable)
?: activity.attrColor(R.attr.colorTextContent)
)
ivFooterToot.imageTintList = csl
ivFooterMenu.imageTintList = csl
@ -949,7 +949,7 @@ val appSettingRoot = AppSettingItem(null, SettingType.Section, R.string.app_sett
vIndicator.setBackgroundColor(
footerTabIndicatorColor.notZero()
?: activity.attrColor(android.R.attr.colorAccent)
?: activity.attrColor(R.attr.colorTextHelp)
)
}

View File

@ -109,7 +109,7 @@ class Column(
?: activity.attrColor(R.attr.colorTimeSmall)
defaultColorContentText = PrefI.ipCcdContentText(pref).notZero()
?: activity.attrColor(R.attr.colorContentText)
?: activity.attrColor(R.attr.colorTextContent)
}
private val internalIdSeed = AtomicInteger(0)

View File

@ -7,12 +7,10 @@ import jp.juggler.subwaytooter.notification.onNotificationCleared
import jp.juggler.subwaytooter.table.SavedAccount
import jp.juggler.subwaytooter.util.BucketList
import jp.juggler.subwaytooter.util.matchHost
import jp.juggler.util.coroutine.EmptyScope
import jp.juggler.util.data.JsonObject
import jp.juggler.util.log.LogCategory
import jp.juggler.util.ui.AdapterChange
import jp.juggler.util.ui.AdapterChangeType
import kotlinx.coroutines.launch
import kotlin.collections.set
private val log = LogCategory("ColumnActions")
@ -194,14 +192,7 @@ fun Column.removeNotifications() {
listData.clear()
duplicateMap.clear()
fireShowContent(reason = "removeNotifications", reset = true)
EmptyScope.launch {
try {
onNotificationCleared(context, accessInfo.db_id)
} catch (ex: Throwable) {
log.e(ex, "onNotificationCleared failed.")
}
}
onNotificationCleared(context, accessInfo.db_id)
}
// 通知を削除した後に呼ばれる

View File

@ -1071,7 +1071,7 @@ class ColumnViewHolder(
contentDescription = context.getString(R.string.add)
imageResource = R.drawable.ic_add
imageTintList = ColorStateList.valueOf(
context.attrColor(R.attr.colorVectorDrawable)
context.attrColor(R.attr.colorTextContent)
)
}.lparams(dip(40), dip(40)) {
startMargin = dip(4)
@ -1082,7 +1082,7 @@ class ColumnViewHolder(
contentDescription = context.getString(R.string.clear)
imageResource = R.drawable.ic_close
imageTintList = ColorStateList.valueOf(
context.attrColor(R.attr.colorVectorDrawable)
context.attrColor(R.attr.colorTextContent)
)
}.lparams(dip(40), dip(40)) {
startMargin = dip(4)
@ -1093,7 +1093,7 @@ class ColumnViewHolder(
contentDescription = context.getString(R.string.search)
imageResource = R.drawable.ic_search
imageTintList = ColorStateList.valueOf(
context.attrColor(R.attr.colorVectorDrawable)
context.attrColor(R.attr.colorTextContent)
)
}.lparams(dip(40), dip(40)) {
startMargin = dip(4)
@ -1132,9 +1132,7 @@ class ColumnViewHolder(
contentDescription = context.getString(R.string.add)
imageResource = R.drawable.ic_add
imageTintList = ColorStateList.valueOf(
context.attrColor(
R.attr.colorVectorDrawable
)
context.attrColor(R.attr.colorTextContent)
)
}.lparams(dip(40), dip(40)) {
startMargin = dip(4)

View File

@ -309,7 +309,6 @@ private fun ColumnViewHolder.showReactionPlus(
b,
R.drawable.ic_add,
color = contentColor,
alphaMultiplier = 1f
)
box.addView(b)

View File

@ -37,7 +37,7 @@ fun ColumnViewHolder.showQuickFilter() {
if (insideColumnSetting) {
svQuickFilter.setBackgroundColor(0)
val colorFg = activity.attrColor(R.attr.colorContentText)
val colorFg = activity.attrColor(R.attr.colorTextContent)
val colorBgSelected = colorFg.applyAlphaMultiplier(0.25f)
val colorFgList = ColorStateList.valueOf(colorFg)
val colorBg = activity.attrColor(R.attr.colorColumnSettingBackground)

View File

@ -110,7 +110,7 @@ internal class ViewHolderHeaderProfile(
private val tvPersonalNotes: TextView
private val btnPersonalNotesEdit: ImageButton
private var contentColor = 0
private var colorTextContent = 0
private var relation: UserRelation? = null
init {
@ -220,7 +220,7 @@ internal class ViewHolderHeaderProfile(
// bind時に呼ばれる
private fun bindColors() {
val contentColor = column.getContentColor()
this.contentColor = contentColor
this.colorTextContent = contentColor
tvPersonalNotes.textColor = contentColor
tvMoved.textColor = contentColor
@ -238,7 +238,7 @@ internal class ViewHolderHeaderProfile(
btnMore,
R.drawable.ic_more,
color = contentColor,
alphaMultiplier = boostAlpha
alphaMultiplier = stylerBoostAlpha
)
setIconDrawableId(
@ -246,7 +246,7 @@ internal class ViewHolderHeaderProfile(
btnPersonalNotesEdit,
R.drawable.ic_edit,
color = contentColor,
alphaMultiplier = boostAlpha
alphaMultiplier = stylerBoostAlpha
)
val acctColor = column.getAcctColor()
@ -378,8 +378,8 @@ internal class ViewHolderHeaderProfile(
ivFollowedBy,
relation,
who,
contentColor,
alphaMultiplier = boostAlpha
colorTextContent,
alphaMultiplier = stylerBoostAlpha
)
tvPersonalNotes.text = relation.note ?: ""
@ -421,8 +421,8 @@ internal class ViewHolderHeaderProfile(
ivMovedBy,
relation,
moved,
contentColor,
alphaMultiplier = boostAlpha
colorTextContent,
alphaMultiplier = stylerBoostAlpha
)
}
@ -693,7 +693,7 @@ internal class ViewHolderHeaderProfile(
nameLp.topMargin = (density * 6f).toInt()
nameView.layoutParams = nameLp
nameView.text = nameText
nameView.setTextColor(contentColor)
nameView.setTextColor(colorTextContent)
nameView.typeface = nameTypeface
nameView.movementMethod = MyLinkMovementMethod
llFields.addView(nameView)
@ -732,7 +732,7 @@ internal class ViewHolderHeaderProfile(
valueLp.startMargin = (density * 32f).toInt()
valueView.layoutParams = valueLp
valueView.text = valueText
valueView.setTextColor(contentColor)
valueView.setTextColor(colorTextContent)
valueView.typeface = valueTypeface
valueView.movementMethod = MyLinkMovementMethod

View File

@ -144,8 +144,7 @@ class DlgAppPicker(
activity,
ivImage,
R.drawable.ic_question,
color = activity.attrColor(R.attr.colorVectorDrawable),
alphaMultiplier = 1f
color = activity.attrColor(R.attr.colorTextContent),
)
}
tvText.text = item.text

View File

@ -98,7 +98,7 @@ object DlgConfirm {
confirm(getString(messageId, *args))
suspend fun AppCompatActivity.confirm(message: CharSequence) {
suspendCancellableCoroutine<Unit> { cont ->
suspendCancellableCoroutine { cont ->
try {
val views = DlgConfirmBinding.inflate(layoutInflater)
views.tvMessage.text = message

View File

@ -232,12 +232,12 @@ internal class DlgContextMenu(
PrefI.ipButtonFollowingColor(activity.pref).notZero()
?: activity.attrColor(R.attr.colorButtonAccentFollow)
val colorButtonError =
PrefI.ipButtonFollowRequestColor(activity.pref).notZero()
val colorButtonFollowRequest =
PrefI.ipButtonFollowRequestColor.invoke(activity.pref).notZero()
?: activity.attrColor(R.attr.colorButtonAccentFollowRequest)
val colorButtonNormal =
activity.attrColor(R.attr.colorImageButton)
activity.attrColor(R.attr.colorTextContent)
fun showRelation(relation: UserRelation) {
@ -266,7 +266,7 @@ internal class DlgContextMenu(
views.btnFollow.imageTintList = ColorStateList.valueOf(
when {
relation.getRequested(who) -> colorButtonError
relation.getRequested(who) -> colorButtonFollowRequest
relation.getFollowing(who) -> colorButtonAccent
else -> colorButtonNormal
}
@ -296,7 +296,7 @@ internal class DlgContextMenu(
views.ivFollowedBy.vg(false)
views.btnFollow.setImageResource(R.drawable.ic_follow_plus)
views.btnFollow.imageTintList =
ColorStateList.valueOf(activity.attrColor(R.attr.colorImageButton))
ColorStateList.valueOf(colorButtonNormal)
views.btnNotificationFrom.visibility = View.GONE
} else {

View File

@ -165,7 +165,7 @@ class ItemViewHolder(
var boostTime: Long = 0L
var contentColor: Int = 0
var colorTextContent: Int = 0
var acctColor: Int = 0
var contentColorCsl: ColorStateList = ColorStateList.valueOf(0)

View File

@ -160,7 +160,7 @@ fun ItemViewHolder.makeEnqueteChoiceView(
if (ratio != null) {
b.backgroundDrawable = PollPlotDrawable(
color = (contentColor and 0xFFFFFF) or 0x20000000,
color = (colorTextContent and 0xFFFFFF) or 0x20000000,
ratio = ratio,
isRtl = b.layoutDirection == View.LAYOUT_DIRECTION_RTL,
startWidth = (activity.density * 2f + 0.5f).toInt()

View File

@ -107,7 +107,7 @@ fun ItemViewHolder.makeReactionsView(status: TootStatus) {
)
}
setTextColor(contentColor)
setTextColor(colorTextContent)
setPadding(paddingH, 0, paddingH, 0)
text = ssb

View File

@ -154,7 +154,7 @@ fun ItemViewHolder.bind(
var c: Int
c = column.getContentColor()
this.contentColor = c
this.colorTextContent = c
this.contentColorCsl = ColorStateList.valueOf(c)
tvBoosted.setTextColor(c)
@ -291,8 +291,8 @@ fun ItemViewHolder.showAccount(whoRef: TootAccountRef) {
ivFollowedBy,
relation,
who,
contentColor,
alphaMultiplier = boostAlpha
colorTextContent,
alphaMultiplier = stylerBoostAlpha
)
if (column.type == ColumnType.FOLLOW_REQUESTS) {
@ -305,7 +305,7 @@ fun ItemViewHolder.showAccount(whoRef: TootAccountRef) {
fun ItemViewHolder.showAntenna(a: MisskeyAntenna) {
llList.visibility = View.VISIBLE
btnListTL.text = a.name
btnListTL.textColor = contentColor
btnListTL.textColor = colorTextContent
btnListMore.imageTintList = contentColorCsl
}
@ -326,8 +326,8 @@ fun ItemViewHolder.showBoost(
activity,
ivBoosted,
iconId,
color = contentColor,
alphaMultiplier = boostAlpha
color = colorTextContent,
alphaMultiplier = stylerBoostAlpha
)
ivBoostAvatar.let { v ->
@ -382,7 +382,7 @@ fun ItemViewHolder.showMessageHolder(item: TootMessageHolder) {
fun ItemViewHolder.showList(list: TootList) {
llList.visibility = View.VISIBLE
btnListTL.text = list.title
btnListTL.textColor = contentColor
btnListTL.textColor = colorTextContent
btnListMore.imageTintList = contentColorCsl
}
@ -486,8 +486,8 @@ fun ItemViewHolder.showReply(
activity,
ivReply,
iconId,
color = contentColor,
alphaMultiplier = boostAlpha
color = colorTextContent,
alphaMultiplier = stylerBoostAlpha
)
ivReplyAvatar.vg(target != null && target.avatar != replyer?.avatar)?.let { v ->
@ -808,8 +808,8 @@ fun ItemViewHolder.showScheduled(item: TootScheduled) {
activity,
btnHideMedia,
R.drawable.ic_close,
color = contentColor,
alphaMultiplier = boostAlpha
color = colorTextContent,
alphaMultiplier = stylerBoostAlpha
)
}

View File

@ -320,8 +320,8 @@ private fun ItemViewHolder.showAttachments(status: TootStatus) {
activity,
btnHideMedia,
R.drawable.ic_close,
color = contentColor,
alphaMultiplier = boostAlpha
color = colorTextContent,
alphaMultiplier = stylerBoostAlpha
)
}
}

View File

@ -16,7 +16,7 @@ import jp.juggler.subwaytooter.R
import jp.juggler.subwaytooter.action.*
import jp.juggler.subwaytooter.actmain.nextPosition
import jp.juggler.subwaytooter.api.entity.*
import jp.juggler.subwaytooter.boostAlpha
import jp.juggler.subwaytooter.stylerBoostAlpha
import jp.juggler.subwaytooter.column.Column
import jp.juggler.subwaytooter.column.getContentColor
import jp.juggler.subwaytooter.pref.PrefB
@ -86,7 +86,7 @@ class StatusButtons(
private val btnCustomShare3 = holder.btnCustomShare3
private val btnMore = holder.btnMore
private val colorNormal = column.getContentColor()
private val colorTextContent = column.getContentColor()
private var optionalButtonFirst: View? = null
private var optionalButtonCount = 0
@ -147,8 +147,8 @@ class StatusButtons(
activity,
btnConversation,
R.drawable.ic_forum,
color = colorNormal,
alphaMultiplier = boostAlpha
color = colorTextContent,
alphaMultiplier = stylerBoostAlpha
)
}
@ -157,8 +157,8 @@ class StatusButtons(
activity,
btnMore,
R.drawable.ic_more,
color = colorNormal,
alphaMultiplier = boostAlpha
color = colorTextContent,
alphaMultiplier = stylerBoostAlpha
)
}
@ -166,7 +166,7 @@ class StatusButtons(
setButton(
btnReply,
true,
colorNormal,
colorTextContent,
R.drawable.ic_reply,
when (val repliesCount = status.replies_count) {
null -> ""
@ -202,7 +202,7 @@ class StatusButtons(
setButton(
btnBoost,
false,
colorNormal,
colorTextContent,
R.drawable.ic_refresh,
"?",
activity.getString(R.string.boost)
@ -216,7 +216,7 @@ class StatusButtons(
PrefI.ipButtonBoostedColor(activity.pref).notZero()
?: activity.attrColor(R.attr.colorButtonAccentBoost)
else ->
colorNormal
colorTextContent
},
R.drawable.ic_repeat,
when (val boostsCount = status.reblogs_count) {
@ -241,7 +241,7 @@ class StatusButtons(
setButton(
it,
true,
colorNormal,
colorTextContent,
R.drawable.ic_quote,
activity.getString(R.string.quote)
)
@ -256,7 +256,7 @@ class StatusButtons(
setButton(
it,
true,
colorNormal,
colorTextContent,
if (bRemoveButton) R.drawable.ic_remove else R.drawable.ic_add,
activity.getString(
if (bRemoveButton) R.string.reaction_remove else R.string.reaction_add
@ -271,7 +271,7 @@ class StatusButtons(
setButton(
btnFavourite,
false,
colorNormal,
colorTextContent,
R.drawable.ic_refresh,
"?",
activity.getString(R.string.favourite)
@ -285,7 +285,7 @@ class StatusButtons(
status.favourited ->
PrefI.ipButtonFavoritedColor(activity.pref).notZero()
?: activity.attrColor(R.attr.colorButtonAccentFavourite)
else -> colorNormal
else -> colorTextContent
},
when {
status.favourited -> R.drawable.ic_star
@ -316,7 +316,7 @@ class StatusButtons(
setButton(
btn,
false,
colorNormal,
colorTextContent,
R.drawable.ic_refresh,
activity.getString(R.string.bookmark)
)
@ -330,7 +330,7 @@ class StatusButtons(
PrefI.ipButtonBookmarkedColor(activity.pref).notZero()
?: activity.attrColor(R.attr.colorButtonAccentBookmark)
else ->
colorNormal
colorTextContent
},
when {
status.bookmarked -> R.drawable.ic_bookmark_added
@ -356,8 +356,8 @@ class StatusButtons(
ivFollowedBy2,
relation,
account,
colorNormal,
alphaMultiplier = boostAlpha
colorTextContent,
alphaMultiplier = stylerBoostAlpha
)
relation
}
@ -393,8 +393,8 @@ class StatusButtons(
icon ?: createColoredDrawable(
this@StatusButtons.activity,
R.drawable.ic_question,
colorNormal,
boostAlpha
colorTextContent,
stylerBoostAlpha
)
)
++optionalButtonCount
@ -486,7 +486,7 @@ class StatusButtons(
count: String,
contentDescription: String,
) {
val alpha = boostAlpha
val alpha = stylerBoostAlpha
val d = createColoredDrawable(
activity,
drawableId,
@ -507,7 +507,7 @@ class StatusButtons(
drawableId: Int,
contentDescription: String,
) {
val alpha = boostAlpha
val alpha = stylerBoostAlpha
val d = createColoredDrawable(
activity,
drawableId,

View File

@ -62,7 +62,7 @@ object CheckerNotification {
.setAutoCancel(false)
.setOngoing(true)
.setSmallIcon(R.drawable.ic_notification)
.setColor(ContextCompat.getColor(context, R.color.Light_colorAccent))
.setColor(ContextCompat.getColor(context, R.color.colorOsNotificationAccent))
.setWhen(System.currentTimeMillis())
.setContentTitle(context.getString(R.string.loading_notification_title))
.setContentText(text)

View File

@ -121,7 +121,7 @@ object MessageNotification {
setSmallIcon(R.drawable.ic_notification)
// 常に白テーマの色を使う
builder.color = ContextCompat.getColor(context, R.color.Light_colorAccent)
color = ContextCompat.getColor(context, R.color.colorOsNotificationAccent)
// Android 7.0 ではグループを指定しないと勝手に通知が束ねられてしまう。
// 束ねられた通知をタップしても pi_click が実行されないので困るため、

View File

@ -190,15 +190,21 @@ fun restartAllWorker(context: Context) {
}
}
suspend fun onNotificationCleared(context: Context, accountDbId: Long) {
if (importProtector.get()) {
log.w("onNotificationCleared: abort by importProtector.")
return
}
PollingChecker.accountMutex(accountDbId).withLock {
log.d("deleteCacheData: db_id=$accountDbId")
SavedAccount.loadAccount(context, accountDbId) ?: return
NotificationCache.deleteCache(accountDbId)
fun onNotificationCleared(context: Context, accountDbId: Long) {
EmptyScope.launch {
try {
if (importProtector.get()) {
log.w("onNotificationCleared: abort by importProtector.")
return@launch
}
PollingChecker.accountMutex(accountDbId).withLock {
log.d("deleteCacheData: db_id=$accountDbId")
SavedAccount.loadAccount(context, accountDbId) ?: return@withLock
NotificationCache.deleteCache(accountDbId)
}
} catch (ex: Throwable) {
log.e(ex, "onNotificationCleared failed.")
}
}
}

View File

@ -101,7 +101,6 @@ class PollingWorker2(
private suspend fun showMessage(text: String) =
CheckerNotification.showMessage(applicationContext, text) {
try {
if (!isAppForehround()) error("app is not foreground.")
setForegroundAsync(ForegroundInfo(NOTIFICATION_ID_POLLING_WORKER, it))
.await()
} catch (ex: Throwable) {

View File

@ -48,21 +48,18 @@ object ServerTimeoutNotification {
val header = context.getString(R.string.error_notification_title)
val summary = context.getString(R.string.error_notification_summary)
builder
.setContentIntent(clickPi)
.setAutoCancel(true)
.setSmallIcon(R.drawable.ic_notification) // ここは常に白テーマのアイコンを使う
.setColor(
ContextCompat.getColor(
context,
R.color.Light_colorAccent
)
) // ここは常に白テーマの色を使う
.setWhen(System.currentTimeMillis())
.setGroup(context.packageName + ":" + "Error")
.setContentTitle(header)
.setContentText("$summary: $accounts")
// ここは常に白テーマのアイコンを使う
// ここは常に白テーマの色を使う
builder.apply {
setContentIntent(clickPi)
setAutoCancel(true)
setSmallIcon(R.drawable.ic_notification)
color = ContextCompat.getColor(context, R.color.colorOsNotificationAccent)
setWhen(System.currentTimeMillis())
setGroup(context.packageName + ":" + "Error")
setContentTitle(header)
setContentText("$summary: $accounts")
}
notificationManager.notify(NOTIFICATION_ID_TIMEOUT, builder.build())
}
}

View File

@ -74,7 +74,7 @@ class HighlightWord {
appDatabase.query(table, null, selection_name, arrayOf(name), null, null, null)
.use { cursor ->
if (cursor.moveToNext()) {
return HighlightWord(cursor)
return HighlightWord(cursor, ColIdx(cursor))
}
}
} catch (ex: Throwable) {
@ -95,7 +95,7 @@ class HighlightWord {
null
).use { cursor ->
if (cursor.moveToNext()) {
return HighlightWord(cursor)
return HighlightWord(cursor, ColIdx(cursor))
}
}
} catch (ex: Throwable) {
@ -196,14 +196,24 @@ class HighlightWord {
this.color_fg = -0x10000
}
constructor(cursor: Cursor) {
this.id = cursor.getLong(COL_ID)
this.name = cursor.getString(COL_NAME)
this.color_bg = cursor.getInt(COL_COLOR_BG)
this.color_fg = cursor.getInt(COL_COLOR_FG)
this.sound_type = cursor.getInt(COL_SOUND_TYPE)
this.sound_uri = cursor.getStringOrNull(COL_SOUND_URI)
this.speech = cursor.getInt(COL_SPEECH)
class ColIdx(cursor: Cursor) {
val idxId = cursor.columnIndexOrThrow(COL_ID)
val idxName = cursor.columnIndexOrThrow(COL_NAME)
val idxColorBg = cursor.columnIndexOrThrow(COL_COLOR_BG)
val idxColorFg = cursor.columnIndexOrThrow(COL_COLOR_FG)
val idxSountType = cursor.columnIndexOrThrow(COL_SOUND_TYPE)
val idxSoundUri = cursor.columnIndexOrThrow(COL_SOUND_URI)
val idxSpeech = cursor.columnIndexOrThrow(COL_SPEECH)
}
constructor(cursor: Cursor, colIdx: ColIdx) {
id = cursor.getLong(colIdx.idxId)
name = cursor.getString(colIdx.idxName)
color_bg = cursor.getInt(colIdx.idxColorBg)
color_fg = cursor.getInt(colIdx.idxColorFg)
sound_type = cursor.getInt(colIdx.idxSountType)
sound_uri = cursor.getStringOrNull(colIdx.idxSoundUri)
speech = cursor.getInt(colIdx.idxSpeech)
}
fun save(context: Context) {

View File

@ -351,7 +351,7 @@ class UserRelation {
fun loadPseudo(acct: Acct) = load(DB_ID_PSEUDO, acct.ascii)
fun createCursorPseudo(): Cursor =
fun createCursorPseudoMuted(): Cursor =
appDatabase.query(
table,
arrayOf(COL_ID.name, COL_WHO_ID.name),

View File

@ -69,7 +69,7 @@ object CustomShare {
label =
"${context.getString(R.string.copy_to_clipboard)}(${context.getString(R.string.app_name)})"
icon = ContextCompat.getDrawable(context, R.drawable.ic_copy)?.mutate()?.apply {
setTint(context.attrColor(R.attr.colorContentText))
setTint(context.attrColor(R.attr.colorTextContent))
setTintMode(PorterDuff.Mode.SRC_IN)
}
} else {

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="?attr/colorActionBarBg"/>
</shape>

View File

@ -1,170 +1,163 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:orientation="vertical">
android:padding="12dp"
android:scrollbarStyle="outsideOverlay"
android:id="@+id/svContent"
android:clipToPadding="false"
>
<LinearLayout
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="start"
android:orientation="vertical"
android:paddingTop="12dp"
android:paddingBottom="12dp"
>
android:layout_height="?attr/actionBarSize"
android:background="@drawable/action_bar_bg"
android:elevation="4dp"
app:navigationIcon="?attr/homeAsUpIndicator" />
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1"
/>
<ScrollView
android:id="@+id/svContent"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:clipToPadding="false"
android:fadeScrollbars="false"
android:fillViewport="true"
android:padding="12dp"
android:scrollbarStyle="outsideOverlay">
<TextView
android:layout_width="wrap_content"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/app_name"
android:textSize="32sp"
android:layout_gravity="center"
/>
android:gravity="start"
android:orientation="vertical">
<TextView
android:id="@+id/tvVersion"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="version 0.0.0"
android:layout_gravity="center"
/>
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1" />
<View
android:layout_width="0dp"
android:layout_height="8dp"
android:layout_weight="0.2"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="@string/app_name"
android:textSize="32sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/please_rate"
/>
<TextView
android:id="@+id/tvVersion"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
tools:text="version 0.0.0" />
<View
android:layout_width="0dp"
android:layout_height="8dp"
android:layout_weight="0.2"
/>
<View
android:layout_width="0dp"
android:layout_height="8dp"
android:layout_weight="0.2" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/releases"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/please_rate" />
<Button
android:id="@+id/btnReleaseNote"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/btn_bg_transparent_round6dp"
android:padding="8dp"
android:textAllCaps="false"
tools:text="https://github.com/tateisu/SubwayTooter/releases"
android:layout_marginStart="32dp"
android:gravity="start|center_vertical"
/>
<View
android:layout_width="0dp"
android:layout_height="8dp"
android:layout_weight="0.2" />
<View
android:layout_width="0dp"
android:layout_height="8dp"
android:layout_weight="0.2"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/releases" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/official_account"
/>
<Button
android:id="@+id/btnReleaseNote"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="32dp"
android:background="@drawable/btn_bg_transparent_round6dp"
android:gravity="start|center_vertical"
android:padding="8dp"
android:textAllCaps="false"
tools:text="https://github.com/tateisu/SubwayTooter/releases" />
<Button
android:id="@+id/btnOfficialAccount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/btn_bg_transparent_round6dp"
android:padding="8dp"
android:textAllCaps="false"
tools:text="SubwayTooter@mastodon.juggler.jp"
android:layout_marginStart="32dp"
android:gravity="start|center_vertical"
/>
<View
android:layout_width="0dp"
android:layout_height="8dp"
android:layout_weight="0.2" />
<View
android:layout_width="0dp"
android:layout_height="8dp"
android:layout_weight="0.2"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/official_account" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/developer"
/>
<Button
android:id="@+id/btnOfficialAccount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="32dp"
android:background="@drawable/btn_bg_transparent_round6dp"
android:gravity="start|center_vertical"
android:padding="8dp"
android:textAllCaps="false"
tools:text="SubwayTooter@mastodon.juggler.jp" />
<Button
android:id="@+id/btnDeveloper"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/btn_bg_transparent_round6dp"
android:padding="8dp"
android:textAllCaps="false"
tools:text="tateisu@mastodon.juggler.jp"
android:layout_marginStart="32dp"
android:gravity="start|center_vertical"
/>
<View
android:layout_width="0dp"
android:layout_height="8dp"
android:layout_weight="0.2" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/developer" />
<Button
android:id="@+id/btnDeveloper"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="32dp"
android:background="@drawable/btn_bg_transparent_round6dp"
android:gravity="start|center_vertical"
android:padding="8dp"
android:textAllCaps="false"
tools:text="tateisu@mastodon.juggler.jp" />
<View
android:layout_width="0dp"
android:layout_height="8dp"
android:layout_weight="0.2"
/>
<View
android:layout_width="0dp"
android:layout_height="8dp"
android:layout_weight="0.2" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/launcher_icon_by"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/launcher_icon_by" />
<!-- <Button-->
<!-- android:id="@+id/btnIconDesign"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:background="@drawable/btn_bg_transparent_round6dp"-->
<!-- android:padding="8dp"-->
<!-- android:textAllCaps="false"-->
<!-- android:layout_marginStart="32dp"-->
<!-- android:gravity="start|center_vertical"-->
<!-- />-->
<!-- <Button-->
<!-- android:id="@+id/btnIconDesign"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:background="@drawable/btn_bg_transparent_round6dp"-->
<!-- android:padding="8dp"-->
<!-- android:textAllCaps="false"-->
<!-- android:layout_marginStart="32dp"-->
<!-- android:gravity="start|center_vertical"-->
<!-- />-->
<!--<View-->
<!--<View-->
<!--android:layout_width="0dp"-->
<!--android:layout_height="8dp"-->
<!--android:layout_weight="0.2"-->
<!--/>-->
<!--<TextView-->
<!--<TextView-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:text="@string/please_donate"-->
<!--/>-->
<!--<Button-->
<!--<Button-->
<!--android:id="@+id/btnDonate"-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
@ -174,41 +167,37 @@
<!--tools:text="enty...."-->
<!--/>-->
<View
android:layout_width="0dp"
android:layout_height="8dp"
android:layout_weight="0.2"
/>
<View
android:layout_width="0dp"
android:layout_height="8dp"
android:layout_weight="0.2" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/contributor"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/contributor" />
<LinearLayout
android:id="@+id/llContributors"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginStart="32dp"
/>
<LinearLayout
android:id="@+id/llContributors"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="32dp"
android:orientation="vertical" />
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1"
/>
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1" />
<Button
android:id="@+id/btnWeblate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/btn_bg_transparent_round6dp"
android:padding="8dp"
android:textAllCaps="false"
android:layout_marginStart="32dp"
android:gravity="start|center_vertical"
/>
</LinearLayout>
</ScrollView>
<Button
android:id="@+id/btnWeblate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="32dp"
android:background="@drawable/btn_bg_transparent_round6dp"
android:gravity="start|center_vertical"
android:padding="8dp"
android:textAllCaps="false" />
</LinearLayout>
</ScrollView>
</LinearLayout>

File diff suppressed because it is too large Load Diff

View File

@ -11,11 +11,13 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorSearchFormBackground"
android:baselineAligned="false"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingStart="12dp"
android:paddingTop="6dp"
android:paddingBottom="6dp"
android:paddingEnd="12dp"
android:paddingBottom="6dp">
android:paddingStart="12dp"
android:paddingTop="6dp">
<EditText
android:id="@+id/etSearch"
@ -28,14 +30,13 @@
<ImageButton
android:id="@+id/btnSearchReset"
android:background="@drawable/btn_bg_transparent_round6dp"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginStart="6dp"
android:background="@drawable/btn_bg_transparent_round6dp"
android:contentDescription="@string/reset"
android:padding="8dp"
android:src="@drawable/ic_close"
app:tint="?attr/colorVectorDrawable" />
app:tint="?attr/colorTextContent" />
</LinearLayout>
@ -47,9 +48,9 @@
android:clipToPadding="false"
android:divider="@null"
android:dividerHeight="0dp"
android:paddingBottom="128dp"
android:paddingEnd="12dp"
android:paddingStart="12dp"
android:paddingTop="12dp"
android:paddingEnd="12dp"
android:paddingBottom="128dp"
android:scrollbarStyle="outsideOverlay" />
</LinearLayout>

View File

@ -1,291 +1,307 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/svContent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
android:clipToPadding="false"
android:fillViewport="true"
android:paddingTop="12dp"
android:paddingBottom="12dp"
android:scrollbarStyle="outsideOverlay">
<LinearLayout
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
android:layout_height="?attr/actionBarSize"
android:background="@drawable/action_bar_bg"
android:elevation="4dp"
app:navigationIcon="?attr/homeAsUpIndicator" />
<View style="@style/setting_divider" />
<ScrollView
android:id="@+id/svContent"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
<TextView
style="@style/setting_row_label"
android:text="@string/column_header" />
<LinearLayout style="@style/setting_row_form">
<LinearLayout
android:id="@+id/llColumnHeader"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="6dp"
android:gravity="center_vertical"
android:paddingStart="12dp"
android:paddingTop="3dp"
android:paddingEnd="12dp"
android:paddingBottom="3dp"
tools:ignore="UseCompoundDrawables">
<ImageView
android:id="@+id/ivColumnHeader"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_marginEnd="4dp"
android:importantForAccessibility="no"
tools:src="@drawable/ic_bike" />
<TextView
android:id="@+id/tvColumnName"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
tools:text="@string/federate_timeline" />
</LinearLayout>
</LinearLayout>
<TextView
style="@style/setting_row_label_indent1"
android:text="@string/background_color" />
<LinearLayout style="@style/setting_row_form">
<Button
android:id="@+id/btnHeaderBackgroundEdit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/edit" />
<Button
android:id="@+id/btnHeaderBackgroundReset"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/reset" />
</LinearLayout>
<TextView
style="@style/setting_row_label_indent1"
android:text="@string/foreground_color" />
<LinearLayout style="@style/setting_row_form">
<Button
android:id="@+id/btnHeaderTextEdit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/edit"
android:textAllCaps="false" />
<Button
android:id="@+id/btnHeaderTextReset"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/reset"
android:textAllCaps="false" />
</LinearLayout>
<View style="@style/setting_divider" />
<TextView
style="@style/setting_row_label"
android:text="@string/column" />
<LinearLayout style="@style/setting_row_form">
<FrameLayout
android:id="@+id/flColumnBackground"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/ivColumnBackground"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:importantForAccessibility="no"
android:scaleType="centerCrop" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="12dp">
<TextView
android:id="@+id/tvSampleAcct"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
android:gravity="start"
android:maxLines="1"
android:text="@string/acct_sample"
android:textColor="?attr/colorTimeSmall"
android:textSize="12sp" />
<jp.juggler.subwaytooter.view.MyTextView
android:id="@+id/tvSampleContent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="3dp"
android:gravity="start"
android:lineSpacingMultiplier="1.1"
android:text="@string/content_sample"
android:textColor="?attr/colorContentText" />
</LinearLayout>
</FrameLayout>
</LinearLayout>
<LinearLayout style="@style/setting_row_form">
<TextView
style="@style/setting_row_label"
android:text="@string/background_color" />
</LinearLayout>
<LinearLayout style="@style/setting_row_form">
<Button
android:id="@+id/btnColumnBackgroundColor"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/edit"
android:textAllCaps="false" />
<Button
android:id="@+id/btnColumnBackgroundColorReset"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/reset"
android:textAllCaps="false" />
</LinearLayout>
<LinearLayout style="@style/setting_row_form">
<TextView
style="@style/setting_row_label"
android:text="@string/background_image" />
</LinearLayout>
<LinearLayout style="@style/setting_row_form">
<Button
android:id="@+id/btnColumnBackgroundImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/pick_image"
android:textAllCaps="false" />
<Button
android:id="@+id/btnColumnBackgroundImageReset"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/reset"
android:textAllCaps="false" />
</LinearLayout>
<LinearLayout style="@style/setting_row_form">
<TextView
style="@style/setting_row_label"
android:labelFor="@+id/etAlpha"
android:text="@string/background_image_alpha" />
</LinearLayout>
android:clipToPadding="false"
android:fillViewport="true"
android:paddingHorizontal="12dp"
android:paddingVertical="6dp"
android:scrollbarStyle="outsideOverlay">
<LinearLayout
style="@style/setting_row_form"
android:layout_height="48dp"
android:baselineAligned="false"
android:gravity="center_vertical">
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<View
android:layout_width="0dp"
android:layout_height="48dp" />
<View style="@style/setting_divider" />
<EditText
android:id="@+id/etAlpha"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="4dp"
android:digits="0123456789.,"
android:importantForAutofill="no"
android:inputType="numberDecimal"
android:maxLines="1"
android:minWidth="64dp"
android:imeOptions="actionDone"
android:minLines="1" />
<TextView
style="@style/setting_row_label"
android:text="@string/column_header" />
<SeekBar
android:id="@+id/sbColumnBackgroundAlpha"
style="@style/setting_horizontal_stretch"
<LinearLayout style="@style/setting_row_form">
<LinearLayout
android:id="@+id/llColumnHeader"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="6dp"
android:gravity="center_vertical"
android:paddingBottom="3dp"
android:paddingEnd="12dp"
android:paddingStart="12dp"
android:paddingTop="3dp"
tools:ignore="UseCompoundDrawables">
<ImageView
android:id="@+id/ivColumnHeader"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_marginEnd="4dp"
android:importantForAccessibility="no"
tools:src="@drawable/ic_bike" />
<TextView
android:id="@+id/tvColumnName"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
tools:text="@string/federate_timeline" />
</LinearLayout>
</LinearLayout>
<TextView
style="@style/setting_row_label_indent1"
android:text="@string/background_color" />
<LinearLayout style="@style/setting_row_form">
<Button
android:id="@+id/btnHeaderBackgroundEdit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/edit" />
<Button
android:id="@+id/btnHeaderBackgroundReset"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/reset" />
</LinearLayout>
<TextView
style="@style/setting_row_label_indent1"
android:text="@string/foreground_color" />
<LinearLayout style="@style/setting_row_form">
<Button
android:id="@+id/btnHeaderTextEdit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/edit"
android:textAllCaps="false" />
<Button
android:id="@+id/btnHeaderTextReset"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/reset"
android:textAllCaps="false" />
</LinearLayout>
<View style="@style/setting_divider" />
<TextView
style="@style/setting_row_label"
android:text="@string/column" />
<LinearLayout style="@style/setting_row_form">
<FrameLayout
android:id="@+id/flColumnBackground"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/ivColumnBackground"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:importantForAccessibility="no"
android:scaleType="centerCrop" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="12dp">
<TextView
android:id="@+id/tvSampleAcct"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
android:gravity="start"
android:maxLines="1"
android:text="@string/acct_sample"
android:textColor="?attr/colorTimeSmall"
android:textSize="12sp" />
<jp.juggler.subwaytooter.view.MyTextView
android:id="@+id/tvSampleContent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="3dp"
android:gravity="start"
android:lineSpacingMultiplier="1.1"
android:text="@string/content_sample"
android:textColor="?attr/colorTextContent" />
</LinearLayout>
</FrameLayout>
</LinearLayout>
<LinearLayout style="@style/setting_row_form">
<TextView
style="@style/setting_row_label"
android:text="@string/background_color" />
</LinearLayout>
<LinearLayout style="@style/setting_row_form">
<Button
android:id="@+id/btnColumnBackgroundColor"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/edit"
android:textAllCaps="false" />
<Button
android:id="@+id/btnColumnBackgroundColorReset"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/reset"
android:textAllCaps="false" />
</LinearLayout>
<LinearLayout style="@style/setting_row_form">
<TextView
style="@style/setting_row_label"
android:text="@string/background_image" />
</LinearLayout>
<LinearLayout style="@style/setting_row_form">
<Button
android:id="@+id/btnColumnBackgroundImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/pick_image"
android:textAllCaps="false" />
<Button
android:id="@+id/btnColumnBackgroundImageReset"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/reset"
android:textAllCaps="false" />
</LinearLayout>
<LinearLayout style="@style/setting_row_form">
<TextView
style="@style/setting_row_label"
android:labelFor="@+id/etAlpha"
android:text="@string/background_image_alpha" />
</LinearLayout>
<LinearLayout
style="@style/setting_row_form"
android:layout_height="48dp"
android:paddingStart="32dp"
android:paddingEnd="32dp" />
</LinearLayout>
android:baselineAligned="false"
android:gravity="center_vertical">
<LinearLayout style="@style/setting_row_form">
<View
android:layout_width="0dp"
android:layout_height="48dp" />
<TextView
style="@style/setting_row_label"
android:text="@string/acct_color" />
</LinearLayout>
<EditText
android:id="@+id/etAlpha"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="4dp"
android:digits="0123456789.,"
android:imeOptions="actionDone"
android:importantForAutofill="no"
android:inputType="numberDecimal"
android:maxLines="1"
android:minLines="1"
android:minWidth="64dp" />
<LinearLayout style="@style/setting_row_form">
<SeekBar
android:id="@+id/sbColumnBackgroundAlpha"
style="@style/setting_horizontal_stretch"
android:layout_height="48dp"
android:paddingEnd="32dp"
android:paddingStart="32dp" />
</LinearLayout>
<Button
android:id="@+id/btnAcctColor"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/edit"
android:textAllCaps="false" />
<LinearLayout style="@style/setting_row_form">
<Button
android:id="@+id/btnAcctColorReset"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/reset"
android:textAllCaps="false" />
<TextView
style="@style/setting_row_label"
android:text="@string/acct_color" />
</LinearLayout>
<LinearLayout style="@style/setting_row_form">
<Button
android:id="@+id/btnAcctColor"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/edit"
android:textAllCaps="false" />
<Button
android:id="@+id/btnAcctColorReset"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/reset"
android:textAllCaps="false" />
</LinearLayout>
<LinearLayout style="@style/setting_row_form">
<TextView
style="@style/setting_row_label"
android:text="@string/content_color" />
</LinearLayout>
<LinearLayout style="@style/setting_row_form">
<Button
android:id="@+id/btnContentColor"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/edit"
android:textAllCaps="false" />
<Button
android:id="@+id/btnContentColorReset"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/reset"
android:textAllCaps="false" />
</LinearLayout>
<View style="@style/setting_divider" />
</LinearLayout>
<LinearLayout style="@style/setting_row_form">
<TextView
style="@style/setting_row_label"
android:text="@string/content_color" />
</LinearLayout>
<LinearLayout style="@style/setting_row_form">
<Button
android:id="@+id/btnContentColor"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/edit"
android:textAllCaps="false" />
<Button
android:id="@+id/btnContentColorReset"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/reset"
android:textAllCaps="false" />
</LinearLayout>
<View style="@style/setting_divider" />
</LinearLayout>
</ScrollView>
</ScrollView>
</LinearLayout>

View File

@ -1,28 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:orientation="vertical">
android:id="@+id/llContent"
>
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@drawable/action_bar_bg"
android:elevation="4dp"
app:navigationIcon="?attr/homeAsUpIndicator" />
<!-- Need to wrap DragListView in another layout for wrap_content to work for some reason -->
<com.woxthebox.draglistview.DragListView
android:id="@+id/drag_list_view"
<LinearLayout
android:id="@+id/llContent"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:layout_marginBottom="4dp"
android:textSize="12sp"
android:text="@string/column_list_desc"
android:gravity="center"
android:orientation="vertical">
/>
<!-- Need to wrap DragListView in another layout for wrap_content to work for some reason -->
<com.woxthebox.draglistview.DragListView
android:id="@+id/listView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
tools:ignore="NestedWeights" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
android:layout_marginTop="4dp"
android:gravity="center"
android:text="@string/column_list_desc"
android:textSize="12sp"
/>
</LinearLayout>
</LinearLayout>

View File

@ -1,16 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/llContent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/llContent"
android:orientation="vertical">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@drawable/action_bar_bg"
android:elevation="4dp"
app:navigationIcon="?attr/homeAsUpIndicator" />
<ListView
android:id="@+id/listView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:fadeScrollbars="false"
/>
android:fadeScrollbars="false" />
</LinearLayout>

View File

@ -1,10 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<ListView
xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
android:scrollbarStyle="outsideOverlay"
android:id="@+id/listView"
/>
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@drawable/action_bar_bg"
app:navigationIcon="?attr/homeAsUpIndicator"
android:elevation="4dp" />
<ListView
android:id="@+id/listView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:scrollbarStyle="outsideOverlay" />
</LinearLayout>

View File

@ -1,164 +1,189 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ScrollView
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@drawable/action_bar_bg"
android:elevation="4dp"
app:navigationIcon="?attr/homeAsUpIndicator" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:clipToPadding="false"
android:fadeScrollbars="false"
android:fillViewport="true"
android:padding="12dp">
android:id="@+id/llContent"
android:orientation="vertical">
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:clipToPadding="false"
android:fadeScrollbars="false"
android:fillViewport="true"
android:padding="12dp"
tools:ignore="NestedWeights">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<View style="@style/setting_divider" />
<TextView
style="@style/setting_row_label"
android:labelFor="@+id/etName"
android:text="@string/keyword" />
<LinearLayout style="@style/setting_row_form">
<EditText
android:id="@+id/etName"
style="@style/setting_horizontal_stretch"
android:gravity="center"
android:importantForAutofill="no"
android:inputType="text"
android:padding="6dp" />
</LinearLayout>
<View style="@style/setting_divider" />
<TextView
style="@style/setting_row_label"
android:text="@string/text_color" />
<LinearLayout style="@style/setting_row_form">
<Button
android:id="@+id/btnTextColorEdit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/edit"
android:textAllCaps="false" />
<Button
android:id="@+id/btnTextColorReset"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/reset"
android:textAllCaps="false" />
</LinearLayout>
<View style="@style/setting_divider" />
<TextView
style="@style/setting_row_label"
android:text="@string/background_color" />
<LinearLayout style="@style/setting_row_form">
<Button
android:id="@+id/btnBackgroundColorEdit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/edit"
android:textAllCaps="false" />
<Button
android:id="@+id/btnBackgroundColorReset"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/reset"
android:textAllCaps="false" />
</LinearLayout>
<View style="@style/setting_divider" />
<TextView
style="@style/setting_row_label"
android:text="@string/notification_sound" />
<LinearLayout style="@style/setting_row_form">
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swSound"
style="@style/setting_horizontal_stretch"
android:gravity="center" />
</LinearLayout>
<LinearLayout style="@style/setting_row_form">
<Button
android:id="@+id/btnNotificationSoundEdit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/edit"
android:textAllCaps="false" />
<Button
android:id="@+id/btnNotificationSoundReset"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/reset"
android:textAllCaps="false" />
<Button
android:id="@+id/btnNotificationSoundTest"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/test"
android:textAllCaps="false" />
</LinearLayout>
<View style="@style/setting_divider" />
<TextView
style="@style/setting_row_label"
android:text="@string/enable_speech" />
<LinearLayout style="@style/setting_row_form">
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swSpeech"
style="@style/setting_horizontal_stretch"
android:gravity="center" />
</LinearLayout>
</LinearLayout>
</ScrollView>
<LinearLayout
style="?android:attr/buttonBarStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
android:measureWithLargestChild="true">
<View style="@style/setting_divider" />
<TextView
style="@style/setting_row_label"
android:labelFor="@+id/etName"
android:text="@string/keyword" />
<LinearLayout style="@style/setting_row_form">
<EditText
android:id="@+id/etName"
style="@style/setting_horizontal_stretch"
android:gravity="center"
android:inputType="text"
android:importantForAutofill="no"
android:padding="6dp" />
</LinearLayout>
<View style="@style/setting_divider" />
<TextView
style="@style/setting_row_label"
android:text="@string/text_color" />
<LinearLayout style="@style/setting_row_form">
<Button
android:id="@+id/btnTextColorEdit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/edit"
android:textAllCaps="false" />
<Button
android:id="@+id/btnTextColorReset"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/reset"
android:textAllCaps="false" />
</LinearLayout>
<View style="@style/setting_divider" />
<TextView
style="@style/setting_row_label"
android:text="@string/background_color" />
<LinearLayout style="@style/setting_row_form">
<Button
android:id="@+id/btnBackgroundColorEdit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/edit"
android:textAllCaps="false" />
<Button
android:id="@+id/btnBackgroundColorReset"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/reset"
android:textAllCaps="false" />
</LinearLayout>
<View style="@style/setting_divider" />
<TextView
style="@style/setting_row_label"
android:text="@string/notification_sound" />
<LinearLayout style="@style/setting_row_form">
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swSound"
style="@style/setting_horizontal_stretch"
android:gravity="center" />
</LinearLayout>
<LinearLayout style="@style/setting_row_form">
<Button
android:id="@+id/btnNotificationSoundEdit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/edit"
android:textAllCaps="false" />
<Button
android:id="@+id/btnNotificationSoundReset"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/reset"
android:textAllCaps="false" />
</LinearLayout>
<View style="@style/setting_divider" />
<TextView
style="@style/setting_row_label"
android:text="@string/enable_speech" />
<LinearLayout style="@style/setting_row_form">
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swSpeech"
style="@style/setting_horizontal_stretch"
android:gravity="center" />
</LinearLayout>
<Button
android:id="@+id/btnDiscard"
style="?android:attr/buttonBarButtonStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/discard"
android:textAllCaps="false" />
<Button
android:id="@+id/btnSave"
style="?android:attr/buttonBarButtonStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/save"
android:textAllCaps="false" />
</LinearLayout>
</ScrollView>
<LinearLayout
style="?android:attr/buttonBarStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:measureWithLargestChild="true">
<Button
android:id="@+id/btnDiscard"
style="?android:attr/buttonBarButtonStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/discard"
android:textAllCaps="false" />
<Button
android:id="@+id/btnSave"
style="?android:attr/buttonBarButtonStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/save"
android:textAllCaps="false" />
</LinearLayout>
</LinearLayout>

View File

@ -1,48 +1,63 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/llContent"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
android:orientation="vertical"
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@drawable/action_bar_bg"
android:elevation="4dp"
app:navigationIcon="?attr/homeAsUpIndicator" />
>
<!-- Need to wrap DragListView in another layout for wrap_content to work for some reason -->
<com.woxthebox.draglistview.DragListView
android:id="@+id/drag_list_view"
<LinearLayout
android:id="@+id/llContent"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
/>
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
android:layout_marginTop="4dp"
<ListView
android:id="@+id/listView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:gravity="center"
android:text="@string/highlight_desc"
android:textSize="12sp"
android:fadeScrollbars="false"
android:scrollbarStyle="outsideOverlay"
tools:ignore="NestedWeights" />
/>
<ImageButton
android:id="@+id/btnAdd"
android:layout_width="wrap_content"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:contentDescription="@string/new_item"
android:src="@drawable/ic_add"
app:tint="?attr/colorVectorDrawable"
/>
android:baselineAligned="false"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingHorizontal="12dp"
android:paddingVertical="4dp">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
android:layout_marginTop="4dp"
android:layout_weight="1"
android:text="@string/highlight_desc"
android:textSize="12sp" />
<ImageButton
android:id="@+id/btnAdd"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginStart="16dp"
android:background="@drawable/btn_bg_transparent_round6dp"
android:contentDescription="@string/new_item"
android:src="@drawable/ic_add"
app:tint="?attr/colorTextContent" />
</LinearLayout>
</LinearLayout>
</LinearLayout>

View File

@ -1,158 +1,176 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/svContent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical">
<ScrollView
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@drawable/action_bar_bg"
android:elevation="4dp"
app:navigationIcon="?attr/homeAsUpIndicator" />
<LinearLayout
android:id="@+id/llContent"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="vertical">
android:clipToPadding="false"
android:fillViewport="true"
android:paddingBottom="128dp"
android:paddingTop="12dp"
android:scrollbarStyle="outsideOverlay"
tools:ignore="TooManyViews">
<LinearLayout
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<View style="@style/setting_divider" />
<TextView
style="@style/setting_row_label"
android:text="@string/account" />
<TextView
android:id="@+id/tvAccount"
style="@style/setting_row_form" />
<View style="@style/setting_divider" />
<TextView
style="@style/setting_row_label"
android:labelFor="@+id/etTitle"
android:text="@string/filter_title" />
<EditText
android:id="@+id/etTitle"
style="@style/setting_row_form"
android:importantForAutofill="no"
android:inputType="text" />
<View style="@style/setting_divider" />
<TextView
style="@style/setting_row_label"
android:text="@string/filter_phrase" />
android:layout_height="0dp"
android:layout_weight="1"
android:clipToPadding="false"
android:fillViewport="true"
android:paddingBottom="128dp"
android:paddingTop="6dp"
android:paddingHorizontal="12dp"
android:scrollbarStyle="outsideOverlay"
android:fadeScrollbars="false"
tools:ignore="NestedWeights,TooManyViews">
<LinearLayout
android:id="@+id/llKeywords"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<View style="@style/setting_divider" />
<TextView
style="@style/setting_row_label"
android:text="@string/account" />
<TextView
android:id="@+id/tvAccount"
style="@style/setting_row_form" />
<View style="@style/setting_divider" />
<TextView
style="@style/setting_row_label"
android:labelFor="@+id/etTitle"
android:text="@string/filter_title" />
<EditText
android:id="@+id/etTitle"
style="@style/setting_row_form"
android:importantForAutofill="no"
android:inputType="text" />
<View style="@style/setting_divider" />
<TextView
style="@style/setting_row_label"
android:text="@string/filter_phrase" />
<LinearLayout
android:id="@+id/llKeywords"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
</LinearLayout>
<Button
android:id="@+id/btnAddKeyword"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableStart="@drawable/ic_add"
android:drawableTint="?attr/colorTextContent"
android:text="@string/add_keyword_or_phrase"
android:textAllCaps="false" />
<View style="@style/setting_divider" />
<TextView
style="@style/setting_row_label"
android:text="@string/filter_action" />
<RadioGroup
android:id="@+id/rgAction"
style="@style/setting_row_form"
android:orientation="vertical">
<RadioButton
android:id="@+id/rbWarn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/filter_action_warn" />
<RadioButton
android:id="@+id/rbHide"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/filter_action_hide" />
</RadioGroup>
<View style="@style/setting_divider" />
<TextView
style="@style/setting_row_label"
android:text="@string/filter_context" />
<CheckBox
android:id="@+id/cbContextHome"
style="@style/setting_row_form"
android:checked="true"
android:text="@string/filter_home" />
<CheckBox
android:id="@+id/cbContextNotification"
style="@style/setting_row_form"
android:checked="true"
android:text="@string/filter_notification" />
<CheckBox
android:id="@+id/cbContextPublic"
style="@style/setting_row_form"
android:checked="true"
android:text="@string/filter_public" />
<CheckBox
android:id="@+id/cbContextThread"
style="@style/setting_row_form"
android:checked="true"
android:text="@string/filter_thread" />
<CheckBox
android:id="@+id/cbContextProfile"
style="@style/setting_row_form"
android:checked="true"
android:text="@string/filter_profile" />
<View style="@style/setting_divider" />
<TextView
style="@style/setting_row_label"
android:text="@string/filter_expires_at" />
<TextView
android:id="@+id/tvExpire"
style="@style/setting_row_form" />
<Spinner
android:id="@+id/spExpire"
style="@style/setting_row_form"
android:minHeight="40dp" />
<View style="@style/setting_divider" />
</LinearLayout>
<Button
android:id="@+id/btnAddKeyword"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableStart="@drawable/ic_add"
android:text="@string/add_keyword_or_phrase"
android:textAllCaps="false" />
</ScrollView>
<View style="@style/setting_divider" />
<TextView
style="@style/setting_row_label"
android:text="@string/filter_action" />
<RadioGroup
android:id="@+id/rgAction"
style="@style/setting_row_form"
android:orientation="vertical">
<RadioButton
android:id="@+id/rbWarn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/filter_action_warn" />
<RadioButton
android:id="@+id/rbHide"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/filter_action_hide" />
</RadioGroup>
<View style="@style/setting_divider" />
<TextView
style="@style/setting_row_label"
android:text="@string/filter_context" />
<CheckBox
android:id="@+id/cbContextHome"
style="@style/setting_row_form"
android:checked="true"
android:text="@string/filter_home" />
<CheckBox
android:id="@+id/cbContextNotification"
style="@style/setting_row_form"
android:checked="true"
android:text="@string/filter_notification" />
<CheckBox
android:id="@+id/cbContextPublic"
style="@style/setting_row_form"
android:checked="true"
android:text="@string/filter_public" />
<CheckBox
android:id="@+id/cbContextThread"
style="@style/setting_row_form"
android:checked="true"
android:text="@string/filter_thread" />
<CheckBox
android:id="@+id/cbContextProfile"
style="@style/setting_row_form"
android:checked="true"
android:text="@string/filter_profile" />
<View style="@style/setting_divider" />
<TextView
style="@style/setting_row_label"
android:text="@string/filter_expires_at" />
<TextView
android:id="@+id/tvExpire"
style="@style/setting_row_form" />
<Spinner
android:id="@+id/spExpire"
style="@style/setting_row_form"
android:minHeight="40dp" />
<View style="@style/setting_divider" />
</LinearLayout>
</ScrollView>
<Button
android:id="@+id/btnSave"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/save" />
<Button
android:id="@+id/btnSave"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/save" />
</LinearLayout>
</LinearLayout>

View File

@ -1,69 +1,80 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/llContent"
android:orientation="vertical">
<ListView
android:id="@+id/listView"
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:fadeScrollbars="false"
/>
android:layout_height="?attr/actionBarSize"
android:background="@drawable/action_bar_bg"
android:elevation="4dp"
app:navigationIcon="?attr/homeAsUpIndicator" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="12dp"
android:paddingEnd="12dp"
android:paddingTop="6dp"
android:paddingBottom="6dp"
android:background="?attr/colorStatusButtonsPopupBg"
>
android:layout_height="0dp"
android:layout_weight="1"
android:id="@+id/llContent"
android:orientation="vertical">
<ImageButton
android:id="@+id/btnAdd"
android:src="@drawable/ic_add"
android:layout_width="0dp"
<ListView
android:id="@+id/listView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:layout_height="48dp"
android:contentDescription="@string/add"
android:textAllCaps="false"
android:elevation="3dp"
/>
android:fadeScrollbars="false"
tools:ignore="NestedWeights" />
<Button
android:id="@+id/btnSave"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="48dp"
android:text="@string/save"
android:textAllCaps="false"
android:elevation="3dp"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorStatusButtonsPopupBg"
android:paddingBottom="6dp"
android:paddingEnd="12dp"
android:paddingStart="12dp"
android:paddingTop="6dp">
<ImageButton
android:id="@+id/btnMore"
android:src="@drawable/ic_more"
android:layout_width="48dp"
android:layout_height="48dp"
android:contentDescription="@string/more"
android:elevation="3dp"
/>
<ImageButton
android:id="@+id/btnAdd"
android:layout_width="0dp"
android:layout_height="48dp"
android:layout_weight="1"
android:contentDescription="@string/add"
android:elevation="3dp"
android:src="@drawable/ic_add"
android:textAllCaps="false" />
<Button
android:id="@+id/btnSave"
android:layout_width="0dp"
android:layout_height="48dp"
android:layout_weight="1"
android:elevation="3dp"
android:text="@string/save"
android:textAllCaps="false" />
<ImageButton
android:id="@+id/btnMore"
android:layout_width="48dp"
android:layout_height="48dp"
android:contentDescription="@string/more"
android:elevation="3dp"
android:src="@drawable/ic_more" />
</LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="6dp"
android:paddingEnd="12dp"
android:paddingStart="12dp"
android:text="@string/language_filter_description"
android:textSize="12sp"
/>
</LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="12sp"
android:text="@string/language_filter_description"
android:paddingStart="12dp"
android:paddingEnd="12dp"
android:paddingBottom="6dp"
/>
</LinearLayout>

View File

@ -63,7 +63,7 @@
android:id="@+id/vFooterDivider1"
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="?attr/colorImageButton" />
android:background="?attr/colorColumnStripBackground" />
<HorizontalScrollView
android:id="@+id/svColumnStrip"
@ -88,7 +88,7 @@
android:id="@+id/vFooterDivider2"
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="?attr/colorImageButton" />
android:background="?attr/colorColumnStripBackground" />
<ImageButton
android:id="@+id/btnToot"
@ -118,8 +118,8 @@
android:id="@+id/etQuickToot"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="6dp"
android:layout_marginEnd="6dp"
android:layout_marginStart="6dp"
android:layout_weight="1"
android:hint="@string/quick_toot_hint"
android:imeOptions="actionSend"
@ -135,10 +135,10 @@
android:src="@drawable/ic_send" />
</LinearLayout>
<View android:id="@+id/vBottomPadding"
<View
android:id="@+id/vBottomPadding"
android:layout_width="match_parent"
android:layout_height="8dp"
/>
android:layout_height="8dp" />
</LinearLayout>
<com.google.android.material.navigation.NavigationView

View File

@ -62,7 +62,7 @@
android:contentDescription="@string/more"
android:minWidth="48dp"
android:src="@drawable/ic_more"
app:tint="?attr/colorVectorDrawable" />
app:tint="?attr/colorTextContent" />
<ImageButton
android:id="@+id/btnDownload"
@ -71,7 +71,7 @@
android:contentDescription="@string/download"
android:minWidth="48dp"
android:src="@drawable/ic_download"
app:tint="?attr/colorVectorDrawable" />
app:tint="?attr/colorTextContent" />
<ImageButton
android:id="@+id/btnNext"
@ -80,7 +80,7 @@
android:contentDescription="@string/next"
android:minWidth="48dp"
android:src="@drawable/ic_arrow_end"
app:tint="?attr/colorVectorDrawable" />
app:tint="?attr/colorTextContent" />
<ImageButton
android:id="@+id/btnPrevious"
@ -90,7 +90,7 @@
android:minWidth="48dp"
android:src="@drawable/ic_arrow_start"
app:tint="?attr/colorVectorDrawable" />
app:tint="?attr/colorTextContent" />
<TextView
android:id="@+id/tvStatus"

View File

@ -1,150 +1,109 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/llContent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
android:orientation="vertical"
>
<TextView
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:paddingEnd="12dp"
android:paddingStart="12dp"
android:text="@string/preview" />
android:layout_height="?attr/actionBarSize"
android:background="@drawable/action_bar_bg"
android:elevation="4dp"
app:navigationIcon="?attr/homeAsUpIndicator" />
<TextView
android:id="@+id/tvPreview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:paddingBottom="6dp"
android:paddingEnd="12dp"
android:paddingStart="12dp"
android:paddingTop="6dp"
android:textSize="20sp"
tools:text="preview..." />
<ScrollView
<LinearLayout
android:id="@+id/llContent"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:fadeScrollbars="false"
android:fillViewport="true">
android:orientation="vertical">
<LinearLayout
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="12dp">
android:layout_marginTop="4dp"
android:paddingEnd="12dp"
android:paddingStart="12dp"
android:text="@string/preview" />
<View style="@style/setting_divider" />
<TextView
android:id="@+id/tvPreview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:paddingBottom="6dp"
android:paddingEnd="12dp"
android:paddingStart="12dp"
android:paddingTop="6dp"
android:textSize="20sp"
tools:text="preview..." />
<TextView
style="@style/setting_row_label"
android:text="@string/acct" />
<LinearLayout style="@style/setting_row_form">
<TextView
android:id="@+id/tvAcct"
style="@style/setting_horizontal_stretch" />
</LinearLayout>
<View style="@style/setting_divider" />
<TextView
style="@style/setting_row_label"
android:labelFor="@+id/etNickname"
android:text="@string/nickname" />
<LinearLayout style="@style/setting_row_form">
<EditText
android:id="@+id/etNickname"
style="@style/setting_horizontal_stretch"
android:importantForAutofill="no"
android:inputType="text"
android:maxLines="1" />
</LinearLayout>
<View style="@style/setting_divider" />
<TextView
style="@style/setting_row_label"
android:text="@string/text_color" />
<LinearLayout style="@style/setting_row_form">
<Button
android:id="@+id/btnTextColorEdit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/edit"
android:textAllCaps="false" />
<Button
android:id="@+id/btnTextColorReset"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/reset"
android:textAllCaps="false" />
</LinearLayout>
<View style="@style/setting_divider" />
<TextView
style="@style/setting_row_label"
android:text="@string/background_color" />
<LinearLayout style="@style/setting_row_form">
<Button
android:id="@+id/btnBackgroundColorEdit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/edit"
android:textAllCaps="false" />
<Button
android:id="@+id/btnBackgroundColorReset"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/reset"
android:textAllCaps="false" />
</LinearLayout>
<View style="@style/setting_divider" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:fadeScrollbars="false"
android:fillViewport="true"
tools:ignore="NestedWeights">
<LinearLayout
android:id="@+id/llNotificationSound"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
android:orientation="vertical"
android:padding="12dp">
<View style="@style/setting_divider" />
<TextView
style="@style/setting_row_label"
android:text="@string/notification_sound" />
android:text="@string/acct" />
<LinearLayout style="@style/setting_row_form">
<TextView
android:id="@+id/tvAcct"
style="@style/setting_horizontal_stretch" />
</LinearLayout>
<View style="@style/setting_divider" />
<TextView
style="@style/setting_row_label"
android:labelFor="@+id/etNickname"
android:text="@string/nickname" />
<LinearLayout style="@style/setting_row_form">
<EditText
android:id="@+id/etNickname"
style="@style/setting_horizontal_stretch"
android:importantForAutofill="no"
android:inputType="text"
android:maxLines="1" />
</LinearLayout>
<View style="@style/setting_divider" />
<TextView
style="@style/setting_row_label"
android:text="@string/text_color" />
<LinearLayout style="@style/setting_row_form">
<Button
android:id="@+id/btnNotificationSoundEdit"
android:id="@+id/btnTextColorEdit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/edit"
android:textAllCaps="false" />
<Button
android:id="@+id/btnNotificationSoundReset"
android:id="@+id/btnTextColorReset"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/reset"
@ -153,40 +112,95 @@
</LinearLayout>
<View style="@style/setting_divider" />
<TextView
style="@style/setting_row_label"
android:text="@string/background_color" />
<LinearLayout style="@style/setting_row_form">
<Button
android:id="@+id/btnBackgroundColorEdit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/edit"
android:textAllCaps="false" />
<Button
android:id="@+id/btnBackgroundColorReset"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/reset"
android:textAllCaps="false" />
</LinearLayout>
<View style="@style/setting_divider" />
<LinearLayout
android:id="@+id/llNotificationSound"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
style="@style/setting_row_label"
android:text="@string/notification_sound" />
<LinearLayout style="@style/setting_row_form">
<Button
android:id="@+id/btnNotificationSoundEdit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/edit"
android:textAllCaps="false" />
<Button
android:id="@+id/btnNotificationSoundReset"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/reset"
android:textAllCaps="false" />
</LinearLayout>
<View style="@style/setting_divider" />
</LinearLayout>
</LinearLayout>
</ScrollView>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/nickname_applied_after_reload"
android:textSize="12sp" />
<LinearLayout
style="?android:attr/buttonBarStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:measureWithLargestChild="true">
<Button
android:id="@+id/btnDiscard"
style="?android:attr/buttonBarButtonStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/discard"
android:textAllCaps="false" />
<Button
android:id="@+id/btnSave"
style="?android:attr/buttonBarButtonStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/save"
android:textAllCaps="false" />
</LinearLayout>
</ScrollView>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/nickname_applied_after_reload"
android:textSize="12sp" />
<LinearLayout
style="?android:attr/buttonBarStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:measureWithLargestChild="true">
<Button
android:id="@+id/btnDiscard"
style="?android:attr/buttonBarButtonStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/discard"
android:textAllCaps="false" />
<Button
android:id="@+id/btnSave"
style="?android:attr/buttonBarButtonStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/save"
android:textAllCaps="false" />
</LinearLayout>
</LinearLayout>

View File

@ -1,19 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:fillViewport="true"
android:padding="12dp"
>
android:orientation="vertical">
<TextView
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/tvText"
android:autoLink="web"
>
android:layout_height="?attr/actionBarSize"
android:background="@drawable/action_bar_bg"
android:elevation="4dp"
app:navigationIcon="?attr/homeAsUpIndicator" />
</TextView>
</ScrollView>
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:clipToPadding="false"
android:fadeScrollbars="false"
android:fillViewport="true"
android:padding="12dp"
android:id="@+id/svContent"
android:scrollbarStyle="outsideOverlay">
<TextView
android:id="@+id/tvText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:autoLink="web" />
</ScrollView>
</LinearLayout>

View File

@ -72,7 +72,7 @@
android:contentDescription="@string/delete"
android:gravity="center_vertical"
android:src="@drawable/ic_close"
app:tint="?attr/colorVectorDrawable" />
app:tint="?attr/colorTextContent" />
</LinearLayout>
<CheckBox
@ -219,7 +219,7 @@
android:background="@drawable/btn_bg_transparent_round6dp"
android:contentDescription="@string/open_picker_emoji"
android:src="@drawable/ic_hashtag"
app:tint="?attr/colorVectorDrawable"
app:tint="?attr/colorTextContent"
/>
@ -231,7 +231,7 @@
android:background="@drawable/btn_bg_transparent_round6dp"
android:contentDescription="@string/open_picker_emoji"
android:src="@drawable/ic_face"
app:tint="?attr/colorVectorDrawable"
app:tint="?attr/colorTextContent"
/>
</LinearLayout>
@ -301,7 +301,7 @@
android:background="@drawable/btn_bg_transparent_round6dp"
android:contentDescription="@string/edit"
android:src="@drawable/ic_edit"
app:tint="?attr/colorVectorDrawable"
app:tint="?attr/colorTextContent"
/>
@ -312,7 +312,7 @@
android:background="@drawable/btn_bg_transparent_round6dp"
android:contentDescription="@string/reset"
android:src="@drawable/ic_close"
app:tint="?attr/colorVectorDrawable"
app:tint="?attr/colorTextContent"
/>
@ -519,7 +519,7 @@
android:background="@drawable/btn_bg_transparent_round6dp"
android:contentDescription="@string/media_attachment"
android:src="@drawable/ic_clip"
app:tint="?attr/colorVectorDrawable" />
app:tint="?attr/colorTextContent" />
<ImageButton
android:id="@+id/btnVisibility"
@ -530,7 +530,7 @@
android:contentDescription="@string/visibility"
android:minHeight="48dp"
android:minWidth="48dp"
app:tint="?attr/colorVectorDrawable"
app:tint="?attr/colorTextContent"
tools:src="@drawable/ic_public" />
<ImageButton
@ -541,7 +541,7 @@
android:background="@drawable/btn_bg_transparent_round6dp"
android:contentDescription="@string/plugin"
android:src="@drawable/ic_extension"
app:tint="?attr/colorVectorDrawable" />
app:tint="?attr/colorTextContent" />
<ImageButton
android:id="@+id/btnMore"
@ -551,7 +551,7 @@
android:background="@drawable/btn_bg_transparent_round6dp"
android:contentDescription="@string/more"
android:src="@drawable/ic_more"
app:tint="?attr/colorVectorDrawable" />
app:tint="?attr/colorTextContent" />
<View
android:layout_width="0dp"
@ -576,7 +576,7 @@
android:background="@drawable/btn_bg_transparent_round6dp"
android:contentDescription="@string/toot"
android:src="@drawable/ic_send"
app:tint="?attr/colorVectorDrawable"
app:tint="?attr/colorTextContent"
tools:ignore="DuplicateSpeakableTextCheck" />
</LinearLayout>

View File

@ -9,13 +9,14 @@
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorStatusButtonsPopupBg"
app:title="@string/select_and_copy"
/>
android:background="@drawable/action_bar_bg"
app:navigationIcon="?attr/homeAsUpIndicator"
android:elevation="4dp" />
<jp.juggler.subwaytooter.view.MyEditText
android:id="@+id/etText"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:inputType="none" />
</LinearLayout>
</LinearLayout>

View File

@ -1,29 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:orientation="vertical">
android:id="@+id/llContent"
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@drawable/action_bar_bg"
android:elevation="4dp"
app:navigationIcon="?attr/homeAsUpIndicator" />
>
<!-- Need to wrap DragListView in another layout for wrap_content to work for some reason -->
<com.woxthebox.draglistview.DragListView
android:id="@+id/drag_list_view"
<LinearLayout
android:id="@+id/llContent"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:layout_marginBottom="4dp"
android:textSize="12sp"
android:text="@string/mute_app_desc"
android:gravity="center"
android:orientation="vertical">
/>
</LinearLayout>
<ListView
android:id="@+id/listView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:fadeScrollbars="false"
android:scrollbarStyle="outsideOverlay"
tools:ignore="NestedWeights" />
<TextView
android:id="@+id/tvFooterDesc"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingHorizontal="12dp"
android:paddingVertical="4dp"
android:text="@string/refresh_after_ummute"
android:textSize="12sp" />
</LinearLayout>
</LinearLayout>

View File

@ -31,7 +31,7 @@
android:layout_marginStart="4dp"
android:contentDescription="@android:string/paste"
android:src="@drawable/ic_paste"
app:tint="?attr/colorImageButton" />
app:tint="?attr/colorTextContent" />
</LinearLayout>

View File

@ -16,7 +16,7 @@
android:id="@+id/tvTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="?attr/colorContentText"
android:textColor="?attr/colorTextContent"
android:textSize="16sp"
/>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<com.woxthebox.draglistview.swipe.ListSwipeItem
xmlns:android="http://schemas.android.com/apk/res/android"
<com.woxthebox.draglistview.swipe.ListSwipeItem xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:leftViewId="@+id/item_left"
@ -20,7 +20,7 @@
android:paddingStart="12dp"
android:text="@string/app_name"
android:textColor="@android:color/white"
android:textSize="20sp"/>
android:textSize="20sp" />
<TextView
android:id="@+id/item_right"
@ -35,7 +35,7 @@
android:paddingStart="12dp"
android:text="@string/delete"
android:textColor="?attr/colorColumnListDeleteText"
android:textSize="20sp"/>
android:textSize="20sp" />
<LinearLayout
android:id="@id/item_layout"
@ -43,78 +43,90 @@
android:layout_height="wrap_content"
android:background="@drawable/column_list_selector"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingEnd="12dp"
android:paddingStart="12dp"
>
<!-- minHeight の代わりにViewで賄う -->
<View
android:layout_width="0dp"
android:layout_height="48dp"
/>
<ImageView
android:id="@+id/ivDragHandle"
android:layout_width="48dp"
android:layout_height="match_parent"
android:layout_marginBottom="4dp"
android:layout_marginEnd="6dp"
android:layout_marginTop="4dp"
android:background="?attr/colorColumnListDragHandleBackground"
android:contentDescription="@string/drag_handle"
android:scaleType="center"
android:src="@drawable/ic_order"
app:tint="?attr/colorVectorDrawable"
/>
android:orientation="vertical">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="vertical"
>
android:baselineAligned="false"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingHorizontal="12dp"
android:paddingVertical="3dp">
<!-- minHeight の代わりにViewで賄う -->
<View
android:layout_width="0dp"
android:layout_height="48dp" />
<TextView
android:id="@+id/tvAccess"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="end"
android:textColor="?attr/colorColumnListItemText"
android:textSize="14sp"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_vertical"
>
<ImageView
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_marginEnd="4dp"
android:id="@+id/ivColumnIcon"
android:importantForAccessibility="no"
app:tint="?attr/colorVectorDrawable"
/>
<TextView
android:id="@+id/tvName"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="18sp"
/>
<ImageView
android:id="@+id/ivBookmark"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_marginStart="6dp"
android:contentDescription="@string/last_selection"
android:scaleType="center"
android:src="@drawable/ic_bookmark"
app:tint="?attr/colorVectorDrawable"
/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
android:layout_weight="1"
android:orientation="vertical"
tools:ignore="NestedWeights">
<TextView
android:id="@+id/tvAccess"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="start"
android:textColor="?attr/colorColumnListItemText"
android:textSize="14sp"
tools:text="user@acct" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:id="@+id/ivColumnIcon"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_marginEnd="4dp"
android:importantForAccessibility="no"
app:tint="?attr/colorTextContent"
tools:src="@drawable/ic_face" />
<TextView
android:id="@+id/tvName"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="18sp"
tools:text="name 名前 " />
</LinearLayout>
</LinearLayout>
<ImageView
android:id="@+id/ivSelected"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:contentDescription="@string/last_selection"
android:src="@drawable/ic_eye"
app:tint="?attr/colorTextContent" />
<ImageView
android:id="@+id/ivDragHandle"
android:layout_width="48dp"
android:layout_height="match_parent"
android:layout_marginStart="8dp"
android:background="?attr/colorColumnListDragHandleBackground"
android:contentDescription="@string/drag_handle"
android:scaleType="center"
android:src="@drawable/ic_order"
app:tint="?attr/colorTextContent" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?attr/colorSettingDivider" />
</LinearLayout>
</com.woxthebox.draglistview.swipe.ListSwipeItem>

View File

@ -1,86 +1,51 @@
<?xml version="1.0" encoding="utf-8"?>
<com.woxthebox.draglistview.swipe.ListSwipeItem xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:leftViewId="@+id/item_left"
app:rightViewId="@+id/item_right"
app:swipeViewId="@+id/item_layout">
android:descendantFocusability="blocksDescendants"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingHorizontal="12dp"
android:minHeight="48dp"
android:paddingVertical="3dp">
<TextView
android:id="@+id/item_left"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignTop="@+id/item_layout"
android:layout_alignBottom="@+id/item_layout"
android:background="#0088ff"
android:gravity="center"
android:text="@string/app_name"
android:textColor="@android:color/white"
android:textSize="20sp" />
<TextView
android:id="@+id/item_right"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignTop="@+id/item_layout"
android:layout_alignBottom="@+id/item_layout"
android:background="?attr/colorColumnListDeleteBackground"
android:gravity="center_vertical"
android:paddingStart="12dp"
android:paddingEnd="12dp"
android:text="@string/delete"
android:textColor="?attr/colorColumnListDeleteText"
android:textSize="20sp" />
<LinearLayout
android:id="@id/item_layout"
android:layout_width="match_parent"
android:id="@+id/tvName"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="@drawable/column_list_selector"
android:gravity="center_vertical"
android:orientation="horizontal">
android:layout_weight="1"
android:textSize="20sp"
tools:text="text..." />
<ImageView
android:id="@+id/ivDragHandle"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="?attr/colorColumnListDragHandleBackground"
android:contentDescription="@string/drag_handle"
android:scaleType="center"
android:src="@drawable/ic_order"
android:visibility="gone"
app:tint="?attr/colorVectorDrawable" />
<ImageButton
android:id="@+id/btnSpeech"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginStart="4dp"
android:background="@drawable/btn_bg_transparent_round6dp"
android:contentDescription="@string/speech"
android:src="@drawable/ic_comment"
app:tint="?attr/colorTextContent" />
<TextView
android:id="@+id/tvName"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="4dp"
android:layout_weight="1"
android:gravity="center_vertical|start"
android:minHeight="48dp"
android:paddingStart="12dp"
android:paddingEnd="12dp"
android:textSize="20sp" />
<ImageButton
android:id="@+id/btnSound"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginStart="4dp"
android:background="@drawable/btn_bg_transparent_round6dp"
android:contentDescription="@string/check_sound"
android:src="@drawable/ic_volume_up"
app:tint="?attr/colorTextContent" />
<ImageButton
android:id="@+id/ivSpeech"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="4dp"
android:contentDescription="@string/speech"
android:src="@drawable/ic_comment"
app:tint="?attr/colorVectorDrawable" />
<ImageButton
android:id="@+id/btnSound"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="4dp"
android:contentDescription="@string/check_sound"
android:src="@drawable/ic_volume_up"
app:tint="?attr/colorVectorDrawable" />
</LinearLayout>
</com.woxthebox.draglistview.swipe.ListSwipeItem>
<ImageButton
android:id="@+id/btnDelete"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginStart="4dp"
android:background="@drawable/btn_bg_transparent_round6dp"
android:contentDescription="@string/delete"
android:src="@drawable/ic_delete"
app:tint="?attr/colorTextContent" />
</LinearLayout>

View File

@ -50,6 +50,6 @@
android:layout_marginStart="16dp"
android:contentDescription="@string/delete"
android:src="@drawable/ic_delete"
app:tint="?attr/colorVectorDrawable" />
app:tint="?attr/colorTextContent" />
</LinearLayout>
</LinearLayout>

View File

@ -1,72 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<com.woxthebox.draglistview.swipe.ListSwipeItem
xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:leftViewId="@+id/item_left"
app:rightViewId="@+id/item_right"
app:swipeViewId="@+id/item_layout">
android:descendantFocusability="blocksDescendants"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingHorizontal="12dp"
android:minHeight="48dp"
android:paddingVertical="3dp">
<TextView
android:id="@+id/item_left"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignBottom="@+id/item_layout"
android:layout_alignTop="@+id/item_layout"
android:background="#0088ff"
android:gravity="center"
android:text="@string/app_name"
android:textColor="@android:color/white"
android:textSize="20sp"/>
<TextView
android:id="@+id/item_right"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignBottom="@+id/item_layout"
android:layout_alignTop="@+id/item_layout"
android:background="?attr/colorColumnListDeleteBackground"
android:gravity="center_vertical"
android:text="@string/delete"
android:textColor="?attr/colorColumnListDeleteText"
android:textSize="20sp"
android:paddingStart="12dp"
android:paddingEnd="12dp"
/>
<LinearLayout
android:id="@id/item_layout"
android:layout_width="match_parent"
android:id="@+id/tvName"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="@drawable/column_list_selector"
android:gravity="center_vertical"
android:orientation="horizontal"
>
android:layout_weight="1"
android:textSize="20sp"
tools:text="text..." />
<ImageView
android:id="@+id/ivDragHandle"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="?attr/colorColumnListDragHandleBackground"
android:contentDescription="@string/drag_handle"
android:scaleType="center"
android:src="@drawable/ic_order"
android:visibility="gone"
/>
<TextView
android:id="@+id/tvName"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="20sp"
android:minHeight="48dp"
android:gravity="center_vertical|start"
android:paddingStart="12dp"
android:paddingEnd="12dp"
/>
</LinearLayout>
</com.woxthebox.draglistview.swipe.ListSwipeItem>
<ImageButton
android:id="@+id/btnDelete"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginStart="4dp"
android:background="@drawable/btn_bg_transparent_round6dp"
android:contentDescription="@string/delete"
android:src="@drawable/ic_delete"
app:tint="?attr/colorTextContent" />
</LinearLayout>

View File

@ -4,7 +4,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/btn_bg_transparent_round6dp"
android:textColor="?attr/colorContentText"
android:textColor="?attr/colorTextContent"
android:gravity="center_vertical|start"
android:drawablePadding="12dp"
android:minHeight="44dp"

View File

@ -31,7 +31,7 @@
android:gravity="start"
android:lineSpacingMultiplier="1.1"
android:text="@string/content_sample"
android:textColor="?attr/colorContentText" />
android:textColor="?attr/colorTextContent" />
</LinearLayout>
</FrameLayout>
</merge>

View File

@ -23,7 +23,7 @@
android:id="@+id/vFooterDivider1"
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="?attr/colorImageButton" />
android:background="?attr/colorColumnStripBackground" />
<View
android:layout_width="0dp"
@ -60,7 +60,7 @@
android:id="@+id/vFooterDivider2"
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="?attr/colorImageButton" />
android:background="?attr/colorColumnStripBackground" />
<ImageView
android:id="@+id/ivFooterToot"

View File

@ -205,7 +205,6 @@
<string name="contributor">col·laboradora</string>
<string name="thanks_for">Gràcies per %1$s.</string>
<string name="simple_list">Llista senzilla(cal reiniciar l\'aplicació)</string>
<string name="mute_app_desc">&gt;Llisca a l\'esquerra per eliminar. Refés les columnes per mostrar els missatges publicats per aplicacions no silenciades.</string>
<string name="muted_app">Aplicacions silenciades</string>
<string name="application_is">aplicació: %1$s</string>
<string name="mute_app_of">Silencia l\'aplicació \"%1$s\"</string>

View File

@ -305,7 +305,6 @@
<string name="mute_app_of">Anwendung \"%1$s\" stummschalten</string>
<string name="application_is">Anwendung: %1$s</string>
<string name="muted_app">Stummgeschaltete Anwendungen</string>
<string name="mute_app_desc">&gt;Wische links um zu löschen. Lade Spalten neu, um Beiträge anzuzeigen, die von stummgeschalteten Anwendungen stammen.</string>
<string name="simple_list">Einfache Liste (App-Neustart benötigt)</string>
<string name="thanks_for">Danke für %1$s.</string>
<string name="contributor">Mitwirkende(r)</string>

View File

@ -192,7 +192,6 @@
<string name="permission_denied_media_access">Autorisation de lapplication manquante pour accéder aux médias. Veuillez accorder l\'autorisation à l\'application dans les paramètres de l\'appareil.</string>
<string name="more">Plus</string>
<string name="mute">Désactiver le son</string>
<string name="mute_app_desc">&gt; Faîtes glisser à gauche pour supprimer. Vous devez rafraîchir les colonnes pour voir les statuts publiés par les applications non masquées.</string>
<string name="mute_app_of">silencer lapplication « %1$s »</string>
<string name="mute_succeeded">En sourdine</string>
<string name="mute_word">Interdire le(s) mot(s)</string>

View File

@ -163,7 +163,6 @@
<string name="thanks_for">תודה עבור %1$s</string>
<string name="confirm_post_from">לפרסם תרועה של %1$s \?</string>
<string name="simple_list">רשימה פשוטה (נא הפעל מחדש את היישום)</string>
<string name="mute_app_desc">&gt; נגב שמאלה כדי למחוק. טען מחדש עמודות כדי להציג סטטוסים שפורסמו על ידי יישומים שלא הושתקו.</string>
<string name="muted_app">יישומים מושתקים</string>
<string name="application_is">יישום: %1$s</string>
<string name="mute_app_of">השתק יישום \"%1$s\"</string>

View File

@ -283,6 +283,7 @@
<string name="exit_app_when_close_protected_column">保護されたカラムを戻るボタンで確認なしで閉じようとしたらアプリを終了する</string>
<string name="fav_muted_user">Fav/BT非通知ユーザ</string>
<string name="fav_muted_user_long">Fav/BT非通知ユーザ</string>
<string name="fav_muted_user_desc">このリストのユーザーからの通知を無視します。 お気に入り、ブースト、フォローリクエスト、リアクションなど。</string>
<string name="favourite">お気に入り</string>
<string name="favourite_from_another_account">別アカウントでお気に入り</string>
<string name="favourite_succeeded">お気に入りにしました</string>
@ -459,7 +460,7 @@
<string name="misskey_hybrid_timeline_long">ソーシャルTL(Misskey)</string>
<string name="more">その他</string>
<string name="mute">ミュート</string>
<string name="mute_app_desc">スワイプで解除。解除した後はカラムをリロードすると再表示されます</string>
<string name="refresh_after_ummute">ミュート解除した後にカラムをリロードすると反映されます。</string>
<string name="mute_app_of">\"%1$s\" アプリをミュート</string>
<string name="mute_succeeded">ミュートできました</string>
<string name="mute_this_conversation">この会話の次回以降の通知をミュート</string>
@ -1016,6 +1017,7 @@
<string name="copy_to_clipboard">クリップボードにコピー</string>
<string name="copied_to_clipboard">クリップボードにコピーしました</string>
<string name="language_filter_quit_waring">言語フィルタは保存されていません。構わず閉じますか?</string>
<string name="keyword_filter_quit_waring">単語フィルタは保存されていません。構わず閉じますか?</string>
<string name="import_completed_please_restart_app">インポート完了。アプリを再起動してください</string>
<string name="delete_custom_emoji_cache">カスタム絵文字のキャッシュを削除</string>
<string name="antenna_list">アンテナ一覧</string>
@ -1174,5 +1176,7 @@
<string name="add_keyword_or_phrase">キーワードやフレーズを追加</string>
<string name="filter_keyword_empty">キーワードがカラです</string>
<string name="filter_title_empty">フィルタ名がカラです</string>
<string name="acct_customize">Acct customize</string>
<string name="delete_confirm">「%1$s」を削除しますか?</string>
</resources>

View File

@ -181,7 +181,6 @@
<string name="contributor">ಕೊಡುಗೆದಾರರು</string>
<string name="thanks_for">%1$sಗೆ ಧನ್ಯವಾದಗಳು.</string>
<string name="simple_list">ಸರಳ ಪಟ್ಟಿ (ಅನ್ವಯ ಮರುಪ್ರಾರಂಭ ಅಗತ್ಯ)</string>
<string name="mute_app_desc">&gt;ಅಳಿಸಲು ಎಡಕ್ಕೆ ತಳ್ಳಿ. ಸದ್ದಡಗಿಸಿರುವ ಅನ್ವಯಗಳಿಂದ ಪ್ರಕಟಿಸಲಾದ ಸ್ಥಿತಿಗಳನ್ನು ತೋರಿಸಲು ಅಂಕಣಗಳನ್ನು ಮರುಲೋಡ್ ಮಾಡಿ.</string>
<string name="muted_app">ಸದ್ದಡಗಿಸಿರುವ ಅನ್ವಯಗಳು</string>
<string name="application_is">ಅನ್ವಯ: %1$s</string>
<string name="mute_app_of">\"%1$s\" ಅನ್ವಯ ಸದ್ದಡಗಿಸು</string>

View File

@ -200,7 +200,6 @@
<string name="contributor">기여자</string>
<string name="thanks_for">%1$s에 대해 감사합니다</string>
<string name="simple_list">간략한 목록 (앱 재시작 필요)</string>
<string name="mute_app_desc">삭제하려면 왼쪽으로 스와이프. 칼럼을 새로 고침하면 음소거 안 된 앱으로 발행된 게시물이 보입니다.</string>
<string name="muted_app">음소거된 앱들</string>
<string name="application_is">앱: %1$s</string>
<string name="mute_app_of">앱 \"%1$s\" 음소거</string>

View File

@ -171,7 +171,6 @@
<string name="contributor">bidragsyter</string>
<string name="thanks_for">Takk for %1$s</string>
<string name="simple_list">Enkel liste (programstart kreves)</string>
<string name="mute_app_desc">Dra for å slette. Du må kanskje laste inn igjen for å vise status offentliggjort av programmer som har fått sin forstumming opphevet.</string>
<string name="muted_app">Forstummede programmer</string>
<string name="application_is">program: %1$s</string>
<string name="mute_app_of">forstum programmet \"%1$s\"</string>

View File

@ -278,7 +278,6 @@
<string name="mute_app_of">静音“%1$s”应用</string>
<string name="application_is">应用:%1$s</string>
<string name="muted_app">被静音应用</string>
<string name="mute_app_desc">&gt;向左滑动可删除.重新加载列,以显示未被静音应用的发布状态.</string>
<string name="simple_list">简单列表(需要重启应用)</string>
<string name="thanks_for">感谢%1$s.</string>
<string name="contributor">支持者</string>

View File

@ -13,9 +13,6 @@
<!-- CWボタンの背景色 -->
<attr name="colorButtonBgCw" format="color"/>
<!-- イメージボタンの図柄の色 0xff000000 -->
<attr name="colorImageButton" format="color"/>
<!-- イメージボタンの図柄の色 ファボ済みなど 0xff0088ff-->
<attr name="colorConversationMainTootBg" format="color"/>
@ -44,11 +41,11 @@
<attr name="colorTimeSmall" format="color"/>
<!-- 本文テキスト -->
<attr name="colorContentText" format="color"/>
<!-- カスタマイズしない画面のImageButtonの図柄のtint -->
<attr name="colorTextContent" format="color"/>
<attr name="colorRefreshErrorBg" format="color"/>
<!-- プロフ背景を薄くするマスク #C0FFFFFF -->
<attr name="colorProfileBackgroundMask" format="color"/>
@ -88,8 +85,6 @@
<!-- サムネイルの背景色 -->
<attr name="colorThumbnailBackground" format="color"/>
<!-- VectorDrawableのXMLに指定するfillColor -->
<attr name="colorVectorDrawable" format="color"/>
<!-- @drawable/window_background_light と @drawable/window_background に指定した色をgetAttributeColorで取得したい -->
<attr name="colorWindowBackground" format="color"/>
@ -105,4 +100,10 @@
<attr name="colorButtonAccentFollowRequest" format="color"/>
<attr name="colorButtonAccentReaction" format="color"/>
<!-- ヘルプテキストなど、少し色の違うテキスト色 -->
<attr name="colorTextHelp" format="color"/>
<attr name="colorActionBarBg" format="color"/>
<attr name="colorActionBarBgStacked" format="color"/>
</resources>

View File

@ -3,7 +3,6 @@
<!-- =================================================== -->
<!-- Light theme -->
<color name="Light_colorAccent">#5a5a5a</color>
<color name="Light_colorBackground">#fff</color>
<color name="Light_colorButtonAccentBookmark">#ff0088ff</color>
<color name="Light_colorButtonAccentBoost">#ff0088ff</color>
@ -13,43 +12,43 @@
<color name="Light_colorButtonAccentReaction">#ff0088ff</color>
<color name="Light_colorButtonBgCw">#cccccc</color>
<color name="Light_colorButtonSelected">#ff000080</color>
<color name="Light_colorColumnHeaderAcct">#80000000</color>
<color name="Light_colorColumnHeaderName">#616161</color>
<color name="Light_colorColumnHeaderPageNumber">#80000000</color>
<color name="Light_colorColumnHeaderBg">#fff</color>
<color name="Light_colorColumnListDeleteBackground">#FF0000</color>
<color name="Light_colorColumnListDeleteText">#fff</color>
<color name="Light_colorColumnListDragHandleBackground">#80cccccc</color>
<color name="Light_colorColumnListItemText">#80000000</color>
<color name="Light_colorColumnSettingBackground">#bbb</color>
<color name="Light_colorColumnStripBackground">#fff</color>
<color name="Light_colorContentText">#ff333333</color>
<color name="Light_colorImageButton">#99343434</color>
<color name="Light_colorConversationMainTootBg">#200088ff</color>
<color name="Light_colorLink">#00a2ff</color>
<color name="Light_colorPostFormBackground">#eee</color>
<color name="Light_colorPrimary">#cccccc</color>
<color name="Light_colorPrimaryDark">#303030</color> <!-- ステータスバー背景 -->
<color name="Light_colorActionBarBg">#ccc</color>
<color name="Light_colorActionBarBgStacked">#ddd</color>
<color name="Light_colorStatusBarBg">#303030</color> <!-- ステータスバー背景 -->
<color name="Light_colorProfileBackgroundMask">#C0FFFFFF</color>
<color name="Light_colorRefreshErrorBg">#D222</color>
<color name="Light_colorRegexFilterError">#f00</color>
<color name="Light_colorReplyBackground">#cccccc</color>
<color name="Light_colorRippleEffect">#FF808080</color>
<color name="Light_colorSearchFormBackground">#bee6ff</color>
<color name="Light_colorSettingDivider">#80000000</color>
<color name="Light_colorShowMediaBackground">#000</color>
<color name="Light_colorShowMediaText">#fff</color>
<color name="Light_colorStatusButtonsPopupBg">#cccccc</color>
<color name="Light_colorThumbnailBackground">#20000000</color>
<color name="Light_colorTimeSmall">#ff666666</color>
<color name="Light_colorVectorDrawable">#616161</color>
<color name="Light_color_column_header">#fff</color>
<color name="Light_list_item_bg_pressed_dragged">#AACCCCCC</color>
<color name="Light_colorSwitchOff">#cccccc</color>
<color name="Light_colorTextColumnHeaderAcct">#80000000</color>
<color name="Light_colorTextColumnHeaderName">#616161</color>
<color name="Light_colorTextColumnHeaderPageNumber">#80000000</color>
<color name="Light_colorTextColumnListItem">#80000000</color>
<color name="Light_colorTextContent">#ff333333</color>
<color name="Light_colorTextDivider">#80000000</color>
<color name="Light_colorTextHelp">#5a5a5a</color>
<color name="Light_colorTextTimeSmall">#ff666666</color>
<color name="Light_colorThumbnailBackground">#20000000</color>
<color name="Light_colotListItemDrag">#AACCCCCC</color>
<color name="Light_colorAppCompatAccent">#0080ff</color>
<!-- =================================================== -->
<!-- Dark theme -->
<color name="Dark_colorAccent">#ccFFFFFF</color>
<color name="Dark_colorBackground">#000</color>
<color name="Dark_colorButtonAccentBookmark">#00a2ff</color>
<color name="Dark_colorButtonAccentBoost">#00a2ff</color>
@ -59,22 +58,19 @@
<color name="Dark_colorButtonAccentReaction">#00a2ff</color>
<color name="Dark_colorButtonBgCw">#5b5b5b</color>
<color name="Dark_colorButtonSelected">#ff000080</color>
<color name="Dark_colorColumnHeaderAcct">#e4e4e4</color>
<color name="Dark_colorColumnHeaderName">#e4e4e4</color>
<color name="Dark_colorColumnHeaderPageNumber">#e4e4e4</color>
<color name="Dark_colorColumnHeader">#333</color>
<color name="Dark_colorColumnListDeleteBackground">#FF0000</color>
<color name="Dark_colorColumnListDeleteText">#fff</color>
<color name="Dark_colorColumnListDragHandleBackground">#80444444</color>
<color name="Dark_colorColumnListItemText">#66FFFFFF</color>
<color name="Dark_colorColumnSettingBackground">#383838</color>
<color name="Dark_colorColumnStripBackground">#000</color>
<color name="Dark_colorContentText">#dddddd</color>
<color name="Dark_colorImageButton">#ccFFFFFF</color>
<color name="Dark_colorConversationMainTootBg">#2000a2ff</color>
<color name="Dark_colorLink">#00a2ff</color>
<color name="Dark_colorListItemDrag">#AA444444</color>
<color name="Dark_colorPostFormBackground">#222</color>
<color name="Dark_colorPrimary">#333</color>
<color name="Dark_colorPrimaryDark">#222</color> <!-- ステータスバー背景 -->
<color name="Dark_colorActionBarBg">#333</color>
<color name="Dark_colorActionBarBgStacked">#222</color>
<color name="Dark_colorStatusBarBg">#222</color> <!-- ステータスバー背景 -->
<color name="Dark_colorProfileBackgroundMask">#C0000000</color>
<color name="Dark_colorRefreshErrorBg">#D222</color>
<color name="Dark_colorRegexFilterError">#f00</color>
@ -85,42 +81,43 @@
<color name="Dark_colorShowMediaBackground">#222</color>
<color name="Dark_colorShowMediaText">#ccFFFFFF</color>
<color name="Dark_colorStatusButtonsPopupBg">#424242</color>
<color name="Dark_colorThumbnailBackground">#20ffffff</color>
<color name="Dark_colorTimeSmall">#BBBBBB</color>
<color name="Dark_colorVectorDrawable">#e4e4e4</color>
<color name="Dark_color_column_header">#333</color>
<color name="Dark_list_item_bg_pressed_dragged">#AA444444</color>
<color name="Dark_colorSwitchOff">#333</color>
<color name="Dark_colorTextColumnHeaderAcct">#e4e4e4</color>
<color name="Dark_colorTextColumnHeaderName">#e4e4e4</color>
<color name="Dark_colorTextColumnHeaderPageNumber">#e4e4e4</color>
<color name="Dark_colorTextColumnListItem">#66FFFFFF</color>
<color name="Dark_colorTextContent">#dddddd</color>
<color name="Dark_colorTextHelp">#ccFFFFFF</color>
<color name="Dark_colorTextTimeSmall">#BBBBBB</color>
<color name="Dark_colorThumbnailBackground">#20ffffff</color>
<color name="Dark_colorAppCompatAccent">#0080ff</color>
<!-- =================================================== -->
<!-- Mastodon theme -->
<color name="Mastodon_colorAccent">#ccFFFFFF</color>
<color name="Mastodon_colorBackground">#282C37</color>
<color name="Mastodon_colorButtonBgCw">#5b5b5b</color>
<color name="Mastodon_colorButtonSelected">#ff000080</color>
<color name="Mastodon_colorButtonAccentBookmark">#9a151a</color>
<color name="Mastodon_colorButtonAccentBoost">#158297</color>
<color name="Mastodon_colorButtonAccentFavourite">#a8ab16</color>
<color name="Mastodon_colorButtonAccentBookmark">#9a151a</color>
<color name="Mastodon_colorButtonAccentFollow">#FF06D3C4</color>
<color name="Mastodon_colorButtonAccentFollowRequest">#f00</color>
<color name="Mastodon_colorButtonAccentReaction">#FF99AEC7</color>
<color name="Mastodon_colorColumnHeaderAcct">#e4e4e4</color>
<color name="Mastodon_colorColumnHeaderName">#e4e4e4</color>
<color name="Mastodon_colorColumnHeaderPageNumber">#e4e4e4</color>
<color name="Mastodon_colorButtonBgCw">#5b5b5b</color>
<color name="Mastodon_colorButtonSelected">#ff000080</color>
<color name="Mastodon_colorColumnHeader">#444B5D</color>
<color name="Mastodon_colorColumnListDeleteBackground">#FF0000</color>
<color name="Mastodon_colorColumnListDeleteText">#fff</color>
<color name="Mastodon_colorColumnListDragHandleBackground">#80444444</color>
<color name="Mastodon_colorColumnListItemText">#66FFFFFF</color>
<color name="Mastodon_colorColumnSettingBackground">#383838</color>
<color name="Mastodon_colorColumnStripBackground">#444B5D</color>
<color name="Mastodon_colorContentText">#dddddd</color>
<color name="Mastodon_colorImageButton">#ccFFFFFF</color>
<color name="Mastodon_colorConversationMainTootBg">#2000a2ff</color>
<color name="Mastodon_colorLink">#FE4E92D6</color>
<color name="Mastodon_colorListItemDrag">#AA444444</color>
<color name="Mastodon_colorPostFormBackground">#222</color>
<color name="Mastodon_colorPrimary">#333</color>
<color name="Mastodon_colorPrimaryDark">#444B5D</color> <!-- ステータスバー背景 -->
<color name="Mastodon_colorActionBarBg">#333</color>
<color name="Mastodon_colorActionBarBgStacked">#222</color>
<color name="Mastodon_colorStatusBarBg">#444B5D</color>
<color name="Mastodon_colorProfileBackgroundMask">#C0000000</color>
<color name="Mastodon_colorRefreshErrorBg">#D222</color>
<color name="Mastodon_colorRegexFilterError">#f00</color>
@ -131,15 +128,22 @@
<color name="Mastodon_colorShowMediaBackground">#222</color>
<color name="Mastodon_colorShowMediaText">#ccFFFFFF</color>
<color name="Mastodon_colorStatusButtonsPopupBg">#424242</color>
<color name="Mastodon_colorThumbnailBackground">#20ffffff</color>
<color name="Mastodon_colorTimeSmall">#BBBBBB</color>
<color name="Mastodon_colorVectorDrawable">#e4e4e4</color>
<color name="Mastodon_color_column_header">#444B5D</color>
<color name="Mastodon_list_item_bg_pressed_dragged">#AA444444</color>
<color name="Mastodon_colorSwitchOff">#777</color>
<color name="Mastodon_colorTextColumnHeaderAcct">#e4e4e4</color>
<color name="Mastodon_colorTextColumnHeaderName">#e4e4e4</color>
<color name="Mastodon_colorTextColumnHeaderPageNumber">#e4e4e4</color>
<color name="Mastodon_colorTextColumnListItem">#66FFFFFF</color>
<color name="Mastodon_colorTextContent">#dddddd</color>
<color name="Mastodon_colorTextHelp">#ccFFFFFF</color>
<color name="Mastodon_colorTextTimeSmall">#BBBBBB</color>
<color name="Mastodon_colorThumbnailBackground">#20ffffff</color>
<color name="Mastodon_colorAppCompatAccent">#0080ff</color>
<!-- =================================================== -->
<!-- スプラッシュ画面の背景色はテーマ関係なし -->
<color name="Other_splashBackground">#0080ff</color>
<!-- 通知のアクセント色 -->
<color name="colorOsNotificationAccent">#B3E1FF</color>
</resources>

View File

@ -209,7 +209,7 @@
<string name="contributor">contributor</string>
<string name="thanks_for">Thanks for %1$s.</string>
<string name="simple_list">Reduce buttons in timeline (app restart required)</string>
<string name="mute_app_desc">&gt;Swipe leftwards to delete. Reload columns to show statuses published by unmuted apps.</string>
<string name="refresh_after_ummute">After unmute items, reloading columns to refresh.</string>
<string name="muted_app">Muted apps</string>
<string name="application_is">app: %1$s</string>
<string name="mute_app_of">mute app \"%1$s\"</string>
@ -655,6 +655,7 @@
<string name="show_favourite_notification_from_user">Enable Fav/BT notifications from this user</string>
<string name="fav_muted_user">FBN disabled users</string>
<string name="fav_muted_user_long">Fav/Boost notifications disabled users</string>
<string name="fav_muted_user_desc">Ignore notifications from users on this list. Favourite, Boost, Follow Request, Reaction, etc.</string>
<string name="changed">Changed.</string>
<string name="thumbnails_arrange_vertically">Vertical arrange thumbnails (app restart required)</string>
<string name="instance_local">Server local</string>
@ -1024,6 +1025,7 @@
<string name="copy_to_clipboard">Copy to clipboard</string>
<string name="copied_to_clipboard">Copied to clipboard.</string>
<string name="language_filter_quit_waring">Language filter is not saved. exit anyway?</string>
<string name="keyword_filter_quit_waring">Keyword filter is not saved. exit anyway?</string>
<string name="import_completed_please_restart_app">Import completed. Please restart app.</string>
<string name="delete_custom_emoji_cache">Delete custom emoji cache</string>
<string name="antenna_list">Antenna list</string>
@ -1181,4 +1183,6 @@
<string name="add_keyword_or_phrase">Add Keyword or phrase</string>
<string name="filter_keyword_empty">filter keyword(s) is empty.</string>
<string name="filter_title_empty">filter title is empty.</string>
<string name="acct_customize">Acct customize</string>
<string name="delete_confirm">delete \"%1$s\" ?</string>
</resources>

View File

@ -1,19 +1,39 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- light theme -->
<style name="AppTheme.Light.Base" parent="Theme.AppCompat.Light.DarkActionBar">
<style name="AppTheme.Light.Base" parent="Theme.AppCompat.Light.NoActionBar">
<!-- AppCompat ============================================ -->
<!--ActionBarの文字色 -->
<item name="android:textColor">@color/Light_colorTextContent</item>
<item name="android:textColorPrimary">@color/Light_colorTextContent</item>
<item name="android:textColorSecondary">@color/Light_colorTextContent</item>
<item name="android:textColorTertiary">@color/Light_colorTextContent</item>
<!-- TabLayoutの下線やRadioButton選択時などの色 -->
<item name="colorAccent">@color/Light_colorAppCompatAccent</item>
<!-- ActionBarの背景色 -->
<item name="colorPrimary">@color/Light_colorActionBarBg</item>
<item name="colorActionBarBg">@color/Light_colorActionBarBg</item>
<item name="colorActionBarBgStacked">@color/Light_colorActionBarBgStacked</item>
<!-- ステータスバーの背景色 -->
<item name="colorPrimaryDark">@color/Light_colorStatusBarBg</item>
<!-- ナビゲーションバー(戻るキー・ホームキーなどがあるバー)の背景色 -->
<item name="android:navigationBarColor">@color/Light_colorColumnStripBackground</item>
<!-- ウィンドウ背景Drawable -->
<item name="android:windowBackground">@drawable/window_background</item>
<item name="android:textColor">?attr/colorContentText</item>
<item name="colorPrimary">@color/Light_colorPrimary</item>
<item name="colorPrimaryDark">@color/Light_colorPrimaryDark</item>
<item name="colorAccent">@color/Light_colorAccent</item>
<!-- AppCompat ここまで ============================================ -->
<item name="colorTextHelp">@color/Light_colorTextHelp</item>
<item name="colorLink">@color/Light_colorLink</item>
<item name="list_item_bg_pressed_dragged">@color/Light_list_item_bg_pressed_dragged</item>
<item name="color_column_header">@color/Light_color_column_header</item>
<item name="colorImageButton">@color/Light_colorImageButton</item>
<item name="list_item_bg_pressed_dragged">@color/Light_colotListItemDrag</item>
<item name="color_column_header">@color/Light_colorColumnHeaderBg</item>
<item name="colorConversationMainTootBg">@color/Light_colorConversationMainTootBg</item>
<item name="colorRippleEffect">@color/Light_colorRippleEffect</item>
<item name="colorButtonSelected">@color/Light_colorButtonSelected</item>
@ -25,53 +45,90 @@
@color/Light_colorColumnListDragHandleBackground
</item>
<item name="colorThumbnailBackground">@color/Light_colorThumbnailBackground</item>
<item name="colorColumnListItemText">@color/Light_colorColumnListItemText</item>
<item name="colorTimeSmall">@color/Light_colorTimeSmall</item>
<item name="colorContentText">@color/Light_colorContentText</item>
<item name="colorColumnListItemText">@color/Light_colorTextColumnListItem</item>
<item name="colorTimeSmall">@color/Light_colorTextTimeSmall</item>
<item name="colorTextContent">@color/Light_colorTextContent</item>
<item name="colorProfileBackgroundMask">@color/Light_colorProfileBackgroundMask</item>
<item name="colorShowMediaBackground">@color/Light_colorShowMediaBackground</item>
<item name="colorShowMediaText">@color/Light_colorShowMediaText</item>
<item name="colorColumnHeaderAcct">@color/Light_colorColumnHeaderAcct</item>
<item name="colorColumnHeaderPageNumber">@color/Light_colorColumnHeaderPageNumber</item>
<item name="colorColumnHeaderAcct">@color/Light_colorTextColumnHeaderAcct</item>
<item name="colorColumnHeaderPageNumber">@color/Light_colorTextColumnHeaderPageNumber</item>
<item name="colorColumnSettingBackground">@color/Light_colorColumnSettingBackground</item>
<item name="colorSearchFormBackground">@color/Light_colorSearchFormBackground</item>
<item name="colorSettingDivider">@color/Light_colorSettingDivider</item>
<item name="colorSettingDivider">@color/Light_colorTextDivider</item>
<item name="colorRegexFilterError">@color/Light_colorRegexFilterError</item>
<item name="colorPostFormBackground">@color/Light_colorPostFormBackground</item>
<item name="colorColumnStripBackground">@color/Light_colorColumnStripBackground</item>
<item name="colorColumnHeaderName">@color/Light_colorColumnHeaderName</item>
<item name="colorColumnHeaderName">@color/Light_colorTextColumnHeaderName</item>
<item name="colorStatusButtonsPopupBg">@color/Light_colorStatusButtonsPopupBg</item>
<item name="colorButtonBgCw">@color/Light_colorButtonBgCw</item>
<item name="colorRefreshErrorBg">@color/Light_colorRefreshErrorBg</item>
<item name="colorVectorDrawable">@color/Light_colorVectorDrawable</item>
<item name="colorWindowBackground">@color/Light_colorBackground</item>
<item name="colorButtonAccentBoost">@color/Light_colorButtonAccentBoost</item>
<item name="colorButtonAccentFavourite">@color/Light_colorButtonAccentFavourite</item>
<item name="colorButtonAccentBookmark">@color/Light_colorButtonAccentBookmark</item>
<item name="colorButtonAccentFollow">@color/Light_colorButtonAccentFollow</item>
<item name="colorButtonAccentFollowRequest">@color/Light_colorButtonAccentFollowRequest</item>
<item name="colorButtonAccentFollowRequest">@color/Light_colorButtonAccentFollowRequest
</item>
<item name="colorButtonAccentReaction">@color/Light_colorButtonAccentReaction</item>
<item name="colorSwitchOff">@color/Light_colorSwitchOff</item>
<!-- アクションバー -->
<item name="android:actionBarStyle">@style/ActionBarStyle.Light</item>
</style>
<style name="AppTheme.Dark.Base" parent="Theme.AppCompat">
<style name="ActionBarStyle.Light" parent="android:Widget.Holo.ActionBar.Solid">
<item name="android:titleTextStyle">@style/ActionBarTitleStyle.Light</item>
<item name="android:subtitleTextStyle">@style/ActionBarSubitleStyle.Light</item>
<item name="android:background">@drawable/action_bar_bg</item>
<item name="android:backgroundStacked">@drawable/action_bar_bg</item>
<item name="android:backgroundSplit">@drawable/action_bar_bg</item>
</style>
<item name="android:windowBackground">@drawable/window_background</item>
<item name="android:textColor">?attr/colorContentText</item>
<style name="ActionBarTitleStyle.Light" parent="@android:style/TextAppearance.Holo.Widget.ActionBar.Title">
<item name="android:textStyle">bold</item>
<item name="android:textColor">@color/Light_colorTextContent</item>
</style>
<style name="ActionBarSubitleStyle.Light" parent="@android:style/TextAppearance.Holo.Widget.ActionBar.Subtitle">
<item name="android:textColor">@color/Light_colorTextTimeSmall</item>
</style>
<style name="AppTheme.Dark.Base" parent="Theme.AppCompat.NoActionBar">
<!-- AppCompat ============================================ -->
<!-- テキスト色 -->
<item name="android:textColor">@color/Dark_colorTextContent</item>
<item name="android:textColorPrimary">@color/Dark_colorTextContent</item>
<item name="android:textColorSecondary">@color/Dark_colorTextContent</item>
<item name="android:textColorTertiary">@color/Dark_colorTextContent</item>
<!-- TabLayoutの下線やRadioButton選択時などの色 -->
<item name="colorAccent">@color/Dark_colorAppCompatAccent</item>
<!-- ActionBarの背景色 -->
<item name="colorPrimary">@color/Dark_colorActionBarBg</item>
<item name="colorActionBarBg">@color/Dark_colorActionBarBg</item>
<item name="colorActionBarBgStacked">@color/Dark_colorActionBarBgStacked</item>
<!-- ステータスバーの背景色 -->
<item name="colorPrimaryDark">@color/Dark_colorStatusBarBg</item>
<!-- ナビゲーションバー(戻るキー・ホームキーなどがあるバー)の背景色 -->
<item name="android:navigationBarColor">@color/Dark_colorColumnStripBackground</item>
<item name="colorPrimary">@color/Dark_colorPrimary</item>
<item name="colorPrimaryDark">@color/Dark_colorPrimaryDark</item>
<item name="colorAccent">@color/Dark_colorAccent</item>
<!-- ウィンドウ背景Drawable -->
<item name="android:windowBackground">@drawable/window_background</item>
<!-- AppCompat ここまで ============================================ -->
<item name="colorTextHelp">@color/Dark_colorTextHelp</item>
<item name="colorLink">@color/Dark_colorLink</item>
<item name="list_item_bg_pressed_dragged">@color/Dark_list_item_bg_pressed_dragged</item>
<item name="color_column_header">@color/Dark_color_column_header</item>
<item name="colorImageButton">@color/Dark_colorImageButton</item>
<item name="list_item_bg_pressed_dragged">@color/Dark_colorListItemDrag</item>
<item name="color_column_header">@color/Dark_colorColumnHeader</item>
<item name="colorConversationMainTootBg">@color/Dark_colorConversationMainTootBg</item>
<item name="colorRippleEffect">@color/Dark_colorRippleEffect</item>
<item name="colorButtonSelected">@color/Dark_colorButtonSelected</item>
@ -84,55 +141,95 @@
</item>
<item name="colorThumbnailBackground">@color/Dark_colorThumbnailBackground</item>
<item name="colorColumnListItemText">@color/Dark_colorColumnListItemText</item>
<item name="colorTimeSmall">@color/Dark_colorTimeSmall</item>
<item name="colorContentText">@color/Dark_colorContentText</item>
<item name="colorColumnListItemText">@color/Dark_colorTextColumnListItem</item>
<item name="colorTimeSmall">@color/Dark_colorTextTimeSmall</item>
<item name="colorTextContent">@color/Dark_colorTextContent</item>
<item name="colorProfileBackgroundMask">@color/Dark_colorProfileBackgroundMask</item>
<item name="colorShowMediaBackground">@color/Dark_colorShowMediaBackground</item>
<item name="colorShowMediaText">@color/Dark_colorShowMediaText</item>
<item name="colorColumnHeaderAcct">@color/Dark_colorColumnHeaderAcct</item>
<item name="colorColumnHeaderPageNumber">@color/Dark_colorColumnHeaderPageNumber</item>
<item name="colorColumnHeaderAcct">@color/Dark_colorTextColumnHeaderAcct</item>
<item name="colorColumnHeaderPageNumber">@color/Dark_colorTextColumnHeaderPageNumber</item>
<item name="colorColumnSettingBackground">@color/Dark_colorColumnSettingBackground</item>
<item name="colorSearchFormBackground">@color/Dark_colorSearchFormBackground</item>
<item name="colorSettingDivider">@color/Dark_colorSettingDivider</item>
<item name="colorRegexFilterError">@color/Dark_colorRegexFilterError</item>
<item name="colorPostFormBackground">@color/Dark_colorPostFormBackground</item>
<item name="colorColumnStripBackground">@color/Dark_colorColumnStripBackground</item>
<item name="colorColumnHeaderName">@color/Dark_colorColumnHeaderName</item>
<item name="colorColumnHeaderName">@color/Dark_colorTextColumnHeaderName</item>
<item name="colorStatusButtonsPopupBg">@color/Dark_colorStatusButtonsPopupBg</item>
<item name="colorButtonBgCw">@color/Dark_colorButtonBgCw</item>
<item name="colorRefreshErrorBg">@color/Dark_colorRefreshErrorBg</item>
<item name="colorVectorDrawable">@color/Dark_colorVectorDrawable</item>
<item name="colorWindowBackground">@color/Dark_colorBackground</item>
<item name="colorButtonAccentBoost">@color/Dark_colorButtonAccentBoost</item>
<item name="colorButtonAccentFavourite">@color/Dark_colorButtonAccentFavourite</item>
<item name="colorButtonAccentBookmark">@color/Dark_colorButtonAccentBookmark</item>
<item name="colorButtonAccentFollow">@color/Dark_colorButtonAccentFollow</item>
<item name="colorButtonAccentFollowRequest">@color/Dark_colorButtonAccentFollowRequest</item>
<item name="colorButtonAccentFollowRequest">@color/Dark_colorButtonAccentFollowRequest
</item>
<item name="colorButtonAccentReaction">@color/Dark_colorButtonAccentReaction</item>
<item name="colorSwitchOff">@color/Dark_colorSwitchOff</item>
<!-- アクションバー -->
<item name="android:actionBarStyle">@style/ActionBarStyle.Dark</item>
</style>
<style name="AppTheme.Mastodon.Base" parent="Theme.AppCompat">
<style name="ActionBarStyle.Dark" parent="android:Widget.Holo.ActionBar.Solid">
<item name="android:titleTextStyle">@style/ActionBarTitleStyle.Dark</item>
<item name="android:subtitleTextStyle">@style/ActionBarSubitleStyle.Dark</item>
<item name="android:background">@drawable/action_bar_bg</item>
<item name="android:backgroundStacked">@drawable/action_bar_bg</item>
<item name="android:backgroundSplit">@drawable/action_bar_bg</item>
</style>
<item name="android:windowBackground">@drawable/window_background</item>
<item name="android:textColor">?attr/colorContentText</item>
<style name="ActionBarTitleStyle.Dark" parent="@android:style/TextAppearance.Holo.Widget.ActionBar.Title">
<item name="android:textStyle">bold</item>
<item name="android:textColor">@color/Dark_colorTextContent</item>
</style>
<style name="ActionBarSubitleStyle.Dark" parent="@android:style/TextAppearance.Holo.Widget.ActionBar.Subtitle">
<item name="android:textColor">@color/Dark_colorTextTimeSmall</item>
</style>
<style name="AppTheme.Mastodon.Base" parent="Theme.AppCompat.NoActionBar">
<!-- AppCompat ============================================ -->
<!-- テキスト色 -->
<item name="android:textColor">@color/Mastodon_colorTextContent</item>
<item name="android:textColorPrimary">@color/Mastodon_colorTextContent</item>
<item name="android:textColorSecondary">@color/Mastodon_colorTextContent</item>
<item name="android:textColorTertiary">@color/Mastodon_colorTextContent</item>
<!-- TabLayoutの下線やRadioButton選択時などの色 -->
<item name="colorAccent">@color/Mastodon_colorAppCompatAccent</item>
<!-- ActionBarの背景色 -->
<item name="colorPrimary">@color/Mastodon_colorActionBarBg</item>
<item name="colorActionBarBg">@color/Mastodon_colorActionBarBg</item>
<item name="colorActionBarBgStacked">@color/Mastodon_colorActionBarBgStacked</item>
<!-- ステータスバーの背景色 -->
<item name="colorPrimaryDark">@color/Mastodon_colorStatusBarBg</item>
<!-- ナビゲーションバー(戻るキー・ホームキーなどがあるバー)の背景色 -->
<item name="android:navigationBarColor">@color/Mastodon_colorColumnStripBackground</item>
<item name="colorPrimary">@color/Mastodon_colorPrimary</item>
<item name="colorPrimaryDark">@color/Mastodon_colorPrimaryDark</item>
<item name="colorAccent">@color/Mastodon_colorAccent</item>
<!-- ウィンドウ背景Drawable -->
<item name="android:windowBackground">@drawable/window_background</item>
<!-- AppCompat ここまで ============================================ -->
<item name="colorTextHelp">@color/Mastodon_colorTextHelp</item>
<item name="colorLink">@color/Mastodon_colorLink</item>
<item name="list_item_bg_pressed_dragged">@color/Mastodon_list_item_bg_pressed_dragged</item>
<item name="color_column_header">@color/Mastodon_color_column_header</item>
<item name="colorImageButton">@color/Mastodon_colorImageButton</item>
<item name="list_item_bg_pressed_dragged">@color/Mastodon_colorListItemDrag</item>
<item name="color_column_header">@color/Mastodon_colorColumnHeader</item>
<item name="colorConversationMainTootBg">@color/Mastodon_colorConversationMainTootBg</item>
<item name="colorRippleEffect">@color/Mastodon_colorRippleEffect</item>
<item name="colorButtonSelected">@color/Mastodon_colorButtonSelected</item>
@ -145,58 +242,62 @@
</item>
<item name="colorThumbnailBackground">@color/Mastodon_colorThumbnailBackground</item>
<item name="colorColumnListItemText">@color/Mastodon_colorColumnListItemText</item>
<item name="colorTimeSmall">@color/Mastodon_colorTimeSmall</item>
<item name="colorContentText">@color/Mastodon_colorContentText</item>
<item name="colorColumnListItemText">@color/Mastodon_colorTextColumnListItem</item>
<item name="colorTimeSmall">@color/Mastodon_colorTextTimeSmall</item>
<item name="colorTextContent">@color/Mastodon_colorTextContent</item>
<item name="colorProfileBackgroundMask">@color/Mastodon_colorProfileBackgroundMask</item>
<item name="colorShowMediaBackground">@color/Mastodon_colorShowMediaBackground</item>
<item name="colorShowMediaText">@color/Mastodon_colorShowMediaText</item>
<item name="colorColumnHeaderAcct">@color/Mastodon_colorColumnHeaderAcct</item>
<item name="colorColumnHeaderPageNumber">@color/Mastodon_colorColumnHeaderPageNumber</item>
<item name="colorColumnSettingBackground">@color/Mastodon_colorColumnSettingBackground</item>
<item name="colorColumnHeaderAcct">@color/Mastodon_colorTextColumnHeaderAcct</item>
<item name="colorColumnHeaderPageNumber">@color/Mastodon_colorTextColumnHeaderPageNumber
</item>
<item name="colorColumnSettingBackground">@color/Mastodon_colorColumnSettingBackground
</item>
<item name="colorSearchFormBackground">@color/Mastodon_colorSearchFormBackground</item>
<item name="colorSettingDivider">@color/Mastodon_colorSettingDivider</item>
<item name="colorRegexFilterError">@color/Mastodon_colorRegexFilterError</item>
<item name="colorPostFormBackground">@color/Mastodon_colorPostFormBackground</item>
<item name="colorColumnStripBackground">@color/Mastodon_colorColumnStripBackground</item>
<item name="colorColumnHeaderName">@color/Mastodon_colorColumnHeaderName</item>
<item name="colorColumnHeaderName">@color/Mastodon_colorTextColumnHeaderName</item>
<item name="colorStatusButtonsPopupBg">@color/Mastodon_colorStatusButtonsPopupBg</item>
<item name="colorButtonBgCw">@color/Mastodon_colorButtonBgCw</item>
<item name="colorRefreshErrorBg">@color/Mastodon_colorRefreshErrorBg</item>
<item name="colorVectorDrawable">@color/Mastodon_colorVectorDrawable</item>
<item name="colorWindowBackground">@color/Mastodon_colorBackground</item>
<item name="colorButtonAccentBoost">@color/Mastodon_colorButtonAccentBoost</item>
<item name="colorButtonAccentFavourite">@color/Mastodon_colorButtonAccentFavourite</item>
<item name="colorButtonAccentBookmark">@color/Mastodon_colorButtonAccentBookmark</item>
<item name="colorButtonAccentFollow">@color/Mastodon_colorButtonAccentFollow</item>
<item name="colorButtonAccentFollowRequest">@color/Mastodon_colorButtonAccentFollowRequest</item>
<item name="colorButtonAccentFollowRequest">@color/Mastodon_colorButtonAccentFollowRequest
</item>
<item name="colorButtonAccentReaction">@color/Mastodon_colorButtonAccentReaction</item>
<item name="colorSwitchOff">@color/Mastodon_colorSwitchOff</item>
<!-- アクションバー -->
<item name="android:actionBarStyle">@style/ActionBarStyle.Mastodon</item>
</style>
<style name="AppTheme.Light.NoActionBar" parent="AppTheme.Light">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<style name="ActionBarStyle.Mastodon" parent="android:Widget.Holo.ActionBar.Solid">
<item name="android:titleTextStyle">@style/ActionBarTitleStyle.Mastodon</item>
<item name="android:subtitleTextStyle">@style/ActionBarSubitleStyle.Mastodon</item>
<item name="android:background">@drawable/action_bar_bg</item>
<item name="android:backgroundStacked">@drawable/action_bar_bg</item>
<item name="android:backgroundSplit">@drawable/action_bar_bg</item>
</style>
<style name="AppTheme.Dark.NoActionBar" parent="AppTheme.Dark">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<style name="ActionBarTitleStyle.Mastodon" parent="@android:style/TextAppearance.Holo.Widget.ActionBar.Title">
<item name="android:textStyle">bold</item>
<item name="android:textColor">@color/Mastodon_colorTextContent</item>
</style>
<style name="AppTheme.Mastodon.NoActionBar" parent="AppTheme.Mastodon">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<style name="ActionBarSubitleStyle.Mastodon" parent="@android:style/TextAppearance.Holo.Widget.ActionBar.Subtitle">
<item name="android:textColor">@color/Mastodon_colorTextTimeSmall</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
<!-- ======================================================================== -->
<style name="setting_group_header">
<item name="android:layout_width">match_parent</item>
@ -273,7 +374,7 @@
<style name="setting_row_help">
<item name="android:background">@drawable/btn_bg_transparent_round6dp</item>
<item name="android:textColor">?attr/colorAccent</item>
<item name="android:textColor">?attr/colorTextHelp</item>
<item name="android:layout_width">40dp</item>
<item name="android:layout_height">40dp</item>
<item name="android:minWidth">32dp</item>

View File

@ -45,14 +45,12 @@ dependencies {
//noinspection GradleDependency
coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:$desugar_lib_bersion"
api "androidx.appcompat:appcompat:$appcompat_version"
def emoji2Version = "1.2.0"
api "androidx.emoji2:emoji2:$emoji2Version"
api "androidx.emoji2:emoji2-views:$emoji2Version"
api "androidx.emoji2:emoji2-views-helper:$emoji2Version"
api "androidx.emoji2:emoji2-bundled:$emoji2Version"
api "androidx.appcompat:appcompat:$appcompat_version"
api 'androidx.core:core-ktx:1.9.0'
api 'com.google.android.material:material:1.7.0'

View File

@ -50,6 +50,21 @@ fun Intent.getIntentExtra(key: String) =
getParcelableExtra(key)
}
/**
* Bundleからキーを指定してint値またはnullを得る
*/
fun Bundle.boolean(key: String) =
when (val v = getRaw(key)) {
is Boolean -> v
else -> null
}
fun Bundle.string(key: String) =
when (val v = getRaw(key)) {
is String -> v
else -> null
}
/**
* Bundleからキーを指定してint値またはnullを得る
*/
@ -71,6 +86,11 @@ fun Bundle.long(key: String) =
else -> null
}
/**
* IntentのExtrasからキーを指定してboolean値またはnullを得る
*/
fun Intent.boolean(key: String) = extras?.boolean(key)
/**
* IntentのExtrasからキーを指定してint値またはnullを得る
*/
@ -81,6 +101,8 @@ fun Intent.int(key: String) = extras?.int(key)
*/
fun Intent.long(key: String) = extras?.long(key)
fun Intent.string(key: String) = extras?.string(key)
fun PackageManager.getPackageInfoCompat(
pakageName: String,
flags: Int = 0,

View File

@ -17,13 +17,13 @@ private val log = LogCategory("EmptyScope")
// プロセスが生きてる間ずっと動いててほしいものや特にキャンセルのタイミングがないコルーチンでは使い続けたい
object EmptyScope : CoroutineScope {
override val coroutineContext: CoroutineContext
get() = EmptyCoroutineContext
get() = EmptyCoroutineContext + AppDispatchers.mainImmediate
}
// メインスレッド上で動作するコルーチンを起動して、終了を待たずにリターンする。
// 起動されたアクティビティのライフサイクルに関わらず中断しない。
fun launchMain(block: suspend CoroutineScope.() -> Unit): Job =
EmptyScope.launch(context = AppDispatchers.mainImmediate) {
EmptyScope.launch {
try {
block()
} catch (ex: Throwable) {
@ -64,7 +64,15 @@ fun AppCompatActivity.launchAndShowError(
try {
block()
} catch (ex: Throwable) {
showError(ex, errorCaption)
when (ex) {
is CancellationException -> {
log.w(ex, errorCaption ?: "launchAndShowError cancelled.")
}
else -> {
log.e(ex, errorCaption ?: "launchAndShowError failed.")
showError(ex, errorCaption)
}
}
}
}
@ -102,7 +110,9 @@ fun <T : Any?> AppCompatActivity.launchProgress(
if (result != null) afterProc(result)
} catch (ex: Throwable) {
log.e(ex, "launchProgress: $caption failed.")
showToast(ex, "$caption failed.")
if (ex !is CancellationException) {
showToast(ex, "$caption failed.")
}
} finally {
progress.dismissSafe()
try {

View File

@ -59,6 +59,9 @@ fun Cursor.getBlobOrNull(keyIdx: Int) =
fun Cursor.getBlobOrNull(key: String) =
getBlobOrNull(getColumnIndex(key))
fun Cursor.columnIndexOrThrow(key:String)=
getColumnIndex(key).takeIf{it>=0L} ?: error("missing column $key")
/////////////////////////////////////////////////////////////
interface TableCompanion {

Some files were not shown because too many files have changed in this diff Show More