本文整理汇总了Java中uk.co.senab.actionbarpulltorefresh.extras.actionbarcompat.PullToRefreshLayout类的典型用法代码示例。如果您正苦于以下问题:Java PullToRefreshLayout类的具体用法?Java PullToRefreshLayout怎么用?Java PullToRefreshLayout使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PullToRefreshLayout类属于uk.co.senab.actionbarpulltorefresh.extras.actionbarcompat包,在下文中一共展示了PullToRefreshLayout类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onViewCreated
import uk.co.senab.actionbarpulltorefresh.extras.actionbarcompat.PullToRefreshLayout; //导入依赖的package包/类
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view,savedInstanceState);
ViewGroup viewGroup = (ViewGroup) view;
// As we're using a ListFragment we create a PullToRefreshLayout manually
mPullToRefreshLayout = new PullToRefreshLayout(viewGroup.getContext());
// We can now setup the PullToRefreshLayout
ActionBarPullToRefresh.from(getActivity())
// We need to insert the PullToRefreshLayout into the Fragment's ViewGroup
.insertLayoutInto(viewGroup)
// Here we mark just the ListView and it's Empty View as pullable
.theseChildrenArePullable(android.R.id.list, android.R.id.empty)
.listener(this)
.setup(mPullToRefreshLayout);
}
示例2: onCreateView
import uk.co.senab.actionbarpulltorefresh.extras.actionbarcompat.PullToRefreshLayout; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout
View view = inflater.inflate(R.layout.layout_fragment, container, false);
// Now give the find the PullToRefreshLayout and set it up
mPullToRefreshLayout = (PullToRefreshLayout) view.findViewById(R.id.ptr_layout);
ActionBarPullToRefresh.from(getActivity())
.allChildrenArePullable()
.listener(this)
.setup(mPullToRefreshLayout);
// Set title in Fragment for display purposes.
TextView title = (TextView) view.findViewById(R.id.tv_title);
Bundle b = getArguments();
if (b != null) {
title.setText(b.getString(EXTRA_TITLE));
}
return view;
}
示例3: onCreate
import uk.co.senab.actionbarpulltorefresh.extras.actionbarcompat.PullToRefreshLayout; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_webview);
// Find WebView and get it ready to display pages
mWebView = (WebView) findViewById(R.id.webview);
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.setWebViewClient(new SampleWebViewClient());
// Now find the PullToRefreshLayout and set it up
mPullToRefreshLayout = (PullToRefreshLayout) findViewById(R.id.ptr_layout);
ActionBarPullToRefresh.from(this)
.allChildrenArePullable()
.listener(this)
.setup(mPullToRefreshLayout);
// Finally make the WebView load something...
mWebView.loadUrl("http://www.google.com");
}
示例4: onCreateView
import uk.co.senab.actionbarpulltorefresh.extras.actionbarcompat.PullToRefreshLayout; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_subreddit, container, false);
mPullToRefreshLayout = (PullToRefreshLayout) rootView.findViewById(R.id.ptr_layout);
ListView postList = (ListView) rootView.findViewById(R.id.Subreddit_post_list);
postList.setOnScrollListener(new PostsScrollListener());
postList.setAdapter(mAdapter);
postList.setOnItemClickListener(this);
postList.setOnTouchListener(new ListSwipeInteraction(postList, null));
// Now setup the PullToRefreshLayout
ActionBarPullToRefresh.from(getActivity())
// Mark All Children as pullable
.allChildrenArePullable()
// Set the OnRefreshListener
.listener(this)
// Finally commit the setup to our PullToRefreshLayout
.setup(mPullToRefreshLayout);
return rootView;
}
示例5: onCreateView
import uk.co.senab.actionbarpulltorefresh.extras.actionbarcompat.PullToRefreshLayout; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.cameras_gallery_fragment,
container, false);
mVibrator = (Vibrator) getActivity().getSystemService(Context.VIBRATOR_SERVICE);
mAdapterView = (GridView) view.findViewById(R.id.grid_view_cameras);
mEmptyGalleryTextView = (TextView) view.findViewById(R.id.text_view_no_favorites);
mPullToRefreshLayout = (PullToRefreshLayout) view.findViewById(R.id.ptr_layout);
mAdapterView.setOnItemClickListener(new CameraItemClickListener());
mAdapterView.setOnItemLongClickListener(new CameraItemLongClickListener());
if (savedInstanceState != null) {
mCurrentIndex = savedInstanceState.getInt(
Constants.BUNDLE_CURRENT_INDEX, 0);
}
mDrawerLayout = (DrawerLayout) getActivity().findViewById(R.id.drawer_layout);
mDrawerList = (ExpandableListView) getActivity().findViewById(R.id.left_drawer);
mActionBar = ((ActionBarActivity) getActivity()).getSupportActionBar();
// Now setup the PullToRefreshLayout
ActionBarPullToRefresh.from(getActivity())
// Mark All Children as pullable
.allChildrenArePullable()
// Set the OnRefreshListener
.listener(this)
.options(Options.create().refreshOnUp(true).build())
// Finally commit the setup to our PullToRefreshLayout
.setup(mPullToRefreshLayout);
return view;
}
示例6: onCreate
import uk.co.senab.actionbarpulltorefresh.extras.actionbarcompat.PullToRefreshLayout; //导入依赖的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);
// Now find the PullToRefreshLayout and set it up
mPullToRefreshLayout = (PullToRefreshLayout) findViewById(R.id.ptr_layout);
ActionBarPullToRefresh.from(this)
.options(Options.create()
// Here we make the refresh scroll distance to 75% of the GridView height
.scrollDistance(.75f)
// Here we define a custom header layout which will be inflated and used
.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
.headerTransformer(new CustomisedHeaderTransformer())
.build())
.allChildrenArePullable()
.listener(this)
// Here we'll set a custom ViewDelegate
.useViewDelegate(GridView.class, new AbsListViewDelegate())
.setup(mPullToRefreshLayout);
}
示例7: onCreate
import uk.co.senab.actionbarpulltorefresh.extras.actionbarcompat.PullToRefreshLayout; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_scrollview);
// Now find the PullToRefreshLayout and set it up
mPullToRefreshLayout = (PullToRefreshLayout) findViewById(R.id.ptr_layout);
ActionBarPullToRefresh.from(this)
.allChildrenArePullable()
.listener(this)
.setup(mPullToRefreshLayout);
}
示例8: findLayout
import uk.co.senab.actionbarpulltorefresh.extras.actionbarcompat.PullToRefreshLayout; //导入依赖的package包/类
private PullToRefreshLayout findLayout(View view) {
if (pullToRefreshId == -1) {
if (view instanceof PullToRefreshLayout) {
return (PullToRefreshLayout) view;
} else {
return null;
}
} else {
return (PullToRefreshLayout) view.findViewById(pullToRefreshId);
}
}
示例9: onStatusResultReceiverError
import uk.co.senab.actionbarpulltorefresh.extras.actionbarcompat.PullToRefreshLayout; //导入依赖的package包/类
@Override
public void onStatusResultReceiverError(Fragment fragment, Exception exception) {
View view = fragment.getView();
if (view == null) {
return;
}
// Now find the PullToRefreshLayout to setup
PullToRefreshLayout pullToRefresh = findLayout(view);
if (pullToRefresh == null) {
return;
}
pullToRefresh.setRefreshComplete();
}
示例10: onStatusResultReceiverDone
import uk.co.senab.actionbarpulltorefresh.extras.actionbarcompat.PullToRefreshLayout; //导入依赖的package包/类
@Override
public void onStatusResultReceiverDone(Fragment fragment, Bundle resultData) {
View view = fragment.getView();
if (view == null) {
return;
}
// Now find the PullToRefreshLayout to setup
PullToRefreshLayout pullToRefresh = findLayout(view);
if (pullToRefresh == null) {
return;
}
pullToRefresh.setRefreshComplete();
}
示例11: onStatusResultReceiverCached
import uk.co.senab.actionbarpulltorefresh.extras.actionbarcompat.PullToRefreshLayout; //导入依赖的package包/类
@Override
public void onStatusResultReceiverCached(Fragment fragment, Bundle resultData) {
View view = fragment.getView();
if (view == null) {
return;
}
// Now find the PullToRefreshLayout to setup
PullToRefreshLayout pullToRefresh = findLayout(view);
if (pullToRefresh == null) {
return;
}
pullToRefresh.setRefreshComplete();
}
示例12: onCreate
import uk.co.senab.actionbarpulltorefresh.extras.actionbarcompat.PullToRefreshLayout; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
preferences = getSharedPreferences("preferences", MODE_PRIVATE);
cityId = preferences.getInt(NetworkQuery.Params.ID, NetworkQuery.Defaults.CITY_ID);
cachingTimestamp = preferences.getLong(CACHE_TIMESTAMP, 0L);
tvTemperatureLimit1 = (TextView) findViewById(R.id.tvTemperatureLimit1);
tvTemperatureLimit2 = (TextView) findViewById(R.id.tvTemperatureLimit2);
tvTime1Limit1 = (TextView) findViewById(R.id.tvTime1Limit1);
tvTime1Limit2 = (TextView) findViewById(R.id.tvTime1Limit2);
tvTime2Limit1 = (TextView) findViewById(R.id.tvTime2Limit1);
tvTime2Limit2 = (TextView) findViewById(R.id.tvTime2Limit2);
tvDayTemperatureSpan = (TextView) findViewById(R.id.tvDayTemperatureSpan);
tvDayAverageTemperature = (TextView) findViewById(R.id.tvDayAverageTemperature);
tvDayMedianTemperature = (TextView) findViewById(R.id.tvDayMedianTemperature);
graphView = (GraphView) findViewById(R.id.graph);
llLoader = (LinearLayout) findViewById(R.id.llLoader);
ptrLayout = (PullToRefreshLayout) findViewById(R.id.ptr_layout);
resetValues();
ActionBarPullToRefresh.from(this).allChildrenArePullable().listener(
new OnRefreshListener() {
@Override
public void onRefreshStarted(View view) {
networkQuery.cancelAllRequests(MainActivity.this);
refreshWeatherData();
}
}
).setup(ptrLayout);
String appId = preferences.getString(NetworkQuery.Params.APPID, "");
networkQuery = NetworkQuery.getInstance(getApplicationContext());
networkQuery.setAppId(appId);
registerDialog = new SettingsActivity.RegisterDialog(this, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
String appId = registerDialog.getEtAppId().getText().toString().trim();
networkQuery.setAppId(appId);
preferences.edit().putString(NetworkQuery.Params.APPID, appId).apply();
cachingTimestamp = 0;
refreshWeatherData();
}
});
if (savedInstanceState == null) {
refreshWeatherData();
if (preferences.getBoolean(IS_FIRST_LAUNCH, true)) {
registerDialog.show();
preferences.edit().putBoolean(IS_FIRST_LAUNCH, false).apply();
}
}
else {
currentTime = savedInstanceState.getLong(SAVED_CURRENT_TIME);
currentTimeMinus12h = savedInstanceState.getLong(SAVED_CURRENT_TIME_MINUS_12);
currentTimeMinus24h = savedInstanceState.getLong(SAVED_CURRENT_TIME_MINUS_24);
currentIsGained = savedInstanceState.getBoolean(SAVED_CURRENT_GAINED);
historyIsGained = savedInstanceState.getBoolean(SAVED_HISTORY_GAINED);
long[] timeArray = savedInstanceState.getLongArray(SAVED_TIME_ARRAY);
double[] tempArray = savedInstanceState.getDoubleArray(SAVED_TEMP_ARRAY);
boolean refreshWasRun = savedInstanceState.getBoolean(SAVED_LOADER_VISIBILITY) || refreshWasCancelled;
if (refreshWasRun || (timeArray == null || tempArray == null))
refreshWeatherData();
else {
temperatureMap.clear();
for (int i = 0; i < timeArray.length && i < tempArray.length; i++)
temperatureMap.put(timeArray[i], tempArray[i]);
processValues(true);
}
if (savedInstanceState.getBoolean(SAVED_DIALOG_VISIBILITY)) {
registerDialog.getEtAppId().setText(savedInstanceState.getString(SAVED_DIALOG_APPID));
registerDialog.show();
}
}
}