Search in sources :

Example 1 with ErrorView

use of tr.xip.errorview.ErrorView in project Hummingbird-for-Android by xiprox.

the class FeedFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_feed, null);
    LayoutInflater layoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    mList = (InfiniteScrollListView) rootView.findViewById(R.id.feed_list);
    mList.setLoadingView(layoutInflater.inflate(R.layout.loading_view, null));
    mList.setLoadingMode(InfiniteScrollListView.LoadingMode.SCROLL_TO_BOTTOM);
    mList.setStopPosition(InfiniteScrollListView.StopPosition.REMAIN_UNCHANGED);
    adapter = new FeedTimelineAdapter(context, mItems, this);
    adapter.setLoadingMode(InfiniteScrollListView.LoadingMode.SCROLL_TO_BOTTOM);
    adapter.setStopPosition(InfiniteScrollListView.StopPosition.REMAIN_UNCHANGED);
    mList.setAdapter(adapter);
    mFlipper = (ViewFlipper) rootView.findViewById(R.id.feed_view_flipper);
    mErrorView = (ErrorView) rootView.findViewById(R.id.feed_error_view);
    mErrorView.setOnRetryListener(this);
    /**
         * Check for any username arguments being passed to the fragment. If one is passed, we will
         * load the feed for that username. If no argument is passed, we load the feed for the
         * currently logged in user.
         */
    if (getArguments() != null && getArguments().getString(ARG_USERNAME) != null) {
        username = getArguments().getString(ARG_USERNAME);
        executeLoadTask();
    } else if (prefMan.getUsername() != null) {
        username = prefMan.getUsername();
        executeLoadTask();
    } else
        Log.e(TAG, "Username not found! Is there a problem with the logged user?");
    return rootView;
}
Also used : LayoutInflater(android.view.LayoutInflater) FeedTimelineAdapter(tr.bcxip.hummingbird.adapters.FeedTimelineAdapter) ErrorView(tr.xip.errorview.ErrorView) InfiniteScrollListView(ca.weixiao.widget.InfiniteScrollListView) View(android.view.View)

Example 2 with ErrorView

use of tr.xip.errorview.ErrorView in project Hummingbird-for-Android by xiprox.

the class UserInfoFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, final ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_user_info, null);
    /*
        * Check if any username argument is passed. If one is passed, load the data for it;
        * if not, load for the currently logged in user.
        */
    if (getArguments() != null) {
        String receivedUsername = getArguments().getString(ARG_USERNAME);
        if (receivedUsername != null && !receivedUsername.equals("") && !receivedUsername.trim().equals(""))
            username = receivedUsername;
        else
            username = prefMan.getUsername();
    } else
        username = prefMan.getUsername();
    try {
        parent = (ProfileFragment) getFragmentManager().findFragmentByTag(ProfileFragment.FRAGMENT_TAG_PROFILE);
    } catch (Exception e) {
    /* empty */
    }
    mCover = (ImageView) rootView.findViewById(R.id.user_info_cover);
    mCoverHolder = (FrameLayout) rootView.findViewById(R.id.user_info_cover_holder);
    mAvatar = (ImageView) rootView.findViewById(R.id.user_info_avatar);
    mAvatartHolder = (FrameLayout) rootView.findViewById(R.id.user_info_avatar_holder);
    mUsername = (TextView) rootView.findViewById(R.id.user_info_username);
    mBio = (TextView) rootView.findViewById(R.id.user_info_bio);
    mOnline = (LinearLayout) rootView.findViewById(R.id.user_info_online);
    mWaifu = (TextView) rootView.findViewById(R.id.user_info_waifu);
    mWaifuHolder = (LinearLayout) rootView.findViewById(R.id.user_info_waifu_holder);
    mLocation = (TextView) rootView.findViewById(R.id.user_info_location);
    mLocationHolder = (LinearLayout) rootView.findViewById(R.id.user_info_location_holder);
    mWebsite = (TextView) rootView.findViewById(R.id.user_info_website);
    mWebsiteHolder = (LinearLayout) rootView.findViewById(R.id.user_info_website_holder);
    mTimeWatched = (TextView) rootView.findViewById(R.id.user_info_watched_time);
    mFlipper = (ViewFlipper) rootView.findViewById(R.id.user_info_view_flipper);
    mErrorView = (ErrorView) rootView.findViewById(R.id.user_info_error_view);
    mErrorView.setOnRetryListener(this);
    mAvatartHolder.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            Intent intent = new Intent(context, FullscreenImageActivity.class);
            intent.putExtra(FullscreenImageActivity.ARG_IMAGE_URL, user.getAvatar());
            ActivityOptionsCompat transition = ActivityOptionsCompat.makeSceneTransitionAnimation((Activity) context, mAvatar, FullscreenImageActivity.TRANSITION_NAME_IMAGE);
            Utils.startActivityWithTransition(context, intent, transition);
        }
    });
    mCoverHolder.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            Intent intent = new Intent(context, FullscreenImageActivity.class);
            intent.putExtra(FullscreenImageActivity.ARG_IMAGE_URL, user.getCoverImage());
            ActivityOptionsCompat transition = ActivityOptionsCompat.makeSceneTransitionAnimation((Activity) context, mCover, FullscreenImageActivity.TRANSITION_NAME_IMAGE);
            Utils.startActivityWithTransition(context, intent, transition);
        }
    });
    loadTask = new LoadTask();
    loadTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
    return rootView;
}
Also used : Activity(android.app.Activity) Intent(android.content.Intent) ImageView(android.widget.ImageView) View(android.view.View) ErrorView(tr.xip.errorview.ErrorView) TextView(android.widget.TextView) ActivityOptionsCompat(android.support.v4.app.ActivityOptionsCompat)

Aggregations

View (android.view.View)2 ErrorView (tr.xip.errorview.ErrorView)2 Activity (android.app.Activity)1 Intent (android.content.Intent)1 ActivityOptionsCompat (android.support.v4.app.ActivityOptionsCompat)1 LayoutInflater (android.view.LayoutInflater)1 ImageView (android.widget.ImageView)1 TextView (android.widget.TextView)1 InfiniteScrollListView (ca.weixiao.widget.InfiniteScrollListView)1 FeedTimelineAdapter (tr.bcxip.hummingbird.adapters.FeedTimelineAdapter)1