Java Code Examples for android.widget.AdapterView

The following are top voted examples for showing how to use android.widget.AdapterView. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: YiZhi   File: FriendListPage.java   View source code 6 votes vote down vote up
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
	if ("FacebookMessenger".equals(platform.getName())) {
		if(lastPosition >= 0) {
			Following lastFollwing = adapter.getItem(lastPosition);
			lastFollwing.checked = false;
		}
		lastPosition = position;
	}
	Following following = adapter.getItem(position);
	following.checked = !following.checked;

	if(following.checked) {
		checkNum++;
	} else {
		checkNum--;
	}

	updateConfirmView();
	adapter.notifyDataSetChanged();
}
 
Example 2
Project: PeSanKita-android   File: DeviceListFragment.java   View source code 6 votes vote down vote up
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
  final String deviceName = ((DeviceListItem)view).getDeviceName();
  final long   deviceId   = ((DeviceListItem)view).getDeviceId();

  AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
  builder.setTitle(getActivity().getString(R.string.DeviceListActivity_unlink_s, deviceName));
  builder.setMessage(R.string.DeviceListActivity_by_unlinking_this_device_it_will_no_longer_be_able_to_send_or_receive);
  builder.setNegativeButton(android.R.string.cancel, null);
  builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
    @Override
    public void onClick(DialogInterface dialog, int which) {
      handleDisconnectDevice(deviceId);
    }
  });
  builder.show();
}
 
Example 3
Project: time-weather   File: ChooseAreaFragment.java   View source code 6 votes vote down vote up
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    if (currentLevel == LEVEL_PROVINCE) {
        selectedProvince = provinceList.get(position);
        queryCities();
    }
    else if (currentLevel == LEVEL_CITY) {
        selectedCity = cityList.get(position);
        queryCounties();
    }
    else if (currentLevel == LEVEL_COUNTY) {
        String weatherID = countyList.get(position).getWeatherID();
        Intent intent = new Intent(getActivity(), WeatherActivity.class);

        intent.putExtra("weather_id", weatherID);
        startActivity(intent);
        getActivity().finish();
    }
}
 
Example 4
Project: Toodoo   File: ToodooNote.java   View source code 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    this.setContentView(R.layout.label_dialog);
    labelList = (ListView) findViewById(R.id.label_list);
    cancel = (Button) findViewById(R.id.cancel);
    // ListView
    SimpleAdapter adapter = new SimpleAdapter(context, getLabelList(),
            R.layout.label_list_item, new String[]{"label_img",
            "label_value"}, new int[]{
            R.id.label_img, R.id.label_value});
    labelList.setAdapter(adapter);
    //ListView
    labelList
            .setOnItemClickListener(new AdapterView.OnItemClickListener() {
                @Override
                public void onItemClick(AdapterView<?> arg0, View arg1,
                                        int position, long arg3) {
                    HashMap<String, Object> label = getLabelList().get(position);
                    selectedLabel = (String) label.get("label_value");

                    ToodooOptionsModel ToodooOptionsModel = toodooOptionsList.get(0);
                    ToodooOptionsModel.setOptionValue(selectedLabel);
                    mAdapter.notifyDataSetChanged();
                    labelDialog.dismiss();
                }
            });

    cancel.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            labelDialog.dismiss();
        }
    });
}
 
Example 5
Project: MultipleRvView   File: MainActivity.java   View source code 6 votes vote down vote up
private void lvClick() {

        lv_main.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {

                switch (i) {
                    case 0:
                        startOtherActivity(LinearLayoutActivity.class);
                        break;
                    case 1:
                        startOtherActivity(GridActivity.class);
                        break;
                    case 2:
                        startOtherActivity(FlowLayoutActivity.class);
                        break;



                }
            }
        });
    }
 
Example 6
Project: cniao5   File: FriendListPage.java   View source code 6 votes vote down vote up
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
	if ("FacebookMessenger".equals(platform.getName())) {
		if(lastPosition >= 0) {
			Following lastFollwing = adapter.getItem(lastPosition);
			lastFollwing.checked = false;
		}
		lastPosition = position;
	}
	Following following = adapter.getItem(position);
	following.checked = !following.checked;

	if(following.checked) {
		checkNum++;
	} else {
		checkNum--;
	}

	updateConfirmView();
	adapter.notifyDataSetChanged();
}
 
