Skip to content

Instantly share code, notes, and snippets.

Avatar

Alexey Korolev Pulimet

View GitHub Profile
@Pulimet
Pulimet / proguard-rules.pro
Last active Jun 15, 2020
MyLog Library Article 4
View proguard-rules.pro
# 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(...);
}
View SetParamsFromLocalProperties.kt
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
@Pulimet
Pulimet / build.gradle
Last active Jun 15, 2020
MyLog Library Article 2
View build.gradle
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply from: 'logger.gradle'
@Pulimet
Pulimet / logger.gradle
Last active Jun 15, 2020
MyLog Library Article
View logger.gradle
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")
@Pulimet
Pulimet / NavComponent.kt
Last active Dec 26, 2019
Navigation component + ToolBar + Drawer (Navigation icon click behavior and animation fix)
View NavComponent.kt
private var navController: NavController? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
setNavigationAndToolBar()
}
private fun setNavigationAndToolBar() {
setSupportActionBar(toolbar)
@Pulimet
Pulimet / GDPR_Countries_List.txt
Created Nov 19, 2018
GDPR Countries 2 Letter Country Code
View GDPR_Countries_List.txt
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
View .gitignore
# Gradle files
.gradle/
# Intellij
.idea/
*.iml
# Build
build/
View ExoPlayer2DashSourceActivity
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);
@Pulimet
Pulimet / OkHttpHelper
Created Sep 14, 2017
OkHttpClient - Real request and response headers log
View OkHttpHelper
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)
@Pulimet
Pulimet / GetAdID
Created Sep 11, 2017
Get advertising id
View GetAdID
public static String getAdvertisingId() {
try {
return AdvertisingIdClient.getAdvertisingIdInfo(Contextor.getInstance().getContext()).getId();
} catch (IOException e) {
e.printStackTrace();
} catch (GooglePlayServicesNotAvailableException e) {
e.printStackTrace();
} catch (GooglePlayServicesRepairableException e) {
e.printStackTrace();
}
You can’t perform that action at this time.