本文整理汇总了Java中uk.co.senab.actionbarpulltorefresh.library.PullToRefreshAttacher类的典型用法代码示例。如果您正苦于以下问题:Java PullToRefreshAttacher类的具体用法?Java PullToRefreshAttacher怎么用?Java PullToRefreshAttacher使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PullToRefreshAttacher类属于uk.co.senab.actionbarpulltorefresh.library包,在下文中一共展示了PullToRefreshAttacher类的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);
setContentView(R.layout.activity_main);
mDrawerLayout = (DrawerLayout)findViewById(R.id.drawer_layout);
mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START);
mDrawerLayout.setScrimColor(Color.argb(100, 0, 0, 0));
ActionBar actionBar = getActionBar();
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setHomeButtonEnabled(true);
actionBar.setDisplayShowTitleEnabled(true);
actionBar.setDisplayShowHomeEnabled(false);
mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.drawable.ic_drawer,
R.string.drawer_open, R.string.drawer_close) {
public void onDrawerClosed(View view) {
mMenu.findItem(R.id.action_refresh).setVisible(true);
}
public void onDrawerOpened(View drawerView) {
mMenu.findItem(R.id.action_refresh).setVisible(false);
}
};
mDrawerLayout.setDrawerListener(mDrawerToggle);
PullToRefreshAttacher.Options options = new PullToRefreshAttacher.Options();
options.headerInAnimation = R.anim.pulldown_fade_in;
options.headerOutAnimation = R.anim.pulldown_fade_out;
options.refreshScrollDistance = 0.3f;
options.headerLayout = R.layout.pulldown_header;
mPullToRefreshAttacher = new PullToRefreshAttacher(this, options);
mPullToRefreshAttacher.setRefreshing(false);
loadStartData();
}
示例11: 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);
}
示例12: onCreate
import uk.co.senab.actionbarpulltorefresh.library.PullToRefreshAttacher; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
getWindow().setFormat(PixelFormat.RGBA_8888);
// request progress bar on action bar
requestWindowFeature(Window.FEATURE_PROGRESS);
setContentView(R.layout.newsview_layout);
// set progress bar as indeterminate
setProgressBarIndeterminate(true);
setProgressBarVisibility(false);
// Set up the action bar to show a dropdown list.
final ActionBar actionBar = getActionBar();
actionBar.setDisplayShowTitleEnabled(false);
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
actionBar.setIcon(getResources().getDrawable(R.drawable.feed_icon));
// Set up the dropdown list navigation in the action bar.
actionBar.setListNavigationCallbacks(
// Specify a SpinnerAdapter to populate the dropdown list.
new ArrayAdapter<String>(
actionBar.getThemedContext(),
android.R.layout.simple_list_item_1,
android.R.id.text1,
getResources().getStringArray(R.array.title_sections)),
this);
// Create Pull to Refresh Attacher with some custom options
// Later the Fragments will need it.
MyHeaderTransformer myTransformer = new MyHeaderTransformer();
PullToRefreshAttacher.Options refreshOpts = new PullToRefreshAttacher.Options();
refreshOpts.headerTransformer = myTransformer;
//refreshOpts.headerInAnimation = R.anim.enter_top;
mPullToRefreshAttacher = new PullToRefreshAttacher(this, refreshOpts);
// Initialize bundles
dataToSave = new Bundle();
dataToSend = new Bundle();
}
示例13: 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;
}
});
}
示例14: 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);
}
示例15: 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));
}