Android Open Source - Lollipop-AppCompat-Widgets-Skeleton Activity1 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;
/*w ww  .j  av a 2 s .com*/
import android.os.Bundle;
import android.support.v4.app.Fragment;
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.Activity1;
import com.sachinshinde.lollipopappcompatskeleton.ui.activities.BaseActivity;
import com.sachinshinde.lollipopappcompatskeleton.utils.UIUtils;

public class Activity1Fragment extends Fragment {
    private static final String KEY_POSITION = "position";

    public static Activity1Fragment newInstance(int position) {
        Activity1Fragment frag = new Activity1Fragment();
        Bundle args = new Bundle();

        args.putInt(KEY_POSITION, position);
        frag.setArguments(args);

        return (frag);
    }

    public static String getTitle(int position) {
        return (String.format("position at %d", position + 1));
    }

    @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);
        int position = getArguments().getInt(KEY_POSITION, -1);

        textView.setText(getTitle(position));

        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);
    }
}




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