Search in sources :

Example 26 with OnItemClickListener

use of android.widget.AdapterView.OnItemClickListener in project android-app-common-tasks by multidots.

the class CodeSnippestHomeActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    mContext = CodeSnippestHomeActivity.this;
    //Activity mActivity = CodeSnippestHomeActivity.this;
    String[] sdkFunctionalityListValue = new String[] { "Executing a HTTP Get Request", /* 0 */
    "Executing a HTTP Post Request", /* 1 */
    "Executing a HTTP post Request for Send Audio,Video and Image" };
    ListView sdkFunctionalityList = (ListView) findViewById(R.id.Md_list_company);
    ArrayAdapter<String> stringArrayAdapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, sdkFunctionalityListValue);
    sdkFunctionalityList.setAdapter(stringArrayAdapter);
    sdkFunctionalityList.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
            selectedListItem(position);
        }
    });
}
Also used : ListView(android.widget.ListView) OnItemClickListener(android.widget.AdapterView.OnItemClickListener) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView) ArrayAdapter(android.widget.ArrayAdapter)

Example 27 with OnItemClickListener

use of android.widget.AdapterView.OnItemClickListener in project Android-Universal-Image-Loader by nostra13.

the class ImageGridFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fr_image_grid, container, false);
    listView = (GridView) rootView.findViewById(R.id.grid);
    ((GridView) listView).setAdapter(new ImageAdapter(getActivity()));
    listView.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            startImagePagerActivity(position);
        }
    });
    return rootView;
}
Also used : OnItemClickListener(android.widget.AdapterView.OnItemClickListener) GridView(android.widget.GridView) GridView(android.widget.GridView) ImageView(android.widget.ImageView) View(android.view.View) AdapterView(android.widget.AdapterView)

Example 28 with OnItemClickListener

use of android.widget.AdapterView.OnItemClickListener in project android-viewflow by pakerfeldt.

the class ViewFlowExample method onCreate.

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

Example 29 with OnItemClickListener

use of android.widget.AdapterView.OnItemClickListener in project PocketHub by pockethub.

the class ItemListFragment method onViewCreated.

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    swipeLayout = (SwipeRefreshLayout) view.findViewById(R.id.swipe_item);
    swipeLayout.setOnRefreshListener(this);
    swipeLayout.setColorSchemeResources(R.color.pager_title_background_top_start, R.color.pager_title_background_end, R.color.text_link, R.color.pager_title_background_end);
    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);
        }
    });
    listView.setOnItemLongClickListener(new OnItemLongClickListener() {

        @Override
        public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
            return onListItemLongClick((ListView) parent, view, position, id);
        }
    });
    progressBar = (ProgressBar) view.findViewById(R.id.pb_loading);
    emptyView = (TextView) view.findViewById(android.R.id.empty);
    configureList(getActivity(), getListView());
}
Also used : ListView(android.widget.ListView) OnItemClickListener(android.widget.AdapterView.OnItemClickListener) TextView(android.widget.TextView) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView) OnItemLongClickListener(android.widget.AdapterView.OnItemLongClickListener)

Example 30 with OnItemClickListener

use of android.widget.AdapterView.OnItemClickListener in project JamsMusicPlayer by psaravan.

the class BlacklistedArtistsPickerFragment method onCreateView.

@SuppressLint("NewApi")
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    mApp = (Common) getActivity().getApplicationContext();
    View rootView = inflater.inflate(R.layout.fragment_artists_music_library_editor, null);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
        rootView.setBackground(UIElementsHelper.getBackgroundGradientDrawable(getActivity()));
    } else {
        rootView.setBackgroundDrawable(UIElementsHelper.getBackgroundGradientDrawable(getActivity()));
    }
    cursor = mApp.getDBAccessHelper().getAllUniqueArtistsNoBlacklist("");
    listView = (ListView) rootView.findViewById(R.id.musicLibraryEditorArtistsListView);
    listView.setFastScrollEnabled(true);
    listView.setAdapter(new BlacklistedArtistsMultiselectAdapter(getActivity(), cursor));
    listView.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> arg0, View view, int which, long dbID) {
            CheckBox checkbox = (CheckBox) view.findViewById(R.id.artistCheckboxMusicLibraryEditor);
            checkbox.performClick();
            /* Since we've performed a software-click (checkbox.performClick()), all we have 
				 * to do now is determine the *new* state of the checkbox. If the checkbox is checked, 
				 * that means that the user tapped on it when it was unchecked, and we should add 
				 * the artist's songs to the HashSet. If the checkbox is unchecked, that means the user 
				 * tapped on it when it was checked, so we should remove the artist's songs from the 
				 * HashSet.
				 */
            if (checkbox.isChecked()) {
                view.setBackgroundColor(0xCCFF4444);
                AsyncBlacklistArtistTask task = new AsyncBlacklistArtistTask((String) view.getTag(R.string.artist));
                task.execute(new String[] { "ADD" });
            } else {
                view.setBackgroundColor(0x00000000);
                AsyncBlacklistArtistTask task = new AsyncBlacklistArtistTask((String) view.getTag(R.string.artist));
                task.execute(new String[] { "REMOVE" });
            }
        }
    });
    instructions = (TextView) rootView.findViewById(R.id.artists_music_library_editor_instructions);
    instructions.setTypeface(TypefaceHelper.getTypeface(getActivity(), "RobotoCondensed-Light"));
    instructions.setPaintFlags(instructions.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG);
    instructions.setText(R.string.blacklist_manager_artists_instructions);
    //KitKat translucent navigation/status bar.
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        //Calculate navigation bar height.
        int navigationBarHeight = 0;
        int resourceId = getResources().getIdentifier("navigation_bar_height", "dimen", "android");
        if (resourceId > 0) {
            navigationBarHeight = getResources().getDimensionPixelSize(resourceId);
        }
        listView.setClipToPadding(false);
        listView.setPadding(0, 0, 0, navigationBarHeight);
    }
    return rootView;
}
Also used : OnItemClickListener(android.widget.AdapterView.OnItemClickListener) CheckBox(android.widget.CheckBox) TextView(android.widget.TextView) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView) AsyncBlacklistArtistTask(com.jams.music.player.BlacklistManagerActivity.BlacklistedArtistsMultiselectAdapter.AsyncBlacklistArtistTask) SuppressLint(android.annotation.SuppressLint) Paint(android.graphics.Paint) SuppressLint(android.annotation.SuppressLint)

Aggregations

OnItemClickListener (android.widget.AdapterView.OnItemClickListener)135 AdapterView (android.widget.AdapterView)134 View (android.view.View)133 ListView (android.widget.ListView)102 TextView (android.widget.TextView)71 Intent (android.content.Intent)43 ImageView (android.widget.ImageView)41 OnClickListener (android.view.View.OnClickListener)24 Bundle (android.os.Bundle)18 ArrayAdapter (android.widget.ArrayAdapter)17 SuppressLint (android.annotation.SuppressLint)15 Paint (android.graphics.Paint)12 ColorDrawable (android.graphics.drawable.ColorDrawable)11 GridView (android.widget.GridView)11 LayoutInflater (android.view.LayoutInflater)10 DialogInterface (android.content.DialogInterface)9 CheckBox (android.widget.CheckBox)9 LinearLayout (android.widget.LinearLayout)9 ArrayList (java.util.ArrayList)7 OnItemLongClickListener (android.widget.AdapterView.OnItemLongClickListener)6