Skip to content
This repository was archived by the owner on Jan 8, 2025. It is now read-only.

Commit

Permalink
angler: add NexusParts
Browse files Browse the repository at this point in the history
control for vibration strenght
proximity check for double tap to wake

Change-Id: I583d2f3e6a1b40363bc4d0b97d30dc54c346de1d
  • Loading branch information
darkobas committed Nov 18, 2016
1 parent 741cd86 commit 629a1b7
Show file tree
Hide file tree
Showing 23 changed files with 913 additions and 1 deletion.
25 changes: 25 additions & 0 deletions NexusParts/Android.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)

LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_PACKAGE_NAME := NexusParts
LOCAL_CERTIFICATE := platform
LOCAL_PRIVILEGED_MODULE := true
LOCAL_AAPT_FLAGS := --auto-add-overlay
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res

package_resource_overlays := $(strip \
$(wildcard $(foreach dir, $(PRODUCT_PACKAGE_OVERLAYS), \
$(addprefix $(dir)/, packages/apps/NexusParts/res))) \
$(wildcard $(foreach dir, $(DEVICE_PACKAGE_OVERLAYS), \
$(addprefix $(dir)/, packages/apps/NexusParts/res))))

LOCAL_RESOURCE_DIR := $(package_resource_overlays) $(LOCAL_RESOURCE_DIR)

LOCAL_PROGUARD_ENABLED := disabled
LOCAL_DEX_PREOPT := false

include $(BUILD_PACKAGE)

include $(call all-makefiles-under,$(LOCAL_PATH))
35 changes: 35 additions & 0 deletions NexusParts/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.omnirom.device"
android:sharedUserId="android.uid.system" >
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
<uses-permission android:name="android.permission.INJECT_EVENTS" />
<uses-permission android:name="android.permission.CAMERA" />

<uses-sdk
android:minSdkVersion="18"
android:targetSdkVersion="21" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/advanced_settings"
android:theme="@android:style/Theme.Material.Settings"
android:supportsRtl="true" >
<activity
android:name="org.omnirom.device.DeviceSettings"
android:exported="true"
android:label="@string/advanced_settings"
android:launchMode="singleTask" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<receiver android:name="org.omnirom.device.Startup" >
<intent-filter android:priority="100" >
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
</application>
</manifest>
Binary file added NexusParts/res/drawable-xxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added NexusParts/res/drawable/ic_vibrations.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
38 changes: 38 additions & 0 deletions NexusParts/res/layout/preference_dialog_vibrator_strength.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2016 The OmniROM 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:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center_horizontal"
android:padding="24dip">

<ImageView android:id="@android:id/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
android:contentDescription="@null" />

<SeekBar android:id="@*android:id/seekbar"
android:layout_width="match_parent"
android:layout_height="wrap_content" />

<Button android:id="@+id/vib_test"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/vib_test"
android:layout_marginTop="10dip" />
</LinearLayout>
41 changes: 41 additions & 0 deletions NexusParts/res/values-fr/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2014 The OmniROM 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>
<string name="app_name">Find 7</string>
<string name="category_gestures_title">Appui écran éteint</string>
<string name="double_tap_wake_title_head">Double appui pour réveiller</string>
<string name="double_tap_wake_summary_head">Un double appui sur l\'écran réveille l\'appareil</string>
<string name="camera_title_head">Appareil photo</string>
<string name="camera_summary_head">Dessiner un cercle pour démarrer l\'appareil photo</string>
<string name="torch_title_head">Torche</string>
<string name="torch_summary_head">Dessiner un V pour afficher la torche</string>
<!--
<string name="music_title_head">Musique</string>
<string name="music_summary_head">Dessiner un II, &lt; ou &gt; pour contrôler le lecteur de musique</string>
<string name="category_vibrator">Vibreur</string>
<string name="vib_strength_title_head">Intensité</string>
<string name="vib_strength_summary_head">Définir l\'intensité du vibreur</string>
<string name="vib_test">Tester</string>
<string name="category_suspend_cap">Limitations</string>
<string name="suspend_cap_freq">Limite de fréquence des cœurs</string>
<string name="suspend_cap_core">Limite du nombre de cœur</string>
<string name="disabled">Désactivé</string>
<string name="core">cœur</string>
<string name="cores">cœurs</string>
<string name="mhz">MHz</string>
-->
<string name="advanced_settings">Avancés</string>
</resources>
22 changes: 22 additions & 0 deletions NexusParts/res/values-it/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Find 7</string>
<string name="category_gestures_title">Gesture da schermo spento</string>
<string name="double_tap_wake_title_head">Doppio tocco</string>
<string name="double_tap_wake_summary_head">Effettua un doppio tocco sullo schermo per attivare il device</string>
<string name="camera_title_head">Fotocamera</string>
<string name="camera_summary_head">Disegna un \"O\" per attivare la fotocamera</string>
<string name="torch_title_head">Torcia</string>
<string name="torch_summary_head">Disegna una \"V\" per attivare la torcia</string>
<!--
<string name="music_title_head">Musica</string>
<string name="music_summary_head">Disegna un \"II\" per attivare la musica</string>
<string name="category_vibrator">Vibrazione</string>
<string name="vib_strength_title_head">Lunghezza</string>
<string name="vib_strength_summary_head">Definisci la lunghezza della vibrazione</string>
<string name="vib_test">Prova</string>
<string name="category_suspend_cap">Sospendere limiti</string>
<string name="suspend_cap_freq">Limite frequenza CPU</string>
<string name="suspend_cap_core">Limite numero CPU</string>
-->
</resources>
24 changes: 24 additions & 0 deletions NexusParts/res/values/config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2016 The OmniROM Project
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->

