Add profile dialog to settings
This commit is contained in:
parent
a253d95dd5
commit
216b92efc4
3 changed files with 17 additions and 13 deletions
|
@ -2,7 +2,9 @@
|
|||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal" android:layout_gravity="center_horizontal" android:gravity="center_horizontal">
|
||||
android:orientation="horizontal" android:layout_gravity="center_horizontal" android:gravity="center_horizontal"
|
||||
android:layout_marginTop="7dp"
|
||||
android:layout_marginBottom="7dp">
|
||||
|
||||
<ToggleButton
|
||||
android:id="@+id/DefaultButton"
|
||||
|
|
|
@ -465,7 +465,8 @@ public class MapActivityActions implements DialogProvider {
|
|||
}
|
||||
|
||||
|
||||
public static View showActivityActionsDialog(Activity a, final Set<ApplicationMode> selected, boolean showDefault) {
|
||||
public static View showActivityActionsDialog(Activity a, final Set<ApplicationMode> selected, boolean showDefault,
|
||||
final View.OnClickListener onClickListener) {
|
||||
View view = a.getLayoutInflater().inflate(R.layout.mode_toggles, null);
|
||||
OsmandSettings settings = ((OsmandApplication) a.getApplication()).getSettings();
|
||||
boolean lc = settings.isLightContentMenu();
|
||||
|
@ -523,6 +524,9 @@ public class MapActivityActions implements DialogProvider {
|
|||
buttons[ind].setChecked(true);
|
||||
}
|
||||
}
|
||||
if(onClickListener != null) {
|
||||
onClickListener.onClick(null);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -21,7 +21,6 @@ import android.app.AlertDialog;
|
|||
import android.app.AlertDialog.Builder;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.DialogInterface.OnClickListener;
|
||||
import android.content.DialogInterface.OnMultiChoiceClickListener;
|
||||
import android.os.Bundle;
|
||||
import android.preference.CheckBoxPreference;
|
||||
|
@ -305,18 +304,17 @@ public abstract class SettingsBaseActivity extends SherlockPreferenceActivity im
|
|||
protected void profileDialog() {
|
||||
Builder b = new AlertDialog.Builder(this);
|
||||
final Set<ApplicationMode> selected = new LinkedHashSet<ApplicationMode>();
|
||||
View v = MapActivityActions.showActivityActionsDialog(this, selected, false);
|
||||
View v = MapActivityActions.showActivityActionsDialog(this, selected, false,
|
||||
new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if(selected.size() > 0) {
|
||||
setSelectedAppMode(selected.iterator().next());
|
||||
}
|
||||
}
|
||||
});
|
||||
b.setTitle(R.string.profile_settings);
|
||||
b.setView(v);
|
||||
b.setPositiveButton(R.string.default_buttons_ok, new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
if(selected.size() > 0) {
|
||||
setSelectedAppMode(selected.iterator().next());
|
||||
}
|
||||
}
|
||||
});
|
||||
b.show();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue