Java Code Examples for android.widget.AdapterView

The following code examples are extracted from open source projects. You can click to vote up the examples that are useful to you.

Example 1

From project androidquery, under directory /src/com/androidquery/.

Source file: AbstractAQuery.java

  18 
vote

/** 
 * Set the adapter of an AdapterView.
 * @param adapter adapter
 * @return self
 */
@SuppressWarnings({"unchecked","rawtypes"}) public T adapter(Adapter adapter){
  if (view instanceof AdapterView) {
    AdapterView av=(AdapterView)view;
    av.setAdapter(adapter);
  }
  return self();
}
 

Example 2

From project 2Degrees-Toolbox, under directory /ActionBarSherlock/src/com/actionbarsherlock/internal/widget/.

Source file: IcsSpinner.java

  15 
vote

public DropdownPopup(Context context,AttributeSet attrs,int defStyleRes){
  super(context,attrs,0,defStyleRes);
  setAnchorView(IcsSpinner.this);
  setModal(true);
  setPromptPosition(POSITION_PROMPT_ABOVE);
  setOnItemClickListener(new OnItemClickListener(){
    @SuppressWarnings("rawtypes") public void onItemClick(    AdapterView parent,    View v,    int position,    long id){
      IcsSpinner.this.setSelection(position);
      dismiss();
    }
  }
);
}
 

Example 3

From project 4308Cirrus, under directory /Extras/actionbarsherlock/src/com/actionbarsherlock/internal/widget/.

Source file: IcsSpinner.java

  15 
vote

public DropdownPopup(Context context,AttributeSet attrs,int defStyleRes){
  super(context,attrs,0,defStyleRes);
  setAnchorView(IcsSpinner.this);
  setModal(true);
  setPromptPosition(POSITION_PROMPT_ABOVE);
  setOnItemClickListener(new OnItemClickListener(){
    @SuppressWarnings("rawtypes") public void onItemClick(    AdapterView parent,    View v,    int position,    long id){
      IcsSpinner.this.setSelection(position);
      dismiss();
    }
  }
);
}
 

Example 4

From project Absolute-Android-RSS, under directory /src/com/AA/Activities/.

Source file: AASettings.java

  15 
vote

/** 
 * Called when the activity is created and put into memory. This is where all GUI elements should be set up and any other member variables that is used throughout the class
 */
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.settings_main);
  TextView tv=(TextView)findViewById(R.id.AATitle);
  Typeface face=Typeface.createFromAsset(getAssets(),"fonts/WREXHAM_.TTF");
  tv.setTypeface(face);
  settings=this.getSharedPreferences("settings",0);
  adapter=new ColorAdapter(this);
  this.setListAdapter(adapter);
  ListView lv=getListView();
  lv.setOnItemClickListener(new OnItemClickListener(){
    public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      showDialog(position);
    }
  }
);
  sb_freq=(SeekBar)this.findViewById(R.id.sb_freq);
  tv_freq=(TextView)this.findViewById(R.id.tv_freq);
  sb_freq.setOnSeekBarChangeListener(new OnSeekBarChangeListener(){
    @Override public void onStopTrackingTouch(    SeekBar seekBar){
    }
    @Override public void onStartTrackingTouch(    SeekBar seekBar){
    }
    @Override public void onProgressChanged(    SeekBar seekBar,    int progress,    boolean fromUser){
      tv_freq.setText((progress + 1) + " hour(s)");
    }
  }
);
  sb_freq.setProgress((int)settings.getLong("freq",2) - 1);
}
 

Example 5

From project ActionBarSherlock, under directory /library/src/com/actionbarsherlock/internal/widget/.

Source file: IcsSpinner.java

  15 
vote

public DropdownPopup(Context context,AttributeSet attrs,int defStyleRes){
  super(context,attrs,0,defStyleRes);
  setAnchorView(IcsSpinner.this);
  setModal(true);
  setPromptPosition(POSITION_PROMPT_ABOVE);
  setOnItemClickListener(new OnItemClickListener(){
    @SuppressWarnings("rawtypes") public void onItemClick(    AdapterView parent,    View v,    int position,    long id){
      IcsSpinner.this.setSelection(position);
      dismiss();
    }
  }
);
}
 

Example 6

From project adg-android, under directory /src/com/analysedesgeeks/android/.

Source file: InfoActivity.java

  15 
vote

@Override protected void onCreate(final Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_info);
  final List<InfoItem> list=initList();
  listView.setAdapter(new InfoAdapter(this,list));
  listView.setOnItemClickListener(new OnItemClickListener(){
    @Override public void onItemClick(    final AdapterView<?> arg0,    final View arg1,    final int position,    final long arg3){
      handleItemClicked(position);
    }
  }
);
}
 

Example 7

From project agit, under directory /agit/src/main/java/com/madgag/agit/.

Source file: RepoSummaryAdapter.java

  15 
vote

public AdapterView.OnItemClickListener getOnItemClickListener(){
  return new AdapterView.OnItemClickListener(){
    public void onItemClick(    AdapterView<?> adapterView,    View view,    int position,    long id){
      EnabledListItem item=(EnabledListItem)getItem(position);
      item.onItemClick();
    }
  }
;
}
 

Example 8

From project AirCastingAndroidClient, under directory /src/main/java/pl/llp/aircasting/activity/.

Source file: SessionsActivity.java

  15 
vote

@Override public boolean onItemLongClick(AdapterView<?> adapterView,View view,int position,long id){
  Intent intent=new Intent(this,OpenSessionActivity.class);
  Session s=sessionAdapter.getSession(position);
  sessionId=s.getId();
  startActivityForResult(intent,0);
  return true;
}
 

Example 9

From project Airports, under directory /src/com/nadmm/airports/afd/.

Source file: SearchActivity.java

  15 
vote

@SuppressWarnings("deprecation") private void showResults(String query){
  Cursor c=managedQuery(AirportsProvider.CONTENT_URI,null,null,new String[]{query},null);
  int count=c.getCount();
  startManagingCursor(c);
  setContentView(R.layout.list_view_layout);
  ListView listView=(ListView)findViewById(android.R.id.list);
  listView.setOnItemClickListener(new OnItemClickListener(){
    @Override public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      Cursor c=mListAdapter.getCursor();
      String siteNumber=c.getString(c.getColumnIndex(Airports.SITE_NUMBER));
      Intent intent=new Intent(SearchActivity.this,AirportDetailsActivity.class);
      intent.putExtra(Airports.SITE_NUMBER,siteNumber);
      startActivity(intent);
    }
  }
);
  mListAdapter=new AirportsCursorAdapter(this,c);
  listView.setAdapter(mListAdapter);
  getSupportActionBar().setSubtitle(getResources().getQuantityString(R.plurals.search_entry_found,count,count,query));
}
 

Example 10

From project AlarmApp-Android, under directory /src/org/alarmapp/activities/.

Source file: AlarmListActivity.java

  15 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.alarm_list);
  this.getListView().setOnItemClickListener(new OnItemClickListener(){
    public void onItemClick(    AdapterView<?> view,    View row,    int pos,    long arg3){
      Alarm a=(Alarm)view.getItemAtPosition(pos);
      LogEx.info("Alarm clicked. OperationID: " + a.getOperationId());
      IntentUtil.displayAlarmActivity(AlarmListActivity.this,a);
    }
  }
);
}
 