<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">

<bool name="config_has_oclick">false</bool>

<bool name="config_has_back_button">false</bool>

</resources>
32 changes: 32 additions & 0 deletions NexusParts/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2014-2016 The OmniROM 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>
<string name="app_name">Device Features</string>
<string name="category_gestures_title">Off screen gestures</string>
<string name="camera_title_head">Camera</string>
<string name="camera_summary_head">Draw a circle to start camera</string>
<string name="torch_title_head">Torch</string>
<string name="torch_summary_head">Draw a V to toggle torch</string>
<string name="category_vibrator">Vibrator</string>
<string name="vib_strength_title_head">Strength</string>
<string name="vib_strength_summary_head">Define the strength of the vibrator</string>
<string name="vib_test">Test</string>
<string name="advanced_settings">Device Features</string>
<string name="music_title_head">Music</string>
<string name="music_summary_head">Draw a II to play / pause music and \u003C / \u003E to skip tracks forward and backward</string>
<string name="proxi_summary_head">Check proximity sensor for handling gesture</string>
<string name="proxi_title_head">Proximity check</string>
</resources>
24 changes: 24 additions & 0 deletions NexusParts/res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2007 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>
<!-- Theme for the activity com.android.phone.Settings, which is the
"Mobile network settings" screen (used on non-voice-capable
tablets as well as regular phone devices.) -->
<style name="Theme.Main" parent="@android:style/Theme.Holo">
<item name="android:actionBarStyle">@android:style/Widget.Holo.ActionBar.Solid</item>
</style>
</resources>
37 changes: 37 additions & 0 deletions NexusParts/res/xml/main.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright (C) 2014-2016 The OmniROM 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.
-->
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory
android:key="gesture_category"
android:title="@string/category_gestures_title" >

<CheckBoxPreference
android:key="proxi"
android:summary="@string/proxi_summary_head"
android:title="@string/proxi_title_head"
android:persistent="false" />

</PreferenceCategory>

<PreferenceCategory
android:title="@string/category_vibrator">
<org.omnirom.device.VibratorStrengthPreference
android:key="vib_strength"
android:title="@string/vib_strength_title_head"
android:summary="@string/vib_strength_summary_head" />
</PreferenceCategory>

</PreferenceScreen>
86 changes: 86 additions & 0 deletions NexusParts/src/org/omnirom/device/DeviceSettings.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
/*
* Copyright (C) 2016 The OmniROM Project
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package org.omnirom.device;

import android.content.res.Resources;
import android.content.Intent;
import android.os.Bundle;
import android.preference.ListPreference;
import android.preference.Preference;
import android.preference.PreferenceActivity;
import android.preference.PreferenceCategory;
import android.preference.PreferenceScreen;
import android.preference.TwoStatePreference;
import android.provider.Settings;
import android.view.MenuItem;
import android.util.Log;

public class DeviceSettings extends PreferenceActivity implements
Preference.OnPreferenceChangeListener {

public static final String KEY_VIBSTRENGTH = "vib_strength";
public static final String KEY_PROXI_SWITCH = "proxi";

private VibratorStrengthPreference mVibratorStrength;
private TwoStatePreference mProxiSwitch;

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getActionBar().setDisplayHomeAsUpEnabled(true);

addPreferencesFromResource(R.xml.main);

mVibratorStrength = (VibratorStrengthPreference) findPreference(KEY_VIBSTRENGTH);
if (mVibratorStrength != null) {
mVibratorStrength.setEnabled(VibratorStrengthPreference.isSupported());
}

mProxiSwitch = (TwoStatePreference) findPreference(KEY_PROXI_SWITCH);
mProxiSwitch.setChecked(Settings.System.getInt(getContentResolver(),
Settings.System.DEVICE_PROXI_CHECK_ENABLED, 1) != 0);

}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
finish();
return true;
default:
break;
}
return super.onOptionsItemSelected(item);
}

@Override
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
if (preference == mProxiSwitch) {
Settings.System.putInt(getContentResolver(),
Settings.System.DEVICE_PROXI_CHECK_ENABLED, mProxiSwitch.isChecked() ? 1 : 0);
return true;
}
return super.onPreferenceTreeClick(preferenceScreen, preference);
}

@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
return true;
}
}
Loading

0 comments on commit 629a1b7

Please sign in to comment.