Search in sources :

Example 46 with AdapterView

use of android.widget.AdapterView in project EasyVolley by asifmujteba.

the class ProductsActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    productsAdapter = new ProductsAdapter(mContext, new ArrayList<Product>());
    gridView.setEmptyView(emptyElement);
    gridView.setAdapter(productsAdapter);
    gridView.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            Product product = productsAdapter.getItem(position);
            DetailsActivity.launch(mContext, product, (ImageView) view.findViewById(R.id.imageView));
        }
    });
    swipeContainer.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {

        @Override
        public void onRefresh() {
            loadProducts();
        }
    });
    loadProducts();
}
Also used : ArrayList(java.util.ArrayList) Product(com.github.asifmujteba.easyvolleysample.Models.Product) GridView(android.widget.GridView) ImageView(android.widget.ImageView) InjectView(butterknife.InjectView) TextView(android.widget.TextView) View(android.view.View) AdapterView(android.widget.AdapterView) SwipeRefreshLayout(android.support.v4.widget.SwipeRefreshLayout) ProductsAdapter(com.github.asifmujteba.easyvolleysample.UI.adapters.ProductsAdapter) AdapterView(android.widget.AdapterView) ImageView(android.widget.ImageView)

Example 47 with AdapterView

use of android.widget.AdapterView in project AndroidPicker by gzu-liyujiang.

the class FilePicker method makeFooterView.

@Nullable
@Override
protected View makeFooterView() {
    LinearLayout rootLayout = new LinearLayout(activity);
    rootLayout.setLayoutParams(new LinearLayout.LayoutParams(MATCH_PARENT, WRAP_CONTENT));
    rootLayout.setOrientation(LinearLayout.VERTICAL);
    rootLayout.setBackgroundColor(Color.WHITE);
    View lineView = new View(activity);
    lineView.setLayoutParams(new LinearLayout.LayoutParams(MATCH_PARENT, 1));
    lineView.setBackgroundColor(0xFFDDDDDD);
    rootLayout.addView(lineView);
    HorizontalListView pathView = new HorizontalListView(activity);
    int height = ConvertUtils.toPx(activity, 30);
    pathView.setLayoutParams(new LinearLayout.LayoutParams(MATCH_PARENT, height));
    pathView.setAdapter(pathAdapter);
    pathView.setBackgroundColor(Color.WHITE);
    pathView.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            refreshCurrentDirPath(pathAdapter.getItem(position));
        }
    });
    rootLayout.addView(pathView);
    return rootLayout;
}
Also used : HorizontalListView(cn.qqtheme.framework.widget.HorizontalListView) AdapterView(android.widget.AdapterView) HorizontalListView(cn.qqtheme.framework.widget.HorizontalListView) TextView(android.widget.TextView) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView) LinearLayout(android.widget.LinearLayout) Nullable(android.support.annotation.Nullable)

Example 48 with AdapterView

use of android.widget.AdapterView in project love-android by hagish.

the class Launcher method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.launcher);
    populateGameList();
    ListView gameListView = (ListView) this.findViewById(R.id.gameList);
    gameListView.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, gameListName));
    gameListView.setTextFilterEnabled(true);
    gameListView.setOnItemClickListener(new OnItemClickListener() {

        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            // only launch if path is set, avoid info-entries
            if (gameListPath.get(position).length() > 0) {
                launchGame(gameListName.get(position), gameListPath.get(position));
            }
        }
    });
}
Also used : ListView(android.widget.ListView) OnItemClickListener(android.widget.AdapterView.OnItemClickListener) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView)

Example 49 with AdapterView

use of android.widget.AdapterView in project MusicDNA by harjot-oberai.

the class HomeActivity method showAddToPlaylistDialog.