Example 11

From project alljoyn_java, under directory /samples/android/chat/src/org/alljoyn/bus/sample/chat/.

Source file: DialogBuilder.java

  15 
vote

public Dialog createUseJoinDialog(final Activity activity,final ChatApplication application){
  Log.i(TAG,"createUseJoinDialog()");
  final Dialog dialog=new Dialog(activity);
  dialog.requestWindowFeature(dialog.getWindow().FEATURE_NO_TITLE);
  dialog.setContentView(R.layout.usejoindialog);
  ArrayAdapter<String> channelListAdapter=new ArrayAdapter<String>(activity,android.R.layout.test_list_item);
  final ListView channelList=(ListView)dialog.findViewById(R.id.useJoinChannelList);
  channelList.setAdapter(channelListAdapter);
  List<String> channels=application.getFoundChannels();
  for (  String channel : channels) {
    int lastDot=channel.lastIndexOf('.');
    if (lastDot < 0) {
      continue;
    }
    channelListAdapter.add(channel.substring(lastDot + 1));
  }
  channelListAdapter.notifyDataSetChanged();
  channelList.setOnItemClickListener(new ListView.OnItemClickListener(){
    public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      String name=channelList.getItemAtPosition(position).toString();
      application.useSetChannelName(name);
      application.useJoinChannel();
      activity.removeDialog(UseActivity.DIALOG_JOIN_ID);
    }
  }
);
  Button cancel=(Button)dialog.findViewById(R.id.useJoinCancel);
  cancel.setOnClickListener(new View.OnClickListener(){
    public void onClick(    View view){
      activity.removeDialog(UseActivity.DIALOG_JOIN_ID);
    }
  }
);
  return dialog;
}
 

Example 12

From project Amantech, under directory /Android/action_bar_sherlock/src/com/actionbarsherlock/internal/widget/.

Source file: IcsSpinner.java

  15 
vote

public DropdownPopup(Context context,AttributeSet attrs,int defStyleRes){
  super(context,attrs,0,defStyleRes);
  setAnchorView(IcsSpinner.this);
  setModal(true);
  setPromptPosition(POSITION_PROMPT_ABOVE);
  setOnItemClickListener(new OnItemClickListener(){
    @SuppressWarnings("rawtypes") public void onItemClick(    AdapterView parent,    View v,    int position,    long id){
      IcsSpinner.this.setSelection(position);
      dismiss();
    }
  }
);
}
 

Example 13

From project AmDroid, under directory /AmDroid/src/main/java/com/jaeckel/amenoid/.

Source file: DisputeActivity.java

  15 
vote

public void onItemClick(AdapterView<?> adapterView,View view,int i,long l){
  Log.d(TAG,"onItemClick: adapterView: " + adapterView + " view: "+ view+ ", i: "+ i+ " l: "+ l);
  Log.d(TAG,"onItemClick: Item: " + adapterView.getAdapter().getItem(i));
  newObjektName=(Objekt)adapterView.getAdapter().getItem(i);
  Log.d(TAG,"-----> newObjektName: " + newObjektName);
}
 

Example 14

From project and-bible, under directory /AndBible/src/net/bible/android/view/activity/base/.

Source file: DocumentSelectionBase.java

  15 
vote

private void initialiseView(){
  languageList=new ArrayList<Language>();
  displayedDocuments=new ArrayList<Book>();
  ArrayAdapter<Book> listArrayAdapter=new DocumentItemAdapter(this,LIST_ITEM_TYPE,displayedDocuments,isInstallStatusIconsShown);
  setListAdapter(listArrayAdapter);
  documentTypeSpinner=(Spinner)findViewById(R.id.documentTypeSpinner);
  setInitialDocumentType();
  documentTypeSpinner.setSelection(selectedDocumentFilterNo);
  documentTypeSpinner.setOnItemSelectedListener(new OnItemSelectedListener(){
    @Override public void onItemSelected(    AdapterView<?> parent,    View view,    int position,    long id){
      selectedDocumentFilterNo=position;
      DocumentSelectionBase.this.filterDocuments();
    }
    @Override public void onNothingSelected(    AdapterView<?> arg0){
    }
  }
);
{
    langSpinner=(Spinner)findViewById(R.id.languageSpinner);
    langSpinner.setOnItemSelectedListener(new OnItemSelectedListener(){
      @Override public void onItemSelected(      AdapterView<?> parent,      View view,      int position,      long id){
        selectedLanguageNo=position;
        lastSelectedLanguage=languageList.get(selectedLanguageNo);
        DocumentSelectionBase.this.filterDocuments();
      }
      @Override public void onNothingSelected(      AdapterView<?> arg0){
      }
    }
);
    langArrayAdapter=new ArrayAdapter<Language>(this,android.R.layout.simple_spinner_item,languageList);
    langArrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    langSpinner.setAdapter(langArrayAdapter);
  }
}
 

Example 15

From project andlytics, under directory /actionbarsherlock/src/com/actionbarsherlock/internal/widget/.

Source file: IcsSpinner.java

  15 
vote

public DropdownPopup(Context context,AttributeSet attrs,int defStyleRes){
  super(context,attrs,0,defStyleRes);
  setAnchorView(IcsSpinner.this);
  setModal(true);
  setPromptPosition(POSITION_PROMPT_ABOVE);
  setOnItemClickListener(new OnItemClickListener(){
    @SuppressWarnings("rawtypes") public void onItemClick(    AdapterView parent,    View v,    int position,    long id){
      IcsSpinner.this.setSelection(position);
      dismiss();
    }
  }
);
}
 

Example 16

From project Android, under directory /app/src/main/java/com/github/mobile/ui/commit/.

Source file: CommitCompareListFragment.java

  15 
vote

private void openLine(AdapterView<?> parent,int position){
  Object item=null;
  while (--position >= 0) {
    item=parent.getItemAtPosition(position);
    if (item instanceof CommitFile) {
      openFile((CommitFile)item);
      return;
    }
  }
}
 

Example 17

From project android-api-demos, under directory /src/com/mobeelizer/demos/activities/.

Source file: ConflictsActivity.java

  15 
vote

@Override public void onItemClick(final AdapterView<?> parent,final View view,final int position,final long id){
  ConflictsEntity ce=mAdapter.getItem(position);
  Intent i=new Intent(ConflictsActivity.this,ConflictsDetailsActivity.class);
  i.putExtra(ConflictsDetailsActivity.POSITION,position);
  i.putExtra(ConflictsDetailsActivity.TITLE,ce.getTitle());
  i.putExtra(ConflictsDetailsActivity.RATING,ce.getScore());
  startActivityForResult(i,CHANGE_RATING);
}
 

Example 18

From project Android-automation, under directory /TmtsApp/src/com/taobao/tmts/framework/app/.

Source file: ListViewActivity.java

  15 
vote

