Skip to content

Instantly share code, notes, and snippets.

@adhishlal
adhishlal / LazyColumnExample.kt
Last active January 13, 2022 11:10
LazyColumn in Jetpack Compose
LazyColumn(modifier = Modifier.fillMaxWidth()) {
items(items = names) {
..
}
}
private fun printKeyHash() {
// Add code to print out the key hash
try {
val info = packageManager.getPackageInfo("YOUR_PACKAGE_NAME", PackageManager.GET_SIGNATURES)
for (signature in info.signatures) {
val md = MessageDigest.getInstance("SHA")
md.update(signature.toByteArray())
Log.d("KeyHash:", Base64.encodeToString(md.digest(), Base64.DEFAULT))
}
} catch (e: PackageManager.NameNotFoundException) {
@adhishlal
adhishlal / colors.xml
Created June 22, 2017 10:36
This is useful list of beautiful colour codes which you can directly use in your Android applications
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">@color/red_400</color>
<color name="colorPrimaryDark">@color/red_600</color>
<color name="colorAccent">@color/white</color>
<color name="white">#FFFFFF</color>
<color name="red_50">#FFEBEE</color>
<color name="red_100">#FFCDD2</color>
<color name="red_200">#EF9A9A</color>
@adhishlal
adhishlal / Custom Toast Android
Last active April 17, 2017 05:15
This is a code for showing custom toast message in Android
private void customToast(String msg)
{
LayoutInflater inflater = getLayoutInflater();
View layout = inflater.inflate(R.layout.customtoast,
(ViewGroup) findViewById(R.id.toast_layout_root));
ImageView image = (ImageView) layout.findViewById(R.id.image);
image.setImageResource(R.mipmap.ic_launcher);
TextView text = (TextView) layout.findViewById(R.id.text);
text.setText(msg);
<?php
// API access key from Google API's Console
define( 'API_ACCESS_KEY', 'YOUR_API_ACCESS_KEY' );
$registrationIds = array( $_GET['id'] );
// prep the bundle
$msg = array
(
'body' => 'here is a message. message',
'title' => 'This is a title. title',
'vibrate' => 1,
adb shell am broadcast -a com.android.vending.INSTALL_REFERRER
-n "com.truelancer.app/com.google.android.gms.analytics.CampaignTrackingReceiver"
--es referrer "utm_source=email&utm_medium=email_marketing&utm_campaign=summer&tl_referral=190"