Add bottom navigation view to the main wikivoyage screen
This commit is contained in:
parent
ae6ef269b1
commit
93af1b763f
3 changed files with 97 additions and 57 deletions
|
@ -1,6 +1,7 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:osmand="http://schemas.android.com/apk/res-auto"
|
xmlns:osmand="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -8,6 +9,12 @@
|
||||||
android:background="?attr/wikivoyage_bg_color"
|
android:background="?attr/wikivoyage_bg_color"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
<android.support.v7.widget.Toolbar
|
<android.support.v7.widget.Toolbar
|
||||||
android:id="@+id/toolbar"
|
android:id="@+id/toolbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -84,4 +91,21 @@
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
<net.osmand.plus.LockableViewPager
|
||||||
|
android:id="@+id/view_pager"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<android.support.design.widget.BottomNavigationView
|
||||||
|
android:id="@+id/bottom_navigation"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="?attr/wikivoyage_card_bg_color"
|
||||||
|
app:itemBackground="?attr/wikivoyage_card_bg_color"
|
||||||
|
app:menu="@menu/wikivoyage_bottom_navigation"
|
||||||
|
tools:itemIconTint="@color/bottom_navigation_color_selector_light"
|
||||||
|
tools:itemTextColor="@color/bottom_navigation_color_selector_light"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
|
@ -2,9 +2,11 @@
|
||||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<item
|
<item
|
||||||
android:id="@+id/action_explore"
|
android:id="@+id/action_explore"
|
||||||
|
android:icon="@drawable/ic_action_explore_part1"
|
||||||
android:title="@string/shared_string_explore"/>
|
android:title="@string/shared_string_explore"/>
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/action_saved_articles"
|
android:id="@+id/action_saved_articles"
|
||||||
|
android:icon="@drawable/ic_action_read_later"
|
||||||
android:title="@string/saved_articles"/>
|
android:title="@string/saved_articles"/>
|
||||||
</menu>
|
</menu>
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
package net.osmand.plus.wikivoyage;
|
package net.osmand.plus.wikivoyage;
|
||||||
|
|
||||||
|
import android.content.res.ColorStateList;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
|
import android.support.design.widget.BottomNavigationView;
|
||||||
import android.support.v4.app.FragmentManager;
|
import android.support.v4.app.FragmentManager;
|
||||||
import android.support.v7.widget.Toolbar;
|
import android.support.v7.widget.Toolbar;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
|
@ -10,6 +12,7 @@ import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
|
|
||||||
|
import net.osmand.AndroidUtils;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.wikivoyage.search.WikivoyageSearchDialogFragment;
|
import net.osmand.plus.wikivoyage.search.WikivoyageSearchDialogFragment;
|
||||||
|
|
||||||
|
@ -34,9 +37,20 @@ public class WikivoyageExploreDialogFragment extends WikivoyageBaseDialogFragmen
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ColorStateList navColorStateList = createBottomNavColorStateList();
|
||||||
|
BottomNavigationView bottomNav = (BottomNavigationView) mainView.findViewById(R.id.bottom_navigation);
|
||||||
|
bottomNav.setItemIconTintList(navColorStateList);
|
||||||
|
bottomNav.setItemTextColor(navColorStateList);
|
||||||
|
|
||||||
return mainView;
|
return mainView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ColorStateList createBottomNavColorStateList() {
|
||||||
|
return AndroidUtils.createCheckedColorStateList(getContext(), nightMode,
|
||||||
|
R.color.icon_color, R.color.wikivoyage_active_light,
|
||||||
|
R.color.icon_color, R.color.wikivoyage_active_dark);
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean showInstance(FragmentManager fm) {
|
public static boolean showInstance(FragmentManager fm) {
|
||||||
try {
|
try {
|
||||||
WikivoyageExploreDialogFragment fragment = new WikivoyageExploreDialogFragment();
|
WikivoyageExploreDialogFragment fragment = new WikivoyageExploreDialogFragment();
|
||||||
|
|
Loading…
Reference in a new issue