work in progress

This commit is contained in:
madwasp79 2019-03-28 17:50:17 +02:00
parent 289e2e8679
commit 4b1d1ef6b5
10 changed files with 545 additions and 88 deletions

View file

@ -10,7 +10,7 @@
<solid android:color="@color/map_widget_light" />
<corners
android:topRightRadius="@dimen/map_button_rect_rad"
android:bottomRightRadius="@dimen/map_button_rect_rad"
android:bottomRightRadius="@dimen/map_button_rect_rad"
/>
<stroke android:color="@color/map_widget_stroke" android:width="@dimen/map_button_stroke"/>
</shape></item>

View file

@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/btn_round_p" android:state_pressed="true"/>
<item android:drawable="@drawable/btn_round_n"/>
<item android:state_pressed="true" android:drawable="@drawable/btn_round_p"/>
<item android:drawable="@drawable/btn_round_n"/>
</selector>

View file

@ -0,0 +1,356 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/map_widget_light_pressed">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_gravity="top">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/cardview_light_background"
android:orientation="vertical"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<LinearLayout
android:id="@+id/profile_icon_layout"
android:layout_width="68dp"
android:layout_height="68dp"
android:layout_marginStart="@dimen/list_content_padding"
android:layout_marginLeft="@dimen/list_content_padding"
android:clickable="true"
android:focusable="true"
android:gravity="center"
android:orientation="vertical"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="@+id/select_icon_btn_txt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingBottom="8dp"
android:text="Icon"/>
<ImageView
android:id="@+id/select_icon_btn_img"
android:layout_width="@dimen/standard_icon_size"
android:layout_height="@dimen/standard_icon_size"
tools:src="@drawable/ic_action_car_dark"
/>
</LinearLayout>
<net.osmand.plus.widgets.OsmandTextFieldBoxes
android:id="@+id/profile_name_otfb"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/list_content_padding"
android:layout_marginBottom="@dimen/list_content_padding"
android:layout_marginStart="@dimen/list_content_padding"
android:layout_marginEnd="@dimen/list_content_padding"
android:layout_marginLeft="@dimen/list_content_padding"
android:layout_marginRight="@dimen/list_content_padding"
app:labelText="Name">
<studio.carbonylgroup.textfieldboxes.ExtendedEditText
android:id="@+id/profile_name_et"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:text="@string/lorem_ipsum"/>
</net.osmand.plus.widgets.OsmandTextFieldBoxes>
</LinearLayout>
<net.osmand.plus.widgets.OsmandTextFieldBoxes
android:id="@+id/navigation_type_otfb"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/list_content_padding"
android:layout_marginStart="@dimen/list_content_padding"
android:layout_marginEnd="@dimen/list_content_padding"
android:layout_marginLeft="@dimen/list_content_padding"
android:layout_marginRight="@dimen/list_content_padding"
app:labelText="Type">
<studio.carbonylgroup.textfieldboxes.ExtendedEditText
android:id="@+id/navigation_type_et"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableEnd="@drawable/ic_action_arrow_drop_down"
android:drawableRight="@drawable/ic_action_arrow_drop_down"
android:textSize="@dimen/default_list_text_size"
tools:text="Car"/>
</net.osmand.plus.widgets.OsmandTextFieldBoxes>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/list_content_padding"
android:layout_marginStart="@dimen/list_content_padding"
android:layout_marginEnd="@dimen/list_content_padding"
android:layout_marginLeft="@dimen/list_content_padding"
android:layout_marginRight="@dimen/list_content_padding"
android:text="Вы можете добавить модифированную версию routing.xml в osmand/files/routing."/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="@dimen/list_content_padding">
<ImageView
android:id="@+id/bottom_shadow1"
android:layout_width="match_parent"
android:layout_height="5dp"
android:scaleType="fitXY"
android:src="@drawable/bg_shadow_list_bottom"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/cardview_light_background"
android:orientation="vertical">
<TextView
android:textStyle="bold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/list_content_padding"
android:layout_marginStart="@dimen/list_content_padding"
android:layout_marginEnd="@dimen/list_content_padding"
android:layout_marginLeft="@dimen/list_content_padding"
android:layout_marginRight="@dimen/list_content_padding"
android:text="Setup Profile"
android:textColor="@color/main_font_light"
android:textSize="@dimen/default_list_text_size"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/list_content_padding"
android:layout_marginStart="@dimen/list_content_padding"
android:layout_marginEnd="@dimen/list_content_padding"
android:layout_marginLeft="@dimen/list_content_padding"
android:layout_marginRight="@dimen/list_content_padding"
android:text="Profile keeps its own settings"
android:textColor="@color/description_font_and_bottom_sheet_icons"/>
<LinearLayout
android:id="@+id/map_config_btn"
android:layout_width="match_parent"
android:layout_height="65dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:id="@+id/map_config_icon"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginStart="@dimen/list_content_padding"
android:layout_marginLeft="@dimen/list_content_padding"
android:src="@drawable/ic_action_layers_dark"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginEnd="@dimen/list_content_padding"
android:layout_marginLeft="24dp"
android:layout_marginRight="@dimen/list_content_padding"
android:orientation="vertical">
<TextView
android:textStyle="bold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Configure map"
android:textColor="@color/main_font_light"
android:textSize="@dimen/default_list_text_size"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Select default map options for profile"
android:textColor="@color/description_font_and_bottom_sheet_icons"/>
</LinearLayout>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginStart="64dp"
android:layout_marginLeft="64dp"
android:background="?android:attr/listDivider"/>
<LinearLayout
android:id="@+id/screen_config_btn"
android:layout_width="match_parent"
android:layout_height="64dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:id="@+id/screen_config_icon"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginStart="@dimen/list_content_padding"
android:layout_marginLeft="@dimen/list_content_padding"
android:src="@drawable/ic_configure_screen_dark"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginEnd="@dimen/list_content_padding"
android:layout_marginLeft="24dp"
android:layout_marginRight="@dimen/list_content_padding"
android:orientation="vertical">
<TextView
android:textStyle="bold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Configure screen"
android:textColor="@color/main_font_light"
android:textSize="@dimen/default_list_text_size"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Select default screen options for profile"
android:textColor="@color/description_font_and_bottom_sheet_icons"/>
</LinearLayout>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginStart="64dp"
android:layout_marginLeft="64dp"
android:background="?android:attr/listDivider"
/>
<LinearLayout
android:id="@+id/nav_settings_btn"
android:layout_width="match_parent"
android:layout_height="64dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:id="@+id/nav_settings_icon"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginStart="@dimen/list_content_padding"
android:layout_marginLeft="@dimen/list_content_padding"
android:src="@drawable/ic_action_start_navigation"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginEnd="@dimen/list_content_padding"
android:layout_marginLeft="24dp"
android:layout_marginRight="@dimen/list_content_padding"
android:orientation="vertical">
<TextView
android:textStyle="bold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Navigation settings"
android:textColor="@color/main_font_light"
android:textSize="@dimen/default_list_text_size"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Select default navigation settings for profile"
android:textColor="@color/description_font_and_bottom_sheet_icons"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="@dimen/list_content_padding">
<ImageView
android:id="@+id/bottom_shadow2"
android:layout_width="match_parent"
android:layout_height="5dp"
android:scaleType="fitXY"
android:src="@drawable/bg_shadow_list_bottom"/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:orientation="horizontal"
android:background="@color/cardview_light_background">
<Button
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginTop="@dimen/list_content_padding"
android:layout_marginBottom="@dimen/list_content_padding"
android:layout_marginStart="@dimen/list_content_padding"
android:layout_marginEnd="8dp"
android:layout_marginLeft="@dimen/list_content_padding"
android:layout_marginRight="8dp"
android:background="@drawable/btn_right_round"
android:text="@string/shared_string_cancel"
android:textAllCaps="false"
android:textColor="@color/map_widget_blue"/>
<Button
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/btn_round_blue"
android:text="@string/shared_string_save"
android:layout_marginEnd="@dimen/list_content_padding"
android:layout_marginRight="@dimen/list_content_padding"
android:layout_marginBottom="@dimen/list_content_padding"
android:layout_marginTop="@dimen/list_content_padding"
android:layout_marginLeft="8dp"
android:layout_marginStart="8dp"
android:textAllCaps="false"
android:textColor="@color/color_white"/>
</LinearLayout>
</FrameLayout>

