mirror of
https://github.com/tateisu/SubwayTooter
synced 2025-01-31 02:54:57 +01:00
refactor. change order of app,lang in timeline
This commit is contained in:
parent
5191e9342e
commit
b8b376af24
@ -367,7 +367,7 @@ class ActAccountSetting
|
||||
btnNotificationStyleEditReply = findViewById(R.id.btnNotificationStyleEditReply)
|
||||
btnNotificationStyleEdit.setOnClickListener(this)
|
||||
btnNotificationStyleEditReply.setOnClickListener(this)
|
||||
vg(btnNotificationStyleEditReply, Pref.bpSeparateReplyNotificationGroup(pref))
|
||||
btnNotificationStyleEditReply.vg(Pref.bpSeparateReplyNotificationGroup(pref))
|
||||
|
||||
name_invalidator = NetworkEmojiInvalidator(handler, etDisplayName)
|
||||
note_invalidator = NetworkEmojiInvalidator(handler, etNote)
|
||||
@ -941,9 +941,9 @@ class ActAccountSetting
|
||||
var profile_busy : Boolean = false
|
||||
|
||||
internal fun showProfile(src : TootAccount) {
|
||||
|
||||
if( isDestroyed ) return
|
||||
|
||||
|
||||
if(isDestroyed) return
|
||||
|
||||
profile_busy = true
|
||||
try {
|
||||
ivProfileAvatar.setImageUrl(
|
||||
@ -1000,8 +1000,8 @@ class ActAccountSetting
|
||||
if(src.source?.fields != null) {
|
||||
val fields = src.source.fields
|
||||
listEtFieldName.forEachIndexed { i, et ->
|
||||
val handler =et.handler // may null
|
||||
if( handler != null){
|
||||
val handler = et.handler // may null
|
||||
if(handler != null) {
|
||||
// いつからかfields name にもカスタム絵文字が使えるようになった
|
||||
// https://github.com/tootsuite/mastodon/pull/11350
|
||||
// しかし
|
||||
@ -1019,8 +1019,8 @@ class ActAccountSetting
|
||||
}
|
||||
|
||||
listEtFieldValue.forEachIndexed { i, et ->
|
||||
val handler =et.handler // may null
|
||||
if( handler != null){
|
||||
val handler = et.handler // may null
|
||||
if(handler != null) {
|
||||
val text = decodeOptions.decodeEmoji(
|
||||
when {
|
||||
i >= fields.size -> ""
|
||||
@ -1038,8 +1038,8 @@ class ActAccountSetting
|
||||
val fields = src.fields
|
||||
|
||||
listEtFieldName.forEachIndexed { i, et ->
|
||||
val handler =et.handler // may null
|
||||
if( handler != null){
|
||||
val handler = et.handler // may null
|
||||
if(handler != null) {
|
||||
// いつからかfields name にもカスタム絵文字が使えるようになった
|
||||
// https://github.com/tootsuite/mastodon/pull/11350
|
||||
val text = decodeOptions.decodeEmoji(
|
||||
@ -1057,8 +1057,8 @@ class ActAccountSetting
|
||||
}
|
||||
|
||||
listEtFieldValue.forEachIndexed { i, et ->
|
||||
val handler =et.handler // may null
|
||||
if( handler != null){
|
||||
val handler = et.handler // may null
|
||||
if(handler != null) {
|
||||
val text = decodeOptions.decodeHTML(
|
||||
when {
|
||||
fields == null || i >= fields.size -> ""
|
||||
|
@ -163,8 +163,8 @@ class ActAppSetting : AppCompatActivity() {
|
||||
|
||||
fun bind(item : Item) {
|
||||
tvTitle.setText(item.titleId)
|
||||
vg(tvDesc, item.descId != null)
|
||||
item.descId?.let { tvDesc.setText(it) }
|
||||
val descId = item.descId ?: 0
|
||||
tvDesc.vg(descId != 0)?.setText(descId)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -163,13 +163,15 @@ class ActHighlightWordList : AppCompatActivity(), View.OnClickListener {
|
||||
?: getAttributeColor(this@ActHighlightWordList, android.R.attr.textColorPrimary)
|
||||
)
|
||||
|
||||
vg(btnSound, item.sound_type != HighlightWord.SOUND_TYPE_NONE)
|
||||
btnSound.setOnClickListener(this)
|
||||
btnSound.tag = item
|
||||
btnSound.vg(item.sound_type != HighlightWord.SOUND_TYPE_NONE)?.apply{
|
||||
setOnClickListener(this@MyViewHolder)
|
||||
tag = item
|
||||
}
|
||||
|
||||
vg(ivSpeech,item.speech != 0 )
|
||||
ivSpeech.setOnClickListener(this)
|
||||
ivSpeech.tag = item
|
||||
ivSpeech.vg(item.speech != 0 )?.apply{
|
||||
setOnClickListener(this@MyViewHolder)
|
||||
tag = item
|
||||
}
|
||||
}
|
||||
|
||||
// @Override
|
||||
|
@ -119,7 +119,7 @@ class ActMain : AppCompatActivity()
|
||||
var acct_font_size_sp = Float.NaN
|
||||
var notification_tl_font_size_sp = Float.NaN
|
||||
var header_text_size_sp = Float.NaN
|
||||
var timeline_spacing:Float? = null
|
||||
var timeline_spacing : Float? = null
|
||||
var avatarIconSize : Int = 0
|
||||
var notificationTlIconSize : Int = 0
|
||||
|
||||
@ -190,14 +190,14 @@ class ActMain : AppCompatActivity()
|
||||
val cancel_follow_request_complete_callback : EmptyCallback = {
|
||||
showToast(this@ActMain, false, R.string.follow_request_cancelled)
|
||||
}
|
||||
|
||||
|
||||
val favourite_complete_callback : EmptyCallback = {
|
||||
showToast(this@ActMain, false, R.string.favourite_succeeded)
|
||||
}
|
||||
val unfavourite_complete_callback : EmptyCallback = {
|
||||
showToast(this@ActMain, false, R.string.unfavourite_succeeded)
|
||||
}
|
||||
|
||||
|
||||
val bookmark_complete_callback : EmptyCallback = {
|
||||
showToast(this@ActMain, false, R.string.bookmark_succeeded)
|
||||
}
|
||||
@ -441,8 +441,8 @@ class ActMain : AppCompatActivity()
|
||||
notification_tl_font_size_sp = Pref.fpNotificationTlFontSize(pref).clipFontSize()
|
||||
header_text_size_sp = Pref.fpHeaderTextSize(pref).clipFontSize()
|
||||
|
||||
val fv = Pref.spTimelineSpacing(pref).toFloatOrNull()
|
||||
timeline_spacing = if(fv!=null && fv.isFinite() && fv!=0f) fv else null
|
||||
val fv = Pref.spTimelineSpacing(pref).toFloatOrNull()
|
||||
timeline_spacing = if(fv != null && fv.isFinite() && fv != 0f) fv else null
|
||||
|
||||
initUI()
|
||||
|
||||
@ -492,7 +492,7 @@ class ActMain : AppCompatActivity()
|
||||
override fun onConfigurationChanged(newConfig : Configuration) {
|
||||
log.d("onConfigurationChanged")
|
||||
super.onConfigurationChanged(newConfig)
|
||||
if(newConfig.screenHeightDp > 0 || newConfig.screenHeightDp >0){
|
||||
if(newConfig.screenHeightDp > 0 || newConfig.screenHeightDp > 0) {
|
||||
tabOnly { env -> resizeColumnWidth(env) }
|
||||
}
|
||||
}
|
||||
@ -1019,7 +1019,7 @@ class ActMain : AppCompatActivity()
|
||||
REQUEST_CODE_COLUMN_COLOR -> if(data != null) {
|
||||
app_state.saveColumnList()
|
||||
val idx = data.getIntExtra(ActColumnCustomize.EXTRA_COLUMN_INDEX, 0)
|
||||
if(idx in app_state.column_list.indices ) {
|
||||
if(idx in app_state.column_list.indices) {
|
||||
app_state.column_list[idx].fireColumnColor()
|
||||
app_state.column_list[idx].fireShowContent(
|
||||
reason = "ActMain column color changed",
|
||||
@ -1028,11 +1028,11 @@ class ActMain : AppCompatActivity()
|
||||
}
|
||||
updateColumnStrip()
|
||||
}
|
||||
|
||||
|
||||
REQUEST_CODE_LANGUAGE_FILTER -> if(data != null) {
|
||||
app_state.saveColumnList()
|
||||
val idx = data.getIntExtra(ActLanguageFilter.EXTRA_COLUMN_INDEX, 0)
|
||||
if(idx in app_state.column_list.indices ) {
|
||||
if(idx in app_state.column_list.indices) {
|
||||
app_state.column_list[idx].onLanguageFilterChanged()
|
||||
}
|
||||
}
|
||||
@ -1465,7 +1465,7 @@ class ActMain : AppCompatActivity()
|
||||
)
|
||||
|
||||
internal fun updateColumnStrip() {
|
||||
vg(llEmpty, app_state.column_list.isEmpty())
|
||||
llEmpty.vg(app_state.column_list.isEmpty())
|
||||
|
||||
val iconSize = stripIconSize
|
||||
val rootW = (iconSize * 1.25f + 0.5f).toInt()
|
||||
@ -1746,7 +1746,7 @@ class ActMain : AppCompatActivity()
|
||||
if(dataIdString != null) {
|
||||
try {
|
||||
val dataId = dataIdString.toLong(10)
|
||||
val type = uri.getQueryParameter("type")?:""
|
||||
val type = uri.getQueryParameter("type") ?: ""
|
||||
val account = SavedAccount.loadAccount(this@ActMain, dataId)
|
||||
if(account != null) {
|
||||
var column = app_state.column_list.firstOrNull {
|
||||
@ -1771,7 +1771,7 @@ class ActMain : AppCompatActivity()
|
||||
column.startLoading()
|
||||
}
|
||||
|
||||
PollingWorker.queueNotificationClicked(this, dataId,type)
|
||||
PollingWorker.queueNotificationClicked(this, dataId, type)
|
||||
|
||||
}
|
||||
} catch(ex : Throwable) {
|
||||
@ -2846,10 +2846,10 @@ class ActMain : AppCompatActivity()
|
||||
if(! timeline_font_size_sp.isNaN()) {
|
||||
tv.textSize = timeline_font_size_sp
|
||||
}
|
||||
|
||||
|
||||
val fv = timeline_spacing
|
||||
if( fv != null) tv.setLineSpacing(0f,fv)
|
||||
|
||||
if(fv != null) tv.setLineSpacing(0f, fv)
|
||||
|
||||
tv.typeface = timeline_font
|
||||
tv.text = text
|
||||
tv.measure(
|
||||
|
@ -361,7 +361,7 @@ class ActMediaViewer : AppCompatActivity(), View.OnClickListener {
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
private fun loadVideo(ta : TootAttachment, state : Bundle? = null) {
|
||||
|
||||
vg(cbMute,true)
|
||||
cbMute.vg(true)
|
||||
if(cbMute.isChecked && lastVolume.isFinite() ) {
|
||||
exoPlayer.volume = 0f
|
||||
}
|
||||
|
@ -1394,13 +1394,13 @@ class ActPost : AppCompatActivity(),
|
||||
|
||||
val account = account
|
||||
if(account == null || account.isPseudo) {
|
||||
vg(btnFeaturedTag, false)
|
||||
btnFeaturedTag.vg(false)
|
||||
return
|
||||
}
|
||||
|
||||
val cache = featuredTagCache[account.acct]
|
||||
|
||||
vg(btnFeaturedTag, cache?.list?.isNotEmpty() == true)
|
||||
btnFeaturedTag.vg(cache?.list?.isNotEmpty() == true)
|
||||
|
||||
val now = SystemClock.elapsedRealtime()
|
||||
if(cache != null && now - cache.time <= 300000L) return
|
||||
@ -1611,7 +1611,7 @@ class ActPost : AppCompatActivity(),
|
||||
|
||||
if(isFinishing) return
|
||||
|
||||
vg(llAttachment, attachment_list.isNotEmpty())
|
||||
llAttachment.vg(attachment_list.isNotEmpty())
|
||||
ivMedia.forEachIndexed { i, v -> showAttachment_sub(v, i) }
|
||||
}
|
||||
|
||||
@ -3058,10 +3058,10 @@ class ActPost : AppCompatActivity(),
|
||||
|
||||
private fun showEnquete() {
|
||||
val i = spEnquete.selectedItemPosition
|
||||
vg(llEnquete, i != 0)
|
||||
vg(llExpire, i == 1)
|
||||
vg(cbHideTotals, i == 1)
|
||||
vg(cbMultipleChoice, i == 1)
|
||||
llEnquete.vg(i != 0)
|
||||
llExpire.vg(i == 1)
|
||||
cbHideTotals.vg(i == 1)
|
||||
cbMultipleChoice.vg(i == 1)
|
||||
}
|
||||
|
||||
private val commitContentListener =
|
||||
|
@ -584,41 +584,41 @@ class ColumnViewHolder(
|
||||
etSearch.setText(column.search_query)
|
||||
cbResolve.isCheckedNoAnime = column.search_resolve
|
||||
|
||||
vg(cbWithAttachment, bAllowFilter)
|
||||
vg(cbWithHighlight, bAllowFilter)
|
||||
vg(etRegexFilter, bAllowFilter)
|
||||
vg(llRegexFilter, bAllowFilter)
|
||||
vg(btnLanguageFilter,bAllowFilter)
|
||||
cbWithAttachment.vg(bAllowFilter)
|
||||
cbWithHighlight.vg(bAllowFilter)
|
||||
etRegexFilter.vg(bAllowFilter)
|
||||
llRegexFilter.vg(bAllowFilter)
|
||||
btnLanguageFilter.vg(bAllowFilter)
|
||||
|
||||
vg(cbDontShowBoost, column.canFilterBoost())
|
||||
vg(cbDontShowReply, column.canFilterReply())
|
||||
vg(cbDontShowNormalToot, column.canFilterNormalToot())
|
||||
vg(cbDontShowReaction, isNotificationColumn && column.isMisskey)
|
||||
vg(cbDontShowVote, isNotificationColumn)
|
||||
vg(cbDontShowFavourite, isNotificationColumn && ! column.isMisskey)
|
||||
vg(cbDontShowFollow, isNotificationColumn)
|
||||
cbDontShowBoost.vg(column.canFilterBoost())
|
||||
cbDontShowReply.vg(column.canFilterReply())
|
||||
cbDontShowNormalToot.vg(column.canFilterNormalToot())
|
||||
cbDontShowReaction.vg(isNotificationColumn && column.isMisskey)
|
||||
cbDontShowVote.vg(isNotificationColumn)
|
||||
cbDontShowFavourite.vg(isNotificationColumn && ! column.isMisskey)
|
||||
cbDontShowFollow.vg(isNotificationColumn)
|
||||
|
||||
vg(cbInstanceLocal, column.type == ColumnType.HASHTAG)
|
||||
cbInstanceLocal.vg(column.type == ColumnType.HASHTAG)
|
||||
|
||||
|
||||
vg(cbDontStreaming, column.canStreaming())
|
||||
vg(cbDontAutoRefresh, column.canAutoRefresh())
|
||||
vg(cbHideMediaDefault, column.canNSFWDefault())
|
||||
vg(cbSystemNotificationNotRelated, column.isNotificationColumn)
|
||||
vg(cbEnableSpeech, column.canSpeech())
|
||||
vg(cbOldApi, column.type == ColumnType.DIRECT_MESSAGES)
|
||||
cbDontStreaming.vg(column.canStreaming())
|
||||
cbDontAutoRefresh.vg(column.canAutoRefresh())
|
||||
cbHideMediaDefault.vg(column.canNSFWDefault())
|
||||
cbSystemNotificationNotRelated.vg(column.isNotificationColumn)
|
||||
cbEnableSpeech.vg(column.canSpeech())
|
||||
cbOldApi.vg(column.type == ColumnType.DIRECT_MESSAGES)
|
||||
|
||||
|
||||
vg(btnDeleteNotification, column.isNotificationColumn)
|
||||
btnDeleteNotification.vg(column.isNotificationColumn)
|
||||
|
||||
if(vg(llSearch, column.isSearchColumn)) {
|
||||
vg(btnSearchClear, Pref.bpShowSearchClear(activity.pref))
|
||||
if(llSearch.vg(column.isSearchColumn) != null) {
|
||||
btnSearchClear.vg(Pref.bpShowSearchClear(activity.pref))
|
||||
}
|
||||
|
||||
vg(llListList, column.type == ColumnType.LIST_LIST)
|
||||
vg(cbResolve, column.type == ColumnType.SEARCH)
|
||||
llListList.vg(column.type == ColumnType.LIST_LIST)
|
||||
cbResolve.vg(column.type == ColumnType.SEARCH)
|
||||
|
||||
vg(llHashtagExtra, column.hasHashtagExtra())
|
||||
llHashtagExtra.vg(column.hasHashtagExtra())
|
||||
etHashtagExtraAny.setText(column.hashtag_any)
|
||||
etHashtagExtraAll.setText(column.hashtag_all)
|
||||
etHashtagExtraNone.setText(column.hashtag_none)
|
||||
@ -1033,7 +1033,7 @@ class ColumnViewHolder(
|
||||
ActColumnCustomize.open(activity, idx, ActMain.REQUEST_CODE_COLUMN_COLOR)
|
||||
}
|
||||
|
||||
btnLanguageFilter ->{
|
||||
btnLanguageFilter -> {
|
||||
val idx = activity.app_state.column_list.indexOf(column)
|
||||
ActLanguageFilter.open(activity, idx, ActMain.REQUEST_CODE_LANGUAGE_FILTER)
|
||||
}
|
||||
@ -1459,12 +1459,10 @@ class ColumnViewHolder(
|
||||
private fun showQuickFilter() {
|
||||
val column = this.column ?: return
|
||||
|
||||
val isNotificationColumn = column.isNotificationColumn
|
||||
vg(svQuickFilter, isNotificationColumn)
|
||||
if(! isNotificationColumn) return
|
||||
svQuickFilter.vg(column.isNotificationColumn) ?: return
|
||||
|
||||
vg(btnQuickFilterReaction, column.isMisskey)
|
||||
vg(btnQuickFilterFavourite, ! column.isMisskey)
|
||||
btnQuickFilterReaction.vg(column.isMisskey)
|
||||
btnQuickFilterFavourite.vg(! column.isMisskey)
|
||||
|
||||
val insideColumnSetting = Pref.bpMoveNotificationsQuickFilter(activity.pref)
|
||||
|
||||
@ -1577,7 +1575,7 @@ class ColumnViewHolder(
|
||||
lp.width = matchParent
|
||||
lp.height = matchParent
|
||||
if(lp is ViewGroup.MarginLayoutParams) {
|
||||
lp.setMargins(0,0,0,0)
|
||||
lp.setMargins(0, 0, 0, 0)
|
||||
}
|
||||
layoutParams = lp
|
||||
}
|
||||
@ -1884,7 +1882,7 @@ class ColumnViewHolder(
|
||||
isAllCaps = false
|
||||
text = context.getString(R.string.language_filter)
|
||||
}.lparams(matchParent, wrapContent)
|
||||
|
||||
|
||||
}
|
||||
|
||||
} // end of column setting scroll view
|
||||
|
@ -304,16 +304,15 @@ internal class DlgContextMenu(
|
||||
addLinkButton(tag, href)
|
||||
}
|
||||
}
|
||||
vg(llLinks, llLinks.childCount > 1)
|
||||
llLinks.vg(llLinks.childCount > 1)
|
||||
|
||||
vg(btnYourToot, status_by_me)
|
||||
btnYourToot.vg(status_by_me)
|
||||
|
||||
|
||||
|
||||
vg(btnBoostWithVisibility, ! access_info.isPseudo && ! access_info.isMisskey)
|
||||
btnBoostWithVisibility.vg(! access_info.isPseudo && ! access_info.isMisskey)
|
||||
|
||||
btnReportStatus.visibility =
|
||||
if(status_by_me || access_info.isPseudo) View.GONE else View.VISIBLE
|
||||
btnReportStatus.vg(! (status_by_me || access_info.isPseudo))
|
||||
|
||||
val application_name = status.application?.name
|
||||
if(status_by_me || application_name == null || application_name.isEmpty()) {
|
||||
@ -323,8 +322,8 @@ internal class DlgContextMenu(
|
||||
}
|
||||
|
||||
val canPin = status.canPin(access_info)
|
||||
vg(btnProfileUnpin, canPin && status.pinned)
|
||||
vg(btnProfilePin, canPin && ! status.pinned)
|
||||
btnProfileUnpin.vg(canPin && status.pinned)
|
||||
btnProfilePin.vg(canPin && ! status.pinned)
|
||||
}
|
||||
|
||||
val bShowConversationMute = when {
|
||||
@ -334,17 +333,20 @@ internal class DlgContextMenu(
|
||||
else -> false
|
||||
}
|
||||
|
||||
if(vg(btnConversationMute, bShowConversationMute)) {
|
||||
val muted = status?.muted ?: false
|
||||
btnConversationMute.setText(if(muted) R.string.unmute_this_conversation else R.string.mute_this_conversation)
|
||||
}
|
||||
val muted = status?.muted ?: false
|
||||
btnConversationMute.vg(bShowConversationMute)
|
||||
?.setText(
|
||||
if(muted)
|
||||
R.string.unmute_this_conversation
|
||||
else R.string.mute_this_conversation
|
||||
)
|
||||
|
||||
vg(llNotification, notification != null)
|
||||
llNotification.vg(notification != null)
|
||||
|
||||
fun showRelation(relation : UserRelation) {
|
||||
// 被フォロー状態
|
||||
// Styler.setFollowIconとは異なり細かい状態を表示しない
|
||||
vg(ivFollowedBy, relation.followed_by)
|
||||
ivFollowedBy.vg(relation.followed_by)
|
||||
|
||||
// フォロー状態
|
||||
// Styler.setFollowIconとは異なりミュートやブロックを表示しない
|
||||
@ -393,7 +395,7 @@ internal class DlgContextMenu(
|
||||
// 疑似アカミュートができたのでアカウントアクションを表示する
|
||||
showRelation(UserRelation())
|
||||
llAccountActionBar.visibility = View.VISIBLE
|
||||
vg(ivFollowedBy, false)
|
||||
ivFollowedBy.vg(false)
|
||||
btnFollow.setImageResource(R.drawable.ic_follow_plus)
|
||||
btnFollow.imageTintList =
|
||||
ColorStateList.valueOf(getAttributeColor(activity, R.attr.colorImageButton))
|
||||
@ -405,19 +407,17 @@ internal class DlgContextMenu(
|
||||
|
||||
val who_host = getUserHost()
|
||||
val llInstance : View = viewRoot.findViewById(R.id.llInstance)
|
||||
if(vg(llInstance, ! (who_host.isEmpty() || who_host == "?"))) {
|
||||
if(llInstance.vg(! (who_host.isEmpty() || who_host == "?")) != null) {
|
||||
val tvInstanceActions : TextView = viewRoot.findViewById(R.id.tvInstanceActions)
|
||||
tvInstanceActions.text = activity.getString(R.string.instance_actions_for, who_host)
|
||||
|
||||
// 疑似アカウントではドメインブロックできない
|
||||
// 自ドメインはブロックできない
|
||||
vg(
|
||||
btnDomainBlock,
|
||||
btnDomainBlock.vg(
|
||||
! (access_info.isPseudo || access_info.host.equals(who_host, ignoreCase = true))
|
||||
)
|
||||
|
||||
vg(
|
||||
btnDomainTimeline,
|
||||
btnDomainTimeline.vg(
|
||||
Pref.bpEnableDomainTimeline(activity.pref) &&
|
||||
! access_info.isPseudo &&
|
||||
! access_info.isMisskey
|
||||
@ -436,12 +436,10 @@ internal class DlgContextMenu(
|
||||
btnCopyAccountId.visibility = View.VISIBLE
|
||||
btnCopyAccountId.text = activity.getString(R.string.copy_account_id, who.id.toString())
|
||||
|
||||
vg(btnOpenAccountInAdminWebUi, ! access_info.isPseudo)
|
||||
vg(btnOpenInstanceInAdminWebUi, ! access_info.isPseudo)
|
||||
|
||||
btnReportUser.visibility =
|
||||
if(access_info.isPseudo || access_info.isMe(who)) View.GONE else View.VISIBLE
|
||||
btnOpenAccountInAdminWebUi.vg(! access_info.isPseudo)
|
||||
btnOpenInstanceInAdminWebUi.vg(! access_info.isPseudo)
|
||||
|
||||
btnReportUser.vg(! (access_info.isPseudo || access_info.isMe(who)))
|
||||
}
|
||||
|
||||
viewRoot.findViewById<View>(R.id.btnAccountText).setOnClickListener(this)
|
||||
@ -539,17 +537,17 @@ internal class DlgContextMenu(
|
||||
private fun updateGroup(btn : Button, group : View, toggle : Boolean = false) {
|
||||
|
||||
if(btn.visibility != View.VISIBLE) {
|
||||
vg(group, false)
|
||||
group.vg(false)
|
||||
return
|
||||
}
|
||||
|
||||
when {
|
||||
Pref.bpAlwaysExpandContextMenuItems(activity.pref) -> {
|
||||
vg(group, true)
|
||||
group.vg(true)
|
||||
btn.background = null
|
||||
}
|
||||
|
||||
toggle -> vg(group, group.visibility != View.VISIBLE)
|
||||
toggle -> group.vg(group.visibility != View.VISIBLE)
|
||||
else -> btn.setOnClickListener(this)
|
||||
}
|
||||
|
||||
|
@ -309,7 +309,7 @@ internal class ItemViewHolder(
|
||||
this.follow_invalidator = NetworkEmojiInvalidator(activity.handler, tvFollowerName)
|
||||
this.name_invalidator = NetworkEmojiInvalidator(activity.handler, tvName)
|
||||
this.lastActive_invalidator = NetworkEmojiInvalidator(activity.handler, tvLastStatusAt)
|
||||
|
||||
|
||||
val cardBackground = llCardOuter.background
|
||||
if(cardBackground is PreviewCardBorder) {
|
||||
val density = activity.density
|
||||
@ -1151,8 +1151,7 @@ internal class ItemViewHolder(
|
||||
|
||||
setAcct(tvFollowerAcct, access_info.getFullAcct(who), who.acct)
|
||||
|
||||
who.setAccountExtra(access_info,tvLastStatusAt,lastActive_invalidator )
|
||||
|
||||
who.setAccountExtra(access_info, tvLastStatusAt, lastActive_invalidator)
|
||||
|
||||
val relation = UserRelation.load(access_info.db_id, who.id)
|
||||
Styler.setFollowIcon(
|
||||
@ -1175,14 +1174,16 @@ internal class ItemViewHolder(
|
||||
private fun showStatus(status : TootStatus, colorBg : Int = 0) {
|
||||
|
||||
val filteredWord = status.filteredWord
|
||||
if(filteredWord != null ) {
|
||||
showMessageHolder(TootMessageHolder(
|
||||
if(Pref.bpShowFilteredWord(activity.pref)){
|
||||
"${activity.getString(R.string.filtered)} / $filteredWord"
|
||||
}else{
|
||||
activity.getString(R.string.filtered)
|
||||
}
|
||||
))
|
||||
if(filteredWord != null) {
|
||||
showMessageHolder(
|
||||
TootMessageHolder(
|
||||
if(Pref.bpShowFilteredWord(activity.pref)) {
|
||||
"${activity.getString(R.string.filtered)} / $filteredWord"
|
||||
} else {
|
||||
activity.getString(R.string.filtered)
|
||||
}
|
||||
)
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
@ -1368,26 +1369,11 @@ internal class ItemViewHolder(
|
||||
makeReactionsView(status)
|
||||
|
||||
buttons_for_status?.bind(status, (item as? TootNotification))
|
||||
|
||||
var sb :StringBuilder? = null
|
||||
|
||||
fun prepareSb() :StringBuilder{
|
||||
var x = sb
|
||||
if( x == null){
|
||||
x = StringBuilder()
|
||||
sb = x
|
||||
}else{
|
||||
x.append(", ")
|
||||
}
|
||||
return x
|
||||
}
|
||||
var sb : StringBuilder? = null
|
||||
|
||||
val language = status.language
|
||||
if( language != null &&
|
||||
(column.type == ColumnType.CONVERSATION || Pref.bpShowLanguage(activity.pref))
|
||||
){
|
||||
prepareSb().append(activity.getString(R.string.language_is,language))
|
||||
}
|
||||
fun prepareSb() : StringBuilder =
|
||||
sb?.append(", ") ?: StringBuilder().also { sb = it }
|
||||
|
||||
val application = status.application
|
||||
if(application != null &&
|
||||
@ -1396,13 +1382,14 @@ internal class ItemViewHolder(
|
||||
prepareSb().append(activity.getString(R.string.application_is, application.name ?: ""))
|
||||
}
|
||||
|
||||
if(sb != null) {
|
||||
tvApplication.visibility = View.VISIBLE
|
||||
tvApplication.text = sb
|
||||
}else{
|
||||
tvApplication.visibility = View.GONE
|
||||
val language = status.language
|
||||
if(language != null &&
|
||||
(column.type == ColumnType.CONVERSATION || Pref.bpShowLanguage(activity.pref))
|
||||
) {
|
||||
prepareSb().append(activity.getString(R.string.language_is, language))
|
||||
}
|
||||
|
||||
|
||||
tvApplication.vg(sb != null)?.text = sb
|
||||
}
|
||||
|
||||
private fun showInstanceTicker(who : TootAccount) {
|
||||
|
@ -200,8 +200,8 @@ internal class StatusButtons(
|
||||
|
||||
// ブックマークボタン
|
||||
when {
|
||||
!Pref.bpShowBookmarkButton(activity.pref) -> vg(btnBookmark,false)
|
||||
|
||||
! Pref.bpShowBookmarkButton(activity.pref) -> btnBookmark.vg(false)
|
||||
|
||||
activity.app_state.isBusyBookmark(access_info, status) -> setButton(
|
||||
btnBookmark,
|
||||
false,
|
||||
@ -242,16 +242,16 @@ internal class StatusButtons(
|
||||
var optionalButtonFirst : View? = null
|
||||
var optionalButtonCount = 0
|
||||
|
||||
fun showCustomShare(target : CustomShareTarget, b : ImageButton) {
|
||||
fun ImageButton.showCustomShare(target : CustomShareTarget) {
|
||||
val (label, icon) = CustomShare.getCache(target)
|
||||
?: error("showCustomShare: invalid target")
|
||||
|
||||
if(vg(b, label != null || icon != null)) {
|
||||
b.isEnabled = true
|
||||
b.contentDescription = label ?: "?"
|
||||
b.setImageDrawable(
|
||||
vg(label != null || icon != null)?.apply {
|
||||
isEnabled = true
|
||||
contentDescription = label ?: "?"
|
||||
setImageDrawable(
|
||||
icon ?: createColoredDrawable(
|
||||
activity,
|
||||
this@StatusButtons.activity,
|
||||
R.drawable.ic_question,
|
||||
color_normal,
|
||||
Styler.boost_alpha
|
||||
@ -259,18 +259,17 @@ internal class StatusButtons(
|
||||
)
|
||||
++ optionalButtonCount
|
||||
if(optionalButtonFirst == null) {
|
||||
optionalButtonFirst = b
|
||||
optionalButtonFirst = this
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
btnTranslate.vg(Pref.bpShowTranslateButton(activity.pref))
|
||||
?.showCustomShare(CustomShareTarget.Translate)
|
||||
|
||||
if(vg(btnTranslate, Pref.bpShowTranslateButton(activity.pref))) {
|
||||
showCustomShare(CustomShareTarget.Translate, btnTranslate)
|
||||
}
|
||||
showCustomShare(CustomShareTarget.CustomShare1, btnCustomShare1)
|
||||
showCustomShare(CustomShareTarget.CustomShare2, btnCustomShare2)
|
||||
showCustomShare(CustomShareTarget.CustomShare3, btnCustomShare3)
|
||||
btnCustomShare1.showCustomShare(CustomShareTarget.CustomShare1)
|
||||
btnCustomShare2.showCustomShare(CustomShareTarget.CustomShare2)
|
||||
btnCustomShare3.showCustomShare(CustomShareTarget.CustomShare3)
|
||||
|
||||
val lpConversation = btnConversation.layoutParams as? FlexboxLayout.LayoutParams
|
||||
val updateAdditionalButton : (btn : ImageButton) -> Unit
|
||||
|
@ -71,7 +71,7 @@ internal class ViewHolderHeaderProfile(
|
||||
ivBackground = viewRoot.findViewById(R.id.ivBackground)
|
||||
llProfile = viewRoot.findViewById(R.id.llProfile)
|
||||
tvCreated = viewRoot.findViewById(R.id.tvCreated)
|
||||
tvLastStatusAt= viewRoot.findViewById(R.id.tvLastStatusAt)
|
||||
tvLastStatusAt = viewRoot.findViewById(R.id.tvLastStatusAt)
|
||||
ivAvatar = viewRoot.findViewById(R.id.ivAvatar)
|
||||
tvDisplayName = viewRoot.findViewById(R.id.tvDisplayName)
|
||||
tvAcct = viewRoot.findViewById(R.id.tvAcct)
|
||||
@ -150,7 +150,7 @@ internal class ViewHolderHeaderProfile(
|
||||
}
|
||||
|
||||
val spacing = activity.timeline_spacing
|
||||
if( spacing != null) {
|
||||
if(spacing != null) {
|
||||
tvMovedName.setLineSpacing(0f, spacing)
|
||||
tvMoved.setLineSpacing(0f, spacing)
|
||||
}
|
||||
@ -200,7 +200,7 @@ internal class ViewHolderHeaderProfile(
|
||||
|
||||
if(who == null) {
|
||||
tvCreated.text = ""
|
||||
vg(tvLastStatusAt,false)
|
||||
tvLastStatusAt.vg(false)
|
||||
ivBackground.setImageDrawable(null)
|
||||
ivAvatar.setImageDrawable(null)
|
||||
|
||||
@ -223,7 +223,12 @@ internal class ViewHolderHeaderProfile(
|
||||
tvCreated.text =
|
||||
TootStatus.formatTime(tvCreated.context, (whoDetail ?: who).time_created_at, true)
|
||||
|
||||
who.setAccountExtra(access_info,tvLastStatusAt,invalidator = null,fromProfileHeader = true)
|
||||
who.setAccountExtra(
|
||||
access_info,
|
||||
tvLastStatusAt,
|
||||
invalidator = null,
|
||||
fromProfileHeader = true
|
||||
)
|
||||
|
||||
ivBackground.setImageUrl(
|
||||
activity.pref,
|
||||
@ -266,7 +271,7 @@ internal class ViewHolderHeaderProfile(
|
||||
append(" ")
|
||||
val info = EmojiMap.sShortNameToEmojiInfo["lock"]
|
||||
if(info != null) {
|
||||
appendSpan("locked",info.er.createSpan(activity))
|
||||
appendSpan("locked", info.er.createSpan(activity))
|
||||
} else {
|
||||
append("locked")
|
||||
}
|
||||
@ -317,14 +322,17 @@ internal class ViewHolderHeaderProfile(
|
||||
append(s)
|
||||
}
|
||||
}
|
||||
vg(tvMisskeyExtra, tvMisskeyExtra.text.isNotEmpty())
|
||||
tvMisskeyExtra.vg(tvMisskeyExtra.text.isNotEmpty())
|
||||
|
||||
btnStatusCount.text = activity.getString(R.string.statuses) + "\n" +
|
||||
(whoDetail?.statuses_count ?: who.statuses_count)
|
||||
btnFollowing.text = activity.getString(R.string.following) + "\n" +
|
||||
(whoDetail?.following_count ?: who.following_count)
|
||||
btnFollowers.text = activity.getString(R.string.followers) + "\n" +
|
||||
(whoDetail?.followers_count ?: who.followers_count)
|
||||
btnStatusCount.text =
|
||||
"${activity.getString(R.string.statuses)}\n${whoDetail?.statuses_count
|
||||
?: who.statuses_count}"
|
||||
btnFollowing.text =
|
||||
"${activity.getString(R.string.following)}\n${whoDetail?.following_count
|
||||
?: who.following_count}"
|
||||
btnFollowers.text =
|
||||
"${activity.getString(R.string.followers)}\n${whoDetail?.followers_count
|
||||
?: who.followers_count}"
|
||||
|
||||
val relation = UserRelation.load(access_info.db_id, who.id)
|
||||
Styler.setFollowIcon(
|
||||
|
@ -116,7 +116,7 @@ open class TootAccount(parser : TootParser, src : JSONObject) {
|
||||
|
||||
init {
|
||||
this.json = src
|
||||
|
||||
|
||||
var sv : String?
|
||||
|
||||
if(parser.serviceType == ServiceType.MISSKEY) {
|
||||
@ -386,9 +386,9 @@ open class TootAccount(parser : TootParser, src : JSONObject) {
|
||||
fun setAccountExtra(
|
||||
accessInfo : SavedAccount,
|
||||
tv : TextView,
|
||||
invalidator: NetworkEmojiInvalidator?,
|
||||
invalidator : NetworkEmojiInvalidator?,
|
||||
fromProfileHeader : Boolean = false
|
||||
):SpannableStringBuilder? {
|
||||
) : SpannableStringBuilder? {
|
||||
val pref = App1.pref
|
||||
val context = tv.context
|
||||
|
||||
@ -441,13 +441,13 @@ open class TootAccount(parser : TootParser, src : JSONObject) {
|
||||
}
|
||||
}
|
||||
|
||||
if(vg(tv, sb != null)) {
|
||||
tv.text = sb
|
||||
tv.movementMethod = MyLinkMovementMethod
|
||||
invalidator?.register(sb)
|
||||
}else{
|
||||
invalidator?.clear()
|
||||
}
|
||||
tv.vg(sb != null)
|
||||
?.apply {
|
||||
text = sb
|
||||
movementMethod = MyLinkMovementMethod
|
||||
invalidator?.register(sb)
|
||||
}
|
||||
?: invalidator?.clear()
|
||||
|
||||
return sb
|
||||
}
|
||||
@ -496,11 +496,10 @@ open class TootAccount(parser : TootParser, src : JSONObject) {
|
||||
|
||||
return "$user@$host"
|
||||
}
|
||||
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
|
||||
private fun parseSource(src : JSONObject?) : Source? {
|
||||
src ?: return null
|
||||
return try {
|
||||
|
@ -59,8 +59,8 @@ object DlgCreateAccount {
|
||||
).neatSpaces()
|
||||
|
||||
val showReason = instanceInfo?.approval_required ?: false
|
||||
vg(tvReasonCaption, showReason)
|
||||
vg(etReason, showReason)
|
||||
tvReasonCaption.vg(showReason)
|
||||
etReason.vg(showReason)
|
||||
|
||||
val listener : View.OnClickListener = View.OnClickListener { v ->
|
||||
when(v.id) {
|
||||
|
@ -62,9 +62,9 @@ fun View.showKeyboard() {
|
||||
|
||||
// set visibility VISIBLE or GONE
|
||||
// return true if visible
|
||||
fun vg(v : View, visible : Boolean) : Boolean {
|
||||
v.visibility = if(visible) View.VISIBLE else View.GONE
|
||||
return visible
|
||||
fun <T : View> T?.vg(visible : Boolean) : T? {
|
||||
this?.visibility = if(visible) View.VISIBLE else View.GONE
|
||||
return if(visible) this else null
|
||||
}
|
||||
|
||||
fun ViewGroup.generateLayoutParamsEx() : ViewGroup.LayoutParams? =
|
||||
|
Loading…
x
Reference in New Issue
Block a user