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();
}
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;
}
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));
}
}
});
}
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();
}
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;
}
});
}
Aggregations