Small fixes with gpx description

This commit is contained in:
Vitaliy 2021-01-25 03:46:49 +02:00
parent a8406fda7d
commit 0d704a93c3
7 changed files with 199 additions and 199 deletions

View file

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="4dp" />

View file

@ -109,16 +109,13 @@
<FrameLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:minHeight="@dimen/card_row_min_height"
android:layout_weight="1"
android:foreground="@drawable/bg_contextmenu_shadow"
android:foregroundGravity="top|fill_horizontal">
android:layout_height="wrap_content"
android:background="?attr/activity_background_basic">
<include
android:id="@+id/shadow"
layout="@layout/card_bottom_divider" />
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/activity_background_basic" />
</FrameLayout>
</LinearLayout>

View file

@ -34,7 +34,6 @@ import com.squareup.picasso.Picasso;
import com.squareup.picasso.RequestCreator;
import net.osmand.AndroidUtils;
import net.osmand.GPXUtilities;
import net.osmand.GPXUtilities.GPXFile;
import net.osmand.GPXUtilities.Metadata;
import net.osmand.GPXUtilities.WptPt;
@ -409,7 +408,7 @@ public class TrackActivityFragmentAdapter implements TrackBitmapDrawerListener {
}
@Nullable
private String getMetadataImageLink(@NonNull Metadata metadata) {
public static String getMetadataImageLink(@NonNull Metadata metadata) {
String link = metadata.link;
if (!TextUtils.isEmpty(link)) {
String lowerCaseLink = link.toLowerCase();

View file

@ -1,13 +1,14 @@
package net.osmand.plus.track;
import android.text.TextUtils;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.appcompat.widget.AppCompatImageView;
import com.squareup.picasso.Callback;
import com.squareup.picasso.Picasso;
import com.squareup.picasso.RequestCreator;
import net.osmand.GPXUtilities;
import net.osmand.GPXUtilities.GPXFile;
import net.osmand.PicassoUtils;
import net.osmand.plus.R;
@ -16,16 +17,15 @@ import net.osmand.plus.helpers.AndroidUiHelper;
import net.osmand.plus.routepreparationmenu.cards.BaseCard;
import net.osmand.plus.widgets.TextViewEx;
import net.osmand.plus.wikipedia.WikiArticleHelper;
import net.osmand.util.Algorithms;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.AppCompatImageView;
import static net.osmand.plus.myplaces.TrackActivityFragmentAdapter.getMetadataImageLink;
public class DescriptionCard extends BaseCard {
private final GPXFile gpxFile;
public DescriptionCard(MapActivity mapActivity, GPXFile gpxFile) {
public DescriptionCard(@NonNull MapActivity mapActivity, @NonNull GPXFile gpxFile) {
super(mapActivity);
this.gpxFile = gpxFile;
}
@ -37,9 +37,11 @@ public class DescriptionCard extends BaseCard {
@Override
protected void updateContent() {
if (gpxFile == null || gpxFile.metadata == null || gpxFile.metadata.getDescription() == null) {
if (gpxFile.metadata == null || gpxFile.metadata.getDescription() == null) {
AndroidUiHelper.updateVisibility(view, false);
return;
} else {
AndroidUiHelper.updateVisibility(view, true);
}
final String title = gpxFile.metadata.getArticleTitle();
@ -62,31 +64,15 @@ public class DescriptionCard extends BaseCard {
editBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
GpxEditDescriptionDialogFragment.showInstance(mapActivity, descriptionHtml);
GpxEditDescriptionDialogFragment.showInstance(mapActivity, descriptionHtml, null);
}
});
}
@Nullable
private String getMetadataImageLink(@NonNull GPXUtilities.Metadata metadata) {
String link = metadata.link;
if (!TextUtils.isEmpty(link)) {
String lowerCaseLink = link.toLowerCase();
if (lowerCaseLink.contains(".jpg")
|| lowerCaseLink.contains(".jpeg")
|| lowerCaseLink.contains(".png")
|| lowerCaseLink.contains(".bmp")
|| lowerCaseLink.contains(".webp")) {
return link;
}
}
return null;
}
private String getFirstParagraph(String descriptionHtml) {
if (descriptionHtml != null) {
String firstParagraph = WikiArticleHelper.getPartialContent(descriptionHtml);
if (!TextUtils.isEmpty(firstParagraph)) {
if (!Algorithms.isEmpty(firstParagraph)) {
return firstParagraph;
}
}
@ -113,5 +99,4 @@ public class DescriptionCard extends BaseCard {
}
});
}
}

View file

@ -2,119 +2,130 @@ package net.osmand.plus.track;
import android.os.AsyncTask;
import android.os.Bundle;
import android.text.Editable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import net.osmand.GPXUtilities;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentManager;
import net.osmand.GPXUtilities.GPXFile;
import net.osmand.PlatformUtil;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.UiUtilities;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.base.BaseOsmAndDialogFragment;
import net.osmand.plus.track.SaveGpxAsyncTask.SaveGpxListener;
import net.osmand.plus.widgets.EditTextEx;
import net.osmand.util.Algorithms;
import org.apache.commons.logging.Log;
import java.io.File;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
public class GpxEditDescriptionDialogFragment extends BaseOsmAndDialogFragment {
public static final String TAG = GpxEditDescriptionDialogFragment.class.getSimpleName();
private static final Log log = PlatformUtil.getLog(GpxEditDescriptionDialogFragment.class);
public static final String TAG = GpxEditDescriptionDialogFragment.class.getSimpleName();
private static final Log log = PlatformUtil.getLog(GpxEditDescriptionDialogFragment.class);
public static final String CONTENT_KEY = "content_key";
private static final String CONTENT_KEY = "content_key";
private EditTextEx editableHtml;
private EditTextEx editableHtml;
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.dialog_edit_gpx_description, container, false);
editableHtml = view.findViewById(R.id.description);
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
OsmandApplication app = getMyApplication();
boolean nightMode = app.getDaynightHelper().isNightModeForMapControls();
LayoutInflater themedInflater = UiUtilities.getInflater(requireContext(), nightMode);
View view = themedInflater.inflate(R.layout.dialog_edit_gpx_description, container, false);
view.findViewById(R.id.btn_close).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dismiss();
}
});
editableHtml = view.findViewById(R.id.description);
view.findViewById(R.id.btn_save).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (!saveGpx(editableHtml.getText().toString())) {
dismiss();
}
}
});
view.findViewById(R.id.btn_close).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dismiss();
}
});
Bundle args = getArguments();
if (args != null) {
String html = args.getString(CONTENT_KEY);
if (html != null) {
editableHtml.setText(html);
}
}
view.findViewById(R.id.btn_save).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Editable editable = editableHtml.getText();
if (!Algorithms.isEmpty(editable) && !saveGpx(editable.toString())) {
dismiss();
}
}
});
return view;
}
Bundle args = getArguments();
if (args != null) {
String html = args.getString(CONTENT_KEY);
if (html != null) {
editableHtml.setText(html);
}
}
private boolean saveGpx(final String html) {
if (html == null) {
return false;
}
final FragmentManager manager = getFragmentManager();
if (manager == null) {
return false;
}
return view;
}
final Fragment readGpxFragment = manager.findFragmentByTag(GpxReadDescriptionDialogFragment.TAG);
final TrackMenuFragment trackMenuFragment = (TrackMenuFragment) manager.findFragmentByTag(TrackMenuFragment.TAG);
if (trackMenuFragment == null) {
return false;
}
private boolean saveGpx(final String html) {
MapActivity mapActivity = getMapActivity();
if (mapActivity == null || mapActivity.getTrackMenuFragment() == null) {
return false;
}
TrackMenuFragment trackMenuFragment = mapActivity.getTrackMenuFragment();
File file = trackMenuFragment.getDisplayHelper().getFile();
GPXUtilities.GPXFile gpx = trackMenuFragment.getGpx();
gpx.metadata.getExtensionsToWrite().put("desc", html);
GPXFile gpx = trackMenuFragment.getGpx();
gpx.metadata.getExtensionsToWrite().put("desc", html);
new SaveGpxAsyncTask(file, gpx, new SaveGpxAsyncTask.SaveGpxListener() {
@Override
public void gpxSavingStarted() {
}
File file = trackMenuFragment.getDisplayHelper().getFile();
new SaveGpxAsyncTask(file, gpx, new SaveGpxListener() {
@Override
public void gpxSavingStarted() {
}
@Override
public void gpxSavingFinished(Exception errorMessage) {
if (errorMessage != null) {
log.error(errorMessage);
}
@Override
public void gpxSavingFinished(Exception errorMessage) {
if (errorMessage != null) {
log.error(errorMessage);
}
MapActivity mapActivity = getMapActivity();
if (mapActivity == null || mapActivity.getTrackMenuFragment() == null) {
TrackMenuFragment trackMenuFragment = mapActivity.getTrackMenuFragment();
trackMenuFragment.updateContent();
}
Fragment target = getTargetFragment();
if (target instanceof GpxReadDescriptionDialogFragment) {
((GpxReadDescriptionDialogFragment) target).updateContent(html);
}
dismiss();
}
}).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
return true;
}
trackMenuFragment.updateContent();
if (readGpxFragment != null) {
Bundle args = readGpxFragment.getArguments();
if (args != null) {
args.putString(GpxReadDescriptionDialogFragment.CONTENT_KEY, html);
readGpxFragment.onResume();
}
}
dismiss();
@Nullable
private MapActivity getMapActivity() {
return (MapActivity) getActivity();
}
}
}).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
return true;
}
public static void showInstance(AppCompatActivity activity, String description) {
Bundle args = new Bundle();
args.putString(GpxEditDescriptionDialogFragment.CONTENT_KEY, description);
GpxEditDescriptionDialogFragment fragment = new GpxEditDescriptionDialogFragment();
fragment.setArguments(args);
fragment.show(activity.getSupportFragmentManager(), GpxEditDescriptionDialogFragment.TAG);
}
public static void showInstance(@NonNull FragmentActivity activity, @NonNull String description, @Nullable Fragment target) {
FragmentManager fragmentManager = activity.getSupportFragmentManager();
if (!fragmentManager.isStateSaved()) {
Bundle args = new Bundle();
args.putString(CONTENT_KEY, description);
GpxEditDescriptionDialogFragment fragment = new GpxEditDescriptionDialogFragment();
fragment.setArguments(args);
fragment.setTargetFragment(target, 0);
fragment.show(fragmentManager, GpxEditDescriptionDialogFragment.TAG);
}
}
}