Example 7
Project: CCDownload   File: UploadFragment.java   View source code 6 votes vote down vote up
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
	UploadView uploadView = (UploadView)view;
	String uploadId = uploadView.getUploadId();
	if (binder.isStop()) {
		UploadInfo uploadInfo = DataSet.getUploadInfo(uploadId);
		if (uploadInfo != null && uploadInfo.getStatus() != Uploader.FINISH) {
			startUploadService(uploadInfo);
		}
		
		currentUploadId = uploadId;
		
	} else if (uploadId.equals(currentUploadId)) {
		
		switch (binder.getUploaderStatus()) {
		case Uploader.UPLOAD:
			binder.pause();
			break;
		case Uploader.PAUSE:
			binder.upload();
			break;
		}
	}
}
 
Example 8
Project: dex-hdog   File: MainActivity.java   View source code 6 votes vote down vote up
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    ListView listView = (ListView) parent;
    AppInfo appInfo = (AppInfo) listView.getItemAtPosition(position);
    String packageName = appInfo.getPackageName();
    String appName = appInfo.getAppName();
    Log.d(TAG, packageName);
    if(!JniUtil.isRunning(packageName)){
        openApp(packageName);
    }

    Log.d(TAG, "Create folder:" + FileUtil.createPath(HDOG_PATH +File.separator + packageName + File.separator + TYPE_DEX));
    Log.d(TAG, "Create folder:" + FileUtil.createPath(HDOG_PATH +File.separator + packageName + File.separator + TYPE_DEY));

    Intent intent = new Intent(this, DumpActivity.class);
    intent.putExtra("package_name", packageName);
    intent.putExtra("app_name", appName);
    startActivity(intent);
}
 
Example 9
Project: SciChart.Android.Examples   File: HomeActivity.java   View source code 6 votes vote down vote up
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
    if (module == null) return;
    final List<Example> examples = module.getExamples();
    final String category = getCategoryByPosition(selectedPosition);
    final List<Example> exampleItems = convertToAdapterItems(examples, category);
    switch (position) {
        case 0:
            adapter.setSortStrategy(new SortByCategory(exampleItems));
            break;
        case 1:
            adapter.setSortStrategy(new SortByFeatures(exampleItems));
            break;
        case 2:
            adapter.setSortStrategy(new SortByName(exampleItems));
            break;
        case 3:
            adapter.setSortStrategy(new SortByMostUsed(exampleItems));
            break;
    }
}
 
Example 10
Project: sctalk   File: ChatFragment.java   View source code 6 votes vote down vote up
@Override
public boolean onItemLongClick(AdapterView<?> parent, View view,
        int position, long id) {

    RecentInfo recentInfo = contactAdapter.getItem(position);
    if (recentInfo == null) {
        logger.e("recent#onItemLongClick null recentInfo -> position:%d", position);
        return false;
    }
    if (recentInfo.getSessionType() == DBConstant.SESSION_TYPE_SINGLE) {
        handleContactItemLongClick(getActivity(),recentInfo);
    } else {
        handleGroupItemLongClick(getActivity(),recentInfo);
    }
    return true;
}
 
Example 11
Project: lqrwechatrongcloud   File: FriendListPage.java   View source code 6 votes vote down vote up
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
	if ("FacebookMessenger".equals(platform.getName())) {
		if(lastPosition >= 0) {
			Following lastFollwing = adapter.getItem(lastPosition);
			lastFollwing.checked = false;
		}
		lastPosition = position;
	}
	Following following = adapter.getItem(position);
	following.checked = !following.checked;

	if(following.checked) {
		checkNum++;
	} else {
		checkNum--;
	}

	updateConfirmView();
	adapter.notifyDataSetChanged();
}
 
Example 12
Project: buildAPKsSamples   File: DeviceListActivity.java   View source code 6 votes vote down vote up
public void onItemClick(AdapterView<?> av, View v, int arg2, long arg3) {
    // Cancel discovery because it's costly and we're about to connect
    mBtAdapter.cancelDiscovery();

    // Get the device MAC address, which is the last 17 chars in the View
    String info = ((TextView) v).getText().toString();
    String address = info.substring(info.length() - 17);

    // Create the result Intent and include the MAC address
    Intent intent = new Intent();
    intent.putExtra(EXTRA_DEVICE_ADDRESS, address);

    // Set result and finish this Activity
    setResult(Activity.RESULT_OK, intent);
    finish();
}
 
