use top navigation bar again

This commit is contained in:
David Luhmer 2019-11-27 20:49:36 +01:00
parent 683f3370b6
commit 42a0230df3
2 changed files with 26 additions and 23 deletions

View file

@ -26,27 +26,20 @@ import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.graphics.Color;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.PersistableBundle;
import android.text.Html;
import android.util.Log;
import android.util.SparseArray;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.webkit.WebView;
import android.widget.ImageButton;
import android.widget.ProgressBar;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.Toolbar;
import androidx.browser.customtabs.CustomTabsIntent;
import androidx.core.content.ContextCompat;
@ -57,8 +50,6 @@ import androidx.fragment.app.FragmentStatePagerAdapter;
import androidx.viewpager.widget.PagerAdapter;
import androidx.viewpager.widget.ViewPager;
import com.google.android.material.bottomappbar.BottomAppBar;
import java.lang.ref.WeakReference;
import java.util.HashSet;
import java.util.List;
@ -71,12 +62,10 @@ import butterknife.ButterKnife;
import de.luhmer.owncloudnewsreader.database.DatabaseConnectionOrm;
import de.luhmer.owncloudnewsreader.database.DatabaseConnectionOrm.SORT_DIRECTION;
import de.luhmer.owncloudnewsreader.database.model.RssItem;
import de.luhmer.owncloudnewsreader.helper.ThemeChooser;
import de.luhmer.owncloudnewsreader.helper.ThemeUtils;
import de.luhmer.owncloudnewsreader.model.PodcastItem;
import de.luhmer.owncloudnewsreader.model.TTSItem;
import de.luhmer.owncloudnewsreader.widget.WidgetProvider;
import static de.luhmer.owncloudnewsreader.helper.ThemeChooser.THEME;
public class NewsDetailActivity extends PodcastFragmentActivity {
@ -93,8 +82,8 @@ public class NewsDetailActivity extends PodcastFragmentActivity {
* {@link FragmentStatePagerAdapter}.
*/
private SectionsPagerAdapter mSectionsPagerAdapter;
//protected @BindView(R.id.toolbar) Toolbar toolbar;
protected @BindView(R.id.bottomAppBar) BottomAppBar bottomAppBar;
protected @BindView(R.id.toolbar) Toolbar toolbar;
// protected @BindView(R.id.bottomAppBar) BottomAppBar bottomAppBar;
protected @BindView(R.id.progressIndicator) ProgressBar progressIndicator;
//protected @BindView(R.id.btn_disable_incognito) ImageButton mBtnDisableIncognito;
@ -140,12 +129,15 @@ public class NewsDetailActivity extends PodcastFragmentActivity {
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN|View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
*/
/*
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
getWindow().setStatusBarColor(Color.WHITE);
}
*/
setContentView(R.layout.activity_news_detail);
@ -159,13 +151,14 @@ public class NewsDetailActivity extends PodcastFragmentActivity {
ButterKnife.bind(this);
/*
if (toolbar != null) {
if (toolbar != null) {
setSupportActionBar(toolbar);
}*/
}
/*
if (bottomAppBar != null) {
setSupportActionBar(bottomAppBar);
}
*/
//getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
@ -621,12 +614,14 @@ public class NewsDetailActivity extends PodcastFragmentActivity {
public void initIncognitoMode() {
int color = getResources().getColor(isIncognitoEnabled() ? R.color.material_grey_900 : R.color.colorPrimary);
//ThemeUtils.colorizeToolbar(toolbar, color);
ThemeUtils.colorizeToolbar(bottomAppBar, color);
ThemeUtils.colorizeToolbar(toolbar, color);
//ThemeUtils.colorizeToolbar(bottomAppBar, color);
//ThemeUtils.changeStatusBarColor(this, color);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
getWindow().setNavigationBarColor(getResources().getColor(R.color.material_grey_900));
//getWindow().setNavigationBarColor(color);
getWindow().setStatusBarColor(color);
/*
switch (ThemeChooser.getSelectedTheme()) {
case LIGHT:
Log.d(TAG, "initIncognitoMode: LIGHT");
@ -644,10 +639,12 @@ public class NewsDetailActivity extends PodcastFragmentActivity {
getWindow().setStatusBarColor(Color.BLACK);
break;
}
*/
}
}
/*
private void setLightStatusBar(@NonNull View view) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
int flags = view.getSystemUiVisibility(); // get current flag
@ -663,6 +660,7 @@ public class NewsDetailActivity extends PodcastFragmentActivity {
view.setSystemUiVisibility(flags);
}
}
*/
/**
* A {@link FragmentPagerAdapter} that returns a fragment corresponding to

View file

@ -10,13 +10,18 @@
android:id="@+id/sliding_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="?attr/actionBarSize"
android:layout_marginTop="?attr/actionBarSize"
android:gravity="bottom"
sothree:umanoPanelHeight="68dp"
sothree:umanoShadowHeight="4dp"
sothree:umanoParallaxOffset="100dp"
sothree:umanoDragView="@+id/name">
<!--
for bottom toolbar, replace marginTop above with marginBottom
android:layout_marginBottom="?attr/actionBarSize"
-->
<androidx.viewpager.widget.ViewPager
android:id="@+id/pager"
android:layout_width="match_parent"
@ -57,6 +62,7 @@
android:layoutDirection="ltr"
style="?android:attr/progressBarStyleHorizontal" />
<!--
<com.google.android.material.bottomappbar.BottomAppBar
android:id="@+id/bottomAppBar"
android:layout_width="match_parent"
@ -64,13 +70,12 @@
android:layout_gravity="bottom"
android:theme="@style/ToolbarTheme"
app:popupTheme="@style/ToolbarOptionMenuBackgroundTheme">
</com.google.android.material.bottomappbar.BottomAppBar>
-->
<!--
<include
android:id="@+id/toolbar_layout"
layout="@layout/toolbar_layout" />
-->
</androidx.coordinatorlayout.widget.CoordinatorLayout>