Skip to content

Commit

Permalink
Input: Backtrack Minipad
Browse files Browse the repository at this point in the history
Enable support for Motorola BackTrack Minipad feature on MB300 devices.

Change-Id: I2f115f013511803c57df4861d1c495d6d05972e2
  • Loading branch information
Patrick Jacques committed Mar 22, 2011
1 parent cc7b5e8 commit 4d9bc6e
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 1 deletion.
2 changes: 1 addition & 1 deletion res/values/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<bool name="has_trackball">true</bool>
<bool name="has_rgb_notification_led">false</bool>
<bool name="has_dual_notification_led">false</bool>

<bool name="has_backtrack_minipad">false</bool>
<!-- LED Flashlight -->
<bool name="has_led_flash">false</bool>
</resources>
3 changes: 3 additions & 0 deletions res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,9 @@
<string name="pref_messaging_tab_app_title">Messaging tab application</string>
<string name="pref_lockscreen_style_title">Lockscreen style</string>
<string name="pref_lockscreen_style_summary">Choose the style of the lockscreen</string>
<string name="pref_backtrack_title">BackTrack Minipad</string>
<string name="pref_backtrack_summary">Motorola Minipad BackTrack input</string>


<!-- Long Press Home -->
<string name="long_press_home_title">Long-press home settings</string>
Expand Down
4 changes: 4 additions & 0 deletions res/xml/input_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
android:targetClass="com.cyanogenmod.cmparts.activities.LongPressHomeActivity" />
</PreferenceScreen>

<CheckBoxPreference android:key="pref_backtrack"
android:title="@string/pref_backtrack_title"
android:summary="@string/pref_backtrack_summary" />

<PreferenceCategory android:title="@string/lockscreen_settings_title">
<CheckBoxPreference android:key="lockscreen_music_controls"
android:title="@string/pref_lockscreen_music_controls_title" android:summary="@string/pref_lockscreen_music_controls_summary" />
Expand Down
32 changes: 32 additions & 0 deletions src/com/cyanogenmod/cmparts/activities/InputActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.os.SystemProperties;
import android.preference.CheckBoxPreference;
import android.preference.ListPreference;
import android.preference.Preference;
Expand All @@ -22,6 +23,7 @@
import android.provider.Settings;
import android.util.Log;


public class InputActivity extends PreferenceActivity implements OnPreferenceChangeListener {

private static final String LOCKSCREEN_MUSIC_CONTROLS = "lockscreen_music_controls";
Expand All @@ -38,6 +40,9 @@ public class InputActivity extends PreferenceActivity implements OnPreferenceCha
private static final String USER_DEFINED_KEY2 = "pref_user_defined_key2";
private static final String USER_DEFINED_KEY3 = "pref_user_defined_key3";
private static final String MESSAGING_TAB_APP = "pref_messaging_tab_app";
private static final String BACKTRACK_PREF = "pref_backtrack";
private static final String BACKTRACK_PROP = "persist.service.backtrack";
private static final String BACKTRACK_DEFAULT = SystemProperties.get("ro.backtrack.default");

private CheckBoxPreference mMusicControlPref;
private CheckBoxPreference mAlwaysMusicControlPref;
Expand All @@ -47,6 +52,7 @@ public class InputActivity extends PreferenceActivity implements OnPreferenceCha
private CheckBoxPreference mQuickUnlockScreenPref;
private CheckBoxPreference mPhoneMessagingTabPref;
private CheckBoxPreference mDisableUnlockTab;
private CheckBoxPreference mBackTrackPref;

private ListPreference mLockscreenStylePref;

Expand Down Expand Up @@ -140,11 +146,24 @@ public void onCreate(Bundle savedInstanceState) {
mUserDefinedKey3Pref = (Preference) prefSet.findPreference(USER_DEFINED_KEY3);
mMessagingTabApp = (Preference) prefSet.findPreference(MESSAGING_TAB_APP);


if (!"vision".equals(Build.DEVICE)) {
buttonCategory.removePreference(mUserDefinedKey1Pref);
buttonCategory.removePreference(mUserDefinedKey2Pref);
buttonCategory.removePreference(mUserDefinedKey3Pref);
}

/* Backtrack */
mBackTrackPref = (CheckBoxPreference) prefSet.findPreference(BACKTRACK_PREF);
//useBackTrack = SystemProperties.set(BACKTRACK_PROP, (String)BACKTRACK_DEFAULT);
//SystemProperties.set(BACKTRACK_PROP, BACKTRACK_DEFAULT);
mBackTrackPref.setChecked(Settings.System.getInt(getContentResolver(),
Settings.System.BACKTRACK_PREF, 1) == 1);

if (!"motus".equals(Build.DEVICE)) {
buttonCategory.removePreference(mBackTrackPref);
}

}

@Override
Expand Down Expand Up @@ -211,6 +230,13 @@ public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preferen
Settings.System.putInt(getContentResolver(),
Settings.System.MENU_UNLOCK_SCREEN, value ? 1 : 0);
return true;
} else if (preference == mBackTrackPref) {
value = mBackTrackPref.isChecked();
Settings.System.putInt(getContentResolver(),
Settings.System.BACKTRACK_PREF, value ? 1 : 0);
SystemProperties.set(BACKTRACK_PROP,
mBackTrackPref.isChecked() ? "1" : "0");
return true;
} else if (preference == mDisableUnlockTab) {
value = mDisableUnlockTab.isChecked();
Settings.Secure.putInt(getContentResolver(),
Expand Down Expand Up @@ -243,6 +269,12 @@ public boolean onPreferenceChange(Preference preference, Object newValue) {
}
return true;
}
if (preference == mBackTrackPref) {
if (newValue != null) {
SystemProperties.set(BACKTRACK_PROP, (String)newValue);
return true;
}
}
return false;
}

Expand Down

0 comments on commit 4d9bc6e

Please sign in to comment.