Example 13
Project: GitHub   File: MainActivity.java   View source code 6 votes vote down vote up
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    switch (position){
        case 1:
            startActivity(new Intent(this, BannerAnimationActivity.class));
            break;
        case 2:
            startActivity(new Intent(this, BannerStyleActivity.class));
            break;
        case 3:
            startActivity(new Intent(this, IndicatorPositionActivity.class));
            break;
        case 4:
            startActivity(new Intent(this, CustomBannerActivity.class));
            break;
        case 5:
            startActivity(new Intent(this, BannerLocalActivity.class));
            break;
        case 6:
            startActivity(new Intent(this, CustomViewPagerActivity.class));
            break;
    }
}
 
Example 14
Project: buildAPKsApps   File: MediaPicker.java   View source code 6 votes vote down vote up
private View newList(
    final PickerQuery q, final ViewAnimator flip,
    AdapterView.OnItemClickListener click) {
  final View list = newList(q, click);
  list.setOnKeyListener(new View.OnKeyListener() {
      @Override
      public boolean onKey(View v, int keyCode, KeyEvent event) {
        if (keyCode == KeyEvent.KEYCODE_BACK &&
            event.getAction() == KeyEvent.ACTION_UP) {
          flip.setInAnimation(getContext(), R.anim.slide_in_left);
          flip.setOutAnimation(getContext(), R.anim.slide_out_right);
          flip.showPrevious();
          flip.removeView(list);
          flip.setInAnimation(getContext(), R.anim.slide_in_right);
          flip.setOutAnimation(getContext(), R.anim.slide_out_left);
          return true;
        }
        return false;
      }
    });
  return list;
}
 
Example 15
Project: Shared-Route   File: TaskViewActivity.java   View source code 6 votes vote down vote up
@Override
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
    listItemList = trollyAdapter.getItems();
    FlipShareView shareBottom = new FlipShareView.Builder(this, mToolbar)
            .addItem(new ShareItem("发布者::"+listItemList.get(position).PublisherName, Color.WHITE, 0xff43549C))
            .addItem(new ShareItem("联系方式:"+listItemList.get(position).PublisherName, Color.WHITE, 0xff43549C))
            .addItem(new ShareItem("物品类型:"+listItemList.get(position).TaskKindID, Color.WHITE, 0xff43549C))
            .addItem(new ShareItem("物品描述:"+listItemList.get(position).Remark, Color.WHITE, 0xff4999F0))
            .addItem(new ShareItem("取件时间:"+listItemList.get(position).FetchTime, Color.WHITE, 0xffD9392D))
            .addItem(new ShareItem("取件地点:"+listItemList.get(position).FetchLocation, Color.WHITE, 0xff57708A))
            .addItem(new ShareItem("送件时间:"+listItemList.get(position).SendTime, Color.WHITE, 0xffea0bb2))
            .addItem(new ShareItem("送件地点:"+listItemList.get(position).SendLocation, Color.WHITE, 0xffea650b))
            .addItem(new ShareItem("订单价格:"+listItemList.get(position).Money, Color.WHITE,0xff063e04))
            .setItemDuration(200)
            .setBackgroundColor(0x60000000)
            .setAnimType(FlipShareView.TYPE_SLIDE)
            .create();
    return true;
}
 
Example 16
Project: CXJPadProject   File: VoucherFragment.java   View source code 6 votes vote down vote up
public void initListPop() {
    listPopupWindow = new ListPopupWindow(getContext());
    ListPopAdapter listPopAdapter = new ListPopAdapter(getContext(), valueList);
    listPopupWindow.setAdapter(listPopAdapter);
    listPopupWindow.setWidth(RelativeLayout.LayoutParams.WRAP_CONTENT);
    listPopupWindow.setHeight(RelativeLayout.LayoutParams.WRAP_CONTENT);
    listPopupWindow.setAnchorView(tv_select_coupons);
    listPopupWindow.setModal(true);
    listPopupWindow.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            tv_select_coupons.setText(valueList.get(position));
            mKey = cardTemplateList.get(position).key;
            listPopupWindow.dismiss();
        }
    });
}
 
