Skip to content

Instantly share code, notes, and snippets.

View rajsuvariya's full-sized avatar

Raj Suvariya rajsuvariya

View GitHub Profile
@rajsuvariya
rajsuvariya / TrepezoidView.java
Created February 11, 2021 07:56
A trepezoid view which provides curv functionality when dragged from top middle position
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.Point;
private static boolean checkRootMethod1() {
String buildTags = android.os.Build.TAGS;
return buildTags != null && buildTags.contains("test-keys");
}
private static boolean checkRootMethod2() {
String[] paths = { "/system/app/Superuser.apk", "/sbin/su", "/system/bin/su", "/system/xbin/su",
"/data/local/xbin/su", "/data/local/bin/su", "/system/sd/xbin/su",
"/system/bin/failsafe/su", "/data/local/su", "/su/bin/su"};
for (String path : paths) {
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
setCount(this, "9");
}
public void setCount(Context context, String count) {
MenuItem menuItem = defaultMenu.findItem(R.id.ic_group);
LayerDrawable icon = (LayerDrawable) menuItem.getIcon();
CountDrawable badge;
package com.bslamc.ifa.customComponent.badgeDrawable;
/**
* Created by rajsuvariya on 17/8/17.
*/
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.ColorFilter;
import android.graphics.Paint;
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto" >
<!-- add the following item to your menu.xml -->
<item
android:id="@+id/ic_group"
android:icon="@drawable/actionbar_group_icon.xml"
android:title="@string/group_title"
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:drawable="@drawable/ic_group"
android:gravity="center" />
<item
android:id="@+id/ic_group_count"
android:drawable="@color/transparent" />
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new SharePreferencePackager()); // <-- Add this line with your package name.
}
NativeModules.SharefPreference.getMpin((mpin)=>console.log(mpin))
@ReactMethod
public void getMpin(Callback successCallBack){
try {
successCallBack.invoke(preferenceManager.getMpin());
} catch (Exception e) {
Toast.makeText(mContext, "Unable to fetch shared preference", Toast.LENGTH_LONG).show();
}
}
mReactInstanceManager = ReactInstanceManager.builder()
.setApplication(getApplication())
.setBundleAssetName("index.android.bundle")
.setJSMainModuleName("index.android")
.addPackage(new MainReactPackage())
.addPackage(new SharedPreferencePackager())
.setUseDeveloperSupport(BuildConfig.DEBUG)
.setInitialLifecycleState(LifecycleState.RESUMED)
.build();