加入自訂圖片UI資源
This commit is contained in:
parent
ee612ab4c0
commit
2d37a734e6
@ -14,6 +14,7 @@ object PreferenceUtil {
|
||||
private const val Y_AXIS_OFFSET = "Y_AXIS_OFFSET"
|
||||
private const val GRAVITY = "GRAVITY"
|
||||
private const val ICON = "ICON"
|
||||
private const val ICON_PATH = "ICON_PATH"
|
||||
|
||||
private val sharedPreferences = MyApp.appContext.getSharedPreferences(MAIN_KEY, Context.MODE_PRIVATE)
|
||||
|
||||
@ -32,4 +33,8 @@ object PreferenceUtil {
|
||||
var icon: Int
|
||||
get() = sharedPreferences.getInt(ICON, R.drawable.ic_chicken)
|
||||
set(value) = sharedPreferences.edit().putInt(ICON, value).apply()
|
||||
|
||||
var iconPath: String?
|
||||
get() = sharedPreferences.getString(ICON_PATH, "")
|
||||
set(value) = sharedPreferences.edit().putString(ICON_PATH, value).apply()
|
||||
}
|
||||
@ -129,4 +129,23 @@
|
||||
app:layout_constraintStart_toEndOf="@+id/textView7"
|
||||
app:layout_constraintTop_toBottomOf="@+id/edYOffset" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imgPreview"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/spIcon"
|
||||
app:srcCompat="@mipmap/ic_launcher" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnPickPhoto"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="選擇圖片"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/imgPreview"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/imgPreview" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@ -20,5 +20,6 @@
|
||||
<item>露西亞2</item>
|
||||
<item>露西亞3</item>
|
||||
<item>星街彗星</item>
|
||||
<item>自訂圖片</item>
|
||||
</array>
|
||||
</resources>
|
||||
Loading…
Reference in New Issue
Block a user