Example 17
Project: couch-potatoes   File: PictureGridActivity.java   View source code 6 votes vote down vote up
private void addChangeProfilePicListener( final DBHelper dbHelper, final String uid ) {
    gridView.setOnItemClickListener(new OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            pos = position;

            new AlertDialog.Builder(PictureGridActivity.this)
                    .setTitle("Use as profile picture?")
                    .setIcon(android.R.drawable.ic_dialog_alert)
                    .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int whichButton) {
                            StorageReference storageRef = dbHelper.getStorage().getReference("Photo/" + uid + "/" + hashList.get(pos));
                            storageRef.getDownloadUrl().addOnSuccessListener(new OnSuccessListener<Uri>() {
                                @Override
                                public void onSuccess(Uri downloadUrl) {
                                    dbHelper.getDb().getReference(dbHelper.getUserPath()).child(uid).child("profile_pic").setValue(downloadUrl.toString());
                                    finish();
                                }
                            });
                        }
                    })
                    .setNegativeButton(android.R.string.no, null).show();
        }
    });
}
 
Example 18
Project: GitHub   File: DropboxStyleActivity.java   View source code 6 votes vote down vote up
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    switch (Item.values()[position]) {
        case 默认主题:
            setThemeColor(R.color.colorPrimary, R.color.colorPrimaryDark);
            mRefreshLayout.setPrimaryColors(0xff283645, 0xff6ea9ff);
            break;
        case 蓝色主题:
            setThemeColor(R.color.colorPrimary, R.color.colorPrimaryDark);
            break;
        case 绿色主题:
            setThemeColor(android.R.color.holo_green_light, android.R.color.holo_green_dark);
            break;
        case 红色主题:
            setThemeColor(android.R.color.holo_red_light, android.R.color.holo_red_dark);
            break;
        case 橙色主题:
            setThemeColor(android.R.color.holo_orange_light, android.R.color.holo_orange_dark);
            break;
    }
    mRefreshLayout.autoRefresh();
}
 
Example 19
Project: GitHub   File: DemoActivity.java   View source code 6 votes vote down vote up
@Override
public void initEvent() {//必须在onCreate方法内调用
	//示例代码<<<<<<<<<<<<<<<<<<<

	lvDemo.setOnItemClickListener(new OnItemClickListener() {
		@Override
		public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
			setResult(RESULT_OK, new Intent().putExtra(RESULT_CLICKED_ITEM, position));
			finish();
		}
	});

	//分页滚动示例代码<<<<<<<<<<<<<<<<<<<
	new PageScroller(lvDemo).init();
	//分页滚动示例代码>>>>>>>>>>>>>>>>>>>

	//示例代码>>>>>>>>>>>>>>>>>>>
}
 
Example 20
Project: aos-Video   File: BrowserWithShowHeader.java   View source code 6 votes vote down vote up
protected void applySelectedViewMode(int newMode) {
    if(mHeaderView!=null) { //removing headerview
        if (mArchosGridView instanceof ListView) {
            ((ListView) mArchosGridView).removeHeaderView(mHeaderView);
            ((AdapterView)mHeaderView.getParent()).removeViewInLayout(mHeaderView);
        }
        if(mArchosGridView instanceof HeaderGridView)
            ((HeaderGridView) mArchosGridView).removeHeaderView(mHeaderView);

    }
    // Save the current position variables before changing the view mode
    setPosition();
    mSelectedPosition = mArchosGridView.getFirstVisiblePosition();
    setViewMode(newMode);
    //replacing headerView

        addHeaderView();
    bindAdapter();

}
 
Example 21
Project: LearnHangul   File: CharactersActivity.java   View source code 6 votes vote down vote up
private void setCharacterList(){

        ListView character_list = (ListView) findViewById(R.id.character_list);
        final ArrayAdapter<Character> adapter = new RowAdapter(this,characters);
        character_list.setAdapter(adapter);

        character_list.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {

                boolean isSelected = characters.get(i).isActive() ? false : true;
                characters.get(i).setActive(isSelected);
                adapter.notifyDataSetChanged();

            }
        });

    }
 
