use of android.widget.AdapterView.OnItemClickListener in project JavaForFun by gumartinm.
the class MobiAdsNewAdsActivity method onResume.
@Override
public void onResume() {
super.onResume();
setContentView(R.layout.mobiadsnewadslist);
// Setup the list view
final ListView newsEntryListView = (ListView) findViewById(R.id.list);
final AdsEntryAdapter newsEntryAdapter = new AdsEntryAdapter(this, R.layout.ads_entry_list_item);
newsEntryListView.setAdapter(newsEntryAdapter);
// Find out a way to populate this list just when it is required... :/
for (final AdsEntry entry : getAdsEntries()) {
newsEntryAdapter.add(entry);
}
newsEntryListView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Uri uri = Uri.parse(newsEntryAdapter.getItem(position).getTitle());
startActivity(new Intent(Intent.ACTION_VIEW, uri));
}
});
}
use of android.widget.AdapterView.OnItemClickListener in project remote-desktop-clients by iiordanov.
the class ConnectionGridActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
appContext = getApplicationContext();
setContentView(R.layout.grid_view_activity);
gridView = (GridView) findViewById(R.id.gridView);
gridView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
SharedPreferences sp = getSharedPreferences("generalSettings", Context.MODE_PRIVATE);
String connections = sp.getString("connections", null);
if (connections != null) {
connectionPreferenceFiles = connections.split(" ");
}
Intent intent = new Intent(ConnectionGridActivity.this, RemoteCanvasActivity.class);
if (connectionPreferenceFiles != null && position < connectionPreferenceFiles.length) {
ConnectionSettings cs = new ConnectionSettings(connectionPreferenceFiles[position]);
cs.loadFromSharedPreferences(appContext);
intent.putExtra("com.undatech.opaque.ConnectionSettings", cs);
}
startActivity(intent);
}
});
gridView.setOnItemLongClickListener(new OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView<?> parent, View v, int position, long id) {
SharedPreferences sp = getSharedPreferences("generalSettings", Context.MODE_PRIVATE);
String connections = sp.getString("connections", null);
if (connections != null) {
connectionPreferenceFiles = connections.split(" ");
}
Intent intent = new Intent(ConnectionGridActivity.this, ConnectionSetupActivity.class);
if (connectionPreferenceFiles != null && position < connectionPreferenceFiles.length) {
intent.putExtra("com.undatech.opaque.connectionToEdit", connectionPreferenceFiles[position]);
}
startActivity(intent);
return true;
}
});
}
use of android.widget.AdapterView.OnItemClickListener in project android by testpress.
the class ItemListFragment method onViewCreated.
@Override
public void onViewCreated(final View view, final Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
progressBar = (ProgressBar) view.findViewById(id.pb_loading);
progressBar.getIndeterminateDrawable().setColorFilter(getResources().getColor(R.color.primary), PorterDuff.Mode.SRC_IN);
emptyView = view.findViewById(id.empty_container);
emptyTitleView = (TextView) view.findViewById(id.empty_title);
emptyDescView = (TextView) view.findViewById(id.empty_description);
listView = (ListView) view.findViewById(android.R.id.list);
listView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
onListItemClick((ListView) parent, view, position, id);
}
});
configureList(getActivity(), getListView());
}
use of android.widget.AdapterView.OnItemClickListener in project Osmand by osmandapp.
the class DashboardOnMap method updateListAdapter.
public void updateListAdapter(ContextMenuAdapter cm) {
boolean nightMode = mapActivity.getMyApplication().getDaynightHelper().isNightModeForMapControls();
if (this.nightMode != nightMode) {
this.nightMode = nightMode;
applyDayNightMode();
}
final ArrayAdapter<ContextMenuItem> listAdapter = cm.createListAdapter(mapActivity, !nightMode);
OnItemClickListener listener = getOptionsMenuOnClickListener(cm, listAdapter);
updateListAdapter(listAdapter, listener);
}
use of android.widget.AdapterView.OnItemClickListener in project Osmand by osmandapp.
the class DashboardOnMap method getOptionsMenuOnClickListener.
private OnItemClickListener getOptionsMenuOnClickListener(final ContextMenuAdapter cm, final ArrayAdapter<ContextMenuItem> listAdapter) {
return new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int which, long id) {
ContextMenuItem item = cm.getItem(which);
ContextMenuAdapter.ItemClickListener click = item.getItemClickListener();
if (click instanceof OnRowItemClick) {
boolean cl = ((OnRowItemClick) click).onRowItemClick(listAdapter, view, item.getTitleId(), which);
if (cl) {
hideDashboard();
}
} else if (click != null) {
CompoundButton btn = (CompoundButton) view.findViewById(R.id.toggle_item);
if (btn != null && btn.getVisibility() == View.VISIBLE) {
btn.setChecked(!btn.isChecked());
} else {
if (click.onContextMenuClick(listAdapter, item.getTitleId(), which, false, null)) {
hideDashboard();
}
}
} else {
if (!item.isCategory()) {
hideDashboard();
}
}
}
};
}
Aggregations