Remove extra button bar.
Bug: 3058024 Change-Id: Ib3c2620869729f8916178ea0c0e899635b470a8f
This commit is contained in:
@@ -23,10 +23,10 @@ import android.content.pm.PackageManager;
|
|||||||
import android.content.pm.PackageManager.NameNotFoundException;
|
import android.content.pm.PackageManager.NameNotFoundException;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.preference.PreferenceActivity;
|
import android.preference.PreferenceActivity;
|
||||||
import android.preference.PreferenceActivity.Header;
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.View.OnClickListener;
|
import android.view.View.OnClickListener;
|
||||||
|
import android.widget.Button;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -290,6 +290,16 @@ public class Settings extends PreferenceActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasNextButton() {
|
||||||
|
return super.hasNextButton();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Button getNextButton() {
|
||||||
|
return super.getNextButton();
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Settings subclasses for launching independently.
|
* Settings subclasses for launching independently.
|
||||||
*/
|
*/
|
||||||
|
@@ -40,20 +40,11 @@ public class SettingsPreferenceFragment extends PreferenceFragment
|
|||||||
|
|
||||||
private static final String TAG = "SettingsPreferenceFragment";
|
private static final String TAG = "SettingsPreferenceFragment";
|
||||||
|
|
||||||
// Originally from PreferenceActivity.
|
|
||||||
private static final String EXTRA_PREFS_SHOW_BUTTON_BAR = "extra_prefs_show_button_bar";
|
|
||||||
private static final String EXTRA_PREFS_SHOW_SKIP = "extra_prefs_show_skip";
|
|
||||||
private static final String EXTRA_PREFS_SET_NEXT_TEXT = "extra_prefs_set_next_text";
|
|
||||||
private static final String EXTRA_PREFS_SET_BACK_TEXT = "extra_prefs_set_back_text";
|
|
||||||
|
|
||||||
private SettingsDialogFragment mDialogFragment;
|
private SettingsDialogFragment mDialogFragment;
|
||||||
|
|
||||||
private Button mNextButton;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onActivityCreated(Bundle savedInstanceState) {
|
public void onActivityCreated(Bundle savedInstanceState) {
|
||||||
super.onActivityCreated(savedInstanceState);
|
super.onActivityCreated(savedInstanceState);
|
||||||
setupButtonBar();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -167,11 +158,11 @@ public class SettingsPreferenceFragment extends PreferenceFragment
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected boolean hasNextButton() {
|
protected boolean hasNextButton() {
|
||||||
return mNextButton != null;
|
return ((Settings)getActivity()).hasNextButton();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Button getNextButton() {
|
protected Button getNextButton() {
|
||||||
return mNextButton;
|
return ((Settings)getActivity()).getNextButton();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void finish() {
|
public void finish() {
|
||||||
@@ -193,92 +184,4 @@ public class SettingsPreferenceFragment extends PreferenceFragment
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets up Button Bar possibly required in the Fragment. Probably available only in
|
|
||||||
* phones.
|
|
||||||
*
|
|
||||||
* Previously {@link PreferenceActivity} had the capability as hidden functionality.
|
|
||||||
*/
|
|
||||||
private void setupButtonBar() {
|
|
||||||
// Originally from PreferenceActivity, which has had button bar inside its layout.
|
|
||||||
final Activity activity = getActivity();
|
|
||||||
final Intent intent = activity.getIntent();
|
|
||||||
final View buttonBar = activity.findViewById(com.android.internal.R.id.button_bar);
|
|
||||||
if (!intent.getBooleanExtra(EXTRA_PREFS_SHOW_BUTTON_BAR, false) || buttonBar == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
buttonBar.setVisibility(View.VISIBLE);
|
|
||||||
View tmpView = activity.findViewById(com.android.internal.R.id.back_button);
|
|
||||||
if (tmpView != null) {
|
|
||||||
// TODO: Assume this is pressed only in single pane, finishing current Activity.
|
|
||||||
try {
|
|
||||||
final Button backButton = (Button)tmpView;
|
|
||||||
backButton.setOnClickListener(new OnClickListener() {
|
|
||||||
public void onClick(View v) {
|
|
||||||
activity.setResult(Activity.RESULT_CANCELED);
|
|
||||||
activity.finish();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
if (intent.hasExtra(EXTRA_PREFS_SET_BACK_TEXT)) {
|
|
||||||
String buttonText = intent.getStringExtra(EXTRA_PREFS_SET_BACK_TEXT);
|
|
||||||
if (TextUtils.isEmpty(buttonText)) {
|
|
||||||
backButton.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
backButton.setText(buttonText);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (ClassCastException e) {
|
|
||||||
Log.w(TAG, "The view originally for back_button is used not as Button. " +
|
|
||||||
"Ignored.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
tmpView = activity.findViewById(com.android.internal.R.id.skip_button);
|
|
||||||
if (tmpView != null) {
|
|
||||||
try {
|
|
||||||
final Button skipButton = (Button)tmpView;
|
|
||||||
skipButton.setOnClickListener(new OnClickListener() {
|
|
||||||
public void onClick(View v) {
|
|
||||||
activity.setResult(Activity.RESULT_OK);
|
|
||||||
activity.finish();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
if (intent.getBooleanExtra(EXTRA_PREFS_SHOW_SKIP, false)) {
|
|
||||||
skipButton.setVisibility(View.VISIBLE);
|
|
||||||
}
|
|
||||||
} catch (ClassCastException e) {
|
|
||||||
Log.w(TAG, "The view originally for skip_button is used not as Button. " +
|
|
||||||
"Ignored.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
tmpView = activity.findViewById(com.android.internal.R.id.next_button);
|
|
||||||
if (tmpView != null) {
|
|
||||||
try {
|
|
||||||
mNextButton = (Button)tmpView;
|
|
||||||
mNextButton.setOnClickListener(new OnClickListener() {
|
|
||||||
public void onClick(View v) {
|
|
||||||
activity.setResult(Activity.RESULT_OK);
|
|
||||||
activity.finish();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
// set our various button parameters
|
|
||||||
if (intent.hasExtra(EXTRA_PREFS_SET_NEXT_TEXT)) {
|
|
||||||
String buttonText = intent.getStringExtra(EXTRA_PREFS_SET_NEXT_TEXT);
|
|
||||||
if (TextUtils.isEmpty(buttonText)) {
|
|
||||||
mNextButton.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
mNextButton.setText(buttonText);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (ClassCastException e) {
|
|
||||||
Log.w(TAG, "The view originally for next_button is used not as Button. " +
|
|
||||||
"Ignored.");
|
|
||||||
mNextButton = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -35,28 +35,29 @@ import android.net.NetworkInfo.DetailedState;
|
|||||||
import android.net.wifi.ScanResult;
|
import android.net.wifi.ScanResult;
|
||||||
import android.net.wifi.SupplicantState;
|
import android.net.wifi.SupplicantState;
|
||||||
import android.net.wifi.WifiConfiguration;
|
import android.net.wifi.WifiConfiguration;
|
||||||
import android.net.wifi.WifiConfiguration.KeyMgmt;
|
|
||||||
import android.net.wifi.WifiInfo;
|
import android.net.wifi.WifiInfo;
|
||||||
import android.net.wifi.WifiManager;
|
import android.net.wifi.WifiManager;
|
||||||
|
import android.net.wifi.WifiConfiguration.KeyMgmt;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
import android.preference.CheckBoxPreference;
|
import android.preference.CheckBoxPreference;
|
||||||
import android.preference.Preference;
|
import android.preference.Preference;
|
||||||
|
import android.preference.PreferenceActivity;
|
||||||
import android.preference.PreferenceScreen;
|
import android.preference.PreferenceScreen;
|
||||||
import android.provider.Settings.Secure;
|
import android.provider.Settings.Secure;
|
||||||
import android.security.Credentials;
|
import android.security.Credentials;
|
||||||
import android.security.KeyStore;
|
import android.security.KeyStore;
|
||||||
import android.view.ContextMenu;
|
import android.view.ContextMenu;
|
||||||
import android.view.ContextMenu.ContextMenuInfo;
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuInflater;
|
import android.view.MenuInflater;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.AdapterView.AdapterContextMenuInfo;
|
import android.view.ContextMenu.ContextMenuInfo;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
import android.widget.AdapterView.AdapterContextMenuInfo;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
@@ -171,7 +172,7 @@ public class WifiSettings extends SettingsPreferenceFragment
|
|||||||
// Avoid re-adding on returning from an overlapping activity/fragment.
|
// Avoid re-adding on returning from an overlapping activity/fragment.
|
||||||
if (getPreferenceScreen() == null || getPreferenceScreen().getPreferenceCount() < 2) {
|
if (getPreferenceScreen() == null || getPreferenceScreen().getPreferenceCount() < 2) {
|
||||||
if (mEnableNextOnConnection) {
|
if (mEnableNextOnConnection) {
|
||||||
if (mEnableNextOnConnection && hasNextButton()) {
|
if (hasNextButton()) {
|
||||||
final ConnectivityManager connectivity = (ConnectivityManager)
|
final ConnectivityManager connectivity = (ConnectivityManager)
|
||||||
getActivity().getSystemService(Context.CONNECTIVITY_SERVICE);
|
getActivity().getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||||
if (connectivity != null) {
|
if (connectivity != null) {
|
||||||
|
Reference in New Issue
Block a user