Show selected item in Select base profile bottom sheet
This commit is contained in:
parent
7761039120
commit
00d38d5170
1 changed files with 14 additions and 15 deletions
|
@ -32,6 +32,7 @@ import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
@ -120,7 +121,6 @@ public class EditProfileFragment extends BaseOsmAndFragment {
|
||||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
|
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
|
||||||
@Nullable Bundle savedInstanceState) {
|
@Nullable Bundle savedInstanceState) {
|
||||||
|
|
||||||
|
|
||||||
final View view = inflater.inflate(R.layout.fragment_selected_profile, container, false);
|
final View view = inflater.inflate(R.layout.fragment_selected_profile, container, false);
|
||||||
|
|
||||||
profileIcon = view.findViewById(R.id.select_icon_btn_img);
|
profileIcon = view.findViewById(R.id.select_icon_btn_img);
|
||||||
|
@ -152,15 +152,11 @@ public class EditProfileFragment extends BaseOsmAndFragment {
|
||||||
.getBackground();
|
.getBackground();
|
||||||
|
|
||||||
if (isNightMode) {
|
if (isNightMode) {
|
||||||
profileNameTextBox
|
profileNameTextBox.setPrimaryColor(ContextCompat.getColor(app, R.color.color_dialog_buttons_dark));
|
||||||
.setPrimaryColor(ContextCompat.getColor(app, R.color.color_dialog_buttons_dark));
|
navTypeTextBox.setPrimaryColor(ContextCompat.getColor(app, R.color.color_dialog_buttons_dark));
|
||||||
navTypeTextBox
|
selectIconBtnBackground.setColor(app.getResources().getColor(R.color.text_field_box_dark));
|
||||||
.setPrimaryColor(ContextCompat.getColor(app, R.color.color_dialog_buttons_dark));
|
|
||||||
selectIconBtnBackground
|
|
||||||
.setColor(app.getResources().getColor(R.color.text_field_box_dark));
|
|
||||||
} else {
|
} else {
|
||||||
selectIconBtnBackground
|
selectIconBtnBackground.setColor(app.getResources().getColor(R.color.text_field_box_light));
|
||||||
.setColor(app.getResources().getColor(R.color.text_field_box_light));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String title = "New Profile";
|
String title = "New Profile";
|
||||||
|
@ -171,11 +167,9 @@ public class EditProfileFragment extends BaseOsmAndFragment {
|
||||||
profileNameEt.setText(title);
|
profileNameEt.setText(title);
|
||||||
startIconId = profile.iconId;
|
startIconId = profile.iconId;
|
||||||
isDataChanged = false;
|
isDataChanged = false;
|
||||||
|
|
||||||
} else if (isNew) {
|
} else if (isNew) {
|
||||||
isDataChanged = true;
|
isDataChanged = true;
|
||||||
title = String
|
title = String.format("Custom %s", getResources().getString(profile.parent.getStringResource()));
|
||||||
.format("Custom %s", getResources().getString(profile.parent.getStringResource()));
|
|
||||||
startIconId = profile.getParent().getSmallIconDark();
|
startIconId = profile.getParent().getSmallIconDark();
|
||||||
profile.setIconId(startIconId);
|
profile.setIconId(startIconId);
|
||||||
} else if (profile.getKey() != -1) {
|
} else if (profile.getKey() != -1) {
|
||||||
|
@ -200,8 +194,14 @@ public class EditProfileFragment extends BaseOsmAndFragment {
|
||||||
final ProfileBottomSheetDialogFragment dialog = new ProfileBottomSheetDialogFragment();
|
final ProfileBottomSheetDialogFragment dialog = new ProfileBottomSheetDialogFragment();
|
||||||
dialog.setProfileTypeListener(baseTypeListener);
|
dialog.setProfileTypeListener(baseTypeListener);
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
bundle.putParcelableArrayList(TYPE_APP_PROFILE,
|
ArrayList<BaseProfile> lst = SettingsProfileFragment.getBaseProfiles(getMyApplication());
|
||||||
SettingsProfileFragment.getBaseProfiles(getMyApplication()));
|
for (BaseProfile bp : lst) {
|
||||||
|
LOG.debug("Base");
|
||||||
|
if (bp.getStringKey().equals(profile.getParent().getStringKey())) {
|
||||||
|
bp.setSelected(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
bundle.putParcelableArrayList(TYPE_APP_PROFILE, lst);
|
||||||
dialog.setArguments(bundle);
|
dialog.setArguments(bundle);
|
||||||
|
|
||||||
if (getActivity() != null) {
|
if (getActivity() != null) {
|
||||||
|
@ -280,7 +280,6 @@ public class EditProfileFragment extends BaseOsmAndFragment {
|
||||||
if (actionBar != null) {
|
if (actionBar != null) {
|
||||||
actionBar.setTitle(s.toString());
|
actionBar.setTitle(s.toString());
|
||||||
profile.setUserProfileTitle(s.toString());
|
profile.setUserProfileTitle(s.toString());
|
||||||
LOG.debug("Typed name: " + s);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue