示例#1
0
 @Override
 public void showProgress(String message) {
   mProgressdialog = new SweetAlertDialog(this, SweetAlertDialog.PROGRESS_TYPE);
   mProgressdialog.getProgressHelper().setBarColor(getResources().getColor(R.color.colorPrimary));
   mProgressdialog.setTitleText(message);
   mProgressdialog.setCancelable(false);
   mProgressdialog.show();
 }
 @Override
 protected void onPreExecute() {
   pDialog = new SweetAlertDialog(context, SweetAlertDialog.PROGRESS_TYPE);
   pDialog.getProgressHelper().setBarColor(context.getResources().getColor(R.color.primary));
   pDialog.setTitleText("Loading");
   pDialog.setCancelable(false);
   pDialog.show();
 }
 public void showLoadingDialog() {
   if (mLoadingDialog == null) {
     mLoadingDialog = new SweetAlertDialog(this, SweetAlertDialog.PROGRESS_TYPE);
     mLoadingDialog.setCancelable(false);
     mLoadingDialog.setTitleText("数据加载中...");
   }
   mLoadingDialog.show();
 }
 @Override
 protected void onPreExecute() {
   super.onPreExecute();
   connection = new ConnectionDetector(context);
   prefs = AppPreferences.getInstance(context);
   pDialog = new SweetAlertDialog(context, SweetAlertDialog.PROGRESS_TYPE).setTitleText("Loading");
   pDialog.show();
   pDialog.setCancelable(false);
   pDialog.setCanceledOnTouchOutside(false);
 }
示例#5
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    mView = inflater.inflate(R.layout.fragment_latest, container, false);
    mContext = getActivity();
    mActivity = getActivity();
    initializeViews();
    MainActivity.tabs.setVisibility(View.VISIBLE);
    MainActivity.layout_user_profle.setVisibility(View.GONE);
    if (NetworkUtils.isOnline(getActivity())) {
      mDialog =
          Utils.showSweetProgressDialog(
              getActivity(),
              getResources().getString(R.string.progress_loading),
              SweetAlertDialog.PROGRESS_TYPE);
      mDialog.setCancelable(true);
      getLatestFeeds();
    } else {
      Utils.showSweetProgressDialog(
          getActivity(),
          getActivity().getResources().getString(R.string.check_your_internet_connection),
          SweetAlertDialog.WARNING_TYPE);
    }

    list_latest_feeds.setHasFixedSize(true);
    list_latest_feeds.setLayoutManager(new LinearLayoutManager(getActivity()));
    mLatestFeedsAdapter = new LatestFeedsAdapter(getActivity(), latestFeedList, list_latest_feeds);
    list_latest_feeds.setAdapter(mLatestFeedsAdapter);

    mLatestFeedsAdapter.setOnLoadMoreListener(
        new OnLoadMoreListener() {
          @Override
          public void onLoadMore() {
            if (hasMoreItems) {
              latestFeedList.add(null);
              if (latestFeedList.size() >= 10) {
                mLatestFeedsAdapter.notifyItemInserted(latestFeedList.size() - 1);
                refreshItems();
              }

            } else {
            }
          }
        });
    return mView;
  }