WMS_Native/.idea/fileTemplates/Android Fragment.java
2024-01-30 10:52:07 +01:00

82 lines
2.2 KiB
Java

#set( $regex = "([a-z])([A-Z]+)")
#set( $replacement = "$1_$2")
#set( $dashName = $NAME.replaceAll($regex, $replacement).toLowerCase())
#set( $variableName = $NAME.replace($NAME.substring(0, 1), $NAME.substring(0, 1).toLowerCase()))
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import javax.inject.Inject;
import it.integry.integrywmsnative.MainApplication;
import it.integry.integrywmsnative.core.expansion.BaseFragment;
public class ${NAME}Fragment extends BaseFragment {
/*
- Create the following layout resource file [fragment_${dashName}.xml]
<?xml version="1.0" encoding="utf-8"?>
<layout 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">
<data>
</data>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
*/
@Inject
${NAME}ViewModel mViewModel;
//private Fragment${NAME}Binding mBindings;
public ${NAME}Fragment() {
// Required empty public constructor
}
public static ${NAME}Fragment newInstance() {
return new ${NAME}Fragment();
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
setRetainInstance(true);
//mBindings = Fragment${NAME}Binding.inflate(inflater, container, false);
//mBindings.setLifecycleOwner(this);
/*
- Add following lines into MainApplicationComponent
[a] into @Component
${NAME}Module.class
[b] into interface body
${NAME}Component.Factory ${variableName}Component();
*/
MainApplication.appComponent
.${variableName}Component()
.create()
.inject(this);
return mBindings.getRoot();
}
}