SystemService で常に実行されている。M Preview の Doze モードを実装するためのもの。
以下のイベントを監視する。
- Screen on/off
- Charging status
- Significant motion detect
import android.net.Uri; | |
import android.util.Pair; | |
import java.util.List; | |
public final class UrlUtil { | |
static String encodePathSegments(String url) { | |
final Uri uri = Uri.parse(url); | |
final List<String> pathSegments = uri.getPathSegments(); | |
final Uri.Builder builder = uri.buildUpon().path(""); |
package com.hkurokawa.powermocktest; | |
import android.support.v7.app.AppCompatActivity; | |
import android.os.Bundle; | |
import android.util.Log; | |
import rx.android.schedulers.AndroidSchedulers; | |
import rx.functions.Action1; | |
import rx.schedulers.Schedulers; |
<?xml version="1.0" encoding="utf-8"?> | |
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | |
package="com.example.hiroshikurokawa.videosample"> | |
<uses-permission android:name="android.permission.INTERNET" /> | |
<application | |
android:allowBackup="true" | |
android:icon="@mipmap/ic_launcher" | |
android:label="@string/app_name" | |
android:supportsRtl="true" |
#! /bin/bash | |
## This script is for taking a screen shot of an Android device. | |
## If possible, it tries to resize the image file and then copy to the clipboard. | |
## | |
## Note the script generates screenshot_yyyyMMddHHmmss.png and screenshot_yyyyMMddHHmmss_s.png | |
## under /sdcard on the device (you can specify another location with '-t' option) | |
## and copies it to the current working directory. | |
## | |
## The script passes unrecognized arguments to adb command, which means you can specify "-e" or "-d" |
package com.hkurokawa.sampleapplication; | |
import android.support.v7.app.AppCompatActivity; | |
import android.os.Bundle; | |
import android.view.Menu; | |
import android.view.MenuItem; | |
import android.view.View; | |
import android.widget.ArrayAdapter; | |
import android.widget.ListView; |
package com.hkurokawa.myapplication; | |
import android.os.Bundle; | |
import android.support.v7.app.AppCompatActivity; | |
import android.view.LayoutInflater; | |
import android.view.View; | |
import android.view.ViewGroup; | |
public class MainActivity extends AppCompatActivity { | |
ViewGroup content; |
package com.hkurokawa.myapplication; | |
import android.os.Bundle; | |
import android.support.v7.app.AppCompatActivity; | |
import android.view.LayoutInflater; | |
import android.view.View; | |
import android.view.ViewGroup; | |
public class MainActivity extends AppCompatActivity { | |
ViewGroup content; |
/** | |
* <p> | |
* This loader caches the result so that it can be taken later - for example, after configuration | |
* was changed and activity is re-created. | |
* </p> | |
* Created by hiroshi on 2014/12/03. | |
*/ | |
public abstract class CachedAsyncTaskLoader<T> extends AsyncTaskLoader<T> { | |
private T mCached; | |
private Throwable mError; |
apply plugin: 'com.android.application' | |
android { | |
compileSdkVersion 21 | |
buildToolsVersion "21.1.1" | |
defaultConfig { | |
applicationId "com.hkurokawa.myapplication" | |
minSdkVersion 14 | |
targetSdkVersion 21 |