View file

@ -455,6 +455,9 @@
<color name="wiki_webview_background_light">#ffffff</color>
<color name="wiki_webview_background_dark">#17191a</color>
<color name="text_field_box_dark">#424242</color>
<color name="text_field_box_light">#eeeeee</color>
<!-- Basic colors -->
<color name="app_bar_main_dark">#101112</color>
<color name="app_bar_main_light">#ff8800</color>
@ -476,4 +479,5 @@
<color name="active_buttons_and_links_trans_light">#66237bff</color>
<color name="active_buttons_and_links_trans_dark">#66d28521</color>
</resources>

View file

@ -0,0 +1,97 @@
package net.osmand.plus.profiles;
import android.os.Parcel;
import android.os.Parcelable;
public class AppProfile implements Parcelable {
private int iconRes;
private String title;
private String navType;
private boolean isSelected;
private boolean isAppDefault;
public AppProfile(int iconRes, String title, String descr, boolean isAppDefault) {
this.iconRes = iconRes;
this.title = title;
this.navType = descr;
this.isAppDefault = isAppDefault;
}
public int getIconRes() {
return iconRes;
}
public void setIconRes(int iconRes) {
this.iconRes = iconRes;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getNavType() {
return navType;
}
public void setNavType(String descr) {
this.navType = descr;
}
public boolean isSelected() {
return isSelected;
}
public void setSelected(boolean isSelected) {
this.isSelected = isSelected;
}
public boolean isAppDefault() {
return isAppDefault;
}
public void setAppDefault(boolean appDefault) {
isAppDefault = appDefault;
}
protected AppProfile(Parcel in) {
iconRes = in.readInt();
title = in.readString();
navType = in.readString();
isSelected = in.readByte() != 0;
isAppDefault = in.readByte() != 0;
}
public static final Creator<AppProfile> CREATOR = new Creator<AppProfile>() {
@Override
public AppProfile createFromParcel(Parcel in) {
return new AppProfile(in);
}
@Override
public AppProfile[] newArray(int size) {
return new AppProfile[size];
}
};
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(iconRes);
dest.writeString(title);
dest.writeString(navType);
dest.writeByte((byte) (isSelected ? 1 : 0));
dest.writeByte((byte) (isAppDefault ? 1 : 0));
}
}

