diff --git a/OsmAnd/AndroidManifest.xml b/OsmAnd/AndroidManifest.xml index 6cc4201970..483726be1e 100644 --- a/OsmAnd/AndroidManifest.xml +++ b/OsmAnd/AndroidManifest.xml @@ -1063,8 +1063,14 @@ - + android:name=".profiles.SettingsProfileActivity"/> + + + + + \ No newline at end of file diff --git a/OsmAnd/res/layout/profile_list_item.xml b/OsmAnd/res/layout/profile_list_item.xml index b6da74edbb..de8c88797e 100644 --- a/OsmAnd/res/layout/profile_list_item.xml +++ b/OsmAnd/res/layout/profile_list_item.xml @@ -64,6 +64,7 @@ android:src="@drawable/ic_action_additional_option" android:tint="?attr/primary_icon_color" android:layout_gravity="center_vertical" + android:clickable="true" android:padding="@dimen/setting_profile_item_switch_margin"/> @Override public void onClick(View v) { listener.changeProfileStatus(item, holder.aSwitch.isChecked()); - PlatformUtil.getLog(ProfileMenuAdapter.class).debug("Is checked: " + holder.aSwitch.isChecked()); } }); holder.profileOptions.setOnClickListener(new OnClickListener() { diff --git a/OsmAnd/src/net/osmand/plus/profiles/SelectedProfileActivity.java b/OsmAnd/src/net/osmand/plus/profiles/SelectedProfileActivity.java new file mode 100644 index 0000000000..f396f91d89 --- /dev/null +++ b/OsmAnd/src/net/osmand/plus/profiles/SelectedProfileActivity.java @@ -0,0 +1,31 @@ +package net.osmand.plus.profiles; + +import android.content.Intent; +import android.os.Bundle; +import android.support.annotation.Nullable; + +import net.osmand.plus.R; +import net.osmand.plus.activities.OsmandActionBarActivity; + +public class SelectedProfileActivity extends OsmandActionBarActivity { + + @Override + protected void onCreate(@Nullable Bundle savedInstanceState) { + getMyApplication().applyTheme(this); + super.onCreate(savedInstanceState); + setContentView(R.layout.single_fragment_layout); + + Intent intent = getIntent(); + if (intent.getExtras() != null) { + if (getSupportActionBar() != null) { + getSupportActionBar().setTitle(intent.getStringExtra("profile_name")); + } + } + +// if (savedInstanceState == null) { +// SettingsProfileFragment profileFragment = new SettingsProfileFragment(); +// profileFragment.setArguments(getIntent().getExtras()); +// getSupportFragmentManager().beginTransaction().add(android.R.id.content, profileFragment).commit(); +// } + } +} diff --git a/OsmAnd/src/net/osmand/plus/profiles/SelectedProfileFragment.java b/OsmAnd/src/net/osmand/plus/profiles/SelectedProfileFragment.java new file mode 100644 index 0000000000..09c2dcb1de --- /dev/null +++ b/OsmAnd/src/net/osmand/plus/profiles/SelectedProfileFragment.java @@ -0,0 +1,24 @@ +package net.osmand.plus.profiles; + +import android.os.Bundle; +import android.support.annotation.NonNull; +import android.support.annotation.Nullable; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import net.osmand.plus.base.BaseOsmAndFragment; + +public class SelectedProfileFragment extends BaseOsmAndFragment { + + @Override + public void onCreate(@Nullable Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + } + + @Nullable + @Override + public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { + return super.onCreateView(inflater, container, savedInstanceState); + } +} diff --git a/OsmAnd/src/net/osmand/plus/profiles/SettingsProfileActivity.java b/OsmAnd/src/net/osmand/plus/profiles/SettingsProfileActivity.java index 4417572672..081c3ac7d2 100644 --- a/OsmAnd/src/net/osmand/plus/profiles/SettingsProfileActivity.java +++ b/OsmAnd/src/net/osmand/plus/profiles/SettingsProfileActivity.java @@ -8,14 +8,9 @@ import net.osmand.plus.activities.OsmandActionBarActivity; public class SettingsProfileActivity extends OsmandActionBarActivity { - private OsmandApplication app; - - - @Override public void onCreate(Bundle savedInstanceState) { - app = getMyApplication(); - app.applyTheme(this); + getMyApplication().applyTheme(this); super.onCreate(savedInstanceState); setContentView(R.layout.single_fragment_layout); if (savedInstanceState == null) { diff --git a/OsmAnd/src/net/osmand/plus/profiles/SettingsProfileFragment.java b/OsmAnd/src/net/osmand/plus/profiles/SettingsProfileFragment.java index 7990912ec9..5ebe72bb58 100644 --- a/OsmAnd/src/net/osmand/plus/profiles/SettingsProfileFragment.java +++ b/OsmAnd/src/net/osmand/plus/profiles/SettingsProfileFragment.java @@ -1,5 +1,6 @@ package net.osmand.plus.profiles; +import android.content.Intent; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.annotation.Nullable; @@ -42,6 +43,10 @@ public class SettingsProfileFragment extends BaseOsmAndFragment { profilesList = new ArrayList<>(); allDefaultModes = ApplicationMode.allPossibleValues(); allDefaultModes.remove(ApplicationMode.DEFAULT); + allDefaultModes.remove(ApplicationMode.AIRCRAFT); + allDefaultModes.remove(ApplicationMode.MOTORCYCLE); + allDefaultModes.remove(ApplicationMode.HIKING); + allDefaultModes.remove(ApplicationMode.TRAIN); selectedDefaultModes = new LinkedHashSet<>(ApplicationMode.values(getMyApplication())); selectedDefaultModes.remove(ApplicationMode.DEFAULT); for (ApplicationMode am : allDefaultModes) { @@ -99,7 +104,9 @@ public class SettingsProfileFragment extends BaseOsmAndFragment { @Override public void editProfile(ProfileItem item) { - + Intent intent = new Intent(getActivity(), SelectedProfileActivity.class); + intent.putExtra("profile_name", item.title); + startActivity(intent); } }; adapter = new ProfileMenuAdapter(profilesList, getMyApplication(), listener);