-
-
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] Optimize RSS edit screen; support custom RSS icon …
…and description; fix known bugs (#51) Feedicon
- Loading branch information
Showing
35 changed files
with
1,181 additions
and
179 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
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
18 changes: 18 additions & 0 deletions
18
app/src/main/java/com/skyd/anivu/model/db/migration/Migration5To6.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,18 @@ | ||
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 | ||
import com.skyd.anivu.model.bean.FEED_TABLE_NAME | ||
import com.skyd.anivu.model.bean.FeedBean | ||
|
||
class Migration5To6 : Migration(5, 6) { | ||
override fun migrate(db: SupportSQLiteDatabase) { | ||
db.execSQL("ALTER TABLE $FEED_TABLE_NAME ADD ${FeedBean.CUSTOM_DESCRIPTION_COLUMN} TEXT") | ||
db.execSQL("ALTER TABLE $FEED_TABLE_NAME ADD ${FeedBean.CUSTOM_ICON_COLUMN} TEXT") | ||
|
||
db.execSQL("ALTER TABLE $ARTICLE_TABLE_NAME ADD ${ArticleBean.IS_READ_COLUMN} INTEGER NOT NULL DEFAULT 0") | ||
db.execSQL("ALTER TABLE $ARTICLE_TABLE_NAME ADD ${ArticleBean.IS_FAVORITE_COLUMN} INTEGER NOT NULL DEFAULT 0") | ||
} | ||
} |
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
45 changes: 45 additions & 0 deletions
45
app/src/main/java/com/skyd/anivu/model/preference/behavior/PickImageMethodPreference.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,45 @@ | ||
package com.skyd.anivu.model.preference.behavior | ||
|
||
import android.content.Context | ||
import androidx.datastore.preferences.core.Preferences | ||
import androidx.datastore.preferences.core.stringPreferencesKey | ||
import com.skyd.anivu.R | ||
import com.skyd.anivu.appContext | ||
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 PickImageMethodPreference : BasePreference<String> { | ||
val methodList = arrayOf( | ||
"PickVisualMedia", | ||
"PickFromGallery", | ||
"OpenDocument", | ||
"GetContent", | ||
) | ||
|
||
private const val PICK_IMAGE_METHOD = "pickImageMethod" | ||
override val default = methodList[0] | ||
|
||
val key = stringPreferencesKey(PICK_IMAGE_METHOD) | ||
|
||
fun put(context: Context, scope: CoroutineScope, value: String) { | ||
scope.launch(Dispatchers.IO) { | ||
context.dataStore.put(key, value) | ||
} | ||
} | ||
|
||
override fun fromPreferences(preferences: Preferences): String = preferences[key] ?: default | ||
|
||
fun toDisplayName(method: String) = appContext.getString( | ||
when (method) { | ||
"PickVisualMedia" -> R.string.pick_image_method_pick_visual_media | ||
"PickFromGallery" -> R.string.pick_image_method_pick_from_gallery | ||
"OpenDocument" -> R.string.pick_image_method_open_document | ||
"GetContent" -> R.string.pick_image_method_get_content | ||
else -> R.string.pick_image_method_pick_visual_media | ||
}, method | ||
) | ||
} |
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
Oops, something went wrong.