This file contains hidden or 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.os.Parcel; | |
import android.os.Parcelable; | |
public class ParcelableHelper { | |
/** | |
* There is not always a guarantee that Parcelable values will be immediately written out and | |
* read back in. For data data that mutable (its own issue), this can be a problem. This is | |
* for the times when it would be great to have confidence that you will be working with a copy | |
* of that data. |
This file contains hidden or 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
package com.sjl.util; | |
import android.app.Activity; | |
import android.app.Application; | |
import android.content.Context; | |
import android.os.Bundle; | |
import android.os.Handler; | |
import android.util.Log; | |
import java.util.List; |
This file contains hidden or 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
apply plugin: 'com.android.library' | |
android { | |
compileSdkVersion 'Google Inc.:Google APIs:22' | |
Properties localProps = new Properties() | |
localProps.load(new FileInputStream(file('../local.properties'))) | |
def buildToolVer = file("${localProps['sdk.dir']}/build-tools/").listFiles().sort().reverse().first().name; | |
buildToolsVersion buildToolVer; |
This file contains hidden or 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
// annotation processor will generate DevicePhoneNumberSumType (see: 4_DevicePhoneNumberSumType.java) | |
@SumType | |
public interface DevicePhoneNumber { | |
String phoneNumber(); | |
void phoneNumberNotAvailable(); | |
String[] permissionsRequired(); | |
} |
This file contains hidden or 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
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
... | |
BarcodeLoggerActivityPermissionsDispatcher.startBarcodeCaptureWithCheck(this); | |
} | |
@NeedsPermission(Manifest.permission.CAMERA) | |
void startBarcodeCapture() { | |
int orientation = WindowManagerHelper.getCurrentAccurateOrientation(this); | |
Intent intent = CaptureActivity.buildIntent(this, orientation); |
This file contains hidden or 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.Activity; | |
import android.support.annotation.CheckResult; | |
import android.support.annotation.NonNull; | |
import android.support.annotation.Size; | |
import android.support.v4.app.ActivityCompat; | |
import static android.content.pm.PackageManager.PERMISSION_GRANTED; | |
public class ActivityPermissionDelegate { | |
public interface PermissionRationaleRetryBehavior { |
This file contains hidden or 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
<receiver | |
android:name=".DownloadBroadcastReceiver" | |
android:exported="true"> | |
<intent-filter> | |
<action android:enabled="true" android:name="android.intent.action.DOWNLOAD_COMPLETE" /> | |
</intent-filter> | |
</receiver> |
This file contains hidden or 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
package com.androidfu.nowplaying.app.api; | |
import android.content.Context; | |
import com.androidfu.nowplaying.app.util.Log; | |
import com.androidfu.nowplaying.app.util.Preconditions; | |
import com.jakewharton.byteunits.DecimalByteUnit; | |
import com.squareup.okhttp.Cache; | |
import com.squareup.okhttp.OkHttpClient; |
This file contains hidden or 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
<?xml version="1.0" encoding="utf-8"?> | |
<!-- Add this as a debug manifest so the permissions won't be required by your production app --> | |
<manifest xmlns:android="http://schemas.android.com/apk/res/android"> | |
<uses-permission android:name="android.permission.WAKE_LOCK" /> | |
<uses-permission android:name="android.permission.DISABLE_KEYGUARD" /> | |
</manifest> |
This file contains hidden or 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.Activity; | |
import android.content.Context; | |
import android.os.PowerManager; | |
import android.os.PowerManager.WakeLock; | |
import android.test.ActivityInstrumentationTestCase2; | |
/** | |
* This requires to be declared in the effective manifest: | |
* <uses-permission android:name="android.permission.WAKE_LOCK"/> | |
* |
NewerOlder