public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  this.requestWindowFeature(Window.FEATURE_NO_TITLE);
  setContentView(R.layout.listview_layout);
  ListView listview=(ListView)findViewById(R.id.my_listview);
  ArrayList<HashMap<String,Object>> listitem=new ArrayList<HashMap<String,Object>>();
  for (int i=0; i < 100; i++) {
    HashMap<String,Object> map=new HashMap<String,Object>();
    map.put("itemimage",R.drawable.icon);
    map.put("itemTitle","Item" + i);
    map.put("itemText","Thank you!");
    listitem.add(map);
  }
  SimpleAdapter listitemAdapter=new SimpleAdapter(this,listitem,R.layout.listview_item_layout,new String[]{"itemimage","itemTitle","itemText"},new int[]{R.id.ItemImage,R.id.ItemTitle,R.id.ItemText});
  listview.setAdapter(listitemAdapter);
  listview.setOnItemClickListener(new OnItemClickListener(){
    @Override public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
    }
  }
);
  listview.setOnCreateContextMenuListener(new OnCreateContextMenuListener(){
    @Override public void onCreateContextMenu(    ContextMenu menu,    View v,    ContextMenuInfo menuInfo){
      menu.setHeaderTitle("Hello");
      menu.add(0,0,0,"Item One");
      menu.add(0,1,0,"Item Two");
    }
  }
);
}
 

Example 19

From project android-bankdroid, under directory /src/com/liato/bankdroid/appwidget/.

Source file: WidgetConfigureActivity.java

  15 
vote

public void onResume(){
  super.onResume();
  setContentView(R.layout.main);
  this.setTitle(this.getString(R.string.choose_an_account));
  setResult(RESULT_CANCELED);
  ((View)findViewById(R.id.layMainMenu)).setVisibility(View.GONE);
  Intent intent=getIntent();
  Bundle extras=intent.getExtras();
  if (extras != null) {
    mAppWidgetId=extras.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID,AppWidgetManager.INVALID_APPWIDGET_ID);
  }
  if (mAppWidgetId == AppWidgetManager.INVALID_APPWIDGET_ID) {
    finish();
  }
  ListView lv=(ListView)findViewById(R.id.lstAccountsList);
  lv.setOnItemClickListener(new OnItemClickListener(){
    public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      if (adapter.getItemViewType(position) != AccountsAdapter.VIEWTYPE_ACCOUNT)       return;
      final Context context=WidgetConfigureActivity.this;
      Account account=(Account)parent.getItemAtPosition(position);
      Bank bank=account.getBank();
      WidgetConfigureActivity.setAccountBankId(context,mAppWidgetId,account.getId(),bank.getDbId());
      SharedPreferences.Editor prefs=context.getSharedPreferences("widget_prefs",0).edit();
      prefs.putBoolean("transperant_background" + mAppWidgetId,((CheckBox)findViewById(R.id.chkTransperantBackground)).isChecked());
      prefs.commit();
      AppWidgetManager appWidgetManager=AppWidgetManager.getInstance(context);
      BankdroidWidgetProvider.updateAppWidget(context,appWidgetManager,mAppWidgetId,account);
      Intent resultValue=new Intent();
      resultValue.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID,mAppWidgetId);
      setResult(RESULT_OK,resultValue);
      finish();
    }
  }
);
  refreshView();
}
 

Example 20

From project android-client, under directory /xwiki-android-components/src/org/xwiki/android/components/attachments/.

Source file: AttachmentActivity.java

  15 
vote

private void initDataArray(){
  Requests request=new Requests(url);
  if (isSecured) {
    request.setAuthentication(username,password);
  }
  Attachments attachments=request.requestAllPageAttachments(wikiName,spaceName,pageName);
  List<Attachment> attachmentList=attachments.getAttachments();
  data=new String[attachmentList.size()];
  for (int i=0; i < data.length; i++) {
    data[i]=attachmentList.get(i).getName();
  }
  setListAdapter(new ArrayAdapter<String>(this,R.layout.attachment_list_item,data));
  ListView lv=getListView();
  lv.setTextFilterEnabled(true);
  lv.setOnItemClickListener(new OnItemClickListener(){
    public void onItemClick(    AdapterView<?> arg0,    View view,    int arg2,    long arg3){
      downloadAndOpenFile(((TextView)view).getText().toString());
    }
  }
);
}
 

Example 21

From project android-client_1, under directory /src/com/buddycloud/view/.

Source file: RosterActivity.java

  15 
vote

public void onItemClick(AdapterView<?> parent,View view,int position,long id){
  Log.d(TAG,"position: " + position);
  Log.d(TAG,"id: " + listAdapter.getItemId(position));
  Cursor cursor=(Cursor)listAdapter.getItem(position);
  Log.d(TAG,"item: " + cursor.getString(cursor.getColumnIndex(Roster.JID)));
  String channel=cursor.getString(cursor.getColumnIndex(Roster.JID));
  Intent openChannel=new Intent();
  openChannel.setClassName("com.buddycloud",ChannelMessageActivity.class.getCanonicalName());
  openChannel.setData(Uri.parse("channel:" + channel));
  startActivity(openChannel);
}
 

Example 22

From project android-client_2, under directory /src/org/mifos/androidclient/main/.

Source file: AccountRepaymentScheduleActivity.java

  15 
vote

@Override public void onItemClick(AdapterView<?> adapterView,View view,int pos,long id){
  RepaymentScheduleItem item=(RepaymentScheduleItem)adapterView.getAdapter().getItem(pos);
  Intent intent=new Intent().setClass(this,RepaymentScheduleActivity.class);
  intent.putExtra(RepaymentScheduleItem.BUNDLE_KEY,item);
  startActivity(intent);
}
 

Example 23

From project android-context, under directory /defunct/.

Source file: ContextBrowserActivity.java

  15 
vote

@Override public boolean onContextItemSelected(MenuItem item){
switch (item.getItemId()) {
case DELETE_ID:
    AdapterView.AdapterContextMenuInfo info=(AdapterView.AdapterContextMenuInfo)item.getMenuInfo();
  delete(info.id);
return true;
}
return (super.onOptionsItemSelected(item));
}
 

Example 24

From project Android-FFXIEQ, under directory /ffxieq/src/com/github/kanata3249/ffxieq/android/.

Source file: BlueMagicSetEditActivity.java

  15 
vote

@Override public void onStart(){
  super.onStart();
  FFXICharacter charInfo=getFFXICharacter();
{
    BlueMagicSetView ms;
    ms=(BlueMagicSetView)findViewById(R.id.Magics);
    if (ms != null) {
      ms.bindFFXICharacter(charInfo);
      ms.setOnItemClickListener(new OnItemClickListener(){
        public void onItemClick(        AdapterView<?> arg0,        View arg1,        int arg2,        long arg3){
        }
      }
);
      ms.setOnItemLongClickListener(new OnItemLongClickListener(){
        public boolean onItemLongClick(        AdapterView<?> arg0,        View arg1,        int arg2,        long arg3){
          mLongClickingItemPosition=arg2;
          openContextMenu(arg0);
          return true;
        }
      }
);
      registerForContextMenu(ms);
    }
  }
{
    BlueMagicSelectionStatusView bmss;
    bmss=(BlueMagicSelectionStatusView)findViewById(R.id.StatusView);
    if (bmss != null) {
      bmss.bindFFXICharacter(charInfo);
    }
  }
}
 

Example 25

From project Android-File-Manager-Tablet, under directory /src/com/nexes/manager/tablet/.

Source file: BluetoothActivity.java

  15 
vote

