* Called by the TermSession when the contents of the view need updating
*/
private UpdateCallback mUpdateNotify = new UpdateCallback() {
- @Override
public void onUpdate() {
if ( mIsSelectingText ) {
int rowShift = mEmulator.getScrollCounter();
private TermService mTermService;
private ServiceConnection mTSConnection = new ServiceConnection() {
- @Override
public void onServiceConnected(ComponentName className, IBinder service) {
Log.i(TermDebug.LOG_TAG, "Bound to TermService");
TermService.TSBinder binder = (TermService.TSBinder) service;
populateViewFlipper();
}
- @Override
public void onServiceDisconnected(ComponentName arg0) {
mTermService = null;
}
class ViewFlipperIterator implements Iterator<View> {
int pos = 0;
- @Override
public boolean hasNext() {
return (pos < getChildCount());
}
- @Override
public View next() {
return getChildAt(pos++);
}
- @Override
public void remove() {
throw new UnsupportedOperationException();
}
this.context = context;
}
- @Override
public Iterator<View> iterator() {
return new ViewFlipperIterator();
}
class WindowListAdapter extends BaseAdapter {
private LayoutInflater inflater = getLayoutInflater();
- @Override
public int getCount() {
return sessions.size();
}
- @Override
public Object getItem(int position) {
return sessions.get(position);
}
- @Override
public long getItemId(int position) {
return position;
}
- @Override
public View getView(int position, View convertView, ViewGroup parent) {
View child = inflater.inflate(R.layout.window_list_item, parent, false);
TextView label = (TextView) child.findViewById(R.id.window_list_label);
final TermService service = mTermService;
final int closePosition = position;
close.setOnClickListener(new View.OnClickListener() {
- @Override
public void onClick(View v) {
TermSession session = service.getSessions().remove(closePosition);
if (session != null) {
}
private ServiceConnection mTSConnection = new ServiceConnection() {
- @Override
public void onServiceConnected(ComponentName className, IBinder service) {
TermService.TSBinder binder = (TermService.TSBinder) service;
mTermService = binder.getService();
populateList();
}
- @Override
public void onServiceDisconnected(ComponentName arg0) {
mTermService = null;
}