(Mastodon 3.2)投稿時に添付メディアがなくてもNSFWを指定できる。それはプレビューカードのサムネイル表示に影響する。

This commit is contained in:
tateisu 2020-07-19 10:16:31 +09:00
parent 7a3b5bc5ae
commit 1f64df766e
5 changed files with 38 additions and 26 deletions

View File

@ -44,7 +44,7 @@
</value>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="JDK" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" project-jdk-name="JDK" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">

View File

@ -877,9 +877,7 @@ class ActPost : AsyncActivity(),
}
}
if(this.attachment_list.isNotEmpty()) {
cbNSFW.isChecked = base_status.sensitive == true
}
cbNSFW.isChecked = base_status.sensitive == true
// 再編集の場合はdefault_textは反映されない
@ -999,9 +997,7 @@ class ActPost : AsyncActivity(),
log.trace(ex)
}
}
if(this.attachment_list.isNotEmpty()) {
cbNSFW.isChecked = item.sensitive
}
cbNSFW.isChecked = item.sensitive
}
} catch(ex : Throwable) {
log.trace(ex)
@ -2350,7 +2346,11 @@ class ActPost : AsyncActivity(),
if(pa.attachment == null) {
pa.status = PostAttachment.STATUS_UPLOAD_FAILED
if(result != null) {
showToast(this@ActPost, true, "${result.error} ${result.response?.request?.method} ${result.response?.request?.url}" )
showToast(
this@ActPost,
true,
"${result.error} ${result.response?.request?.method} ${result.response?.request?.url}"
)
}
} else {
pa.status = PostAttachment.STATUS_UPLOADED

View File

@ -128,7 +128,7 @@ internal class ItemViewHolder(
private lateinit var llCardImage : View
private lateinit var ivCardImage : MyNetworkImageView
private lateinit var btnCardImageHide : ImageButton
private lateinit var btnCardImageShow : Button
private lateinit var btnCardImageShow : BlurhashView
private lateinit var llExtra : LinearLayout
@ -2338,7 +2338,9 @@ internal class ItemViewHolder(
val imageUrl = access_info.supplyBaseUrl(image)
ivCardImage.setImageUrl(activity.pref, 0f, imageUrl, imageUrl)
btnCardImageShow.blurhash = card.blurhash
// show about card outer
bShowOuter = true
@ -3682,13 +3684,12 @@ internal class ItemViewHolder(
}
}
btnCardImageShow = button {
btnCardImageShow = blurhashView {
backgroundColor = getAttributeColor(
errorColor = getAttributeColor(
context,
R.attr.colorShowMediaBackground
)
gravity = Gravity.CENTER
textColor = getAttributeColor(

View File

@ -26,6 +26,8 @@ class TootCard(
val provider_name : String? = null,
val provider_url : String? = null,
val blurhash : String? = null,
val originalStatus : TootStatus? = null
) {
@ -39,8 +41,8 @@ class TootCard(
author_name = src.string("author_name"),
author_url = src.string("author_url"),
provider_name = src.string("provider_name"),
provider_url = src.string("provider_url")
provider_url = src.string("provider_url"),
blurhash = src.string("blurhash")
)
constructor(parser : TootParser, src : TootStatus) : this(

View File

@ -119,6 +119,7 @@
android:id="@+id/ivMedia1"
android:layout_width="48dp"
android:layout_height="match_parent"
android:layout_marginEnd="4dp"
android:background="@drawable/btn_bg_transparent_round6dp"
android:scaleType="fitCenter" />
@ -126,7 +127,7 @@
android:id="@+id/ivMedia2"
android:layout_width="48dp"
android:layout_height="match_parent"
android:layout_marginStart="4dp"
android:layout_marginEnd="4dp"
android:background="@drawable/btn_bg_transparent_round6dp"
android:scaleType="fitCenter" />
@ -134,7 +135,7 @@
android:id="@+id/ivMedia3"
android:layout_width="48dp"
android:layout_height="match_parent"
android:layout_marginStart="4dp"
android:layout_marginEnd="4dp"
android:background="@drawable/btn_bg_transparent_round6dp"
android:scaleType="fitCenter" />
@ -142,25 +143,33 @@
android:id="@+id/ivMedia4"
android:layout_width="48dp"
android:layout_height="match_parent"
android:layout_marginStart="4dp"
android:layout_marginEnd="4dp"
android:background="@drawable/btn_bg_transparent_round6dp"
android:scaleType="fitCenter" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:orientation="horizontal">
<CheckBox
android:id="@+id/cbNSFW"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|start"
android:layout_marginStart="4dp"
android:layout_marginEnd="4dp"
android:text="@string/nsfw" />
</LinearLayout>
<CheckBox
android:id="@+id/cbContentWarning"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:text="@string/content_warning" />
<CheckBox
android:id="@+id/cbContentWarning"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|start"
android:layout_weight="1"
android:text="@string/content_warning" />
</LinearLayout>
<FrameLayout
android:layout_width="match_parent"