// Path: src/main/java/com/inovex/zabbixmobile/adapters/ScreensListAdapter.java
// public class ScreensListAdapter extends BaseServiceAdapter<Screen> {
// 
// 	private static final String TAG = ScreensListAdapter.class.getSimpleName();
// 	private int mTextViewResourceId = R.layout.list_item_screens;
// 
// 	/**
// 	 * Constructor.
// 	 * 
// 	 * @param service
// 	 */
// 	public ScreensListAdapter(ZabbixDataService service) {
// 		super(service);
// 	}
// 
// 	@Override
// 	public View getView(int position, View convertView, ViewGroup parent) {
// 		View row = convertView;
// 
// 		if (row == null) {
// 			row = getInflater().inflate(mTextViewResourceId, parent, false);
// 
// 		}
// 
// 		TextView title = (TextView) row.findViewById(R.id.screen_entry_name);
// 
// 		Screen s = getItem(position);
// 
// 		StringBuilder titleBuilder = new StringBuilder();
// 		if(s.getHost() != null) {
// 			titleBuilder.append(s.getHost().getName() + " - ");
// 		}
// 		titleBuilder.append(s.getName());
// 		title.setText(titleBuilder.toString());
// 
// 		return row;
// 	}
// 
// 	@Override
// 	public long getItemId(int position) {
// 		Screen item = getItem(position); 
// 		if (item != null)
// 			return item.getScreenId();
// 		return 0;
// 	}
// 
// }
// 
// Path: src/main/java/com/inovex/zabbixmobile/listeners/OnScreensItemSelectedListener.java
// public interface OnScreensItemSelectedListener {
// 
// 	/**
// 	 * Callback method for the selection of a screen.
// 	 * 
// 	 * @param screen
// 	 *            the screen
// 	 */
// 	public void onScreenSelected(Screen screen);
// 
// }


import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.ListView;
import com.inovex.zabbixmobile.R;
import com.inovex.zabbixmobile.adapters.ScreensListAdapter;
import com.inovex.zabbixmobile.listeners.OnScreensItemSelectedListener;
	public void setCurrentPosition(int currentPosition) {
		this.mCurrentPosition = currentPosition;
	}

	public void setCurrentItemId(long currentItemId) {
		this.mCurrentItemId = currentItemId;
	}

	@Override
	public void onListItemClick(ListView l, View v, int position, long id) {
		setCurrentPosition(position);
		setCurrentItemId(id);
		mCallbackMain.onScreenSelected(mListAdapter.getItem(position));
	}

	@Override
	protected void setupListAdapter() {
		this.mListAdapter = mZabbixDataService.getScreensListAdapter();
		setListAdapter(mListAdapter);
	}

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		if (savedInstanceState != null) {
			mCurrentPosition = savedInstanceState.getInt(ARG_POSITION);
			mCurrentItemId = savedInstanceState.getLong(ARG_ITEM_ID);
			mLoadingSpinnerVisible = savedInstanceState.getBoolean(
					ARG_SPINNER_VISIBLE, false);
		}
// Path: src/main/java/com/inovex/zabbixmobile/adapters/ScreensListAdapter.java
// public class ScreensListAdapter extends BaseServiceAdapter<Screen> {
// 
// 	private static final String TAG = ScreensListAdapter.class.getSimpleName();
// 	private int mTextViewResourceId = R.layout.list_item_screens;
// 
// 	/**
// 	 * Constructor.
// 	 * 
// 	 * @param service
// 	 */
// 	public ScreensListAdapter(ZabbixDataService service) {
// 		super(service);
// 	}
// 
// 	@Override
// 	public View getView(int position, View convertView, ViewGroup parent) {
// 		View row = convertView;
// 
// 		if (row == null) {
// 			row = getInflater().inflate(mTextViewResourceId, parent, false);
// 
// 		}
// 
// 		TextView title = (TextView) row.findViewById(R.id.screen_entry_name);
// 
// 		Screen s = getItem(position);
// 
// 		StringBuilder titleBuilder = new StringBuilder();
// 		if(s.getHost() != null) {
// 			titleBuilder.append(s.getHost().getName() + " - ");
// 		}
// 		titleBuilder.append(s.getName());
// 		title.setText(titleBuilder.toString());
// 
// 		return row;
// 	}
// 
// 	@Override
// 	public long getItemId(int position) {
// 		Screen item = getItem(position); 
// 		if (item != null)
// 			return item.getScreenId();
// 		return 0;
// 	}
// 
// }
// 
// Path: src/main/java/com/inovex/zabbixmobile/listeners/OnScreensItemSelectedListener.java
// public interface OnScreensItemSelectedListener {
// 
// 	/**
// 	 * Callback method for the selection of a screen.
// 	 * 
// 	 * @param screen
// 	 *            the screen
// 	 */
// 	public void onScreenSelected(Screen screen);
// 
// }


// Path: src/main/java/com/inovex/zabbixmobile/activities/fragments/ScreensListFragment.java
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.ListView;
import com.inovex.zabbixmobile.R;
import com.inovex.zabbixmobile.adapters.ScreensListAdapter;
import com.inovex.zabbixmobile.listeners.OnScreensItemSelectedListener;

	public void setCurrentPosition(int currentPosition) {
		this.mCurrentPosition = currentPosition;
	}

	public void setCurrentItemId(long currentItemId) {
		this.mCurrentItemId = currentItemId;
	}

	@Override
	public void onListItemClick(ListView l, View v, int position, long id) {
		setCurrentPosition(position);
		setCurrentItemId(id);
		mCallbackMain.onScreenSelected(mListAdapter.getItem(position));
	}

	@Override
	protected void setupListAdapter() {
		this.mListAdapter = mZabbixDataService.getScreensListAdapter();
		setListAdapter(mListAdapter);
	}

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		if (savedInstanceState != null) {
			mCurrentPosition = savedInstanceState.getInt(ARG_POSITION);
			mCurrentItemId = savedInstanceState.getLong(ARG_ITEM_ID);
			mLoadingSpinnerVisible = savedInstanceState.getBoolean(
					ARG_SPINNER_VISIBLE, false);
		}
		Log.d(TAG, "pos: " + mCurrentPosition + "; id: " + mCurrentItemId);