]> git.ktnx.net Git - mobile-ledger.git/commitdiff
profile list: larger profile names, add URL sub-head style
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Thu, 10 Jan 2019 19:47:15 +0000 (19:47 +0000)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Thu, 10 Jan 2019 19:47:15 +0000 (19:47 +0000)
app/src/main/java/net/ktnx/mobileledger/ui/activity/ProfileListActivity.java
app/src/main/res/layout/profile_list.xml
app/src/main/res/layout/profile_list_content.xml

index 66288d525256456c2a82185bf73a15d44a070263..03088b473a1abd6f463bca9966b40e100ee8c88e 100644 (file)
@@ -204,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() {
@@ -227,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);
             }
         }
     }
index cb915aaa753a7824a5e8e92de953180ba79f9bdb..ac83fc757ed2dc4d0bae92870d9e38f74b2b6e57 100644 (file)
@@ -23,8 +23,6 @@
     android:name="net.ktnx.mobileledger.ui.activity.ProfileListFragment"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
-    android:layout_marginLeft="16dp"
-    android:layout_marginRight="16dp"
     app:layoutManager="LinearLayoutManager"
     tools:context=".ui.activity.ProfileListActivity"
     tools:listitem="@layout/profile_list_content" />
\ No newline at end of file
index 68fa9a967e39f6fbe1c493b324934ac115e103b0..495acdde995232b5f7457888de44f34511c6725e 100644 (file)
@@ -30,6 +30,7 @@
         android:id="@+id/profile_list_edit_button"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
+        android:layout_marginEnd="16dp"
         android:layout_weight="9"
         android:drawableStart="@drawable/ic_mode_edit_black_24dp"
         android:padding="8dp"
 
     <RadioButton
         android:id="@+id/profile_list_radio"
-        android:layout_width="0dp"
+        android:layout_width="wrap_content"
         android:layout_height="wrap_content"
+        android:layout_marginStart="16dp"
         android:layout_weight="9"
-        android:text="Profile name"
         app:layout_constraintBottom_toBottomOf="parent"
-        app:layout_constraintEnd_toStartOf="@id/profile_list_edit_button"
         app:layout_constraintStart_toStartOf="parent"
         app:layout_constraintTop_toTopOf="parent"
         tools:ignore="HardcodedText" />
 
+    <TextView
+        android:id="@+id/title"
+        style="@style/TextAppearance.AppCompat.Large"
+        android:layout_width="0dp"
+        android:layout_height="wrap_content"
+        android:layout_marginStart="16dp"
+        android:layout_marginEnd="16dp"
+        android:text="Profile name"
+        app:layout_constraintEnd_toStartOf="@id/profile_list_edit_button"
+        app:layout_constraintStart_toEndOf="@id/profile_list_radio"
+        app:layout_constraintTop_toTopOf="parent"
+        tools:ignore="HardcodedText" />
+
+    <TextView
+        android:id="@+id/subtitle"
+        style="@style/TextAppearance.AppCompat.Medium"
+        android:layout_width="0dp"
+        android:layout_height="wrap_content"
+        android:layout_marginStart="16dp"
+        android:layout_marginEnd="16dp"
+        android:text="Sub-heading"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintEnd_toStartOf="@id/profile_list_edit_button"
+        app:layout_constraintStart_toEndOf="@id/profile_list_radio"
+        app:layout_constraintTop_toBottomOf="@id/title"
+        tools:ignore="HardcodedText" />
+
 
 </android.support.constraint.ConstraintLayout>
\ No newline at end of file