本文整理汇总了Java中uk.co.senab.actionbarpulltorefresh.library.PullToRefreshAttacher.get方法的典型用法代码示例。如果您正苦于以下问题:Java PullToRefreshAttacher.get方法的具体用法?Java PullToRefreshAttacher.get怎么用?Java PullToRefreshAttacher.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类uk.co.senab.actionbarpulltorefresh.library.PullToRefreshAttacher
的用法示例。
在下文中一共展示了PullToRefreshAttacher.get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import uk.co.senab.actionbarpulltorefresh.library.PullToRefreshAttacher; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
homeReceiver = new HomeReceiver();
IntentFilter intentFilter = new IntentFilter("cn.edu.njupt.allgo.HomeACTIVITY");
registerReceiver(homeReceiver, intentFilter);
Intent intent = new Intent(this,PullService.class);
intent.putExtra("action", 1);
startService(intent);
setContentView(R.layout.activity_home);
mPullToRefreshAttacher = PullToRefreshAttacher.get(this);
findViewById(savedInstanceState);
initView();
if(savedInstanceState == null) {
selectItem(1);
}
Log.i(TAG,"==> HomeCTIVITY初始化完毕");
}
示例2: onCreate
import uk.co.senab.actionbarpulltorefresh.library.PullToRefreshAttacher; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
/**
* Get ListView and give it an adapter to display the sample items
*/
ListView listView = getListView();
ListAdapter adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1,
ITEMS);
listView.setAdapter(adapter);
/**
* Here we create a PullToRefreshAttacher manually without an Options instance.
* PullToRefreshAttacher will manually create one using default values.
*/
mPullToRefreshAttacher = PullToRefreshAttacher.get(this);
// Set the Refreshable View to be the ListView and the refresh listener to be this.
mPullToRefreshAttacher.addRefreshableView(listView, this);
}
示例3: onCreate
import uk.co.senab.actionbarpulltorefresh.library.PullToRefreshAttacher; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_fragment_tabs);
// The attacher should always be created in the Activity's onCreate
mPullToRefreshAttacher = PullToRefreshAttacher.get(this);
// Add 3 tabs which will switch fragments
ActionBar ab = getActionBar();
ab.addTab(ab.newTab().setText("Tab 1").setTabListener(this));
ab.addTab(ab.newTab().setText("Tab 2").setTabListener(this));
ab.addTab(ab.newTab().setText("Tab 3").setTabListener(this));
ab.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
}
示例4: onCreate
import uk.co.senab.actionbarpulltorefresh.library.PullToRefreshAttacher; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_listview_empty);
/**
* Get ListView and give it an adapter to display the sample items
*/
ListView listView = (ListView) findViewById(R.id.ptr_listview);
mAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1,
new ArrayList<String>());
listView.setEmptyView(findViewById(android.R.id.empty));
listView.setAdapter(mAdapter);
/**
* Here we create a PullToRefreshAttacher manually without an Options instance.
* PullToRefreshAttacher will manually create one using default values.
*/
mPullToRefreshAttacher = PullToRefreshAttacher.get(this);
// Set the Refreshable View to be the ListView and the refresh listener to be this.
PullToRefreshLayout ptrLayout = (PullToRefreshLayout) findViewById(R.id.ptr_layout);
ptrLayout.setPullToRefreshAttacher(mPullToRefreshAttacher, this);
}
示例5: onCreate
import uk.co.senab.actionbarpulltorefresh.library.PullToRefreshAttacher; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Display the fragment as the main content.
getActionBar().setDisplayHomeAsUpEnabled(true);
mPullToRefreshAttacher = PullToRefreshAttacher.get(this);
getSupportFragmentManager().beginTransaction().replace(android.R.id.content,
new UnreadFRAGMENT()).commit();
}
示例6: onCreate
import uk.co.senab.actionbarpulltorefresh.library.PullToRefreshAttacher; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO 自动生成的方法存根
super.onCreate(savedInstanceState);
getActionBar().setDisplayHomeAsUpEnabled(true);
getSupportFragmentManager().beginTransaction().replace(android.R.id.content,
new MyHomePageFRAGMENT()).commit();
mPullToRefreshAttacher = PullToRefreshAttacher.get(this);
getActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
}
示例7: onCreate
import uk.co.senab.actionbarpulltorefresh.library.PullToRefreshAttacher; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_gridview);
GridView gridView = (GridView) findViewById(R.id.ptr_gridview);
ListAdapter adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1,
ITEMS);
gridView.setAdapter(adapter);
// As we're modifying some of the options, create an instance of
// PullToRefreshAttacher.Options
PullToRefreshAttacher.Options ptrOptions = new PullToRefreshAttacher.Options();
// Here we make the refresh scroll distance to 75% of the GridView height
ptrOptions.refreshScrollDistance = 0.75f;
// Here we define a custom header layout which will be inflated and used
ptrOptions.headerLayout = R.layout.customised_header;
// Here we define a custom header transformer which will alter the header based on the
// current pull-to-refresh state
ptrOptions.headerTransformer = new CustomisedHeaderTransformer();
// Here we create a PullToRefreshAttacher manually with the Options instance created above.
mPullToRefreshAttacher = PullToRefreshAttacher.get(this, ptrOptions);
/**
* As GridView is an AbsListView derived class, we create a new
* AbsListViewDelegate instance. You do NOT need to do this if you're using
* a supported scrollable Views. It is merely in this sample to show you how to set a
* custom view delegate.
*/
PullToRefreshAttacher.ViewDelegate handler = new AbsListViewDelegate();
mPullToRefreshAttacher.addRefreshableView(gridView, handler, this);
}
示例8: onCreate
import uk.co.senab.actionbarpulltorefresh.library.PullToRefreshAttacher; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_scrollview);
// Create new PullToRefreshAttacher
mPullToRefreshAttacher = PullToRefreshAttacher.get(this);
// Retrieve the PullToRefreshLayout from the content view
PullToRefreshLayout ptrLayout = (PullToRefreshLayout) findViewById(R.id.ptr_layout);
// Give the PullToRefreshAttacher to the PullToRefreshLayout, along with the refresh
// listener (this).
ptrLayout.setPullToRefreshAttacher(mPullToRefreshAttacher, this);
}
示例9: onCreate
import uk.co.senab.actionbarpulltorefresh.library.PullToRefreshAttacher; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_webview);
/**
* Get ListView and give it an adapter to display the sample items
*/
mWebView = (WebView) findViewById(R.id.webview);
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.setWebViewClient(new SampleWebViewClient());
/**
* Here we create a PullToRefreshAttacher without an Options instance.
* PullToRefreshAttacher will manually create one using default values.
*/
mPullToRefreshAttacher = PullToRefreshAttacher.get(this);
// Retrieve the PullToRefreshLayout from the content view
PullToRefreshLayout ptrLayout = (PullToRefreshLayout) findViewById(R.id.ptr_webview);
// Give the PullToRefreshAttacher to the PullToRefreshLayout, along with the refresh
// listener (this).
ptrLayout.setPullToRefreshAttacher(mPullToRefreshAttacher, this);
// Finally make the WebView load something...
mWebView.loadUrl("http://www.google.com");
}
示例10: onCreate
import uk.co.senab.actionbarpulltorefresh.library.PullToRefreshAttacher; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
createTabs();
pullToRefreshAttacher = PullToRefreshAttacher.get(this);
}
示例11: onCreate
import uk.co.senab.actionbarpulltorefresh.library.PullToRefreshAttacher; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
super.onCreate(savedInstanceState, true);
setContentView(R.layout.activity_rockets_list);
// Show the Up button in the action bar.
setupActionBar();
mLvRockets = (ListView) findViewById(R.id.lvRockets);
mLvRockets.setEmptyView(findViewById(android.R.id.empty));
mLayoutRockets = (PullToRefreshLayout) findViewById(R.id.layoutRockets);
mPullToRefreshAttacher = PullToRefreshAttacher.get(this);
mLayoutRockets.setPullToRefreshAttacher(mPullToRefreshAttacher, this);
mGestureDetector = new GestureDetector(this, new GestureListener());
mAdapter = new RocketsArrayAdapter(this, mLensRocketService.getLocalRockets());
mLvRockets.setAdapter(mAdapter);
mLvRockets.setOnItemClickListener(rocketClickListener);
mLvRockets.setOnItemLongClickListener(rocketLongClickListener);
mLvRockets.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
mGestureDetector.onTouchEvent(event);
if (event.getAction() == MotionEvent.ACTION_UP) {
if (mIsViewingPicture || mIsViewingVideo) {
mViewingDialog.dismiss();
mIsViewingPicture = false;
mIsViewingVideo = false;
if (mImagePicture != null) {
mImagePicture = null;
} else if (mVideoView != null) {
mVideoView.stopPlayback();
mVideoView = null;
}
}
}
return false;
}
});
}
示例12: onCreate
import uk.co.senab.actionbarpulltorefresh.library.PullToRefreshAttacher; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_gridview);
GridView gridView = (GridView) findViewById(R.id.ptr_gridview);
ListAdapter adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1,
ITEMS);
gridView.setAdapter(adapter);
// As we're modifying some of the options, create an instance of
// PullToRefreshAttacher.Options
PullToRefreshAttacher.Options ptrOptions = new PullToRefreshAttacher.Options();
// Here we make the refresh scroll distance to 75% of the GridView height
ptrOptions.refreshScrollDistance = 0.75f;
// Here we customise the animations which are used when showing/hiding the header view
ptrOptions.headerInAnimation = R.anim.slide_in_top;
ptrOptions.headerOutAnimation = R.anim.slide_out_top;
// Here we define a custom header layout which will be inflated and used
ptrOptions.headerLayout = R.layout.customised_header;
// Here we define a custom header transformer which will alter the header based on the
// current pull-to-refresh state
ptrOptions.headerTransformer = new CustomisedHeaderTransformer();
// Here we create a PullToRefreshAttacher manually with the Options instance created above.
mPullToRefreshAttacher = PullToRefreshAttacher.get(this, ptrOptions);
/**
* As GridView is an AbsListView derived class, we create a new
* AbsListViewDelegate instance. You do NOT need to do this if you're using
* a supported scrollable Views. It is merely in this sample to show you how to set a
* custom view delegate.
*/
PullToRefreshAttacher.ViewDelegate handler = new AbsListViewDelegate();
mPullToRefreshAttacher.addRefreshableView(gridView, handler, this);
}
示例13: onCreate
import uk.co.senab.actionbarpulltorefresh.library.PullToRefreshAttacher; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_scrollview);
// Create new PullToRefreshAttacher
mPullToRefreshAttacher = PullToRefreshAttacher.get(this);
// Retrieve the PullToRefreshLayout from the content view
PullToRefreshLayout ptrLayout = (PullToRefreshLayout) findViewById(R.id.ptr_layout);
// Give the PullToRefreshAttacher to the PullToRefreshLayout, along with the refresh
// listener (this).
ptrLayout.setPullToRefreshAttacher(mPullToRefreshAttacher, this);
// As we haven't set an explicit HeaderTransformer, we can safely cast the result of
// getHeaderTransformer() to DefaultHeaderTransformer
DefaultHeaderTransformer ht = (DefaultHeaderTransformer) mPullToRefreshAttacher
.getHeaderTransformer();
// As we're using a DefaultHeaderTransformer we can change the text which is displayed.
// You should load these values from localised resources, but we'll just use static strings.
ht.setPullText("Swipe Me!!!");
ht.setRefreshingText("Refreshing :)");
// DefaultHeaderTransformer allows you to change the color of the progress bar. Here
// we set it to a dark holo green, loaded from our resources
ht.setProgressBarColor(getResources().getColor(R.color.holo_dark_green));
}
示例14: onCreate
import uk.co.senab.actionbarpulltorefresh.library.PullToRefreshAttacher; //导入方法依赖的package包/类
@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_menu);
String shortName = getIntent().getStringExtra(MenuActivity.EXTRA_MENSA_SHORTNAME);
mensa = Mensa.getMensa(shortName);
final ActionBar actionBar = getActionBar();
actionBar.setDisplayShowTitleEnabled(true);
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setHomeButtonEnabled(true);
setTitle(mensa.getShortName());
viewPager = (ViewPager) findViewById(R.id.container);
viewPagerAdapter = new NavigationAdapter(viewPager, this, actionBar, getSupportFragmentManager());
refresher = PullToRefreshAttacher.get(this);
((DefaultHeaderTransformer)refresher.getHeaderTransformer()).setProgressBarColor(
ThemeHelper.getRefreshBarColor(this));
int selectedDateIndex = 0;
if (savedInstanceState != null) {
if (savedInstanceState.containsKey(STATE_SELECTED_NAVIGATION_ITEM)) {
selectedDateIndex = savedInstanceState.getInt(STATE_SELECTED_NAVIGATION_ITEM);
}
if (savedInstanceState.containsKey(STATE_WEEKLY_MENU)) {
weeklyMenu = (WeeklyMenu) savedInstanceState.getSerializable(STATE_WEEKLY_MENU);
Log.i(TAG, "Restored WeeklyMenu from state.");
}
}
if (weeklyMenu != null && !weeklyMenu.isOutdated()) {
Log.i(TAG, "Showing restored WeeklyMenu with index " + selectedDateIndex);
viewPagerAdapter.displayMenu(weeklyMenu, selectedDateIndex);
}
setupBottomBar();
}
示例15: onCreate
import uk.co.senab.actionbarpulltorefresh.library.PullToRefreshAttacher; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
users = new ArrayList<User>();
ArrayList<User> initialUsers = new ArrayList<User>();
User u = new User();
u.id=2157036348l;
User v = new User();
v.id=102014181l;
initialUsers.add(u);
initialUsers.add(v);
initialUsers.add(v);
initialUsers.add(v);
initialUsers.add(v);
initialUsers.add(v);
initialUsers.add(v);
adapter=new UserAdapter(this, R.layout.user_card, users);
setListAdapter(adapter);
final ActionBar actionBar = getActionBar();
actionBar.setDisplayShowTitleEnabled(false);
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
ArrayList<String> itemList = new ArrayList<String>();
itemList.add("My University");
itemList.add("My Module");
itemList.add("My Year");
ArrayAdapter<String> aAdpt = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, android.R.id.text1, itemList);
actionBar.setListNavigationCallbacks(aAdpt, this);
actionBar.setSelectedNavigationItem(1);
// Create a PullToRefreshAttacher instance
mPullToRefreshAttacher = PullToRefreshAttacher.get(this);
// Add the Refreshable View and provide the refresh listener
mPullToRefreshAttacher.addRefreshableView(getListView(), this);
StartupTask t = new StartupTask();
t.execute(initialUsers);
}