parent
f0f5e699b9
commit
201fbe843e
@ -0,0 +1,22 @@ |
|||||||
|
package io.legado.app.ui.widget.prefs |
||||||
|
|
||||||
|
import android.content.Context |
||||||
|
import android.util.AttributeSet |
||||||
|
import android.widget.TextView |
||||||
|
import androidx.preference.PreferenceViewHolder |
||||||
|
import io.legado.app.R |
||||||
|
|
||||||
|
class EditTextPreference(context: Context, attrs: AttributeSet) : androidx.preference.EditTextPreference(context, attrs) { |
||||||
|
|
||||||
|
init { |
||||||
|
// isPersistent = true |
||||||
|
layoutResource = R.layout.view_preference |
||||||
|
} |
||||||
|
|
||||||
|
override fun onBindViewHolder(holder: PreferenceViewHolder?) { |
||||||
|
super.onBindViewHolder(holder) |
||||||
|
val txt = if (text == null || text.isEmpty()) summary else text |
||||||
|
val v = Preference.bindView<TextView>(context, holder, icon, title, txt, null, null) |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,101 @@ |
|||||||
|
package io.legado.app.ui.widget.prefs |
||||||
|
|
||||||
|
import android.content.Context |
||||||
|
import android.content.ContextWrapper |
||||||
|
import android.content.res.TypedArray |
||||||
|
import android.graphics.Color |
||||||
|
import android.graphics.drawable.Drawable |
||||||
|
import android.media.Image |
||||||
|
import android.os.Bundle |
||||||
|
import android.util.AttributeSet |
||||||
|
import android.view.LayoutInflater |
||||||
|
import android.view.View |
||||||
|
import android.view.ViewGroup |
||||||
|
import android.widget.FrameLayout |
||||||
|
import android.widget.ImageView |
||||||
|
import android.widget.TextView |
||||||
|
import androidx.annotation.ColorInt |
||||||
|
import androidx.annotation.StringRes |
||||||
|
import androidx.appcompat.app.AlertDialog |
||||||
|
import androidx.appcompat.widget.SwitchCompat |
||||||
|
import androidx.core.view.isVisible |
||||||
|
import androidx.core.view.updateLayoutParams |
||||||
|
import androidx.fragment.app.FragmentActivity |
||||||
|
import androidx.preference.Preference |
||||||
|
import androidx.preference.PreferenceViewHolder |
||||||
|
import com.jaredrummler.android.colorpicker.* |
||||||
|
import io.legado.app.lib.theme.ATH |
||||||
|
import io.legado.app.R |
||||||
|
import io.legado.app.lib.theme.accentColor |
||||||
|
import org.jetbrains.anko.imageBitmap |
||||||
|
import org.jetbrains.anko.layoutInflater |
||||||
|
import kotlin.math.roundToInt |
||||||
|
|
||||||
|
class Preference(context: Context, attrs: AttributeSet) : androidx.preference.Preference(context, attrs) { |
||||||
|
|
||||||
|
init { |
||||||
|
// isPersistent = true |
||||||
|
layoutResource = R.layout.view_preference |
||||||
|
} |
||||||
|
|
||||||
|
companion object { |
||||||
|
|
||||||
|
fun <T: View> bindView(context: Context, it: PreferenceViewHolder?, icon: Drawable?, title: CharSequence?, summary: CharSequence?, weightLayoutRes: Int?, viewId: Int?, |
||||||
|
weightWidth: Int = 0, weightHeight: Int = 0): T? { |
||||||
|
if (it == null) return null |
||||||
|
val view = it.findViewById(R.id.preference_title) |
||||||
|
if (view is TextView) { // && !view.isInEditMode |
||||||
|
view.text = title |
||||||
|
view.isVisible = title != null && title.isNotEmpty() |
||||||
|
|
||||||
|
val tv_summary = it.findViewById(R.id.preference_desc) |
||||||
|
if(tv_summary is TextView) { |
||||||
|
tv_summary.text = summary |
||||||
|
tv_summary.isVisible = summary != null && summary.isNotEmpty() |
||||||
|
} |
||||||
|
|
||||||
|
val _icon = it.findViewById(R.id.preference_icon) |
||||||
|
if (_icon is ImageView) { |
||||||
|
_icon.isVisible = icon != null && icon.isVisible |
||||||
|
_icon.setImageDrawable(icon) |
||||||
|
_icon.setColorFilter(context.accentColor) |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
if (weightLayoutRes != null && weightLayoutRes != 0 && viewId != null && viewId != 0) { |
||||||
|
val lay = it.findViewById(R.id.preference_widget) |
||||||
|
if (lay is FrameLayout) { |
||||||
|
var v = it.itemView.findViewById<T>(viewId) |
||||||
|
if (v == null) { |
||||||
|
val inflater: LayoutInflater = context.layoutInflater |
||||||
|
val childView = inflater.inflate(weightLayoutRes, null) |
||||||
|
lay.removeAllViews() |
||||||
|
lay.addView(childView) |
||||||
|
lay.isVisible = true |
||||||
|
v = lay.findViewById<T>(viewId) |
||||||
|
} |
||||||
|
|
||||||
|
if (weightWidth > 0 || weightHeight > 0) { |
||||||
|
val lp = lay.layoutParams |
||||||
|
if (weightHeight > 0) |
||||||
|
lp.height = (context.resources.displayMetrics.density * weightHeight).roundToInt() |
||||||
|
if (weightWidth > 0) |
||||||
|
lp.width = (context.resources.displayMetrics.density * weightWidth).roundToInt() |
||||||
|
lay.layoutParams = lp |
||||||
|
} |
||||||
|
|
||||||
|
return v |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
return null |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
override fun onBindViewHolder(holder: PreferenceViewHolder?) { |
||||||
|
super.onBindViewHolder(holder) |
||||||
|
bindView<View>(context, holder, icon, title, summary, null, null) |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,10 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<ripple xmlns:android="http://schemas.android.com/apk/res/android" |
||||||
|
android:color="@color/btn_bg_press"> |
||||||
|
<item> |
||||||
|
<shape android:shape="rectangle"> |
||||||
|
<solid android:color="@color/background_prefs" /> |
||||||
|
<corners android:radius="0dp" /> |
||||||
|
</shape> |
||||||
|
</item> |
||||||
|
</ripple> |
@ -0,0 +1,15 @@ |
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android" |
||||||
|
android:width="24dp" |
||||||
|
android:height="24dp" |
||||||
|
android:viewportWidth="24" |
||||||
|
android:viewportHeight="24"> |
||||||
|
<path |
||||||
|
android:fillColor="#FF000000" |
||||||
|
android:pathData="M12,4.5A7.5,7.5 0,1 1,4.5 12,7.5 7.5,0 0,1 12,4.5M12,3a9,9 0,1 0,9 9,9 9,0 0,0 -9,-9Z"/> |
||||||
|
<path |
||||||
|
android:fillColor="#FF000000" |
||||||
|
android:pathData="M11.25,10.5h1.5v6h-1.5z"/> |
||||||
|
<path |
||||||
|
android:fillColor="#FF000000" |
||||||
|
android:pathData="M12,8.5m-1,0a1,1 0,1 1,2 0a1,1 0,1 1,-2 0"/> |
||||||
|
</vector> |
@ -0,0 +1,9 @@ |
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android" |
||||||
|
android:width="24dp" |
||||||
|
android:height="24dp" |
||||||
|
android:viewportWidth="24" |
||||||
|
android:viewportHeight="24"> |
||||||
|
<path |
||||||
|
android:fillColor="#FF000000" |
||||||
|
android:pathData="M9.94,4H5A2,2 0,0 0,3 6V18a2,2 0,0 0,2 2H19a2,2 0,0 0,2 -2V8a2,2 0,0 0,-2 -2H13.23a1.49,1.49 0,0 1,-1 -0.42L11,4.42a1.49,1.49 0,0 0,-1 -0.42ZM4.5,9.25V6A0.5,0.5 0,0 1,5 5.5H9.94l1.21,1.16a3,3 0,0 0,2.08 0.84H19a0.5,0.5 0,0 1,0.5 0.5V9.25ZM5,18.5a0.5,0.5 0,0 1,-0.5 -0.5V10.75h15V18a0.5,0.5 0,0 1,-0.5 0.5Z"/> |
||||||
|
</vector> |
@ -0,0 +1,5 @@ |
|||||||
|
<vector android:height="32dp" android:viewportHeight="24" |
||||||
|
android:viewportWidth="24" android:width="32dp" xmlns:android="http://schemas.android.com/apk/res/android"> |
||||||
|
<path android:fillColor="#FF000000" android:pathData="M12,4.5A7.5,7.5 0,1 1,4.5 12,7.5 7.5,0 0,1 12,4.5M12,3a9,9 0,1 0,9 9,9 9,0 0,0 -9,-9Z"/> |
||||||
|
<path android:fillColor="#FF000000" android:pathData="M12,5.25v13.5a6.75,6.75 0,0 0,0 -13.5Z"/> |
||||||
|
</vector> |
@ -0,0 +1,12 @@ |
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android" |
||||||
|
android:width="24dp" |
||||||
|
android:height="24dp" |
||||||
|
android:viewportWidth="24" |
||||||
|
android:viewportHeight="24"> |
||||||
|
<path |
||||||
|
android:fillColor="#FF000000" |
||||||
|
android:pathData="M12,4.5A7.5,7.5 0,1 1,4.5 12,7.5 7.5,0 0,1 12,4.5M12,3a9,9 0,1 0,9 9,9 9,0 0,0 -9,-9Z"/> |
||||||
|
<path |
||||||
|
android:fillColor="#FF000000" |
||||||
|
android:pathData="M15.01,7.25l-1.49,0l-1.51,2.59l-1.5,-2.59l-1.5,0l1.6,2.75l-1.6,0l0,1.5l2.24,0l0,1l-2.24,0l0,1.5l2.24,0l0,2.75l1.5,0l0,-2.75l2.24,0l0,-1.5l-2.24,0l0,-1l2.24,0l0,-1.5l-1.58,0l1.6,-2.75z"/> |
||||||
|
</vector> |
@ -0,0 +1,12 @@ |
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android" |
||||||
|
android:width="24dp" |
||||||
|
android:height="24dp" |
||||||
|
android:viewportWidth="24" |
||||||
|
android:viewportHeight="24"> |
||||||
|
<path |
||||||
|
android:fillColor="#FF000000" |
||||||
|
android:pathData="M12,10.5A1.5,1.5 0,1 1,10.5 12,1.5 1.5,0 0,1 12,10.5M12,9a3,3 0,1 0,3 3,3 3,0 0,0 -3,-3Z"/> |
||||||
|
<path |
||||||
|
android:fillColor="#FF000000" |
||||||
|
android:pathData="M15.62,5.5h0L19.28,12l-3.66,6.5H8.38L4.72,12 8.38,5.5h7.24m0,-1.5H8.38a1.5,1.5 0,0 0,-1.31 0.77L3.41,11.26a1.55,1.55 0,0 0,0 1.48l3.66,6.49A1.5,1.5 0,0 0,8.38 20h7.24a1.5,1.5 0,0 0,1.31 -0.77l3.66,-6.49a1.55,1.55 0,0 0,0 -1.48L16.93,4.77A1.5,1.5 0,0 0,15.62 4Z"/> |
||||||
|
</vector> |
@ -0,0 +1,12 @@ |
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android" |
||||||
|
android:width="24dp" |
||||||
|
android:height="24dp" |
||||||
|
android:viewportWidth="24" |
||||||
|
android:viewportHeight="24"> |
||||||
|
<path |
||||||
|
android:fillColor="#FF000000" |
||||||
|
android:pathData="M10.84,19.2V17.8a5.1,5.1 0,0 1,-5.13 -4.2,0.64 0.64,0 0,1 0.68,-0.7 0.87,0.87 0,0 1,0.82 0.69,3.66 3.66,0 0,0 3.63,2.81V15l3,2.1 -3,2.1Z"/> |
||||||
|
<path |
||||||
|
android:fillColor="#FF000000" |
||||||
|
android:pathData="M5.93,3 L3,10.52L4.61,10.52l0.62,-1.71h3l0.66,1.71h1.65L7.53,3ZM5.7,7.54l1,-2.79 1,2.79ZM20.63,17.69A2,2 0,0 0,19.57 17a1.76,1.76 0,0 0,0.78 -0.67,1.79 1.79,0 0,0 0,-1.84 2,2 0,0 0,-0.58 -0.63,1.91 1.91,0 0,0 -0.78,-0.31 8.48,8.48 0,0 0,-1.33 -0.08h-3L14.66,21h2.56c1,0 1.58,0 1.83,-0.05a2.21,2.21 0,0 0,1 -0.36,2 2,0 0,0 0.65,-0.77 2.23,2.23 0,0 0,0.24 -1A1.78,1.78 0,0 0,20.63 17.69ZM16.22,14.69h0.87c0.72,0 1.15,0 1.3,0A0.9,0.9 0,0 1,19 15a0.84,0.84 0,0 1,0.19 0.57,0.8 0.8,0 0,1 -0.22,0.59 1,1 0,0 1,-0.61 0.27c-0.14,0 -0.51,0 -1.1,0h-1ZM19.22,19.35a0.94,0.94 0,0 1,-0.55 0.3,7.41 7.41,0 0,1 -1,0L16.22,19.65v-2h1.23a5.11,5.11 0,0 1,1.34 0.11,1 1,0 0,1 0.48,0.34 1,1 0,0 1,0.16 0.58,0.93 0.93,0 0,1 -0.21,0.64Z"/> |
||||||
|
</vector> |
@ -0,0 +1,12 @@ |
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android" |
||||||
|
android:width="24dp" |
||||||
|
android:height="24dp" |
||||||
|
android:viewportWidth="24" |
||||||
|
android:viewportHeight="24"> |
||||||
|
<path |
||||||
|
android:fillColor="#FF000000" |
||||||
|
android:pathData="M20.59,4.2A15,15 0,0 0,18.12 4,20 20,0 0,0 12,5 20,20 0,0 0,5.88 4a15,15 0,0 0,-2.47 0.2c-0.24,0 -0.41,0.25 -0.41,1.1L3,18.68a0.48,0.48 0,0 0,0.49 0.48h0.08A14.08,14.08 0,0 1,5.88 19a19.58,19.58 0,0 1,5.39 0.8L12,20l0.66,-0.2A19.85,19.85 0,0 1,18.12 19a14.08,14.08 0,0 1,2.31 0.18h0.08a0.48,0.48 0,0 0,0.49 -0.49L21,4.7A0.5,0.5 0,0 0,20.59 4.2ZM11.27,18.2a21.47,21.47 0,0 0,-5.39 -0.74c-0.48,0 -1,0 -1.42,0.06v-12A13.24,13.24 0,0 1,5.88 5.5a19,19 0,0 1,5.39 0.85ZM19.54,17.52c-0.46,0 -0.94,-0.06 -1.42,-0.06a21.27,21.27 0,0 0,-5.39 0.74L12.73,6.35a19.14,19.14 0,0 1,5.39 -0.85,13.11 13.11,0 0,1 1.42,0.07Z"/> |
||||||
|
<path |
||||||
|
android:fillColor="#FF000000" |
||||||
|
android:pathData="M18.12,8.45l0.5,0V7l-0.5,0a19.49,19.49 0,0 0,-4.5 0.56V9.05A18.3,18.3 0,0 1,18.12 8.45Z"/> |
||||||
|
</vector> |
@ -0,0 +1,9 @@ |
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android" |
||||||
|
android:width="24dp" |
||||||
|
android:height="24dp" |
||||||
|
android:viewportWidth="24" |
||||||
|
android:viewportHeight="24"> |
||||||
|
<path |
||||||
|
android:fillColor="#FF000000" |
||||||
|
android:pathData="M20.37,4.75 L16,3H14.29A2.5,2.5 0,0 1,9.71 3H8L3.63,4.75A1,1 0,0 0,3 5.68V10a1.05,1.05 0,0 0,1 1.05,1 1,0 0,0 0.3,-0.05L6.5,10v9a2,2 0,0 0,2 2h7a2,2 0,0 0,2 -2V10l2.18,1A1,1 0,0 0,21 10V5.68A1,1 0,0 0,20.37 4.75ZM19.5,9.27 L16.72,8a0.51,0.51 0,0 0,-0.72 0.46V19a0.5,0.5 0,0 1,-0.5 0.5h-7A0.5,0.5 0,0 1,8 19V8.45A0.5,0.5 0,0 0,7.29 8L4.5,9.27V6L8.29,4.5H8.9a4,4 0,0 0,6.2 0h0.61L19.5,6Z"/> |
||||||
|
</vector> |
@ -0,0 +1,9 @@ |
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android" |
||||||
|
android:width="24dp" |
||||||
|
android:height="24dp" |
||||||
|
android:viewportWidth="24" |
||||||
|
android:viewportHeight="24"> |
||||||
|
<path |
||||||
|
android:fillColor="#FF000000" |
||||||
|
android:pathData="M19.62,7.23A8.83,8.83 0,0 0,18.72 6,9 9,0 0,0 13.24,3.1 3.86,3.86 0,0 0,12.75 3c-0.25,0 -0.5,0 -0.75,0s-0.5,0 -0.75,0a3.86,3.86 0,0 0,-0.49 0.06A9,9 0,0 0,5.28 6a8.83,8.83 0,0 0,-0.9 1.21,8.93 8.93,0 0,0 0,9.54A8.83,8.83 0,0 0,5.28 18a9,9 0,0 0,5.48 2.92,3.86 3.86,0 0,0 0.49,0.06c0.25,0 0.5,0 0.75,0s0.5,0 0.75,0a3.86,3.86 0,0 0,0.49 -0.06A9,9 0,0 0,18.72 18a8.83,8.83 0,0 0,0.9 -1.21,8.93 8.93,0 0,0 0,-9.54ZM19.46,11.23L16,11.23A13.84,13.84 0,0 0,15.67 9a13.7,13.7 0,0 0,2.65 -1A7.36,7.36 0,0 1,19.46 11.25ZM17.37,6.77a12.57,12.57 0,0 1,-2.1 0.78A13.83,13.83 0,0 0,14 4.77,7.56 7.56,0 0,1 17.37,6.77ZM12,14.5a14.51,14.51 0,0 0,-2.2 0.19,12.41 12.41,0 0,1 -0.26,-1.94h4.92a12.41,12.41 0,0 1,-0.26 1.94A14.51,14.51 0,0 0,12 14.5ZM13.78,16.14A12.69,12.69 0,0 1,12 19.47a12.69,12.69 0,0 1,-1.78 -3.33A13,13 0,0 1,12 16,13 13,0 0,1 13.78,16.14ZM9.54,11.25A12.41,12.41 0,0 1,9.8 9.31,14.51 14.51,0 0,0 12,9.5a14.51,14.51 0,0 0,2.2 -0.19,12.41 12.41,0 0,1 0.26,1.94ZM10.22,7.86A12.69,12.69 0,0 1,12 4.53a12.69,12.69 0,0 1,1.78 3.33A13,13 0,0 1,12 8,13 13,0 0,1 10.22,7.86ZM10,4.77a13.83,13.83 0,0 0,-1.3 2.78,12.57 12.57,0 0,1 -2.1,-0.78A7.56,7.56 0,0 1,10 4.77ZM8.33,9A13.84,13.84 0,0 0,8 11.25L4.54,11.25A7.36,7.36 0,0 1,5.68 8,13.7 13.7,0 0,0 8.33,9ZM4.54,12.75L8,12.75A13.84,13.84 0,0 0,8.33 15a13.7,13.7 0,0 0,-2.65 1A7.36,7.36 0,0 1,4.54 12.75ZM6.63,17.23a12.57,12.57 0,0 1,2.1 -0.78A13.83,13.83 0,0 0,10 19.23,7.56 7.56,0 0,1 6.63,17.23ZM13.97,19.23a13.83,13.83 0,0 0,1.3 -2.78,12.57 12.57,0 0,1 2.1,0.78A7.56,7.56 0,0 1,14 19.23ZM15.67,15A13.84,13.84 0,0 0,16 12.75h3.5A7.36,7.36 0,0 1,18.32 16,13.7 13.7,0 0,0 15.67,15Z"/> |
||||||
|
</vector> |
@ -0,0 +1,67 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<LinearLayout |
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android" |
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto" |
||||||
|
android:background="@drawable/bg_prefs_color" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:paddingLeft="16dp" |
||||||
|
android:paddingTop="10dp" |
||||||
|
android:paddingRight="16dp" |
||||||
|
android:paddingBottom="4dp" |
||||||
|
android:minHeight="42dp" |
||||||
|
android:clickable="true" |
||||||
|
android:orientation="horizontal" > |
||||||
|
|
||||||
|
<ImageView android:id="@+id/preference_icon" |
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android" |
||||||
|
android:layout_marginRight="16dp" |
||||||
|
android:scaleType="fitCenter" |
||||||
|
android:visibility="visible" |
||||||
|
android:paddingTop="1dp" |
||||||
|
android:layout_width="24dp" |
||||||
|
android:layout_height="24dp" /> |
||||||
|
|
||||||
|
<LinearLayout |
||||||
|
android:orientation="vertical" |
||||||
|
android:layout_weight="1.0" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content"> |
||||||
|
|
||||||
|
<TextView |
||||||
|
android:id="@+id/preference_title" |
||||||
|
android:paddingBottom="8dp" |
||||||
|
android:singleLine="true" |
||||||
|
android:textSize="16sp" |
||||||
|
android:text="@string/title" |
||||||
|
android:textColor="@color/tv_text_default" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
/> |
||||||
|
|
||||||
|
<TextView |
||||||
|
android:id="@+id/preference_desc" |
||||||
|
android:paddingBottom="8dp" |
||||||
|
android:singleLine="true" |
||||||
|
android:textSize="14sp" |
||||||
|
android:textColor="@color/tv_text_summary" |
||||||
|
android:text="@string/default1" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
/> |
||||||
|
</LinearLayout> |
||||||
|
|
||||||
|
<FrameLayout |
||||||
|
android:id="@+id/preference_widget" |
||||||
|
android:orientation="vertical" |
||||||
|
android:layout_gravity="center" |
||||||
|
android:layout_marginLeft="8dp" |
||||||
|
android:layout_marginTop="8dp" |
||||||
|
android:layout_marginBottom="8dp" |
||||||
|
android:visibility="gone" |
||||||
|
android:gravity="right|center_vertical" |
||||||
|
android:layout_width="wrap_content" |
||||||
|
android:layout_height="wrap_content"> |
||||||
|
</FrameLayout> |
||||||
|
|
||||||
|
</LinearLayout> |
@ -0,0 +1,29 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<LinearLayout |
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:orientation="vertical" > |
||||||
|
|
||||||
|
<View |
||||||
|
android:id="@+id/preference_divider_above" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="8dp" /> |
||||||
|
|
||||||
|
<TextView |
||||||
|
android:id="@+id/preference_title" |
||||||
|
android:paddingTop="16dip" |
||||||
|
android:paddingBottom="8dip" |
||||||
|
android:background="@drawable/bg_prefs_color" |
||||||
|
android:paddingLeft="16dp" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
/> |
||||||
|
|
||||||
|
<View |
||||||
|
android:id="@+id/preference_divider_below" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:visibility="gone" |
||||||
|
android:layout_height="8dp" /> |
||||||
|
|
||||||
|
</LinearLayout> |
@ -0,0 +1,66 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<LinearLayout |
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android" |
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto" |
||||||
|
android:background="@drawable/bg_prefs_color" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:paddingLeft="16dp" |
||||||
|
android:paddingTop="10dp" |
||||||
|
android:paddingRight="16dp" |
||||||
|
android:paddingBottom="4dp" |
||||||
|
android:minHeight="42dp" |
||||||
|
android:clickable="true" |
||||||
|
android:orientation="horizontal" > |
||||||
|
|
||||||
|
<ImageView android:id="@+id/preference_icon" |
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android" |
||||||
|
android:layout_marginRight="16dp" |
||||||
|
android:scaleType="fitCenter" |
||||||
|
android:visibility="visible" |
||||||
|
android:paddingTop="1dp" |
||||||
|
android:layout_width="24dp" |
||||||
|
android:layout_height="24dp" /> |
||||||
|
|
||||||
|
<LinearLayout |
||||||
|
android:orientation="vertical" |
||||||
|
android:layout_weight="1.0" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content"> |
||||||
|
|
||||||
|
<TextView |
||||||
|
android:id="@+id/preference_title" |
||||||
|
android:paddingBottom="8dp" |
||||||
|
android:singleLine="true" |
||||||
|
android:textSize="16sp" |
||||||
|
android:text="@string/title" |
||||||
|
android:textColor="@color/tv_text_default" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
/> |
||||||
|
|
||||||
|
<TextView |
||||||
|
android:id="@+id/preference_desc" |
||||||
|
android:paddingBottom="8dp" |
||||||
|
android:singleLine="true" |
||||||
|
android:textSize="14sp" |
||||||
|
android:textColor="@color/tv_text_summary" |
||||||
|
android:text="@string/default1" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
/> |
||||||
|
</LinearLayout> |
||||||
|
|
||||||
|
<FrameLayout |
||||||
|
android:id="@+id/preference_widget" |
||||||
|
android:layout_gravity="center" |
||||||
|
android:layout_marginLeft="8dp" |
||||||
|
android:layout_marginTop="8dp" |
||||||
|
android:layout_marginBottom="8dp" |
||||||
|
android:visibility="gone" |
||||||
|
android:gravity="right|center_vertical" |
||||||
|
android:layout_width="32dp" |
||||||
|
android:layout_height="32dp"> |
||||||
|
</FrameLayout> |
||||||
|
|
||||||
|
</LinearLayout> |
Loading…
Reference in new issue