public void showAddToPlaylistDialog(final UnifiedTrack track) {
    final Dialog dialog = new Dialog(ctx);
    dialog.setContentView(R.layout.add_to_playlist_dialog);
    dialog.setTitle("Add to Playlist");
    ListView lv = (ListView) dialog.findViewById(R.id.playlist_list);
    AddToPlaylistAdapter adapter;
    if (allPlaylists.getPlaylists() != null && allPlaylists.getPlaylists().size() != 0) {
        adapter = new AddToPlaylistAdapter(allPlaylists.getPlaylists(), ctx);
        lv.setAdapter(adapter);
        lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {

            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                Playlist temp = allPlaylists.getPlaylists().get(position);
                boolean isRepeat = false;
                for (UnifiedTrack ut : temp.getSongList()) {
                    if (track.getType() && ut.getType() && track.getLocalTrack().getTitle().equals(ut.getLocalTrack().getTitle())) {
                        isRepeat = true;
                        break;
                    } else if (!track.getType() && !ut.getType() && track.getStreamTrack().getTitle().equals(ut.getStreamTrack().getTitle())) {
                        isRepeat = true;
                        break;
                    }
                }
                if (!isRepeat) {
                    temp.addSong(track);
                    playlistsRecycler.setVisibility(View.VISIBLE);
                    playlistNothingText.setVisibility(View.INVISIBLE);
                    pAdapter.notifyDataSetChanged();
                    Toast.makeText(ctx, "Added to Playlist : " + temp.getPlaylistName(), Toast.LENGTH_SHORT).show();
                    new SavePlaylists().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
                    dialog.dismiss();
                } else {
                    Toast.makeText(ctx, "Song already present in Playlist", Toast.LENGTH_SHORT).show();
                }
            }
        });
    } else {
        lv.setVisibility(GONE);
    }
    // set the custom dialog components - text, image and button
    final EditText text = (EditText) dialog.findViewById(R.id.new_playlist_name);
    ImageView image = (ImageView) dialog.findViewById(R.id.confirm_button);
    // if button is clicked, close the custom dialog
    image.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            boolean isNameRepeat = false;
            if (text.getText().toString().trim().equals("")) {
                text.setError("Enter Playlist Name!");
            } else {
                for (int i = 0; i < allPlaylists.getPlaylists().size(); i++) {
                    if (text.getText().toString().equals(allPlaylists.getPlaylists().get(i).getPlaylistName())) {
                        isNameRepeat = true;
                        text.setError("Playlist with same name exists!");
                        break;
                    }
                }
                if (!isNameRepeat) {
                    List<UnifiedTrack> l = new ArrayList<UnifiedTrack>();
                    l.add(track);
                    Playlist pl = new Playlist(l, text.getText().toString().trim());
                    allPlaylists.addPlaylist(pl);
                    playlistsRecycler.setVisibility(View.VISIBLE);
                    playlistNothingText.setVisibility(View.INVISIBLE);
                    pAdapter.notifyDataSetChanged();
                    dialog.dismiss();
                    new SavePlaylists().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
                }
            }
        }
    });
    dialog.show();
}
Also used : EditText(android.widget.EditText) AddToPlaylistAdapter(com.sdsmdg.harjot.MusicDNA.adapters.playlistdialogadapter.AddToPlaylistAdapter) ImageView(android.widget.ImageView) VisualizerView(com.sdsmdg.harjot.MusicDNA.visualizers.VisualizerView) RecyclerView(android.support.v7.widget.RecyclerView) NavigationView(android.support.design.widget.NavigationView) SearchView(android.support.v7.widget.SearchView) CircleImageView(de.hdodenhof.circleimageview.CircleImageView) ShowcaseView(com.github.amlcurran.showcaseview.ShowcaseView) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) WheelView(com.lantouzi.wheelview.WheelView) ListView(android.widget.ListView) TextPaint(android.text.TextPaint) Playlist(com.sdsmdg.harjot.MusicDNA.models.Playlist) ListView(android.widget.ListView) Dialog(android.app.Dialog) CustomLocalBottomSheetDialog(com.sdsmdg.harjot.MusicDNA.custombottomsheets.CustomLocalBottomSheetDialog) CustomGeneralBottomSheetDialog(com.sdsmdg.harjot.MusicDNA.custombottomsheets.CustomGeneralBottomSheetDialog) UnifiedTrack(com.sdsmdg.harjot.MusicDNA.models.UnifiedTrack) AdapterView(android.widget.AdapterView) ColorStateList(android.content.res.ColorStateList) ArrayList(java.util.ArrayList) List(java.util.List) ImageView(android.widget.ImageView) CircleImageView(de.hdodenhof.circleimageview.CircleImageView)

