diff --git a/app/src/main/java/com/github/dfa/diaspora_android/activity/MainActivity.java b/app/src/main/java/com/github/dfa/diaspora_android/activity/MainActivity.java index 8e113f13..86966c4c 100644 --- a/app/src/main/java/com/github/dfa/diaspora_android/activity/MainActivity.java +++ b/app/src/main/java/com/github/dfa/diaspora_android/activity/MainActivity.java @@ -183,13 +183,6 @@ public class MainActivity extends AppCompatActivity setContentView(R.layout.main__activity); ButterKnife.bind(this); - fm = getSupportFragmentManager(); - if(fm.findFragmentByTag(StreamFragment.TAG) == null) { - fm.beginTransaction().replace(R.id.fragment_container, new StreamFragment()).commit(); - } else { - fm.beginTransaction().replace(R.id.fragment_container, fm.findFragmentByTag(StreamFragment.TAG)).commit(); - } - if ((app = (App) getApplication()) == null) AppLog.e(this, "App is null!"); if ((appSettings = app.getSettings()) == null) AppLog.e(this, "AppSettings is null!"); if ((podUserProfile = app.getPodUserProfile()) == null) @@ -199,6 +192,11 @@ public class MainActivity extends AppCompatActivity urls = new DiasporaUrlHelper(appSettings); customTabActivityHelper = new CustomTabActivityHelper(); + fm = getSupportFragmentManager(); + StreamFragment sf = getStreamFragment(); + fm.beginTransaction().replace(R.id.fragment_container, sf, StreamFragment.TAG).commit(); + sf.onCreateBottomOptionsMenu(toolbarBottom.getMenu(), getMenuInflater()); + setupUI(savedInstanceState); brOpenExternalLink = new OpenExternalLinkReceiver(this); @@ -256,6 +254,7 @@ public class MainActivity extends AppCompatActivity public void openDiasporaUrl(String url) { StreamFragment streamFragment = getStreamFragment(); if(!streamFragment.isVisible()) { + AppLog.d(this, "StreamFragment not visible"); fm.beginTransaction().replace(R.id.fragment_container, streamFragment, StreamFragment.TAG).commit(); streamFragment.onCreateBottomOptionsMenu(toolbarBottom.getMenu(), getMenuInflater()); } @@ -265,6 +264,7 @@ public class MainActivity extends AppCompatActivity public StreamFragment getStreamFragment() { StreamFragment streamFragment = (StreamFragment) fm.findFragmentByTag(StreamFragment.TAG); if(streamFragment == null) { + AppLog.d(this, "StreamFragment was null"); streamFragment = new StreamFragment(); } return streamFragment; @@ -275,13 +275,6 @@ public class MainActivity extends AppCompatActivity AppLog.i(this, "onConfigurationChanged()"); super.onConfigurationChanged(newConfig); - - // Load the layout resource for the new configuration - setContentView(R.layout.main__activity); - - // Reinitialize the UI - AppLog.v(this, "Rebuild the UI"); - setupUI(null); } private void setupNavigationSlider() { diff --git a/app/src/main/java/com/github/dfa/diaspora_android/fragment/StreamFragment.java b/app/src/main/java/com/github/dfa/diaspora_android/fragment/StreamFragment.java index cdf28103..5a375e35 100644 --- a/app/src/main/java/com/github/dfa/diaspora_android/fragment/StreamFragment.java +++ b/app/src/main/java/com/github/dfa/diaspora_android/fragment/StreamFragment.java @@ -138,4 +138,10 @@ public class StreamFragment extends WebViewFragment { } return false; } + + @Override + public ContextMenuWebView getWebView() { + AppLog.d(this, "getWebView: "+(this.webView != null)); + return this.webView; + } } diff --git a/app/src/main/res/layout/main__app_bar.xml b/app/src/main/res/layout/main__app_bar.xml index d2b73082..8d217e2b 100644 --- a/app/src/main/res/layout/main__app_bar.xml +++ b/app/src/main/res/layout/main__app_bar.xml @@ -1,10 +1,11 @@ - + + android:layout_width="fill_parent" + android:layout_height="fill_parent" + app:layout_behavior="@string/appbar_scrolling_view_behavior"/> - + + android:layout_height="match_parent" /> + android:progressDrawable="@drawable/progressbar"/> \ No newline at end of file diff --git a/app/src/main/res/layout/ui__webview.xml b/app/src/main/res/layout/ui__webview.xml deleted file mode 100644 index 35d12bc4..00000000 --- a/app/src/main/res/layout/ui__webview.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - \ No newline at end of file