-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
465 additions
and
62 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
30 changes: 30 additions & 0 deletions
30
app/src/main/java/com/ojhdtapp/parabox/extension/auto/core/util/BrowserUtil.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,30 @@ | ||
package com.ojhdtapp.parabox.extension.auto.core.util | ||
|
||
import android.content.Context | ||
import android.net.Uri | ||
import androidx.browser.customtabs.CustomTabColorSchemeParams | ||
import androidx.browser.customtabs.CustomTabsIntent | ||
|
||
import android.content.Intent | ||
|
||
|
||
object BrowserUtil { | ||
private val defaultColor = CustomTabColorSchemeParams.Builder() | ||
// .setToolbarColor(colorInt) | ||
.build() | ||
|
||
fun launchURL(context: Context, url: String) { | ||
val customTabsIntent = CustomTabsIntent.Builder() | ||
.setDefaultColorSchemeParams(defaultColor) | ||
.build() | ||
customTabsIntent.launchUrl(context, Uri.parse(url)) | ||
} | ||
|
||
fun composeEmail(context: Context, addresses: Array<String?>?, subject: String?) { | ||
val intent = Intent(Intent.ACTION_SENDTO) | ||
intent.data = Uri.parse("mailto:") // only email apps should handle this | ||
intent.putExtra(Intent.EXTRA_EMAIL, addresses) | ||
intent.putExtra(Intent.EXTRA_SUBJECT, subject) | ||
context.startActivity(intent) | ||
} | ||
} |
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
25 changes: 25 additions & 0 deletions
25
app/src/main/java/com/ojhdtapp/parabox/extension/auto/data/AppModelDao.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,25 @@ | ||
package com.ojhdtapp.parabox.extension.auto.data | ||
|
||
import androidx.room.Dao | ||
import androidx.room.Insert | ||
import androidx.room.OnConflictStrategy | ||
import androidx.room.Query | ||
import androidx.room.Update | ||
import com.ojhdtapp.parabox.extension.auto.domain.model.AppModel | ||
import com.ojhdtapp.parabox.extension.auto.domain.model.AppModelDisabledUpdate | ||
import kotlinx.coroutines.flow.Flow | ||
|
||
@Dao | ||
interface AppModelDao { | ||
@Insert(onConflict = OnConflictStrategy.REPLACE) | ||
suspend fun insert(appModel: AppModel): Long | ||
|
||
@Query("SELECT * FROM appmodel WHERE packageName = :packageName LIMIT 1") | ||
suspend fun queryByPackageName(packageName: String): AppModel? | ||
|
||
@Update(entity = AppModel::class) | ||
fun updateDisabledState(appModelDisabledUpdate: AppModelDisabledUpdate) | ||
|
||
@Query("SELECT * FROM appmodel") | ||
fun getAll(): Flow<List<AppModel>> | ||
} |
18 changes: 18 additions & 0 deletions
18
app/src/main/java/com/ojhdtapp/parabox/extension/auto/domain/model/AppModel.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.ojhdtapp.parabox.extension.auto.domain.model | ||
|
||
import androidx.room.ColumnInfo | ||
import androidx.room.Entity | ||
import androidx.room.PrimaryKey | ||
|
||
@Entity | ||
data class AppModel( | ||
val packageName: String, | ||
val appName: String, | ||
@PrimaryKey(autoGenerate = true) val id: Long = 0, | ||
val disabled: Boolean = false, | ||
) | ||
|
||
data class AppModelDisabledUpdate( | ||
@ColumnInfo(name = "id") val id: Long, | ||
@ColumnInfo(name = "disabled") val disabled: Boolean | ||
) |
Oops, something went wrong.