Compare commits
2 Commits
master
..
a97002db71
| Author | SHA1 | Date | |
|---|---|---|---|
| a97002db71 | |||
| cfc323704f |
@@ -34,6 +34,9 @@ public class AppController {
|
|||||||
}
|
}
|
||||||
public AppCompatActivity getActivity() { return appActivity; }
|
public AppCompatActivity getActivity() { return appActivity; }
|
||||||
public void init() {
|
public void init() {
|
||||||
|
if (getActivity().getSupportActionBar() != null)
|
||||||
|
getActivity().getSupportActionBar().hide();
|
||||||
|
|
||||||
if(map == null) map = new MapComponent(this);
|
if(map == null) map = new MapComponent(this);
|
||||||
if(ui == null) {
|
if(ui == null) {
|
||||||
ui = new UIComponent(this, map);
|
ui = new UIComponent(this, map);
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package eu.konggdev.strikemaps.ui;
|
|||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.appcompat.widget.Toolbar;
|
|
||||||
import eu.konggdev.strikemaps.Component;
|
import eu.konggdev.strikemaps.Component;
|
||||||
import eu.konggdev.strikemaps.R;
|
import eu.konggdev.strikemaps.R;
|
||||||
import eu.konggdev.strikemaps.app.AppController;
|
import eu.konggdev.strikemaps.app.AppController;
|
||||||
@@ -42,8 +41,7 @@ public class UIComponent implements Component {
|
|||||||
R.id.mainContentView, new MainContentRegion(map.toFragment(), R.id.mainContentView),
|
R.id.mainContentView, new MainContentRegion(map.toFragment(), R.id.mainContentView),
|
||||||
R.id.bottomUi, new UIRegion(new FragmentLayoutControls(app, R.id.bottomUi), R.id.bottomUi),
|
R.id.bottomUi, new UIRegion(new FragmentLayoutControls(app, R.id.bottomUi), R.id.bottomUi),
|
||||||
R.id.topUi, new UIRegion(new FragmentLayoutSearch(app, R.id.topUi), R.id.topUi)
|
R.id.topUi, new UIRegion(new FragmentLayoutSearch(app, R.id.topUi), R.id.topUi)
|
||||||
), //TODO: Probably stop referencing layout 3(!) times everytime
|
) //TODO: Probably stop referencing layout 3(!) times everytime
|
||||||
null
|
|
||||||
),
|
),
|
||||||
//Settings screen
|
//Settings screen
|
||||||
DefinedScreen.SETTINGS, new Screen(
|
DefinedScreen.SETTINGS, new Screen(
|
||||||
@@ -51,8 +49,7 @@ public class UIComponent implements Component {
|
|||||||
//Just the settings content fragment
|
//Just the settings content fragment
|
||||||
Map.of(
|
Map.of(
|
||||||
R.id.mainContentView, new MainContentRegion(new FragmentLayoutContentSettings(), R.id.mainContentView)
|
R.id.mainContentView, new MainContentRegion(new FragmentLayoutContentSettings(), R.id.mainContentView)
|
||||||
),
|
)
|
||||||
new Toolbar(app.getActivity())
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,11 +38,4 @@ public final class AlertDialogFactory {
|
|||||||
|
|
||||||
return dialog;
|
return dialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static AlertDialog searchSettings(AppController app) {
|
|
||||||
return new AlertDialog.Builder(app.getActivity())
|
|
||||||
.setTitle("Configure Search")
|
|
||||||
.setPositiveButton("OK", null)
|
|
||||||
.create();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
+12
-50
@@ -1,24 +1,29 @@
|
|||||||
package eu.konggdev.strikemaps.ui.fragment.layout;
|
package eu.konggdev.strikemaps.ui.fragment.layout;
|
||||||
|
|
||||||
|
import android.Manifest;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.graphics.drawable.ColorDrawable;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
import android.view.ViewGroup;
|
|
||||||
import android.widget.PopupWindow;
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import android.widget.PopupMenu;
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
import eu.konggdev.strikemaps.R;
|
import eu.konggdev.strikemaps.R;
|
||||||
import eu.konggdev.strikemaps.app.AppController;
|
import eu.konggdev.strikemaps.app.AppController;
|
||||||
import eu.konggdev.strikemaps.ui.factory.AlertDialogFactory;
|
import eu.konggdev.strikemaps.data.helper.UserPrefsHelper;
|
||||||
|
import eu.konggdev.strikemaps.map.overlay.implementation.LocationOverlay;
|
||||||
|
import eu.konggdev.strikemaps.ui.fragment.popup.FragmentMapChangePopup;
|
||||||
import eu.konggdev.strikemaps.ui.screen.definition.DefinedScreen;
|
import eu.konggdev.strikemaps.ui.screen.definition.DefinedScreen;
|
||||||
|
|
||||||
public class FragmentLayoutSearch extends Fragment implements Layout {
|
public class FragmentLayoutSearch extends Fragment implements Layout {
|
||||||
AppController app;
|
AppController app;
|
||||||
|
View rootView;
|
||||||
|
|
||||||
private final Integer region;
|
private final Integer region;
|
||||||
|
|
||||||
public FragmentLayoutSearch(AppController app, Integer region) {
|
public FragmentLayoutSearch(AppController app, Integer region) {
|
||||||
@@ -40,50 +45,7 @@ public class FragmentLayoutSearch extends Fragment implements Layout {
|
|||||||
@Override
|
@Override
|
||||||
public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
|
public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
|
||||||
super.onViewCreated(view, savedInstanceState);
|
super.onViewCreated(view, savedInstanceState);
|
||||||
|
//TODO: Make a floating menu instead of going right in settings
|
||||||
setupButton(view, R.id.hamburgerButton, click(() -> {
|
setupButton(view, R.id.hamburgerButton, click(() -> app.getUi().swapScreen(DefinedScreen.SETTINGS)));
|
||||||
|
|
||||||
View menuView = getLayoutInflater().inflate(R.layout.menu_dropdown, null);
|
|
||||||
|
|
||||||
PopupWindow popupWindow = new PopupWindow(
|
|
||||||
menuView,
|
|
||||||
ViewGroup.LayoutParams.WRAP_CONTENT,
|
|
||||||
ViewGroup.LayoutParams.WRAP_CONTENT,
|
|
||||||
true
|
|
||||||
);
|
|
||||||
|
|
||||||
popupWindow.setOutsideTouchable(true);
|
|
||||||
popupWindow.setFocusable(true);
|
|
||||||
popupWindow.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
|
||||||
|
|
||||||
setupButton(menuView, R.id.menuSearchSettings, click(() -> {
|
|
||||||
app.getUi().alert(AlertDialogFactory.searchSettings(app));
|
|
||||||
}));
|
|
||||||
|
|
||||||
setupButton(menuView, R.id.menuSettings, click(() -> {
|
|
||||||
popupWindow.dismiss();
|
|
||||||
app.getUi().swapScreen(DefinedScreen.SETTINGS);
|
|
||||||
}));
|
|
||||||
|
|
||||||
menuView.findViewById(R.id.menuSearchSettings).setOnClickListener(v -> popupWindow.dismiss());
|
|
||||||
menuView.findViewById(R.id.menuAbout).setOnClickListener(v -> popupWindow.dismiss());
|
|
||||||
|
|
||||||
View anchor = view.findViewById(R.id.searchContainer);
|
|
||||||
|
|
||||||
anchor.post(() -> {
|
|
||||||
|
|
||||||
menuView.measure(
|
|
||||||
View.MeasureSpec.UNSPECIFIED,
|
|
||||||
View.MeasureSpec.UNSPECIFIED
|
|
||||||
);
|
|
||||||
|
|
||||||
int popupWidth = menuView.getMeasuredWidth();
|
|
||||||
int containerWidth = anchor.getWidth();
|
|
||||||
|
|
||||||
int xOffset = containerWidth - popupWidth;
|
|
||||||
popupWindow.showAsDropDown(anchor, xOffset, 1);
|
|
||||||
});
|
|
||||||
|
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,24 +2,25 @@ package eu.konggdev.strikemaps.ui.screen;
|
|||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import androidx.appcompat.widget.Toolbar;
|
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import eu.konggdev.strikemaps.app.AppController;
|
import eu.konggdev.strikemaps.app.AppController;
|
||||||
import eu.konggdev.strikemaps.ui.fragment.ContainerFragment;
|
import eu.konggdev.strikemaps.ui.fragment.ContainerFragment;
|
||||||
import eu.konggdev.strikemaps.ui.fragment.FragmentEmptyPlaceholder;
|
import eu.konggdev.strikemaps.ui.fragment.FragmentEmptyPlaceholder;
|
||||||
|
import eu.konggdev.strikemaps.ui.fragment.layout.content.main.MainContentLayout;
|
||||||
import eu.konggdev.strikemaps.ui.fragment.popup.Popup;
|
import eu.konggdev.strikemaps.ui.fragment.popup.Popup;
|
||||||
import eu.konggdev.strikemaps.ui.element.region.UIRegion;
|
import eu.konggdev.strikemaps.ui.element.region.UIRegion;
|
||||||
|
|
||||||
public class Screen {
|
public class Screen {
|
||||||
@NonNull AppController app;
|
@NonNull AppController app;
|
||||||
Toolbar supportBar;
|
public Screen(AppController app, Map<Integer, UIRegion> regions) {
|
||||||
public Screen(AppController app, Map<Integer, UIRegion> regions, Toolbar supportBar) {
|
|
||||||
this.app = app;
|
this.app = app;
|
||||||
this.uiRegions = regions;
|
this.uiRegions = regions;
|
||||||
this.supportBar = supportBar;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private MainContentLayout mainContent;
|
||||||
|
|
||||||
Map<Integer, UIRegion> uiRegions;
|
Map<Integer, UIRegion> uiRegions;
|
||||||
public Integer popup;
|
public Integer popup;
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 177 B After Width: | Height: | Size: 214 B |
@@ -4,13 +4,13 @@
|
|||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:padding="6dp">
|
android:padding="24dp">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/searchContainer"
|
android:id="@+id/searchContainer"
|
||||||
android:layout_width="320dp"
|
android:layout_width="290dp"
|
||||||
android:layout_height="35dp"
|
android:layout_height="33dp"
|
||||||
android:layout_marginTop="2dp"
|
android:layout_marginTop="4dp"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:background="#000000"
|
android:background="#000000"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
|||||||
@@ -7,4 +7,15 @@
|
|||||||
android:padding="24dp"
|
android:padding="24dp"
|
||||||
android:background="@android:color/background_dark">
|
android:background="@android:color/background_dark">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/settingsBanner"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Settings"
|
||||||
|
android:textColor="#FFFFFF"
|
||||||
|
android:textSize="21sp"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
@@ -55,5 +55,4 @@
|
|||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/choiceName"
|
app:layout_constraintTop_toBottomOf="@id/choiceName"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"/>
|
app:layout_constraintBottom_toBottomOf="parent"/>
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent">
|
|
||||||
|
|
||||||
<com.google.android.material.card.MaterialCardView
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
android:layout_width="200dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
app:cardCornerRadius="12dp"
|
|
||||||
app:cardElevation="12dp"
|
|
||||||
app:cardBackgroundColor="#000000">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:padding="8dp">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/menuSearchSettings"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:padding="12dp"
|
|
||||||
android:text="Configure Search"
|
|
||||||
android:textColor="#FFFFFF"
|
|
||||||
android:background="?android:attr/selectableItemBackground"/>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/menuSettings"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:padding="12dp"
|
|
||||||
android:text="Settings"
|
|
||||||
android:textColor="#FFFFFF"
|
|
||||||
android:background="?android:attr/selectableItemBackground"/>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/menuAbout"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:padding="12dp"
|
|
||||||
android:text="About"
|
|
||||||
android:textColor="#FFFFFF"
|
|
||||||
android:background="?android:attr/selectableItemBackground"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</com.google.android.material.card.MaterialCardView>
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||||
<!-- Base application theme. -->
|
<!-- Base application theme. -->
|
||||||
<style name="Theme.StrikeMaps" parent="Theme.MaterialComponents.DayNight.NoActionBar">
|
<style name="Theme.StrikeMaps" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
|
||||||
<!-- Primary brand color. -->
|
<!-- Primary brand color. -->
|
||||||
<item name="colorPrimary">@color/purple_200</item>
|
<item name="colorPrimary">@color/purple_200</item>
|
||||||
<item name="colorPrimaryVariant">@color/purple_700</item>
|
<item name="colorPrimaryVariant">@color/purple_700</item>
|
||||||
@@ -11,5 +11,6 @@
|
|||||||
<item name="colorOnSecondary">@color/black</item>
|
<item name="colorOnSecondary">@color/black</item>
|
||||||
<!-- Status bar color. -->
|
<!-- Status bar color. -->
|
||||||
<item name="android:statusBarColor" tools:targetApi="21">?attr/colorPrimaryVariant</item>
|
<item name="android:statusBarColor" tools:targetApi="21">?attr/colorPrimaryVariant</item>
|
||||||
|
<!-- Customize your theme here. -->
|
||||||
</style>
|
</style>
|
||||||
</resources>
|
</resources>
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
<resources>
|
<resources>
|
||||||
<string name="app_name">Strike Maps</string>
|
<string name="app_name">Strike Maps</string>
|
||||||
<string name="settings_title">Settings</string>
|
|
||||||
<string name="attribution_title"> Attribution </string>
|
<string name="attribution_title"> Attribution </string>
|
||||||
<string name="shipped_attribution">Earth map data Included;\n - © OpenStreetMap Contributors\nMap Rendering libraries Included;\n - MapLibre developed by MapLibre Organization\n - Vtm developed by Mapsforge\nStrike Maps made with <3 by konggdev</string>
|
<string name="shipped_attribution">Earth map data Included;\n - © OpenStreetMap Contributors\nMap Rendering libraries Included;\n - MapLibre developed by MapLibre Organization\n - Vtm developed by Mapsforge\nStrike Maps made with <3 by konggdev</string>
|
||||||
</resources>
|
</resources>
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||||
<!-- Base application theme. -->
|
<!-- Base application theme. -->
|
||||||
<style name="Theme.StrikeMaps" parent="Theme.MaterialComponents.DayNight.NoActionBar">
|
<style name="Theme.StrikeMaps" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
|
||||||
<!-- Primary brand color. -->
|
<!-- Primary brand color. -->
|
||||||
<item name="colorPrimary">@color/black</item>
|
<item name="colorPrimary">@color/black</item>
|
||||||
<item name="colorPrimaryVariant">@color/black</item>
|
<item name="colorPrimaryVariant">@color/black</item>
|
||||||
@@ -11,5 +11,6 @@
|
|||||||
<item name="colorOnSecondary">@color/black</item>
|
<item name="colorOnSecondary">@color/black</item>
|
||||||
<!-- Status bar color. -->
|
<!-- Status bar color. -->
|
||||||
<item name="android:statusBarColor" tools:targetApi="21">?attr/colorPrimaryVariant</item>
|
<item name="android:statusBarColor" tools:targetApi="21">?attr/colorPrimaryVariant</item>
|
||||||
|
<!-- Customize your theme here. -->
|
||||||
</style>
|
</style>
|
||||||
</resources>
|
</resources>
|
||||||
Reference in New Issue
Block a user