Skip to content

Instantly share code, notes, and snippets.

View rmkrishna's full-sized avatar

Muthukrishnan rmkrishna

View GitHub Profile
@rmkrishna
rmkrishna / ComposeViewPager.kt
Created October 16, 2020 17:59
View Pager Template for Android Compose View
import androidx.compose.animation.animatedFloat
import androidx.compose.animation.asDisposableClock
import androidx.compose.animation.core.*
import androidx.compose.foundation.animation.AndroidFlingDecaySpec
import androidx.compose.foundation.animation.FlingConfig
import androidx.compose.foundation.background
import androidx.compose.foundation.gestures.ScrollableController
import androidx.compose.foundation.gestures.scrollable
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
@rmkrishna
rmkrishna / Git-Tag
Last active December 10, 2018 09:28
#Ref : https://gist.github.com/rponte/fdc0724dd984088606b0
# The command finds the most recent tag that is reachable from a commit.
# If the tag points to the commit, then only the tag is shown.
# Otherwise, it suffixes the tag name with the number of additional commits on top of the tagged object
# and the abbreviated object name of the most recent commit.
git describe
# With --abbrev set to 0, the command can be used to find the closest tagname without any suffix:
git describe --abbrev=0
@rmkrishna
rmkrishna / NetworkUtility
Created August 11, 2017 09:46
NetworkUtility class
package in.rmkrishna.util.network;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.util.Base64;
import java.io.BufferedReader;
@rmkrishna
rmkrishna / WebUtil.java
Created July 20, 2017 10:55
Clear cache from CookieManager android
public class WebUtil {
public static void clearCookies(Context context) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
CookieManager.getInstance().removeAllCookies(null);
CookieManager.getInstance().flush();
} else {
CookieSyncManager cookieSyncMngr = CookieSyncManager.createInstance(context);
cookieSyncMngr.startSync();
@rmkrishna
rmkrishna / AndroidManifest.xml
Last active March 6, 2024 08:01
To get the Recent Apps in Android
// We should have this 2 permissions to get the recent app
<uses-permission android:name="android.permission.GET_TASKS" />
<uses-permission android:name="android.permission.PACKAGE_USAGE_STATS" />
// we should register our service in manifest file