Java 类android.widget.ListView 实例源码
项目:lighthouse
文件:PodcastsActivity.java
private void updatePodcastRows() {
ListView list = getListView();
int first = list.getFirstVisiblePosition();
int last = list.getLastVisiblePosition();
for (int i = first; i <= last; i++) {
View view = list.getChildAt(i - first);
list.getAdapter().getView(i, view, list);
}
}
项目:CSipSimple
文件:CallLogListFragment.java
private void actionModeDelete() {
ListView lv = getListView();
ArrayList<Long> checkedIds = new ArrayList<Long>();
for(int i = 0; i < lv.getCount(); i++) {
if(lv.isItemChecked(i)) {
long[] selectedIds = mAdapter.getCallIdsAtPosition(i);
for(long id : selectedIds) {
checkedIds.add(id);
}
}
}
if(checkedIds.size() > 0) {
String strCheckedIds = TextUtils.join(", ", checkedIds);
Log.d(THIS_FILE, "Checked positions ("+ strCheckedIds +")");
getActivity().getContentResolver().delete(SipManager.CALLLOG_URI, Calls._ID + " IN ("+strCheckedIds+")", null);
mMode.finish();
}
}
项目:andcouchbaseentity
文件:TaskActivity.java
private void setListItemLongClick(ListView listView) {
listView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView<?> parent, View view, final int pos, long id) {
PopupMenu popup = new PopupMenu(TaskActivity.this, view);
popup.inflate(R.menu.task_item);
popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
TaskEntity task = (TaskEntity) mAdapter.getItem(pos - 1);
handleTaskPopupAction(item, task);
return true;
}
});
popup.show();
return true;
}
});
}
项目:LearnHangul
文件:CharactersActivity.java
private void setCharacterList(){
ListView character_list = (ListView) findViewById(R.id.character_list);
final ArrayAdapter<Character> adapter = new RowAdapter(this,characters);
character_list.setAdapter(adapter);
character_list.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
boolean isSelected = characters.get(i).isActive() ? false : true;
characters.get(i).setActive(isSelected);
adapter.notifyDataSetChanged();
}
});
}
项目:routineKeen
文件:HabitListActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.habit_list);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
IOManager.initManager(getApplicationContext());
lv = (ListView) findViewById(R.id.listOfUserHabits);
addHabitBtn = (ImageButton) findViewById(R.id.addNewHabit);
try {
HabitListController.initHabitList();
HabitListController.getHabitList().addObserver(this);
} catch (NetworkUnavailableException e){
Toast.makeText(this, "You must be connected to a network" +
" to view, edit, and add habits.", Toast.LENGTH_LONG).show();
finish();
}
initListeners();
}
项目:Matrix-Calculator-for-Android
文件:CloneFragment.java
@Override
public void onListItemClick(ListView l, View v, int position, long id) {
if (((GlobalValues) getActivity().getApplication()).CanCreateVariable()) {
Matrix m = ((GlobalValues) getActivity().getApplication()).GetCompleteList().get(position);
Matrix clone;
clone = m.ExactClone("Copy_" + m.GetName());
((GlobalValues) getActivity().getApplication()).GetCompleteList().add(clone);
((GlobalValues) getActivity().getApplication()).matrixAdapter.notifyDataSetChanged();
Toast.makeText(getContext(), "Saved as Copy_" + m.GetName(), Toast.LENGTH_SHORT).show();
NavigationView view = (NavigationView) getActivity().findViewById(R.id.nav_view);
view.setCheckedItem(R.id.Home);
FragmentTransaction transaction = getActivity().getSupportFragmentManager().beginTransaction();
transaction.replace(R.id.MainContent, new MainActivityFragmentList());
transaction.commit();
((MainActivity) getActivity()).SetMainActivity(true, getString(R.string.app_name), getString(R.string.MainSubtitle));
} else {
if (!((GlobalValues) getActivity().getApplication()).AdLoaded)
Toast.makeText(getContext(), R.string.ToAddMoreTurnData, Toast.LENGTH_SHORT).show();
else
Toast.makeText(getContext(), R.string.LimitExceeds, Toast.LENGTH_SHORT).show();
}
}
项目:CIA
文件:ViewHabitEventIntentTests.java
/**
* Test to make sure the edit button actually modifies the event
*/
public void testEdit(){
if (((ListView)solo.getView(R.id.historyList)).getAdapter().getCount() > 0){
solo.clickInList(1, 0);
solo.sleep(2000);
solo.assertCurrentActivity("wrong activity", HabitEventViewActivity.class);
solo.clearEditText(0);
solo.sleep(600);
solo.enterText(0, "newcomment");
solo.sleep(600);
solo.clickOnButton("Save");
solo.sleep(2000);
solo.assertCurrentActivity("wrong activity", HistoryActivity.class);
solo.clickInList(1, 0);
solo.sleep(3000);
solo.assertCurrentActivity("wrong activity", HabitEventViewActivity.class);
// make sure the comment was changed
assertTrue(((EditText)solo.getView(R.id.vheCommentDynamicText)).getText().toString().equals("newcomment"));
}
}
项目:YCDialog
文件:CustomSelectDialog.java
private void initViews() {
DialogAdapter dialogAdapter=new DialogAdapter(mName);
ListView dialogList=(ListView) findViewById(R.id.dialog_list);
Button mMBtnCancel = (Button) findViewById(R.id.mBtn_Cancel);
TextView mTvTitle = (TextView) findViewById(R.id.mTv_Title);
dialogList.setOnItemClickListener(this);
dialogList.setAdapter(dialogAdapter);
mMBtnCancel.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(mCancelListener != null){
mCancelListener.onCancelClick(v);
}
dismiss();
}
});
if(!TextUtils.isEmpty(mTitle)){
mTvTitle.setVisibility(View.VISIBLE);
mTvTitle.setText(mTitle);
}else{
mTvTitle.setVisibility(View.GONE);
}
}
项目:GCSApp
文件:ContactList.java
private void init(Context context, AttributeSet attrs) {
this.context = context;
TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.EaseContactList);
primaryColor = ta.getColor(R.styleable.EaseContactList_ctsListPrimaryTextColor, 0);
primarySize = ta.getDimensionPixelSize(R.styleable.EaseContactList_ctsListPrimaryTextSize, 0);
showSiderBar = ta.getBoolean(R.styleable.EaseContactList_ctsListShowSiderBar, true);
initialLetterBg = ta.getDrawable(R.styleable.EaseContactList_ctsListInitialLetterBg);
initialLetterColor = ta.getColor(R.styleable.EaseContactList_ctsListInitialLetterColor, 0);
ta.recycle();
LayoutInflater.from(context).inflate(R.layout.ease_widget_contact_list, this);
listView = (ListView) findViewById(R.id.list);
sidebar = (EaseSidebar) findViewById(R.id.sidebar);
if (!showSiderBar)
sidebar.setVisibility(View.GONE);
}
项目:q-mail
文件:K9ListActivity.java
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
// Shortcuts that work no matter what is selected
if (QMail.useVolumeKeysForListNavigationEnabled() &&
(keyCode == KeyEvent.KEYCODE_VOLUME_UP ||
keyCode == KeyEvent.KEYCODE_VOLUME_DOWN)) {
final ListView listView = getListView();
int currentPosition = listView.getSelectedItemPosition();
if (currentPosition == AdapterView.INVALID_POSITION || listView.isInTouchMode()) {
currentPosition = listView.getFirstVisiblePosition();
}
if (keyCode == KeyEvent.KEYCODE_VOLUME_UP && currentPosition > 0) {
listView.setSelection(currentPosition - 1);
} else if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN &&
currentPosition < listView.getCount()) {
listView.setSelection(currentPosition + 1);
}
return true;
}
return super.onKeyDown(keyCode, event);
}
项目:android-chessclock
文件:SettingsFragment.java
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_settings, container, false);
// Inflate chess.com logo
View header = inflater.inflate(R.layout.list_settings_header, null);
header.setOnClickListener(mHeaderClickListener);
// Init ListView
mListView = (ListView) v.findViewById(R.id.list_time_controls);
mListView.addHeaderView(header, null, false);
mListView.setOnItemClickListener(mItemClickListener);
// Set start button listener
mStartBtn = v.findViewById(R.id.btn_start);
mStartBtn.setOnClickListener(mStartBtnListener);
// Set List Adapter and selection positions.
setupListView(savedInstanceState);
return v;
}
项目:Bartout
文件:DrinkBeverageActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
android.content.Intent intent = getIntent();
beverageName = intent.getStringExtra(beverageNameKey);
beverageVolume = intent.getDoubleExtra(beverageVolumeKey, 0.0);
beverageAlcoholicStrength = intent.getDoubleExtra(beverageAlcoholicKey, 0.0);
bartour = Bartout.getInstance().getActiveBartour();
users = bartour.getUsers();
editTextBeverageName = (EditText) findViewById(R.id.editTextBeverageName);
editTextBeverageVolume = (EditText) findViewById(R.id.editTextBeverageVolume);
editTextAlcoholicStrength = (EditText) findViewById(R.id.editTextBeverageAlcoholicStrength);
editTextBeverageName.setText(beverageName);
editTextBeverageVolume.setText(Double.toString(beverageVolume));
editTextAlcoholicStrength.setText(Double.toString(beverageAlcoholicStrength));
listViewUsers = (ListView) findViewById(R.id.listViewDrinkUsers);
UserBeverageAdapter userBeverageAdapter = new UserBeverageAdapter(this, users);
listViewUsers.setAdapter(userBeverageAdapter);
}
项目:HiBangClient
文件:EditProvinceActivity.java
/***
* 动态设置listview的高度
*
* @param listView
*/
public void setListViewHeightBasedOnChildren(ListView listView) {
ListAdapter listAdapter = listView.getAdapter();
if (listAdapter == null) {
return;
}
int totalHeight = 0;
for (int i = 0; i < listAdapter.getCount(); i++) {
View listItem = listAdapter.getView(i, null, listView);
listItem.measure(0, 0);
totalHeight += listItem.getMeasuredHeight();
}
ViewGroup.LayoutParams params = listView.getLayoutParams();
params.height = totalHeight
+ (listView.getDividerHeight() * (listAdapter.getCount() - 1));
// params.height += 5;// if without this statement,the listview will be
// a
// little short
// listView.getDividerHeight()获取子项间分隔符占用的高度
// params.height最后得到整个ListView完整显示需要的高度
listView.setLayoutParams(params);
}
项目:Todule-android
文件:ToduleLabelFragment.java
@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
// Swap the new cursor in. (The framework will take care of closing the
// old cursor once we return.)
lAdapter.swapCursor(data);
getListView().postDelayed(new Runnable() {
@Override
public void run() {
ListView lv = getListView();
if(selecting) {
if (selectedLabelId == -1L){
// Set headerview as checked
lv.setItemChecked(0, true);
} else {
lv.setItemChecked(getAdapterItemPosition(selectedLabelId) + lv.getHeaderViewsCount(), true);
}
}
}
}, 100);
}
项目:EsperantoRadio
文件:Venstremenu_frag.java
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
listView = (ListView) inflater.inflate(R.layout.venstremenu_frag, container, false);
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
venstremenuAdapter.vælgMenu(getActivity(), position);
}
});
venstremenuAdapter = new VenstremenuAdapter(getActivity());
listView.setAdapter(venstremenuAdapter);
listView.setItemChecked(mCurrentSelectedPosition, true);
for (Backend b : App.backend) b.favoritter.observatører.add(this);
App.data.hentedeUdsendelser.observatører.add(this);
Alarms.setNextAlert(getActivity());
return listView;
}
项目:privacyidea-authenticator
文件:MainActivityTest.java
private int getAdapterCount(){
final int[] counts = new int[1];
onView(withId(R.id.listview)).check(matches(new TypeSafeMatcher<View>() {
@Override
public boolean matchesSafely(View view) {
ListView listView = (ListView) view;
counts[0] = listView.getCount();
return true;
}
@Override
public void describeTo(Description description) {
}
}));
return counts[0];
}
项目:TrackPlan-app
文件:MainteachersActivity.java
void check()
{ListView listView=(ListView)findViewById(R.id.lvt);
Databaseteaclass db1 = new Databaseteaclass(getApplicationContext());
List<Teacherclass> contacts = db1.getAllContacts();
for (Teacherclass cn : contacts) {
Log.d("cccccc", cn.getName());
stringArrayList.add(cn.getName());
stringArrayList1.add(cn.getcName());
}
lviewAdapter = new ListViewAdteach(MainteachersActivity.this, stringArrayList1, stringArrayList);
listView.setAdapter(lviewAdapter);
}
项目:pracler
文件:ProfileMenuAdapter.java
@Override
public View getView(final int position, View convertView, ViewGroup parent)
{
if (convertView == null)
{
convertView = new ProfileRow(context);
ListView.LayoutParams layoutParams = new ListView.LayoutParams(ListView.LayoutParams.MATCH_PARENT, ListView.LayoutParams.MATCH_PARENT);
convertView.setLayoutParams(layoutParams);
}
final ProfileRow v = (ProfileRow) convertView;
v.setText(followingList.get(position).name);
UpdateView updateView = new UpdateView();
updateView.setImageView(v.imageView);
updateView.execute(followingList.get(position).picture);
convertView = v;
return convertView;
}
项目:eddystone-beacon
文件:MainActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
beaconList = (ListView) findViewById(R.id.beacon_list);
beaconManager = BeaconManager.getInstanceForApplication(this);
// Detect the main identifier (UID) frame:
beaconManager.getBeaconParsers().add(new BeaconParser().
setBeaconLayout(BeaconParser.EDDYSTONE_UID_LAYOUT));
// Detect the telemetry (TLM) frame:
beaconManager.getBeaconParsers().add(new BeaconParser().
setBeaconLayout(BeaconParser.EDDYSTONE_TLM_LAYOUT));
// Detect the URL frame:
beaconManager.getBeaconParsers().add(new BeaconParser().
setBeaconLayout(BeaconParser.EDDYSTONE_URL_LAYOUT));
beaconManager.bind(this);
}
项目:Wireless-Programming-Works
文件:DivisionActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_division);
Bundle dataBundle = getIntent().getExtras();
Data data = (Data) dataBundle.getSerializable("data");
String div_name = dataBundle.getString("div");
bg = (ImageView) findViewById(R.id.division_image);
placeList = (ListView) findViewById(R.id.place_list);
divisionName = (TextView) findViewById(R.id.division_name);
divisionName.setText(data.getDivisionName(div_name));
bg.setImageResource(data.getImageRes(div_name));
System.out.println(data.getPlaces(div_name));
ArrayAdapter<String> adapter = new ArrayAdapter<String> (DivisionActivity.this, android.R.layout.simple_list_item_1, data.getPlaces(div_name));
placeList.setAdapter(adapter);
}
项目:My-Day
文件:DayView.java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_day_view);
DisplayMetrics dm = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(dm);
int width = dm.widthPixels;
int height = dm.heightPixels;
getWindow().setLayout((int) (width*.80), (int) (height*.80));
dateText = (TextView) findViewById(R.id.tasklist_date);
list = (ListView) findViewById(R.id.task_list);
db = new DatabaseHandler(getApplicationContext());
adapter = new TaskListAdapter(this, R.layout.task_row, db.getTaskOfDate(getIntent().getStringExtra("date")));
list.setAdapter(adapter);
adapter.notifyDataSetChanged();
}
项目:EasyUpdateApplication
文件:ms_AlertDialog.java
private void initAlertDialog(Context context)
{
layout = LayoutInflater.from(context).inflate(R.layout.ms_dialog, null);
custom_view = (ViewGroup)layout.findViewById(R.id.id_custom_view);
title = (TextView)layout.findViewById(R.id.id_title);
content = (TextView)layout.findViewById(R.id.id_content_text);
button_bar = (LinearLayout)layout.findViewById(R.id.bar_button);
positive = (Button)layout.findViewById(R.id.button_positive);
negative = (Button)layout.findViewById(R.id.button_negative);
scroll = (ScrollView)layout.findViewById(R.id.id_scroll);
list = (ListView)layout.findViewById(R.id.id_list);
recycler = (RecyclerView)layout.findViewById(R.id.id_recycler);
builder = new AlertDialog.Builder(context)
.setView(layout);
dialog = builder.create();
dialog.show();
}
项目:Plus1s
文件:LostViewActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_lost_view);
final TextView lost_view_back = (TextView) findViewById(R.id.lost_view_back);
lost_view_list = (ListView) findViewById(R.id.lost_view_list);
final Animation fade_in_anim = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.fade_in);
lost_view_list.setAnimation(fade_in_anim);
ArrayAdapter<String> adapter = new ArrayAdapter(this, android.R.layout.simple_spinner_item, displayLostItem());
lost_view_list.setAdapter(adapter);
lost_view_back.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
goToMain();
}
});
}
项目:iosched-reader
文件:CollectionView.java
public CollectionView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
setAdapter(new MyListAdapter());
setDivider(null);
setDividerHeight(0);
setItemsCanFocus(false);
setChoiceMode(ListView.CHOICE_MODE_NONE);
setSelector(android.R.color.transparent);
if (attrs != null) {
final TypedArray xmlArgs = context.obtainStyledAttributes(attrs,
R.styleable.CollectionView, defStyle, 0);
mInternalPadding = xmlArgs.getDimensionPixelSize(
R.styleable.CollectionView_internalPadding, 0);
mContentTopClearance = xmlArgs.getDimensionPixelSize(
R.styleable.CollectionView_contentTopClearance, 0);
xmlArgs.recycle();
}
}
项目:polling-station-app
文件:TransactionHistoryActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_transaction_history);
Toolbar appBar = (Toolbar) findViewById(R.id.app_bar);
setSupportActionBar(appBar);
Util.setupAppBar(appBar, this);
ListView transactionList = (ListView) findViewById(R.id.transaction_list);
// create a transaction history array with all the transactions and add them to the list
ArrayList<TransactionHistoryItem> transactionHistory = new ArrayList<>();
adapter = new TransactionsAdapter(this, transactionHistory);
transactionList.setAdapter(adapter);
// Load transactions in separate thread since this can take a while.
HandlerThread thread = new HandlerThread("transactions");
thread.start();
new Handler(thread.getLooper()).post(loadTransactions);
}
项目:eyeRS
文件:ShareActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
SettingUtilities.onActivityCreateSetTheme(this);
setContentView(R.layout.activity_share);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
ArrayList<ItemLabel> items = new ArrayList<>();
for (ItemLabel category : EyeRS.getCategoriesList(this)) {
for (ItemWrapper item : EyeRS.getItems(category.getName(), this)) {
items.add(new ItemLabel(item.getName(), item.getImage(), ""));
}
}
LabelAdapter adapter = new LabelAdapter(this, items);
listView = (ListView) findViewById(R.id.listView);
listView.setAdapter(adapter);
listView.setOnItemClickListener(this);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
Toast.makeText(this, "Please select the item you wish to share", Toast.LENGTH_LONG).show();
}
项目:Matrix-Calculator-for-Android
文件:TraceFragment.java
@Override
public void onListItemClick(ListView l, View v, int position, long id) {
ProgressDialog progressDialog = new ProgressDialog(getContext());
progressDialog.setMessage(getString(R.string.Calculating));
progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
progressDialog.setIndeterminate(true);
progressDialog.setCanceledOnTouchOutside(false);
progressDialog.show();
RunToGetTrace(position, progressDialog);
}
项目:AC2RD
文件:Filters.java
public boolean setCursorAdapter()
{
try
{
startManagingCursor(cursor);
listView = (ListView) findViewById(android.R.id.list);
simpleCursorAdapter = new SimpleCursorAdapter(this, R.layout.filter, cursor, from, to);
simpleCursorAdapter.setViewBinder(new ViewBinder()
{
public boolean setViewValue(View aView, Cursor aCursor, int aColumnIndex)
{
return setFilterViewValue(aView, aCursor, aColumnIndex);
}
});
listView.setAdapter(simpleCursorAdapter);
return true;
}
catch (Exception e)
{
return false;
}
}
项目:Android_RuuvitagScannner
文件:ListActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_list);
ruuvitagArrayList = new ArrayList<>();
settings = PreferenceManager.getDefaultSharedPreferences(this);
handler = new DBHandler(getApplicationContext());
db = handler.getReadableDatabase();
cursor = db.rawQuery("SELECT * FROM " + DBContract.RuuvitagDB.TABLE_NAME, null);
beaconListView = (ListView)findViewById(R.id.listView);
adapter = new listAdapter(ruuvitagArrayList, this);
beaconListView.setAdapter(adapter);
savedTags = getSharedPreferences("saved_tags", MODE_PRIVATE);
gson = new Gson();
beaconListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
Intent intent = new Intent(ListActivity.this, ScannerService.class);
Ruuvitag temp = (Ruuvitag) adapterView.getItemAtPosition(i);
intent.putExtra("favorite", temp);
startService(intent);
finish();
}
});
}
项目:InstagramManager-Android
文件:FollowActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_follow);
list.add(new Follow("A","B",""));
list.add(new Follow("AB","BC",""));
ListAdapter adapter=new ListAdapter();
listView=(ListView)findViewById(R.id.list);
listView.setAdapter(adapter);
}
项目:buildAPKsApps
文件:BarrageList.java
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.barrage_list);
ListView listView = getListView();
LayoutInflater inflater = LayoutInflater.from(this);
BarrageHeaderView headerView = (BarrageHeaderView)inflater.inflate(R.layout.barrage_header_view, listView, false);
headerView.bind(getString(R.string.menu_new_barrage), getString(R.string.create_new_barrage));
listView.addHeaderView(headerView, null, true);
//UI Preview
/*BarrageHeaderView item1 = (BarrageHeaderView)inflater.inflate(R.layout.barrage_header_view, listView, false);
item1.bind(this, new BarrageHeader("Testing 1, 2, 3...", BarrageHeader.STATUS_RUNNING, 43, 12));
listView.addHeaderView(item1, null, true);
BarrageHeaderView item4 = (BarrageHeaderView)inflater.inflate(R.layout.barrage_header_view, listView, false);
item4.bind(this, new BarrageHeader("Another Barrage", BarrageHeader.STATUS_PAUSED, 123, 64));
listView.addHeaderView(item4, null, true);
BarrageHeaderView item2 = (BarrageHeaderView)inflater.inflate(R.layout.barrage_header_view, listView, false);
item2.bind(this, new BarrageHeader("Pie Day", BarrageHeader.STATUS_QUEUED, 43, 12));
listView.addHeaderView(item2, null, true);
BarrageHeaderView item3 = (BarrageHeaderView)inflater.inflate(R.layout.barrage_header_view, listView, false);
item3.bind(this, new BarrageHeader("Some Name", BarrageHeader.STATUS_DRAFT, 160, 12));
listView.addHeaderView(item3, null, true);*/
setListAdapter(new BarrageListAdapter(this, null, true));
if (savedInstanceState != null) {
//do something
}
}
项目:WarningSystemWeather-Android-App
文件:ListFragment.java
@Override
public void onListItemClick(ListView l, View v, int position, long id) {
super.onListItemClick(l, v, position, id);
if (mListAsync.mWarningses == null) {
} else {
String url = mListAsync.mWarningses[position].getLink();
OnRecipeSelectedInterface listener = (OnRecipeSelectedInterface) getActivity();
listener.onListRecipeSelected(position, url);
}
}
项目:Renrentou
文件:CitySelectFragment.java
private void initProvince(){
provinceListView = (ListView)popupView.findViewById(R.id.province_list);
provinceAdapter = new ProvinceAdapter(getActivity());
provinceListView.setAdapter(provinceAdapter);
provinceListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
Province province = getDefaultProvince();
if(i != 0){
province = provinceList.get(i-1);
}else{
}
if(!currentProvince.getAreaId().equals(province.getAreaId())){
currentProvince = province;
cityList = province.getCities();
currentCity = getDefaultCity();
countyList.clear();
currentCounty = getDefaultCounty();
provinceAdapter.notifyDataSetChanged();
cityAdapter.notifyDataSetChanged();
countyAdapter.notifyDataSetChanged();
}
}
});
}
项目:Misc
文件:CallHistoryActivity.java
@Override
protected void onListItemClick(ListView lv, View view, int position, long
id) {
super.onListItemClick(lv, view, position, id);
// Save the position when starting the activity
mCurrentPosition = position;
mCurrentId = id;
mIncrement = 0;
displayCall();
}
项目:UnversityFinance
文件:NoticeListActivity.java
private void initView() {
mActionBarTitle.setText(R.string.title_notice_list);
mListView = (ListView) findViewById(R.id.list_view);
mListView.setOnItemClickListener(this);
mRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipe_refresh);
mRefreshLayout.setColorSchemeResources(R.color.colorPrimaryDark);
mRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
refreshList();
}
});
}
项目:XERUNG
文件:Profession.java
private void findViewids(View view) {
this.view = view;
listview = (ListView)view.findViewById(R.id.lvList);
listview1 = (ListView)view.findViewById(R.id.lvList1);
layMain = (LinearLayout)view.findViewById(R.id.layMain);
txtnorecord = (TextView)view.findViewById(R.id.txtnorecord);
relProgress = (RelativeLayout)view.findViewById(R.id.layProgressresult);
}
项目:iosched-reader
文件:MapInfoFragment.java
@Nullable
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState, int layout) {
View root = inflater.inflate(layout, container, false);
mTitle = (TextView) root.findViewById(R.id.map_info_title);
mSubtitle = (TextView) root.findViewById(R.id.map_info_subtitle);
mIcon = (ImageView) root.findViewById(R.id.map_info_icon);
mIcon.setColorFilter(getResources().getColor(R.color.my_schedule_icon_default));
mList = (ListView) root.findViewById(R.id.map_info_list);
mList.setOnItemClickListener(mListClickListener);
return root;
}
项目:Android-DFU-App
文件:UARTLogFragment.java
@Override
public void onSaveInstanceState(final Bundle outState) {
super.onSaveInstanceState(outState);
// Save the last log list view scroll position
final ListView list = getListView();
final boolean scrolledToBottom = list.getCount() > 0 && list.getLastVisiblePosition() == list.getCount() - 1;
outState.putInt(SIS_LOG_SCROLL_POSITION, scrolledToBottom ? LOG_SCROLLED_TO_BOTTOM : list.getFirstVisiblePosition());
}
项目:rental-calc
文件:PropertiesListActivityTest.java
@Test
public void clickPropertyLaunchesActivity()
{
db.insertProperty(new Property());
ActivityController controller = Robolectric.buildActivity(PropertiesListActivity.class).create();
Activity activity = (Activity)controller.get();
controller.start();
controller.visible();
controller.resume();
ListView list = (ListView)activity.findViewById(R.id.list);
ShadowListView shadowList = shadowOf(list);
shadowList.populateItems();
assertEquals(1, list.getCount());
shadowList.performItemClick(0);
assertTrue(activity.isFinishing() == false);
Intent next = shadowOf(activity).getNextStartedActivity();
ComponentName componentName = next.getComponent();
String name = componentName.flattenToShortString();
assertEquals("protect.rentalcalc/.PropertyOverviewActivity", name);
Bundle extras = next.getExtras();
assertNotNull(extras);
assertTrue(extras.containsKey("id"));
assertEquals(DatabaseTestHelper.FIRST_ID, extras.getLong("id"));
}
项目:android-app-aam
文件:FragmentFriends.java
private void populateFriendList(View rootView) {
// Construct the data source
ArrayList<Friend> arrayOfUsers = Friend.getFriends();
// Create the adapter to convert the array to views
CustomFriendAdapter adapter = new CustomFriendAdapter (getActivity(), arrayOfUsers);
// Attach the adapter to a ListView
ListView listView = (ListView) rootView.findViewById (R.id.lvFriends);
listView.setAdapter(adapter);
}