package com.seven.demobox.designpatterns.patterns.factory;

import com.seven.demobox.R;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

public class SampleFragment extends Fragment {
    private String title;
    private int page;
    public static SampleFragment newInstance(int page, String title) {
        final SampleFragment fragment = new SampleFragment();
        Bundle bundle = new Bundle();
        bundle.putInt("someInt", page);
        bundle.putString("someTitle", title);
        fragment.setArguments(bundle);
        return  fragment;
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        page = getArguments().getInt("someInt");
        title = getArguments().getString("someTitle");
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.factory_fragment, container, false);
        TextView tvLabel = (TextView) view.findViewById(R.id.page_tv);
        tvLabel.setText(page + " -- " + title);
        return view;
    }
}

@@ -369,56 +369,8 @@
 t %7B%0A
-    private String title;%0A    private int page;%0A
     
@@ -502,171 +502,8 @@
 ();%0A
-        Bundle bundle = new Bundle();%0A        bundle.putInt(%22someInt%22, page);%0A        bundle.putString(%22someTitle%22, title);%0A        fragment.setArguments(bundle);%0A
     
@@ -647,112 +647,8 @@
 e);%0A
-        page = getArguments().getInt(%22someInt%22);%0A        title = getArguments().getString(%22someTitle%22);%0A
     
@@ -869,127 +869,8 @@
 e);%0A
-        TextView tvLabel = (TextView) view.findViewById(R.id.page_tv);%0A        tvLabel.setText(page + %22 -- %22 + title);%0A
     

delete pages info