Example 22
Project: DialogHelper   File: ShareDialog.java   View source code 6 votes vote down vote up
@Override
public void initData() {

    list = new ArrayList<>();
    list.add(context.getString(R.string.weChat));
    list.add(context.getString(R.string.qq));
    list.add(context.getString(R.string.weChatFriends));
    list.add(context.getString(R.string.qzone));
    list.add(context.getString(R.string.sina));

    gridView.setAdapter(new ShareAdapter(context, list));

    gridView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {

            if (onItemClick != null) {
                onItemClick.onItemClick(i);
            }

        }
    });
}
 
Example 23
Project: decoy   File: ContactsFragment.java   View source code 6 votes vote down vote up
@Override
public void onItemClick(AdapterView<?> parent, View view, int position,
                        long id) {
    AbsContactItem item = (AbsContactItem) adapter.getItem(position);
    if (item == null) {
        return;
    }

    int type = item.getItemType();

    if (type == ItemTypes.FUNC && customization != null) {
        customization.onFuncItemClick(item);
        return;
    }

    if (type == ItemTypes.FRIEND && item instanceof ContactItem && NimUIKit.getContactEventListener() != null) {
        NimUIKit.getContactEventListener().onItemClick(getActivity(), (((ContactItem) item).getContact()).getContactId());
    }
}
 
Example 24
Project: Rey-MusicPlayer   File: EqualizerActivity.java   View source code 5 votes vote down vote up
@Override
public void onItemSelected(AdapterView<?> arg0, View arg1, int index, long arg3) {
    PreferencesHelper.getInstance().put(PreferencesHelper.Key.LAST_PRESET_NAME, mReverbSpinner.getSelectedItem().toString());
    reverbSetting = index;

    if (mApp.isServiceRunning())
        if (index == 0) {
            mApp.getService().getEqualizerHelper().getReverb().setPreset(PresetReverb.PRESET_NONE);
            reverbSetting = 0;
        } else if (index == 1) {
            mApp.getService().getEqualizerHelper().getReverb().setPreset(PresetReverb.PRESET_LARGEHALL);
            reverbSetting = 1;
        } else if (index == 2) {
            mApp.getService().getEqualizerHelper().getReverb().setPreset(PresetReverb.PRESET_LARGEROOM);
            reverbSetting = 2;
        } else if (index == 3) {
            mApp.getService().getEqualizerHelper().getReverb().setPreset(PresetReverb.PRESET_MEDIUMHALL);
            reverbSetting = 3;
        } else if (index == 4) {
            mApp.getService().getEqualizerHelper().getReverb().setPreset(PresetReverb.PRESET_MEDIUMROOM);
            reverbSetting = 4;
        } else if (index == 5) {
            mApp.getService().getEqualizerHelper().getReverb().setPreset(PresetReverb.PRESET_SMALLROOM);
            reverbSetting = 5;
        } else if (index == 6) {
            mApp.getService().getEqualizerHelper().getReverb().setPreset(PresetReverb.PRESET_PLATE);
            reverbSetting = 6;
        } else
            reverbSetting = 0;
}
 
Example 25
Project: FilterPlayer   File: MainActivity.java   View source code 5 votes vote down vote up
@Override
public void onItemSelected(AdapterView<?> parent, View view, final int position, long id) {

    glSurfaceView.queueEvent(new Runnable() {
        @Override public void run() {
            // notify the renderer that we want to change the encoder's state
            videoRenderer.changeFilterMode(position);
        }
    });
}
 
Example 26
Project: android_ui   File: BaseSamplesNavigationFragment.java   View source code 5 votes vote down vote up
@Override
public void onItemClick(@NonNull AdapterView<?> parent, @NonNull View view, int position, long id) {
	final SampleItem item = getAdapter().getItem(position);
	mFragmentController.newRequest((int) item.getId())
			.addToBackStack(true)
			.execute();
}
 
Example 27
Project: GravityBox   File: OngoingNotifPreference.java   View source code 5 votes vote down vote up
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    IIconCheckListAdapterItem item = 
            (IIconCheckListAdapterItem) parent.getItemAtPosition(position);
    item.setChecked(!item.isChecked());
    mListView.invalidateViews();
}
 