@Override public void onItemClick(AdapterView<?> list,View view,int pos,long id){
  final String name=mDeviceData.get(pos);
  String deviceName;
  if (name.equals("No Devices"))   return;
  mProgress=new ProgressDialog(BluetoothActivity.this);
  mProgress.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
  mProgress.setMessage("Sending...");
  deviceName=name.substring(0,name.lastIndexOf('\n'));
  if (mBluetoothAdapter.isDiscovering())   mBluetoothAdapter.cancelDiscovery();
  new AlertDialog.Builder(this).setTitle("Bluetooth Transfer").setMessage("Would you like to send this " + mFilePaths.length + " file(s) to "+ deviceName+ "?").setIcon(R.drawable.bluetooth).setPositiveButton("Yes",new DialogInterface.OnClickListener(){
    @Override public void onClick(    DialogInterface dialog,    int which){
      mProgress.show();
      new ClientSocketThread(name,handle).start();
    }
  }
).setNegativeButton("No",new DialogInterface.OnClickListener(){
    @Override public void onClick(    DialogInterface dialog,    int which){
      dialog.dismiss();
    }
  }
).create().show();
}
 

Example 26

From project android-flash-cards, under directory /src/org/thomasamsler/android/flashcards/fragment/.

Source file: ActionbarFragment.java

  15 
vote

private OnItemClickListener getCardFragmentActionListener(){
  return new OnItemClickListener(){
    public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      mListViewOverflow.setVisibility(View.GONE);
switch (position) {
case C_OVERFLOW_ACTION_ZOOM_IN:
        mMainApplication.doAction(ACTION_ZOOM_IN_CARD);
      break;
case C_OVERFLOW_ACTION_ZOOM_OUT:
    mMainApplication.doAction(ACTION_ZOOM_OUT_CARD);
  break;
case C_OVERFLOW_ACTION_CARD_INFO:
mMainApplication.doAction(ACTION_SHOW_CARD_INFO);
break;
case C_OVERFLOW_ACTION_DELETE_CARD:
mMainApplication.doAction(ACTION_DELETE_CARD);
break;
case C_OVERFLOW_ACTION_HELP_CARD:
mMainApplication.doAction(ACTION_SHOW_HELP);
break;
case C_OVERFLOW_ACTION_RESHUFFLE:
mMainApplication.doAction(ACTION_RESHUFFLE_CARDS);
break;
}
}
}
;
}
 

Example 27

From project Android-GifStitch, under directory /src/com/phunkosis/gifstitch/.

Source file: BrowseGifsActivity.java

  15 
vote

@Override public void onItemSelected(AdapterView<?> parent,View view,int position,long id){
  if (this.mSS.mPosition <= position) {
    this.mSwitcher.setInAnimation(this.mInLeftAnim);
    this.mSwitcher.setOutAnimation(this.mOutLeftAnim);
  }
 else {
    this.mSwitcher.setInAnimation(this.mInRightAnim);
    this.mSwitcher.setOutAnimation(this.mOutRightAnim);
  }
  if (this.mAdapter.getCount() <= 0)   this.finish();
 else   if (position > 0 && position >= this.mAdapter.getCount())   position=this.mAdapter.getCount() - 1;
  GifView nv=(GifView)this.mSwitcher.getNextView();
  nv.loadGif(this.mAdapter.getItemPath(position));
  this.mSS.mPosition=position;
  nv.setBackgroundColor(Color.TRANSPARENT);
  this.mSwitcher.showNext();
}
 

Example 28

From project android-joedayz, under directory /Proyectos/client/src/org/springframework/android/showcase/.

Source file: MainActivity.java

  15 
vote

@Override protected OnItemClickListener getMenuOnItemClickListener(){
  return new OnItemClickListener(){
    public void onItemClick(    AdapterView<?> parentView,    View childView,    int position,    long id){
      Class<?> cls=null;
switch (position) {
case 0:
        cls=HttpGetActivity.class;
      break;
case 1:
    cls=HttpPostActivity.class;
  break;
case 2:
cls=TwitterActivity.class;
break;
case 3:
cls=FacebookActivity.class;
break;
default :
break;
}
startActivity(new Intent(parentView.getContext(),cls));
}
}
;
}
 

Example 29

From project android-mapviewballoons, under directory /android-mapviewballoons-example/src/mapviewballoons/.

Source file: Main.java

  15 
vote

@Override public void onItemClick(AdapterView<?> parent,View view,int position,long id){
  Intent intent=null;
switch (position) {
case 0:
    intent=new Intent(this,SimpleMap.class);
  startActivity(intent);
break;
case 1:
intent=new Intent(this,CustomMap.class);
startActivity(intent);
break;
case 2:
intent=new Intent(this,TapControlledMap.class);
startActivity(intent);
break;
default :
break;
}
}
 

Example 30

From project android-rackspacecloud, under directory /src/com/rackspacecloud/android/.

Source file: AddAccountActivity.java

  15 
vote

private void loadProviderSpinner(){
  authServer="https://auth.api.rackspacecloud.com/v2.0";
  providerSpinner=(Spinner)findViewById(R.id.provider_spinner);
  ArrayAdapter<String> imageAdapter=new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item,PROVIDERS);
  imageAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  providerSpinner.setAdapter(imageAdapter);
  providerSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener(){
    public void onItemSelected(    AdapterView<?> parent,    View view,    int pos,    long id){
      if (pos == 0) {
        authServer=Preferences.COUNTRY_US_AUTH_SERVER_V2;
        customServer.setEnabled(false);
      }
 else       if (pos == 1) {
        authServer=Preferences.COUNTRY_UK_AUTH_SERVER_V2;
        customServer.setEnabled(false);
      }
 else {
        customServer.setEnabled(true);
      }
    }
    public void onNothingSelected(    AdapterView<?> parent){
    }
  }
);
}
 

Example 31

From project android-shuffle, under directory /client/src/org/dodgybits/shuffle/android/core/activity/.

Source file: HelpActivity.java

  15 
vote

@Override protected void onCreate(Bundle icicle){
  super.onCreate(icicle);
  setContentView(R.layout.help);
  ArrayAdapter<CharSequence> adapter=ArrayAdapter.createFromResource(this,R.array.help_screens,android.R.layout.simple_spinner_item);
  adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  mHelpSpinner.setAdapter(adapter);
  mHelpSpinner.setOnItemSelectedListener(new OnItemSelectedListener(){
    public void onNothingSelected(    AdapterView<?> arg0){
    }
    public void onItemSelected(    AdapterView<?> parent,    View v,    int position,    long id){
      int resId=HelpActivity.this.getResources().getIdentifier("help" + position,cStringType,cPackage);
      mHelpContent.setText(HelpActivity.this.getText(resId));
      updateNavigationButtons();
    }
  }
);
  mPrevious.setOnClickListener(new View.OnClickListener(){
    public void onClick(    View v){
      int position=mHelpSpinner.getSelectedItemPosition();
      mHelpSpinner.setSelection(position - 1);
    }
  }
);
  mNext.setOnClickListener(new View.OnClickListener(){
    public void onClick(    View v){
      int position=mHelpSpinner.getSelectedItemPosition();
      mHelpSpinner.setSelection(position + 1);
    }
  }
);
  setSelectionFromBundle(getIntent().getExtras());
}
 

Example 32

