Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Inital implementation: s2w and dt2w support. Change-Id: I214e02038f3d6d9916ad35ec9dc292011b4eac3a
- Loading branch information
Showing
16 changed files
with
699 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
LOCAL_PATH:= $(call my-dir) | ||
ifneq ($(filter flo deb,$(TARGET_DEVICE)),) | ||
include $(CLEAR_VARS) | ||
|
||
LOCAL_MODULE_TAGS := optional | ||
|
||
LOCAL_SRC_FILES := $(call all-java-files-under, src) | ||
|
||
LOCAL_PACKAGE_NAME := FloParts | ||
LOCAL_CERTIFICATE := platform | ||
|
||
include $(BUILD_PACKAGE) | ||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="org.eos.settings.device" | ||
android:sharedUserId="android.uid.system"> | ||
|
||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> | ||
<uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" /> | ||
|
||
<application android:label="@string/app_name" > | ||
|
||
<activity | ||
android:name=".DeviceSettings" | ||
android:theme="@style/Theme.Settings" | ||
android:icon="@drawable/eos_device" | ||
android:label="@string/app_name" > | ||
|
||
<intent-filter> | ||
<action android:name="com.cfx.action.LAUNCH_DEVICE_SETTINGS" /> | ||
<action android:name="android.intent.action.MAIN" /> | ||
</intent-filter> | ||
|
||
</activity> | ||
|
||
<receiver android:name=".Startup" > | ||
<intent-filter android:priority="100" > | ||
<action android:name="android.intent.action.BOOT_COMPLETED" /> | ||
<action android:name="com.cfx.settings.device.FloParts.feature_changed" /> | ||
</intent-filter> | ||
</receiver> | ||
|
||
</application> | ||
|
||
</manifest> |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
<dimen name="settings_side_margin">@*android:dimen/preference_fragment_padding_side</dimen> | ||
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
<string name="app_name">Nexus 7 (2013) Settings</string> | ||
|
||
<!-- Touchscreen controls --> | ||
<string name="category_touchscreen_title">Touchscreen features</string> | ||
<string name="s2w_checkbox">Sweep2Wake</string> | ||
<string name="s2w_summary">Do a swipe to wake your device</string> | ||
<string name="dt2w_checkbox">DoubleTap2Wake</string> | ||
<string name="dt2w_summary">Double tap to wake your device</string> | ||
|
||
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- Copyright (C) 2006 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> | ||
<style name="PreferenceHeaderPanelSinglePane"> | ||
<item name="android:layout_marginStart">0dp</item> | ||
<item name="android:layout_marginEnd">0dp</item> | ||
<item name="android:background">@null</item> | ||
</style> | ||
|
||
<style name="PreferencePanelSinglePane" parent="@*android:style/PreferencePanel"> | ||
<item name="android:layout_marginStart">0dp</item> | ||
<item name="android:layout_marginEnd">0dp</item> | ||
<item name="android:paddingStart">0dp</item> | ||
<item name="android:paddingEnd">0dp</item> | ||
<item name="android:background">@null</item> | ||
<item name="android:scrollbarStyle">outsideOverlay</item> | ||
</style> | ||
|
||
<style name="PreferenceHeaderListSinglePane" parent="@*android:style/PreferenceHeaderList"> | ||
<item name="android:paddingStart">@dimen/settings_side_margin</item> | ||
<item name="android:paddingEnd">@dimen/settings_side_margin</item> | ||
<item name="android:paddingTop">0dp</item> | ||
<item name="android:paddingBottom">0dp</item> | ||
<item name="android:layout_marginStart">0dp</item> | ||
<item name="android:layout_marginEnd">0dp</item> | ||
<item name="android:layout_marginTop">0dp</item> | ||
<item name="android:layout_marginBottom">0dp</item> | ||
<item name="android:scrollbarStyle">outsideOverlay</item> | ||
</style> | ||
|
||
<style name="PreferenceFragmentListSinglePane" parent="@*android:style/PreferenceFragmentList"> | ||
<item name="android:paddingStart">@dimen/settings_side_margin</item> | ||
<item name="android:paddingEnd">@dimen/settings_side_margin</item> | ||
<item name="android:layout_marginStart">0dp</item> | ||
<item name="android:layout_marginEnd">0dp</item> | ||
<item name="android:scrollbarStyle">outsideOverlay</item> | ||
</style> | ||
|
||
</resources> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- Copyright (C) 2010 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> | ||
<style name="Theme.Settings" parent="@android:style/Theme.Holo"> | ||
<item name="@*android:preferenceHeaderPanelStyle">@style/PreferenceHeaderPanelSinglePane</item> | ||
<item name="@*android:preferencePanelStyle">@style/PreferencePanelSinglePane</item> | ||
<item name="@*android:preferenceListStyle">@style/PreferenceHeaderListSinglePane</item> | ||
<item name="@*android:preferenceFragmentListStyle">@style/PreferenceFragmentListSinglePane</item> | ||
<item name="android:actionBarStyle">@android:style/Widget.Holo.ActionBar.Solid</item> | ||
</style> | ||
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
|
||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<PreferenceCategory | ||
android:key="category_touchscreen" | ||
android:title="@string/category_touchscreen_title"> | ||
<CheckBoxPreference | ||
android:key="s2w" | ||
android:persistent="false" | ||
android:title="@string/s2w_checkbox" | ||
android:summary="@string/s2w_summary" | ||
android:defaultValue="false" /> | ||
|
||
<CheckBoxPreference | ||
android:key="dt2w" | ||
android:persistent="false" | ||
android:title="@string/dt2w_checkbox" | ||
android:summary="@string/dt2w_summary" | ||
android:defaultValue="false" /> | ||
|
||
</PreferenceCategory> | ||
</PreferenceScreen> |
103 changes: 103 additions & 0 deletions
103
FloParts/src/org/eos/settings/device/DevicePreferenceActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
/* | ||
* Copyright (C) 2011 The CyanogenMod Project | ||
* Copyright (C) 2014 Team Eos | ||
* | ||
* 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 org.eos.settings.device; | ||
|
||
import android.app.ActionBar; | ||
import android.content.Context; | ||
import android.os.Bundle; | ||
import android.preference.CheckBoxPreference; | ||
import android.preference.Preference; | ||
import android.preference.Preference.OnPreferenceChangeListener; | ||
import android.preference.PreferenceFragment; | ||
import android.preference.PreferenceScreen; | ||
import android.preference.SwitchPreference; | ||
import android.view.MenuItem; | ||
|
||
import org.eos.settings.device.R; | ||
|
||
public class DevicePreferenceActivity extends PreferenceFragment { | ||
|
||
public static final String KEY_S2W = "s2w"; | ||
public static final String KEY_DT2W = "dt2w"; | ||
|
||
private Context context; | ||
private CheckBoxPreference mS2w; | ||
private CheckBoxPreference mDt2w; | ||
|
||
@Override | ||
public void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
|
||
ActionBar actionBar = getActivity().getActionBar(); | ||
actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_HOME | ||
| actionBar.DISPLAY_SHOW_TITLE); | ||
actionBar.setDisplayHomeAsUpEnabled(true); | ||
|
||
addPreferencesFromResource(R.xml.preferences); | ||
context = getActivity().getApplication(); | ||
|
||
mS2w = (CheckBoxPreference) findPreference(KEY_S2W); | ||
//mS2w.setChecked(S2w.isEnabled()); | ||
mS2w.setEnabled(S2w.isSupported()); | ||
|
||
mDt2w = (CheckBoxPreference) findPreference(KEY_DT2W); | ||
//mDt2w.setChecked(Dt2w.isEnabled()); | ||
mDt2w.setEnabled(Dt2w.isSupported()); | ||
|
||
} | ||
|
||
@Override | ||
public void onStart() { | ||
super.onStart(); | ||
mS2w.setChecked(S2w.isEnabled()); | ||
mDt2w.setChecked(Dt2w.isEnabled()); | ||
} | ||
|
||
@Override | ||
public boolean onOptionsItemSelected(MenuItem item) { | ||
switch (item.getItemId()) { | ||
case android.R.id.home: | ||
getActivity().finish(); | ||
break; | ||
default: | ||
break; | ||
} | ||
return super.onOptionsItemSelected(item); | ||
} | ||
|
||
@Override | ||
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) { | ||
if (preference == mS2w) { | ||
if (mS2w.isChecked()) | ||
S2w.enable(context); | ||
else | ||
S2w.disable(context); | ||
return true; | ||
} | ||
|
||
if (preference == mDt2w) { | ||
if (mDt2w.isChecked()) | ||
Dt2w.enable(context); | ||
else | ||
Dt2w.disable(context); | ||
return true; | ||
} | ||
|
||
return super.onPreferenceTreeClick(preferenceScreen, preference); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* Copyright (C) 2014 Team Eos | ||
* | ||
* 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 org.eos.settings.device; | ||
|
||
import android.app.ActionBar; | ||
import android.app.Activity; | ||
import android.os.Bundle; | ||
import android.view.MenuItem; | ||
|
||
public class DeviceSettings extends Activity { | ||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
|
||
ActionBar actionBar = getActionBar(); | ||
actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE, ActionBar.DISPLAY_SHOW_TITLE); | ||
actionBar.setDisplayHomeAsUpEnabled(true); | ||
|
||
getFragmentManager().beginTransaction().replace(android.R.id.content, | ||
new DevicePreferenceActivity()).commit(); | ||
} | ||
|
||
@Override | ||
public boolean onOptionsItemSelected(MenuItem item) { | ||
switch (item.getItemId()) { | ||
case android.R.id.home: | ||
DeviceSettings.this.onBackPressed(); | ||
default: | ||
return super.onOptionsItemSelected(item); | ||
} | ||
} | ||
} |
Oops, something went wrong.