This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.Manifest; | |
import android.app.Activity; | |
import android.app.Dialog; | |
import android.content.pm.PackageManager; | |
import android.support.v4.app.ActivityCompat; | |
public class CheckPermissions { | |
public static final int REQUEST_CONTACTS = 1273; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.content.ContentProviderOperation; | |
import android.content.Context; | |
import android.provider.ContactsContract; | |
import android.util.Pair; | |
import java.util.ArrayList; | |
import java.util.List; | |
public class AddContactToContactDevice { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.app.Application; | |
import android.content.res.Configuration; | |
import android.content.res.Resources; | |
import android.os.Build; | |
import android.view.ContextThemeWrapper; | |
import java.util.Locale; | |
public class LocaleUtils { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class PackageUtils { | |
public static void startNewActivity(Context context, String packageName) { | |
Intent intent = context.getPackageManager().getLaunchIntentForPackage(packageName); | |
if (intent == null) { | |
intent = new Intent(Intent.ACTION_VIEW); | |
intent.setData(Uri.parse("market://details?id=" + packageName)); | |
} | |
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | |
context.startActivity(intent); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Bind(R.id.webView) WebView webView; | |
webView.getSettings().setJavaScriptEnabled(true); | |
webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true); | |
webView.getSettings().setAllowFileAccessFromFileURLs(true); | |
webView.getSettings().setAllowUniversalAccessFromFileURLs(true); | |
//To request the geolocation in the webview | |
webView.getSettings().setGeolocationDatabasePath(getContext().getFilesDir().getPath()); | |
webView.setWebChromeClient(new WebChromeClient() { |