From project android-viewflow, under directory /viewflow-example/src/org/taptwo/android/widget/viewflow/example/.

Source file: ViewFlowExample.java

  15 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main);
  listView=(ListView)findViewById(R.id.menu);
  String[] listeStrings={"Circle indicator...","Title indicator...","Different Views...","Async Data Loading..."};
  listView.setAdapter(new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,listeStrings));
  listView.setOnItemClickListener(new OnItemClickListener(){
    @Override public void onItemClick(    AdapterView<?> adapterView,    View view,    int position,    long arg3){
switch (position) {
case 0:
        startActivity(new Intent(ViewFlowExample.this,CircleViewFlowExample.class));
      break;
case 1:
    startActivity(new Intent(ViewFlowExample.this,TitleViewFlowExample.class));
  break;
case 2:
startActivity(new Intent(ViewFlowExample.this,DiffViewFlowExample.class));
break;
case 3:
startActivity(new Intent(ViewFlowExample.this,AsyncDataFlowExample.class));
break;
}
}
}
);
}
 

Example 33

From project android-voip-service, under directory /src/main/java/org/linphone/.

Source file: AbstractContactPickerActivity.java

  15 
vote

protected void createCustomPicker(){
  mContactList=(ListView)findViewById(R.id.contactList);
  mcontactFilter=(EditText)findViewById(R.id.contactFilter);
  mcontactFilter.addTextChangedListener(new TextWatcher(){
    public void onTextChanged(    CharSequence s,    int start,    int b,    int c){
    }
    public void beforeTextChanged(    CharSequence s,    int st,    int c,    int a){
    }
    public void afterTextChanged(    Editable s){
      adapter.runQueryOnBackgroundThread(s);
      adapter.getFilter().filter(s.toString());
    }
  }
);
  String[] from=new String[]{col_display_name};
  int[] to=new int[]{android.R.id.text1};
  int layout=android.R.layout.simple_list_item_1;
  adapter=new SimpleCursorAdapter(this,layout,runQuery(null),from,to);
  adapter.setFilterQueryProvider(this);
  mContactList.setAdapter(adapter);
  mContactList.setOnItemClickListener(new OnItemClickListener(){
    public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      final CharSequence contactName=((TextView)view.findViewById(android.R.id.text1)).getText();
      choosePhoneNumberAndDial(contactName,String.valueOf(id));
    }
  }
);
}
 

Example 34

From project android-xbmcremote, under directory /src/org/xbmc/android/remote/presentation/controller/.

Source file: AlbumListController.java

  15 
vote

public void onCreate(Activity activity,Handler handler,AbsListView list){
  mMusicManager=ManagerFactory.getMusicManager(this);
  mControlManager=ManagerFactory.getControlManager(this);
  ((ISortableManager)mMusicManager).setSortKey(AbstractManager.PREF_SORT_KEY_ALBUM);
  ((ISortableManager)mMusicManager).setPreferences(activity.getPreferences(Context.MODE_PRIVATE));
  final String sdError=ImportUtilities.assertSdCard();
  mLoadCovers=sdError == null;
  if (!isCreated()) {
    super.onCreate(activity,handler,list);
    if (!mLoadCovers) {
      Toast toast=Toast.makeText(activity,sdError + " Displaying place holders only.",Toast.LENGTH_LONG);
      toast.show();
    }
    mArtist=(Artist)activity.getIntent().getSerializableExtra(ListController.EXTRA_ARTIST);
    mGenre=(Genre)activity.getIntent().getSerializableExtra(ListController.EXTRA_GENRE);
    activity.registerForContextMenu(mList);
    mFallbackBitmap=BitmapFactory.decodeResource(activity.getResources(),R.drawable.default_album);
    setupIdleListener();
    mList.setOnItemClickListener(new OnItemClickListener(){
      public void onItemClick(      AdapterView<?> parent,      View view,      int position,      long id){
        if (isLoading())         return;
        Intent nextActivity;
        final Album album=(Album)mList.getAdapter().getItem(((ThreeLabelsItemView)view).position);
        nextActivity=new Intent(view.getContext(),ListActivity.class);
        nextActivity.putExtra(ListController.EXTRA_LIST_CONTROLLER,new SongListController());
        nextActivity.putExtra(ListController.EXTRA_ALBUM,album);
        mActivity.startActivity(nextActivity);
      }
    }
);
    mList.setOnKeyListener(new ListControllerOnKeyListener<Album>());
    fetch();
  }
}
 

Example 35

From project android-xbmcremote-sandbox, under directory /src/org/xbmc/android/remotesandbox/ui/phone/.

Source file: DashboardFragment.java

  15 
vote

@Override public void onItemClick(AdapterView<?> listView,View v,int position,long ID){
  HomeItem item=(HomeItem)listView.getAdapter().getItem(position);
  final Intent intent=new Intent();
switch (item.ID) {
case HOME_ACTION_REMOTE:
case HOME_ACTION_MUSIC:
case HOME_ACTION_VIDEOS:
    intent.setClass(v.getContext(),MusicPagerActivity.class);
  break;
default :
return;
}
startActivity(intent);
}
 

Example 36

From project AndroidBillingLibrary, under directory /DungeonsRedux/src/net/robotmedia/billing/example/.

Source file: Dungeons.java

  15 
vote

private void setupWidgets(){
  mBuyButton=(Button)findViewById(R.id.buy_button);
  mBuyButton.setEnabled(false);
  mBuyButton.setOnClickListener(new OnClickListener(){
    public void onClick(    View v){
      if (mSelectedItem.managed != Managed.SUBSCRIPTION) {
        BillingController.requestPurchase(Dungeons.this,mSelectedItem.sku,true,null);
      }
 else {
        BillingController.requestSubscription(Dungeons.this,mSelectedItem.sku,true,null);
      }
    }
  }
);
  mSelectItemSpinner=(Spinner)findViewById(R.id.item_choices);
  mCatalogAdapter=new CatalogAdapter(this,CatalogEntry.CATALOG);
  mSelectItemSpinner.setAdapter(mCatalogAdapter);
  mSelectItemSpinner.setOnItemSelectedListener(new OnItemSelectedListener(){
    public void onItemSelected(    AdapterView<?> parent,    View view,    int position,    long id){
      mSelectedItem=CatalogEntry.CATALOG[position];
    }
    public void onNothingSelected(    AdapterView<?> arg0){
    }
  }
);
  mOwnedItemsTable=(ListView)findViewById(R.id.owned_items);
}
 

Example 37

From project AndroidDevWeekendDub-BookLibrary, under directory /src/org/curiouscreature/android/shelves/activity/.

Source file: ShelvesActivity.java

  15 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View v,ContextMenu.ContextMenuInfo menuInfo){
  super.onCreateContextMenu(menu,v,menuInfo);
  AdapterView.AdapterContextMenuInfo info=(AdapterView.AdapterContextMenuInfo)menuInfo;
  menu.setHeaderTitle(((TextView)info.targetView).getText());
  getMenuInflater().inflate(R.menu.book,menu);
}
 

Example 38

From project AndroidExamples, under directory /RSSExample/src/com/robertszkutak/androidexamples/rss/.

Source file: RSSExampleActivity.java

  15 
vote

