Skip to content

Instantly share code, notes, and snippets.

Alexey Korolev Pulimet

Block or report user

Report or block Pulimet

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Pulimet
Pulimet / NavComponent.kt
Last active Jul 24, 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();
}
@Pulimet
Pulimet / AdbCommands
Last active Sep 18, 2019
Adb useful commands list
View AdbCommands
== Adb Server
adb kill-server
adb start-server
== Adb Reboot
adb reboot
adb reboot recovery
adb reboot-bootloader
== Shell
@Pulimet
Pulimet / CustomTabStrip.java
Created Sep 11, 2017
Custom tab strip for ViewPager (titles + current indicator)
View CustomTabStrip.java
/**
* PagerTitleStrip is a non-interactive indicator of the current, next,
* and previous pages of a {@link ViewPager}. It is intended to be used as a
* child view of a ViewPager widget in your XML layout.
* Add it as a child of a ViewPager in your layout file and set its
* android:layout_gravity to TOP or BOTTOM to pin it to the top or bottom
* of the ViewPager. The title from each page is supplied by the method
* {@link PagerAdapter#getPageTitle(int)} in the adapter supplied to
* the ViewPager.
*/
View gist:6cf1d0e1ab5f59e6711c
if (Looper.getMainLooper().equals(Looper.myLooper())) {
// UI thread
} else {
// Non UI thread
}
// Run on UI
new Handler(Looper.getMainLooper()).post(new Runnable() {
@Override
public void run() {
View SHA1-certificate-ingerprint
try {
PackageInfo info = getPackageManager().getPackageInfo("com.xxx.yyy", PackageManager.GET_SIGNATURES);
for (Signature signature : info.signatures) {
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(signature.toByteArray());
Log.d("KeyHash:", Base64.encodeToString(md.digest(), Base64.DEFAULT));
}
} catch (PackageManager.NameNotFoundException e) {
} catch (NoSuchAlgorithmException e) {
}
You can’t perform that action at this time.