Commit 6ebf8619 authored by Daisuke Miyakawa's avatar Daisuke Miyakawa

Fragmentize BluetoothSettings.

Add UserLeaveHintListener.java, so that the settings won't use
its implementation around Activity#onUserLeaveHint().

Also fragmentize bluetooth tethering screen.

Change-Id: Id06ae3161fbdb5854ddb7a257f464fb16ea9b089
parent b68e0f1d
......@@ -168,9 +168,10 @@
</intent-filter>
</activity>
<activity android:name=".bluetooth.BluetoothSettings"
<activity-alias android:name=".bluetooth.BluetoothSettings"
android:label="@string/bluetooth_settings_title"
android:clearTaskOnLaunch="true"
android:targetActivity="Settings"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
......@@ -183,7 +184,7 @@
<action android:name="android.bluetooth.devicepicker.action.LAUNCH" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</activity-alias>
<activity-alias android:name=".TetherSettings"
android:clearTaskOnLaunch="true"
......
......@@ -3,4 +3,4 @@
-keep class com.android.settings.*Picker
-keep class com.android.settings.*Settings
-keep class com.android.settings.wifi.*Settings
-keep class com.android.settings.deviceinfo.*
\ No newline at end of file
-keep class com.android.settings.deviceinfo.*
......@@ -38,14 +38,13 @@
android:title="@string/bluetooth_tether_checkbox_text"
android:persistent="false" />
<!-- BluetoothSettings will have extra argument to know this request is
for tethering, not for BT setting in general. -->
<PreferenceScreen
android:fragment="com.android.settings.bluetooth.BluetoothSettings"
android:key="bluetooth_tether_settings"
android:title="@string/bluetooth_tether_settings_text"
android:summary="@string/bluetooth_tether_settings_subtext" >
<intent
android:action="com.android.settings.bluetooth.action.LAUNCH_TETHER_PICKER"
android:targetPackage="com.android.settings"
android:targetClass="com.android.settings.bluetooth.BluetoothSettings" />
</PreferenceScreen>
<PreferenceScreen
......
......@@ -45,13 +45,10 @@
android:persistent="false" />
<PreferenceScreen
android:fragment="com.android.settings.bluetooth.BluetoothSettings"
android:key="bt_settings"
android:title="@string/bluetooth_settings_title"
android:summary="@string/bluetooth_settings_summary">
<intent
android:action="android.intent.action.MAIN"
android:targetPackage="com.android.settings"
android:targetClass="com.android.settings.bluetooth.BluetoothSettings" />
</PreferenceScreen>
<PreferenceScreen
......
......@@ -175,6 +175,10 @@ public class SettingsPreferenceFragment extends PreferenceFragment
return mNextButton;
}
public void finish() {
getActivity().onBackPressed();
}
/**
* Sets up Button Bar possibly required in the Fragment. Probably available only in
* phones.
......
......@@ -16,6 +16,7 @@
package com.android.settings;
import com.android.settings.bluetooth.BluetoothSettings;
import com.android.settings.wifi.WifiApEnabler;
import android.app.Activity;
......@@ -34,6 +35,7 @@ import android.os.Environment;
import android.preference.CheckBoxPreference;
import android.preference.Preference;
import android.preference.PreferenceScreen;
import android.util.Log;
import android.webkit.WebView;
import java.io.InputStream;
......@@ -385,7 +387,7 @@ public class TetherSettings extends SettingsPreferenceFragment {
}
@Override
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
public boolean onPreferenceTreeClick(PreferenceScreen screen, Preference preference) {
if (preference == mUsbTether) {
boolean newState = mUsbTether.isChecked();
......@@ -457,11 +459,15 @@ public class TetherSettings extends SettingsPreferenceFragment {
mBluetoothTether.setSummary(R.string.bluetooth_tethering_off_subtext);
}
}
} else if (preference == mBluetoothSettings) {
preference.getExtras().putString(BluetoothSettings.ACTION,
BluetoothSettings.ACTION_LAUNCH_TETHER_PICKER);
} else if (preference == mTetherHelp) {
showDialog(DIALOG_TETHER_HELP);
return true;
}
return super.onPreferenceTreeClick(preferenceScreen, preference);
return super.onPreferenceTreeClick(screen, preference);
}
private String findIface(String[] ifaces, String[] regexes) {
......
/*
* 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.
*/
package com.android.settings;
/**
* Interface enabling fragments to listen to Activity#onUserLeaveHint().
*/
public interface UserLeaveHintListener {
public void onUserLeaveHint();
}
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment