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
// Short way to collect StateFlow on coroutine when Activity Started. | |
// Useful when you need to collect one StateFlow, but could be used for many. | |
fun <T> StateFlow<T>.collectIt(lifecycleOwner: LifecycleOwner, function: (T) -> Unit) { | |
lifecycleOwner.lifecycleScope.launch { | |
lifecycleOwner.repeatOnLifecycle(Lifecycle.State.STARTED) { | |
collect { | |
function.invoke(it) | |
} | |
} | |
} |
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
# Removes all the logging functions | |
-assumenosideeffects class net.alexandroid.utils.mylogkt.MyLogKtKt { *; } | |
# Removes only logD() and logV() function | |
-assumenosideeffects class net.alexandroid.utils.mylogkt.MyLogKtKt { | |
public static *** logD$default(...); | |
public static *** logV$default(...); | |
} |
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
private fun setParamsFromLocalProperties() { | |
MyLogKt.isThreadNameVisible = BuildConfig.isThreadNameVisible | |
MyLogKt.isTimeVisible = BuildConfig.isTimeVisible | |
MyLogKt.isPackageNameVisible = BuildConfig.isPackageNameVisible | |
MyLogKt.isClassNameVisible = BuildConfig.isClassNameVisible | |
MyLogKt.isMethodNameVisible = BuildConfig.isMethodNameVisible | |
MyLogKt.isSpacingEnabled = BuildConfig.isSpacingEnabled | |
MyLogKt.isLengthShouldWrap = BuildConfig.isLengthShouldWrap | |
MyLogKt.classNameLength = BuildConfig.classNameLength | |
MyLogKt.methodNameLength = BuildConfig.methodNameLength |
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
apply plugin: 'com.android.application' | |
apply plugin: 'kotlin-android' | |
apply plugin: 'kotlin-android-extensions' | |
apply from: 'logger.gradle' |
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
android { | |
Properties properties = new Properties() | |
if (project.rootProject.file("local.properties").exists()) { | |
properties.load(project.rootProject.file("local.properties").newDataInputStream()) | |
} | |
defaultConfig { | |
buildConfigField "boolean", "isThreadNameVisible", properties.getProperty("logger.isThreadNameVisible", "false") | |
buildConfigField "boolean", "isTimeVisible", properties.getProperty("logger.isTimeVisible","false") | |
buildConfigField "boolean", "isPackageNameVisible", properties.getProperty("logger.isPackageNameVisible", "false") |
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
private String gdprCounries[] = new String[]{ | |
"US", //United States | |
"UM", //United States Minor Outlying Islands | |
"AT", //Austria | |
"BE", //Belgium | |
"BG", //Bulgaria | |
"HR", //Croatia | |
"CY", //Cyprus | |
"CZ", //Czech Republic | |
"DK", //Denmark |
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
# Gradle files | |
.gradle/ | |
# Intellij | |
.idea/ | |
*.iml | |
# Build | |
build/ |
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
public class DashTestActivity extends AppCompatActivity { | |
public static final String DASH_SAMPLE = "http://www.bok.net/dash/tears_of_steel/cleartext/stream.mpd"; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_dash_test); | |
SimpleExoPlayerView exoPlayerView = findViewById(R.id.exoPlayerView); |
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
public class OkHttpHelper { | |
public static final String TAG = "OkHttpHelper"; | |
public static final boolean SHOW_NETWORK_LOGS = true; | |
public static OkHttpClient getOkHttpClient() { | |
int cacheSize = 10 * 1024 * 1024; // 10 MB | |
Cache cache = new Cache(getCacheDir(), cacheSize); | |
return new OkHttpClient.Builder() | |
.addInterceptor(applicationInterceptor) |
NewerOlder