uk.co.senab.actionbarpulltorefresh.library.ActionBarPullToRefresh Java Examples
The following examples show how to use
uk.co.senab.actionbarpulltorefresh.library.ActionBarPullToRefresh.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TopicFragment.java From v2ex-daily-android with Apache License 2.0 | 6 votes |
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); ActionBarPullToRefresh.from(getActivity()) .allChildrenArePullable() .listener(this) .setup(mPullToRefreshLayout); if(getArguments().containsKey("model")){ mTopicModel = getArguments().getParcelable("model"); mTopicId = mTopicModel.id; mHeaderView = new TopicView(getActivity()); mHeaderView.setViewDetail(); mHeaderView.parse(mTopicModel); mListView.addHeaderView(mHeaderView, mTopicModel, false); mListView.setAdapter(new LoadingAdapter(getActivity())); getReplyData(); }else if(getArguments().containsKey("topic_id")){ mTopicId = getArguments().getInt("topic_id"); getTopicData(); } }
Example #2
Source File: NodeFragment.java From v2ex-daily-android with Apache License 2.0 | 6 votes |
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); ActionBarPullToRefresh.from(getActivity()) .allChildrenArePullable() .listener(this) .setup(mPullToRefreshLayout); if((mNodeId = getArguments().getInt("node_id", 0)) != 0){ getData(false); }else{ getActivity().finish(); } NodeModel nodeModel = mAllNodesDataHelper.select(mNodeId); if(getActivity() instanceof NodeActivity && !nodeModel.isCollected){ setHasOptionsMenu(true); } }
Example #3
Source File: NewestNodeFragment.java From v2ex-daily-android with Apache License 2.0 | 5 votes |
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); ActionBarPullToRefresh.from(getActivity()) .allChildrenArePullable() .listener(this) .setup(mPullToRefreshLayout); if(mAllNodesDataHelper.query().length == 0){ mNewestNodeDataHelper.clear(); getAllNodesData(); }else{ getNewestNodeData(); } }
Example #4
Source File: FragmentFeeds.java From rss with GNU General Public License v3.0 | 5 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { super.onCreateView(inflater, container, savedInstanceState); FeedsActivity activity = (FeedsActivity) getActivity(); PullToRefreshLayout layout = (PullToRefreshLayout) inflater.inflate(R.layout.viewpager, container, false); // Find and configure the ViewPager. s_viewPager = (ViewPager) layout.findViewById(R.id.viewpager); s_viewPager.setOffscreenPageLimit(128); s_viewPager.setOnPageChangeListener(new OnPageChangeListener()); // Create the Options object for the ActionBarPullToRefresh SetupWizard. Options.Builder optionsBuilder = Options.create(); optionsBuilder.scrollDistance(PULL_DISTANCE); Options options = optionsBuilder.build(); // Create the ActionBarPullToRefresh object using its SetupWizard. ActionBarPullToRefresh.SetupWizard setup = ActionBarPullToRefresh.from(activity); setup.allChildrenArePullable(); setup.options(options); setup.useViewDelegate(ViewPager.class, new ViewPagerDelegate()); setup.listener(new RefreshListener(activity)); setup.setup(layout); return layout; }
Example #5
Source File: ThreadViewFragment.java From something.apk with MIT License | 4 votes |
@Override protected void setupPullToRefresh(PullToRefreshLayout ptr) { ActionBarPullToRefresh.from(getActivity()).allChildrenArePullable().options(generatePullToRefreshOptions()).bottomListener(this).setup(ptr); }
Example #6
Source File: NotificationFragment.java From v2ex-daily-android with Apache License 2.0 | 4 votes |
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); ActionBarPullToRefresh.from(getActivity()) .listener(this) .allChildrenArePullable() .setup(mPullToRefreshLayout); final SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getActivity()); if(sharedPreferences.contains("username")){ if(sharedPreferences.contains("token")){ mToken = sharedPreferences.getString("token", null); getNotificationData(); }else{ final ProgressDialog progressDialog = ProgressDialog.show(getActivity(), null, "Getting notification token...", true, false); V2EX.getNotificationToken(getActivity(), new JsonHttpResponseHandler() { @Override public void onSuccess(int statusCode, Header[] headers, JSONObject response) { DebugUtils.log(response); if (getActivity() != null) { try { if (response.getString("result").equals("ok")) { progressDialog.setMessage("Save notification token..."); mToken = response.getString("token"); sharedPreferences.edit() .putString("token", mToken) .apply(); progressDialog.dismiss(); getNotificationData(); } else if (response.getString("result").equals("fail")) { progressDialog.setMessage("Get token fail"); MessageUtils.toast(getActivity(), "Get token fail"); progressDialog.dismiss(); } } catch (JSONException e) { e.printStackTrace(); } } } }); } } }
Example #7
Source File: AbstractMessagesActivity.java From Faceless with GNU General Public License v3.0 | 4 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(getLayoutResourceID()); // set up access to the preferences mPrefs = PreferenceManager.getDefaultSharedPreferences(this); Global.Setup.load(mPrefs); // check if introduction has already been completed if (mPrefs.getInt(Global.Preferences.INTRO_STEP, 0) < Integer.MAX_VALUE) { // if introduction has not yet been completed // switch to introduction screen startActivity(new Intent(this, ActivityIntro.class)); // prevent any window animation because the user is to be redirected immediately overridePendingTransition(0, 0); finish(); return; } // check if setup has been completed if (!Global.Setup.isComplete()) { // try to run automatic setup if (!Global.Setup.runAuto(this, mPrefs)) { // if automatic setup did not succeed // switch to manual setup startActivity(new Intent(this, ActivitySetup.class)); // prevent any window animation because the user is to be redirected immediately overridePendingTransition(0, 0); finish(); return; } } // set up the layout inflater mInflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE); // set up other resources mResources = getResources(); mMessagePropertyDrawables = new Global.MessagePropertyDrawables(this); mBackgroundPatterns = BackgroundPatterns.getInstance(this); // set up the two mode tabs setupButtonBar(); // set up the ListView with its ArrayAdapter and the ProgressBar mListView = (ListView) findViewById(R.id.listViewMessages); mProgressBarLoading = (ProgressBar) findViewById(R.id.progressBarLoading); mAdapter = new MessagesAdapter(this, R.layout.row_messages_list, new ArrayList<Message>()); mListView.setAdapter(mAdapter); mListView.setOnItemClickListener(mMessageClickListener); // set up pull-to-refresh (at the top) mPullToRefreshLayout = (PullToRefreshLayout) findViewById(R.id.viewListViewContainer); ActionBarPullToRefresh.from(this).allChildrenArePullable().listener(this).setup(mPullToRefreshLayout); // set up infinite scrolling (at the bottom) mListView.setOnScrollListener(mInfiniteScrollListener); // set up the action bar getActionBar().setDisplayHomeAsUpEnabled(isActionBarUpEnabled()); // create the location provider mSimpleLocation = new SimpleLocation(this); // load first data into the ListView reloadMessages(getMessagesMode(), 0, true, false, false); // prompt the user to rate the app if this is appropriate AppRater appRater = new AppRater(this); appRater.setPhrases(R.string.app_rater_title, R.string.app_rater_explanation, R.string.app_rater_now, R.string.app_rater_later, R.string.app_rater_never); appRater.show(); }