private void initViews() { myTitleBarHelper = new MyTitleBarHelper(this, getWindow().getDecorView().findViewById(android.R.id.content)); myTitleBarHelper.setLeftImgVisible(false); myTitleBarHelper.resetState(); myTitleBarHelper.setMiddleText("查询历史"); myTitleBarHelper.setRightImgVisible(false); myTitleBarHelper.setLeftImag(R.mipmap.btn_back); refreshLayout_no_receive = (SwipeRefreshLayout) findViewById(R.id.swipe_no_receive_layout); refreshLayout_no_receive.setColorSchemeResources(R.color.repair_line_color); refreshLayout_received = (SwipeRefreshLayout) findViewById(R.id.swipe_received_layout); refreshLayout_received.setColorSchemeResources(R.color.repair_line_color); express_no_receive = (Button) findViewById(R.id.express_no_receive); btn_express_received = (Button) findViewById(R.id.btn_express_received); empty_list_view = (TextView) findViewById(R.id.empty_list_view); lv_no_receive = (ListView) findViewById(R.id.lv_no_receive); lv_no_receive.setEmptyView(empty_list_view); lv_received = (ListView) findViewById(R.id.lv_received); lv_received.setEmptyView(empty_list_view); footBar = LayoutInflater.from(this).inflate(R.layout.item_progressbar, null); lv_no_receive.addFooterView(footBar); lv_received.addFooterView(footBar); mFootBarView = new FootBarHelper(footBar, this); mFootBarView.hideFooter(); }
private void ensureList() { if (mList != null) { return; } View root = getView(); if (root == null) { throw new IllegalStateException("Content view not yet created"); } if (root instanceof ListView) { mList = (ListView) root; } else { mStandardEmptyView = (TextView) root.findViewById(INTERNAL_EMPTY_ID); if (mStandardEmptyView == null) { mEmptyView = root.findViewById(android.R.id.empty); } else { mStandardEmptyView.setVisibility(View.GONE); } mProgressContainer = root.findViewById(INTERNAL_PROGRESS_CONTAINER_ID); mListContainer = root.findViewById(INTERNAL_LIST_CONTAINER_ID); View rawListView = root.findViewById(android.R.id.list); if (!(rawListView instanceof ListView)) { if (rawListView == null) { throw new RuntimeException( "Your content must have a ListView whose id attribute is " + "'android.R.id.list'"); } throw new RuntimeException( "Content has view with id attribute 'android.R.id.list' " + "that is not a ListView class"); } mList = (ListView) rawListView; if (mEmptyView != null) { mList.setEmptyView(mEmptyView); } else if (mEmptyText != null) { mStandardEmptyView.setText(mEmptyText); mList.setEmptyView(mStandardEmptyView); } } mListShown = true; mList.setOnItemClickListener(mOnClickListener); if (mAdapter != null) { ListAdapter adapter = mAdapter; mAdapter = null; setListAdapter(adapter); } else { // We are starting without an adapter, so assume we won't // have our data right away and start with the progress indicator. if (mProgressContainer != null) { setListShown(false, false); } } mHandler.post(mRequestFocus); }
protected void onCreateView(LayoutInflater inflater, ViewGroup container) { mView = inflateView(inflater, container); mListView = (ListView) mView.findViewById(android.R.id.list); if (mListView == null) { throw new RuntimeException( "Your content must have a ListView whose id attribute is " + "'android.R.id.list'"); } View emptyView = mView.findViewById(android.R.id.empty); if (emptyView != null) { mListView.setEmptyView(emptyView); } mListView.setOnItemClickListener(this); mListView.setOnFocusChangeListener(this); mListView.setOnTouchListener(this); mListView.setFastScrollEnabled(!isSearchMode()); // Tell list view to not show dividers. We'll do it ourself so that we can *not* show // them when an A-Z headers is visible. mListView.setDividerHeight(0); // We manually save/restore the listview state mListView.setSaveEnabled(false); configureVerticalScrollbar(); configurePhotoLoader(); }
@Override public View onCreateView( LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View v = inflater.inflate(R.layout.frag_tab_trend, container, false); listView = (ListView) v.findViewById(R.id.tab_trend_list); trendDataSource = new TrendDataSource(getActivity().getApplicationContext()); Date today = MyApplication.getTodayDate(); String order = DbTrend.COLUMN_COUNT + " DESC"; String limit = "50"; trendDataSource.open(); trendList = trendDataSource.getTrendsByDate(limit, order, today.getTime()); trendDataSource.close(); adapter = new FragTabTrendsAdapter( getActivity().getApplicationContext(), inflater, R.layout.frag_tab_trend_item_row, trendList); listView.setEmptyView(v.findViewById(R.id.emptyElement)); listView.setAdapter(adapter); return v; }
@Override public void onResponse(JSONObject response) { mProgressBar.setVisibility(View.INVISIBLE); parseJSONObject(response); mListView.setEmptyView(mEmptyView); setListViewAdapter(); }
private void setupListViewEvents() { int now = (int) (new Date().getTime() / 1000); if (setupListViewEventsFinished != null && setupListViewEventsFinished > now - 100) return; setupListViewEventsFinished = now; ListView lv = (ListView) findViewById(R.id.listview_events); lv.setEmptyView(findViewById(R.id.listview_events_empty)); lv.setOnItemClickListener( new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View view, int arg2, long event__id) { contentSupport.onEventItemClick(MainActivitySmartphone.this, view); } }); contentSupport.setupListEventsAdapter(lv); AsyncQueryHandler queryHandler = new AsyncQueryHandler(getContentResolver()) { @Override protected void onQueryComplete(int token, Object cookie, Cursor cursor) { startManagingCursor(cursor); ListView lv = (ListView) findViewById(R.id.listview_events); ResourceCursorAdapter adapter = (ResourceCursorAdapter) lv.getAdapter(); adapter.changeCursor(cursor); hideLoading(); } }; queryHandler.startQuery( 0, null, ZabbixContentProvider.CONTENT_URI_EVENTS, null, null, null, null); showLoading(); }
@Override public void onCreate(Bundle b) { super.onCreate(b); setContentView(R.layout.activity_ignore_list); context = this; setTitle("차단된 전화번호"); getSupportActionBar().setDisplayHomeAsUpEnabled(true); pref = new BlockNumberPref(this); ListView lvIgnore = (ListView) findViewById(R.id.lv_ignore); adapter = new BlockedNumberAdapter(getBaseContext(), 0); lvIgnore.setAdapter(adapter); lvIgnore.setOnItemClickListener(this); lvIgnore.setEmptyView(getLayoutInflater().inflate(R.layout.item_nodata, null)); cbAll = (CheckBox) findViewById(R.id.cb_item_delete); cbAll.setOnCheckedChangeListener( new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { adapter.setAllChecked(isChecked); adapter.notifyDataSetChanged(); } }); findViewById(R.id.btn_block_add) .setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { NumberAddDialog d = new NumberAddDialog(context); d.show(); d.setOnDismissListener( new DialogInterface.OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { storeData(); } }); } }); findViewById(R.id.btn_block_del) .setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { for (int i = 0; i < adapter.getCheckedItemPosition().size(); i++) { int delPosition = adapter.getCheckedItemPosition().get(i); pref.deleteBlockNumberData(array.get(delPosition)); } adapter.setAllChecked(false); storeData(); } }); }
/** Show the last element in the list of adapters */ private void showList() { if (mAdapters.isEmpty() || mAdapters.getLast().isEmpty()) { mList.setEmptyView(mEmptyLibrary); } else { LibraryAdapter adapter = mAdapters.getLast(); adapter.getFilter().filter(mLastFilter); mList.setAdapter(adapter); if (adapter.isEmpty() || adapter.getCount() == 0) { buildSubActionBar("", ""); } else { MyLibraryItem item = adapter.getItem(0); switch (item.getLevel()) { case MyLibrary.LVL_ARTIST: buildSubActionBar("", ""); break; case MyLibrary.LVL_ALBUM: buildSubActionBar(item.getArtist(), ""); break; default: buildSubActionBar(item.getArtist(), item.getAlbum()); break; } } } }
private void init(LayoutInflater inflater) { new Thread( new Runnable() { @Override public void run() { playbackService = PlaybackService.get(getContext()); } }) .start(); view = (ViewGroup) inflater.inflate(getLayoutId(), null); listView = getListView(view); emptyMessage = getMessageView(view); adapter = getAdapter(inflater.getContext()); listView.setAdapter(adapter); playLastPlaylist = view.findViewById(R.id.lastPlayedPlaylist); createNewPlayList = view.findViewById(R.id.createNewPlaylist); animateListView(listView, adapter); initListeners(); updatePlaylist(); if (adapter.isEmpty()) { listView.setEmptyView(emptyMessage); } adapter.getCount(); }
@Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); ButterKnife.inject(this, view); listView.setEmptyView(emptyView); listView.setAdapter(adapter); }
@Override public void onSuccess(int statusCode, Header[] headers, byte[] responseBody) { String content = new String(responseBody); try { boolean success = new JSONObject(content).optBoolean("success", false); String message = new JSONObject(content).optString("message"); String data = new JSONObject(content).optString("data"); if (!success) { MsgTools.toast(getActivity(), message, ResourceMap.LENGTH_SHORT); } else { List<MessageBean> messageList = new ArrayList<MessageBean>(); messageList.addAll( (List<MessageBean>) new Gson().fromJson(data, new TypeToken<List<MessageBean>>() {}.getType())); // 数据从未读数开始排序 // ComparatorNoRead comparator = new ComparatorNoRead(); // Collections.sort(messageList, comparator); kzxMessageAdapter.setDataForLoader(messageList); if (kzxMessageAdapter.isEmpty()) { dateCustomList.setEmptyView(img_empty_feed); } } } catch (Exception e) { e.printStackTrace(); MsgTools.toast( getActivity(), getString(R.string.request_error), ResourceMap.LENGTH_SHORT); } }
private void showNotOnlineNotification(View V) { if (getView() != null) { V = getView(); } progressBarRecentShows = (ProgressBar) V.findViewById(R.id.progressBar_recent_shows); progressBarRecentShows.setVisibility(View.GONE); listViewRecentShows = (ListView) V.findViewById(R.id.listview_recent_shows); final View emptyView = getActivity().getLayoutInflater().inflate(R.layout.empty_list, null); ((ViewGroup) listViewRecentShows.getParent()).addView(emptyView); listViewRecentShows.setEmptyView(emptyView); buttonRefresh = (Button) V.findViewById(R.id.button_refresh); buttonRefresh.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { ((ViewGroup) listViewRecentShows.getParent()).removeView(emptyView); progressBarRecentShows.setVisibility(View.VISIBLE); startRetrievingOnlineData(v); } }); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); actionBar = getActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setTitle("WOW"); view = new CustomView(getApplicationContext(), actionBar); setContentView(view); view.setRefreshListner(SampleForGmailLikePullToRefresh.this); view.setActionBar(SampleForGmailLikePullToRefresh.this); mListView = view.getListView(); list = new ArrayList<Integer>(); adapter = new DummyAdapter(SampleForGmailLikePullToRefresh.this, 0, list); LayoutInflater layoutInflater = (LayoutInflater) SampleForGmailLikePullToRefresh.this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View loadingView = layoutInflater.inflate(R.layout.view_listview_loading, null); RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT); params.setMargins(0, 5, 0, 0); loadingView.setLayoutParams(params); mListView.setEmptyView(null); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.file_select_layout); msisdn = getIntent().getStringExtra(HikeConstants.Extras.MSISDN); items = (ArrayList<FileListItem>) HikeConversationsDatabase.getInstance() .getSharedMedia(msisdn, HikeConstants.MAX_MEDIA_ITEMS_TO_LOAD_INITIALLY, -1, false); listAdapter = new FileListAdapter(this, items); emptyView = (TextView) findViewById(R.id.search_empty_view); listView = (ListView) findViewById(R.id.file_list); listView.setEmptyView(emptyView); listView.setAdapter(listAdapter); listView.setOnItemClickListener( new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) { FileListItem item = items.get(i); HikeFile.openFile( item.getFile(), item.getHikeSharedFile().getFileTypeString(), SharedOtherFilesActivity.this); } }); listView.setOnScrollListener(this); setupActionBar(); }
@Override View getContentView(PagerAdapter pages) { FrameLayout result = new FrameLayout(helper.getHost()); master = buildListView(helper.getHost()); result.addView( master, new FrameLayout.LayoutParams( FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT)); View listEmptyView = helper.buildListEmptyView(); result.addView( listEmptyView, new FrameLayout.LayoutParams( FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.WRAP_CONTENT, Gravity.CENTER)); master.setEmptyView(listEmptyView); detail = buildViewPager(helper.getHost(), pages); detail.setOnPageChangeListener(this); showMaster(); result.addView( detail, new FrameLayout.LayoutParams( FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT)); return (result); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_measures_list); app = (MyExApp) getApplication(); mAdapter = new MeasuresAdapter(app, this, app.getDataManager().getMeasures(null, null)); // Click on list mListView = (ListView) findViewById(android.R.id.list); mListView.setEmptyView(findViewById(android.R.id.empty)); mListView.setClickable(true); mListView.setOnItemClickListener( new AdapterView.OnItemClickListener() { public void onItemClick(AdapterView<?> arg0, View arg1, int position, long id) { Measure measure = (Measure) mAdapter.getItem(position); Intent intent = new Intent(MeasuresActivity.this, MeasuresEditActivity.class); intent.putExtra("id", measure.getId()); startActivityForResult(intent, 0); } }); // Fill the list mAdapter = new MeasuresAdapter(app, this, app.getDataManager().getMeasures(null, null)); mListView.setAdapter(mAdapter); }
// Done per ListaGruppiAT public void done(boolean res, List<InfoGruppoBean> listaGruppi) { if (res && listaGruppi != null) { groupslist = listaGruppi; // Chiamo l'adapter adapterGroups = new CustomListGroups(RicercaGruppoActivity.this, groupslist); nomigruppi = new String[groupslist.size()]; aperti = new boolean[groupslist.size()]; citta = new String[groupslist.size()]; ids = new Long[groupslist.size()]; for (int i = 0; i < groupslist.size(); i++) { nomigruppi[i] = groupslist.get(i).getNome(); aperti[i] = groupslist.get(i).getAperto(); citta[i] = groupslist.get(i).getCitta(); ids[i] = groupslist.get(i).getId(); } myList = (ListView) findViewById(R.id.listView1); emptyText = (TextView) findViewById(android.R.id.empty); myList.setEmptyView(emptyText); myList.setAdapter(adapterGroups); } // this.nameCapture.setFocusable(true); // this.nameCapture.setClickable(true); this.progressView.setVisibility(View.GONE); }
private void fillData() { getLoaderManager().initLoader(0, null, this); adapter = new SimpleCursorAdapter( this, android.R.layout.simple_list_item_1, null, // null cursor to start with, because it will get swapped in when load finished new String[] {"name"}, new int[] {android.R.id.text1}, 0); ListView listView = (ListView) findViewById(R.id.lists); listView.setAdapter(adapter); listView.setEmptyView(findViewById(R.id.empty_lists)); final ListOverviewActivity that = this; listView.setOnItemClickListener( new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Intent i = new Intent(that, ListDetailActivity.class); Uri listUri = Uri.parse(ListContentProvider.CONTENT_URI + "/" + id); i.putExtra(ListContentProvider.CONTENT_ITEM_TYPE, listUri); startActivity(i); } }); }
@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final View view = inflater.inflate(R.layout.account_settings_edit_quick_responses_fragment, container, false); final ListView listView = UiUtilities.getView(view, R.id.account_settings_quick_responses_list); final TextView emptyView = UiUtilities.getView((ViewGroup) listView.getParent(), R.id.empty_view); listView.setEmptyView(emptyView); listView.setOnItemClickListener( new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { final Cursor c = (Cursor) listView.getItemAtPosition(position); final String quickResponseText = c.getString(c.getColumnIndex(UIProvider.QuickResponseColumns.TEXT)); final Uri uri = Utils.getValidUri( c.getString(c.getColumnIndex(UIProvider.QuickResponseColumns.URI))); EditQuickResponseDialog.newInstance(quickResponseText, uri, false) .show(getFragmentManager(), null); } }); return view; }
private void ensureList(View rootView) { if (mListView != null || rootView == null) { return; } mCitySelectView = rootView.findViewById(R.id.common_city_selected); mStandardEmptyView = (TextView) rootView.findViewById(android.R.id.empty); mProgressContainer = rootView.findViewById(R.id.progressContainer); ImageView ivProgress = (ImageView) rootView.findViewById(R.id.iv_progress); ivProgress.setBackgroundResource(R.drawable.animation_progress); animationDrawable = (AnimationDrawable) ivProgress.getBackground(); mListContainer = rootView.findViewById(R.id.listContainer); mListView = (ListView) rootView.findViewById(android.R.id.list); if (mListView == null) { throw new RuntimeException( "Your content must have a ListView whose id attribute is " + "'android.R.id.list'"); } mListView.setOnScrollListener(new PauseOnScrollListener(true, false)); mStandardEmptyView.setText(mEmptyText); mListView.setEmptyView(mStandardEmptyView); mListShown = true; mListView.setOnItemClickListener(mOnClickListener); if (mProgressContainer != null) { setListShown(false, false); } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.physical_web_list_urls_activity); mAdapter = new NearbyUrlsAdapter(this); View emptyView = findViewById(R.id.physical_web_empty); mListView = (ListView) findViewById(R.id.physical_web_urls_list); mListView.setEmptyView(emptyView); mListView.setAdapter(mAdapter); mListView.setOnItemClickListener(this); mEmptyListText = (TextView) findViewById(R.id.physical_web_empty_list_text); mScanningImageView = (ImageView) findViewById(R.id.physical_web_logo); mSwipeRefreshWidget = (SwipeRefreshWidget) findViewById(R.id.physical_web_swipe_refresh_widget); mSwipeRefreshWidget.setOnRefreshListener(this); mPwsClient = new PwsClientImpl(); int referer = getIntent().getIntExtra(REFERER_KEY, 0); if (savedInstanceState == null // Ensure this is a newly-created activity. && referer == NOTIFICATION_REFERER) { PhysicalWebUma.onNotificationPressed(this); } mIsInitialDisplayRecorded = false; mIsRefreshing = false; mIsRefreshUserInitiated = false; }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_daily_forecast); ButterKnife.bind(this); Intent intent = getIntent(); mLocation = intent.getStringExtra(getString(R.string.location_name)); Parcelable[] parcelables = intent.getParcelableArrayExtra(MainActivity.DAILY_FORECAST); mDays = Arrays.copyOf(parcelables, parcelables.length, Day[].class); mLocationLabel.setText(String.valueOf(mLocation)); DayAdapter adapter = new DayAdapter(this, mDays); mListView.setAdapter(adapter); mListView.setEmptyView(mEmptyTextView); mListView.setOnItemClickListener( new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { String dayOfTheWeek = mDays[position].getDayOfTheWeek(); String conditions = mDays[position].getSummary(); String highTemp = mDays[position].getTemperatureMax() + ""; String lowTemp = mDays[position].getTemperatureMin() + ""; String message = String.format( "%s - High: %s, Low: %s, and %s", dayOfTheWeek, highTemp, lowTemp, conditions); Toast.makeText(DailyForecastActivity.this, message, Toast.LENGTH_LONG).show(); } }); }
/** 通讯模块,通知,聊天,球队没有数据的时候提示方法 */ public void setEmptyView(ListView lv, View emptyView, int res) { ViewGroup parentView = (ViewGroup) lv.getParent(); parentView.addView(emptyView); TextView warn = (TextView) emptyView.findViewById(R.id.empty_view_nearby_tv); warn.setText(res); lv.setEmptyView(emptyView); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_header); mHeaderList = (ListView) findViewById(R.id.header_list); mHeaderList.setEmptyView(findViewById(R.id.empty_text)); final HeaderAdapter adapter = new HeaderAdapter(this); mHeaderList.setAdapter(adapter); mHeaderList.setOnItemClickListener(new HeaderClickListener()); if (savedInstanceState == null) { VolleyHelper helper = VolleyHelper.createInstance(this); helper.requestHeaders( new HeadersCallback() { @Override public void execute(List<Header> headers) { mHeaders = new ArrayList<>(headers); refreshListView(adapter); reloadLessonsIfNeed(); } }); } else { Icepick.restoreInstanceState(this, savedInstanceState); refreshListView(adapter); reloadLessonsIfNeed(); } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.setContentView(R.layout.trans_list); this.findViewById(R.id.topInfoView); ((TextView) this.findViewById(R.id.titleView)).setText(R.string.historyGroup); backButton = (Button) this.findViewById(R.id.backButton); backButton.setOnClickListener(this); listView = (ListView) this.findViewById(R.id.transList); // 生成适配器的Item和动态数组对应的元素 SimpleAdapter listItemAdapter = new SimpleAdapter( this, mapList, R.layout.querytransgroup_listitem, new String[] {"tranCode", "tranName", "total", "amount"}, new int[] {R.id.groupTypeID, R.id.groupType, R.id.groupCount, R.id.groupAmount}); listView.setAdapter(listItemAdapter); listView.setOnItemClickListener(this); // 设置EmptyView ImageView emptyView = new ImageView(QueryTransferHistoryGroupActivity.this); emptyView.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); emptyView.setImageResource(R.drawable.nodata); emptyView.setScaleType(ScaleType.CENTER_INSIDE); ((ViewGroup) listView.getParent()).addView(emptyView); listView.setEmptyView(emptyView); // 设置数据 try { String content = this.getIntent().getStringExtra("detail"); String[] items = content.split("\\|"); for (String item : items) { HashMap<String, String> tempMap = new HashMap<String, String>(); String[] detail = item.split("\\^"); for (String str : detail) { String[] fieldArray = str.split(":"); if (fieldArray.length == 1) { tempMap.put(fieldArray[0], ""); } else if (fieldArray.length == 2) { tempMap.put(fieldArray[0], fieldArray[1]); } tempMap.put("tranName", AppDataCenter.getTransferName(tempMap.get("tranCode"))); } mapList.add(tempMap); } ((SimpleAdapter) listView.getAdapter()).notifyDataSetChanged(); } catch (Exception e) { e.printStackTrace(); } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.select_recipients_list_screen); if (savedInstanceState != null) { mMode = savedInstanceState.getInt(MODE); } else { mMode = getIntent().getIntExtra(MODE, MODE_INFO); } if (mMode == MODE_INFO || mMode == MODE_VCARD) { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); prefs.edit().putBoolean(PREF_SHOW_GROUPS, false).commit(); } else { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); prefs.edit().putBoolean(PREF_SHOW_GROUPS, true).commit(); } switch (mMode) { case MODE_INFO: setTitle(R.string.attach_add_contact_as_text); break; case MODE_VCARD: setTitle(R.string.attach_add_contact_as_vcard); break; default: // leave it be } mProgressSpinner = findViewById(R.id.progress_spinner); // List view ListView listView = getListView(); if (mMode == MODE_VCARD) { listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE); } else { listView.setChoiceMode(ListView.CHOICE_MODE_NONE); } listView.setFastScrollEnabled(true); listView.setFastScrollAlwaysVisible(true); listView.setDivider(null); listView.setDividerHeight(0); listView.setEmptyView(findViewById(R.id.empty)); listView.setOnItemClickListener(this); // Get things ready mCheckedPhoneNumbers = new HashSet<PhoneNumber>(); mLocalGroups = new HashSet<Group>(); getLoaderManager().initLoader(0, null, this); ActionBar mActionBar = getActionBar(); if (mActionBar != null) { mActionBar.setDisplayHomeAsUpEnabled(true); } }
@Override public void onCreate(Bundle savedState) { super.onCreate(savedState); thumbSize = getResources().getInteger(R.integer.config_list_thumb_size); if (savedState != null) { String cropTempPath = savedState.getString("crop_temp"); if (cropTempPath != null) cropTemp = new File(cropTempPath); pickedRawContact = savedState.getInt("picked_raw_contact", 0); } // Initialize cache directory new File(getCacheDir(), DISK_CACHE_DIR).mkdir(); unchangedThumb = new BitmapDrawable(getResources(), Bitmap.createBitmap(1, 1, Config.ALPHA_8)); setContentView(R.layout.activity_assign_contact_photo); contactList = (ListView) findViewById(R.id.contactList); emptyList = (TextView) findViewById(R.id.empty); loadingProgress = (ProgressBar) findViewById(R.id.loading); contactList.setEmptyView(loadingProgress); contactList.setAdapter(new ContactAdapter()); contactList.setDividerHeight(1); contactList.setMultiChoiceModeListener(new ContactListMultiChoiceModeListener()); contactList.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE_MODAL); getActionBar().setDisplayHomeAsUpEnabled(true); account = getIntent().getStringExtra("account"); setTitle(account); thumbMemCache = new SparseArray<Drawable>(); asyncTasks = new HashSet<AsyncTask<?, ?, ?>>(); defaultThumb = getResources().getDrawable(R.drawable.new_picture); contactList.setOnItemClickListener( new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View view, int position, long id) { pickedRawContact = ((Contact) contactList.getItemAtPosition(position)).rawContactId; Intent intent = new Intent(); // We only really accept PNG and JPEG but the activities registered for // the intended action only accept the generic form of the mime type. We // will check for our constraints after the image is picked. intent.setType("image/*"); intent.setAction(Intent.ACTION_GET_CONTENT); startActivityForResult( Intent.createChooser(intent, getResources().getString(R.string.select_picture)), REQ_CODE_PICK_IMAGE); } }); }
/** * 给List设置适配器 * * @param cardList */ private void setCardListAdapter(ArrayList<BankCardInfo> cardList) { if (cardList.size() == 0) { emptyView.setVisibility(View.VISIBLE); bankList.setEmptyView(emptyView); return; } CardListAdapter cardListAdapter = new CardListAdapter(getRootController(), cardList); bankList.setAdapter(cardListAdapter); }
/* (non-Javadoc) * @see android.support.v4.app.Fragment#onActivityCreated(android.os.Bundle) */ @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); usersAdapter = new UserListAdapter(getActivity(), channelUsersList, null); channelUsersList.setAdapter(usersAdapter); registerForContextMenu(channelUsersList); channelUsersList.setEmptyView(noUsersText); }
/** Reloads the current show and adds any new episodes to the list. */ private void reload() { if (refresh != null) refresh.setVisibility(View.GONE); loading.setVisibility(View.VISIBLE); mainListView.setEmptyView(loading); loading.setText(this.getResources().getString(R.string.loading)); setProgressBarIndeterminateVisibility(true); new UpdateShowTask().execute((Object[]) null); new GetShowTask().execute((Object[]) null); }