Cats are not, technically, tasty treats.

am: 27a9fcc618

Change-Id: I04dd4cf9573e88635e814d75162b742fe19b316d
This commit is contained in:
Dan Sandler
2016-06-26 22:56:01 +00:00
committed by android-build-merger
55 changed files with 2414 additions and 3 deletions

View File

@@ -53,7 +53,7 @@ import android.widget.FrameLayout;
import android.widget.ImageView;
public class PlatLogoActivity extends Activity {
public static final boolean REVEAL_THE_NAME = true;
public static final boolean REVEAL_THE_NAME = false;
FrameLayout mLayout;
int mTapCount;
@@ -112,7 +112,6 @@ public class PlatLogoActivity extends Activity {
ObjectAnimator.ofInt(overlay, "alpha", 0, 255)
.setDuration(500)
.start();
return true;
}
final ContentResolver cr = getContentResolver();

View File

@@ -0,0 +1,21 @@
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_STATIC_JAVA_LIBRARIES := \
android-support-v4 \
android-support-v13 \
android-support-v7-recyclerview \
android-support-v7-preference \
android-support-v7-appcompat \
android-support-v14-preference \
jsr305
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_PACKAGE_NAME := EasterEgg
LOCAL_CERTIFICATE := platform
include $(BUILD_PACKAGE)
include $(call all-makefiles-under,$(LOCAL_PATH))

View File

@@ -0,0 +1,75 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2016 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.egg"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="24" />
<uses-permission android:name="android.permission.SUBSTITUTE_NOTIFICATION_APP_NAME" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application android:label="@string/app_name" android:icon="@drawable/icon">
<!-- Long press the QS tile to get here -->
<activity android:name=".neko.NekoLand"
android:theme="@android:style/Theme.Material.NoActionBar"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.service.quicksettings.action.QS_TILE_PREFERENCES" />
</intent-filter>
</activity>
<!-- This is where the magic happens -->
<service
android:name=".neko.NekoService"
android:enabled="true"
android:permission="android.permission.BIND_JOB_SERVICE"
android:exported="true" >
</service>
<!-- Used to show over lock screen -->
<activity android:name=".neko.NekoLockedActivity"
android:excludeFromRecents="true"
android:theme="@android:style/Theme.Material.Light.Dialog.NoActionBar"
android:showOnLockScreen="true" />
<!-- Used to enable easter egg -->
<activity android:name=".neko.NekoActivationActivity"
android:excludeFromRecents="true"
android:theme="@android:style/Theme.NoDisplay"
>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.DEFAULT" />
<category android:name="com.android.internal.category.PLATLOGO" />
</intent-filter>
</activity>
<!-- The quick settings tile, disabled by default -->
<service
android:name=".neko.NekoTile"
android:permission="android.permission.BIND_QUICK_SETTINGS_TILE"
android:icon="@drawable/stat_icon"
android:enabled="false"
android:label="@string/default_tile_name">
<intent-filter>
<action android:name="android.service.quicksettings.action.QS_TILE" />
</intent-filter>
</service>
</application>
</manifest>

View File

@@ -0,0 +1,22 @@
<!--
Copyright (C) 2016 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:viewportWidth="48.0"
android:viewportHeight="48.0">
<path android:name="back" android:fillColor="#FF000000" android:pathData="M37.1,22c-1.1,0 -1.9,0.8 -1.9,1.9v5.6c0,1.1 0.8,1.9 1.9,1.9H39v-1.9v-5.6V22H37.1z"/>
</vector>

View File

@@ -0,0 +1,22 @@
<!--
Copyright (C) 2016 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:viewportWidth="48.0"
android:viewportHeight="48.0">
<path android:name="belly" android:fillColor="#FF000000" android:pathData="M20.5,25c-3.6,0 -6.5,2.9 -6.5,6.5V38h13v-6.5C27,27.9 24.1,25 20.5,25z"/>
</vector>

View File

@@ -0,0 +1,22 @@
<!--
Copyright (C) 2016 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:viewportWidth="48.0"
android:viewportHeight="48.0">
<path android:name="body" android:fillColor="#FF000000" android:pathData="M9,20h30v18h-30z"/>
</vector>

View File

@@ -0,0 +1,22 @@
<!--
Copyright (C) 2016 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:viewportWidth="48.0"
android:viewportHeight="48.0">
<path android:name="bowtie" android:fillColor="#FF000000" android:pathData="M29,16.8l-10,5l0,-5l10,5z"/>
</vector>

View File

@@ -0,0 +1,22 @@
<!--
Copyright (C) 2016 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:viewportWidth="48.0"
android:viewportHeight="48.0">
<path android:name="cap" android:fillColor="#FF000000" android:pathData="M27.2,3.8c-1,-0.2 -2.1,-0.3 -3.2,-0.3s-2.1,0.1 -3.2,0.3c0.2,1.3 1.5,2.2 3.2,2.2C25.6,6.1 26.9,5.1 27.2,3.8z"/>
</vector>

View File

@@ -0,0 +1,22 @@
<!--
Copyright (C) 2016 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:viewportWidth="48.0"
android:viewportHeight="48.0">
<path android:name="collar" android:fillColor="#FF000000" android:pathData="M9,18.4h30v1.6h-30z"/>
</vector>

View File

@@ -0,0 +1,22 @@
<!--
Copyright (C) 2016 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:viewportWidth="48.0"
android:viewportHeight="48.0">
<path android:name="face_spot" android:fillColor="#FF000000" android:pathData="M19.5,15.2a4.5,3.2 0,1 0,9 0a4.5,3.2 0,1 0,-9 0z"/>
</vector>

View File

@@ -0,0 +1,24 @@
<!--
Copyright (C) 2015 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:viewportWidth="48.0"
android:viewportHeight="48.0">
<path
android:fillColor="#FF000000"
android:pathData="M42.6,14.9c-0.8,0,-2.6,-1.3,-2.7,-1.6c-0.2,-0.2,-2.2,-0.9,-2.7,-2c-0.2,-0.4,-1.1,-3.4,-1.1,-3.4s0,0,-1.8,3 c-1.8,3,-4.3,3.1,-7.6,3c-3.3,-0.1,-3,3.4,-5.5,5.8c-2.5,2.4,-5.4,3,-9.6,2.5c-4.2,-0.6,-6.8,6.7,-6.8,6.7s1.5,0.5,2.5,0.5s2.5,1.2,3.3,5 c0.8,3.9,5.1,6.5,5.1,6.5s0.1,-6.3,1.2,-9.2c1.1,-2.9,6.4,-0.5,9.8,-1.3c3.4,-0.8,3.3,-4.8,4.2,-6.7c0.9,-1.9,3.9,-2.6,7.6,-3.4 C42.2,19.4,43.4,14.9,42.6,14.9z M13.4,30.7c-0.6,2.1,-0.6,1.7,-0.6,1.7s0,-2.6,0.8,-3.3c0.8,-0.6,4.8,-1,4.8,-1S14.1,28.6,13.4,30.7z M13.4,25.6c-1.5,0.8,-3,1.8,-3,1.8s-1.1,-1.7,1.1,-2.3c2.2,-0.6,9,0.6,10,-2.2c1,-2.6,3.8,-7.5,4.5,-7.1c-1.5,1.7,-3.1,7,-4.3,8.6 C20.8,25.7,14.9,24.8,13.4,25.6z M31.7,17.3c-2.1,0.9,-3.9,2.3,-5.3,5.7c-1.4,3.3,-3.5,2.7,-3.5,2.7c5.6,-5,3.2,-7.4,5.5,-8.4 c3.5,-1.5,2.6,0.2,4.8,-1.3c2.3,-1.6,3.1,-2.6,3.1,-2.6C36.4,13.4,34.1,16.3,31.7,17.3z"/>
</vector>

View File

@@ -0,0 +1,33 @@
<!--
Copyright (C) 2015 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:viewportWidth="48.0"
android:viewportHeight="48.0">
<path
android:fillColor="#FF000000"
android:pathData="M19.1,34l-3.5,1.3c-1,0.4,-2.2,-0.1,-2.6,-1.1l-1.2,-3c-0.4,-1,0.1,-2.2,1.1,-2.6l3.5,-1.3c1,-0.4,2.2,0.1,2.6,1.1l1.2,3 C20.6,32.4,20.1,33.6,19.1,34z"/>
<path
android:fillColor="#FF000000"
android:pathData="M25.2,28.1L22.9,28c-0.8,0,-1.5,-0.7,-1.4,-1.6l0.1,-2c0,-0.8,0.7,-1.5,1.6,-1.4l2.4,0.1c0.8,0,1.5,0.7,1.4,1.6l-0.1,2 C26.8,27.5,26.1,28.1,25.2,28.1z"/>
<path
android:fillColor="#FF000000"
android:pathData="M18.7,23.1L16.5,23c-0.5,0,-0.9,-0.4,-0.8,-0.9l0.1,-2.2c0,-0.5,0.4,-0.9,0.9,-0.8l2.2,0.1c0.5,0,0.9,0.4,0.8,0.9 l-0.1,2.2C19.6,22.8,19.2,23.1,18.7,23.1z"/>
<path
android:fillColor="#FF000000"
android:pathData="M32.2,35.3l-3.6,-1.8c-1,-0.5,-1.4,-1.7,-0.9,-2.7l1.6,-3.1c0.5,-1,1.7,-1.4,2.7,-0.9l3.6,1.8c1,0.5,1.4,1.7,0.9,2.7 l-1.6,3.1C34.4,35.4,33.2,35.7,32.2,35.3z"/>
</vector>

View File

@@ -0,0 +1,24 @@
<!--
Copyright (C) 2015 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:viewportWidth="48.0"
android:viewportHeight="48.0">
<path
android:fillColor="#FF000000"
android:pathData="M24,13.8C11.3,13.8,1,18.3,1,24c0,5.7,10.3,10.2,23,10.2S47,29.7,47,24C47,18.3,36.7,13.8,24,13.8z M33.7,26.6 c1.1,-0.6,1.8,-1.3,1.8,-2c0,-2.1,-5.2,-3.8,-11.7,-3.8s-11.7,1.7,-11.7,3.8c0,0.6,0.4,1.2,1.2,1.7c-1.7,-0.8,-2.8,-1.7,-2.8,-2.8 c0,-2.5,6,-4.5,13.4,-4.5s13.4,2,13.4,4.5C37.4,24.7,36,25.8,33.7,26.6z"/>
</vector>

View File

@@ -0,0 +1,24 @@
<!--
Copyright (C) 2015 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:viewportWidth="48.0"
android:viewportHeight="48.0">
<path
android:fillColor="#FF000000"
android:pathData="M24,4.5c-10.5,0,-19,8.5,-19,19s8.5,19,19,19s19,-8.5,19,-19S34.5,4.5,24,4.5z M35.2,15.5l1.6,-1.1 c0.3,-0.2,0.6,-0.1,0.8,0.1l0.1,0.1c0.2,0.3,0.1,0.6,-0.1,0.8l-1.6,1.1c-0.3,0.2,-0.6,0.1,-0.8,-0.1l-0.1,-0.1 C34.9,16.1,35,15.7,35.2,15.5z M32.7,10.7c0,-0.3,0.3,-0.5,0.6,-0.5l0.1,0c0.3,0,0.5,0.3,0.5,0.6l-0.2,2c0,0.3,-0.3,0.5,-0.6,0.5l-0.1,0 c-0.3,0,-0.5,-0.3,-0.5,-0.6L32.7,10.7z M31.7,15.1l1.5,-0.2c0.2,0,0.5,0.1,0.5,0.4l0,0.1c0,0.2,-0.1,0.5,-0.4,0.5l-1.5,0.2 c-0.2,0,-0.5,-0.1,-0.5,-0.4l0,-0.1C31.3,15.4,31.5,15.2,31.7,15.1z M28.8,10.6l1.6,-1.1c0.3,-0.2,0.6,-0.1,0.8,0.1l0.1,0.1 c0.2,0.3,0.1,0.6,-0.1,0.8l-1.6,1.1c-0.3,0.2,-0.6,0.1,-0.8,-0.1l-0.1,-0.1C28.4,11.1,28.5,10.8,28.8,10.6z M25.8,6 c0,-0.3,0.3,-0.5,0.6,-0.5l0.1,0c0.3,0,0.5,0.3,0.5,0.6l-0.2,2c0,0.3,-0.3,0.5,-0.6,0.5l-0.1,0c-0.3,0,-0.5,-0.3,-0.5,-0.6L25.8,6z M20.7,6.5l1.9,-0.7c0.3,-0.1,0.6,0,0.7,0.3l0,0.1c0.1,0.3,0,0.6,-0.3,0.7l-1.9,0.7c-0.3,0.1,-0.6,0,-0.7,-0.3l0,-0.1 C20.3,6.9,20.4,6.6,20.7,6.5z M19.9,10.9l1.5,-0.2c0.2,0,0.5,0.1,0.5,0.4l0,0.1c0,0.2,-0.1,0.5,-0.4,0.5l-1.5,0.2 c-0.2,0,-0.5,-0.1,-0.5,-0.4l0,-0.1C19.5,11.1,19.7,10.9,19.9,10.9z M16,10.9L16,10.9c0.2,-0.3,0.4,-0.4,0.6,-0.3l1.3,0.7 c0.2,0.1,0.3,0.4,0.2,0.6L18,12c-0.1,0.2,-0.4,0.3,-0.6,0.2l-1.3,-0.7C15.9,11.4,15.8,11.1,16,10.9z M15.8,18.5c0.2,0,0.4,0.1,0.5,0.4 l0,0.1c0,0.2,-0.1,0.4,-0.4,0.5l-1.5,0.2c-0.2,0,-0.4,-0.1,-0.5,-0.4l0,-0.1c0,-0.2,0.1,-0.4,0.4,-0.5L15.8,18.5z M14,21.8l-1.6,1.1 c-0.3,0.2,-0.6,0.1,-0.8,-0.1l-0.1,-0.1c-0.2,-0.3,-0.1,-0.6,0.1,-0.8l1.6,-1.1c0.3,-0.2,0.6,-0.1,0.8,0.1l0.1,0.1 C14.3,21.3,14.3,21.6,14,21.8z M12.4,12L12.4,12c0.3,-0.2,0.5,-0.2,0.7,-0.1l1,1.1c0.2,0.2,0.2,0.4,0,0.6L14,13.7 c-0.2,0.2,-0.4,0.2,-0.6,0l-1,-1.1C12.2,12.4,12.2,12.1,12.4,12z M8.3,24.5c0,0.3,-0.3,0.5,-0.6,0.5l-0.1,0c-0.3,0,-0.5,-0.3,-0.5,-0.6 l0.2,-2c0,-0.3,0.3,-0.5,0.6,-0.5l0.1,0c0.3,0,0.5,0.3,0.5,0.6L8.3,24.5z M8.5,16.2v-0.1c0,-0.3,0.2,-0.6,0.6,-0.6h2 c0.3,0,0.6,0.2,0.6,0.6v0.1c0,0.3,-0.2,0.6,-0.6,0.6H9C8.7,16.7,8.5,16.5,8.5,16.2z M10.3,20.7c-0.3,0.2,-0.6,0.1,-0.8,-0.1l-0.1,-0.1 c-0.2,-0.3,-0.1,-0.6,0.1,-0.8l1.6,-1.1c0.3,-0.2,0.6,-0.1,0.8,0.1l0.1,0.1c0.2,0.3,0.1,0.6,-0.1,0.8L10.3,20.7z M11.3,28.3l0,-0.1 c-0.1,-0.3,0,-0.6,0.3,-0.7l1.9,-0.7c0.3,-0.1,0.6,0,0.7,0.3l0,0.1c0.1,0.3,0,0.6,-0.3,0.7L12,28.6C11.7,28.7,11.4,28.6,11.3,28.3z M14.4,33c0,0.2,-0.2,0.4,-0.4,0.4h-1.5c-0.2,0,-0.4,-0.2,-0.4,-0.4v-0.1c0,-0.2,0.2,-0.4,0.4,-0.4H14c0.2,0,0.4,0.2,0.4,0.4V33z M17.9,35.2 l-1.6,1.1c-0.3,0.2,-0.6,0.1,-0.8,-0.1l-0.1,-0.1c-0.2,-0.3,-0.1,-0.6,0.1,-0.8l1.6,-1.1c0.3,-0.2,0.6,-0.1,0.8,0.1l0.1,0.1 C18.2,34.7,18.2,35.1,17.9,35.2z M20.7,33.8l-0.1,0.1c-0.1,0.3,-0.5,0.4,-0.8,0.2l-1.7,-1c-0.3,-0.1,-0.4,-0.5,-0.2,-0.8l0.1,-0.1 c0.1,-0.3,0.5,-0.4,0.8,-0.2l1.7,1C20.7,33.2,20.8,33.5,20.7,33.8z M17.5,23.5c0,-3.6,2.9,-6.5,6.5,-6.5s6.5,2.9,6.5,6.5 c0,3.6,-2.9,6.5,-6.5,6.5S17.5,27.1,17.5,23.5z M27.4,35.7l-1.9,0.7c-0.3,0.1,-0.6,0,-0.7,-0.3l0,-0.1c-0.1,-0.3,0,-0.6,0.3,-0.7l1.9,-0.7 c0.3,-0.1,0.6,0,0.7,0.3l0,0.1C27.9,35.3,27.7,35.6,27.4,35.7z M29.7,32.7l-1.4,0.5c-0.2,0.1,-0.5,0,-0.5,-0.3l0,-0.1 c-0.1,-0.2,0,-0.5,0.3,-0.5l1.4,-0.5c0.2,-0.1,0.5,0,0.5,0.3l0,0.1C30,32.3,29.9,32.6,29.7,32.7z M32.8,35.5l-0.1,0.1 c-0.1,0.3,-0.5,0.4,-0.8,0.2l-1.7,-1c-0.3,-0.1,-0.4,-0.5,-0.2,-0.8l0.1,-0.1c0.1,-0.3,0.5,-0.4,0.8,-0.2l1.7,1C32.8,34.9,32.9,35.2,32.8,35.5z M33.7,30.9c0,0.2,-0.2,0.4,-0.5,0.4l-0.1,0c-0.2,0,-0.4,-0.2,-0.4,-0.5l0.1,-1.5c0,-0.2,0.2,-0.4,0.5,-0.4l0.1,0c0.2,0,0.4,0.2,0.4,0.5 L33.7,30.9z M34.5,26.5l-1.3,0.9c-0.2,0.1,-0.5,0.1,-0.6,-0.1l-0.1,-0.1c-0.1,-0.2,-0.1,-0.5,0.1,-0.6l1.3,-0.9c0.2,-0.1,0.5,-0.1,0.6,0.1 l0.1,0.1C34.8,26.1,34.7,26.3,34.5,26.5z M35.6,20.6l-1.7,-1c-0.3,-0.1,-0.4,-0.5,-0.2,-0.8l0.1,-0.1c0.1,-0.3,0.5,-0.4,0.8,-0.2l1.7,1 c0.3,0.1,0.4,0.5,0.2,0.8l-0.1,0.1C36.2,20.6,35.8,20.7,35.6,20.6z M38.6,27.1l-1.6,1.1c-0.3,0.2,-0.6,0.1,-0.8,-0.1L36.1,28 c-0.2,-0.3,-0.1,-0.6,0.1,-0.8l1.6,-1.1c0.3,-0.2,0.6,-0.1,0.8,0.1l0.1,0.1C38.9,26.6,38.8,27,38.6,27.1z M39,19.4l-1.5,0.2 c-0.2,0,-0.5,-0.1,-0.5,-0.4l0,-0.1c0,-0.2,0.1,-0.5,0.4,-0.5l1.5,-0.2c0.2,0,0.5,0.1,0.5,0.4l0,0.1C39.4,19.1,39.2,19.3,39,19.4z"/>
</vector>

View File

@@ -0,0 +1,24 @@
<!--
Copyright (C) 2015 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:viewportWidth="48.0"
android:viewportHeight="48.0">
<path
android:fillColor="#FF000000"
android:pathData="M46,18.4l-5.8,4.6c-3.9,-3.2,-8.9,-5.6,-14.6,-6.3l1.2,-6l-7.3,5.9C12.5,17.2,6.4,20,2,24.3l7.2,1.4L2,27 c4.3,4.2,10.4,7.1,17.3,7.6l3.1,2.5L22,34.8c7.1,0,13.5,-2.5,18.2,-6.5l5.8,4.6l-1.4,-7.2L46,18.4z M14.3,24.8l-0.6,0.6l-1.1,-1.1 l-1.1,1.1l-0.6,-0.6l1.1,-1.1l-1.1,-1.1l0.6,-0.6l1.1,1.1l1.1,-1.1l0.6,0.6l-1.1,1.1L14.3,24.8z M18.8,29.1c0.7,-0.8,1.1,-2.2,1.1,-3.8 c0,-1.6,-0.4,-3,-1.1,-3.8c1.1,0.5,1.9,2,1.9,3.8S19.9,28.5,18.8,29.1z M20.7,29.1c0.7,-0.8,1.1,-2.2,1.1,-3.8c0,-1.6,-0.4,-3,-1.1,-3.8 c1.1,0.5,1.9,2,1.9,3.8S21.8,28.5,20.7,29.1z"/>
</vector>

View File

@@ -0,0 +1,22 @@
<!--
Copyright (C) 2016 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:viewportWidth="48.0"
android:viewportHeight="48.0">
<path android:name="foot1" android:fillColor="#FF000000" android:pathData="M11.5,43m-2.5,0a2.5,2.5 0,1 1,5 0a2.5,2.5 0,1 1,-5 0"/>
</vector>

View File

@@ -0,0 +1,22 @@
<!--
Copyright (C) 2016 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:viewportWidth="48.0"
android:viewportHeight="48.0">
<path android:name="foot2" android:fillColor="#FF000000" android:pathData="M18.5,43m-2.5,0a2.5,2.5 0,1 1,5 0a2.5,2.5 0,1 1,-5 0"/>
</vector>

View File

@@ -0,0 +1,22 @@
<!--
Copyright (C) 2016 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:viewportWidth="48.0"
android:viewportHeight="48.0">
<path android:name="foot3" android:fillColor="#FF000000" android:pathData="M29.5,43m-2.5,0a2.5,2.5 0,1 1,5 0a2.5,2.5 0,1 1,-5 0"/>
</vector>

View File

@@ -0,0 +1,22 @@
<!--
Copyright (C) 2016 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:viewportWidth="48.0"
android:viewportHeight="48.0">
<path android:name="foot4" android:fillColor="#FF000000" android:pathData="M36.5,43m-2.5,0a2.5,2.5 0,1 1,5 0a2.5,2.5 0,1 1,-5 0"/>
</vector>

View File

@@ -0,0 +1,22 @@
<!--
Copyright (C) 2016 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:viewportWidth="48.0"
android:viewportHeight="48.0">
<path android:name="head" android:fillColor="#FF000000" android:pathData="M9,18.5c0,-8.3 6.8,-15 15,-15s15,6.7 15,15H9z"/>
</vector>

View File

@@ -0,0 +1,24 @@
<!--
Copyright (C) 2016 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24.0dp"
android:height="24.0dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FFFFFFFF"
android:pathData="M19.0,6.41L17.59,5.0 12.0,10.59 6.41,5.0 5.0,6.41 10.59,12.0 5.0,17.59 6.41,19.0 12.0,13.41 17.59,19.0 19.0,17.59 13.41,12.0z"/>
</vector>

View File

@@ -0,0 +1,24 @@
<!--
Copyright (C) 2016 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24.0dp"
android:height="24.0dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FFFFFFFF"
android:pathData="M18.0,16.08c-0.76,0.0 -1.4,0.3 -1.9,0.77L8.91,12.7c0.05,-0.2 0.09,-0.4 0.09,-0.7s-0.04,-0.47 -0.09,-0.7l7.05,-4.11c0.5,0.5 1.2,0.81 2.0,0.81 1.66,0.0 3.0,-1.34 3.0,-3.0s-1.34,-3.0 -3.0,-3.0 -3.0,1.34 -3.0,3.0c0.0,0.2 0.0,0.4 0.0,0.7L8.04,9.81C7.5,9.31 6.79,9.0 6.0,9.0c-1.66,0.0 -3.0,1.34 -3.0,3.0s1.34,3.0 3.0,3.0c0.79,0.0 1.5,-0.31 2.04,-0.81l7.12,4.16c0.0,0.21 0.0,0.43 0.0,0.65 0.0,1.61 1.31,2.92 2.92,2.92 1.61,0.0 2.92,-1.31 2.92,-2.92s-1.31,-2.92 -2.92,-2.92z"/>
</vector>

View File

@@ -0,0 +1,38 @@
<!--
Copyright (C) 2016 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:viewportWidth="48.0"
android:viewportHeight="48.0">
<path
android:fillColor="#00796B"
android:pathData="M32.0,12.5l0.0,28.0l12.0,-5.0l0.0,-28.0z"/>
<path
android:fillColor="#00796B"
android:pathData="M4.0,40.5l12.0,-5.0l0.0,-11.0l-12.0,-12.0z"/>
<path
android:fillColor="#40000000"
android:pathData="M44.0,35.5l-12.0,-12.0l0.0,-4.0z"/>
<path
android:fillColor="#40000000"
android:pathData="M4.0,12.5l12.0,12.0l0.0,4.0z"/>
<path
android:fillColor="#4DB6AC"
android:pathData="M32.0,23.5l-16.0,-16.0l-12.0,5.0l0.0,0.0l12.0,12.0l16.0,16.0l12.0,-5.0l0.0,0.0z"/>
</vector>

View File

@@ -0,0 +1,22 @@
<!--
Copyright (C) 2016 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:viewportWidth="48.0"
android:viewportHeight="48.0">
<path android:name="left_ear" android:fillColor="#FF000000" android:pathData="M15.4,1l5.1000004,5.3l-6.3,2.8000002z"/>
</vector>

View File

@@ -0,0 +1,22 @@
<!--
Copyright (C) 2016 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:viewportWidth="48.0"
android:viewportHeight="48.0">
<path android:name="left_ear_inside" android:fillColor="#FF000000" android:pathData="M15.4,1l3.5,6.2l-4.7,1.9z"/>
</vector>

View File

@@ -0,0 +1,22 @@
<!--
Copyright (C) 2016 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:viewportWidth="48.0"
android:viewportHeight="48.0">
<path android:name="left_eye" android:fillColor="#FF000000" android:pathData="M20.5,11c0,1.7 -3,1.7 -3,0C17.5,9.3 20.5,9.3 20.5,11z"/>
</vector>

View File

@@ -0,0 +1,22 @@
<!--
Copyright (C) 2016 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:viewportWidth="48.0"
android:viewportHeight="48.0">
<path android:name="leg1" android:fillColor="#FF000000" android:pathData="M9,38h5v5h-5z"/>
</vector>

View File

@@ -0,0 +1,22 @@
<!--
Copyright (C) 2016 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:viewportWidth="48.0"
android:viewportHeight="48.0">
<path android:name="leg2" android:fillColor="#FF000000" android:pathData="M16,38h5v5h-5z"/>
</vector>

View File

@@ -0,0 +1,22 @@
<!--
Copyright (C) 2016 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:viewportWidth="48.0"
android:viewportHeight="48.0">
<path android:name="leg2_shadow" android:fillColor="#FF000000" android:pathData="M16,38h5v1h-5z"/>
</vector>

View File

@@ -0,0 +1,22 @@
<!--
Copyright (C) 2016 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:viewportWidth="48.0"
android:viewportHeight="48.0">
<path android:name="leg3" android:fillColor="#FF000000" android:pathData="M27,38h5v5h-5z"/>
</vector>

View File

@@ -0,0 +1,22 @@
<!--
Copyright (C) 2016 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:viewportWidth="48.0"
android:viewportHeight="48.0">
<path android:name="leg4" android:fillColor="#FF000000" android:pathData="M34,38h5v5h-5z"/>
</vector>

View File

@@ -0,0 +1,27 @@
<!--
Copyright (C) 2016 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:viewportWidth="48.0"
android:viewportHeight="48.0">
<path android:name="mouth"
android:strokeColor="#FF000000"
android:strokeWidth="1.2"
android:strokeLineCap="round"
android:pathData="M29,14.3c-0.4,0.8 -1.3,1.4 -2.3,1.4c-1.4,0 -2.7,-1.3 -2.7,-2.7
M24,13c0,1.5 -1.2,2.7 -2.7,2.7c-1,0 -1.9,-0.5 -2.3,-1.4"/>
</vector>

View File

@@ -0,0 +1,22 @@
<!--
Copyright (C) 2016 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:viewportWidth="48.0"
android:viewportHeight="48.0">
<path android:name="nose" android:fillColor="#FF000000" android:pathData="M25.2,13c0,1.3 -2.3,1.3 -2.3,0S25.2,11.7 25.2,13z"/>
</vector>

View File

@@ -0,0 +1,22 @@
<!--
Copyright (C) 2016 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:viewportWidth="48.0"
android:viewportHeight="48.0">
<path android:name="right_ear" android:fillColor="#FF000000" android:pathData="M32.6,1l-5.0999985,5.3l6.299999,2.8000002z"/>
</vector>

View File

@@ -0,0 +1,23 @@
<!--
Copyright (C) 2016 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:viewportWidth="48.0"
android:viewportHeight="48.0">
<path android:name="right_ear_inside" android:fillColor="#FF000000" android:pathData="M33.8,9.1l-4.7,-1.9l3.5,-6.2z"/>
</vector>

View File

@@ -0,0 +1,22 @@
<!--
Copyright (C) 2016 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:viewportWidth="48.0"
android:viewportHeight="48.0">
<path android:name="right_eye" android:fillColor="#FF000000" android:pathData="M30.5,11c0,1.7 -3,1.7 -3,0C27.5,9.3 30.5,9.3 30.5,11z"/>
</vector>

View File

@@ -0,0 +1,30 @@
<!--
Copyright (C) 2015 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M12,2C6.5,2 2,6.5 2,12c0,5.5 4.5,10 10,10s10,-4.5 10,-10C22,6.5 17.5,2 12,2zM5.5,11c0,-1.6 3,-1.6 3,0C8.5,12.7 5.5,12.7 5.5,11zM17.5,14.6c-0.6,1 -1.7,1.7 -2.9,1.7c-1.1,0 -2,-0.6 -2.6,-1.4c-0.6,0.9 -1.6,1.4 -2.7,1.4c-1.3,0 -2.3,-0.7 -2.9,-1.8c-0.2,-0.3 0,-0.7 0.3,-0.8c0.3,-0.2 0.7,0 0.8,0.3c0.3,0.7 1,1.1 1.8,1.1c0.9,0 1.6,-0.5 1.9,-1.3c-0.2,-0.2 -0.4,-0.4 -0.4,-0.7c0,-1.3 2.3,-1.3 2.3,0c0,0.3 -0.2,0.6 -0.4,0.7c0.3,0.8 1.1,1.3 1.9,1.3c0.8,0 1.5,-0.6 1.8,-1.1c0.2,-0.3 0.6,-0.4 0.9,-0.2C17.6,13.9 17.7,14.3 17.5,14.6zM15.5,11c0,-1.6 3,-1.6 3,0C18.5,12.7 15.5,12.7 15.5,11z"/>
<path
android:fillColor="#FF000000"
android:pathData="M5.2,1.0l4.1000004,4.2l-5.0,2.1000004z"/>
<path
android:fillColor="#FF000000"
android:pathData="M18.8,1.0l-4.0999994,4.2l5.000001,2.1000004z"/>
</vector>

View File

@@ -0,0 +1,26 @@
<!--
Copyright (C) 2016 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:viewportWidth="48.0"
android:viewportHeight="48.0">
<path android:name="tail"
android:strokeColor="#FF000000"
android:strokeWidth="5"
android:strokeLineCap="round"
android:pathData="M35,35.5h5.9c2.1,0 3.8,-1.7 3.8,-3.8v-6.2"/>
</vector>

View File

@@ -0,0 +1,22 @@
<!--
Copyright (C) 2016 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:viewportWidth="48.0"
android:viewportHeight="48.0">
<path android:name="tail_cap" android:fillColor="#FF000000" android:pathData="M42.2,25.5c0,-1.4 1.1,-2.5 2.5,-2.5s2.5,1.1 2.5,2.5H42.2z"/>
</vector>

View File

@@ -0,0 +1,22 @@
<!--
Copyright (C) 2016 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:viewportWidth="48.0"
android:viewportHeight="48.0">
<path android:name="tail_shadow" android:fillColor="#FF000000" android:pathData="M40,38l0,-5l-1,0l0,5z"/>
</vector>

View File

@@ -0,0 +1,79 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2016 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the
License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the specific language governing
permissions and limitations under the License.
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?android:attr/listPreferredItemHeightSmall"
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:gravity="center_horizontal"
android:clipToPadding="false">
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:id="@android:id/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="10dp"
android:scaleType="fitCenter" />
<LinearLayout
android:id="@+id/contextGroup"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="invisible"
android:layout_gravity="bottom">
<ImageView
android:id="@android:id/shareText"
android:layout_width="40dp"
android:layout_height="40dp"
android:padding="8dp"
android:src="@drawable/ic_share"
android:scaleType="fitCenter"
android:background="#40000000"/>
<Space
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1" />
<ImageView
android:id="@android:id/closeButton"
android:layout_width="40dp"
android:layout_height="40dp"
android:padding="4dp"
android:src="@drawable/ic_close"
android:scaleType="fitCenter"
android:background="#40000000"/>
</LinearLayout>
</FrameLayout>
<TextView
android:id="@android:id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceListItem"
android:gravity="center"/>
</LinearLayout>

View File

@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2016 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the
License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the specific language governing
permissions and limitations under the License.
-->
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingStart="20dp"
android:paddingEnd="20dp">
<EditText
android:id="@android:id/edit"
android:maxLines="1"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</FrameLayout>

View File

@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2016 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the
License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the specific language governing
permissions and limitations under the License.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:paddingLeft="4dp" android:paddingRight="4dp"
android:paddingBottom="6dp" android:paddingTop="6dp">
<ImageView
android:layout_width="64dp"
android:layout_height="64dp"
android:id="@+id/icon"
android:tint="?android:attr/colorControlNormal"/>
<TextView android:layout_width="64dp" android:layout_height="wrap_content"
android:gravity="top|center_horizontal"
android:id="@+id/text" />
</LinearLayout>

View File

@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2016 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView
android:id="@+id/holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"/>
</FrameLayout>

View File

@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2016 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<string name="app_name" translatable="false">Android Easter Egg</string>
<string name="notification_name" translatable="false">Android Neko</string>
<string name="default_tile_name" translatable="false">\????</string>
<string name="notification_title" translatable="false">A cat is here.</string>
<string name="default_cat_name" translatable="false">Cat #%s</string>
<string name="directory_name" translatable="false">Cats</string>
<string-array name="food_names" translatable="false">
<item>Empty dish</item>
<item>Bits</item>
<item>Fish</item>
<item>Bacon</item>
<item>Treat</item>
</string-array>
<array name="food_icons">
<item>@drawable/food_dish</item>
<item>@drawable/food_bits</item>
<item>@drawable/food_sysuituna</item>
<item>@drawable/food_bacon</item>
<item>@drawable/food_donut</item>
</array>
<integer-array name="food_intervals">
<item>0</item>
<item>15</item>
<item>30</item>
<item>60</item>
<item>120</item>
</integer-array>
<integer-array name="food_new_cat_prob">
<item>0</item>
<item>5</item>
<item>25</item>
<item>50</item>
<item>75</item>
</integer-array>
</resources>

View File

@@ -0,0 +1,373 @@
/*
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
package com.android.egg.neko;
import android.app.Notification;
import android.app.PendingIntent;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.graphics.*;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.Icon;
import android.os.Bundle;
import java.util.Random;
import java.util.concurrent.ThreadLocalRandom;
import com.android.egg.R;
public class Cat extends Drawable {
private Random mNotSoRandom;
private Bitmap mBitmap;
private long mSeed;
private String mName;
private int mBodyColor;
private synchronized Random notSoRandom(long seed) {
if (mNotSoRandom == null) {
mNotSoRandom = new Random();
mNotSoRandom.setSeed(seed);
}
return mNotSoRandom;
}
public static final float frandrange(Random r, float a, float b) {
return (b-a)*r.nextFloat() + a;
}
public static final Object choose(Random r, Object...l) {
return l[r.nextInt(l.length)];
}
public static final int chooseP(Random r, int[] a) {
int pct = r.nextInt(1000);
final int stop = a.length-2;
int i=0;
while (i<stop) {
pct -= a[i];
if (pct < 0) break;
i+=2;
}
return a[i+1];
}
public static final int[] P_BODY_COLORS = {
180, 0xFF212121, // black
180, 0xFFFFFFFF, // white
140, 0xFF616161, // gray
140, 0xFF795548, // brown
100, 0xFF90A4AE, // steel
100, 0xFFFFF9C4, // buff
100, 0xFFFF8F00, // orange
5, 0xFF29B6F6, // blue..?
5, 0xFFFFCDD2, // pink!?
5, 0xFFCE93D8, // purple?!?!?
4, 0xFF43A047, // yeah, why not green
1, 0, // ?!?!?!
};
public static final int[] P_COLLAR_COLORS = {
250, 0xFFFFFFFF,
250, 0xFF000000,
250, 0xFFF44336,
50, 0xFF1976D2,
50, 0xFFFDD835,
50, 0xFFFB8C00,
50, 0xFFF48FB1,
50, 0xFF4CAF50,
};
public static final int[] P_BELLY_COLORS = {
750, 0,
250, 0xFFFFFFFF,
};
public static final int[] P_DARK_SPOT_COLORS = {
700, 0,
250, 0xFF212121,
50, 0xFF6D4C41,
};
public static final int[] P_LIGHT_SPOT_COLORS = {
700, 0,
300, 0xFFFFFFFF,
};
private CatParts D;
public static void tint(int color, Drawable ... ds) {
for (Drawable d : ds) {
if (d != null) {
d.mutate().setTint(color);
}
}
}
public static boolean isDark(int color) {
final int r = (color & 0xFF0000) >> 16;
final int g = (color & 0x00FF00) >> 8;
final int b = color & 0x0000FF;
return (r + g + b) < 0x80;
}
public Cat(Context context, long seed) {
D = new CatParts(context);
mSeed = seed;
setName(context.getString(R.string.default_cat_name,
String.valueOf(mSeed).substring(0, 3)));
final Random nsr = notSoRandom(seed);
// body color
mBodyColor = chooseP(nsr, P_BODY_COLORS);
if (mBodyColor == 0) mBodyColor = Color.HSVToColor(new float[] {
nsr.nextFloat()*360f, frandrange(nsr,0.5f,1f), frandrange(nsr,0.5f, 1f)});
tint(mBodyColor, D.body, D.head, D.leg1, D.leg2, D.leg3, D.leg4, D.tail,
D.leftEar, D.rightEar, D.foot1, D.foot2, D.foot3, D.foot4, D.tailCap);
tint(0x20000000, D.leg2Shadow, D.tailShadow);
if (isDark(mBodyColor)) {
tint(0xFFFFFFFF, D.leftEye, D.rightEye, D.mouth, D.nose);
}
tint(isDark(mBodyColor) ? 0xFFEF9A9A : 0x20D50000, D.leftEarInside, D.rightEarInside);
tint(chooseP(nsr, P_BELLY_COLORS), D.belly);
tint(chooseP(nsr, P_BELLY_COLORS), D.back);
final int faceColor = chooseP(nsr, P_BELLY_COLORS);
tint(faceColor, D.faceSpot);
if (!isDark(faceColor)) {
tint(0xFF000000, D.mouth, D.nose);
}
if (nsr.nextFloat() < 0.25f) {
tint(0xFFFFFFFF, D.foot1, D.foot2, D.foot3, D.foot4);
} else {
if (nsr.nextFloat() < 0.25f) {
tint(0xFFFFFFFF, D.foot1, D.foot2);
} else if (nsr.nextFloat() < 0.25f) {
tint(0xFFFFFFFF, D.foot3, D.foot4);
} else if (nsr.nextFloat() < 0.1f) {
tint(0xFFFFFFFF, (Drawable) choose(nsr, D.foot1, D.foot2, D.foot3, D.foot4));
}
}
tint(nsr.nextFloat() < 0.333f ? 0xFFFFFFFF : mBodyColor, D.tailCap);
final int capColor = chooseP(nsr, isDark(mBodyColor) ? P_LIGHT_SPOT_COLORS : P_DARK_SPOT_COLORS);
tint(capColor, D.cap);
//tint(chooseP(nsr, isDark(bodyColor) ? P_LIGHT_SPOT_COLORS : P_DARK_SPOT_COLORS), D.nose);
final int collarColor = chooseP(nsr, P_COLLAR_COLORS);
tint(collarColor, D.collar);
tint((nsr.nextFloat() < 0.1f) ? collarColor : 0, D.bowtie);
}
public static Cat create(Context context) {
return new Cat(context, Math.abs(ThreadLocalRandom.current().nextInt()));
}
public Notification.Builder buildNotification(Context context) {
final Bundle extras = new Bundle();
extras.putString("android.substName", context.getString(R.string.notification_name));
final Intent intent = new Intent(Intent.ACTION_MAIN)
.setClass(context, NekoLand.class)
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
return new Notification.Builder(context)
.setSmallIcon(Icon.createWithResource(context, R.drawable.stat_icon))
.setLargeIcon(createLargeIcon(context))
.setColor(getBodyColor())
.setPriority(Notification.PRIORITY_LOW)
.setContentTitle(context.getString(R.string.notification_title))
.setShowWhen(true)
.setCategory(Notification.CATEGORY_STATUS)
.setContentText(getName())
.setContentIntent(PendingIntent.getActivity(context, 0, intent, 0))
.setAutoCancel(true)
.addExtras(extras);
}
public long getSeed() {
return mSeed;
}
@Override
public void draw(Canvas canvas) {
final int w = Math.min(canvas.getWidth(), canvas.getHeight());
final int h = w;
if (mBitmap == null || mBitmap.getWidth() != w || mBitmap.getHeight() != h) {
mBitmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888);
final Canvas bitCanvas = new Canvas(mBitmap);
slowDraw(bitCanvas, 0, 0, w, h);
}
canvas.drawBitmap(mBitmap, 0, 0, null);
}
private void slowDraw(Canvas canvas, int x, int y, int w, int h) {
for (int i = 0; i < D.drawingOrder.length; i++) {
final Drawable d = D.drawingOrder[i];
if (d != null) {
d.setBounds(x, y, x+w, y+h);
d.draw(canvas);
}
}
}
public Bitmap createBitmap(int w, int h) {
if (mBitmap != null && mBitmap.getWidth() == w && mBitmap.getHeight() == h) {
return mBitmap.copy(mBitmap.getConfig(), true);
}
Bitmap result = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888);
slowDraw(new Canvas(result), 0, 0, w, h);
return result;
}
public Icon createLargeIcon(Context context) {
final Resources res = context.getResources();
final int w = res.getDimensionPixelSize(android.R.dimen.notification_large_icon_width);
final int h = res.getDimensionPixelSize(android.R.dimen.notification_large_icon_height);
Bitmap result = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888);
final Canvas canvas = new Canvas(result);
final Paint pt = new Paint();
float[] hsv = new float[3];
Color.colorToHSV(mBodyColor, hsv);
hsv[2] = (hsv[2]>0.5f)
? (hsv[2] - 0.25f)
: (hsv[2] + 0.25f);
pt.setColor(Color.HSVToColor(hsv));
float r = w/2;
canvas.drawCircle(r, r, r, pt);
int m = w/10;
slowDraw(canvas, m, m, w-m-m, h-m-m);
return Icon.createWithBitmap(result);
}
@Override
public void setAlpha(int i) {
}
@Override
public void setColorFilter(ColorFilter colorFilter) {
}
@Override
public int getOpacity() {
return PixelFormat.TRANSLUCENT;
}
public String getName() {
return mName;
}
public void setName(String name) {
this.mName = name;
}
public int getBodyColor() {
return mBodyColor;
}
public static class CatParts {
public Drawable leftEar;
public Drawable rightEar;
public Drawable rightEarInside;
public Drawable leftEarInside;
public Drawable head;
public Drawable faceSpot;
public Drawable cap;
public Drawable mouth;
public Drawable body;
public Drawable foot1;
public Drawable leg1;
public Drawable foot2;
public Drawable leg2;
public Drawable foot3;
public Drawable leg3;
public Drawable foot4;
public Drawable leg4;
public Drawable tail;
public Drawable leg2Shadow;
public Drawable tailShadow;
public Drawable tailCap;
public Drawable belly;
public Drawable back;
public Drawable rightEye;
public Drawable leftEye;
public Drawable nose;
public Drawable bowtie;
public Drawable collar;
public Drawable[] drawingOrder;
public CatParts(Context context) {
body = context.getDrawable(R.drawable.body);
head = context.getDrawable(R.drawable.head);
leg1 = context.getDrawable(R.drawable.leg1);
leg2 = context.getDrawable(R.drawable.leg2);
leg3 = context.getDrawable(R.drawable.leg3);
leg4 = context.getDrawable(R.drawable.leg4);
tail = context.getDrawable(R.drawable.tail);
leftEar = context.getDrawable(R.drawable.left_ear);
rightEar = context.getDrawable(R.drawable.right_ear);
rightEarInside = context.getDrawable(R.drawable.right_ear_inside);
leftEarInside = context.getDrawable(R.drawable.left_ear_inside);
faceSpot = context.getDrawable(R.drawable.face_spot);
cap = context.getDrawable(R.drawable.cap);
mouth = context.getDrawable(R.drawable.mouth);
foot4 = context.getDrawable(R.drawable.foot4);
foot3 = context.getDrawable(R.drawable.foot3);
foot1 = context.getDrawable(R.drawable.foot1);
foot2 = context.getDrawable(R.drawable.foot2);
leg2Shadow = context.getDrawable(R.drawable.leg2_shadow);
tailShadow = context.getDrawable(R.drawable.tail_shadow);
tailCap = context.getDrawable(R.drawable.tail_cap);
belly = context.getDrawable(R.drawable.belly);
back = context.getDrawable(R.drawable.back);
rightEye = context.getDrawable(R.drawable.right_eye);
leftEye = context.getDrawable(R.drawable.left_eye);
nose = context.getDrawable(R.drawable.nose);
collar = context.getDrawable(R.drawable.collar);
bowtie = context.getDrawable(R.drawable.bowtie);
drawingOrder = getDrawingOrder();
}
private Drawable[] getDrawingOrder() {
return new Drawable[] {
collar,
leftEar, leftEarInside, rightEar, rightEarInside,
head,
faceSpot,
cap,
leftEye, rightEye,
nose, mouth,
tail, tailCap, tailShadow,
foot1, leg1,
foot2, leg2,
foot3, leg3,
foot4, leg4,
leg2Shadow,
body, belly,
bowtie
};
}
}
}

View File

@@ -0,0 +1,60 @@
/*
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
package com.android.egg.neko;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.Icon;
import com.android.egg.R;
public class Food {
private final int mType;
private static int[] sIcons;
private static String[] sNames;
public Food(int type) {
mType = type;
}
public Icon getIcon(Context context) {
if (sIcons == null) {
TypedArray icons = context.getResources().obtainTypedArray(R.array.food_icons);
sIcons = new int[icons.length()];
for (int i = 0; i < sIcons.length; i++) {
sIcons[i] = icons.getResourceId(i, 0);
}
icons.recycle();
}
return Icon.createWithResource(context, sIcons[mType]);
}
public String getName(Context context) {
if (sNames == null) {
sNames = context.getResources().getStringArray(R.array.food_names);
}
return sNames[mType];
}
public long getInterval(Context context) {
return context.getResources().getIntArray(R.array.food_intervals)[mType];
}
public int getType() {
return mType;
}
}

View File

@@ -0,0 +1,40 @@
/*
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
package com.android.egg.neko;
import android.app.Activity;
import android.content.ComponentName;
import android.content.pm.PackageManager;
import android.util.Log;
public class NekoActivationActivity extends Activity {
@Override
public void onStart() {
final PackageManager pm = getPackageManager();
final ComponentName cn = new ComponentName(this, NekoTile.class);
if (pm.getComponentEnabledSetting(cn) == PackageManager.COMPONENT_ENABLED_STATE_ENABLED) {
if (NekoLand.DEBUG) {
Log.v("Neko", "Disabling tile.");
}
pm.setComponentEnabledSetting(cn, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, 0);
} else {
if (NekoLand.DEBUG) {
Log.v("Neko", "Enabling tile.");
}
pm.setComponentEnabledSetting(cn, PackageManager.COMPONENT_ENABLED_STATE_ENABLED, 0);
}
finish();
}
}

View File

@@ -0,0 +1,105 @@
/*
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
package com.android.egg.neko;
import android.support.annotation.NonNull;
import android.app.Dialog;
import android.content.Context;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.android.egg.R;
import java.util.ArrayList;
public class NekoDialog extends Dialog {
private final Adapter mAdapter;
public NekoDialog(@NonNull Context context) {
super(context, android.R.style.Theme_Material_Dialog_NoActionBar);
RecyclerView view = new RecyclerView(getContext());
mAdapter = new Adapter(getContext());
view.setLayoutManager(new GridLayoutManager(getContext(), 2));
view.setAdapter(mAdapter);
final float dp = context.getResources().getDisplayMetrics().density;
final int pad = (int)(16*dp);
view.setPadding(pad, pad, pad, pad);
setContentView(view);
}
private void onFoodSelected(Food food) {
PrefState prefs = new PrefState(getContext());
int currentState = prefs.getFoodState();
if (currentState == 0 && food.getType() != 0) {
NekoService.registerJob(getContext(), food.getInterval(getContext()));
}
prefs.setFoodState(food.getType());
dismiss();
}
private class Adapter extends RecyclerView.Adapter<Holder> {
private final Context mContext;
private final ArrayList<Food> mFoods = new ArrayList<>();
public Adapter(Context context) {
mContext = context;
int[] foods = context.getResources().getIntArray(R.array.food_names);
// skip food 0, you can't choose it
for (int i=1; i<foods.length; i++) {
mFoods.add(new Food(i));
}
}
@Override
public Holder onCreateViewHolder(ViewGroup parent, int viewType) {
return new Holder(LayoutInflater.from(parent.getContext())
.inflate(R.layout.food_layout, parent, false));
}
@Override
public void onBindViewHolder(final Holder holder, int position) {
final Food food = mFoods.get(position);
((ImageView) holder.itemView.findViewById(R.id.icon))
.setImageIcon(food.getIcon(mContext));
((TextView) holder.itemView.findViewById(R.id.text))
.setText(food.getName(mContext));
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onFoodSelected(mFoods.get(holder.getAdapterPosition()));
}
});
}
@Override
public int getItemCount() {
return mFoods.size();
}
}
public static class Holder extends RecyclerView.ViewHolder {
public Holder(View itemView) {
super(itemView);
}
}
}

View File

@@ -0,0 +1,280 @@
/*
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
package com.android.egg.neko;
import android.Manifest;
import android.app.ActionBar;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.media.MediaScannerConnection;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.provider.MediaStore.Images;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.ContextThemeWrapper;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnLongClickListener;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import com.android.egg.R;
import com.android.egg.neko.PrefState.PrefsListener;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
public class NekoLand extends Activity implements PrefsListener {
public static boolean DEBUG = false;
public static boolean DEBUG_NOTIFICATIONS = false;
private static final int STORAGE_PERM_REQUEST = 123;
private static boolean CAT_GEN = false;
private PrefState mPrefs;
private CatAdapter mAdapter;
private Cat mPendingShareCat;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.neko_activity);
final ActionBar actionBar = getActionBar();
if (actionBar != null) {
actionBar.setLogo(Cat.create(this));
actionBar.setDisplayUseLogoEnabled(false);
actionBar.setDisplayShowHomeEnabled(true);
}
mPrefs = new PrefState(this);
mPrefs.setListener(this);
final RecyclerView recyclerView = (RecyclerView) findViewById(R.id.holder);
mAdapter = new CatAdapter();
recyclerView.setAdapter(mAdapter);
recyclerView.setLayoutManager(new GridLayoutManager(this, 3));
updateCats();
}
@Override
protected void onDestroy() {
super.onDestroy();
mPrefs.setListener(null);
}
private void updateCats() {
Cat[] cats;
if (CAT_GEN) {
cats = new Cat[50];
for (int i = 0; i < cats.length; i++) {
cats[i] = Cat.create(this);
}
} else {
cats = mPrefs.getCats().toArray(new Cat[0]);
}
mAdapter.setCats(cats);
}
private void onCatClick(Cat cat) {
if (CAT_GEN) {
mPrefs.addCat(cat);
new AlertDialog.Builder(NekoLand.this)
.setTitle("Cat added")
.setPositiveButton(android.R.string.ok, null)
.show();
} else {
showNameDialog(cat);
}
// noman.notify(1, cat.buildNotification(NekoLand.this).build());
}
private void onCatRemove(Cat cat) {
mPrefs.removeCat(cat);
}
private void showNameDialog(final Cat cat) {
Context context = new ContextThemeWrapper(this,
android.R.style.Theme_Material_Light_Dialog_NoActionBar);
// TODO: Move to XML, add correct margins.
View view = LayoutInflater.from(context).inflate(R.layout.edit_text, null);
final EditText text = (EditText) view.findViewById(android.R.id.edit);
text.setText(cat.getName());
text.setSelection(cat.getName().length());
Drawable catIcon = cat.createLargeIcon(this).loadDrawable(this);
new AlertDialog.Builder(context)
.setTitle(" ")
.setIcon(catIcon)
.setView(view)
.setPositiveButton(android.R.string.ok, new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
cat.setName(text.getText().toString().trim());
mPrefs.addCat(cat);
}
}).show();
}
@Override
public void onPrefsChanged() {
updateCats();
}
private class CatAdapter extends RecyclerView.Adapter<CatHolder> {
private Cat[] mCats;
public void setCats(Cat[] cats) {
mCats = cats;
notifyDataSetChanged();
}
@Override
public CatHolder onCreateViewHolder(ViewGroup parent, int viewType) {
return new CatHolder(LayoutInflater.from(parent.getContext())
.inflate(R.layout.cat_view, parent, false));
}
@Override
public void onBindViewHolder(final CatHolder holder, int position) {
Context context = holder.itemView.getContext();
holder.imageView.setImageIcon(mCats[position].createLargeIcon(context));
holder.textView.setText(mCats[position].getName());
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onCatClick(mCats[holder.getAdapterPosition()]);
}
});
holder.itemView.setOnLongClickListener(new OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
holder.contextGroup.removeCallbacks((Runnable) holder.contextGroup.getTag());
holder.contextGroup.setVisibility(View.VISIBLE);
Runnable hideAction = new Runnable() {
@Override
public void run() {
holder.contextGroup.setVisibility(View.INVISIBLE);
}
};
holder.contextGroup.setTag(hideAction);
holder.contextGroup.postDelayed(hideAction, 5000);
return true;
}
});
holder.delete.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
holder.contextGroup.setVisibility(View.INVISIBLE);
holder.contextGroup.removeCallbacks((Runnable) holder.contextGroup.getTag());
onCatRemove(mCats[holder.getAdapterPosition()]);
}
});
holder.share.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Cat cat = mCats[holder.getAdapterPosition()];
if (checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE)
!= PackageManager.PERMISSION_GRANTED) {
mPendingShareCat = cat;
requestPermissions(
new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},
STORAGE_PERM_REQUEST);
return;
}
shareCat(cat);
}
});
}
@Override
public int getItemCount() {
return mCats.length;
}
}
private void shareCat(Cat cat) {
final File dir = new File(
Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES),
getString(R.string.directory_name));
if (!dir.exists() && !dir.mkdirs()) {
Log.e("NekoLand", "save: error: can't create Pictures directory");
return;
}
final File png = new File(dir, cat.getName().replaceAll("[/ #:]+", "_") + ".png");
Bitmap bitmap = cat.createBitmap(512, 512);
if (bitmap != null) {
try {
OutputStream os = new FileOutputStream(png);
bitmap.compress(Bitmap.CompressFormat.PNG, 0, os);
os.close();
MediaScannerConnection.scanFile(
this,
new String[] {png.toString()},
new String[] {"image/png"},
null);
Uri uri = Uri.fromFile(png);
Intent intent = new Intent(Intent.ACTION_SEND);
intent.putExtra(Intent.EXTRA_STREAM, uri);
intent.putExtra(Intent.EXTRA_SUBJECT, cat.getName());
intent.setType("image/png");
startActivity(Intent.createChooser(intent, null));
} catch (IOException e) {
Log.e("NekoLand", "save: error: " + e);
}
}
}
@Override
public void onRequestPermissionsResult(int requestCode,
String permissions[], int[] grantResults) {
if (requestCode == STORAGE_PERM_REQUEST) {
if (mPendingShareCat != null) {
shareCat(mPendingShareCat);
mPendingShareCat = null;
}
}
}
private static class CatHolder extends RecyclerView.ViewHolder {
private final ImageView imageView;
private final TextView textView;
private final View contextGroup;
private final View delete;
private final View share;
public CatHolder(View itemView) {
super(itemView);
imageView = (ImageView) itemView.findViewById(android.R.id.icon);
textView = (TextView) itemView.findViewById(android.R.id.title);
contextGroup = itemView.findViewById(R.id.contextGroup);
delete = itemView.findViewById(android.R.id.closeButton);
share = itemView.findViewById(android.R.id.shareText);
}
}
}

View File

@@ -0,0 +1,45 @@
/*
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
package com.android.egg.neko;
import android.support.annotation.Nullable;
import android.app.Activity;
import android.content.DialogInterface;
import android.content.DialogInterface.OnDismissListener;
import android.os.Bundle;
import android.view.WindowManager;
public class NekoLockedActivity extends Activity implements OnDismissListener {
private NekoDialog mDialog;
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
mDialog = new NekoDialog(this);
mDialog.setOnDismissListener(this);
mDialog.show();
}
@Override
public void onDismiss(DialogInterface dialog) {
finish();
}
}

View File

@@ -0,0 +1,136 @@
/*
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
package com.android.egg.neko;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.job.JobInfo;
import android.app.job.JobParameters;
import android.app.job.JobScheduler;
import android.app.job.JobService;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import java.util.List;
import android.util.Log;
import com.android.egg.R;
import java.util.Random;
public class NekoService extends JobService {
private static final String TAG = "NekoService";
public static int JOB_ID = 42;
public static int CAT_NOTIFICATION = 1;
public static float CAT_CAPTURE_PROB = 1.0f; // generous
public static long SECONDS = 1000;
public static long MINUTES = 60 * SECONDS;
public static long INTERVAL_FLEX = 5 * MINUTES;
public static float INTERVAL_JITTER_FRAC = 0.25f;
@Override
public boolean onStartJob(JobParameters params) {
Log.v(TAG, "Starting job: " + String.valueOf(params));
NotificationManager noman = getSystemService(NotificationManager.class);
if (NekoLand.DEBUG_NOTIFICATIONS) {
final Bundle extras = new Bundle();
extras.putString("android.substName", getString(R.string.notification_name));
final int size = getResources()
.getDimensionPixelSize(android.R.dimen.notification_large_icon_width);
final Cat cat = Cat.create(this);
final Notification.Builder builder
= cat.buildNotification(this)
.setContentTitle("DEBUG")
.setContentText("Ran job: " + params);
noman.notify(1, builder.build());
}
final PrefState prefs = new PrefState(this);
int food = prefs.getFoodState();
if (food != 0) {
prefs.setFoodState(0); // nom
final Random rng = new Random();
if (rng.nextFloat() <= CAT_CAPTURE_PROB) {
Cat cat;
List<Cat> cats = prefs.getCats();
final int[] probs = getResources().getIntArray(R.array.food_new_cat_prob);
final float new_cat_prob = (float)((food < probs.length) ? probs[food] : 50) / 100f;
if (cats.size() == 0 || rng.nextFloat() <= new_cat_prob) {
cat = Cat.create(this);
prefs.addCat(cat);
Log.v(TAG, "A new cat is here: " + cat.getName());
} else {
cat = cats.get(rng.nextInt(cats.size()));
Log.v(TAG, "A cat has returned: " + cat.getName());
}
final Notification.Builder builder = cat.buildNotification(this);
noman.notify(CAT_NOTIFICATION, builder.build());
}
}
cancelJob(this);
return false;
}
@Override
public boolean onStopJob(JobParameters jobParameters) {
return false;
}
public static void registerJob(Context context, long intervalMinutes) {
JobScheduler jss = context.getSystemService(JobScheduler.class);
jss.cancel(JOB_ID);
long interval = intervalMinutes * MINUTES;
long jitter = (long)(INTERVAL_JITTER_FRAC * interval);
interval += (long)(Math.random() * (2 * jitter)) - jitter;
final JobInfo jobInfo = new JobInfo.Builder(JOB_ID,
new ComponentName(context, NekoService.class))
.setPeriodic(interval, INTERVAL_FLEX)
.build();
Log.v(TAG, "A cat will visit in " + interval + "ms: " + String.valueOf(jobInfo));
jss.schedule(jobInfo);
if (NekoLand.DEBUG_NOTIFICATIONS) {
NotificationManager noman = context.getSystemService(NotificationManager.class);
noman.notify(500, new Notification.Builder(context)
.setSmallIcon(R.drawable.stat_icon)
.setContentTitle(String.format("Job scheduled in %d min", (interval / MINUTES)))
.setContentText(String.valueOf(jobInfo))
.setPriority(Notification.PRIORITY_MIN)
.setCategory(Notification.CATEGORY_SERVICE)
.setShowWhen(true)
.build());
}
}
public static void cancelJob(Context context) {
JobScheduler jss = context.getSystemService(JobScheduler.class);
Log.v(TAG, "Canceling job");
jss.cancel(JOB_ID);
}
}

View File

@@ -0,0 +1,96 @@
/*
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
package com.android.egg.neko;
import android.content.Intent;
import android.service.quicksettings.Tile;
import android.service.quicksettings.TileService;
import android.util.Log;
import com.android.egg.neko.PrefState.PrefsListener;
public class NekoTile extends TileService implements PrefsListener {
private static final String TAG = "NekoTile";
private PrefState mPrefs;
@Override
public void onCreate() {
super.onCreate();
mPrefs = new PrefState(this);
}
@Override
public void onStartListening() {
super.onStartListening();
mPrefs.setListener(this);
updateState();
}
@Override
public void onStopListening() {
super.onStopListening();
mPrefs.setListener(null);
}
@Override
public void onPrefsChanged() {
updateState();
}
private void updateState() {
Tile tile = getQsTile();
int foodState = mPrefs.getFoodState();
Food food = new Food(foodState);
tile.setIcon(food.getIcon(this));
tile.setLabel(food.getName(this));
tile.setState(foodState != 0 ? Tile.STATE_ACTIVE : Tile.STATE_INACTIVE);
tile.updateTile();
}
@Override
public void onClick() {
if (mPrefs.getFoodState() != 0) {
// there's already food loaded, let's empty it
mPrefs.setFoodState(0);
NekoService.cancelJob(this);
} else {
// time to feed the cats
if (isLocked()) {
if (isSecure()) {
Log.d(TAG, "startActivityAndCollapse");
Intent intent = new Intent(this, NekoLockedActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivityAndCollapse(intent);
} else {
unlockAndRun(new Runnable() {
@Override
public void run() {
showNekoDialog();
}
});
}
} else {
showNekoDialog();
}
}
}
private void showNekoDialog() {
Log.d(TAG, "showNekoDialog");
showDialog(new NekoDialog(this));
}
}

View File

@@ -0,0 +1,94 @@
/*
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
package com.android.egg.neko;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class PrefState implements OnSharedPreferenceChangeListener {
private static final String FILE_NAME = "mPrefs";
private static final String FOOD_STATE = "food";
private static final String CAT_KEY_PREFIX = "cat:";
private final Context mContext;
private final SharedPreferences mPrefs;
private PrefsListener mListener;
public PrefState(Context context) {
mContext = context;
mPrefs = mContext.getSharedPreferences(FILE_NAME, 0);
}
// Can also be used for renaming.
public void addCat(Cat cat) {
mPrefs.edit()
.putString(CAT_KEY_PREFIX + String.valueOf(cat.getSeed()), cat.getName())
.commit();
}
public void removeCat(Cat cat) {
mPrefs.edit()
.remove(CAT_KEY_PREFIX + String.valueOf(cat.getSeed()))
.commit();
}
public List<Cat> getCats() {
ArrayList<Cat> cats = new ArrayList<>();
Map<String, ?> map = mPrefs.getAll();
for (String key : map.keySet()) {
if (key.startsWith(CAT_KEY_PREFIX)) {
long seed = Long.parseLong(key.substring(CAT_KEY_PREFIX.length()));
Cat cat = new Cat(mContext, seed);
cat.setName(String.valueOf(map.get(key)));
cats.add(cat);
}
}
return cats;
}
public int getFoodState() {
return mPrefs.getInt(FOOD_STATE, 0);
}
public void setFoodState(int foodState) {
mPrefs.edit().putInt(FOOD_STATE, foodState).commit();
}
public void setListener(PrefsListener listener) {
mListener = listener;
if (mListener != null) {
mPrefs.registerOnSharedPreferenceChangeListener(this);
} else {
mPrefs.unregisterOnSharedPreferenceChangeListener(this);
}
}
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
mListener.onPrefsChanged();
}
public interface PrefsListener {
void onPrefsChanged();
}
}

View File

@@ -436,7 +436,6 @@
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.DEFAULT" />
<category android:name="com.android.internal.category.PLATLOGO" />
</intent-filter>
</activity>