ボタン画像のデータを24dpに変更。デフォルト表示サイズを24dpに変更。添付メディアの種別がunknwonとaudioの際のサムネイル表示を改善。
1
.idea/dictionaries/tateisu.xml
generated
@ -47,6 +47,7 @@
|
||||
<w>kotlinx</w>
|
||||
<w>mailto</w>
|
||||
<w>mimumedon</w>
|
||||
<w>mpga</w>
|
||||
<w>navi</w>
|
||||
<w>nicodic</w>
|
||||
<w>nicoru</w>
|
||||
|
@ -25,6 +25,7 @@ import android.text.SpannableString
|
||||
import android.text.TextWatcher
|
||||
import android.view.View
|
||||
import android.widget.*
|
||||
import jp.juggler.subwaytooter.Styler.defaultColorIcon
|
||||
import jp.juggler.subwaytooter.api.*
|
||||
import jp.juggler.subwaytooter.api.entity.*
|
||||
import jp.juggler.subwaytooter.dialog.ActionsDialog
|
||||
@ -725,9 +726,9 @@ class ActAccountSetting
|
||||
|
||||
private fun initializeProfile() {
|
||||
// 初期状態
|
||||
val question_id = getAttributeResourceId(this, R.attr.ic_question)
|
||||
ivProfileAvatar.setErrorImageResId(question_id)
|
||||
ivProfileAvatar.setDefaultImageResId(question_id)
|
||||
val question_id = R.drawable.wide_question
|
||||
ivProfileAvatar.setErrorImage( defaultColorIcon(this,question_id))
|
||||
ivProfileAvatar.setDefaultImage( defaultColorIcon(this,question_id))
|
||||
|
||||
val loadingText = when(account.isPseudo) {
|
||||
true -> "(disabled for pseudo account)"
|
||||
|
@ -679,10 +679,10 @@ class ActAppSettingChild : AppCompatActivity()
|
||||
)
|
||||
|
||||
tvColumnName !!.textColor = header_fg
|
||||
setIconAttr(
|
||||
setIconDrawableId(
|
||||
this,
|
||||
ivColumnHeader !!,
|
||||
R.attr.btn_federate_tl,
|
||||
R.drawable.ic_bike,
|
||||
color = header_fg
|
||||
)
|
||||
}
|
||||
@ -1092,13 +1092,9 @@ class ActAppSettingChild : AppCompatActivity()
|
||||
}
|
||||
|
||||
c = footer_button_fg_color
|
||||
if(c == 0) {
|
||||
setIconAttr(this, ivFooterToot !!, R.attr.ic_edit)
|
||||
setIconAttr(this, ivFooterMenu !!, R.attr.ic_hamburger)
|
||||
} else {
|
||||
setIconAttr(this, ivFooterToot !!, R.attr.ic_edit, color = c)
|
||||
setIconAttr(this, ivFooterMenu !!, R.attr.ic_hamburger, color = c)
|
||||
}
|
||||
if(c == 0) c= getAttributeColor(this,R.attr.colorVectorDrawable)
|
||||
setIconDrawableId(this, ivFooterToot !!, R.drawable.ic_edit, color = c)
|
||||
setIconDrawableId(this, ivFooterMenu !!, R.drawable.ic_hamburger, color = c)
|
||||
|
||||
c = footer_tab_bg_color
|
||||
if(c == 0) {
|
||||
|
@ -392,10 +392,10 @@ class ActColumnCustomize : AppCompatActivity(), View.OnClickListener, ColorPicke
|
||||
|
||||
val c = column.getHeaderNameColor()
|
||||
tvColumnName.textColor = c
|
||||
setIconAttr(
|
||||
setIconDrawableId(
|
||||
this,
|
||||
ivColumnHeader,
|
||||
column.getIconAttrId(column.column_type),
|
||||
column.getIconId(column.column_type),
|
||||
color = c
|
||||
)
|
||||
|
||||
|
@ -3,7 +3,9 @@ package jp.juggler.subwaytooter
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.graphics.PorterDuff
|
||||
import android.os.Bundle
|
||||
import android.support.v4.content.ContextCompat
|
||||
import android.support.v7.app.AppCompatActivity
|
||||
import android.support.v7.widget.LinearLayoutManager
|
||||
import android.view.View
|
||||
@ -265,10 +267,11 @@ class ActColumnList : AppCompatActivity() {
|
||||
tvAccess.setBackgroundColor(item.acct_color_bg)
|
||||
tvAccess.setPaddingRelative(acct_pad_lr, 0, acct_pad_lr, 0)
|
||||
tvName.text = item.name
|
||||
ivColumnIcon.setImageResource(
|
||||
getAttributeResourceId(
|
||||
this@ActColumnList, Column.getIconAttrId(item.acct, item.type)
|
||||
)
|
||||
ivColumnIcon.setImageDrawable(
|
||||
ContextCompat.getDrawable(this@ActColumnList,Column.getIconId(item.acct, item.type))?.also{
|
||||
it.setTint(getAttributeColor(this@ActColumnList,R.attr.colorVectorDrawable))
|
||||
it.setTintMode(PorterDuff.Mode.SRC_IN)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
@ -299,10 +302,11 @@ class ActColumnList : AppCompatActivity() {
|
||||
tv.text = item.name
|
||||
|
||||
val ivColumnIcon = dragView.findViewById<ImageView>(R.id.ivColumnIcon)
|
||||
ivColumnIcon.setImageResource(
|
||||
getAttributeResourceId(
|
||||
this@ActColumnList, Column.getIconAttrId(item.acct, item.type)
|
||||
)
|
||||
ivColumnIcon.setImageDrawable(
|
||||
ContextCompat.getDrawable(this@ActColumnList,Column.getIconId(item.acct, item.type))?.also{
|
||||
it.setTint( getAttributeColor(this@ActColumnList,R.attr.colorVectorDrawable))
|
||||
it.setTintMode(PorterDuff.Mode.SRC_IN)
|
||||
}
|
||||
)
|
||||
|
||||
dragView.findViewById<View>(R.id.ivBookmark).visibility =
|
||||
|
@ -1518,10 +1518,10 @@ class ActMain : AppCompatActivity()
|
||||
|
||||
column.setHeaderBackground(viewRoot)
|
||||
|
||||
setIconAttr(
|
||||
setIconDrawableId(
|
||||
this,
|
||||
ivIcon,
|
||||
column.getIconAttrId(column.column_type),
|
||||
column.getIconId(column.column_type),
|
||||
column.getHeaderNameColor()
|
||||
)
|
||||
|
||||
@ -2427,15 +2427,10 @@ class ActMain : AppCompatActivity()
|
||||
}
|
||||
|
||||
c = footer_button_fg_color
|
||||
if(c == 0) {
|
||||
setIconAttr(this, btnToot, R.attr.ic_edit)
|
||||
setIconAttr(this, btnMenu, R.attr.ic_hamburger)
|
||||
setIconAttr(this, btnQuickToot, R.attr.btn_post)
|
||||
} else {
|
||||
setIconAttr(this, btnToot, R.attr.ic_edit, c)
|
||||
setIconAttr(this, btnMenu, R.attr.ic_hamburger, c)
|
||||
setIconAttr(this, btnQuickToot, R.attr.btn_post, c)
|
||||
}
|
||||
if(c == 0) c= getAttributeColor(this,R.attr.colorVectorDrawable)
|
||||
setIconDrawableId(this, btnToot, R.drawable.ic_edit, c)
|
||||
setIconDrawableId(this, btnMenu, R.drawable.ic_hamburger, c)
|
||||
setIconDrawableId(this, btnQuickToot, R.drawable.ic_send, c)
|
||||
|
||||
c = footer_tab_bg_color
|
||||
if(c == 0) c = getAttributeColor(this, R.attr.colorColumnStripBackground)
|
||||
|
@ -30,6 +30,7 @@ import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.ViewTreeObserver
|
||||
import android.widget.*
|
||||
import jp.juggler.subwaytooter.Styler.defaultColorIcon
|
||||
import jp.juggler.subwaytooter.api.*
|
||||
import jp.juggler.subwaytooter.api.entity.*
|
||||
import jp.juggler.subwaytooter.dialog.*
|
||||
@ -191,9 +192,9 @@ class ActPost : AppCompatActivity(),
|
||||
|
||||
// (Misskey) 返信を引用リノートにする
|
||||
quotedRenote : Boolean = false,
|
||||
|
||||
|
||||
//(Mastodon) 予約投稿の編集
|
||||
scheduledStatus: TootScheduled? = null
|
||||
scheduledStatus : TootScheduled? = null
|
||||
|
||||
) {
|
||||
val intent = Intent(activity, ActPost::class.java)
|
||||
@ -215,7 +216,7 @@ class ActPost : AppCompatActivity(),
|
||||
if(sent_intent != null) {
|
||||
intent.putExtra(KEY_SENT_INTENT, sent_intent)
|
||||
}
|
||||
if( scheduledStatus != null ){
|
||||
if(scheduledStatus != null) {
|
||||
intent.putExtra(KEY_SCHEDULED_STATUS, scheduledStatus.src.toString())
|
||||
}
|
||||
activity.startActivityForResult(intent, request_code)
|
||||
@ -263,7 +264,7 @@ class ActPost : AppCompatActivity(),
|
||||
|
||||
private lateinit var llReply : View
|
||||
private lateinit var tvReplyTo : TextView
|
||||
private lateinit var btnRemoveReply : View
|
||||
private lateinit var btnRemoveReply : ImageButton
|
||||
private lateinit var ivReply : MyNetworkImageView
|
||||
private lateinit var scrollView : ScrollView
|
||||
|
||||
@ -461,10 +462,10 @@ class ActPost : AppCompatActivity(),
|
||||
this.visibility = TootVisibility.fromId(savedInstanceState.getInt(KEY_VISIBILITY, - 1))
|
||||
|
||||
val a = account
|
||||
if( a != null) {
|
||||
if(a != null) {
|
||||
savedInstanceState.getString(STATE_SCHEDULED_STATUS)?.let {
|
||||
scheduledStatus =
|
||||
parseItem(::TootScheduled, TootParser(this@ActPost, a), JSONObject(it),log)
|
||||
parseItem(::TootScheduled, TootParser(this@ActPost, a), JSONObject(it), log)
|
||||
}
|
||||
}
|
||||
|
||||
@ -493,8 +494,7 @@ class ActPost : AppCompatActivity(),
|
||||
sv.toJsonArray().forEach {
|
||||
if(it !is JSONObject) return@forEach
|
||||
try {
|
||||
val a = TootAttachment.decodeJson(it)
|
||||
attachment_list.add(PostAttachment(a))
|
||||
attachment_list.add(PostAttachment(TootAttachment.decodeJson(it)))
|
||||
} catch(ex : Throwable) {
|
||||
log.trace(ex)
|
||||
}
|
||||
@ -738,9 +738,14 @@ class ActPost : AppCompatActivity(),
|
||||
// 予約編集の再編集
|
||||
sv = intent.getStringExtra(KEY_SCHEDULED_STATUS)
|
||||
if(sv != null && account != null) {
|
||||
try{
|
||||
val item = parseItem(::TootScheduled, TootParser(this@ActPost, account), JSONObject(sv),log)
|
||||
if( item != null){
|
||||
try {
|
||||
val item = parseItem(
|
||||
::TootScheduled,
|
||||
TootParser(this@ActPost, account),
|
||||
JSONObject(sv),
|
||||
log
|
||||
)
|
||||
if(item != null) {
|
||||
scheduledStatus = item
|
||||
|
||||
timeSchedule = item.timeScheduledAt
|
||||
@ -749,34 +754,34 @@ class ActPost : AppCompatActivity(),
|
||||
etContent.setText(text)
|
||||
|
||||
val cw = item.spoiler_text
|
||||
if( cw?.isNotEmpty() == true ){
|
||||
if(cw?.isNotEmpty() == true) {
|
||||
etContentWarning.setText(cw)
|
||||
cbContentWarning.isChecked = true
|
||||
}else{
|
||||
} else {
|
||||
cbContentWarning.isChecked = false
|
||||
}
|
||||
cbNSFW.isChecked = item.sensitive
|
||||
visibility = item.visibility
|
||||
|
||||
|
||||
// 2019/1/7 どうも添付データを古い投稿から引き継げないようだ…。
|
||||
// バグ臭い
|
||||
// val src_attachments = item.media_attachments
|
||||
// if(src_attachments?.isNotEmpty() == true) {
|
||||
// app_state.attachment_list = this.attachment_list
|
||||
// this.attachment_list.clear()
|
||||
// try {
|
||||
// for(src in src_attachments) {
|
||||
// if(src is TootAttachment) {
|
||||
// src.redraft = true
|
||||
// val pa = PostAttachment(src)
|
||||
// pa.status = PostAttachment.STATUS_UPLOADED
|
||||
// this.attachment_list.add(pa)
|
||||
// }
|
||||
// }
|
||||
// } catch(ex : Throwable) {
|
||||
// log.trace(ex)
|
||||
// }
|
||||
// }
|
||||
// val src_attachments = item.media_attachments
|
||||
// if(src_attachments?.isNotEmpty() == true) {
|
||||
// app_state.attachment_list = this.attachment_list
|
||||
// this.attachment_list.clear()
|
||||
// try {
|
||||
// for(src in src_attachments) {
|
||||
// if(src is TootAttachment) {
|
||||
// src.redraft = true
|
||||
// val pa = PostAttachment(src)
|
||||
// pa.status = PostAttachment.STATUS_UPLOADED
|
||||
// this.attachment_list.add(pa)
|
||||
// }
|
||||
// }
|
||||
// } catch(ex : Throwable) {
|
||||
// log.trace(ex)
|
||||
// }
|
||||
// }
|
||||
}
|
||||
} catch(ex : Throwable) {
|
||||
log.trace(ex)
|
||||
@ -794,7 +799,7 @@ class ActPost : AppCompatActivity(),
|
||||
// 表示を未選択に更新
|
||||
selectAccount(null)
|
||||
}
|
||||
|
||||
|
||||
updateContentWarning()
|
||||
showMediaAttachment()
|
||||
showVisibility()
|
||||
@ -978,7 +983,7 @@ class ActPost : AppCompatActivity(),
|
||||
|
||||
tvSchedule = findViewById(R.id.tvSchedule)
|
||||
ibSchedule = findViewById(R.id.ibSchedule)
|
||||
ibScheduleReset= findViewById(R.id.ibScheduleReset)
|
||||
ibScheduleReset = findViewById(R.id.ibScheduleReset)
|
||||
|
||||
ibSchedule.setOnClickListener(this)
|
||||
ibScheduleReset.setOnClickListener(this)
|
||||
@ -1002,15 +1007,18 @@ class ActPost : AppCompatActivity(),
|
||||
|
||||
for(iv in ivMedia) {
|
||||
iv.setOnClickListener(this)
|
||||
iv.setDefaultImageResId(getAttributeResourceId(this, R.attr.ic_loading))
|
||||
iv.setErrorImageResId(getAttributeResourceId(this, R.attr.ic_unknown))
|
||||
iv.setDefaultImage(defaultColorIcon(this, R.drawable.ic_upload))
|
||||
iv.setErrorImage(defaultColorIcon(this, R.drawable.ic_unknown))
|
||||
}
|
||||
|
||||
setIcon(btnPost, R.drawable.btn_post)
|
||||
setIcon(btnMore, R.drawable.btn_more)
|
||||
setIcon(btnPlugin, R.drawable.ic_plugin)
|
||||
setIcon(btnEmojiPicker, R.drawable.ic_face)
|
||||
setIcon(btnAttachment, R.drawable.btn_attachment)
|
||||
// setIcon(btnPost, R.drawable.ic_send)
|
||||
// setIcon(btnMore, R.drawable.ic_more)
|
||||
// setIcon(btnPlugin, R.drawable.ic_extension)
|
||||
// setIcon(btnEmojiPicker, R.drawable.ic_face)
|
||||
// setIcon(btnAttachment, R.drawable.ic_attachment)
|
||||
// setIcon(ibSchedule, R.drawable.ic_edit)
|
||||
// setIcon(ibScheduleReset, R.drawable.ic_close)
|
||||
// setIcon(btnRemoveReply, R.drawable.ic_close)
|
||||
|
||||
cbContentWarning.setOnCheckedChangeListener { _, _ ->
|
||||
updateContentWarning()
|
||||
@ -1046,15 +1054,6 @@ class ActPost : AppCompatActivity(),
|
||||
|
||||
}
|
||||
|
||||
private fun setIcon(iv : ImageView, drawableId : Int) {
|
||||
setIconDrawableId(
|
||||
this,
|
||||
iv,
|
||||
drawableId,
|
||||
getAttributeColor(this, R.attr.colorColumnHeaderName)
|
||||
)
|
||||
}
|
||||
|
||||
private var lastInstanceTask : TootTaskRunner? = null
|
||||
|
||||
private fun getMaxCharCount() : Int {
|
||||
@ -1188,7 +1187,7 @@ class ActPost : AppCompatActivity(),
|
||||
|
||||
private fun performAccountChooser() {
|
||||
|
||||
if( scheduledStatus!= null ) {
|
||||
if(scheduledStatus != null) {
|
||||
// 予約投稿の再編集ではアカウントを切り替えられない
|
||||
showToast(this, false, R.string.cant_change_account_when_editing_scheduled_status)
|
||||
return
|
||||
@ -2059,15 +2058,15 @@ class ActPost : AppCompatActivity(),
|
||||
}
|
||||
}
|
||||
|
||||
private fun showVisibility() {
|
||||
setIcon(
|
||||
btnVisibility, Styler.getVisibilityIcon(
|
||||
this
|
||||
, account?.isMisskey == true
|
||||
, visibility ?: TootVisibility.Public
|
||||
)
|
||||
)
|
||||
}
|
||||
private fun showVisibility() = setIconDrawableId(
|
||||
this,
|
||||
btnVisibility,
|
||||
Styler.getVisibilityIconId(
|
||||
account?.isMisskey == true
|
||||
, visibility ?: TootVisibility.Public
|
||||
),
|
||||
getAttributeColor(this, R.attr.colorVectorDrawable)
|
||||
)
|
||||
|
||||
private fun performVisibility() {
|
||||
val list = if(account?.isMisskey == true) {
|
||||
@ -2190,7 +2189,7 @@ class ActPost : AppCompatActivity(),
|
||||
|
||||
post_helper.scheduledId = scheduledStatus?.id
|
||||
|
||||
post_helper.post(account,callback=object:PostHelper.PostCompleteCallback{
|
||||
post_helper.post(account, callback = object : PostHelper.PostCompleteCallback {
|
||||
override fun onPostComplete(
|
||||
target_account : SavedAccount,
|
||||
status : TootStatus
|
||||
@ -2206,7 +2205,7 @@ class ActPost : AppCompatActivity(),
|
||||
}
|
||||
|
||||
override fun onScheduledPostComplete(target_account : SavedAccount) {
|
||||
showToast(this@ActPost,false,getString(R.string.scheduled_status_sent))
|
||||
showToast(this@ActPost, false, getString(R.string.scheduled_status_sent))
|
||||
val data = Intent()
|
||||
data.putExtra(EXTRA_POSTED_ACCT, target_account.acct)
|
||||
setResult(RESULT_OK, data)
|
||||
@ -2677,8 +2676,8 @@ class ActPost : AppCompatActivity(),
|
||||
showSchedule()
|
||||
}
|
||||
}
|
||||
|
||||
private fun resetSchedule(){
|
||||
|
||||
private fun resetSchedule() {
|
||||
timeSchedule = 0L
|
||||
showSchedule()
|
||||
}
|
||||
|
@ -293,42 +293,42 @@ class Column(
|
||||
}
|
||||
}
|
||||
|
||||
internal fun getIconAttrId(acct : String, type : Int) : Int {
|
||||
internal fun getIconId(acct : String, type : Int) : Int {
|
||||
return when(type) {
|
||||
TYPE_REPORTS -> R.attr.ic_info
|
||||
TYPE_HOME -> R.attr.btn_home
|
||||
TYPE_REPORTS -> R.drawable.ic_info
|
||||
TYPE_HOME -> R.drawable.ic_home
|
||||
|
||||
TYPE_LOCAL_AROUND -> R.attr.btn_local_tl
|
||||
TYPE_FEDERATED_AROUND -> R.attr.btn_federate_tl
|
||||
TYPE_ACCOUNT_AROUND -> R.attr.btn_statuses
|
||||
TYPE_LOCAL_AROUND -> R.drawable.ic_run
|
||||
TYPE_FEDERATED_AROUND -> R.drawable.ic_bike
|
||||
TYPE_ACCOUNT_AROUND -> R.drawable.ic_account_box
|
||||
|
||||
TYPE_LOCAL -> R.attr.btn_local_tl
|
||||
TYPE_FEDERATE -> R.attr.btn_federate_tl
|
||||
TYPE_MISSKEY_HYBRID -> R.attr.ic_share
|
||||
TYPE_LOCAL -> R.drawable.ic_run
|
||||
TYPE_FEDERATE -> R.drawable.ic_bike
|
||||
TYPE_MISSKEY_HYBRID -> R.drawable.ic_share
|
||||
|
||||
TYPE_PROFILE -> R.attr.btn_statuses
|
||||
TYPE_FAVOURITES -> if(SavedAccount.isNicoru(acct)) R.attr.ic_nicoru else R.attr.btn_favourite
|
||||
TYPE_NOTIFICATIONS -> R.attr.btn_notification
|
||||
TYPE_CONVERSATION -> R.attr.ic_conversation
|
||||
TYPE_BOOSTED_BY -> R.attr.btn_boost
|
||||
TYPE_FAVOURITED_BY -> if(SavedAccount.isNicoru(acct)) R.attr.ic_nicoru else R.attr.btn_favourite
|
||||
TYPE_HASHTAG -> R.attr.ic_hashtag
|
||||
TYPE_MUTES -> R.attr.ic_mute
|
||||
TYPE_KEYWORD_FILTER -> R.attr.ic_mute
|
||||
TYPE_BLOCKS -> R.attr.ic_block
|
||||
TYPE_DOMAIN_BLOCKS -> R.attr.ic_domain_block
|
||||
TYPE_SEARCH, TYPE_SEARCH_MSP, TYPE_SEARCH_TS -> R.attr.ic_search
|
||||
TYPE_INSTANCE_INFORMATION -> R.attr.ic_info
|
||||
TYPE_FOLLOW_REQUESTS -> R.attr.ic_follow_wait
|
||||
TYPE_FOLLOW_SUGGESTION -> R.attr.ic_follow_plus
|
||||
TYPE_ENDORSEMENT -> R.attr.ic_follow_plus
|
||||
TYPE_LIST_LIST -> R.attr.ic_list_list
|
||||
TYPE_LIST_MEMBER -> R.attr.ic_list_member
|
||||
TYPE_LIST_TL -> R.attr.ic_list_tl
|
||||
TYPE_DIRECT_MESSAGES -> R.attr.ic_mail
|
||||
TYPE_TREND_TAG -> R.attr.ic_hashtag
|
||||
TYPE_SCHEDULED_STATUS -> R.attr.ic_timer
|
||||
else -> R.attr.ic_info
|
||||
TYPE_PROFILE -> R.drawable.ic_account_box
|
||||
TYPE_FAVOURITES -> if(SavedAccount.isNicoru(acct)) R.drawable.ic_nicoru else R.drawable.ic_star
|
||||
TYPE_NOTIFICATIONS -> R.drawable.ic_announcement
|
||||
TYPE_CONVERSATION -> R.drawable.ic_forum
|
||||
TYPE_BOOSTED_BY -> R.drawable.ic_repeat
|
||||
TYPE_FAVOURITED_BY -> if(SavedAccount.isNicoru(acct)) R.drawable.ic_nicoru else R.drawable.ic_star
|
||||
TYPE_HASHTAG -> R.drawable.ic_hashtag
|
||||
TYPE_MUTES -> R.drawable.ic_volume_off
|
||||
TYPE_KEYWORD_FILTER -> R.drawable.ic_volume_off
|
||||
TYPE_BLOCKS -> R.drawable.ic_block
|
||||
TYPE_DOMAIN_BLOCKS -> R.drawable.ic_cloud_off
|
||||
TYPE_SEARCH, TYPE_SEARCH_MSP, TYPE_SEARCH_TS -> R.drawable.ic_search
|
||||
TYPE_INSTANCE_INFORMATION -> R.drawable.ic_info
|
||||
TYPE_FOLLOW_REQUESTS -> R.drawable.ic_follow_wait
|
||||
TYPE_FOLLOW_SUGGESTION -> R.drawable.ic_follow_plus
|
||||
TYPE_ENDORSEMENT -> R.drawable.ic_follow_plus
|
||||
TYPE_LIST_LIST -> R.drawable.ic_list_list
|
||||
TYPE_LIST_MEMBER -> R.drawable.ic_list_member
|
||||
TYPE_LIST_TL -> R.drawable.ic_list_tl
|
||||
TYPE_DIRECT_MESSAGES -> R.drawable.ic_mail
|
||||
TYPE_TREND_TAG -> R.drawable.ic_hashtag
|
||||
TYPE_SCHEDULED_STATUS -> R.drawable.ic_timer
|
||||
else -> R.drawable.ic_info
|
||||
}
|
||||
}
|
||||
|
||||
@ -1096,8 +1096,8 @@ class Column(
|
||||
}
|
||||
}
|
||||
|
||||
internal fun getIconAttrId(type : Int) : Int {
|
||||
return getIconAttrId(access_info.acct, type)
|
||||
internal fun getIconId(type : Int) : Int {
|
||||
return getIconId(access_info.acct, type)
|
||||
}
|
||||
|
||||
// ブーストやお気に入りの更新に使う。ステータスを列挙する。
|
||||
@ -6444,10 +6444,6 @@ class Column(
|
||||
s.markDeleted(context, ev.deletedAt) ?: false
|
||||
}
|
||||
}
|
||||
|
||||
else -> {
|
||||
log.d("onNoteUpdated: unknown type: ${ev.type}")
|
||||
}
|
||||
}
|
||||
|
||||
if(changeList.isNotEmpty()) {
|
||||
|
@ -760,15 +760,15 @@ class ColumnViewHolder(
|
||||
// カラムヘッダ文字色(A)
|
||||
var c = column.getHeaderNameColor()
|
||||
tvColumnName.textColor = c
|
||||
setIconAttr(
|
||||
setIconDrawableId(
|
||||
activity,
|
||||
ivColumnIcon,
|
||||
column.getIconAttrId(column.column_type),
|
||||
column.getIconId(column.column_type),
|
||||
c
|
||||
)
|
||||
setIconAttr(activity, btnColumnSetting, R.attr.ic_tune, c)
|
||||
setIconAttr(activity, btnColumnReload, R.attr.btn_refresh, c)
|
||||
setIconAttr(activity, btnColumnClose, R.attr.btn_close, c)
|
||||
setIconDrawableId(activity, btnColumnSetting, R.drawable.ic_tune, c)
|
||||
setIconDrawableId(activity, btnColumnReload, R.drawable.ic_refresh, c)
|
||||
setIconDrawableId(activity, btnColumnClose, R.drawable.ic_close, c)
|
||||
|
||||
// カラムヘッダ文字色(B)
|
||||
c = column.getHeaderPageNumberColor()
|
||||
@ -1562,19 +1562,19 @@ class ColumnViewHolder(
|
||||
|
||||
showQuickFilterButton(
|
||||
btnQuickFilterMention,
|
||||
R.drawable.btn_reply,
|
||||
R.drawable.ic_reply,
|
||||
column.quick_filter == Column.QUICK_FILTER_MENTION
|
||||
)
|
||||
|
||||
showQuickFilterButton(
|
||||
btnQuickFilterFavourite,
|
||||
R.drawable.btn_favourite,
|
||||
R.drawable.ic_star,
|
||||
column.quick_filter == Column.QUICK_FILTER_FAVOURITE
|
||||
)
|
||||
|
||||
showQuickFilterButton(
|
||||
btnQuickFilterBoost,
|
||||
R.drawable.btn_boost,
|
||||
R.drawable.ic_repeat,
|
||||
column.quick_filter == Column.QUICK_FILTER_BOOST
|
||||
)
|
||||
|
||||
|
@ -298,21 +298,16 @@ internal class DlgContextMenu(
|
||||
ivFollowedBy.visibility = View.GONE
|
||||
} else {
|
||||
ivFollowedBy.visibility = View.VISIBLE
|
||||
ivFollowedBy.setImageResource(
|
||||
getAttributeResourceId(
|
||||
activity,
|
||||
R.attr.ic_followed_by
|
||||
)
|
||||
)
|
||||
ivFollowedBy.setImageResource(R.drawable.ic_followed_by)
|
||||
}
|
||||
|
||||
btnFollow.setImageDrawable(
|
||||
createColoredDrawable(
|
||||
activity,
|
||||
when {
|
||||
relation.getRequested(who) -> R.drawable.ic_follow_wait_dark
|
||||
relation.getFollowing(who) -> R.drawable.ic_follow_cross_dark
|
||||
else -> R.drawable.ic_follow_plus_dark
|
||||
relation.getRequested(who) -> R.drawable.ic_follow_wait
|
||||
relation.getFollowing(who) -> R.drawable.ic_follow_cross
|
||||
else -> R.drawable.ic_follow_plus
|
||||
},
|
||||
getAttributeColor(
|
||||
activity,
|
||||
@ -328,7 +323,7 @@ internal class DlgContextMenu(
|
||||
btnMute.setImageDrawable(
|
||||
createColoredDrawable(
|
||||
activity,
|
||||
R.drawable.ic_mute_dark,
|
||||
R.drawable.ic_volume_off,
|
||||
getAttributeColor(
|
||||
activity,
|
||||
when(relation.muting) {
|
||||
@ -342,7 +337,7 @@ internal class DlgContextMenu(
|
||||
btnBlock.setImageDrawable(
|
||||
createColoredDrawable(
|
||||
activity,
|
||||
R.drawable.ic_block_dark,
|
||||
R.drawable.ic_block,
|
||||
getAttributeColor(
|
||||
activity,
|
||||
when(relation.blocking) {
|
||||
|
@ -19,6 +19,7 @@ import android.widget.*
|
||||
import com.google.android.flexbox.FlexWrap
|
||||
import com.google.android.flexbox.FlexboxLayout
|
||||
import com.google.android.flexbox.JustifyContent
|
||||
import jp.juggler.subwaytooter.Styler.defaultColorIcon
|
||||
import jp.juggler.subwaytooter.action.*
|
||||
import jp.juggler.subwaytooter.api.*
|
||||
import jp.juggler.subwaytooter.api.entity.*
|
||||
@ -33,7 +34,6 @@ import jp.juggler.util.*
|
||||
import org.jetbrains.anko.*
|
||||
import org.json.JSONObject
|
||||
import kotlin.math.max
|
||||
import kotlin.math.min
|
||||
|
||||
internal class ItemViewHolder(
|
||||
val activity : ActMain
|
||||
@ -266,7 +266,7 @@ internal class ItemViewHolder(
|
||||
ivFollow.layoutParams.width = s
|
||||
ivBoosted.layoutParams.width = s
|
||||
|
||||
s = ActMain.replyIconSize + (activity.density*8).toInt()
|
||||
s = ActMain.replyIconSize + (activity.density * 8).toInt()
|
||||
ivReply.layoutParams.width = s
|
||||
ivReply.layoutParams.height = s
|
||||
|
||||
@ -459,7 +459,7 @@ internal class ItemViewHolder(
|
||||
item.hasAnyContent() -> {
|
||||
// 引用Renote
|
||||
showReply(
|
||||
R.attr.btn_boost,
|
||||
R.drawable.ic_repeat,
|
||||
R.string.renote_to,
|
||||
reblog
|
||||
)
|
||||
@ -471,7 +471,7 @@ internal class ItemViewHolder(
|
||||
showBoost(
|
||||
item.accountRef,
|
||||
item.time_created_at,
|
||||
R.attr.btn_boost,
|
||||
R.drawable.ic_repeat,
|
||||
R.string.display_name_boosted_by
|
||||
)
|
||||
showStatusOrReply(item.reblog)
|
||||
@ -500,9 +500,10 @@ internal class ItemViewHolder(
|
||||
showConversationIcons(item)
|
||||
}
|
||||
|
||||
is TootScheduled ->{
|
||||
is TootScheduled -> {
|
||||
showScheduled(item)
|
||||
}
|
||||
|
||||
else -> {
|
||||
}
|
||||
}
|
||||
@ -518,9 +519,9 @@ internal class ItemViewHolder(
|
||||
|
||||
showStatusTimeScheduled(activity, tvTime, item)
|
||||
|
||||
val who = access_info.loginAccount!!
|
||||
val who = access_info.loginAccount !!
|
||||
val whoRef = TootAccountRef(TootParser(activity, access_info), who)
|
||||
this.status_account =whoRef
|
||||
this.status_account = whoRef
|
||||
|
||||
setAcct(tvAcct, access_info.getFullAcct(who), who.acct)
|
||||
|
||||
@ -533,26 +534,23 @@ internal class ItemViewHolder(
|
||||
access_info.supplyBaseUrl(who.avatar)
|
||||
)
|
||||
|
||||
val content = SpannableString(item.text?:"")
|
||||
val content = SpannableString(item.text ?: "")
|
||||
|
||||
tvMentions.visibility = View.GONE
|
||||
|
||||
tvContent.text = content
|
||||
content_invalidator.register(content)
|
||||
|
||||
tvContent.minLines = -1
|
||||
tvContent.minLines = - 1
|
||||
|
||||
|
||||
|
||||
|
||||
val decoded_spoiler_text = SpannableString(item.spoiler_text?:"")
|
||||
val decoded_spoiler_text = SpannableString(item.spoiler_text ?: "")
|
||||
when {
|
||||
decoded_spoiler_text.isNotEmpty() -> {
|
||||
// 元データに含まれるContent Warning を使う
|
||||
llContentWarning.visibility = View.VISIBLE
|
||||
tvContentWarning.text = decoded_spoiler_text
|
||||
spoiler_invalidator.register(decoded_spoiler_text)
|
||||
val cw_shown = ContentWarning.isShown(item.uri,false)
|
||||
val cw_shown = ContentWarning.isShown(item.uri, false)
|
||||
showContent(cw_shown)
|
||||
}
|
||||
|
||||
@ -564,7 +562,7 @@ internal class ItemViewHolder(
|
||||
}
|
||||
|
||||
val media_attachments = item.media_attachments
|
||||
if(media_attachments?.isEmpty() != false ) {
|
||||
if(media_attachments?.isEmpty() != false) {
|
||||
flMedia.visibility = View.GONE
|
||||
llMedia.visibility = View.GONE
|
||||
btnShowMedia.visibility = View.GONE
|
||||
@ -577,7 +575,7 @@ internal class ItemViewHolder(
|
||||
access_info.dont_hide_nsfw -> true
|
||||
else -> ! item.sensitive
|
||||
}
|
||||
val is_shown = MediaShown.isShown(item.uri, default_shown)
|
||||
val is_shown = MediaShown.isShown(item.uri, default_shown)
|
||||
|
||||
btnShowMedia.visibility = if(! is_shown) View.VISIBLE else View.GONE
|
||||
llMedia.visibility = if(! is_shown) View.GONE else View.VISIBLE
|
||||
@ -591,10 +589,10 @@ internal class ItemViewHolder(
|
||||
tvMediaDescription.text = sb
|
||||
}
|
||||
|
||||
setIconAttr(
|
||||
setIconDrawableId(
|
||||
activity,
|
||||
btnHideMedia,
|
||||
R.attr.btn_close,
|
||||
R.drawable.ic_close,
|
||||
color = content_color,
|
||||
alphaMultiplier = Styler.boost_alpha
|
||||
)
|
||||
@ -603,16 +601,17 @@ internal class ItemViewHolder(
|
||||
buttons_for_status?.hide()
|
||||
|
||||
tvApplication.visibility = View.GONE
|
||||
|
||||
}catch(ex:Throwable){
|
||||
|
||||
} catch(ex : Throwable) {
|
||||
|
||||
}
|
||||
llSearchTag.visibility = View.VISIBLE
|
||||
btnSearchTag.text = activity.getString(R.string.scheduled_status) + " "+ TootStatus.formatTime(
|
||||
activity,
|
||||
item.timeScheduledAt,
|
||||
true
|
||||
)
|
||||
btnSearchTag.text = activity.getString(R.string.scheduled_status) + " " +
|
||||
TootStatus.formatTime(
|
||||
activity,
|
||||
item.timeScheduledAt,
|
||||
true
|
||||
)
|
||||
}
|
||||
|
||||
private fun removeExtraView() {
|
||||
@ -705,14 +704,14 @@ internal class ItemViewHolder(
|
||||
when {
|
||||
reply != null ->
|
||||
showReply(
|
||||
R.attr.btn_reply,
|
||||
R.drawable.ic_reply,
|
||||
R.string.reply_to,
|
||||
reply
|
||||
)
|
||||
|
||||
in_reply_to_id != null && in_reply_to_account_id != null -> {
|
||||
showReply(
|
||||
R.attr.btn_reply,
|
||||
R.drawable.ic_reply,
|
||||
in_reply_to_account_id,
|
||||
item
|
||||
)
|
||||
@ -755,7 +754,7 @@ internal class ItemViewHolder(
|
||||
else -> {
|
||||
// 引用Renote
|
||||
showReply(
|
||||
R.attr.btn_boost,
|
||||
R.drawable.ic_repeat,
|
||||
R.string.renote_to,
|
||||
reblog
|
||||
)
|
||||
@ -770,7 +769,7 @@ internal class ItemViewHolder(
|
||||
if(n_account != null) showBoost(
|
||||
n_accountRef,
|
||||
n.time_created_at,
|
||||
if(access_info.isNicoru(n_account)) R.attr.ic_nicoru else R.attr.btn_favourite,
|
||||
if(access_info.isNicoru(n_account)) R.drawable.ic_nicoru else R.drawable.ic_star,
|
||||
R.string.display_name_favourited_by
|
||||
)
|
||||
if(n_status != null) {
|
||||
@ -782,7 +781,7 @@ internal class ItemViewHolder(
|
||||
if(n_account != null) showBoost(
|
||||
n_accountRef,
|
||||
n.time_created_at,
|
||||
R.attr.btn_boost,
|
||||
R.drawable.ic_repeat,
|
||||
R.string.display_name_boosted_by
|
||||
)
|
||||
if(n_status != null) {
|
||||
@ -796,7 +795,7 @@ internal class ItemViewHolder(
|
||||
if(n_account != null) showBoost(
|
||||
n_accountRef,
|
||||
n.time_created_at,
|
||||
R.attr.btn_boost,
|
||||
R.drawable.ic_repeat,
|
||||
R.string.display_name_boosted_by
|
||||
)
|
||||
if(n_status != null) {
|
||||
@ -809,7 +808,7 @@ internal class ItemViewHolder(
|
||||
showBoost(
|
||||
n_accountRef,
|
||||
n.time_created_at,
|
||||
R.attr.ic_follow_plus,
|
||||
R.drawable.ic_follow_plus,
|
||||
R.string.display_name_followed_by
|
||||
)
|
||||
showAccount(n_accountRef)
|
||||
@ -821,7 +820,7 @@ internal class ItemViewHolder(
|
||||
showBoost(
|
||||
n_accountRef,
|
||||
n.time_created_at,
|
||||
R.attr.ic_follow_cross,
|
||||
R.drawable.ic_follow_cross,
|
||||
R.string.display_name_unfollowed_by
|
||||
)
|
||||
showAccount(n_accountRef)
|
||||
@ -842,7 +841,7 @@ internal class ItemViewHolder(
|
||||
showBoost(
|
||||
n_accountRef,
|
||||
n.time_created_at,
|
||||
R.attr.btn_reply,
|
||||
R.drawable.ic_reply,
|
||||
R.string.display_name_mentioned_by
|
||||
)
|
||||
}
|
||||
@ -858,7 +857,7 @@ internal class ItemViewHolder(
|
||||
if(n_account != null) showBoost(
|
||||
n_accountRef,
|
||||
n.time_created_at,
|
||||
R.attr.ic_question, // not used
|
||||
R.drawable.ic_question, // not used
|
||||
R.string.display_name_reaction_by
|
||||
, reactionDrawableId = reaction?.btnDrawableId
|
||||
)
|
||||
@ -871,7 +870,7 @@ internal class ItemViewHolder(
|
||||
if(n_account != null) showBoost(
|
||||
n_accountRef,
|
||||
n.time_created_at,
|
||||
R.attr.btn_boost,
|
||||
R.drawable.ic_repeat,
|
||||
R.string.display_name_quoted_by
|
||||
)
|
||||
if(n_status != null) {
|
||||
@ -883,7 +882,7 @@ internal class ItemViewHolder(
|
||||
if(n_account != null) showBoost(
|
||||
n_accountRef,
|
||||
n.time_created_at,
|
||||
R.attr.ic_vote,
|
||||
R.drawable.ic_vote,
|
||||
R.string.display_name_voted_by
|
||||
)
|
||||
if(n_status != null) {
|
||||
@ -895,7 +894,7 @@ internal class ItemViewHolder(
|
||||
if(n_account != null) showBoost(
|
||||
n_accountRef,
|
||||
n.time_created_at,
|
||||
R.attr.ic_follow_wait,
|
||||
R.drawable.ic_follow_wait,
|
||||
R.string.display_name_follow_request_by
|
||||
)
|
||||
boostedAction = {
|
||||
@ -911,7 +910,7 @@ internal class ItemViewHolder(
|
||||
if(n_account != null) showBoost(
|
||||
n_accountRef,
|
||||
n.time_created_at,
|
||||
R.attr.ic_question,
|
||||
R.drawable.ic_question,
|
||||
R.string.unknown_notification_from
|
||||
)
|
||||
if(n_status != null) {
|
||||
@ -973,15 +972,15 @@ internal class ItemViewHolder(
|
||||
}
|
||||
|
||||
private fun showReply(
|
||||
iconAttrId : Int,
|
||||
iconId : Int,
|
||||
text : Spannable
|
||||
) {
|
||||
llReply.visibility = View.VISIBLE
|
||||
|
||||
setIconAttr(
|
||||
setIconDrawableId(
|
||||
activity,
|
||||
ivReply,
|
||||
iconAttrId,
|
||||
iconId,
|
||||
color = content_color,
|
||||
alphaMultiplier = Styler.boost_alpha
|
||||
)
|
||||
@ -991,7 +990,7 @@ internal class ItemViewHolder(
|
||||
}
|
||||
|
||||
private fun showReply(
|
||||
iconAttrId : Int,
|
||||
iconId : Int,
|
||||
stringId : Int,
|
||||
reply : TootStatus
|
||||
) {
|
||||
@ -1002,11 +1001,11 @@ internal class ItemViewHolder(
|
||||
// setAcct(tvReplyAcct, access_info.getFullAcct(who), who.acct)
|
||||
|
||||
val text = reply.accountRef.decoded_display_name.intoStringResource(activity, stringId)
|
||||
showReply(iconAttrId, text)
|
||||
showReply(iconId, text)
|
||||
}
|
||||
|
||||
private fun showReply(
|
||||
iconAttrId : Int,
|
||||
iconId : Int,
|
||||
accountId : EntityId,
|
||||
replyStatus : TootStatus
|
||||
) {
|
||||
@ -1029,13 +1028,13 @@ internal class ItemViewHolder(
|
||||
// showStatusTime(activity, tvReplyTime, who, time = reply.time_created_at)
|
||||
// setAcct(tvReplyAcct, access_info.getFullAcct(who), who.acct)
|
||||
|
||||
showReply(iconAttrId, text)
|
||||
showReply(iconId, text)
|
||||
}
|
||||
|
||||
private fun showBoost(
|
||||
whoRef : TootAccountRef,
|
||||
time : Long,
|
||||
icon_attr_id : Int,
|
||||
iconId : Int,
|
||||
string_id : Int,
|
||||
reactionDrawableId : Int? = null
|
||||
) {
|
||||
@ -1053,10 +1052,10 @@ internal class ItemViewHolder(
|
||||
if(reactionDrawableId != null) {
|
||||
setIconDrawableId(activity, ivBoosted, reactionDrawableId)
|
||||
} else {
|
||||
setIconAttr(
|
||||
setIconDrawableId(
|
||||
activity,
|
||||
ivBoosted,
|
||||
icon_attr_id,
|
||||
iconId,
|
||||
color = content_color,
|
||||
alphaMultiplier = Styler.boost_alpha
|
||||
)
|
||||
@ -1271,10 +1270,10 @@ internal class ItemViewHolder(
|
||||
tvMediaDescription.text = sb
|
||||
}
|
||||
|
||||
setIconAttr(
|
||||
setIconDrawableId(
|
||||
activity,
|
||||
btnHideMedia,
|
||||
R.attr.btn_close,
|
||||
R.drawable.ic_close,
|
||||
color = content_color,
|
||||
alphaMultiplier = Styler.boost_alpha
|
||||
)
|
||||
@ -1408,13 +1407,13 @@ internal class ItemViewHolder(
|
||||
}
|
||||
|
||||
// visibility
|
||||
val visIconAttrId =
|
||||
Styler.getVisibilityIconAttr(access_info.isMisskey, status.visibility)
|
||||
if(R.attr.ic_public != visIconAttrId) {
|
||||
val visIconId =
|
||||
Styler.getVisibilityIconId(access_info.isMisskey, status.visibility)
|
||||
if(R.drawable.ic_public != visIconId) {
|
||||
if(sb.isNotEmpty()) sb.append('\u200B')
|
||||
sb.appendColorShadeIcon(
|
||||
activity,
|
||||
getAttributeResourceId(activity, visIconAttrId),
|
||||
visIconId,
|
||||
Styler.getVisibilityString(
|
||||
activity,
|
||||
access_info.isMisskey,
|
||||
@ -1486,28 +1485,28 @@ internal class ItemViewHolder(
|
||||
) {
|
||||
val sb = SpannableStringBuilder()
|
||||
|
||||
// NSFWマーク
|
||||
if(item.hasMedia() && item.sensitive) {
|
||||
if(sb.isNotEmpty()) sb.append('\u200B')
|
||||
sb.appendColorShadeIcon(activity, R.drawable.ic_eye_off, "NSFW")
|
||||
}
|
||||
|
||||
// visibility
|
||||
val visIconAttrId =
|
||||
Styler.getVisibilityIconAttr(access_info.isMisskey, item.visibility )
|
||||
if(R.attr.ic_public != visIconAttrId) {
|
||||
if(sb.isNotEmpty()) sb.append('\u200B')
|
||||
sb.appendColorShadeIcon(
|
||||
// NSFWマーク
|
||||
if(item.hasMedia() && item.sensitive) {
|
||||
if(sb.isNotEmpty()) sb.append('\u200B')
|
||||
sb.appendColorShadeIcon(activity, R.drawable.ic_eye_off, "NSFW")
|
||||
}
|
||||
|
||||
// visibility
|
||||
val visIconId =
|
||||
Styler.getVisibilityIconId(access_info.isMisskey, item.visibility)
|
||||
if(R.drawable.ic_public != visIconId) {
|
||||
if(sb.isNotEmpty()) sb.append('\u200B')
|
||||
sb.appendColorShadeIcon(
|
||||
activity,
|
||||
visIconId,
|
||||
Styler.getVisibilityString(
|
||||
activity,
|
||||
getAttributeResourceId(activity, visIconAttrId),
|
||||
Styler.getVisibilityString(
|
||||
activity,
|
||||
access_info.isMisskey,
|
||||
item.visibility
|
||||
)
|
||||
access_info.isMisskey,
|
||||
item.visibility
|
||||
)
|
||||
}
|
||||
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
if(sb.isNotEmpty()) sb.append(' ')
|
||||
sb.append(
|
||||
@ -1591,13 +1590,13 @@ internal class ItemViewHolder(
|
||||
when(ta.type) {
|
||||
TootAttachmentLike.TYPE_AUDIO -> {
|
||||
iv.setMediaType(0)
|
||||
iv.setDefaultImageResId(getAttributeResourceId(activity, R.attr.ic_music))
|
||||
iv.setDefaultImage(defaultColorIcon(activity,R.drawable.wide_music))
|
||||
iv.setImageUrl(activity.pref, 0f, null)
|
||||
}
|
||||
|
||||
TootAttachmentLike.TYPE_UNKNOWN -> {
|
||||
iv.setMediaType(0)
|
||||
iv.setDefaultImageResId(getAttributeResourceId(activity, R.attr.ic_question))
|
||||
iv.setDefaultImage(defaultColorIcon(activity,R.drawable.wide_question))
|
||||
iv.setImageUrl(activity.pref, 0f, null)
|
||||
}
|
||||
|
||||
@ -1606,12 +1605,7 @@ internal class ItemViewHolder(
|
||||
when {
|
||||
url?.isEmpty() != false -> {
|
||||
iv.setMediaType(0)
|
||||
iv.setDefaultImageResId(
|
||||
getAttributeResourceId(
|
||||
activity,
|
||||
R.attr.ic_question
|
||||
)
|
||||
)
|
||||
iv.setDefaultImage(defaultColorIcon(activity,R.drawable.wide_question))
|
||||
iv.setImageUrl(activity.pref, 0f, null)
|
||||
}
|
||||
|
||||
@ -1623,7 +1617,7 @@ internal class ItemViewHolder(
|
||||
else -> 0
|
||||
}
|
||||
)
|
||||
iv.setDefaultImageResId(0)
|
||||
iv.setDefaultImage(null)
|
||||
iv.setImageUrl(
|
||||
activity.pref,
|
||||
0f,
|
||||
@ -1666,7 +1660,7 @@ internal class ItemViewHolder(
|
||||
val notification = (item as? TootNotification)
|
||||
boost_account?.let { whoRef ->
|
||||
if(access_info.isPseudo) {
|
||||
DlgContextMenu(activity, column, whoRef, null, notification,tvContent).show()
|
||||
DlgContextMenu(activity, column, whoRef, null, notification, tvContent).show()
|
||||
} else {
|
||||
Action_User.profileLocal(activity, pos, access_info, whoRef.get())
|
||||
}
|
||||
@ -1687,21 +1681,21 @@ internal class ItemViewHolder(
|
||||
btnShowMedia.visibility = View.VISIBLE
|
||||
llMedia.visibility = View.GONE
|
||||
}
|
||||
(item as? TootScheduled)?.let{ item ->
|
||||
if( item is TootScheduled){
|
||||
MediaShown.save(item.uri, false)
|
||||
btnShowMedia.visibility = View.VISIBLE
|
||||
llMedia.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
|
||||
btnShowMedia ->{
|
||||
btnShowMedia -> {
|
||||
|
||||
status_showing?.let { status ->
|
||||
MediaShown.save(status, true)
|
||||
btnShowMedia.visibility = View.GONE
|
||||
llMedia.visibility = View.VISIBLE
|
||||
}
|
||||
(item as? TootScheduled)?.let{ item ->
|
||||
if( item is TootScheduled){
|
||||
MediaShown.save(item.uri, true)
|
||||
btnShowMedia.visibility = View.GONE
|
||||
llMedia.visibility = View.VISIBLE
|
||||
@ -1713,7 +1707,7 @@ internal class ItemViewHolder(
|
||||
ivMedia3 -> clickMedia(2)
|
||||
ivMedia4 -> clickMedia(3)
|
||||
|
||||
btnContentWarning ->{
|
||||
btnContentWarning -> {
|
||||
status_showing?.let { status ->
|
||||
val new_shown = llContents.visibility == View.GONE
|
||||
ContentWarning.save(status, new_shown)
|
||||
@ -1722,7 +1716,7 @@ internal class ItemViewHolder(
|
||||
list_adapter.notifyChange(reason = "ContentWarning onClick", reset = true)
|
||||
|
||||
}
|
||||
(item as? TootScheduled)?.let{ item ->
|
||||
if(item is TootScheduled){
|
||||
val new_shown = llContents.visibility == View.GONE
|
||||
ContentWarning.save(item.uri, new_shown)
|
||||
|
||||
@ -1769,14 +1763,14 @@ internal class ItemViewHolder(
|
||||
|
||||
llFollow -> follow_account?.let { whoRef ->
|
||||
if(access_info.isPseudo) {
|
||||
DlgContextMenu(activity, column, whoRef, null, notification,tvContent).show()
|
||||
DlgContextMenu(activity, column, whoRef, null, notification, tvContent).show()
|
||||
} else {
|
||||
Action_User.profileLocal(activity, pos, access_info, whoRef.get())
|
||||
}
|
||||
}
|
||||
|
||||
btnFollow -> follow_account?.let { who ->
|
||||
DlgContextMenu(activity, column, who, null, notification,tvContent).show()
|
||||
DlgContextMenu(activity, column, who, null, notification, tvContent).show()
|
||||
}
|
||||
|
||||
btnSearchTag, llTrendTag -> when(item) {
|
||||
@ -1810,16 +1804,16 @@ internal class ItemViewHolder(
|
||||
)
|
||||
}
|
||||
|
||||
is TootScheduled ->{
|
||||
is TootScheduled -> {
|
||||
ActionsDialog()
|
||||
.addAction(activity.getString(R.string.delete)){
|
||||
Action_Toot.deleteScheduledPost(activity,access_info,item){
|
||||
.addAction(activity.getString(R.string.delete)) {
|
||||
Action_Toot.deleteScheduledPost(activity, access_info, item) {
|
||||
column.onScheduleDeleted(item)
|
||||
showToast(activity,false,R.string.scheduled_post_deleted)
|
||||
showToast(activity, false, R.string.scheduled_post_deleted)
|
||||
}
|
||||
}
|
||||
.addAction(activity.getString(R.string.edit)){
|
||||
Action_Toot.editScheduledPost(activity,access_info,item)
|
||||
.addAction(activity.getString(R.string.edit)) {
|
||||
Action_Toot.editScheduledPost(activity, access_info, item)
|
||||
}
|
||||
.show(activity)
|
||||
}
|
||||
@ -2035,7 +2029,9 @@ internal class ItemViewHolder(
|
||||
|
||||
private fun clickMedia(i : Int) {
|
||||
try {
|
||||
val media_attachments = status_showing?.media_attachments ?: (item as? TootScheduled)?.media_attachments ?: return
|
||||
val media_attachments =
|
||||
status_showing?.media_attachments ?: (item as? TootScheduled)?.media_attachments
|
||||
?: return
|
||||
val item = if(i < media_attachments.size) media_attachments[i] else return
|
||||
when(item) {
|
||||
is TootAttachmentMSP -> {
|
||||
@ -2770,7 +2766,7 @@ internal class ItemViewHolder(
|
||||
ivReply = imageView {
|
||||
scaleType = ImageView.ScaleType.FIT_END
|
||||
importantForAccessibility = View.IMPORTANT_FOR_ACCESSIBILITY_NO
|
||||
padding=dip(4)
|
||||
padding = dip(4)
|
||||
}.lparams(dip(32), dip(32)) {
|
||||
endMargin = dip(4)
|
||||
}
|
||||
@ -2848,11 +2844,7 @@ internal class ItemViewHolder(
|
||||
R.drawable.btn_bg_transparent
|
||||
)
|
||||
contentDescription = "@string/hide"
|
||||
imageResource =
|
||||
getAttributeResourceId(
|
||||
context,
|
||||
R.attr.btn_close
|
||||
)
|
||||
imageResource = R.drawable.ic_close
|
||||
}.lparams(dip(32), dip(32)) {
|
||||
gravity = Gravity.END
|
||||
}
|
||||
@ -3005,11 +2997,7 @@ internal class ItemViewHolder(
|
||||
R.drawable.btn_bg_transparent
|
||||
)
|
||||
contentDescription = "@string/hide"
|
||||
imageResource =
|
||||
getAttributeResourceId(
|
||||
context,
|
||||
R.attr.btn_close
|
||||
)
|
||||
imageResource = R.drawable.ic_close
|
||||
}.lparams(dip(32), matchParent) {
|
||||
startMargin = dip(8)
|
||||
}
|
||||
@ -3023,11 +3011,10 @@ internal class ItemViewHolder(
|
||||
)
|
||||
gravity = Gravity.CENTER
|
||||
text = context.getString(R.string.tap_to_show)
|
||||
textColor =
|
||||
getAttributeColor(
|
||||
context,
|
||||
R.attr.colorShowMediaText
|
||||
)
|
||||
textColor = getAttributeColor(
|
||||
context,
|
||||
R.attr.colorShowMediaText
|
||||
)
|
||||
|
||||
}.lparams(matchParent, matchParent)
|
||||
}
|
||||
@ -3188,7 +3175,7 @@ internal class ItemViewHolder(
|
||||
|
||||
background =
|
||||
ContextCompat.getDrawable(context, R.drawable.btn_bg_transparent)
|
||||
imageResource = getAttributeResourceId(context, R.attr.btn_more)
|
||||
imageResource = R.drawable.ic_more
|
||||
contentDescription = context.getString(R.string.more)
|
||||
}.lparams(dip(40), dip(40)) {
|
||||
startMargin = dip(4)
|
||||
@ -3209,7 +3196,7 @@ internal class ItemViewHolder(
|
||||
background =
|
||||
ContextCompat.getDrawable(context, R.drawable.btn_bg_transparent)
|
||||
contentDescription = context.getString(R.string.follow_accept)
|
||||
imageResource = getAttributeResourceId(context, R.attr.ic_check)
|
||||
imageResource = R.drawable.ic_check
|
||||
setPadding(0, 0, 0, 0)
|
||||
}.lparams(dip(48f), dip(32f))
|
||||
|
||||
@ -3217,7 +3204,7 @@ internal class ItemViewHolder(
|
||||
background =
|
||||
ContextCompat.getDrawable(context, R.drawable.btn_bg_transparent)
|
||||
contentDescription = context.getString(R.string.follow_deny)
|
||||
imageResource = getAttributeResourceId(context, R.attr.btn_close)
|
||||
imageResource = R.drawable.ic_close
|
||||
setPadding(0, 0, 0, 0)
|
||||
}.lparams(dip(48f), dip(32f)) {
|
||||
startMargin = dip(4)
|
||||
|
@ -421,11 +421,11 @@ object Pref {
|
||||
val spAutoCWLines = StringPref("auto_cw_lines", "0")
|
||||
val spCardDescriptionLength = StringPref("CardDescriptionLength", "64")
|
||||
val spAvatarIconSize = StringPref("avatar_icon_size", "48")
|
||||
val spNotificationTlIconSize = StringPref("notification_tl_icon_size", "32")
|
||||
val spNotificationTlIconSize = StringPref("notification_tl_icon_size", "24")
|
||||
val spBoostButtonSize = StringPref("BoostButtonSize", "35")
|
||||
val spReplyIconSize = StringPref("ReplyIconSize", "24")
|
||||
val spHeaderIconSize = StringPref("HeaderIconSize", "32")
|
||||
val spStripIconSize = StringPref("StripIconSize", "32")
|
||||
val spHeaderIconSize = StringPref("HeaderIconSize", "24")
|
||||
val spStripIconSize = StringPref("StripIconSize", "24")
|
||||
val spMediaSizeMax = StringPref("max_media_size", "8")
|
||||
val spMovieSizeMax = StringPref("max_movie_size", "40")
|
||||
val spTimelineFont = StringPref("timeline_font", "", skipImport = true)
|
||||
|
@ -75,7 +75,6 @@ internal class StatusButtons(
|
||||
btnReply.setOnLongClickListener(this)
|
||||
}
|
||||
|
||||
|
||||
fun hide() {
|
||||
holder.viewRoot.visibility = View.GONE
|
||||
}
|
||||
@ -86,8 +85,8 @@ internal class StatusButtons(
|
||||
this.notification = notification
|
||||
|
||||
val fav_icon_drawable = when {
|
||||
access_info.isNicoru(status.account) -> R.drawable.ic_nicoru_dark
|
||||
else -> R.drawable.btn_favourite_dark
|
||||
access_info.isNicoru(status.account) -> R.drawable.ic_nicoru
|
||||
else -> R.drawable.ic_star
|
||||
}
|
||||
|
||||
val replies_count = status.replies_count
|
||||
@ -95,35 +94,35 @@ internal class StatusButtons(
|
||||
setIconDrawableId(
|
||||
activity,
|
||||
btnConversation,
|
||||
R.drawable.ic_conversation_dark,
|
||||
R.drawable.ic_forum,
|
||||
color = color_normal,
|
||||
alphaMultiplier = Styler.boost_alpha
|
||||
)
|
||||
setIconDrawableId(
|
||||
activity,
|
||||
btnMore,
|
||||
R.drawable.btn_more_dark,
|
||||
R.drawable.ic_more,
|
||||
color = color_normal,
|
||||
alphaMultiplier = Styler.boost_alpha
|
||||
)
|
||||
|
||||
// val a = (((color_normal ushr 24)/255f) * 0.7f)
|
||||
|
||||
// val a = (((color_normal ushr 24)/255f) * 0.7f)
|
||||
|
||||
// setIconDrawableId で色を指定するとアルファ値も反映されるらしい
|
||||
// btnConversation.alpha = a
|
||||
// btnMore.alpha = a
|
||||
//
|
||||
// btnReply.alpha = a
|
||||
// btnBoost.alpha = a
|
||||
// btnFavourite.alpha = a
|
||||
// btnFollow2.alpha = a
|
||||
// ivFollowedBy2.alpha = a
|
||||
// btnConversation.alpha = a
|
||||
// btnMore.alpha = a
|
||||
//
|
||||
// btnReply.alpha = a
|
||||
// btnBoost.alpha = a
|
||||
// btnFavourite.alpha = a
|
||||
// btnFollow2.alpha = a
|
||||
// ivFollowedBy2.alpha = a
|
||||
|
||||
setButton(
|
||||
btnReply,
|
||||
true,
|
||||
color_normal,
|
||||
R.drawable.btn_reply_dark,
|
||||
R.drawable.ic_reply,
|
||||
when(replies_count) {
|
||||
null -> ""
|
||||
else -> when(Pref.ipRepliesCount(activity.pref)) {
|
||||
@ -146,7 +145,7 @@ internal class StatusButtons(
|
||||
btnBoost,
|
||||
false,
|
||||
color_accent,
|
||||
R.drawable.ic_mail_dark,
|
||||
R.drawable.ic_repeat,
|
||||
"",
|
||||
activity.getString(R.string.boost)
|
||||
)
|
||||
@ -155,7 +154,7 @@ internal class StatusButtons(
|
||||
btnBoost,
|
||||
false,
|
||||
color_normal,
|
||||
R.drawable.btn_refresh_dark,
|
||||
R.drawable.ic_refresh,
|
||||
"?",
|
||||
activity.getString(R.string.boost)
|
||||
)
|
||||
@ -164,7 +163,7 @@ internal class StatusButtons(
|
||||
btnBoost,
|
||||
true,
|
||||
if(status.reblogged) color_accent else color_normal,
|
||||
R.drawable.btn_boost_dark,
|
||||
R.drawable.ic_repeat,
|
||||
status.reblogs_count?.toString() ?: "",
|
||||
activity.getString(R.string.boost)
|
||||
)
|
||||
@ -175,7 +174,7 @@ internal class StatusButtons(
|
||||
btnFavourite,
|
||||
false,
|
||||
color_normal,
|
||||
R.drawable.btn_refresh_dark,
|
||||
R.drawable.ic_refresh,
|
||||
"?",
|
||||
activity.getString(R.string.favourite)
|
||||
)
|
||||
@ -220,7 +219,8 @@ internal class StatusButtons(
|
||||
count : String,
|
||||
contentDescription : String
|
||||
) {
|
||||
val d = createColoredDrawable(activity,drawableId,color,alphaMultiplier = Styler.boost_alpha)
|
||||
val d =
|
||||
createColoredDrawable(activity, drawableId, color, alphaMultiplier = Styler.boost_alpha)
|
||||
b.setImageDrawable(d)
|
||||
b.setPaddingAndText(holder.paddingH, holder.paddingV, count, 14f, holder.compoundPaddingDp)
|
||||
b.setTextColor(color.applyAlphaMultiplier(Styler.boost_alpha))
|
||||
@ -418,7 +418,6 @@ internal class StatusButtons(
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
open class _FlexboxLayout(ctx : Context) : FlexboxLayout(ctx) {
|
||||
@ -481,8 +480,7 @@ class StatusButtonsViewHolder(
|
||||
|
||||
setPadding(paddingH, paddingV, paddingH, paddingV)
|
||||
scaleType = ImageView.ScaleType.FIT_CENTER
|
||||
imageResource =
|
||||
getAttributeResourceId(context, R.attr.ic_conversation)
|
||||
imageResource = R.drawable.ic_forum
|
||||
}.lparams(buttonHeight, buttonHeight)
|
||||
|
||||
btnReply = customView<CountImageButton> {
|
||||
@ -560,8 +558,7 @@ class StatusButtonsViewHolder(
|
||||
scaleType = ImageView.ScaleType.FIT_CENTER
|
||||
|
||||
contentDescription = context.getString(R.string.more)
|
||||
imageResource =
|
||||
getAttributeResourceId(context, R.attr.btn_more)
|
||||
imageResource = R.drawable.ic_more
|
||||
}.lparams(buttonHeight, buttonHeight) {
|
||||
startMargin = marginBetween
|
||||
}
|
||||
|
@ -1,10 +1,9 @@
|
||||
package jp.juggler.subwaytooter
|
||||
|
||||
import android.content.Context
|
||||
import android.content.res.ColorStateList
|
||||
import android.graphics.drawable.*
|
||||
import android.graphics.drawable.shapes.RectShape
|
||||
import android.os.Build
|
||||
import android.graphics.PorterDuff
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.support.v4.content.ContextCompat
|
||||
import android.text.SpannableStringBuilder
|
||||
import android.text.Spanned
|
||||
import android.view.View
|
||||
@ -19,7 +18,13 @@ import jp.juggler.util.*
|
||||
|
||||
object Styler {
|
||||
|
||||
fun getVisibilityIconAttr(isMisskeyData : Boolean, visibility : TootVisibility) : Int {
|
||||
fun defaultColorIcon(context : Context, iconId : Int) : Drawable? =
|
||||
ContextCompat.getDrawable(context, iconId)?.also {
|
||||
it.setTint(getAttributeColor(context, R.attr.colorVectorDrawable))
|
||||
it.setTintMode(PorterDuff.Mode.SRC_IN)
|
||||
}
|
||||
|
||||
fun getVisibilityIconId(isMisskeyData : Boolean, visibility : TootVisibility) : Int {
|
||||
val isMisskey = when(Pref.ipVisibilityStyle(App1.pref)) {
|
||||
Pref.VS_MASTODON -> false
|
||||
Pref.VS_MISSKEY -> true
|
||||
@ -27,42 +32,34 @@ object Styler {
|
||||
}
|
||||
return when {
|
||||
isMisskey -> when(visibility) {
|
||||
TootVisibility.Public -> R.attr.ic_public
|
||||
TootVisibility.UnlistedHome -> R.attr.btn_home
|
||||
TootVisibility.PrivateFollowers -> R.attr.ic_lock_open
|
||||
TootVisibility.DirectSpecified -> R.attr.ic_mail
|
||||
TootVisibility.DirectPrivate -> R.attr.ic_lock
|
||||
TootVisibility.WebSetting -> R.attr.ic_question
|
||||
TootVisibility.Public -> R.drawable.ic_public
|
||||
TootVisibility.UnlistedHome -> R.drawable.ic_home
|
||||
TootVisibility.PrivateFollowers -> R.drawable.ic_lock_open
|
||||
TootVisibility.DirectSpecified -> R.drawable.ic_mail
|
||||
TootVisibility.DirectPrivate -> R.drawable.ic_lock
|
||||
TootVisibility.WebSetting -> R.drawable.ic_question
|
||||
|
||||
TootVisibility.LocalPublic -> R.attr.ic_local_ltl
|
||||
TootVisibility.LocalHome -> R.attr.ic_local_home
|
||||
TootVisibility.LocalFollowers -> R.attr.ic_local_lock_open
|
||||
TootVisibility.LocalPublic -> R.drawable.ic_local_ltl
|
||||
TootVisibility.LocalHome -> R.drawable.ic_local_home
|
||||
TootVisibility.LocalFollowers -> R.drawable.ic_local_lock_open
|
||||
|
||||
}
|
||||
else -> when(visibility) {
|
||||
TootVisibility.Public -> R.attr.ic_public
|
||||
TootVisibility.UnlistedHome -> R.attr.ic_lock_open
|
||||
TootVisibility.PrivateFollowers -> R.attr.ic_lock
|
||||
TootVisibility.DirectSpecified -> R.attr.ic_mail
|
||||
TootVisibility.DirectPrivate -> R.attr.ic_mail
|
||||
TootVisibility.WebSetting -> R.attr.ic_question
|
||||
TootVisibility.Public -> R.drawable.ic_public
|
||||
TootVisibility.UnlistedHome -> R.drawable.ic_lock_open
|
||||
TootVisibility.PrivateFollowers -> R.drawable.ic_lock
|
||||
TootVisibility.DirectSpecified -> R.drawable.ic_mail
|
||||
TootVisibility.DirectPrivate -> R.drawable.ic_mail
|
||||
TootVisibility.WebSetting -> R.drawable.ic_question
|
||||
|
||||
TootVisibility.LocalPublic -> R.attr.ic_local_ltl
|
||||
TootVisibility.LocalHome -> R.attr.ic_local_lock_open
|
||||
TootVisibility.LocalFollowers -> R.attr.ic_local_lock
|
||||
TootVisibility.LocalPublic -> R.drawable.ic_local_ltl
|
||||
TootVisibility.LocalHome -> R.drawable.ic_local_lock_open
|
||||
TootVisibility.LocalFollowers -> R.drawable.ic_local_lock
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun getVisibilityIcon(
|
||||
context : Context,
|
||||
isMisskeyData : Boolean,
|
||||
visibility : TootVisibility
|
||||
) : Int {
|
||||
return getAttributeResourceId(context, getVisibilityIconAttr(isMisskeyData, visibility))
|
||||
}
|
||||
|
||||
fun getVisibilityString(
|
||||
context : Context,
|
||||
isMisskeyData : Boolean,
|
||||
@ -110,16 +107,26 @@ object Styler {
|
||||
visibility : TootVisibility
|
||||
) : CharSequence {
|
||||
|
||||
val icon_id = getVisibilityIcon(context, isMisskeyData, visibility)
|
||||
val icon_id = getVisibilityIconId(isMisskeyData, visibility)
|
||||
val sv = getVisibilityString(context, isMisskeyData, visibility)
|
||||
|
||||
val color = getAttributeColor(context, R.attr.colorVectorDrawable)
|
||||
val sb = SpannableStringBuilder()
|
||||
|
||||
// アイコン部分
|
||||
val start = sb.length
|
||||
sb.append(" ")
|
||||
val end = sb.length
|
||||
sb.setSpan(EmojiImageSpan(context, icon_id), start, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
|
||||
sb.setSpan(
|
||||
EmojiImageSpan(
|
||||
context,
|
||||
icon_id,
|
||||
useColorShader = true,
|
||||
color = color
|
||||
),
|
||||
start,
|
||||
end,
|
||||
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE
|
||||
)
|
||||
|
||||
// 文字列部分
|
||||
sb.append(' ')
|
||||
@ -168,10 +175,10 @@ object Styler {
|
||||
|
||||
relation.followed_by -> {
|
||||
ivDot.visibility = View.VISIBLE
|
||||
setIconAttr(
|
||||
setIconDrawableId(
|
||||
context,
|
||||
ivDot,
|
||||
R.attr.ic_followed_by,
|
||||
R.drawable.ic_followed_by,
|
||||
color = colorAccent(),
|
||||
alphaMultiplier = alphaMultiplier
|
||||
)
|
||||
@ -188,46 +195,51 @@ object Styler {
|
||||
// フォローボタン
|
||||
// follow button
|
||||
val color : Int
|
||||
val icon_attr : Int
|
||||
val iconId : Int
|
||||
val contentDescription : String
|
||||
|
||||
when {
|
||||
relation.blocking -> {
|
||||
icon_attr = R.attr.ic_block
|
||||
iconId = R.drawable.ic_block
|
||||
color = defaultColor
|
||||
contentDescription = context.getString(R.string.follow)
|
||||
}
|
||||
|
||||
relation.muting -> {
|
||||
icon_attr = R.attr.ic_mute
|
||||
iconId = R.drawable.ic_volume_off
|
||||
color = defaultColor
|
||||
contentDescription = context.getString(R.string.follow)
|
||||
}
|
||||
|
||||
relation.getFollowing(who) -> {
|
||||
icon_attr = R.attr.ic_follow_cross
|
||||
iconId = R.drawable.ic_follow_cross
|
||||
color = colorAccent()
|
||||
contentDescription = context.getString(R.string.unfollow)
|
||||
}
|
||||
|
||||
relation.getRequested(who) -> {
|
||||
icon_attr = R.attr.ic_follow_wait
|
||||
iconId = R.drawable.ic_follow_wait
|
||||
color = colorError()
|
||||
contentDescription = context.getString(R.string.unfollow)
|
||||
}
|
||||
|
||||
else -> {
|
||||
icon_attr = R.attr.ic_follow_plus
|
||||
iconId = R.drawable.ic_follow_plus
|
||||
color = defaultColor
|
||||
contentDescription = context.getString(R.string.follow)
|
||||
}
|
||||
}
|
||||
|
||||
setIconAttr(context, ibFollow, icon_attr, color = color, alphaMultiplier = alphaMultiplier)
|
||||
setIconDrawableId(
|
||||
context,
|
||||
ibFollow,
|
||||
iconId,
|
||||
color = color,
|
||||
alphaMultiplier = alphaMultiplier
|
||||
)
|
||||
ibFollow.contentDescription = contentDescription
|
||||
}
|
||||
|
||||
|
||||
private fun getHorizontalPadding(v : View, delta_dp : Float) : Int {
|
||||
val form_width_max = 420f
|
||||
val dm = v.resources.displayMetrics
|
||||
|
@ -165,7 +165,7 @@ internal class ViewHolderHeaderProfile(
|
||||
setIconDrawableId(
|
||||
activity,
|
||||
btnMore,
|
||||
R.drawable.btn_more,
|
||||
R.drawable.ic_more,
|
||||
color = contentColor,
|
||||
alphaMultiplier = Styler.boost_alpha
|
||||
)
|
||||
|
@ -146,10 +146,6 @@ class TootApiClient(
|
||||
bodyString : String? = null,
|
||||
jsonErrorParser : (json : JSONObject) -> String? = DEFAULT_JSON_ERROR_PARSER
|
||||
) : String {
|
||||
val url = response.request()?.url()
|
||||
if(url?.toString()?.contains("misskey") == true) {
|
||||
log.d("Misskey response error: url=$url")
|
||||
}
|
||||
val sb = StringBuilder()
|
||||
try {
|
||||
// body は既に読み終わっているか、そうでなければこれから読む
|
||||
@ -171,9 +167,7 @@ class TootApiClient(
|
||||
sb.append("(HTTP ").append(Integer.toString(response.code()))
|
||||
|
||||
val message = response.message()
|
||||
if(message != null && message.isNotEmpty()) {
|
||||
sb.append(' ').append(message)
|
||||
}
|
||||
if(message.isNotEmpty()) sb.append(' ').append(message)
|
||||
sb.append(")")
|
||||
|
||||
if(caption.isNotEmpty()) {
|
||||
@ -308,15 +302,13 @@ class TootApiClient(
|
||||
val response = result.response !!
|
||||
|
||||
val request = response.request()
|
||||
if(request != null) {
|
||||
publishApiProgress(
|
||||
context.getString(
|
||||
R.string.reading_api,
|
||||
request.method(),
|
||||
progressPath ?: result.caption
|
||||
)
|
||||
publishApiProgress(
|
||||
context.getString(
|
||||
R.string.reading_api,
|
||||
request.method(),
|
||||
progressPath ?: result.caption
|
||||
)
|
||||
}
|
||||
)
|
||||
|
||||
val bodyString = response.body()?.string()
|
||||
if(isApiCancelled) return null
|
||||
@ -359,7 +351,6 @@ class TootApiClient(
|
||||
val response = result.response !!
|
||||
|
||||
val request = response.request()
|
||||
if(request != null) {
|
||||
publishApiProgress(
|
||||
context.getString(
|
||||
R.string.reading_api,
|
||||
@ -367,7 +358,6 @@ class TootApiClient(
|
||||
progressPath ?: result.caption
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
val bodyBytes = response.body()?.bytes()
|
||||
if(isApiCancelled) return null
|
||||
@ -479,15 +469,12 @@ class TootApiClient(
|
||||
sb.append("(HTTP ").append(Integer.toString(response.code()))
|
||||
|
||||
val message = response.message()
|
||||
if(message != null && message.isNotEmpty()) {
|
||||
sb.append(' ').append(message)
|
||||
}
|
||||
if(message.isNotEmpty()) sb.append(' ').append(message)
|
||||
|
||||
sb.append(")")
|
||||
|
||||
val url = response.request()?.url()?.toString()
|
||||
if(url?.isNotEmpty() == true) {
|
||||
sb.append(' ').append(url)
|
||||
}
|
||||
val url = response.request().url().toString()
|
||||
if(url.isNotEmpty()) sb.append(' ').append(url)
|
||||
|
||||
result.error = sb.toString()
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ class TootAttachment : TootAttachmentLike {
|
||||
private fun guessMediaTypeByUrl(src : String?) : String? {
|
||||
val uri = src.mayUri() ?: return null
|
||||
|
||||
if( ext_audio.find { uri.path.endsWith(it) } != null ){
|
||||
if( ext_audio.find { uri.path?.endsWith(it) == true } != null ){
|
||||
return TootAttachmentLike.TYPE_AUDIO
|
||||
}
|
||||
|
||||
|
@ -99,7 +99,7 @@ object LoginForm {
|
||||
val dialog = Dialog(activity)
|
||||
dialog.setContentView(view)
|
||||
// 警告がでるが、パラメータ名の指定を削ってはいけない
|
||||
btnOk.setOnClickListener { v ->
|
||||
btnOk.setOnClickListener { _ ->
|
||||
val instance = etInstance.text.toString().trim { it <= ' ' }
|
||||
|
||||
when {
|
||||
|
@ -36,10 +36,10 @@ class MyNetworkImageView : AppCompatImageView {
|
||||
}
|
||||
|
||||
// ロード中などに表示するDrawableのリソースID
|
||||
private var mDefaultImageId = 0
|
||||
private var mDefaultImage :Drawable? = null
|
||||
|
||||
// エラー時に表示するDrawableのリソースID
|
||||
private var mErrorImageId = 0
|
||||
private var mErrorImage :Drawable? = null
|
||||
|
||||
// 角丸の半径。元画像の短辺に対する割合を指定するらしい
|
||||
internal var mCornerRadius = 0f
|
||||
@ -67,13 +67,13 @@ class MyNetworkImageView : AppCompatImageView {
|
||||
constructor(context : Context, attrs : AttributeSet, defStyleAttr : Int)
|
||||
: super(context, attrs, defStyleAttr)
|
||||
|
||||
fun setDefaultImageResId(defaultImage : Int) {
|
||||
mDefaultImageId = defaultImage
|
||||
fun setDefaultImage(defaultImage : Drawable?) {
|
||||
mDefaultImage = defaultImage
|
||||
loadImageIfNecessary()
|
||||
}
|
||||
|
||||
fun setErrorImageResId(errorImage : Int) {
|
||||
mErrorImageId = errorImage
|
||||
fun setErrorImage(errorImage : Drawable?) {
|
||||
mErrorImage = errorImage
|
||||
loadImageIfNecessary()
|
||||
}
|
||||
|
||||
@ -138,14 +138,7 @@ class MyNetworkImageView : AppCompatImageView {
|
||||
|
||||
}
|
||||
|
||||
// デフォルト画像かnull
|
||||
private fun getDefaultDrawable(context : Context?) : Drawable? {
|
||||
return if(context != null && mDefaultImageId != 0) {
|
||||
ContextCompat.getDrawable(context, mDefaultImageId)
|
||||
} else {
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 必要なら非同期処理を開始する
|
||||
private fun loadImageIfNecessary() {
|
||||
@ -154,7 +147,7 @@ class MyNetworkImageView : AppCompatImageView {
|
||||
if(url?.isEmpty() != false) {
|
||||
// if the URL to be loaded in this view is empty,
|
||||
// cancel any old requests and clear the currently loaded image.
|
||||
cancelLoading(getDefaultDrawable(context))
|
||||
cancelLoading(mDefaultImage)
|
||||
return
|
||||
}
|
||||
|
||||
@ -162,7 +155,7 @@ class MyNetworkImageView : AppCompatImageView {
|
||||
if((mTarget as? UrlTarget)?.urlLoading == url) return
|
||||
|
||||
// if there is a pre-existing request, cancel it if it's fetching a different URL.
|
||||
cancelLoading(getDefaultDrawable(context))
|
||||
cancelLoading(mDefaultImage)
|
||||
|
||||
// 非表示状態ならロードを延期する
|
||||
if(! isShown) return
|
||||
@ -239,9 +232,9 @@ class MyNetworkImageView : AppCompatImageView {
|
||||
// 別の画像を表示するよう指定が変化していたなら何もしない
|
||||
if(urlLoading != mUrl) return
|
||||
|
||||
if(mErrorImageId != 0) {
|
||||
if(mErrorImage != null) {
|
||||
// エラー表示用の画像リソースが指定されていたら使う
|
||||
setImageResource(mErrorImageId)
|
||||
setImageDrawable(mErrorImage)
|
||||
} else {
|
||||
// このタイミングでImageViewのDrawableを変更するとチラつきの元になるので何もしない
|
||||
}
|
||||
|
@ -42,23 +42,25 @@ fun getAttributeColor(context : Context, attrId : Int) : Int {
|
||||
return color
|
||||
}
|
||||
|
||||
fun getAttributeResourceId(context : Context, attrId : Int) : Int {
|
||||
val theme = context.theme
|
||||
val a = theme.obtainStyledAttributes(intArrayOf(attrId))
|
||||
val resourceId = a.getResourceId(0, 0)
|
||||
a.recycle()
|
||||
if(resourceId == 0)
|
||||
throw RuntimeException(
|
||||
String.format(
|
||||
Locale.JAPAN,
|
||||
"attr not defined.attr_id=0x%x",
|
||||
attrId
|
||||
)
|
||||
)
|
||||
return resourceId
|
||||
}
|
||||
|
||||
fun getAttributeDrawable(context : Context, attrId : Int) : Drawable {
|
||||
|
||||
fun getAttributeResourceId(context : Context, attrId : Int) : Int {
|
||||
val theme = context.theme
|
||||
val a = theme.obtainStyledAttributes(intArrayOf(attrId))
|
||||
val resourceId = a.getResourceId(0, 0)
|
||||
a.recycle()
|
||||
if(resourceId == 0)
|
||||
throw RuntimeException(
|
||||
String.format(
|
||||
Locale.JAPAN,
|
||||
"attr not defined.attr_id=0x%x",
|
||||
attrId
|
||||
)
|
||||
)
|
||||
return resourceId
|
||||
}
|
||||
|
||||
val drawableId = getAttributeResourceId(context, attrId)
|
||||
val d = ContextCompat.getDrawable(context, drawableId)
|
||||
return d ?: throw RuntimeException(
|
||||
@ -233,21 +235,21 @@ fun setIconDrawableId(
|
||||
}
|
||||
}
|
||||
|
||||
fun setIconAttr(
|
||||
context : Context,
|
||||
imageView : ImageView,
|
||||
iconAttrId : Int,
|
||||
color : Int? = null,
|
||||
alphaMultiplier : Float? = null
|
||||
) {
|
||||
setIconDrawableId(
|
||||
context,
|
||||
imageView,
|
||||
getAttributeResourceId(context, iconAttrId),
|
||||
color,
|
||||
alphaMultiplier
|
||||
)
|
||||
}
|
||||
//fun setIconAttr(
|
||||
// context : Context,
|
||||
// imageView : ImageView,
|
||||
// iconAttrId : Int,
|
||||
// color : Int? = null,
|
||||
// alphaMultiplier : Float? = null
|
||||
//) {
|
||||
// setIconDrawableId(
|
||||
// context,
|
||||
// imageView,
|
||||
// getAttributeResourceId(context, iconAttrId),
|
||||
// color,
|
||||
// alphaMultiplier
|
||||
// )
|
||||
//}
|
||||
|
||||
fun CharSequence.copyToClipboard(context:Context) {
|
||||
try {
|
||||
|
Before Width: | Height: | Size: 292 B |
Before Width: | Height: | Size: 234 B |
Before Width: | Height: | Size: 348 B |
Before Width: | Height: | Size: 294 B |
Before Width: | Height: | Size: 334 B |
Before Width: | Height: | Size: 278 B |
Before Width: | Height: | Size: 458 B |
Before Width: | Height: | Size: 386 B |
Before Width: | Height: | Size: 700 B |
Before Width: | Height: | Size: 530 B |
Before Width: | Height: | Size: 344 B |
Before Width: | Height: | Size: 282 B |
Before Width: | Height: | Size: 512 B |
Before Width: | Height: | Size: 394 B |
Before Width: | Height: | Size: 240 B |
Before Width: | Height: | Size: 188 B |
Before Width: | Height: | Size: 304 B |
Before Width: | Height: | Size: 216 B |
Before Width: | Height: | Size: 416 B |
Before Width: | Height: | Size: 326 B |
Before Width: | Height: | Size: 526 B |
Before Width: | Height: | Size: 428 B |
Before Width: | Height: | Size: 340 B |
Before Width: | Height: | Size: 304 B |
Before Width: | Height: | Size: 322 B |
Before Width: | Height: | Size: 258 B |
Before Width: | Height: | Size: 374 B |
Before Width: | Height: | Size: 314 B |
Before Width: | Height: | Size: 246 B |
Before Width: | Height: | Size: 202 B |
Before Width: | Height: | Size: 686 B |
Before Width: | Height: | Size: 508 B |
BIN
app/src/main/res/drawable-hdpi/ic_blocked_by.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 306 B |
Before Width: | Height: | Size: 256 B |
Before Width: | Height: | Size: 192 B |
Before Width: | Height: | Size: 328 B |
Before Width: | Height: | Size: 264 B |
Before Width: | Height: | Size: 264 B |
Before Width: | Height: | Size: 252 B |
Before Width: | Height: | Size: 290 B |
Before Width: | Height: | Size: 230 B |
Before Width: | Height: | Size: 332 B |
Before Width: | Height: | Size: 244 B |
Before Width: | Height: | Size: 344 B |
Before Width: | Height: | Size: 270 B |
Before Width: | Height: | Size: 628 B |
Before Width: | Height: | Size: 484 B |
Before Width: | Height: | Size: 234 B |
Before Width: | Height: | Size: 226 B |
Before Width: | Height: | Size: 326 B |
Before Width: | Height: | Size: 298 B |
Before Width: | Height: | Size: 404 B |
Before Width: | Height: | Size: 646 B |
Before Width: | Height: | Size: 474 B |
Before Width: | Height: | Size: 786 B |
Before Width: | Height: | Size: 582 B |
Before Width: | Height: | Size: 546 B After Width: | Height: | Size: 450 B |
Before Width: | Height: | Size: 442 B |
Before Width: | Height: | Size: 472 B After Width: | Height: | Size: 430 B |
Before Width: | Height: | Size: 372 B |
Before Width: | Height: | Size: 570 B After Width: | Height: | Size: 474 B |
Before Width: | Height: | Size: 448 B |
BIN
app/src/main/res/drawable-hdpi/ic_followed_by.png
Normal file
After Width: | Height: | Size: 423 B |
Before Width: | Height: | Size: 284 B |
Before Width: | Height: | Size: 274 B |
Before Width: | Height: | Size: 190 B |
Before Width: | Height: | Size: 156 B |
BIN
app/src/main/res/drawable-hdpi/ic_hashtag.png
Normal file
After Width: | Height: | Size: 1018 B |
Before Width: | Height: | Size: 512 B |
Before Width: | Height: | Size: 406 B |
Before Width: | Height: | Size: 494 B |
Before Width: | Height: | Size: 386 B |
Before Width: | Height: | Size: 346 B After Width: | Height: | Size: 338 B |
Before Width: | Height: | Size: 260 B |
Before Width: | Height: | Size: 510 B |
Before Width: | Height: | Size: 366 B |
Before Width: | Height: | Size: 318 B |
Before Width: | Height: | Size: 288 B |
Before Width: | Height: | Size: 216 B |