Merge "Don't change the settings title when editing VPN entries."
This commit is contained in:
committed by
Android (Google) Code Review
commit
37b84f3db1
@@ -22,6 +22,7 @@ import com.android.settings.SettingsPreferenceFragment;
|
|||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.net.vpn.L2tpIpsecProfile;
|
import android.net.vpn.L2tpIpsecProfile;
|
||||||
@@ -152,17 +153,15 @@ public class VpnEditor extends SettingsPreferenceFragment {
|
|||||||
}*/
|
}*/
|
||||||
|
|
||||||
private void initViewFor(VpnProfile profile) {
|
private void initViewFor(VpnProfile profile) {
|
||||||
setTitle(profile);
|
|
||||||
mProfileEditor.loadPreferencesTo(getPreferenceScreen());
|
mProfileEditor.loadPreferencesTo(getPreferenceScreen());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setTitle(VpnProfile profile) {
|
/* package */static String getTitle(Context context, VpnProfile profile, boolean adding) {
|
||||||
final Activity activity = getActivity();
|
String formatString = adding
|
||||||
String formatString = mAddingProfile
|
? context.getString(R.string.vpn_edit_title_add)
|
||||||
? activity.getString(R.string.vpn_edit_title_add)
|
: context.getString(R.string.vpn_edit_title_edit);
|
||||||
: activity.getString(R.string.vpn_edit_title_edit);
|
return String.format(formatString,
|
||||||
activity.setTitle(String.format(formatString,
|
profile.getType().getDisplayName());
|
||||||
profile.getType().getDisplayName()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -745,7 +745,7 @@ public class VpnSettings extends SettingsPreferenceFragment
|
|||||||
// TODO: Show different titles for add and edit.
|
// TODO: Show different titles for add and edit.
|
||||||
((PreferenceActivity)getActivity()).startPreferencePanel(
|
((PreferenceActivity)getActivity()).startPreferencePanel(
|
||||||
VpnEditor.class.getCanonicalName(), args,
|
VpnEditor.class.getCanonicalName(), args,
|
||||||
add ? R.string.vpn_details_title : R.string.vpn_details_title, null,
|
0, VpnEditor.getTitle(getActivity(), profile, add),
|
||||||
this, REQUEST_ADD_OR_EDIT_PROFILE);
|
this, REQUEST_ADD_OR_EDIT_PROFILE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user