@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.wallchanger); mProgressBar = (ProgressBar) findViewById(R.id.progress_progress); mProgressPanel = findViewById(R.id.progress_progress); mProgressLabel = (TextView) findViewById(R.id.progress_label); mProgressCancel = (Button) findViewById(R.id.progress_cancel); if (isGTV()) { showToast("Welcome, GoogleTV user!"); } if (true) getActionBar().hide(); else findViewById(R.id.title_frame).setVisibility(View.GONE); MediaUtils.init(getApplicationContext()); try { if (!MediaUtils.writeFile("pewp", new byte[] {}, true)) Logger.LogWarning("Unable to write to pewp"); else Logger.LogInfo("Wrote to pewp!"); } catch (IOException fnfe) { Logger.LogError("Unable to write to pewp!", fnfe); } mUseMultiplePanes = (null != findViewById(R.id.detail_container)); if (null == savedInstanceState) { FragmentManager fm = getSupportFragmentManager(); FragmentTransaction ft = fm.beginTransaction(); mFragHash.put("list", new ProfileMakerList()); ft.replace(R.id.list, mFragHash.get("list"), "list"); ft.commit(); ShowDetailFragment(new PreviewFragment(), "preview"); ShowPreview(((BitmapDrawable) getWallpaper()).getBitmap()); } }
public void ShowDetailFragment(Fragment frag, String tag) { Boolean bExists = false; if (mFragHash.containsKey(tag)) bExists = true; FragmentManager fm = getSupportFragmentManager(); FragmentTransaction ft = fm.beginTransaction(); int id = R.id.detail_container; if (!mUseMultiplePanes) id = R.id.list; if (!mFragHash.containsValue(frag)) ft.replace(id, frag, tag); else { try { ft.show(frag); } catch (IllegalStateException ise) { Logger.LogWarning("Unable to show fragment.", ise); ft.replace(id, frag, tag); } } // ft.addToBackStack(null); mFragHash.put(tag, frag); ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN); ft.commit(); }