Android Open Source - Lollipop-AppCompat-Widgets-Skeleton Other Fragment






From Project

Back to project page Lollipop-AppCompat-Widgets-Skeleton.

License

The source code is released under:

Apache License

If you think the Android project Lollipop-AppCompat-Widgets-Skeleton listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.sachinshinde.lollipopappcompatskeleton.ui.fragments;
//from   w w w.  j  a v  a 2  s  . co  m
import android.app.Activity;
import android.os.Bundle;
import android.support.v7.internal.widget.CompatTextView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;

import com.sachinshinde.lollipopappcompatskeleton.R;
import com.sachinshinde.lollipopappcompatskeleton.ui.activities.BaseActivity;
import com.sachinshinde.lollipopappcompatskeleton.ui.widgets.CallbackFragment;
import com.sachinshinde.lollipopappcompatskeleton.utils.UIUtils;

public class OtherFragment extends CallbackFragment {

    /**
     * The fragment's current callback object.
     */
    private Callbacks mCallbacks = sDummyCallbacks;

    private static Callbacks sDummyCallbacks = new Callbacks() {
        @Override
        public void onItemSelected(long id) {
        }

        @Override
        public int getSelectedFragment() {
            return 0;
        }
    };

    /**
     * Mandatory empty constructor for the fragment manager to instantiate the
     * fragment (e.g. upon screen orientation changes).
     */
    public OtherFragment() {
    }



    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View result = inflater.inflate(R.layout.fragment_layout, null);
        CompatTextView textView = (CompatTextView) result.findViewById(R.id.tvSample);

        textView.setText(getArguments().getString("Title"));

        result.findViewById(R.id.bButterBar).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

                ((BaseActivity)getActivity()).showButterBar("Android is awesome", "I know", 3000, new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        Toast.makeText(getActivity(), "Yo!!", Toast.LENGTH_LONG).show();
                        ((BaseActivity)getActivity()).hideButterBar();
                    }
                });
            }
        });

        result.findViewById(R.id.bProgressDialog).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                UIUtils.getProgressDialog(getActivity());
            }
        });

        return (result);

    }

    @Override
    public void onAttach(Activity activity) {
        super.onAttach(activity);

        // Activities containing this fragment must implement its callbacks.
        if (!(activity instanceof Callbacks)) {
            throw new IllegalStateException(
                    "Activity must implement fragment's callbacks.");
        }

        mCallbacks = (Callbacks) activity;
    }

    @Override
    public void onDetach() {
        super.onDetach();

        // Reset the active callbacks interface to the dummy implementation.
        mCallbacks = sDummyCallbacks;
    }

}




Java Source Code List

com.sachinshinde.lollipopappcompatskeleton.ApplicationTest.java
com.sachinshinde.lollipopappcompatskeleton.ui.activities.Activity1.java
com.sachinshinde.lollipopappcompatskeleton.ui.activities.Activity2.java
com.sachinshinde.lollipopappcompatskeleton.ui.activities.Activity3.java
com.sachinshinde.lollipopappcompatskeleton.ui.activities.BaseActivity.java
com.sachinshinde.lollipopappcompatskeleton.ui.adapters.SampleAdapter.java
com.sachinshinde.lollipopappcompatskeleton.ui.fragments.Activity1Fragment.java
com.sachinshinde.lollipopappcompatskeleton.ui.fragments.OtherFragment.java
com.sachinshinde.lollipopappcompatskeleton.ui.widgets.BezelImageView.java
com.sachinshinde.lollipopappcompatskeleton.ui.widgets.CallbackFragment.java
com.sachinshinde.lollipopappcompatskeleton.ui.widgets.DrawShadowFrameLayout.java
com.sachinshinde.lollipopappcompatskeleton.ui.widgets.MultiSwipeRefreshLayout.java
com.sachinshinde.lollipopappcompatskeleton.ui.widgets.ScrimInsetsFrameLayout.java
com.sachinshinde.lollipopappcompatskeleton.ui.widgets.ScrimInsetsScrollView.java
com.sachinshinde.lollipopappcompatskeleton.ui.widgets.SlidingTabLayout.java
com.sachinshinde.lollipopappcompatskeleton.ui.widgets.SlidingTabStrip.java
com.sachinshinde.lollipopappcompatskeleton.utils.UIUtils.java