-
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[feature|optimize|fix] Support configure the tonal elevation of some …
…components of Feed (#55), Article, and Search screens; optimize the layout of Article screen and search screen (#53); fix the wrong article deduplication issue (#54)
- Loading branch information
Showing
37 changed files
with
1,504 additions
and
317 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
app/src/main/java/com/skyd/anivu/model/db/migration/Migration6To7.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.skyd.anivu.model.db.migration | ||
|
||
import androidx.room.migration.Migration | ||
import androidx.sqlite.db.SupportSQLiteDatabase | ||
import com.skyd.anivu.model.bean.ARTICLE_TABLE_NAME | ||
import com.skyd.anivu.model.bean.ArticleBean | ||
|
||
class Migration6To7 : Migration(6, 7) { | ||
override fun migrate(db: SupportSQLiteDatabase) { | ||
db.execSQL("ALTER TABLE $ARTICLE_TABLE_NAME ADD ${ArticleBean.GUID_COLUMN} TEXT") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
...com/skyd/anivu/model/preference/appearance/article/ArticleItemTonalElevationPreference.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.skyd.anivu.model.preference.appearance.article | ||
|
||
import android.content.Context | ||
import androidx.datastore.preferences.core.Preferences | ||
import androidx.datastore.preferences.core.floatPreferencesKey | ||
import com.skyd.anivu.base.BasePreference | ||
import com.skyd.anivu.ext.dataStore | ||
import com.skyd.anivu.ext.put | ||
import kotlinx.coroutines.CoroutineScope | ||
import kotlinx.coroutines.Dispatchers | ||
import kotlinx.coroutines.launch | ||
|
||
object ArticleItemTonalElevationPreference : BasePreference<Float> { | ||
private const val ARTICLE_ITEM_TONAL_ELEVATION = "articleItemTonalElevation" | ||
override val default = -2f | ||
|
||
val key = floatPreferencesKey(ARTICLE_ITEM_TONAL_ELEVATION) | ||
|
||
fun put(context: Context, scope: CoroutineScope, value: Float) { | ||
scope.launch(Dispatchers.IO) { | ||
context.dataStore.put(key, value) | ||
} | ||
} | ||
|
||
override fun fromPreferences(preferences: Preferences): Float = preferences[key] ?: default | ||
} |
26 changes: 26 additions & 0 deletions
26
...com/skyd/anivu/model/preference/appearance/article/ArticleListTonalElevationPreference.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.skyd.anivu.model.preference.appearance.article | ||
|
||
import android.content.Context | ||
import androidx.datastore.preferences.core.Preferences | ||
import androidx.datastore.preferences.core.floatPreferencesKey | ||
import com.skyd.anivu.base.BasePreference | ||
import com.skyd.anivu.ext.dataStore | ||
import com.skyd.anivu.ext.put | ||
import kotlinx.coroutines.CoroutineScope | ||
import kotlinx.coroutines.Dispatchers | ||
import kotlinx.coroutines.launch | ||
|
||
object ArticleListTonalElevationPreference : BasePreference<Float> { | ||
private const val ARTICLE_LIST_TONAL_ELEVATION = "articleListTonalElevation" | ||
override val default = 2f | ||
|
||
val key = floatPreferencesKey(ARTICLE_LIST_TONAL_ELEVATION) | ||
|
||
fun put(context: Context, scope: CoroutineScope, value: Float) { | ||
scope.launch(Dispatchers.IO) { | ||
context.dataStore.put(key, value) | ||
} | ||
} | ||
|
||
override fun fromPreferences(preferences: Preferences): Float = preferences[key] ?: default | ||
} |
26 changes: 26 additions & 0 deletions
26
...m/skyd/anivu/model/preference/appearance/article/ArticleTopBarTonalElevationPreference.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.skyd.anivu.model.preference.appearance.article | ||
|
||
import android.content.Context | ||
import androidx.datastore.preferences.core.Preferences | ||
import androidx.datastore.preferences.core.floatPreferencesKey | ||
import com.skyd.anivu.base.BasePreference | ||
import com.skyd.anivu.ext.dataStore | ||
import com.skyd.anivu.ext.put | ||
import kotlinx.coroutines.CoroutineScope | ||
import kotlinx.coroutines.Dispatchers | ||
import kotlinx.coroutines.launch | ||
|
||
object ArticleTopBarTonalElevationPreference : BasePreference<Float> { | ||
private const val ARTICLE_TOP_BAR_TONAL_ELEVATION = "articleTopBarTonalElevation" | ||
override val default = 2f | ||
|
||
val key = floatPreferencesKey(ARTICLE_TOP_BAR_TONAL_ELEVATION) | ||
|
||
fun put(context: Context, scope: CoroutineScope, value: Float) { | ||
scope.launch(Dispatchers.IO) { | ||
context.dataStore.put(key, value) | ||
} | ||
} | ||
|
||
override fun fromPreferences(preferences: Preferences): Float = preferences[key] ?: default | ||
} |
32 changes: 32 additions & 0 deletions
32
.../java/com/skyd/anivu/model/preference/appearance/feed/FeedListTonalElevationPreference.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.skyd.anivu.model.preference.appearance.feed | ||
|
||
import android.content.Context | ||
import androidx.datastore.preferences.core.Preferences | ||
import androidx.datastore.preferences.core.floatPreferencesKey | ||
import com.skyd.anivu.base.BasePreference | ||
import com.skyd.anivu.ext.dataStore | ||
import com.skyd.anivu.ext.put | ||
import kotlinx.coroutines.CoroutineScope | ||
import kotlinx.coroutines.Dispatchers | ||
import kotlinx.coroutines.launch | ||
|
||
object FeedListTonalElevationPreference : BasePreference<Float> { | ||
private const val FEED_LIST_TONAL_ELEVATION = "feedListTonalElevation" | ||
override val default = 0f | ||
|
||
val key = floatPreferencesKey(FEED_LIST_TONAL_ELEVATION) | ||
|
||
fun put(context: Context, scope: CoroutineScope, value: Float) { | ||
scope.launch(Dispatchers.IO) { | ||
context.dataStore.put(key, value) | ||
} | ||
} | ||
|
||
override fun fromPreferences(preferences: Preferences): Float = preferences[key] ?: default | ||
} | ||
|
||
object TonalElevationPreferenceUtil { | ||
fun toDisplay(value: Float): String { | ||
return "%.2fdp".format(value) | ||
} | ||
} |
Oops, something went wrong.