@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.d(TAG, "onCreate"); requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); setSupportProgressBarIndeterminateVisibility(false); getSupportActionBar().setDisplayShowTitleEnabled(false); setContentView(R.layout.activity_multipane); // FragmentManager.enableDebugLogging(true); if (savedInstanceState != null) executeState(savedInstanceState); else executeDefaultInstanceState(); ActionBar actionBar = getSupportActionBar(); actionBar.setDisplayShowTitleEnabled(false); createSearchModeCustomView(actionBar); mResizeButton.setOnClickListener(this); FragmentManager fm = getSupportFragmentManager(); FragmentTransaction t = fm.beginTransaction(); mWorkerFragment = (CombinedWorkerFragment) fm.findFragmentByTag(CombinedWorkerFragment.TAG); if (mWorkerFragment == null) { mWorkerFragment = new CombinedWorkerFragment(); t.add(mWorkerFragment, CombinedWorkerFragment.TAG); } mListFragment = (POIsListFragment) fm.findFragmentById(R.id.list_layout); if (mListFragment == null) { mListFragment = POIsListFragment.newInstance(false, true); t.add(R.id.list_layout, mListFragment, POIsListFragment.TAG); } mMapFragment = (POIsMapsforgeFragment) fm.findFragmentById(R.id.map_layout); if (mMapFragment == null) { mMapFragment = POIsMapsforgeFragment.newInstance(false, true); t.add(R.id.map_layout, mMapFragment, POIsMapsforgeFragment.TAG); } mDetailFragment = (POIDetailFragment) fm.findFragmentById(R.id.detail_layout); if (mDetailFragment == null) { mDetailFragment = POIDetailFragment.newInstance(); t.add(R.id.detail_layout, mDetailFragment); } t.commit(); }
@Override protected void onPostExecute(Boolean b) { super.onPostExecute(b); if (progress != null) { progress.dismiss(); } if (!b) { Toast.makeText(mContext, R.string.photo_upload_failed, Toast.LENGTH_LONG).show(); } else { Toast.makeText(mContext, R.string.photo_upload_successfully, Toast.LENGTH_LONG).show(); if (mFragment != null && mFragment.isAdded() && mCursor != null && mCursor.getCount() > 0) { ((POIDetailFragment) mFragment).reloadData(); } } }
@Override public void onShowDetail(Fragment fragment, ContentValues values) { long id = values.getAsLong(POIs.POI_ID); long copyId = PrepareDatabaseHelper.createCopyIfNotExists(getContentResolver(), id, true); poiIdSelected = copyId; if (!mMovableVisible && !mMovableGoneByButton) toggleMovableResize(); mDetailFragment.showDetail(poiIdSelected); if (fragment == mListFragment) { mMapFragment.markItem(values, true); } if (fragment == mMapFragment) { mListFragment.markItem(values, false); } }