1
0
Fork 0
mirror of https://github.com/gsantner/dandelion synced 2024-11-25 13:52:08 +01:00

Fixed layout issue (webview below topbar

This commit is contained in:
vanitasvitae 2016-09-21 21:35:03 +02:00
parent b2337b1955
commit 3d2fce6ac0
5 changed files with 29 additions and 49 deletions

View file

@ -183,13 +183,6 @@ public class MainActivity extends AppCompatActivity
setContentView(R.layout.main__activity); setContentView(R.layout.main__activity);
ButterKnife.bind(this); 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 ((app = (App) getApplication()) == null) AppLog.e(this, "App is null!");
if ((appSettings = app.getSettings()) == null) AppLog.e(this, "AppSettings is null!"); if ((appSettings = app.getSettings()) == null) AppLog.e(this, "AppSettings is null!");
if ((podUserProfile = app.getPodUserProfile()) == null) if ((podUserProfile = app.getPodUserProfile()) == null)
@ -199,6 +192,11 @@ public class MainActivity extends AppCompatActivity
urls = new DiasporaUrlHelper(appSettings); urls = new DiasporaUrlHelper(appSettings);
customTabActivityHelper = new CustomTabActivityHelper(); 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); setupUI(savedInstanceState);
brOpenExternalLink = new OpenExternalLinkReceiver(this); brOpenExternalLink = new OpenExternalLinkReceiver(this);
@ -256,6 +254,7 @@ public class MainActivity extends AppCompatActivity
public void openDiasporaUrl(String url) { public void openDiasporaUrl(String url) {
StreamFragment streamFragment = getStreamFragment(); StreamFragment streamFragment = getStreamFragment();
if(!streamFragment.isVisible()) { if(!streamFragment.isVisible()) {
AppLog.d(this, "StreamFragment not visible");
fm.beginTransaction().replace(R.id.fragment_container, streamFragment, StreamFragment.TAG).commit(); fm.beginTransaction().replace(R.id.fragment_container, streamFragment, StreamFragment.TAG).commit();
streamFragment.onCreateBottomOptionsMenu(toolbarBottom.getMenu(), getMenuInflater()); streamFragment.onCreateBottomOptionsMenu(toolbarBottom.getMenu(), getMenuInflater());
} }
@ -265,6 +264,7 @@ public class MainActivity extends AppCompatActivity
public StreamFragment getStreamFragment() { public StreamFragment getStreamFragment() {
StreamFragment streamFragment = (StreamFragment) fm.findFragmentByTag(StreamFragment.TAG); StreamFragment streamFragment = (StreamFragment) fm.findFragmentByTag(StreamFragment.TAG);
if(streamFragment == null) { if(streamFragment == null) {
AppLog.d(this, "StreamFragment was null");
streamFragment = new StreamFragment(); streamFragment = new StreamFragment();
} }
return streamFragment; return streamFragment;
@ -275,13 +275,6 @@ public class MainActivity extends AppCompatActivity
AppLog.i(this, "onConfigurationChanged()"); AppLog.i(this, "onConfigurationChanged()");
super.onConfigurationChanged(newConfig); 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() { private void setupNavigationSlider() {

View file

@ -138,4 +138,10 @@ public class StreamFragment extends WebViewFragment {
} }
return false; return false;
} }
@Override
public ContextMenuWebView getWebView() {
AppLog.d(this, "getWebView: "+(this.webView != null));
return this.webView;
}
} }

View file

@ -1,10 +1,11 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" <android.support.design.widget.CoordinatorLayout
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" xmlns:tools="http://schemas.android.com/tools"
android:layout_height="match_parent" android:layout_width="match_parent"
tools:context=".activity.MainActivity"> android:layout_height="match_parent"
tools:context=".activity.MainActivity">
<android.support.design.widget.AppBarLayout <android.support.design.widget.AppBarLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@ -24,8 +25,9 @@
<FrameLayout <FrameLayout
android:id="@+id/fragment_container" android:id="@+id/fragment_container"
android:layout_width="match_parent" android:layout_width="fill_parent"
android:layout_height="match_parent" /> android:layout_height="fill_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
<android.support.design.widget.AppBarLayout <android.support.design.widget.AppBarLayout
android:layout_width="match_parent" android:layout_width="match_parent"

View file

@ -1,20 +1,13 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_width="match_parent" android:layout_height="match_parent">
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context=".activity.MainActivity"
tools:showIn="@layout/main__app_bar">
<com.github.dfa.diaspora_android.ui.ContextMenuWebView <com.github.dfa.diaspora_android.ui.ContextMenuWebView
android:id="@+id/webView" android:id="@+id/webView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent" />
android:layout_alignParentEnd="true"
android:layout_alignParentStart="true"
android:layout_centerVertical="true" />
<ProgressBar <ProgressBar
android:id="@+id/progressBar" android:id="@+id/progressBar"
@ -22,7 +15,6 @@
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="7dp" android:layout_height="7dp"
android:indeterminate="false" android:indeterminate="false"
android:progressDrawable="@drawable/progressbar" android:progressDrawable="@drawable/progressbar"/>
app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
</RelativeLayout> </RelativeLayout>

View file

@ -1,13 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent">
<com.github.dfa.diaspora_android.ui.ContextMenuWebView
android:id="@+id/webView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentEnd="true"
android:layout_alignParentStart="true"
android:layout_centerVertical="true" />
</LinearLayout>