public void onItemClick(AdapterView parent,View v,int position,long id){
  Intent itemintent=null;
  if (in) {
    itemintent=new Intent(this,StoryActivity.class);
    itemintent.putExtra("title",feed.getItem(position).getTitle());
    itemintent.putExtra("description",feed.getItem(position).getDescription());
    itemintent.putExtra("link",feed.getItem(position).getLink());
    itemintent.putExtra("pubdate",feed.getItem(position).getPubDate());
  }
 else   itemintent=new Intent(Intent.ACTION_VIEW,Uri.parse(feed.getItem(position).getLink().toString()));
  startActivity(itemintent);
}
 

Example 39

From project AndroidLab, under directory /samples/AndroidLdapClient/src/com/unboundid/android/ldap/client/.

Source file: EMailAddressOptions.java

  15 
vote

/** 
 * Takes any appropriate action after a list item was clicked.
 * @param parent    The list containing the item that was clicked.
 * @param item      The item that was clicked.
 * @param position  The position of the item that was clicked.
 * @param id        The ID of the item that was clicked.
 */
public void onItemClick(final AdapterView<?> parent,final View item,final int position,final long id){
  logEnter(LOG_TAG,"onItemClick",parent,item,position,id);
switch (position) {
case 0:
    doEMail();
  break;
case 1:
doCopy();
break;
default :
break;
}
finish();
}
 

Example 40

From project androidTileMapEditor_1, under directory /src/it/sineo/android/tileMapEditor/.

Source file: HomeActivity.java

  15 
vote

@Override public void onItemClick(AdapterView<?> parent,View view,int position,long id){
  Intent tiledMapActivity=new Intent(HomeActivity.this,TiledMapActivity.class);
  Cursor cur=(Cursor)parent.getAdapter().getItem(position);
  long mapid=cur.getLong(0);
  String json=cur.getString(2);
  tiledMapActivity.putExtra(C.EXTRA_MAP_JSON,json);
  tiledMapActivity.putExtra(C.EXTRA_MAP_ID,mapid);
  startActivityForResult(tiledMapActivity,C.REQ_CODE_EDIT_MAP);
}
 

Example 41

From project androidtracks, under directory /src/org/sfcta/cycletracks/.

Source file: MainInput.java

  15 
vote

void populateList(ListView lv){
  DbAdapter mDb=new DbAdapter(MainInput.this);
  mDb.open();
  int cleanedTrips=mDb.cleanTables();
  if (cleanedTrips > 0) {
    Toast.makeText(getBaseContext(),"" + cleanedTrips + " bad trip(s) removed.",Toast.LENGTH_SHORT).show();
  }
  try {
    Cursor allTrips=mDb.fetchAllTrips();
    SimpleCursorAdapter sca=new SimpleCursorAdapter(this,R.layout.twolinelist,allTrips,new String[]{"purp","fancystart","fancyinfo"},new int[]{R.id.TextView01,R.id.TextView03,R.id.TextInfo});
    lv.setAdapter(sca);
    TextView counter=(TextView)findViewById(R.id.TextViewPreviousTrips);
    int numtrips=allTrips.getCount();
switch (numtrips) {
case 0:
      counter.setText("No saved trips.");
    break;
case 1:
  counter.setText("1 saved trip:");
break;
default :
counter.setText("" + numtrips + " saved trips:");
}
}
 catch (SQLException sqle) {
}
mDb.close();
lv.setOnItemClickListener(new AdapterView.OnItemClickListener(){
public void onItemClick(AdapterView<?> parent,View v,int pos,long id){
Intent i=new Intent(MainInput.this,ShowMap.class);
i.putExtra("showtrip",id);
startActivity(i);
}
}
);
registerForContextMenu(lv);
}
 

Example 42

From project androidZenWriter, under directory /library/src/com/actionbarsherlock/internal/widget/.

Source file: IcsSpinner.java

  15 
vote

public DropdownPopup(Context context,AttributeSet attrs,int defStyleRes){
  super(context,attrs,0,defStyleRes);
  setAnchorView(IcsSpinner.this);
  setModal(true);
  setPromptPosition(POSITION_PROMPT_ABOVE);
  setOnItemClickListener(new OnItemClickListener(){
    @SuppressWarnings("rawtypes") public void onItemClick(    AdapterView parent,    View v,    int position,    long id){
      IcsSpinner.this.setSelection(position);
      dismiss();
    }
  }
);
}
 

Example 43

From project Android_1, under directory /CarouselFragment/src/novoda/demo/.

Source file: Carousel.java

  15 
vote

@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  super.onCreateView(inflater,container,savedInstanceState);
  Gallery gallery=(Gallery)inflater.inflate(R.layout.carousel_gallery,null);
  gallery.setAdapter(new GalleryAdapter(mContext));
  gallery.setOnItemClickListener(new OnItemClickListener(){
    public void onItemClick(    AdapterView<?> l,    View v,    int position,    long id){
      count=position;
      ((Carousel)mContext).setSelectedId(id);
      FragmentTransaction ft=getFragmentManager().beginTransaction();
      ft.hide(fragment);
      ft.commit();
    }
  }
);
  gallery.requestFocus();
  gallery.setSelection(mCurCheckPosition);
  return gallery;
}
 

Example 44

From project android_7, under directory /src/org/immopoly/android/dialog/.

Source file: HighScoreDialog.java

  15 
vote

@Override public void onItemSelected(AdapterView<?> parent,View view,int position,long id){
  if (position == selection)   return;
  mTracker.stopSession();
  loadURL(URLS[position]);
  selection=position;
}
 

Example 45

From project android_aosp_packages_apps_Settings, under directory /src/com/android/settings/applications/.

Source file: RunningProcessesView.java

  15 
vote

public void onItemClick(AdapterView<?> parent,View v,int position,long id){
  ListView l=(ListView)parent;
  RunningState.MergedItem mi=(RunningState.MergedItem)l.getAdapter().getItem(position);
  mCurSelected=mi;
  Intent intent=new Intent();
  intent.putExtra(RunningServiceDetails.KEY_UID,mi.mProcess.mUid);
  intent.putExtra(RunningServiceDetails.KEY_PROCESS,mi.mProcess.mProcessName);
  intent.putExtra(RunningServiceDetails.KEY_BACKGROUND,mAdapter.mShowBackground);
  intent.setClass(getContext(),RunningServiceDetails.class);
  getContext().startActivity(intent);
}
 

Example 46

From project Android_NFC_FelicaEdit, under directory /src/jp/co/yumemi/rd/felicaedit/.

Source file: EditBlock.java

  15 
vote

/** 
 * BlockData????????yte??????????????????????????????ap?????
 */
@Override public void onItemClick(AdapterView<?> l,View v,int position,long id){
  if (blockData == null)   return;
  byte data=blockData[position];
  Bundle bundle=new Bundle();
  bundle.putByte(BYTE_DATA,data);
  bytePosition=position;
  showDialog(BYTE_DIALOG,bundle);
}
 

Example 47

From project android_packages_apps_cmparts, under directory /src/com/cyanogenmod/cmparts/activities/.

Source file: GestureListActivity.java

  15 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View v,ContextMenu.ContextMenuInfo menuInfo){
  super.onCreateContextMenu(menu,v,menuInfo);
  AdapterView.AdapterContextMenuInfo info=(AdapterView.AdapterContextMenuInfo)menuInfo;
  menu.setHeaderTitle(((TextView)info.targetView).getText());
  menu.add(0,MENU_ID_REMOVE,0,R.string.gestures_delete);
}
 