Example 28
Project: Earthquake-App   File: EarthquakeActivity.java   View source code 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_earthquake);
    init();

    //TODO: verify if there's internet connection

        if(thereIsInternet()){
            progressBar.setVisibility(View.VISIBLE);
        }
        else if(!(thereIsInternet())){
            progressBar.setVisibility(View.GONE);
            noInternetConection.setText("There is no internet connection");
        }
    // Find a reference to the {@link ListView} in the layout
    LoaderManager loaderManager = getLoaderManager();
    loaderManager.initLoader(EARTHQUAKE_LOADER, null, this);

    //TODO: set up the correct url
    earthquakeListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
            Earthquake earthquake = earthquakeAdapterm.getItem(i);
            intent = new Intent(Intent.ACTION_VIEW);
            intent.setData(Uri.parse(earthquake.getUrl()));
            startActivity(intent);
        }
    });
}
 
Example 29
Project: container   File: ResolverActivity.java   View source code 5 votes vote down vote up
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    final int checkedPos = mListView.getCheckedItemPosition();
    final boolean hasValidSelection = checkedPos != ListView.INVALID_POSITION;
    if (mAlwaysUseOption && (!hasValidSelection || mLastSelected != checkedPos)) {
        mAlwaysButton.setEnabled(hasValidSelection);
        mOnceButton.setEnabled(hasValidSelection);
        if (hasValidSelection) {
            mListView.smoothScrollToPosition(checkedPos);
        }
        mLastSelected = checkedPos;
    } else {
        startSelected(position, false);
    }
}
 
Example 30
Project: FireFiles   File: StandaloneActivity.java   View source code 5 votes vote down vote up
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
    if (mIgnoreNextNavigation) {
        mIgnoreNextNavigation = false;
        return;
    }
    while (mState.stack.size() > position + 1) {
        mState.stackTouched = true;
        mState.stack.pop();
    }
    onCurrentDirectoryChanged(ANIM_UP);
}
 
Example 31
Project: Make-A-Pede-Android-App   File: DeviceListActivity.java   View source code 5 votes vote down vote up
protected void onListItemClick(AdapterView l, View v, int position, long id) {
	final BluetoothDevice device = leDeviceListAdapter.getDevice(position);

	if (device == null) return;

	final Intent intent = new Intent(this, ControllerActivity.class);
	intent.putExtra(EXTRAS_DEVICE_NAME, device.getName());
	intent.putExtra(EXTRAS_DEVICE_ADDRESS, device.getAddress());
	intent.putExtra(EXTRAS_DEVICE_TYPE, device.getType());

	btScanner.stopScan();

	startActivity(intent);
}
 
Example 32
Project: SmartRefreshLayout   File: RefreshUsingFragment.java   View source code 5 votes vote down vote up
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    Item item = Item.values()[position];
    if (Activity.class.isAssignableFrom(item.clazz)) {
        startActivity(new Intent(getContext(), item.clazz));
    } else if (Fragment.class.isAssignableFrom(item.clazz)) {
        FragmentActivity.start(this, item.clazz);
    }
}
 
Example 33
Project: DoorAccess   File: LocationFragment.java   View source code 5 votes vote down vote up
@Override
public boolean onContextItemSelected(MenuItem menuItem) {

    final AdapterView.AdapterContextMenuInfo menuInfo;
    menuInfo = (AdapterView.AdapterContextMenuInfo)menuItem.getMenuInfo();

    /**
     * menuInfo.position for List index
     * menuItem.getItemId for operation index
     */
    ReaderLocation rLocation = mRLocaitonList.get(menuInfo.position);
    switch(menuItem.getItemId()) {
        case LOC_CONTEXT_MENU_MODIFY:
            Toast.makeText(getContext(), "LOC_CONTEXT_MENU_MODIFY", Toast.LENGTH_SHORT);
            ModifyLocationFragment modifyLocationFragment = new ModifyLocationFragment(rLocation, menuInfo.position);
            modifyLocationFragment.setTargetFragment(this, 0);
            modifyLocationFragment.show(mFragmentManager, "ModifyLocation");
            break;
        case LOC_CONTEXT_MENU_TAG:
            Toast.makeText(getContext(), "LOC_CONTEXT_MENU_TAG", Toast.LENGTH_SHORT);
            AssociateTagFragment associateTagFragment = new AssociateTagFragment(rLocation, menuInfo.position);
            associateTagFragment.setTargetFragment(this, 0);
            associateTagFragment.show(mFragmentManager, "AssociateTag");
            break;
        case LOC_CONTEXT_MENU_DELETE:
            Toast.makeText(getContext(), "LOC_CONTEXT_MENU_DELETE", Toast.LENGTH_SHORT);
            DeleteLocation(rLocation);
            break;
    }

    return false;
}
 
