package com.biotronisis.pettplant.activity.fragment;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnFocusChangeListener;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.LinearLayout;

import com.biotronisis.pettplant.R;
import com.biotronisis.pettplant.activity.AbstractBaseActivity.MyOnClickListener;
import com.biotronisis.pettplant.activity.IntentParams;
import com.biotronisis.pettplant.debug.MyDebug;
import com.biotronisis.pettplant.file.ErrorHandler;

import java.util.logging.Level;

public abstract class AbstractBaseFragment extends Fragment implements IntentParams {

   private static final String TAG = "AbstractBaseFragment";
//    protected boolean dummyLLHasFocus;

   public abstract void setupView(View view, Bundle savedInstanceState);

   public void populateData() {}

   public void persistData() {}

   @Override
   public void onViewCreated(View view, Bundle savedInstanceState) {
      super.onViewCreated(view, savedInstanceState);
      try {
         //Test
         boolean test = false;
         if (test) {
            throw new Exception("test");
         } else {
            setupView(view, savedInstanceState);
         }
      } catch (Exception e) {
         if (MyDebug.LOG) {
            Log.e(TAG, "setupView failed", e);
         }
         ErrorHandler errorHandler = ErrorHandler.getInstance();
         errorHandler.logError(Level.WARNING, this.getClass().getSimpleName() + ".onViewCreated(): " +
                     "setupView failed - " + e,
               "Alert - Setup View Error",
               "There was an error setting up the view for " + this.getClass().getSimpleName(),
               okOnClickListener);
      }
   }

   MyOnClickListener okOnClickListener = new MyOnClickListener() {
      @Override
      public void onClick() {
         getActivity().finish();
      }
   };

   @Override
   public void onResume() {
      if (MyDebug.LOG) {
         Log.d(TAG, this.getClass().getSimpleName() + ".onResume");
      }
      super.onResume();

      try {
         //Test
//            if (true) {
         populateData();
//            } else {
//                throw new Exception("test");
//            }
      } catch (Exception e) {
         if (MyDebug.LOG) {
            Log.e(TAG, "populateData failed", e);
         }
         ErrorHandler errorHandler = ErrorHandler.getInstance();
         errorHandler.logError(Level.WARNING, this.getClass().getSimpleName() + ".onResume(): " +
                     "populateData failed - " + e,
               getString(R.string.activity_fatal_setup_title),
               getString(R.string.activity_fatal_setup_message) + this.getClass().getSimpleName(),
               okOnClickListener);
      }
   }

   @Override
   public void onPause() {
      if (MyDebug.LOG) {
         Log.d(TAG, "onPause");
      }
      try {
         //Test
//            if (true) {
         persistData();
//            } else {
//                throw new Exception("test");
//            }
      } catch (Exception e) {
         if (MyDebug.LOG) {
            Log.e(TAG, "persistData failed", e);
         }
         ErrorHandler errorHandler = ErrorHandler.getInstance();
         errorHandler.logError(Level.WARNING, this.getClass().getSimpleName() + ".onPause(): " +
                     "persistData failed - " + e,
               getString(R.string.activity_fatal_persist_title),
               getString(R.string.activity_fatal_persist_message) + this.getClass().getSimpleName(),
               okOnClickListener);
      }
      super.onPause();
   }

}

@@ -96,31 +96,34 @@
 support.
-v4.app.Fragment
+annotation.NonNull
 ;%0Aimport
@@ -154,23 +154,16 @@
 Fragment
-Manager
 ;%0Aimport
@@ -210,218 +210,8 @@
 iew;
-%0Aimport android.view.View.OnClickListener;%0Aimport android.view.View.OnFocusChangeListener;%0Aimport android.view.inputmethod.InputMethodManager;%0Aimport android.widget.EditText;%0Aimport android.widget.LinearLayout;
 %0A%0Aim
@@ -889,16 +889,25 @@
 Created(
+@NonNull 
 View vie
@@ -934,24 +934,24 @@
 nceState) %7B%0A
-
       super.
@@ -1019,16 +1019,18 @@
  //Test%0A
+//
         
@@ -1052,16 +1052,18 @@
  false;%0A
+//
         
@@ -1071,24 +1071,26 @@
 if (test) %7B%0A
+//
             
@@ -1114,24 +1114,26 @@
 on(%22test%22);%0A
+//
          %7D e
@@ -1183,24 +1183,26 @@
 anceState);%0A
+//
          %7D%0A 

Delete unused imports. Add NonNull annotation to onViewCreated method. Comment out some manual test code.