Example 48

From project android_packages_apps_CMSettings, under directory /src/com/cyanogenmod/settings/widgets/.

Source file: TouchInterceptor.java

  15 
vote

@Override public boolean onInterceptTouchEvent(MotionEvent ev){
  if (mDragListener != null || mDropListener != null) {
switch (ev.getAction()) {
case MotionEvent.ACTION_DOWN:
      int x=(int)ev.getX();
    int y=(int)ev.getY();
  int itemnum=pointToPosition(x,y);
if (itemnum == AdapterView.INVALID_POSITION) {
  break;
}
ViewGroup item=(ViewGroup)getChildAt(itemnum - getFirstVisiblePosition());
mDragPoint=y - item.getTop();
mCoordOffset=((int)ev.getRawY()) - y;
View dragger=item.findViewById(R.id.grabber);
Rect r=mTempRect;
dragger.getDrawingRect(r);
if (x < r.right * 2) {
item.setDrawingCacheEnabled(true);
Bitmap bitmap=Bitmap.createBitmap(item.getDrawingCache());
startDragging(bitmap,y);
mDragPos=itemnum;
mFirstDragPos=mDragPos;
mHeight=getHeight();
int touchSlop=mTouchSlop;
mUpperBound=Math.min(y - touchSlop,mHeight / 3);
mLowerBound=Math.max(y + touchSlop,mHeight * 2 / 3);
return false;
}
stopDragging();
break;
}
}
return super.onInterceptTouchEvent(ev);
}
 

Example 49

From project android_packages_apps_FileManager, under directory /src/org/openintents/distribution/.

Source file: InfoActivity.java

  15 
vote

public void onItemClick(AdapterView<?> parent,View view,int pos,long id){
  if (VersionUtils.isPackageAvailable(this,mPackageNames[pos],mMinVersionCodes[pos])) {
    showDialog(DIALOG_INFO + pos);
  }
 else {
    showDialog(DIALOG_GET_FROM_MARKET + pos);
  }
}
 

Example 50

From project android_packages_apps_Gallery, under directory /src/com/android/camera/.

Source file: GalleryPicker.java

  15 
vote

@Override public void onCreate(Bundle icicle){
  super.onCreate(icicle);
  setContentView(R.layout.gallerypicker);
  mGridView=(GridView)findViewById(R.id.albums);
  mGridView.setOnItemClickListener(new AdapterView.OnItemClickListener(){
    public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      launchFolderGallery(position);
    }
  }
);
  mGridView.setOnCreateContextMenuListener(new View.OnCreateContextMenuListener(){
    public void onCreateContextMenu(    ContextMenu menu,    View v,    final ContextMenuInfo menuInfo){
      onCreateGalleryPickerContextMenu(menu,menuInfo);
    }
  }
);
  mReceiver=new BroadcastReceiver(){
    @Override public void onReceive(    Context context,    Intent intent){
      onReceiveMediaBroadcast(intent);
    }
  }
;
  mDbObserver=new ContentObserver(mHandler){
    @Override public void onChange(    boolean selfChange){
      rebake(false,ImageManager.isMediaScannerScanning(getContentResolver()));
    }
  }
;
  ImageManager.ensureOSXCompatibleFolder();
}
 

Example 51

From project android_packages_apps_phone, under directory /src/com/android/phone/.

Source file: SimContacts.java

  15 
vote

@Override public boolean onContextItemSelected(MenuItem item){
switch (item.getItemId()) {
case MENU_IMPORT_ONE:
    ContextMenu.ContextMenuInfo menuInfo=item.getMenuInfo();
  if (menuInfo instanceof AdapterView.AdapterContextMenuInfo) {
    int position=((AdapterView.AdapterContextMenuInfo)menuInfo).position;
    importOneSimContact(position);
    return true;
  }
}
return super.onContextItemSelected(item);
}
 

Example 52

From project android_packages_apps_SalvageParts, under directory /src/com/salvagemod/salvageparts/widgets/.

Source file: TouchInterceptor.java

  15 
vote

@Override public boolean onInterceptTouchEvent(MotionEvent ev){
  if (mDragListener != null || mDropListener != null) {
switch (ev.getAction()) {
case MotionEvent.ACTION_DOWN:
      int x=(int)ev.getX();
    int y=(int)ev.getY();
  int itemnum=pointToPosition(x,y);
if (itemnum == AdapterView.INVALID_POSITION) {
  break;
}
ViewGroup item=(ViewGroup)getChildAt(itemnum - getFirstVisiblePosition());
mDragPoint=y - item.getTop();
mCoordOffset=((int)ev.getRawY()) - y;
View dragger=item.findViewById(R.id.grabber);
Rect r=mTempRect;
dragger.getDrawingRect(r);
if (x < r.right * 2) {
item.setDrawingCacheEnabled(true);
Bitmap bitmap=Bitmap.createBitmap(item.getDrawingCache());
startDragging(bitmap,y);
mDragPos=itemnum;
mFirstDragPos=mDragPos;
mHeight=getHeight();
int touchSlop=mTouchSlop;
mUpperBound=Math.min(y - touchSlop,mHeight / 3);
mLowerBound=Math.max(y + touchSlop,mHeight * 2 / 3);
return false;
}
stopDragging();
break;
}
}
return super.onInterceptTouchEvent(ev);
}
 

Example 53

From project android_packages_apps_Tag, under directory /src/com/android/apps/tag/.

Source file: MyTagList.java

  15 
vote

@Override public boolean onContextItemSelected(MenuItem item){
  long id=mTagIdLongPressed;
switch (item.getItemId()) {
case R.id.delete:
    deleteTag(id);
  return true;
case R.id.set_as_active:
Cursor cursor=mAdapter.getCursor();
if (cursor == null || cursor.isClosed()) {
break;
}
for (int position=0; cursor.moveToPosition(position); position++) {
if (cursor.getLong(TagQuery.COLUMN_ID) == id) {
selectActiveTag(position);
return true;
}
}
break;
case R.id.edit:
editTag(id);
return true;
case 1:
AdapterView.AdapterContextMenuInfo info;
try {
info=(AdapterView.AdapterContextMenuInfo)item.getMenuInfo();
}
 catch (ClassCastException e) {
Log.e(TAG,"bad menuInfo",e);
break;
}
Intent intent=new Intent(this,WriteTagActivity.class);
intent.putExtra("id",info.id);
startActivity(intent);
return true;
}
return false;
}
 

Example 54

From project androvoip, under directory /src/org/androvoip/ui/.

Source file: Accounts.java

  15 
vote

public void onItemClick(AdapterView<?> parent,View view,int position,long id){
  Account account=(Account)parent.getItemAtPosition(position);
  Intent intent=new Intent(this,Settings.class);
  intent.putExtra("account",account);
  startActivity(intent);
}
 

Example 55

From project andstatus, under directory /src/org/andstatus/app/account/.