Example 34
Project: boohee_v5.6   File: StatusPostTextActivity.java   View source code 5 votes vote down vote up
public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {
    if ("add".equals((String) StatusPostTextActivity.this.mAdapter.getItem(position))) {
        StatusPostTextActivity.this.openPhotoPicker();
        return;
    }
    StatusPostTextActivity.this.mCurEditPicPosition = position;
    Uri imageUri = Uri.fromFile(new File((String) StatusPostTextActivity.this
            .mSelectPictures.get(position)));
    Intent intent = new Intent(StatusPostTextActivity.this.mActivity, ImageEditActivity
            .class);
    intent.setData(imageUri);
    StatusPostTextActivity.this.startActivityForResult(intent, 4);
}
 
Example 35
Project: boohee_v5.6   File: MeasureCurveActivity.java   View source code 5 votes vote down vote up
public void onItemSelected(AdapterView<?> adapterView, View view, int position, long arg3) {
    MeasureCurveActivity.this.setSpinnerText(view);
    MeasureCurveActivity.this.measureType = MeasureCurveActivity.this.getMeasureType
            (position);
    MeasureCurveActivity.this.mMeasure.clear();
    MeasureCurveActivity.this.mCurrentDate = DateHelper.format(new Date());
    MeasureCurveActivity.this.mEndDate = MeasureCurveActivity.this.mCurrentDate;
    MeasureCurveActivity.this.mBeginDate = MeasureCurveActivity.this.getDateByMode
            (MeasureCurveActivity.this.mEndDate, MeasureCurveActivity.this.typeMode, true);
    MeasureCurveActivity.this.mViewportLeft = 0.0f;
    MeasureCurveActivity.this.mViewportRight = 0.0f;
    ((LineChartRenderer) MeasureCurveActivity.this.lineChart.getChartRenderer())
            .resetPointIndex();
    MeasureCurveActivity.this.requestMeasure();
}
 
Example 36
Project: MegviiFacepp-Android-SDK   File: FaceppActionActivity.java   View source code 5 votes vote down vote up
private void onClickListener() {
    mListView.setOnItemClickListener(new OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            isShowListView();
            resolutionMap = cameraSize.get(position);
            String str = resolutionMap.get("width") + "*" + resolutionMap.get("height");
            mDialogUtil.setTextSzie(editItemTexts[1], str.length());
            editItemTexts[1].setText(str);
        }
    });
}
 
Example 37
Project: Tribe   File: InterceptLayout.java   View source code 5 votes vote down vote up
public boolean avPullUpIntercept(View child) {
    boolean intercept = false;
    AdapterView adapterChild = (AdapterView) child;

    // 判断AbsListView是否已经到达内容最底部
    if (adapterChild.getLastVisiblePosition() == adapterChild.getCount() - 1
            && (adapterChild.getChildAt(adapterChild.getChildCount() - 1).getBottom() == getMeasuredHeight())) {
        // 如果到达底部,则拦截事件
        intercept = true;
    }
    return intercept;
}
 
Example 38
Project: q-mail   File: ManageIdentities.java   View source code 5 votes vote down vote up
@Override
protected void setupClickListeners() {
    this.getListView().setOnItemClickListener(new AdapterView.OnItemClickListener() {
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            editItem(position);
        }
    });

    ListView listView = getListView();
    registerForContextMenu(listView);
}
 
Example 39
Project: iosched-reader   File: MapInfoFragment.java   View source code 5 votes vote down vote up
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    SessionAdapter adapter = (SessionAdapter) parent.getAdapter();

    final String sessionId = adapter.getSessionIdAtPosition(position);
    mCallback.onSessionClicked(sessionId);
}
 
Example 40
Project: MavsSnapUp   File: HomeActivity.java   View source code 5 votes vote down vote up
private void loadListView() {
    ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, android.R.id.text1, items);

    mListView.setAdapter(adapter);

    mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
            Intent intent = new Intent(getBaseContext(), ItemDescActivity.class);
            intent.putExtra("itemKey", itemKeys.get(i));
            startActivity(intent);
        }
    });
}