fedilab-Android-App/app/src/main/java/app/fedilab/android/imageeditor/base/BaseFragment.java

30 lines
850 B
Java

package app.fedilab.android.imageeditor.base;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
/**
* @author <a href="https://github.com/burhanrashid52">Burhanuddin Rashid</a>
* @version 0.1.2
* @since 5/25/2018
*/
public abstract class BaseFragment extends Fragment {
protected abstract int getLayoutId();
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
if (getLayoutId() == 0) {
throw new IllegalArgumentException("Invalid layout id");
}
return inflater.inflate(getLayoutId(), container, false);
}
}