X-Git-Url: https://git.ktnx.net/?p=mobile-ledger.git;a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fnet%2Fktnx%2Fmobileledger%2Fui%2Factivity%2FProfileListActivity.java;h=03088b473a1abd6f463bca9966b40e100ee8c88e;hp=b61f567a6dbc0cbb13960ea962060e6d04594b09;hb=64de9b485d42fee572e012a61601fa8c316fc64d;hpb=df76491e17ff98a247a428920f27680aae0d5ae4 diff --git a/app/src/main/java/net/ktnx/mobileledger/ui/activity/ProfileListActivity.java b/app/src/main/java/net/ktnx/mobileledger/ui/activity/ProfileListActivity.java index b61f567a..03088b47 100644 --- a/app/src/main/java/net/ktnx/mobileledger/ui/activity/ProfileListActivity.java +++ b/app/src/main/java/net/ktnx/mobileledger/ui/activity/ProfileListActivity.java @@ -23,6 +23,7 @@ import android.os.Bundle; import android.support.annotation.NonNull; import android.support.design.widget.FloatingActionButton; import android.support.v7.app.AppCompatActivity; +import android.support.v7.widget.DividerItemDecoration; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.Toolbar; import android.support.v7.widget.helper.ItemTouchHelper; @@ -127,6 +128,7 @@ public class ProfileListActivity extends AppCompatActivity { @NonNull RecyclerView.ViewHolder target) { Collections.swap(Data.profiles.getList(), viewHolder.getAdapterPosition(), target.getAdapterPosition()); + MobileLedgerProfile.storeProfilesOrder(); adapter.notifyItemMoved(viewHolder.getAdapterPosition(), target.getAdapterPosition()); return true; @@ -137,6 +139,8 @@ public class ProfileListActivity extends AppCompatActivity { } }; new ItemTouchHelper(cb).attachToRecyclerView(recyclerView); + recyclerView.addItemDecoration(new DividerItemDecoration(recyclerView.getContext(), + DividerItemDecoration.VERTICAL)); } public static class ProfilesRecyclerViewAdapter @@ -200,7 +204,11 @@ public class ProfileListActivity extends AppCompatActivity { final MobileLedgerProfile currentProfile = Data.profile.get(); Log.d("profiles", String.format("pos %d: %s, current: %s", position, profile.getUuid(), currentProfile.getUuid())); - holder.mRadioView.setText(profile.getName()); + View.OnClickListener profileSelector = v -> holder.mRadioView.setChecked(true); + holder.mTitle.setText(profile.getName()); + holder.mTitle.setOnClickListener(profileSelector); + holder.mSubTitle.setText(profile.getUrl()); + holder.mSubTitle.setOnClickListener(profileSelector); holder.mRadioView.setChecked(profile.getUuid().equals(currentProfile.getUuid())); holder.mRadioView .setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @@ -223,11 +231,14 @@ public class ProfileListActivity extends AppCompatActivity { class ProfileListViewHolder extends RecyclerView.ViewHolder { final RadioButton mRadioView; final TextView mEditButton; + final TextView mTitle, mSubTitle; ProfileListViewHolder(View view) { super(view); mRadioView = view.findViewById(R.id.profile_list_radio); mEditButton = view.findViewById(R.id.profile_list_edit_button); + mTitle = view.findViewById(R.id.title); + mSubTitle = view.findViewById(R.id.subtitle); } } }