アプリ設定に「区切り線の色」を追加

This commit is contained in:
tateisu 2018-08-15 19:22:19 +09:00
parent e252e7ae34
commit 0d38b086a4
11 changed files with 85 additions and 42 deletions

View File

@ -71,9 +71,9 @@
<category android:name="android.intent.category.BROWSABLE"/>
<data
android:scheme="subwaytooter"
android:host="*"
android:pathPattern=".*"
android:scheme="subwaytooter"
/>
</intent-filter>
@ -84,9 +84,9 @@
<category android:name="android.intent.category.BROWSABLE"/>
<data
android:scheme="https"
android:host="*"
android:pathPrefix="/@"
android:scheme="https"
/>
</intent-filter>
@ -248,12 +248,11 @@
<receiver android:name=".DownloadReceiver">
<intent-filter>
<action android:name="android.intent.action.DOWNLOAD_NOTIFICATION_CLICKED" />
<action android:name="android.intent.action.DOWNLOAD_COMPLETE" />
<action android:name="android.intent.action.DOWNLOAD_NOTIFICATION_CLICKED"/>
<action android:name="android.intent.action.DOWNLOAD_COMPLETE"/>
</intent-filter>
</receiver>
<!-- okhttp3クライアントを指定する必要があるため、マニフェスト経由での組み込みは行わない -->
<!--<meta-data-->
<!--android:name="com.bumptech.glide.integration.okhttp3.OkHttpGlideModule"-->
@ -269,7 +268,7 @@
</service>
<!-- Set custom default icon. This is used when no icon is set for incoming notification messages.
See README(https://goo.gl/l4GJaQ) for more. -->
See README(https://goo.gl/l4GJaQ) for more. -->
<meta-data
android:name="com.google.firebase.messaging.default_notification_icon"
android:resource="@drawable/ic_notification"

View File

@ -69,6 +69,7 @@ class ActAppSetting : AppCompatActivity()
internal const val COLOR_DIALOG_ID_FOOTER_TAB_BG = 3
internal const val COLOR_DIALOG_ID_FOOTER_TAB_DIVIDER = 4
internal const val COLOR_DIALOG_ID_FOOTER_TAB_INDICATOR = 5
internal const val COLOR_DIALOG_ID_LIST_DIVIDER = 6
internal const val REQUEST_CODE_TIMELINE_FONT = 1
internal const val REQUEST_CODE_TIMELINE_FONT_BOLD = 2
@ -108,6 +109,7 @@ class ActAppSetting : AppCompatActivity()
private var footer_tab_bg_color : Int = 0
private var footer_tab_divider_color : Int = 0
private var footer_tab_indicator_color : Int = 0
private var list_divider_color : Int = 0
private lateinit var ivFooterToot : ImageView
private lateinit var ivFooterMenu : ImageView
@ -262,6 +264,8 @@ class ActAppSetting : AppCompatActivity()
findViewById<View>(R.id.btnTabDividerColorReset).setOnClickListener(this)
findViewById<View>(R.id.btnTabIndicatorColorEdit).setOnClickListener(this)
findViewById<View>(R.id.btnTabIndicatorColorReset).setOnClickListener(this)
findViewById<View>(R.id.btnListDividerColorEdit).setOnClickListener(this)
findViewById<View>(R.id.btnListDividerColorReset).setOnClickListener(this)
findViewById<View>(R.id.btnTimelineFontEdit).setOnClickListener(this)
findViewById<View>(R.id.btnTimelineFontReset).setOnClickListener(this)
@ -370,6 +374,7 @@ class ActAppSetting : AppCompatActivity()
footer_tab_bg_color = Pref.ipFooterTabBgColor(pref)
footer_tab_divider_color = Pref.ipFooterTabDividerColor(pref)
footer_tab_indicator_color = Pref.ipFooterTabIndicatorColor(pref)
list_divider_color = Pref.ipListDividerColor(pref)
etColumnWidth.setText(Pref.spColumnWidth(pref))
etMediaThumbHeight.setText(Pref.spMediaThumbHeight(pref))
@ -463,6 +468,7 @@ class ActAppSetting : AppCompatActivity()
.put(Pref.ipFooterTabBgColor, footer_tab_bg_color)
.put(Pref.ipFooterTabDividerColor, footer_tab_divider_color)
.put(Pref.ipFooterTabIndicatorColor, footer_tab_indicator_color)
.put(Pref.ipListDividerColor, list_divider_color)
.apply()
@ -551,7 +557,18 @@ class ActAppSetting : AppCompatActivity()
saveUIToData()
showFooterColor()
}
R.id.btnListDividerColorEdit -> openColorPicker(
COLOR_DIALOG_ID_LIST_DIVIDER,
list_divider_color,
true
)
R.id.btnListDividerColorReset -> {
list_divider_color = 0
saveUIToData()
}
R.id.btnTimelineFontReset -> {
timeline_font = ""
saveUIToData()
@ -673,6 +690,11 @@ class ActAppSetting : AppCompatActivity()
saveUIToData()
showFooterColor()
}
COLOR_DIALOG_ID_LIST_DIVIDER ->{
list_divider_color = if(colorSelected == 0) 0x01000000 else colorSelected
saveUIToData()
}
}
}

