View transform.py
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
import os | |
import re | |
for root, dirs, files in os.walk("."): | |
for file in files: | |
pkg = '' | |
if file == 'AndroidManifest.xml' and 'build' not in root: | |
print(os.path.join(root, file)) | |
content = open(os.path.join(root, file)).read() |
View DIModule.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
@CoDispatcher(DispatcherType.SHARED) | |
@Singleton | |
@Provides | |
fun sharedDispatcher(threadPoolExecutor: ThreadPoolExecutor): CoroutineDispatcher { | |
return threadPoolExecutor.asCoroutineDispatcher() | |
} |
View HomeViewModel.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
@HiltViewModel | |
class HomeViewModel @Inject constructor( | |
private val redditRepository: RedditRepository, | |
@CoDispatcher(DispatcherType.SHARED) | |
private val coroutineDispatcher: CoroutineDispatcher | |
) : ViewModel() { | |
val reddits: LiveData<RedditListing> = redditRepository | |
.topReddits | |
.asLiveData(context = coroutineDispatcher) |
View DIModule.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
// DIModule.kt | |
@Provides | |
@Singleton | |
fun workManagerConfig(threadPoolExecutor: ThreadPoolExecutor): Configuration { | |
return Configuration.Builder() | |
.setExecutor(threadPoolExecutor) | |
.build() | |
} | |
// MainApplication.kt |
View DIModule.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
@Provides | |
@Singleton | |
fun okhttpClient( | |
threadPoolExecutor: ThreadPoolExecutor, | |
@ApplicationContext applicationContext: Context | |
): OkHttpClient { | |
val client = OkHttpClient.Builder() | |
.dispatcher(Dispatcher(threadPoolExecutor)) | |
.build() |
View DIModule.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
@Provides | |
@Singleton | |
fun threadPoolExecutor(): ThreadPoolExecutor { | |
val index = AtomicInteger() | |
return ThreadPoolExecutor( | |
Runtime.getRuntime().availableProcessors().coerceAtLeast(2), | |
Int.MAX_VALUE, | |
60, | |
TimeUnit.SECONDS, | |
SynchronousQueue(), |
View logcat.log
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
ConnectivityThread | |
FinalizerDaemon | |
FinalizerWatchdogDaemon | |
HeapTaskDaemon | |
OkHttp TaskRunner | |
OkHttp TaskRunner | |
OkHttp TaskRunner | |
OkHttp www.reddit.com | |
Okio Watchdog | |
ReferenceQueueDaemon |
View gist:678753c2d9d9509ed5d1f2699dd9c57d
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
diff --git a/Flagship/build.gradle b/Flagship/build.gradle | |
index 9dd476b9e86..1ff6765ffb7 100644 | |
--- a/Flagship/build.gradle | |
+++ b/Flagship/build.gradle | |
@@ -131,7 +131,7 @@ android { | |
release { | |
minifyEnabled true | |
shrinkResources true | |
- proguardFiles getDefaultProguardFile('proguard-android.txt'), ('proguard-rules.pro') | |
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), ('proguard-rules.pro') |
View MainActivity.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
class MainActivity : AppCompatActivity() { | |
private lateinit var binding: ActivityMainBinding | |
private lateinit var viewModel: MyViewModel | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
viewModel = ViewModelProvider(this).get(MyViewModel::class.java) | |
binding = ActivityMainBinding.inflate(layoutInflater) |
View MyViewModel.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
class MyViewModel : ViewModel() { | |
private val _sourceFlow = MutableStateFlow(0) | |
val sourceFlow: StateFlow<Int> | |
get() = _sourceFlow | |
private val _transformedFlow = _sourceFlow.map { | |
it * it | |
} | |
val transformedFlow: Flow<Int> |
NewerOlder