-
Notifications
You must be signed in to change notification settings - Fork 1
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
1 parent
93182f8
commit 4d7bf52
Showing
11 changed files
with
101 additions
and
86 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 was deleted.
Oops, something went wrong.
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.custom.app.util | ||
|
||
import android.content.Context | ||
import android.content.DialogInterface | ||
import android.widget.Toast | ||
import androidx.appcompat.app.AlertDialog | ||
|
||
object AlertUtil { | ||
|
||
fun showToast(context: Context, msg: CharSequence?) { | ||
Toast.makeText(context, msg, Toast.LENGTH_SHORT).show() | ||
} | ||
|
||
fun showActionAlertDialog( | ||
context: Context, msg: CharSequence?, | ||
negativeAction: CharSequence?, positiveAction: CharSequence?, | ||
listener: DialogInterface.OnClickListener? | ||
) { | ||
val alert = AlertDialog.Builder(context) | ||
alert.setMessage(msg) | ||
alert.setCancelable(true) | ||
alert.setPositiveButton(positiveAction, listener) | ||
alert.setNegativeButton(negativeAction) { dialog, _: Int -> dialog.dismiss() } | ||
alert.show() | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
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,20 @@ | ||
package com.custom.app.util | ||
|
||
object Constant { | ||
|
||
const val NOTIFICATION_STATUS_ID = 1 | ||
const val NOTIFICATION_STATUS_CHANNEL = "status" | ||
|
||
const val KEY_UUID = "uuid" | ||
const val KEY_DEVICE_NAME = "device_name" | ||
const val KEY_DEVICE_STATUS = "device_status" | ||
const val KEY_DEFAULT_DEVICE = "default_device" | ||
const val KEY_SERVICE_ENABLED = "service_enabled" | ||
const val KEY_REBOOT_ENABLED = "reboot_enabled" | ||
const val KEY_PERMISSION = "permission" | ||
const val KEY_NOTIFICATION = "notification" | ||
const val KEY_IGNORE_VOLUME = "ignore_volume" | ||
const val KEY_RESET = "reset" | ||
const val KEY_VERSION = "version" | ||
|
||
} |
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 |
---|---|---|
|
@@ -100,4 +100,4 @@ class SpannyTypeface : TypefaceSpan { | |
paint.typeface = tf | ||
} | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
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,23 @@ | ||
package com.custom.app.util | ||
|
||
import android.app.Activity | ||
import android.content.Context | ||
import android.content.Intent | ||
import android.content.pm.PackageManager | ||
import android.net.Uri | ||
import android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS | ||
import androidx.core.content.ContextCompat | ||
|
||
object Util { | ||
|
||
fun isPermissionGranted(context: Context, permission: String): Boolean { | ||
return ContextCompat.checkSelfPermission(context, permission) == PackageManager.PERMISSION_GRANTED | ||
} | ||
|
||
fun showAppSettings(activity: Activity, packageName: String) { | ||
val intent = Intent(ACTION_APPLICATION_DETAILS_SETTINGS, Uri.parse("package:$packageName")) | ||
intent.addCategory(Intent.CATEGORY_DEFAULT) | ||
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK | ||
activity.startActivity(intent) | ||
} | ||
} |