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
@AndroidEntryPoint | |
class MainActivity : ComponentActivity() { | |
@Inject | |
lateinit var settingsRepository: SettingsRepository | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
enableEdgeToEdge() | |
setContent { |
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
<!--To get the apps--> | |
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" | |
tools:ignore="QueryAllPackagesPermission" /> | |
<!--To expand the status bar on a swipe--> | |
<uses-permission android:name="android.permission.EXPAND_STATUS_BAR" /> | |
<!--To uninstall apps--> | |
<uses-permission android:name="android.permission.REQUEST_DELETE_PACKAGES" /> |
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
@OptIn(ExperimentalMaterial3Api::class) | |
@Composable | |
fun SwipeToDelete( | |
onDelete: () -> Unit | |
) { | |
var value by remember { mutableFloatStateOf(0f) } | |
val source = remember { MutableInteractionSource() } | |
val scale = remember { 12f } | |
val height = remember { (4 * scale).dp } | |
var initialDragValue: Float? by remember { mutableStateOf(null) } //To prevent accidental deletes and make sure the user actually swipes |