View File

@ -65,6 +65,7 @@ import jp.juggler.subwaytooter.view.MyEditText
import jp.juggler.subwaytooter.span.MyClickableSpan
import jp.juggler.subwaytooter.span.MyClickableSpanClickCallback
import jp.juggler.subwaytooter.util.*
import jp.juggler.subwaytooter.view.ListDivider
class ActMain : AppCompatActivity()
, NavigationView.OnNavigationItemSelectedListener
@ -105,6 +106,7 @@ class ActMain : AppCompatActivity()
@Suppress("HasPlatformType")
val reStatusPage = Pattern.compile("\\Ahttps://([^/]+)/@([A-Za-z0-9_]+)/(\\d+)(?:\\z|[?#])")
}
// @Override
@ -451,6 +453,9 @@ class ActMain : AppCompatActivity()
bStart = true
log.d("onStart")
// カラーカスタマイズを読み直す
ListDivider.color = Pref.ipListDividerColor(pref)
// アカウント設定から戻ってきたら、カラムを消す必要があるかもしれない
run {
val new_order = ArrayList<Int>()
@ -1149,16 +1154,8 @@ class ActMain : AppCompatActivity()
llEmpty = findViewById(R.id.llEmpty)
// // toolbar
// Toolbar toolbar = (Toolbar) findViewById( R.id.toolbar );
// setSupportActionBar( toolbar );
// navigation drawer
drawer = findViewById(R.id.drawer_layout)
// ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
// this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close );
drawer.addDrawerListener(this)
// toggle.syncState();
val navigationView = findViewById<NavigationView>(R.id.nav_view)
navigationView.setNavigationItemSelectedListener(this)

View File

@ -532,7 +532,7 @@ class ActPost : AppCompatActivity(), View.OnClickListener, PostAttachment.Callba
val account = this.account
var sv = intent.getStringExtra(KEY_REPLY_STATUS)
sv = intent.getStringExtra(KEY_REPLY_STATUS)
if(sv != null && account != null) {
try {
val reply_status = TootParser(this@ActPost, account).status(sv.toJsonObject())

View File

@ -1,22 +0,0 @@
package jp.juggler.subwaytooter
import com.google.firebase.iid.FirebaseInstanceId
import com.google.firebase.iid.FirebaseInstanceIdService
import jp.juggler.subwaytooter.util.LogCategory
class MyFirebaseInstanceIDService : FirebaseInstanceIdService() {
companion object {
internal val log = LogCategory("MyFirebaseInstanceIDService")
}
// Called when the system determines that the tokens need to be refreshed.
override fun onTokenRefresh() {
super.onTokenRefresh()
}
}

View File

@ -328,6 +328,7 @@ object Pref {
val ipFooterTabBgColor = IntPref("footer_tab_bg_color", 0)
val ipFooterTabDividerColor = IntPref("footer_tab_divider_color", 0)
val ipFooterTabIndicatorColor = IntPref("footer_tab_indicator_color", 0)
val ipListDividerColor = IntPref("listDividerColor", 0)
val ipLastColumnPos = IntPref("last_column_pos", - 1)
// val ipTrendTagCountShowing = IntPref("TrendTagCountShowing", 0)

View File

@ -2,9 +2,9 @@ package jp.juggler.subwaytooter.view
import android.content.Context
import android.graphics.Canvas
import android.graphics.Paint
import android.graphics.Rect
import android.support.v7.widget.RecyclerView
import android.graphics.drawable.Drawable
import android.view.View
import jp.juggler.subwaytooter.R
import jp.juggler.subwaytooter.Styler
@ -12,14 +12,21 @@ import jp.juggler.subwaytooter.Styler
class ListDivider(context : Context) : RecyclerView.ItemDecoration() {
companion object {
var color :Int =0
var height : Int = 0
}
private val drawable : Drawable
private val drawable = Styler.getAttributeDrawable(context, R.attr.colorSettingDivider)
private val paint = Paint()
private val rect = Rect()
init {
drawable = Styler.getAttributeDrawable(context, R.attr.colorSettingDivider)
height = (context.resources.displayMetrics.density * 1f + 0.5f).toInt()
paint.style = Paint.Style.FILL
paint.isAntiAlias = true
}
override fun getItemOffsets(
@ -35,13 +42,22 @@ class ListDivider(context : Context) : RecyclerView.ItemDecoration() {
val left = parent.paddingLeft
val right = parent.width - parent.paddingRight
if( color != 0){
paint.color = color
}
for(i in 0 until parent.childCount) {
val child = parent.getChildAt(i)
val params = child.layoutParams as RecyclerView.LayoutParams
val top = child.bottom + params.bottomMargin
val bottom = top + height
drawable.setBounds(left, top, right, bottom)
drawable.draw(canvas)
if( color != 0){
rect.set(left, top, right, bottom)
canvas.drawRect(rect,paint)
}else {
drawable.setBounds(left, top, right, bottom)
drawable.draw(canvas)
}
}
}

View File

@ -1151,6 +1151,33 @@
<View style="@style/setting_divider"/>
<TextView
style="@style/setting_row_label"
android:text="@string/list_divider_color"
/>
<LinearLayout style="@style/setting_row_form">
<Button
android:id="@+id/btnListDividerColorEdit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/edit"
android:textAllCaps="false"
/>
<Button
android:id="@+id/btnListDividerColorReset"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/reset"
android:textAllCaps="false"
/>
</LinearLayout>
<View style="@style/setting_divider"/>
<TextView
style="@style/setting_row_label"
android:text="@string/timeline_font"

View File

@ -730,6 +730,7 @@
<string name="delete_succeeded_confirm">The user \"%1$s\" will be removed from follow suggestion. Are you sure?</string>
<string name="toot_context_parse_failed">conversation parse failed.</string>
<string name="toot_default_text">Default text when composing toot. (not affected to quick toot bar and switching account in toot composing screen)</string>
<string name="list_divider_color">List divider color</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>-->

View File

@ -1009,5 +1009,6 @@
<string name="delete_succeeded_confirm">ユーザ \"%1$s\" はフォロー推奨から削除されます。よろしいですか?</string>
<string name="toot_context_parse_failed">会話データのデコードに失敗</string>
<string name="toot_default_text">トゥート作成時のデフォルトテキスト (簡易投稿や投稿画面でのアカウント切り替えには影響しません)</string>
<string name="list_divider_color">区切り線の色</string>
</resources>

View File

@ -716,4 +716,5 @@
<string name="delete_succeeded_confirm">The user \"%1$s\" will be removed from follow suggestion. Are you sure?</string>
<string name="toot_context_parse_failed">conversation parse failed.</string>
<string name="toot_default_text">Default text when composing toot. (not affected to quick toot bar and switching account in toot composing screen)</string>
<string name="list_divider_color">List divider color</string>
</resources>