Adds edit monster view holder and placeholder for basic info tap handler.
This commit is contained in:
		| @@ -4,6 +4,7 @@ import android.os.Bundle; | ||||
| import android.view.LayoutInflater; | ||||
| import android.view.View; | ||||
| import android.view.ViewGroup; | ||||
| import android.widget.TextView; | ||||
|  | ||||
| import androidx.annotation.NonNull; | ||||
| import androidx.annotation.Nullable; | ||||
| @@ -11,10 +12,12 @@ import androidx.fragment.app.Fragment; | ||||
| import androidx.lifecycle.ViewModelProvider; | ||||
|  | ||||
| import com.majinnaibu.monstercards.R; | ||||
| import com.majinnaibu.monstercards.utils.Logger; | ||||
|  | ||||
| public class EditMonsterFragment extends Fragment { | ||||
|  | ||||
|     private EditMonsterViewModel mViewModel; | ||||
|     private ViewHolder mHolder; | ||||
|  | ||||
|     public static EditMonsterFragment newInstance() { | ||||
|         return new EditMonsterFragment(); | ||||
| @@ -23,7 +26,20 @@ public class EditMonsterFragment extends Fragment { | ||||
|     @Override | ||||
|     public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, | ||||
|                              @Nullable Bundle savedInstanceState) { | ||||
|         return inflater.inflate(R.layout.fragment_edit_monster, container, false); | ||||
|         // TODO: Get our monster from the repo based on the id passed in. | ||||
|         // TODO: Show a loading spinner until we have the monster loaded. | ||||
|         // TODO: If there is an error loading the monster show the error. | ||||
|  | ||||
|         View root = inflater.inflate(R.layout.fragment_edit_monster, container, false); | ||||
|  | ||||
|         mHolder = new ViewHolder(root); | ||||
|  | ||||
|         mHolder.basicInfoButton.setOnClickListener(v -> { | ||||
|             // TODO: Navigate to the EditBasicInfo fragment | ||||
|             Logger.logDebug("Basic Info clicked"); | ||||
|         }); | ||||
|  | ||||
|         return root; | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
| @@ -33,4 +49,12 @@ public class EditMonsterFragment extends Fragment { | ||||
|         // TODO: Use the ViewModel | ||||
|     } | ||||
|  | ||||
|     private static class ViewHolder { | ||||
|  | ||||
|         TextView basicInfoButton; | ||||
|  | ||||
|         ViewHolder(View root) { | ||||
|             basicInfoButton = root.findViewById(R.id.basicInfo); | ||||
|         } | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user
	 Tom Hicks
						Tom Hicks