本文整理汇总了Java中uk.co.senab.actionbarpulltorefresh.library.PullToRefreshAttacher.Options方法的典型用法代码示例。如果您正苦于以下问题:Java PullToRefreshAttacher.Options方法的具体用法?Java PullToRefreshAttacher.Options怎么用?Java PullToRefreshAttacher.Options使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类uk.co.senab.actionbarpulltorefresh.library.PullToRefreshAttacher
的用法示例。
在下文中一共展示了PullToRefreshAttacher.Options方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
示例2: 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();
}
示例3: 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();
}
示例4: 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);
}
示例5: 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);
findViews();
mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START);
mDrawerLayout.setScrimColor(Color.argb(100, 0, 0, 0));
ActionBar actionBar = getActionBar();
actionBar.setIcon(R.drawable.ic_actionbar);
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setHomeButtonEnabled(true);
actionBar.setDisplayShowTitleEnabled(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);
setCategory(Category.popular);
FragmentManager fragmentManager = getSupportFragmentManager();
fragmentManager.beginTransaction().replace(R.id.left_drawer, new DrawerFragment()).commit();
}
示例6: onCreate
import uk.co.senab.actionbarpulltorefresh.library.PullToRefreshAttacher; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
getWindow().setFormat(PixelFormat.RGBA_8888);
setContentView(R.layout.comments_activity_layout);
// Set up the ActionBar with some options
actionBar = getActionBar();
actionBar.setHomeButtonEnabled(true);
actionBar.setDisplayHomeAsUpEnabled(true);
// 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;
mPullToRefreshAttacher = new PullToRefreshAttacher(this, refreshOpts);
// Get the intent bundle, get the comments URL
Intent incomingIntent = getIntent();
Bundle extras = incomingIntent.getExtras();
try
{
if(extras == null)
throw new Exception("extras is null");
commentsUrl = extras.getString(
getString(R.string.BUNDLE_OPEN_COMMENTS));
articleTitle = extras.getString(
getString(R.string.BUNDLE_ARTICLE_TITLE));
if(commentsUrl == null)
throw new Exception("no comment url specified");
}
catch(Exception e)
{
Utils.log.w("[CMT] "+e.getMessage());
finish();
}
// Create a new CommentsFragment
CommentsFragment commentsFragment = new CommentsFragment();
// Set our FragmentCommunicator as the commentsFragment
fragmentCommunicator = commentsFragment;
urlSender = commentsFragment;
// Display the fragment
getSupportFragmentManager().beginTransaction()
.replace(R.id.comments_container, commentsFragment).commit();
}