Replaces duplicated list item layouts with a single shared SimpleListItem.
This commit is contained in:
		
							
								
								
									
										59
									
								
								Android/.idea/misc.xml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										59
									
								
								Android/.idea/misc.xml
									
									
									
										generated
									
									
									
								
							| @@ -1,6 +1,63 @@ | ||||
| <?xml version="1.0" encoding="UTF-8"?> | ||||
| <project version="4"> | ||||
|   <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK"> | ||||
|   <component name="DesignSurface"> | ||||
|     <option name="filePathToZoomLevelMap"> | ||||
|       <map> | ||||
|         <entry key="app/src/main/res/layout/dropdown_list_item.xml" value="0.12777777777777777" /> | ||||
|         <entry key="app/src/main/res/layout/fragment_dashboard_list_item.xml" value="0.2210144927536232" /> | ||||
|         <entry key="app/src/main/res/layout/fragment_edit_strings_list.xml" value="0.2210144927536232" /> | ||||
|         <entry key="app/src/main/res/layout/fragment_edit_strings_list_item.xml" value="0.2210144927536232" /> | ||||
|         <entry key="app/src/main/res/layout/fragment_edit_traits_list.xml" value="0.2210144927536232" /> | ||||
|         <entry key="app/src/main/res/layout/fragment_edit_traits_list_item.xml" value="0.2210144927536232" /> | ||||
|         <entry key="app/src/main/res/layout/simple_list_item.xml" value="0.2210144927536232" /> | ||||
|       </map> | ||||
|     </option> | ||||
|   </component> | ||||
|   <component name="NullableNotNullManager"> | ||||
|     <option name="myDefaultNullable" value="androidx.annotation.Nullable" /> | ||||
|     <option name="myDefaultNotNull" value="androidx.annotation.NonNull" /> | ||||
|     <option name="myNullables"> | ||||
|       <value> | ||||
|         <list size="14"> | ||||
|           <item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" /> | ||||
|           <item index="1" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" /> | ||||
|           <item index="2" class="java.lang.String" itemvalue="android.support.annotation.Nullable" /> | ||||
|           <item index="3" class="java.lang.String" itemvalue="androidx.annotation.Nullable" /> | ||||
|           <item index="4" class="java.lang.String" itemvalue="androidx.annotation.RecentlyNullable" /> | ||||
|           <item index="5" class="java.lang.String" itemvalue="com.android.annotations.Nullable" /> | ||||
|           <item index="6" class="java.lang.String" itemvalue="javax.annotation.Nullable" /> | ||||
|           <item index="7" class="java.lang.String" itemvalue="javax.annotation.CheckForNull" /> | ||||
|           <item index="8" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.qual.Nullable" /> | ||||
|           <item index="9" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NullableDecl" /> | ||||
|           <item index="10" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NullableType" /> | ||||
|           <item index="11" class="java.lang.String" itemvalue="org.eclipse.jdt.annotation.Nullable" /> | ||||
|           <item index="12" class="java.lang.String" itemvalue="io.reactivex.annotations.Nullable" /> | ||||
|           <item index="13" class="java.lang.String" itemvalue="io.reactivex.rxjava3.annotations.Nullable" /> | ||||
|         </list> | ||||
|       </value> | ||||
|     </option> | ||||
|     <option name="myNotNulls"> | ||||
|       <value> | ||||
|         <list size="14"> | ||||
|           <item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" /> | ||||
|           <item index="1" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" /> | ||||
|           <item index="2" class="java.lang.String" itemvalue="android.support.annotation.NonNull" /> | ||||
|           <item index="3" class="java.lang.String" itemvalue="androidx.annotation.NonNull" /> | ||||
|           <item index="4" class="java.lang.String" itemvalue="androidx.annotation.RecentlyNonNull" /> | ||||
|           <item index="5" class="java.lang.String" itemvalue="com.android.annotations.NonNull" /> | ||||
|           <item index="6" class="java.lang.String" itemvalue="javax.annotation.Nonnull" /> | ||||
|           <item index="7" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.qual.NonNull" /> | ||||
|           <item index="8" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NonNullDecl" /> | ||||
|           <item index="9" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NonNullType" /> | ||||
|           <item index="10" class="java.lang.String" itemvalue="org.eclipse.jdt.annotation.NonNull" /> | ||||
|           <item index="11" class="java.lang.String" itemvalue="io.reactivex.annotations.NonNull" /> | ||||
|           <item index="12" class="java.lang.String" itemvalue="io.reactivex.rxjava3.annotations.NonNull" /> | ||||
|           <item index="13" class="java.lang.String" itemvalue="lombok.NonNull" /> | ||||
|         </list> | ||||
|       </value> | ||||
|     </option> | ||||
|   </component> | ||||
|   <component name="ProjectRootManager" version="2" languageLevel="JDK_X" project-jdk-name="1.8" project-jdk-type="JavaSDK"> | ||||
|     <output url="file://$PROJECT_DIR$/build/classes" /> | ||||
|   </component> | ||||
|   <component name="ProjectType"> | ||||
|   | ||||
| @@ -10,7 +10,6 @@ import androidx.annotation.NonNull; | ||||
| import androidx.recyclerview.widget.RecyclerView; | ||||
|  | ||||
| import com.majinnaibu.monstercards.databinding.FragmentEditLanguagesListHeaderBinding; | ||||
| import com.majinnaibu.monstercards.databinding.FragmentEditLanguagesListItemBinding; | ||||
| import com.majinnaibu.monstercards.models.Language; | ||||
| import com.majinnaibu.monstercards.ui.components.Stepper; | ||||
| import com.majinnaibu.monstercards.utils.ItemCallback; | ||||
| @@ -45,7 +44,7 @@ public class EditLanguagesRecyclerViewAdapter extends RecyclerView.Adapter<Recyc | ||||
|         if (viewType == HEADER_VIEW_TYPE) { | ||||
|             return new HeaderViewHolder(FragmentEditLanguagesListHeaderBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false)); | ||||
|         } | ||||
|         return new ItemViewHolder(FragmentEditLanguagesListItemBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false)); | ||||
|         return new ItemViewHolder(com.majinnaibu.monstercards.databinding.SimpleListItemBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false)); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
| @@ -97,7 +96,7 @@ public class EditLanguagesRecyclerViewAdapter extends RecyclerView.Adapter<Recyc | ||||
|         public final TextView mContentView; | ||||
|         public Language mItem; | ||||
|  | ||||
|         public ItemViewHolder(@NonNull FragmentEditLanguagesListItemBinding binding) { | ||||
|         public ItemViewHolder(@NonNull com.majinnaibu.monstercards.databinding.SimpleListItemBinding binding) { | ||||
|             super(binding.getRoot()); | ||||
|             mContentView = binding.content; | ||||
|         } | ||||
|   | ||||
| @@ -7,7 +7,6 @@ import android.widget.TextView; | ||||
| import androidx.annotation.NonNull; | ||||
| import androidx.recyclerview.widget.RecyclerView; | ||||
|  | ||||
| import com.majinnaibu.monstercards.databinding.FragmentEditSkillsListItemBinding; | ||||
| import com.majinnaibu.monstercards.models.Skill; | ||||
| import com.majinnaibu.monstercards.utils.ItemCallback; | ||||
|  | ||||
| @@ -28,7 +27,7 @@ public class EditSkillsRecyclerViewAdapter extends RecyclerView.Adapter<EditSkil | ||||
|     @NonNull | ||||
|     @Override | ||||
|     public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { | ||||
|         return new ViewHolder(FragmentEditSkillsListItemBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false)); | ||||
|         return new ViewHolder(com.majinnaibu.monstercards.databinding.SimpleListItemBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false)); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
| @@ -51,7 +50,7 @@ public class EditSkillsRecyclerViewAdapter extends RecyclerView.Adapter<EditSkil | ||||
|         public final TextView mContentView; | ||||
|         public Skill mItem; | ||||
|  | ||||
|         public ViewHolder(@NonNull FragmentEditSkillsListItemBinding binding) { | ||||
|         public ViewHolder(@NonNull com.majinnaibu.monstercards.databinding.SimpleListItemBinding binding) { | ||||
|             super(binding.getRoot()); | ||||
|             mContentView = binding.content; | ||||
|         } | ||||
|   | ||||
| @@ -4,13 +4,12 @@ import android.view.LayoutInflater; | ||||
| import android.view.ViewGroup; | ||||
| import android.widget.TextView; | ||||
|  | ||||
| import androidx.annotation.NonNull; | ||||
| import androidx.recyclerview.widget.RecyclerView; | ||||
|  | ||||
| import com.majinnaibu.monstercards.databinding.FragmentEditStringsListItemBinding; | ||||
| import com.majinnaibu.monstercards.databinding.SimpleListItemBinding; | ||||
| import com.majinnaibu.monstercards.utils.ItemCallback; | ||||
|  | ||||
| import org.jetbrains.annotations.NotNull; | ||||
|  | ||||
| import java.util.List; | ||||
|  | ||||
| public class EditStringsRecyclerViewAdapter extends RecyclerView.Adapter<EditStringsRecyclerViewAdapter.ViewHolder> { | ||||
| @@ -22,14 +21,14 @@ public class EditStringsRecyclerViewAdapter extends RecyclerView.Adapter<EditStr | ||||
|         mOnClick = onClick; | ||||
|     } | ||||
|  | ||||
|     @NotNull | ||||
|     @NonNull | ||||
|     @Override | ||||
|     public ViewHolder onCreateViewHolder(@NotNull ViewGroup parent, int viewType) { | ||||
|         return new ViewHolder(FragmentEditStringsListItemBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false)); | ||||
|     public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { | ||||
|         return new ViewHolder(SimpleListItemBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false)); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public void onBindViewHolder(final ViewHolder holder, int position) { | ||||
|     public void onBindViewHolder(@NonNull final ViewHolder holder, int position) { | ||||
|         holder.mItem = mValues.get(position); | ||||
|         holder.mContentView.setText(mValues.get(position)); | ||||
|         holder.itemView.setOnClickListener(v -> { | ||||
| @@ -48,12 +47,12 @@ public class EditStringsRecyclerViewAdapter extends RecyclerView.Adapter<EditStr | ||||
|         public final TextView mContentView; | ||||
|         public String mItem; | ||||
|  | ||||
|         public ViewHolder(FragmentEditStringsListItemBinding binding) { | ||||
|         public ViewHolder(@NonNull SimpleListItemBinding binding) { | ||||
|             super(binding.getRoot()); | ||||
|             mContentView = binding.content; | ||||
|         } | ||||
|  | ||||
|         @NotNull | ||||
|         @NonNull | ||||
|         @Override | ||||
|         public String toString() { | ||||
|             return super.toString() + " '" + mContentView.getText() + "'"; | ||||
|   | ||||
| @@ -9,22 +9,20 @@ import androidx.recyclerview.widget.DiffUtil; | ||||
| import androidx.recyclerview.widget.ListAdapter; | ||||
| import androidx.recyclerview.widget.RecyclerView; | ||||
|  | ||||
| import com.majinnaibu.monstercards.databinding.FragmentEditTraitsListItemBinding; | ||||
| import com.majinnaibu.monstercards.databinding.SimpleListItemBinding; | ||||
| import com.majinnaibu.monstercards.models.Trait; | ||||
| import com.majinnaibu.monstercards.utils.ItemCallback; | ||||
|  | ||||
| import org.jetbrains.annotations.NotNull; | ||||
|  | ||||
| public class EditTraitsRecyclerViewAdapter extends ListAdapter<Trait, EditTraitsRecyclerViewAdapter.ViewHolder> { | ||||
|     private static final DiffUtil.ItemCallback<Trait> DIFF_CALLBACK = new DiffUtil.ItemCallback<Trait>() { | ||||
|  | ||||
|         @Override | ||||
|         public boolean areItemsTheSame(@NonNull @NotNull Trait oldItem, @NonNull @NotNull Trait newItem) { | ||||
|         public boolean areItemsTheSame(@NonNull Trait oldItem, @NonNull Trait newItem) { | ||||
|             return oldItem.equals(newItem); | ||||
|         } | ||||
|  | ||||
|         @Override | ||||
|         public boolean areContentsTheSame(@NonNull @NotNull Trait oldItem, @NonNull @NotNull Trait newItem) { | ||||
|         public boolean areContentsTheSame(@NonNull Trait oldItem, @NonNull Trait newItem) { | ||||
|             return oldItem.equals(newItem); | ||||
|         } | ||||
|     }; | ||||
| @@ -35,14 +33,14 @@ public class EditTraitsRecyclerViewAdapter extends ListAdapter<Trait, EditTraits | ||||
|         mOnClick = onClick; | ||||
|     } | ||||
|  | ||||
|     @NotNull | ||||
|     @NonNull | ||||
|     @Override | ||||
|     public ViewHolder onCreateViewHolder(@NotNull ViewGroup parent, int viewType) { | ||||
|         return new ViewHolder(FragmentEditTraitsListItemBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false)); | ||||
|     public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { | ||||
|         return new ViewHolder(SimpleListItemBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false)); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public void onBindViewHolder(final ViewHolder holder, int position) { | ||||
|     public void onBindViewHolder(@NonNull final ViewHolder holder, int position) { | ||||
|         holder.mItem = getItem(position); | ||||
|         holder.mContentView.setText(holder.mItem.name); | ||||
|         holder.itemView.setOnClickListener(v -> { | ||||
| @@ -56,12 +54,12 @@ public class EditTraitsRecyclerViewAdapter extends ListAdapter<Trait, EditTraits | ||||
|         public final TextView mContentView; | ||||
|         public Trait mItem; | ||||
|  | ||||
|         public ViewHolder(FragmentEditTraitsListItemBinding binding) { | ||||
|         public ViewHolder(@NonNull SimpleListItemBinding binding) { | ||||
|             super(binding.getRoot()); | ||||
|             mContentView = binding.content; | ||||
|         } | ||||
|  | ||||
|         @NotNull | ||||
|         @NonNull | ||||
|         @Override | ||||
|         public String toString() { | ||||
|             return super.toString() + " '" + mContentView.getText() + "'"; | ||||
|   | ||||
| @@ -1,42 +0,0 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||||
|     android:layout_width="match_parent" | ||||
|     android:layout_height="wrap_content" | ||||
|     android:orientation="horizontal"> | ||||
|  | ||||
|     <TextView | ||||
|         android:id="@+id/content" | ||||
|         android:layout_width="match_parent" | ||||
|         android:layout_height="wrap_content" | ||||
|         android:layout_margin="@dimen/text_margin" | ||||
|         android:textAppearance="?attr/textAppearanceListItem" /> | ||||
|  | ||||
|     <!--            <include--> | ||||
|     <!--                layout="@layout/card_monster"--> | ||||
|     <!--                android:layout_width="0dp"--> | ||||
|     <!--                android:layout_height="wrap_content"--> | ||||
|     <!--                android:layout_columnWeight="1"--> | ||||
|     <!--                android:layout_marginVertical="8dp"/>--> | ||||
|  | ||||
|     <!--            <include--> | ||||
|     <!--                layout="@layout/card_monster_short"--> | ||||
|     <!--                android:layout_width="0dp"--> | ||||
|     <!--                android:layout_height="wrap_content"--> | ||||
|     <!--                android:layout_columnWeight="1"--> | ||||
|     <!--                android:layout_marginVertical="8dp"/>--> | ||||
|  | ||||
|     <!--            <include--> | ||||
|     <!--                layout="@layout/tile_monster"--> | ||||
|     <!--                android:layout_width="0dp"--> | ||||
|     <!--                android:layout_height="wrap_content"--> | ||||
|     <!--                android:layout_columnWeight="1"--> | ||||
|     <!--                android:layout_marginVertical="8dp"/>--> | ||||
|  | ||||
|     <!--            <include--> | ||||
|     <!--                layout="@layout/tile_monster_short"--> | ||||
|     <!--                android:layout_width="0dp"--> | ||||
|     <!--                android:layout_height="wrap_content"--> | ||||
|     <!--                android:layout_columnWeight="1"--> | ||||
|     <!--                android:layout_marginVertical="8dp" />--> | ||||
|  | ||||
| </LinearLayout> | ||||
| @@ -17,7 +17,7 @@ | ||||
|         app:layout_constraintEnd_toEndOf="parent" | ||||
|         app:layout_constraintStart_toStartOf="parent" | ||||
|         app:layout_constraintTop_toTopOf="parent" | ||||
|         tools:listitem="@layout/fragment_edit_languages_list_item" /> | ||||
|         tools:listitem="@layout/simple_list_item" /> | ||||
|  | ||||
|     <com.google.android.material.floatingactionbutton.FloatingActionButton | ||||
|         android:id="@+id/add_language" | ||||
|   | ||||
| @@ -1,13 +1,33 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <androidx.recyclerview.widget.RecyclerView xmlns:android="http://schemas.android.com/apk/res/android" | ||||
| <androidx.constraintlayout.widget.ConstraintLayout 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:id="@+id/list" | ||||
|     android:name="com.majinnaibu.monstercards.ui.editmonster.EditSkillsFragment" | ||||
|     android:layout_width="match_parent" | ||||
|     android:layout_height="match_parent" | ||||
|     android:layout_marginLeft="16dp" | ||||
|     android:layout_marginRight="16dp" | ||||
|     tools:context=".ui.editmonster.EditSkillsFragment"> | ||||
|  | ||||
|     <androidx.recyclerview.widget.RecyclerView | ||||
|         android:id="@+id/list" | ||||
|         android:layout_width="match_parent" | ||||
|         android:layout_height="match_parent" | ||||
|         android:divider="?android:attr/dividerVertical" | ||||
|         android:dividerPadding="@dimen/text_margin" | ||||
|         app:layoutManager="LinearLayoutManager" | ||||
|     tools:context=".ui.editmonster.EditSkillsFragment" | ||||
|     tools:listitem="@layout/fragment_edit_skills_list_item" /> | ||||
|         app:layout_constraintBottom_toBottomOf="parent" | ||||
|         app:layout_constraintEnd_toEndOf="parent" | ||||
|         app:layout_constraintStart_toStartOf="parent" | ||||
|         app:layout_constraintTop_toTopOf="parent" | ||||
|         tools:listitem="@layout/simple_list_item" /> | ||||
|  | ||||
|     <com.google.android.material.floatingactionbutton.FloatingActionButton | ||||
|         android:id="@+id/add_skill" | ||||
|         android:layout_width="wrap_content" | ||||
|         android:layout_height="wrap_content" | ||||
|         android:layout_gravity="bottom|end" | ||||
|         android:layout_margin="@dimen/fab_margin" | ||||
|         android:contentDescription="@string/action_add_skill" | ||||
|         app:layout_constraintBottom_toBottomOf="parent" | ||||
|         app:layout_constraintEnd_toEndOf="parent" | ||||
|         app:srcCompat="@android:drawable/ic_input_add" | ||||
|         app:tint="@android:color/white" /> | ||||
| </androidx.constraintlayout.widget.ConstraintLayout> | ||||
|   | ||||
| @@ -1,13 +0,0 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||||
|     android:layout_width="match_parent" | ||||
|     android:layout_height="wrap_content" | ||||
|     android:orientation="horizontal"> | ||||
|  | ||||
|     <TextView | ||||
|         android:id="@+id/content" | ||||
|         android:layout_width="match_parent" | ||||
|         android:layout_height="wrap_content" | ||||
|         android:layout_margin="@dimen/text_margin" | ||||
|         android:textAppearance="?attr/textAppearanceListItem" /> | ||||
| </LinearLayout> | ||||
| @@ -17,7 +17,7 @@ | ||||
|         app:layout_constraintEnd_toEndOf="parent" | ||||
|         app:layout_constraintStart_toStartOf="parent" | ||||
|         app:layout_constraintTop_toTopOf="parent" | ||||
|         tools:listitem="@layout/fragment_edit_traits_list_item" /> | ||||
|         tools:listitem="@layout/simple_list_item" /> | ||||
|  | ||||
|     <com.google.android.material.floatingactionbutton.FloatingActionButton | ||||
|         android:id="@+id/add_item" | ||||
|   | ||||
| @@ -17,7 +17,7 @@ | ||||
|         app:layout_constraintEnd_toEndOf="parent" | ||||
|         app:layout_constraintStart_toStartOf="parent" | ||||
|         app:layout_constraintTop_toTopOf="parent" | ||||
|         tools:listitem="@layout/fragment_edit_traits_list_item" /> | ||||
|         tools:listitem="@layout/simple_list_item" /> | ||||
|  | ||||
|     <com.google.android.material.floatingactionbutton.FloatingActionButton | ||||
|         android:id="@+id/add_trait" | ||||
|   | ||||
| @@ -1,13 +0,0 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||||
|     android:layout_width="match_parent" | ||||
|     android:layout_height="wrap_content" | ||||
|     android:orientation="horizontal"> | ||||
|  | ||||
|     <TextView | ||||
|         android:id="@+id/content" | ||||
|         android:layout_width="match_parent" | ||||
|         android:layout_height="wrap_content" | ||||
|         android:layout_margin="@dimen/text_margin" | ||||
|         android:textAppearance="?attr/textAppearanceListItem" /> | ||||
| </LinearLayout> | ||||
		Reference in New Issue
	
	Block a user
	 Tom Hicks
						Tom Hicks