Example 50 with AdapterView

use of android.widget.AdapterView in project AndroidSDK-RecipeBook by gabu.

the class Recipe041 method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    // アイコン画像を生成
    Bitmap defaultImage;
    defaultImage = BitmapFactory.decodeResource(getResources(), R.drawable.default_image);
    // テストデータを作成
    List<ListItem> list = new ArrayList<ListItem>();
    ListItem item1 = new ListItem();
    item1.image = defaultImage;
    item1.name = "gabu";
    item1.comment = "検索なら http://google.com/ がオススメ。";
    list.add(item1);
    ListItem item2 = new ListItem();
    item2.image = defaultImage;
    item2.name = "gabu";
    item2.comment = "連絡先は tsukada.shouya@gmail.com です!";
    list.add(item2);
    ListItem item3 = new ListItem();
    item3.image = defaultImage;
    item3.name = "gabu";
    item3.comment = "電話 090-9999-9999";
    list.add(item3);
    ListItem item4 = new ListItem();
    item4.image = defaultImage;
    item4.name = "gabu";
    item4.comment = "Address: 620 Eighth Avenue New York, NY 10018";
    list.add(item4);
    ListItem item5 = new ListItem();
    item5.image = defaultImage;
    item5.name = "gabu";
    item5.comment = "日本表記だと?住所: 〒460-0031 愛知県名古屋市中区本丸1−1";
    list.add(item5);
    // ListItemAdapterを生成
    ListItemAdapter adapter;
    adapter = new ListItemAdapter(this, 0, list);
    // ListViewにListItemAdapterをセット
    ListView listView = (ListView) findViewById(R.id.ListView01);
    listView.setAdapter(adapter);
    listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            ListView listView = (ListView) parent;
            //                ListItem item = (ListItem)listView.getSelectedItem(); // itemがnull
            ListItem item = (ListItem) listView.getItemAtPosition(position);
            Log.d(TAG, "選択されたアイテムのcomment=" + item.comment);
            TextView textView = (TextView) view.findViewById(R.id.name);
            Log.d(TAG, "選択されたViewのTextView(name)のtext=" + textView.getText());
        }
    });
    listView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {

        public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
            Log.d(TAG, "onItemLongClick position=" + position);
            // ちなみに、falseを返すとイベントが継続するのでonItemClickも呼び出されます。
            return true;
        }
    });
}
Also used : ArrayList(java.util.ArrayList) TextView(android.widget.TextView) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView) Bitmap(android.graphics.Bitmap) ListView(android.widget.ListView) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView)

Aggregations

AdapterView (android.widget.AdapterView)677 View (android.view.View)653 ListView (android.widget.ListView)412 TextView (android.widget.TextView)342 Intent (android.content.Intent)177 ImageView (android.widget.ImageView)174 OnItemClickListener (android.widget.AdapterView.OnItemClickListener)142 ArrayAdapter (android.widget.ArrayAdapter)75 ArrayList (java.util.ArrayList)71 ViewGroup (android.view.ViewGroup)63 AbsListView (android.widget.AbsListView)59 GridView (android.widget.GridView)58 Bundle (android.os.Bundle)53 Spinner (android.widget.Spinner)50 LinearLayout (android.widget.LinearLayout)49 OnClickListener (android.view.View.OnClickListener)46 RecyclerView (android.support.v7.widget.RecyclerView)42 DialogInterface (android.content.DialogInterface)41 SuppressLint (android.annotation.SuppressLint)38 LayoutInflater (android.view.LayoutInflater)34