本文整理匯總了Java中com.handmark.pulltorefresh.library.PullToRefreshListView.setMode方法的典型用法代碼示例。如果您正苦於以下問題:Java PullToRefreshListView.setMode方法的具體用法?Java PullToRefreshListView.setMode怎麽用?Java PullToRefreshListView.setMode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.handmark.pulltorefresh.library.PullToRefreshListView
的用法示例。
在下文中一共展示了PullToRefreshListView.setMode方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: initTitleBar
import com.handmark.pulltorefresh.library.PullToRefreshListView; //導入方法依賴的package包/類
protected void initTitleBar() {
ptrListView = (PullToRefreshListView) this
.findViewById(R.id.book_source_list);
tv_current_booksource = (TextView) this
.findViewById(R.id.tv_current_booksource);
booksource_line = (View) this.findViewById(R.id.booksource_line);
tv_other_booksource = (TextView) this
.findViewById(R.id.tv_other_booksource);
ptrListView.setMode(Mode.DISABLED);
ptrListView.setOnItemClickListener(this);
mTitleBar = (BookTitleBar) this.findViewById(R.id.book_titleBar);
mTitleBar.setBackgroundColor(BookTheme.THEME_COLOR);
mTitleBar.setTitle("書籍換源");
mTitleBar.setRightLogoGone();
mTitleBar.setLeftDrawable(R.drawable.book_details_close);
mTitleBar.getLeftTextView().setOnClickListener(this);
}
示例2: onCreateView
import com.handmark.pulltorefresh.library.PullToRefreshListView; //導入方法依賴的package包/類
@SuppressLint("InflateParams")
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_select, null);
lv_select = (PullToRefreshListView) view.findViewById(R.id.lv_select);
lv_select.setMode(Mode.BOTH);
lv_select.setOnRefreshListener(new OnRefreshListener<ListView>() {
@Override
public void onRefresh(PullToRefreshBase<ListView> refreshView) {
if (refreshView.isHeaderShown()) {
lv_select.getLoadingLayoutProxy(false, true).setPullLabel("下拉可以刷新...");
lv_select.getLoadingLayoutProxy(false, true).setRefreshingLabel("正在刷新...");
lv_select.getLoadingLayoutProxy(false, true).setReleaseLabel("鬆開之後更新數據...");
getData();
} else {
lv_select.getLoadingLayoutProxy(false, true).setPullLabel("上拉加載更多...");
lv_select.getLoadingLayoutProxy(false, true).setRefreshingLabel("正在加載...");
lv_select.getLoadingLayoutProxy(false, true).setReleaseLabel("鬆開之後更新數據...");
getNextPage();
}
}
});
getData();
return view;
}
示例3: initView
import com.handmark.pulltorefresh.library.PullToRefreshListView; //導入方法依賴的package包/類
public void initView(View rootView) {
rootView.findViewById(R.id.back).setVisibility(View.GONE);
tvTitle = (TextView) rootView.findViewById(R.id.title);
tvTitle.setText("資訊中心");
emptyView = rootView.findViewById(R.id.empty);
newsList = (PullToRefreshListView) rootView.findViewById(R.id.newslist);
newsList.setOnItemClickListener(this);
newsList.setMode(Mode.BOTH);
newsList.setScrollingWhileRefreshingEnabled(false);
newsList.setOnRefreshListener(this);
newsList.setOnLastItemVisibleListener(this);
newsList.setEmptyView(emptyView);
}
示例4: onCreateView
import com.handmark.pulltorefresh.library.PullToRefreshListView; //導入方法依賴的package包/類
/**
* 在onCreate之後調用
* @param inflater
* @param container
* @param savedInstanceState
* @return
*/
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
view = inflater.inflate(R.layout.fragment_main, container, false);
mPullRefreshListView = (PullToRefreshListView)view.findViewById(R.id.messageList);
// 設置刷新模式
mPullRefreshListView.setMode(PullToRefreshBase.Mode.PULL_FROM_START);
// 設置列表內容
ListView actualListView = mPullRefreshListView.getRefreshableView();
//生成動態數組,並且轉入數據
itemsData = getMessages();
mAdapter= new SimpleAdapter(MainTabFragment.this.getActivity(), //沒什麽解釋
itemsData,//數據來源
R.layout.item_list_fragment_main,//XML實現
new String[]{"Avatar", "UserName", "Message", "Time", "Number"}, //動態數據KEY
new int[]{R.id.avatar, R.id.userName, R.id.message, R.id.time, R.id.number});
actualListView.setAdapter(mAdapter);
/*定義事件*/
mPullRefreshListView.setOnItemClickListener(new CustomOnItemClickListener());
mPullRefreshListView.setOnRefreshListener(new PullToRefreshBase.OnRefreshListener<ListView>() {
@Override
public void onRefresh(PullToRefreshBase<ListView> refreshView) {
// 異步獲取消息任務
new GetMessagesTask().execute();
}
});
return view;
}
示例5: onCreateView
import com.handmark.pulltorefresh.library.PullToRefreshListView; //導入方法依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View page = inflater.inflate(R.layout.fragment_userlist, container, false);
PullToRefreshListView listView = getListView(page);
UserListListAdapter adapter = getListAdapter((MainActivity) getActivity());
listView.setAdapter(adapter);
listView.setOnScrollListener(this);
listView.setOnRefreshListener(this);
listView.setMode(getRefreshMode());
ImageButton buttonUserLists = getUserListsButton(page);
buttonUserLists.setOnClickListener(this);
textListName = getTextListName(page);
textListName.setText(adapter.getListFullName());
return page;
}
示例6: onCreateView
import com.handmark.pulltorefresh.library.PullToRefreshListView; //導入方法依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View page = inflater.inflate(R.layout.fragment_list, container, false);
Bundle args = getArguments();
int fragmentIndex = args.getInt(ADAPTER_INDEX);
PullToRefreshListView listView = getListView(page);
ListAdapter adapter = getListAdapter(fragmentIndex);
listView.setAdapter(adapter);
listView.setOnScrollListener(this);
listView.setOnRefreshListener(this);
listView.setMode(getRefreshMode());
return page;
}
示例7: onCreate
import com.handmark.pulltorefresh.library.PullToRefreshListView; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle bundle) {
super.onCreate(bundle);
setContentView(R.layout.activity_fav);
mBottomPanelHeight = getResources().getDimensionPixelSize(R.dimen.bottom_panel_height);
mFooterView = new View(this);
mFooterView.setLayoutParams(new AbsListView.LayoutParams(AbsListView.LayoutParams.MATCH_PARENT,
mBottomPanelHeight));
mFavList = (PullToRefreshListView) findViewById(R.id.fav_list);
mFavList.setMode(Mode.DISABLED);
mFavAdapter = new FavAdapter();
mFavList.setAdapter(mFavAdapter);
mBottomPanel = findViewById(R.id.bottom_panel);
mSelectAll = findViewById(R.id.select_all);
mSelectAll.setOnClickListener(mSelectAllClickListener);
mConfirmDelete = findViewById(R.id.confirm_delete);
mConfirmDelete.setOnClickListener(mConfirmDeleteClickListener);
getFav();
}
示例8: onCreate
import com.handmark.pulltorefresh.library.PullToRefreshListView; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_android_pull_to_refresh_sample);
final PullToRefreshListView listView = (PullToRefreshListView) findViewById(R.id.list_view);
listView.setMode(Mode.PULL_FROM_START);
final List<String> items = new ArrayList<String>() {
private static final long serialVersionUID = 1L;
{
this.add("red");
this.add("yellow");
this.add("green");
}
};
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1, android.R.id.text1, items);
listView.setOnRefreshListener(new OnRefreshListener<ListView>() {
@Override
public void onRefresh(final PullToRefreshBase<ListView> refreshView) {
// リスト更新処理。一般的には通信処理や、データベースアクセスをする為別スレッドで実行する。
// ここではHandlerを使って1秒後にリストを更新する様にしている。
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
items.add("No." + (items.size() + 1));
refreshView.onRefreshComplete();
}
}, 1000);
}
});
listView.setAdapter(adapter);
}
開發者ID:android-opensource-library-56,項目名稱:android-opensource-library-56,代碼行數:33,代碼來源:AndroidPullToRefreshSampleActivity.java
示例9: initP2RLvAndThread
import com.handmark.pulltorefresh.library.PullToRefreshListView; //導入方法依賴的package包/類
void initP2RLvAndThread() {
// init p2r
p2r_lv = (PullToRefreshListView) this.findViewById(R.id.p2r_lv);
ListView listview = p2r_lv.getRefreshableView();
listview.setVerticalFadingEdgeEnabled(false);
p2r_lv.setMode(Mode.PULL_FROM_END);
p2r_lv.setShowIndicator(false);
p2r_lv.setOnItemClickListener(this);
p2r_lv.setOnRefreshListener(this);
p2r_lv.setAdapter(getAdapter());
// init msgHandler
Looper looper = Looper.myLooper();
msgHandler = new MessageHandler(looper);
}
示例10: onCreateView
import com.handmark.pulltorefresh.library.PullToRefreshListView; //導入方法依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
view = inflater.inflate(R.layout.whu_zheng_wen, container,false);
refreshView = (PullToRefreshListView)view.findViewById(R.id.whu_zheng_wen_list);
refreshView.setMode(Mode.BOTH);
actuallListView = refreshView.getRefreshableView();
registerForContextMenu(actuallListView);
new MyAsyncTask().execute(0);
initListView();
setListener();
return view;
}
示例11: onCreateView
import com.handmark.pulltorefresh.library.PullToRefreshListView; //導入方法依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_news_list, null);
// 注冊ListView
listView = (PullToRefreshListView) view.findViewById(R.id.newslist);
textView = (TextView) view.findViewById(R.id.textView_newslist_title);
// 獲取傳入的新聞地址和頻道
Bundle bundle = getArguments();
path = bundle.getString("path");
chnnel = bundle.getString("chnnel");
textView.setText(chnnel);
listView.setMode(Mode.PULL_FROM_START);
helper = new DataBaseHelper(getActivity());
// 把查詢總頁數放到這裏,每次進入該Fragment時查詢一次。
getTotalPage();
// 如果數據庫能夠獲取數據,直接加載
list.clear();
list = getDataFromDatabase(chnnel, currentPage);
// 先設置一個空的adapter,防止adapter.notifyDataChanged空指針異常.
adapter = new XMLNewsAdapter(getActivity(), list);
listView.setAdapter(adapter);
// 初始化進度條,首次進入沒有新聞的時候顯示一個進度條
dialog = new ProgressDialog(getActivity());
dialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
dialog.setTitle("正在加載");
dialog.setMessage("第一次加載較慢,請稍等一下");
if (list.isEmpty()) {
// 從網絡加載數據,並在本方法裏設置Adapter;
getDataFromVolley();
dialog.show();
}
// 設置Item點擊監聽
ItemListener();
// 設置滑動監聽
NextPage();
// 設置刷新監聽
refreshListener();
return view;
}
示例12: init
import com.handmark.pulltorefresh.library.PullToRefreshListView; //導入方法依賴的package包/類
void init() {
lv0 = (PullToRefreshListView) findViewById(R.id.every_day_push_list);
lv0.setMode(PullToRefreshBase.Mode.PULL_FROM_END);
lv0.setOnRefreshListener(new PullToRefreshBase.OnRefreshListener<ListView>() {
@Override
public void onRefresh(PullToRefreshBase<ListView> refreshView) {
Log.v("DEBUG list size", "" + listResource.size());
new LoadingTask().execute();
}
});
cr = getContentResolver();
cursor = cr.query(DataProviderMetaData.DataTableMetaData.CONTENT_URI, new String[]{"created", "modified", "title", "value", "begin",
"end", "finish", "kind", "call"}, "kind = " + KIND_ADVERTISE,
null, "begin DESC");
for(int i = 0;i < 6*5;i++)
if(cursor.moveToNext()) {
Bundle map = new Bundle();
long created, modified, begin, end, finish, kind, call;
String title, value;
created = cursor.getLong(cursor.getColumnIndex("created"));
modified = cursor.getLong(cursor.getColumnIndex("modified"));
title = cursor.getString(cursor.getColumnIndex("title"));
value = cursor.getString(cursor.getColumnIndex("value"));
begin = cursor.getLong(cursor.getColumnIndex("begin"));
end = cursor.getLong(cursor.getColumnIndex("end"));
finish = cursor.getLong(cursor.getColumnIndex("finish"));
kind = cursor.getLong(cursor.getColumnIndex("kind"));
call = cursor.getLong(cursor.getColumnIndex("call"));
map.putLong("created", created);
map.putLong("modified", modified);
map.putString("title", title);
map.putString("value", value);
map.putLong("begin", begin);
map.putLong("end", end);
map.putLong("finish", finish);
map.putLong("kind", kind);
map.putLong("call", call);
listResource.add(map);
Log.v("Debug", "in update" + listResource.size());
}
sa = new EveryDayPushListItemAdapter(this, listResource, R.layout.every_day_push_view_pager, null, null);
lv0.setAdapter(sa);
}
示例13: onCreate
import com.handmark.pulltorefresh.library.PullToRefreshListView; //導入方法依賴的package包/類
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_ptr_list);
mPullRefreshListView = (PullToRefreshListView) findViewById(R.id.pull_refresh_list);
// Set a listener to be invoked when the list should be refreshed.
mPullRefreshListView.setOnRefreshListener(new OnRefreshListener<ListView>() {
// ひっぱりきって指をはなしたとき?
@Override
public void onRefresh(PullToRefreshBase<ListView> refreshView) {
String label = DateUtils.formatDateTime(getApplicationContext(),
System.currentTimeMillis(),
DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_SHOW_DATE
| DateUtils.FORMAT_ABBREV_ALL);
// Update the LastUpdatedLabel
refreshView.getLoadingLayoutProxy().setLastUpdatedLabel(label);
// Do work to refresh the list here.
new GetDataTask().execute();
}
});
/**
* customize
*/
mPullRefreshListView.setMode(Mode.BOTH);
// LoadingLayoutに関してカスタマイズ(主に文言)
ILoadingLayout iLoadingLayout = mPullRefreshListView.getLoadingLayoutProxy(true, true);
iLoadingLayout.setLastUpdatedLabel("");
iLoadingLayout.setReleaseLabel("離してください、更新します");
iLoadingLayout.setPullLabel("さらに下に引いて下さい");
iLoadingLayout.setRefreshingLabel("更新中です");
// Add an end-of-list listener
mPullRefreshListView.setOnLastItemVisibleListener(new OnLastItemVisibleListener() {
@Override
public void onLastItemVisible() {
Toast.makeText(PullToRefreshCustomActivity.this, "End of List!", Toast.LENGTH_SHORT)
.show();
}
});
/**
* リスト表示
*/
mIemsList = new LinkedList<String>();
mIemsList.addAll(Arrays.asList(INITIAL_LIST));
mAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, mIemsList);
ListView actualListView = mPullRefreshListView.getRefreshableView();
actualListView.setAdapter(mAdapter);
}