Java tutorial
/* * Copyright 2015 Kejun Xia * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.shipdream.lib.android.mvc.samples.note.view.fragment; import android.content.res.Configuration; import android.os.Bundle; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentTransaction; import android.view.View; import com.shipdream.lib.android.mvc.samples.note.R; public class NoteTabletLandscape extends BaseFragment { @Override protected int getLayoutResId() { return R.layout.fragment_note_large; } @Override public void onViewReady(View view, Bundle savedInstanceState, Reason reason) { super.onViewReady(view, savedInstanceState, reason); if (getCurrentOrientation() == Configuration.ORIENTATION_LANDSCAPE) { NoteListFragment noteListFragment = new NoteListFragment(); NoteDetailFragment noteDetailFragment = new NoteDetailFragment(); FragmentManager fm = getChildFragmentManager(); FragmentTransaction trans = fm.beginTransaction(); trans.replace(R.id.note_large_leftPane, noteListFragment); trans.replace(R.id.note_large_rightPane, noteDetailFragment); trans.commit(); } } @Override public void onResume() { super.onResume(); if (getCurrentOrientation() == Configuration.ORIENTATION_LANDSCAPE) { getToolBar().setTitle("My Notes - LargeView"); } } }