This file contains hidden or 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
| // conversions based on https://material.io/blog/migrating-material-3, deprecated colors set to Colors.Red | |
| @Composable | |
| fun fromMaterial3Theme(isLight: Boolean): Colors { | |
| val scheme = MaterialTheme.colorScheme | |
| return Colors( | |
| primary = scheme.primary, | |
| primaryVariant = Color.Red, | |
| secondary = scheme.secondary, | |
| secondaryVariant = Color.Red, | |
| background = scheme.background, |
This file contains hidden or 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
| class DemoModeEnabler { | |
| fun enable() { | |
| executeShellCommand("settings put global sysui_demo_allowed 1") | |
| sendCommand("exit") | |
| sendCommand("enter") | |
| sendCommand("notifications", "visible" to "false") | |
| sendCommand("network", "wifi" to "hide") | |
| sendCommand("battery", "level" to "100", "plugged" to "false") | |
| sendCommand("clock", "hhmm" to "1000") |
This file contains hidden or 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
| @Composable | |
| fun KeepScreenOn() { | |
| val currentView = LocalView.current | |
| DisposableEffect(Unit) { | |
| currentView.keepScreenOn = true | |
| onDispose { | |
| currentView.keepScreenOn = false | |
| } | |
| } |
This file contains hidden or 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
| gradle.projectsLoaded { gradle -> | |
| def file = rootProject.file("gradle.local.properties") | |
| if (file.exists()) { | |
| def properties = new Properties() | |
| file.withInputStream { properties.load(it) } | |
| // set the loaded properties for all projects | |
| gradle.beforeProject { project -> | |
| properties.entrySet().forEach { prop -> |
This file contains hidden or 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
| package com.neenbedankt.listfragmentbug; | |
| import android.annotation.TargetApi; | |
| import android.app.ListFragment; | |
| import android.os.Bundle; | |
| import android.view.View; | |
| import android.widget.ArrayAdapter; | |
| import android.widget.TextView; | |
| public class TestListFragment extends ListFragment { |
This file contains hidden or 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
| package nl.qbusict.cupboard; | |
| import android.content.ContentValues; | |
| import android.database.Cursor; | |
| import android.database.MatrixCursor; | |
| import android.test.AndroidTestCase; | |
| import nl.qbusict.cupboard.convert.EntityConverter.ColumnType; | |
| import nl.qbusict.cupboard.convert.FieldConverter; |
This file contains hidden or 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
| <?xml version="1.0" encoding="utf-8"?> | |
| <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
| android:layout_width="match_parent" | |
| android:layout_height="wrap_content" | |
| android:addStatesFromChildren="true" // when any child has state_pressed, this container will also have! | |
| android:orientation="vertical" android:background="@drawable/my_selector"> | |
| <ImageView android:clickable="true" .../> | |
| <TextView android:clickable="true" .../> | |
| </LinearLayout> |
This file contains hidden or 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
| <resources xmlns:android="http://schemas.android.com/apk/res/android"> | |
| <style android:name="MyStyle" parent="android:Theme.Light"> | |
| <!-- if the minSdk level is less then 11, then this should be a lint error, since android:actionBarStyle is since API 11, | |
| unless this is in a -v11 (or better) resource folder --> | |
| <item name="android:actionBarStyle">...</item> | |
| </style> | |
| </resources> |
This file contains hidden or 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
| package com.neenbedankt.listfragmentbug; | |
| import android.annotation.TargetApi; | |
| import android.app.ListFragment; | |
| import android.os.Bundle; | |
| import android.view.View; | |
| import android.widget.ArrayAdapter; | |
| import android.widget.TextView; | |
| public class TestListFragment extends ListFragment { |
This file contains hidden or 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
| // TypeToken is a Gson class | |
| Type type = new TypeToken<List<Author>>(){}.getType(); | |
| GsonFieldConverterFactory factory = new GsonFieldConverterFactory(type); | |
| // Register the factory and set the instance as the global Cupboard instance | |
| CupboardFactory.setCupboard(new CupboardBuilder().registerFieldConverterFactory(factory).build()); |
NewerOlder