1
0
Fork 0
mirror of https://github.com/gsantner/dandelion synced 2024-11-22 04:12: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);
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() {

View file

@ -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;
}
}

View file

@ -1,5 +1,6 @@
<?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:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
@ -24,8 +25,9 @@
<FrameLayout
android:id="@+id/fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent" />
android:layout_width="fill_parent"
android:layout_height="fill_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"

View file

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