View file

@ -11,36 +11,34 @@ import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import java.util.List;
import net.osmand.PlatformUtil;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.profiles.ProfileMenuAdapter.ProfileViewHolder;
import net.osmand.plus.profiles.SettingsProfileFragment.ProfileItem;
public class ProfileMenuAdapter extends RecyclerView.Adapter<ProfileViewHolder> {
private List<ProfileItem> items;
private List<AppProfile> items;
private ProfileListener listener = null;
OsmandApplication app;
public ProfileMenuAdapter(List<ProfileItem> items, OsmandApplication app, ProfileListener listener) {
public ProfileMenuAdapter(List<AppProfile> items, OsmandApplication app, ProfileListener listener) {
this.items = items;
this.listener = listener;
this.app = app;
}
public List<ProfileItem> getItems() {
public List<AppProfile> getItems() {
return items;
}
public void addItem(ProfileItem profileItem) {
public void addItem(AppProfile profileItem) {
items.add(profileItem);
notifyDataSetChanged();
}
public void updateItemsList(List<ProfileItem> newList) {
public void updateItemsList(List<AppProfile> newList) {
items.clear();
items.addAll(newList);
notifyDataSetChanged();
@ -56,12 +54,11 @@ public class ProfileMenuAdapter extends RecyclerView.Adapter<ProfileViewHolder>
@Override
public void onBindViewHolder(@NonNull final ProfileViewHolder holder, int position) {
final ProfileItem item = items.get(position);
final AppProfile item = items.get(position);
holder.title.setText(item.getTitle());
holder.title.setTextColor(app.getResources().getColor(isNightMode(app) ? R.color.main_font_dark : R.color.main_font_light));
holder.descr.setText(String.format("Type: %s", item.getDescr()));
holder.descr.setText(String.format("Type: %s", item.getNavType()));
Drawable drawable = app.getUIUtilities().getThemedIcon(item.getIconRes());
holder.icon.setImageDrawable(drawable);
holder.icon.setImageDrawable(app.getUIUtilities().getIcon(item.getIconRes(), isNightMode(app) ? R.color.active_buttons_and_links_dark : R.color.active_buttons_and_links_light));
holder.aSwitch.setChecked(item.isSelected());
holder.aSwitch.setOnClickListener(new OnClickListener() {
@ -103,8 +100,8 @@ public class ProfileMenuAdapter extends RecyclerView.Adapter<ProfileViewHolder>
}
public interface ProfileListener {
void changeProfileStatus(ProfileItem item, boolean isSelected);
void editProfile(ProfileItem item);
void changeProfileStatus(AppProfile item, boolean isSelected);
void editProfile(AppProfile item);
}
}

View file

@ -4,6 +4,7 @@ import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.MenuItem;
import net.osmand.plus.R;
import net.osmand.plus.activities.OsmandActionBarActivity;
@ -18,14 +19,27 @@ public class SelectedProfileActivity extends OsmandActionBarActivity {
Intent intent = getIntent();
if (intent.getExtras() != null) {
if (getSupportActionBar() != null) {
getSupportActionBar().setTitle(intent.getStringExtra("profile_name"));
getSupportActionBar().setTitle(((AppProfile) intent.getParcelableExtra("profile")).getTitle());
getSupportActionBar().setElevation(5.0f);
}
}
// if (savedInstanceState == null) {
// SettingsProfileFragment profileFragment = new SettingsProfileFragment();
// profileFragment.setArguments(getIntent().getExtras());
// getSupportFragmentManager().beginTransaction().add(android.R.id.content, profileFragment).commit();
// }
if (savedInstanceState == null) {
SelectedProfileFragment selectedProfileFragment = new SelectedProfileFragment();
selectedProfileFragment.setArguments(getIntent().getExtras());
getSupportFragmentManager().beginTransaction().add(android.R.id.content, selectedProfileFragment).commit();
}
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int itemId = item.getItemId();
switch (itemId) {
case android.R.id.home:
finish();
return true;
}
return false;
}
}

View file

@ -1,24 +1,70 @@
package net.osmand.plus.profiles;
import android.content.res.Resources;
import android.graphics.drawable.GradientDrawable;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.content.ContextCompat;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import net.osmand.plus.ApplicationMode;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.base.BaseOsmAndFragment;
import net.osmand.plus.widgets.OsmandTextFieldBoxes;
import studio.carbonylgroup.textfieldboxes.ExtendedEditText;
public class SelectedProfileFragment extends BaseOsmAndFragment {
AppProfile profile = null;
OsmandApplication app;
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
app = getMyApplication();
if (getArguments() != null) {
profile = getArguments().getParcelable("profile");
}
}
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
return super.onCreateView(inflater, container, savedInstanceState);
boolean isNightMode = !app.getSettings().isLightContent();
View view = inflater.inflate(R.layout.fragment_selected_profile, container, false);
ImageView profileIcon = view.findViewById(R.id.select_icon_btn_img);
LinearLayout profileIconBtn = view.findViewById(R.id.profile_icon_layout);
ExtendedEditText profileNameEt = view.findViewById(R.id.profile_name_et);
OsmandTextFieldBoxes profileNameTextBox = view.findViewById(R.id.profile_name_otfb);
ExtendedEditText navTypeEt = view.findViewById(R.id.navigation_type_et);
OsmandTextFieldBoxes navTypeTextBox= view.findViewById(R.id.navigation_type_otfb);
profileIconBtn.setBackgroundResource(R.drawable.rounded_background_3dp);
GradientDrawable selectIconBtnBackground = (GradientDrawable) profileIconBtn.getBackground();
profileIcon.setImageDrawable(app.getUIUtilities().getIcon(profile.getIconRes(),
isNightMode ? R.color.active_buttons_and_links_dark : R.color.active_buttons_and_links_light));
if (isNightMode) {
profileNameTextBox.setPrimaryColor(ContextCompat.getColor(app, R.color.color_dialog_buttons_dark));
navTypeTextBox.setPrimaryColor(ContextCompat.getColor(app, R.color.color_dialog_buttons_dark));
selectIconBtnBackground.setColor(app.getResources().getColor(R.color.text_field_box_dark));
} else {
selectIconBtnBackground.setColor(app.getResources().getColor(R.color.text_field_box_light));
}
//((OsmandTextFieldBoxes) textBox).setPrimaryColor(ContextCompat.getColor(app, R.color.color_dialog_buttons_dark));
return view;
}
}

View file

@ -2,7 +2,6 @@ package net.osmand.plus.profiles;
import android.os.Bundle;
import android.view.MenuItem;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.activities.OsmandActionBarActivity;
@ -13,6 +12,7 @@ public class SettingsProfileActivity extends OsmandActionBarActivity {
getMyApplication().applyTheme(this);
super.onCreate(savedInstanceState);
setContentView(R.layout.single_fragment_layout);
getSupportActionBar().setElevation(5.0f);
if (savedInstanceState == null) {
SettingsProfileFragment profileFragment = new SettingsProfileFragment();
profileFragment.setArguments(getIntent().getExtras());

View file

@ -20,7 +20,6 @@ import net.osmand.plus.ApplicationMode;
import net.osmand.plus.R;
import net.osmand.plus.base.BaseOsmAndFragment;
import net.osmand.plus.profiles.ProfileMenuAdapter.ProfileListener;
import net.sf.junidecode.App;
import org.apache.commons.logging.Log;
public class SettingsProfileFragment extends BaseOsmAndFragment {
@ -29,13 +28,13 @@ public class SettingsProfileFragment extends BaseOsmAndFragment {
private ProfileMenuAdapter adapter;
private RecyclerView recyclerView;
private LinearLayout btn;
private LinearLayout addProfileBtn;
ProfileListener listener = null;
private List<ApplicationMode> allDefaultModes;
private Set<ApplicationMode> selectedDefaultModes;
private List<ProfileItem> profilesList;
private List<AppProfile> profilesList;
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
@ -50,7 +49,7 @@ public class SettingsProfileFragment extends BaseOsmAndFragment {
selectedDefaultModes = new LinkedHashSet<>(ApplicationMode.values(getMyApplication()));
selectedDefaultModes.remove(ApplicationMode.DEFAULT);
for (ApplicationMode am : allDefaultModes) {
ProfileItem profileItem = new ProfileItem(
AppProfile profileItem = new AppProfile(
am.getSmallIconDark(),
am.toHumanStringCtx(getMyApplication().getApplicationContext()),
am.toHumanStringCtx(getMyApplication().getApplicationContext()),
@ -60,8 +59,6 @@ public class SettingsProfileFragment extends BaseOsmAndFragment {
}
profilesList.add(profileItem);
}
}
@Nullable
@ -70,8 +67,8 @@ public class SettingsProfileFragment extends BaseOsmAndFragment {
@Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.profiles_list_fragment, container, false);
recyclerView = view.findViewById(R.id.profiles_list);
btn = view.findViewById(R.id.add_profile_btn);
btn.setOnClickListener(new OnClickListener() {
addProfileBtn = view.findViewById(R.id.add_profile_btn);
addProfileBtn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
//todo add new profile;
@ -79,7 +76,7 @@ public class SettingsProfileFragment extends BaseOsmAndFragment {
});
listener = new ProfileListener() {
@Override
public void changeProfileStatus(ProfileItem item, boolean isSelected) {
public void changeProfileStatus(AppProfile item, boolean isSelected) {
LOG.debug(item.getTitle() + " - " + isSelected);
StringBuilder vls = new StringBuilder(ApplicationMode.DEFAULT.getStringKey()+",");
ApplicationMode mode = null;
@ -103,9 +100,9 @@ public class SettingsProfileFragment extends BaseOsmAndFragment {
}
@Override
public void editProfile(ProfileItem item) {
public void editProfile(AppProfile item) {
Intent intent = new Intent(getActivity(), SelectedProfileActivity.class);
intent.putExtra("profile_name", item.title);
intent.putExtra("profile", item);
startActivity(intent);
}
};
@ -117,58 +114,5 @@ public class SettingsProfileFragment extends BaseOsmAndFragment {
return view;
}
public class ProfileItem {
private int iconRes;
private String title;
private String descr;
private boolean isSelected;
private boolean isAppDefault;
public ProfileItem(int iconRes, String title, String descr, boolean isAppDefault) {
this.iconRes = iconRes;
this.title = title;
this.descr = descr;
this.isAppDefault = isAppDefault;
}
public int getIconRes() {
return iconRes;
}
public void setIconRes(int iconRes) {
this.iconRes = iconRes;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getDescr() {
return descr;
}
public void setDescr(String descr) {
this.descr = descr;
}
public boolean isSelected() {
return isSelected;
}
public void setSelected(boolean isSelected) {
this.isSelected = isSelected;
}
public boolean isAppDefault() {
return isAppDefault;
}
public void setAppDefault(boolean appDefault) {
isAppDefault = appDefault;
}
}
}