Profile details edit - work in progress
This commit is contained in:
parent
6bd8fda90a
commit
289e2e8679
8 changed files with 95 additions and 32 deletions
|
@ -1063,8 +1063,14 @@
|
|||
<activity
|
||||
android:configChanges="keyboardHidden|orientation"
|
||||
android:label="Application profiles"
|
||||
android:name=".profiles.SettingsProfileActivity">
|
||||
</activity>
|
||||
android:name=".profiles.SettingsProfileActivity"/>
|
||||
|
||||
|
||||
<activity android:name=".profiles.SelectedProfileActivity"
|
||||
android:label="Application profiles"
|
||||
/>
|
||||
|
||||
|
||||
</application>
|
||||
|
||||
</manifest>
|
|
@ -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"/>
|
||||
|
||||
<android.support.v7.widget.SwitchCompat
|
||||
|
|
|
@ -18,8 +18,8 @@ public class OsmandActionBarActivity extends OsmandInAppPurchaseActivity {
|
|||
protected boolean haveHomeButton = true;
|
||||
|
||||
//should be called after set content view
|
||||
protected void setupHomeButton(){
|
||||
Drawable back = ((OsmandApplication)getApplication()).getUIUtilities().getIcon(R.drawable.ic_arrow_back, R.color.color_white);
|
||||
protected void setupHomeButton() {
|
||||
Drawable back = ((OsmandApplication) getApplication()).getUIUtilities().getIcon(R.drawable.ic_arrow_back, R.color.color_white);
|
||||
final ActionBar supportActionBar = getSupportActionBar();
|
||||
if (supportActionBar != null) {
|
||||
supportActionBar.setHomeButtonEnabled(true);
|
||||
|
|
|
@ -68,7 +68,6 @@ public class ProfileMenuAdapter extends RecyclerView.Adapter<ProfileViewHolder>
|
|||
@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() {
|
||||
|
|
|
@ -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();
|
||||
// }
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue