package com.dailystudio.app.fragment;

import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.LoaderManager.LoaderCallbacks;

public abstract class AbsLoaderFragment<T> extends BaseIntentFragment implements LoaderCallbacks<T> {
    
	@Override
	public void onActivityCreated(Bundle savedInstanceState) {
		super.onActivityCreated(savedInstanceState);
		
		getLoaderManager().initLoader(getLoaderId(), createLoaderArguments(), this);
	}
	
	public void onNewIntent(Intent intent) {
		super.onNewIntent(intent);
		
		restartLoader();
	}
	
	public void restartLoader() {
		getLoaderManager().restartLoader(getLoaderId(), createLoaderArguments(), this);
	}

	protected int getEmptyViewId() {
		return android.R.id.empty;
	}
	
	abstract protected int getLoaderId();
	abstract protected Bundle createLoaderArguments();

}

@@ -63,16 +63,58 @@
 Intent;%0A
+import android.content.pm.PackageManager;%0A
 import a
@@ -191,16 +191,65 @@
 llbacks;
+%0Aimport android.support.v4.content.ContextCompat;
 %0A%0Apublic
@@ -835,17 +835,189 @@
 pty;%0A%09%7D%0A
-%09
+%0A%09public boolean isPermissionGranted(String permission)%7B%0A%09%09return (ContextCompat.checkSelfPermission(getContext(),%0A%09%09%09%09permission) == PackageManager.PERMISSION_GRANTED);%0A%09%7D%0A
 %0A%09abstra

add permission check facilities;