Search in sources :

Example 71 with OnItemClickListener

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));
        }
    });
}
Also used : ListView(android.widget.ListView) OnItemClickListener(android.widget.AdapterView.OnItemClickListener) Intent(android.content.Intent) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView) Uri(android.net.Uri)

Example 72 with OnItemClickListener

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;
        }
    });
}
Also used : OnItemClickListener(android.widget.AdapterView.OnItemClickListener) SharedPreferences(android.content.SharedPreferences) Intent(android.content.Intent) GridView(android.widget.GridView) View(android.view.View) AdapterView(android.widget.AdapterView) OnItemLongClickListener(android.widget.AdapterView.OnItemLongClickListener)

Example 73 with OnItemClickListener

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());
}
Also used : ListView(android.widget.ListView) OnItemClickListener(android.widget.AdapterView.OnItemClickListener) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) ListView(android.widget.ListView)

Example 74 with OnItemClickListener

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);
}
Also used : ContextMenuItem(net.osmand.plus.ContextMenuItem) OnItemClickListener(android.widget.AdapterView.OnItemClickListener)

Example 75 with OnItemClickListener

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();
                }
            }
        }
    };
}
Also used : ContextMenuAdapter(net.osmand.plus.ContextMenuAdapter) OnItemClickListener(android.widget.AdapterView.OnItemClickListener) ContextMenuItem(net.osmand.plus.ContextMenuItem) AdapterView(android.widget.AdapterView) OnRowItemClick(net.osmand.plus.ContextMenuAdapter.OnRowItemClick) ImageView(android.widget.ImageView) DynamicListView(net.osmand.plus.views.controls.DynamicListView) OsmandMapTileView(net.osmand.plus.views.OsmandMapTileView) ScrollView(android.widget.ScrollView) ObservableScrollView(com.github.ksoichiro.android.observablescrollview.ObservableScrollView) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) ListView(android.widget.ListView) AbsListView(android.widget.AbsListView) CompoundButton(android.widget.CompoundButton)

Aggregations

OnItemClickListener (android.widget.AdapterView.OnItemClickListener)241 AdapterView (android.widget.AdapterView)238 View (android.view.View)237 ListView (android.widget.ListView)188 TextView (android.widget.TextView)135 ImageView (android.widget.ImageView)86 Intent (android.content.Intent)68 OnClickListener (android.view.View.OnClickListener)44 SuppressLint (android.annotation.SuppressLint)32 LayoutInflater (android.view.LayoutInflater)32 AlertDialog (android.app.AlertDialog)27 DialogInterface (android.content.DialogInterface)27 GridView (android.widget.GridView)26 ArrayAdapter (android.widget.ArrayAdapter)24 Bundle (android.os.Bundle)23 Dialog (android.app.Dialog)22 ArrayList (java.util.ArrayList)21 Paint (android.graphics.Paint)17 File (java.io.File)17 AbsListView (android.widget.AbsListView)16