content: /*
   * Copyright 2017 Thomas Andres
   *
   * This file is part of Kandroid.
   *
   * Kandroid is free software: you can redistribute it and/or modify
   * it under the terms of the GNU General Public License as published by
   * the Free Software Foundation, either version 3 of the License, or
   * (at your option) any later version.
   *
   * Kandroid is distributed in the hope that it will be useful,
   * but WITHOUT ANY WARRANTY; without even the implied warranty of
   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   * GNU General Public License for more details.
   *
   * You should have received a copy of the GNU General Public License
   * along with Foobar.  If not, see <http://www.gnu.org/licenses/>.
   */
  
  package in.andres.kandroid.ui;
  
  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;
  
  import in.andres.kandroid.R;
  
  public class TextFragment extends Fragment {
  
      private static final String ARG_SECTION_NAME = "section_name";
  
      public TextFragment() {}
  
      public static TextFragment newInstance(String sectionName) {
          TextFragment fragment = new TextFragment();
          Bundle args = new Bundle();
          args.putString(ARG_SECTION_NAME, sectionName);
          fragment.setArguments(args);
          return fragment;
      }
  
      @Nullable
      @Override
      public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
          return inflater.inflate(R.layout.fragment_text, container, false);
      }
  
      @Override
      public void onActivityCreated(Bundle savedInstanceState) {
          super.onActivityCreated(savedInstanceState);
          assert getView() != null : "TextFragment: getView() returned null";
          TextView textView = (TextView) getView().findViewById(R.id.fragmentTextView);
          textView.setText(getArguments().getString(TextFragment.ARG_SECTION_NAME));
      }
  }
  