package com.socialize.demo;

import android.app.Activity;
import android.content.Context;
import android.widget.Toast;

import com.socialize.entity.Entity;
import com.socialize.ui.SocializeEntityLoader;

public class SampleEntityLoader implements SocializeEntityLoader {

	private Toast toast;

	@Override
	public void loadEntity(Activity activity, Entity entity) {
		
		// Demo only.. you would usually load your entity here.
		String msg = "Clicked on entity with key: " + entity.getKey();
		if(toast != null) {
			toast.cancel();
			toast.setText(msg);
		}
		else {
			toast = Toast.makeText(activity, msg, Toast.LENGTH_SHORT);
		}
		
		toast.show();
	}

	@Override
	public boolean canLoad(Context arg0, Entity arg1) {
		return true;
	}

}

@@ -269,31 +269,8 @@
  %7B%0A%0A
-%09private Toast toast;%0A%0A
 %09@Ov
@@ -268,32 +268,32 @@
 r %7B%0A%0A%09@Override%0A
+
 %09public void loa
@@ -336,19 +336,16 @@
 tity) %7B%0A
-%09%09%0A
 %09%09// Dem
@@ -465,94 +465,8 @@
 ;%0A%09%09
-if(toast != null) %7B%0A%09%09%09toast.cancel();%0A%09%09%09toast.setText(msg);%0A%09%09%7D%0A%09%09else %7B%0A%09%09%09toast = 
 Toas
@@ -514,24 +514,8 @@
 ORT)
-;%0A%09%09%7D%0A%09%09%0A%09%09toast
 .sho
@@ -602,14 +602,13 @@
 n true;%0A
+
 %09%7D%0A
-%0A
 %7D%0A

Update sample entity loader