-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: initial implementation of custom app drawer folder (#5189)
- Implemented basic CRUD operations for app drawer folders. - Moved wallpaper database to preference database for better organization. closes : - #4674 - #4710 - #4475 - #3481
- Loading branch information
Showing
34 changed files
with
1,322 additions
and
107 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
16 changes: 16 additions & 0 deletions
16
lawnchair/src/app/lawnchair/data/factory/ViewModelFactory.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,16 @@ | ||
package app.lawnchair.data.factory | ||
|
||
import android.content.Context | ||
import androidx.lifecycle.ViewModel | ||
import androidx.lifecycle.ViewModelProvider | ||
|
||
class ViewModelFactory<T : ViewModel>( | ||
private val context: Context, | ||
private val creator: (Context) -> T, | ||
) : ViewModelProvider.Factory { | ||
override fun <T : ViewModel> create(modelClass: Class<T>): T { | ||
@Suppress("UNCHECKED_CAST") | ||
return creator(context) as? T | ||
?: throw IllegalArgumentException("Unknown ViewModel class: ${modelClass.name}") | ||
} | ||
} |
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,35 @@ | ||
package app.lawnchair.data.folder | ||
|
||
import androidx.room.ColumnInfo | ||
import androidx.room.Entity | ||
import androidx.room.ForeignKey | ||
import androidx.room.PrimaryKey | ||
|
||
@Entity(tableName = "Folders") | ||
data class FolderInfoEntity( | ||
@PrimaryKey(autoGenerate = true) val id: Int = 0, | ||
val title: String, | ||
val hide: Boolean = false, | ||
val rank: Int = 0, | ||
val timestamp: Long = System.currentTimeMillis(), | ||
) | ||
|
||
@Entity( | ||
tableName = "FolderItems", | ||
foreignKeys = [ | ||
ForeignKey( | ||
entity = FolderInfoEntity::class, | ||
parentColumns = ["id"], | ||
childColumns = ["folderId"], | ||
onDelete = ForeignKey.CASCADE, | ||
onUpdate = ForeignKey.CASCADE, | ||
), | ||
], | ||
) | ||
data class FolderItemEntity( | ||
@PrimaryKey(autoGenerate = true) val id: Int = 0, | ||
val folderId: Int, | ||
val rank: Int = 0, | ||
@ColumnInfo(name = "item_info") val componentKey: String?, | ||
val timestamp: Long = System.currentTimeMillis(), | ||
) |
Oops, something went wrong.