アプリ設定に「添付メディア/サムネイルを縦に並べる」を追加

This commit is contained in:
tateisu 2018-03-22 00:39:10 +09:00
parent b00e3021f6
commit 97b2d5016a
8 changed files with 236 additions and 89 deletions

View File

@ -12,8 +12,8 @@ android {
minSdkVersion 21
targetSdkVersion 27
versionCode 229
versionName "2.2.9"
versionCode 230
versionName "2.3.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

View File

@ -173,8 +173,7 @@ internal class ItemViewHolder(
btnHideMedia.setOnClickListener(this)
val lp = flMedia.layoutParams
lp.height = activity.app_state.media_thumb_height
this.content_color_default = tvContent.textColors.defaultColor
@ -738,11 +737,11 @@ internal class ItemViewHolder(
if(url != null && url.isNotEmpty()) {
iv.visibility = View.VISIBLE
iv.setFocusPoint( ta.focusX, ta.focusY )
iv.setFocusPoint(ta.focusX, ta.focusY)
if( Pref.bpDontCropMediaThumb(App1.pref) ){
if(Pref.bpDontCropMediaThumb(App1.pref)) {
iv.scaleType = ImageView.ScaleType.FIT_CENTER
}else{
} else {
iv.setScaleTypeForMedia()
}
@ -896,9 +895,15 @@ internal class ItemViewHolder(
activity.addColumn(pos, access_info, Column.TYPE_LIST_TL, item.id)
}
.addAction(activity.getString(R.string.list_member)) {
activity.addColumn(false,pos, access_info, Column.TYPE_LIST_MEMBER, item.id)
activity.addColumn(
false,
pos,
access_info,
Column.TYPE_LIST_MEMBER,
item.id
)
}
.addAction(activity.getString(R.string.rename)){
.addAction(activity.getString(R.string.rename)) {
Action_List.rename(activity, access_info, item)
}
.addAction(activity.getString(R.string.delete)) {
@ -1449,98 +1454,206 @@ internal class ItemViewHolder(
topMargin = dip(3)
}
flMedia = frameLayout {
lparams(matchParent, dip(64)) {
topMargin = dip(3)
val actMain = activity as? ActMain
val thumbnailHeight = actMain?.app_state?.media_thumb_height ?: dip(64)
val verticalArrangeThumbnails = Pref.bpVerticalArrangeThumbnails( actMain?.pref ?: Pref.pref(context))
flMedia = if(verticalArrangeThumbnails ) {
frameLayout {
lparams(matchParent, wrapContent ) {
topMargin = dip(3)
}
llMedia = verticalLayout {
lparams(matchParent, matchParent)
btnHideMedia = imageButton {
background = ContextCompat.getDrawable(
context,
R.drawable.btn_bg_transparent
)
contentDescription = "@string/hide"
imageResource =
Styler.getAttributeResourceId(
context,
R.attr.btn_close
)
}.lparams(dip(32),dip(32)) {
gravity = Gravity.END
}
ivMedia1 = myNetworkImageView {
background = ContextCompat.getDrawable(
context,
R.drawable.bg_thumbnail
)
contentDescription =
context.getString(R.string.thumbnail)
scaleType = ImageView.ScaleType.CENTER_CROP
}.lparams(matchParent, thumbnailHeight) {
topMargin = dip(3)
}
ivMedia2 = myNetworkImageView {
background = ContextCompat.getDrawable(
context,
R.drawable.bg_thumbnail
)
contentDescription =
context.getString(R.string.thumbnail)
scaleType = ImageView.ScaleType.CENTER_CROP
}.lparams(matchParent, thumbnailHeight) {
topMargin = dip(3)
}
ivMedia3 = myNetworkImageView {
background = ContextCompat.getDrawable(
context,
R.drawable.bg_thumbnail
)
contentDescription =
context.getString(R.string.thumbnail)
scaleType = ImageView.ScaleType.CENTER_CROP
}.lparams(matchParent, thumbnailHeight) {
topMargin = dip(3)
}
ivMedia4 = myNetworkImageView {
background = ContextCompat.getDrawable(
context,
R.drawable.bg_thumbnail
)
contentDescription =
context.getString(R.string.thumbnail)
scaleType = ImageView.ScaleType.CENTER_CROP
}.lparams(matchParent, thumbnailHeight) {
topMargin = dip(3)
}
}
btnShowMedia = textView {
backgroundColor = Styler.getAttributeColor(
context,
R.attr.colorShowMediaBackground
)
gravity = Gravity.CENTER_VERTICAL or Gravity.END
text = context.getString(R.string.tap_to_show)
textColor =
Styler.getAttributeColor(context, R.attr.colorShowMediaText)
endPadding=dip(4)
minHeightCompat = dip(32)
}.lparams(matchParent, matchParent)
}
llMedia = linearLayout {
lparams(matchParent, matchParent)
ivMedia1 = myNetworkImageView {
} else {
frameLayout {
lparams(matchParent, thumbnailHeight) {
topMargin = dip(3)
}
llMedia = linearLayout {
lparams(matchParent, matchParent)
ivMedia1 = myNetworkImageView {
background = ContextCompat.getDrawable(
context,
R.drawable.bg_thumbnail
)
contentDescription =
context.getString(R.string.thumbnail)
scaleType = ImageView.ScaleType.CENTER_CROP
}.lparams(0, matchParent) {
weight = 1f
}
background = ContextCompat.getDrawable(
context,
R.drawable.bg_thumbnail
)
contentDescription = context.getString(R.string.thumbnail)
scaleType = ImageView.ScaleType.CENTER_CROP
ivMedia2 = myNetworkImageView {
background = ContextCompat.getDrawable(
context,
R.drawable.bg_thumbnail
)
contentDescription =
context.getString(R.string.thumbnail)
scaleType = ImageView.ScaleType.CENTER_CROP
}.lparams(0, matchParent) {
startMargin = dip(8)
weight = 1f
}
}.lparams(0, matchParent) {
weight = 1f
ivMedia3 = myNetworkImageView {
background = ContextCompat.getDrawable(
context,
R.drawable.bg_thumbnail
)
contentDescription =
context.getString(R.string.thumbnail)
scaleType = ImageView.ScaleType.CENTER_CROP
}.lparams(0, matchParent) {
startMargin = dip(8)
weight = 1f
}
ivMedia4 = myNetworkImageView {
background = ContextCompat.getDrawable(
context,
R.drawable.bg_thumbnail
)
contentDescription =
context.getString(R.string.thumbnail)
scaleType = ImageView.ScaleType.CENTER_CROP
}.lparams(0, matchParent) {
startMargin = dip(8)
weight = 1f
}
btnHideMedia = imageButton {
background = ContextCompat.getDrawable(
context,
R.drawable.btn_bg_transparent
)
contentDescription = "@string/hide"
imageResource =
Styler.getAttributeResourceId(
context,
R.attr.btn_close
)
}.lparams(dip(32), matchParent) {
startMargin = dip(8)
}
}
ivMedia2 = myNetworkImageView {
btnShowMedia = textView {
background = ContextCompat.getDrawable(
backgroundColor = Styler.getAttributeColor(
context,
R.drawable.bg_thumbnail
R.attr.colorShowMediaBackground
)
contentDescription = context.getString(R.string.thumbnail)
scaleType = ImageView.ScaleType.CENTER_CROP
gravity = Gravity.CENTER
text = context.getString(R.string.tap_to_show)
textColor =
Styler.getAttributeColor(context, R.attr.colorShowMediaText)
}.lparams(0, matchParent) {
startMargin = dip(8)
weight = 1f
}
ivMedia3 = myNetworkImageView {
background = ContextCompat.getDrawable(
context,
R.drawable.bg_thumbnail
)
contentDescription = context.getString(R.string.thumbnail)
scaleType = ImageView.ScaleType.CENTER_CROP
}.lparams(0, matchParent) {
startMargin = dip(8)
weight = 1f
}
ivMedia4 = myNetworkImageView {
background = ContextCompat.getDrawable(
context,
R.drawable.bg_thumbnail
)
contentDescription = context.getString(R.string.thumbnail)
scaleType = ImageView.ScaleType.CENTER_CROP
}.lparams(0, matchParent) {
startMargin = dip(8)
weight = 1f
}
btnHideMedia = imageButton {
background = ContextCompat.getDrawable(
context,
R.drawable.btn_bg_transparent
)
contentDescription = "@string/hide"
imageResource =
Styler.getAttributeResourceId(context, R.attr.btn_close)
}.lparams(dip(32), matchParent) {
startMargin = dip(8)
}
}.lparams(matchParent, matchParent)
}
btnShowMedia = textView {
backgroundColor = Styler.getAttributeColor(
context,
R.attr.colorShowMediaBackground
)
gravity = Gravity.CENTER
text = context.getString(R.string.tap_to_show)
textColor =
Styler.getAttributeColor(context, R.attr.colorShowMediaText)
}.lparams(matchParent, matchParent)
}
llExtra = verticalLayout {
lparams(matchParent, wrapContent) {

View File

@ -294,6 +294,12 @@ object Pref {
R.id.swAppendAttachmentUrlToContent
)
val bpVerticalArrangeThumbnails = BooleanPref(
"VerticalArrangeThumbnails",
false,
R.id.swVerticalArrangeThumbnails
)
// int

View File

@ -41,9 +41,17 @@ fun View.setPaddingStartEnd(start : Int, end : Int) {
// XMLのandroid:minWidthと同じことをしたい場合、View#setMinimumWidthとTextView#setMinWidthの両方を呼び出す必要がある
// http://www.thekingsmuseum.info/entry/2015/12/01/233134
var TextView.minWidthCompat : Int
get() = minWidth
set(value) {
minimumWidth = value
minWidth = value
}
var TextView.minHeightCompat : Int
get() = minHeight
set(value) {
minimumHeight = value
minHeight = value
}

View File

@ -608,6 +608,23 @@
</LinearLayout>
<View style="@style/setting_divider"/>
<TextView
style="@style/setting_row_label"
android:text="@string/thumbnails_arrange_vertically"
/>
<LinearLayout style="@style/setting_row_form">
<Switch
android:id="@+id/swVerticalArrangeThumbnails"
style="@style/setting_horizontal_stretch"
/>
</LinearLayout>
<View style="@style/setting_divider"/>
<!-- =============================================== -->

View File

@ -628,8 +628,9 @@
<string name="fav_muted_user_long">Fav/Boost notification disabled users</string>
<string name="changed">changed.</string>
<string name="thumbnails_arrange_vertically">Vertical arrange thumbnails (app restart required)</string>
<!--<string name="abc_action_bar_home_description">Revenir à l\'accueil</string>-->
<!--<string name="abc_action_bar_home_description">Revenir à l\'accueil</string>-->
<!--<string name="abc_action_bar_home_description_format">%1$s, %2$s</string>-->
<!--<string name="abc_action_bar_home_subtitle_description_format">%1$s, %2$s, %3$s</string>-->
<!--<string name="abc_action_bar_up_description">Revenir en haut de la page</string>-->

View File

@ -910,5 +910,6 @@
<string name="fav_muted_user_long">Fav/BT非通知ユーザ</string>
<string name="changed">変更しました</string>
<string name="thumbnails_arrange_vertically">サムネイルを縦に並べる (アプリ再起動が必要)</string>
</resources>

View File

@ -615,4 +615,5 @@
<string name="fav_muted_user">FBN disabled users</string>
<string name="fav_muted_user_long">Fav/Boost notification disabled users</string>
<string name="changed">changed.</string>
<string name="thumbnails_arrange_vertically">Vertical arrange thumbnails (app restart required)</string>
</resources>