View file

@ -15,47 +15,69 @@ import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.AppCompatImageView;
import androidx.appcompat.widget.Toolbar;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentManager;
import com.squareup.picasso.Callback;
import com.squareup.picasso.Picasso;
import com.squareup.picasso.RequestCreator;
import net.osmand.AndroidUtils;
import net.osmand.PicassoUtils;
import net.osmand.PlatformUtil;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.UiUtilities;
import net.osmand.plus.base.BaseOsmAndDialogFragment;
import net.osmand.plus.helpers.AndroidUiHelper;
import net.osmand.plus.widgets.TextViewEx;
import net.osmand.plus.widgets.WebViewEx;
import net.osmand.plus.wikivoyage.WikivoyageUtils;
import org.apache.commons.logging.Log;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.AppCompatImageView;
import androidx.appcompat.widget.Toolbar;
import androidx.core.content.ContextCompat;
import net.osmand.util.Algorithms;
public class GpxReadDescriptionDialogFragment extends BaseOsmAndDialogFragment {
public static final String TAG = GpxReadDescriptionDialogFragment.class.getSimpleName();
private static final Log log = PlatformUtil.getLog(GpxReadDescriptionDialogFragment.class);
public static final String TITLE_KEY = "title_key";
public static final String IMAGE_URL_KEY = "image_url_key";
public static final String CONTENT_KEY = "content_key";
WebViewEx webView;
private static final String TITLE_KEY = "title_key";
private static final String IMAGE_URL_KEY = "image_url_key";
private static final String CONTENT_KEY = "content_key";
private static final int EDIT_ID = 1;
private WebViewEx webView;
private String title;
private String imageUrl;
private String contentHtml;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Bundle args = getArguments();
if (savedInstanceState != null) {
readBundle(savedInstanceState);
} else if (args != null) {
readBundle(args);
}
}
private void readBundle(Bundle bundle) {
title = bundle.getString(TITLE_KEY);
imageUrl = bundle.getString(IMAGE_URL_KEY);
contentHtml = bundle.getString(CONTENT_KEY);
}
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.dialog_read_gpx_description, container, false);
OsmandApplication app = getMyApplication();
boolean nightMode = app.getDaynightHelper().isNightModeForMapControls();
LayoutInflater themedInflater = UiUtilities.getInflater(requireContext(), nightMode);
View view = themedInflater.inflate(R.layout.dialog_read_gpx_description, container, false);
setupToolbar(view);
setupImage(view);
@ -73,7 +95,10 @@ public class GpxReadDescriptionDialogFragment extends BaseOsmAndDialogFragment {
@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
if (item.getItemId() == EDIT_ID) {
GpxEditDescriptionDialogFragment.showInstance(getMyActivity(), getArgument(CONTENT_KEY));
FragmentActivity activity = getActivity();
if (activity != null) {
GpxEditDescriptionDialogFragment.showInstance(activity, contentHtml, this);
}
return true;
}
return super.onOptionsItemSelected(item);
@ -95,6 +120,14 @@ public class GpxReadDescriptionDialogFragment extends BaseOsmAndDialogFragment {
menuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
}
@Override
public void onSaveInstanceState(@NonNull Bundle outState) {
super.onSaveInstanceState(outState);
outState.putString(TITLE_KEY, title);
outState.putString(IMAGE_URL_KEY, imageUrl);
outState.putString(CONTENT_KEY, contentHtml);
}
private void setupToolbar(View view) {
Toolbar toolbar = view.findViewById(R.id.toolbar);
getMyActivity().setSupportActionBar(toolbar);
@ -107,8 +140,7 @@ public class GpxReadDescriptionDialogFragment extends BaseOsmAndDialogFragment {
toolbar.setNavigationIcon(icBack);
toolbar.setNavigationContentDescription(R.string.access_shared_string_navigate_up);
String title = getArgument(TITLE_KEY);
if (title != null) {
if (!Algorithms.isEmpty(title)) {
toolbar.setTitle(title);
int titleColor = AndroidUtils.resolveAttribute(ctx, R.attr.pstsTextColor);
toolbar.setTitleTextColor(ContextCompat.getColor(ctx, titleColor));
@ -123,7 +155,6 @@ public class GpxReadDescriptionDialogFragment extends BaseOsmAndDialogFragment {
}
private void setupImage(View view) {
final String imageUrl = getArgument(IMAGE_URL_KEY);
if (imageUrl == null) {
return;
}
@ -168,8 +199,13 @@ public class GpxReadDescriptionDialogFragment extends BaseOsmAndDialogFragment {
loadWebviewData();
}
public void updateContent(String content) {
contentHtml = content;
loadWebviewData();
}
private void loadWebviewData() {
String content = getArgument(CONTENT_KEY);
String content = contentHtml;
if (content != null) {
content = isNightMode(false) ? getColoredContent(content) : content;
String encoded = Base64.encodeToString(content.getBytes(), Base64.NO_PADDING);
@ -182,7 +218,10 @@ public class GpxReadDescriptionDialogFragment extends BaseOsmAndDialogFragment {
readBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
GpxEditDescriptionDialogFragment.showInstance(getMyActivity(), getArgument(CONTENT_KEY));
FragmentActivity activity = getActivity();
if (activity != null) {
GpxEditDescriptionDialogFragment.showInstance(activity, contentHtml, GpxReadDescriptionDialogFragment.this);
}
}
});
AndroidUiHelper.setVisibility(View.VISIBLE,
@ -193,27 +232,20 @@ public class GpxReadDescriptionDialogFragment extends BaseOsmAndDialogFragment {
}
private String getColoredContent(String content) {
return "<body style=\"color:white;\">\n" +
content +
"</body>\n";
return "<body style=\"color:white;\">\n" + content + "</body>\n";
}
private String getArgument(String key) {
Bundle args = getArguments();
if (args == null) {
return null;
public static void showInstance(@NonNull FragmentActivity activity, @NonNull String title, @NonNull String imageUrl, @NonNull String description) {
FragmentManager fragmentManager = activity.getSupportFragmentManager();
if (!fragmentManager.isStateSaved()) {
Bundle args = new Bundle();
args.putString(TITLE_KEY, title);
args.putString(IMAGE_URL_KEY, imageUrl);
args.putString(CONTENT_KEY, description);
GpxReadDescriptionDialogFragment fragment = new GpxReadDescriptionDialogFragment();
fragment.setArguments(args);
fragment.show(fragmentManager, GpxReadDescriptionDialogFragment.TAG);
}
return args.getString(key);
}
public static void showInstance(AppCompatActivity activity, String title, String imageUrl, String description) {
Bundle args = new Bundle();
args.putString(GpxReadDescriptionDialogFragment.TITLE_KEY, title);
args.putString(GpxReadDescriptionDialogFragment.IMAGE_URL_KEY, imageUrl);
args.putString(GpxReadDescriptionDialogFragment.CONTENT_KEY, description);
GpxReadDescriptionDialogFragment fragment = new GpxReadDescriptionDialogFragment();
fragment.setArguments(args);
fragment.show(activity.getSupportFragmentManager(), GpxReadDescriptionDialogFragment.TAG);
}
}

View file

@ -15,16 +15,21 @@ import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;
import com.github.mikephil.charting.interfaces.datasets.ILineDataSet;
import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.StringRes;
import androidx.appcompat.app.AlertDialog;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentManager;
import com.google.android.material.bottomnavigation.BottomNavigationView;
import net.osmand.AndroidUtils;
import net.osmand.FileUtils;
import net.osmand.FileUtils.RenameCallback;
import net.osmand.GPXUtilities.GPXFile;
import net.osmand.GPXUtilities.Track;
import net.osmand.GPXUtilities.TrkSegment;
import net.osmand.GPXUtilities.WptPt;
import net.osmand.Location;
import net.osmand.PlatformUtil;
import net.osmand.data.LatLon;
@ -48,8 +53,6 @@ import net.osmand.plus.base.ContextMenuFragment;
import net.osmand.plus.base.ContextMenuScrollFragment;
import net.osmand.plus.helpers.AndroidUiHelper;
import net.osmand.plus.helpers.GpxUiHelper;
import net.osmand.plus.helpers.GpxUiHelper.GPXDataSetType;
import net.osmand.plus.helpers.GpxUiHelper.OrderedLineDataSet;
import net.osmand.plus.mapcontextmenu.MapContextMenu;
import net.osmand.plus.mapcontextmenu.controllers.SelectedGpxMenuController.OpenGpxDetailsTask;
import net.osmand.plus.mapcontextmenu.other.TrackChartPoints;
@ -58,7 +61,6 @@ import net.osmand.plus.measurementtool.GpxData;
import net.osmand.plus.measurementtool.MeasurementEditingContext;
import net.osmand.plus.measurementtool.MeasurementToolFragment;
import net.osmand.plus.myplaces.AvailableGPXFragment.GpxInfo;
import net.osmand.plus.myplaces.GPXTabItemType;
import net.osmand.plus.myplaces.MoveGpxFileBottomSheet;
import net.osmand.plus.myplaces.MoveGpxFileBottomSheet.OnTrackFileMoveListener;
import net.osmand.plus.myplaces.SegmentActionsListener;
@ -77,14 +79,6 @@ import org.apache.commons.logging.Log;
import java.io.File;
import java.util.List;
import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.StringRes;
import androidx.appcompat.app.AlertDialog;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentManager;
import static net.osmand.plus.activities.TrackActivity.CURRENT_RECORDING;
import static net.osmand.plus.activities.TrackActivity.TRACK_FILE_NAME;
import static net.osmand.plus.myplaces.TrackActivityFragmentAdapter.isGpxFileSelected;
@ -224,8 +218,6 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
if (isPortrait()) {
AndroidUiHelper.updateVisibility(getTopShadow(), true);
AndroidUtils.setBackground(view.getContext(), getBottomContainer(), isNightMode(),
R.color.list_background_color_light, R.color.list_background_color_dark);
} else {
int widthNoShadow = getLandscapeNoShadowWidth();
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(widthNoShadow, ViewGroup.LayoutParams.WRAP_CONTENT);
@ -663,21 +655,6 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
}
}
/*private void updateCardsLayout() {
View mainView = getMainView();
if (mainView != null) {
View topShadow = getTopShadow();
FrameLayout bottomContainer = getBottomContainer();
if (getCurrentMenuState() == MenuState.HEADER_ONLY) {
topShadow.setVisibility(View.INVISIBLE);
bottomContainer.setBackgroundDrawable(null);
} else {
topShadow.setVisibility(View.VISIBLE);
AndroidUtils.setBackground(mainView.getContext(), bottomContainer, isNightMode(), R.color.list_background_color_light, R.color.list_background_color_dark);
}
}
}*/
private void setupButtons(View view) {
ColorStateList navColorStateList = AndroidUtils.createBottomNavColorStateList(getContext(), isNightMode());
BottomNavigationView bottomNav = view.findViewById(R.id.bottom_navigation);