Source file: AccountSelector.java

  15 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  MyPreferences.loadTheme(TAG,this);
  setContentView(R.layout.accountlist);
  ArrayList<Map<String,String>> data=new ArrayList<Map<String,String>>();
  for (int ind=0; ind < MyAccount.list().length; ind++) {
    HashMap<String,String> map=new HashMap<String,String>();
    map.put(KEY_NAME,MyAccount.list()[ind].getAccountGuid());
    map.put(KEY_TYPE,TYPE_ACCOUNT);
    data.add(map);
  }
  ListAdapter adapter=new SimpleAdapter(this,data,R.layout.accountlist_item,new String[]{KEY_NAME,KEY_TYPE},new int[]{R.id.name,R.id.type});
  setListAdapter(adapter);
  getListView().setOnItemClickListener(new OnItemClickListener(){
    public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      String accountName=((TextView)view.findViewById(R.id.name)).getText().toString();
      MyAccount ma=MyAccount.getMyAccount(accountName);
      if (ma.isPersistent()) {
        ma.setCurrentMyAccount();
        AccountSelector.this.setResult(RESULT_OK);
        finish();
      }
    }
  }
);
}
 

Example 56

From project andtweet, under directory /src/com/xorcode/andtweet/.

Source file: MessageListActivity.java

  15 
vote

@Override public boolean onContextItemSelected(MenuItem item){
  super.onContextItemSelected(item);
  AdapterView.AdapterContextMenuInfo info;
  try {
    info=(AdapterView.AdapterContextMenuInfo)item.getMenuInfo();
  }
 catch (  ClassCastException e) {
    Log.e(TAG,"bad menuInfo",e);
    return false;
  }
switch (item.getItemId()) {
case CONTEXT_MENU_ITEM_REPLY:
    Uri uri=ContentUris.withAppendedId(AndTweetDatabase.DirectMessages.CONTENT_URI,info.id);
  Cursor c=getContentResolver().query(uri,new String[]{AndTweetDatabase.DirectMessages._ID,AndTweetDatabase.DirectMessages.AUTHOR_ID},null,null,null);
try {
  c.moveToFirst();
}
 catch (Exception e) {
  Log.e(TAG,"onContextItemSelected: " + e.toString());
}
 finally {
  if (c != null && !c.isClosed())   c.close();
}
return true;
case CONTEXT_MENU_ITEM_STAR:
case CONTEXT_MENU_ITEM_RETWEET:
case CONTEXT_MENU_ITEM_UNFOLLOW:
case CONTEXT_MENU_ITEM_BLOCK:
case CONTEXT_MENU_ITEM_DIRECT_MESSAGE:
case CONTEXT_MENU_ITEM_PROFILE:
Toast.makeText(this,R.string.unimplemented,Toast.LENGTH_SHORT).show();
return true;
}
return false;
}
 

Example 57

From project Anki-Android, under directory /src/com/ichi2/anki/.

Source file: PersonalDeckPicker.java

  15 
vote

/** 
 * Lifecycle methods 
 */
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.download_deck_picker);
  initDownloadManagerService();
  registerExternalStorageListener();
  initDialogs();
  mPersonalDeckDownloads=new ArrayList<Download>();
  mPersonalDecks=new ArrayList<String>();
  mAllPersonalDecks=new ArrayList<Object>();
  mPersonalDecksAdapter=new PersonalDecksAdapter();
  mPersonalDecksListView=(ListView)findViewById(R.id.list);
  mPersonalDecksListView.setAdapter(mPersonalDecksAdapter);
  mPersonalDecksListView.setOnItemClickListener(new OnItemClickListener(){
    @Override public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      String deckName=(String)mAllPersonalDecks.get(position);
      Download personalDeckDownload=new Download(deckName);
      mPersonalDeckDownloads.add(personalDeckDownload);
      refreshPersonalDecksList();
      try {
        startService(mDownloadManagerServiceIntent);
        mDownloadManagerService.downloadFile(personalDeckDownload);
      }
 catch (      RemoteException e) {
        Log.e(AnkiDroidApp.TAG,"RemoteException = " + e.getMessage());
        e.printStackTrace();
      }
    }
  }
);
  getPersonalDecks();
}
 

Example 58

From project AnySoftKeyboard, under directory /src/com/anysoftkeyboard/ui/settings/.

Source file: UserDictionaryEditorActivity.java

  15 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.user_dictionary_editor);
  mLangs=(Spinner)findViewById(R.id.user_dictionay_langs);
  mLangs.setOnItemSelectedListener(new OnItemSelectedListener(){
    public void onItemSelected(    AdapterView<?> arg0,    View arg1,    int arg2,    long arg3){
      mSelectedLocale=arg0.getItemAtPosition(arg2).toString();
      fillWordsList();
    }
    public void onNothingSelected(    AdapterView<?> arg0){
      Log.d(TAG,"No locale selected");
      mSelectedLocale=null;
    }
  }
);
  findViewById(R.id.add_user_word).setOnClickListener(new OnClickListener(){
    public void onClick(    View v){
      showAddOrEditDialog(null);
    }
  }
);
  findViewById(R.id.backup_words).setOnClickListener(new OnClickListener(){
    public void onClick(    View v){
      new BackupUserWordsAsyncTask(UserDictionaryEditorActivity.this).execute();
    }
  }
);
  findViewById(R.id.restore_words).setOnClickListener(new OnClickListener(){
    public void onClick(    View v){
      new RestoreUserWordsAsyncTask(UserDictionaryEditorActivity.this).execute();
    }
  }
);
  TextView emptyView=(TextView)findViewById(R.id.empty_user_dictionary);
  ListView listView=getListView();
  listView.setFastScrollEnabled(true);
  listView.setEmptyView(emptyView);
}
 

Example 59

From project apg, under directory /src/org/thialfihar/android/apg/.

Source file: MainActivity.java

  15 
vote

@Override public boolean onContextItemSelected(MenuItem menuItem){
  AdapterView.AdapterContextMenuInfo info=(AdapterView.AdapterContextMenuInfo)menuItem.getMenuInfo();
switch (menuItem.getItemId()) {
case Id.menu.delete:
{
      Apg.getDatabase().db().delete(Accounts.TABLE_NAME,Accounts._ID + " = ?",new String[]{"" + info.id});
      mAccountCursor.requery();
      mListAdapter.notifyDataSetChanged();
      return true;
    }
default :
{
    return super.onContextItemSelected(menuItem);
  }
}
}
 

Example 60

From project apps-for-android, under directory /BTClickLinkCompete/src/net/clc/bt/.

Source file: ServerListActivity.java

  15 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  self=this;
  arrayAdapter=new ArrayAdapter<String>(self,R.layout.text);
  ListView lv=self.getListView();
  lv.setAdapter(arrayAdapter);
  lv.setOnItemClickListener(new OnItemClickListener(){
    public void onItemClick(    AdapterView<?> arg0,    View arg1,    int arg2,    long arg3){
      myBt.cancelDiscovery();
      String btDeviceInfo=((TextView)arg1).getText().toString();
      String btHardwareAddress=btDeviceInfo.substring(btDeviceInfo.length() - 17);
      Intent i=new Intent();
      i.putExtra(EXTRA_SELECTED_ADDRESS,btHardwareAddress);
      self.setResult(Activity.RESULT_OK,i);
      finish();
    }
  }
);
  myBt=BluetoothAdapter.getDefaultAdapter();
  myBt.startDiscovery();
  self.setResult(Activity.RESULT_CANCELED);
}