Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 90 additions & 0 deletions android-app/app/src/main/java/app/cinemood/handy/NavBar.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
package app.cinemood.handy;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.RectF;
import android.util.AttributeSet;
import android.widget.LinearLayout;

/**
* Navigationsleiste unten, gleich wie in der Web-App: Die runden Bubbles stehen frei, die Leiste
* beginnt auf halber Bubble-Höhe, ist oben gerade und hat unter jeder Bubble eine runde Mulde mit
* abgerundeten Kanten.
*/
public class NavBar extends LinearLayout {
/** Bubble-Mitte über der Oberkante der Leiste (halbe Bubble, 56 dp). */
private static final float BUBBLE_HALF_DP = 28f;
/** Radius der Mulde (Bubble plus etwas Luft) und der abgerundeten Kanten. */
private static final float CRADLE_DP = 34f;
private static final float FILLET_DP = 12f;

private final Paint fill = new Paint(Paint.ANTI_ALIAS_FLAG);
private final Paint edge = new Paint(Paint.ANTI_ALIAS_FLAG);
private final Path path = new Path();
private final RectF oval = new RectF();

public NavBar(Context context, AttributeSet attrs) {
super(context, attrs);
setWillNotDraw(false);
fill.setColor(context.getColor(R.color.bar));
edge.setColor(context.getColor(R.color.bar_edge));
edge.setStyle(Paint.Style.STROKE);
edge.setStrokeWidth(dp(1));
}

private float dp(float v) {
return v * getResources().getDisplayMetrics().density;
}

@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
buildPath(w, h);
}

private void buildPath(int w, int h) {
float top = getPaddingTop() + dp(BUBBLE_HALF_DP);
float big = dp(CRADLE_DP);
float small = dp(FILLET_DP);
float d = (float) Math.sqrt((big + small) * (big + small) - small * small);
float k = big / (big + small);
// Winkel (Grad, im Uhrzeigersinn ab 3 Uhr) der Berührpunkte Kante/Mulde
float angle = (float) Math.toDegrees(Math.atan2(small * k, d * k));
int count = Math.max(1, getChildCount());

path.reset();
path.moveTo(-dp(1), top);
for (int i = 0; i < count; i++) {
float c = (i + 0.5f) * w / count;
path.lineTo(c - d, top);
// linke abgerundete Kante: Kreis um (c-d, top+small), von oben nach rechts unten
oval.set(c - d - small, top, c - d + small, top + 2 * small);
path.arcTo(oval, 270f, 90f - angle, false);
// Mulde: Kreis um (c, top), von links unten über den Boden nach rechts unten
oval.set(c - big, top - big, c + big, top + big);
path.arcTo(oval, 180f - angle, -(180f - 2 * angle), false);
// rechte abgerundete Kante
oval.set(c + d - small, top, c + d + small, top + 2 * small);
path.arcTo(oval, 180f + angle, 90f - angle, false);
}
path.lineTo(w + dp(1), top);
path.lineTo(w + dp(1), h + dp(1));
path.lineTo(-dp(1), h + dp(1));
path.close();
}

@Override
protected void onDraw(Canvas canvas) {
canvas.drawPath(path, fill);
canvas.drawPath(path, edge);
super.onDraw(canvas);
}

@Override
public void onViewAdded(android.view.View child) {
super.onViewAdded(child);
if (getWidth() > 0) buildPath(getWidth(), getHeight());
}
}
6 changes: 6 additions & 0 deletions android-app/app/src/main/res/color/nav_icon.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Symbol in der Bubble: auf der goldenen (aktiven) Bubble dunkel, sonst gedämpft -->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@color/bg" android:state_selected="true" />
<item android:color="@color/cream_dim" />
</selector>
3 changes: 2 additions & 1 deletion android-app/app/src/main/res/drawable/nav_account.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
android:viewportHeight="24"
android:tint="@color/nav_icon">
<path
android:fillColor="#FFFFFFFF"
android:pathData="M12,12c2.21,0 4,-1.79 4,-4s-1.79,-4 -4,-4 -4,1.79 -4,4 1.79,4 4,4zM12,14c-2.67,0 -8,1.34 -8,4v2h16v-2c0,-2.66 -5.33,-4 -8,-4z" />
Expand Down
6 changes: 6 additions & 0 deletions android-app/app/src/main/res/drawable/nav_bubble_account.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Bubble mit Symbol für die Navigationsleiste -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/nav_bubble_bg" android:width="56dp" android:height="56dp" />
<item android:drawable="@drawable/nav_account" android:width="24dp" android:height="24dp" android:gravity="center" />
</layer-list>
17 changes: 17 additions & 0 deletions android-app/app/src/main/res/drawable/nav_bubble_bg.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Runde Bubble: aktiv gold, sonst dunkelrot mit feinem Rand -->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="true">
<shape android:shape="oval">
<solid android:color="@color/gold" />
<size android:width="56dp" android:height="56dp" />
</shape>
</item>
<item>
<shape android:shape="oval">
<solid android:color="@color/bubble" />
<stroke android:width="1dp" android:color="@color/bar_edge" />
<size android:width="56dp" android:height="56dp" />
</shape>
</item>
</selector>
6 changes: 6 additions & 0 deletions android-app/app/src/main/res/drawable/nav_bubble_lobby.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Bubble mit Symbol für die Navigationsleiste -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/nav_bubble_bg" android:width="56dp" android:height="56dp" />
<item android:drawable="@drawable/nav_lobby" android:width="24dp" android:height="24dp" android:gravity="center" />
</layer-list>
6 changes: 6 additions & 0 deletions android-app/app/src/main/res/drawable/nav_bubble_train.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Bubble mit Symbol für die Navigationsleiste -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/nav_bubble_bg" android:width="56dp" android:height="56dp" />
<item android:drawable="@drawable/nav_train" android:width="24dp" android:height="24dp" android:gravity="center" />
</layer-list>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Bubble mit Symbol für die Navigationsleiste -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/nav_bubble_bg" android:width="56dp" android:height="56dp" />
<item android:drawable="@drawable/nav_watchlist" android:width="24dp" android:height="24dp" android:gravity="center" />
</layer-list>
8 changes: 2 additions & 6 deletions android-app/app/src/main/res/drawable/nav_item_bg.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Antippen zeigt eine goldene Welle -->
<ripple xmlns:android="http://schemas.android.com/apk/res/android" android:color="#33ffc94d">
<item android:id="@android:id/mask">
<color android:color="#FFFFFFFF" />
</item>
</ripple>
<!-- Antippen zeigt eine goldene Welle rund um die Bubble -->
<ripple xmlns:android="http://schemas.android.com/apk/res/android" android:color="#33ffc94d" android:radius="36dp" />
3 changes: 2 additions & 1 deletion android-app/app/src/main/res/drawable/nav_lobby.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
android:viewportHeight="24"
android:tint="@color/nav_icon">
<path
android:fillColor="#FFFFFFFF"
android:pathData="M10,20v-6h4v6h5v-8h3L12,3 2,12h3v8z" />
Expand Down
3 changes: 2 additions & 1 deletion android-app/app/src/main/res/drawable/nav_train.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
android:viewportHeight="24"
android:tint="@color/nav_icon">
<path
android:fillColor="#FFFFFFFF"
android:pathData="M19,9l1.25,-2.75L23,5l-2.75,-1.25L19,1l-1.25,2.75L15,5l2.75,1.25L19,9zM11.5,9.5L9,4 6.5,9.5 1,12l5.5,2.5L9,20l2.5,-5.5L17,12l-5.5,-2.5zM19,15l-1.25,2.75L15,19l2.75,1.25L19,23l1.25,-2.75L23,19l-2.75,-1.25L19,15z" />
Expand Down
3 changes: 2 additions & 1 deletion android-app/app/src/main/res/drawable/nav_watchlist.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
android:viewportHeight="24"
android:tint="@color/nav_icon">
<path
android:fillColor="#FFFFFFFF"
android:pathData="M17,3H7c-1.1,0 -1.99,0.9 -1.99,2L5,21l7,-3 7,3V5c0,-1.1 -0.9,-2 -2,-2z" />
Expand Down
18 changes: 9 additions & 9 deletions android-app/app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,36 +73,36 @@
</LinearLayout>
</FrameLayout>

<!-- Navigationsleiste unten: Lobby, Watchlist, Train my Algorithm, Konto -->
<LinearLayout
<!-- Navigationsleiste unten: Lobby, Watchlist, Train my Algorithm, Konto (runde Bubbles, Form in NavBar) -->
<app.cinemood.handy.NavBar
android:id="@+id/nav"
android:layout_width="match_parent"
android:layout_height="64dp"
android:background="@color/bg_light"
android:layout_height="wrap_content"
android:paddingTop="6dp"
android:orientation="horizontal">

<TextView
android:id="@+id/nav_lobby"
style="@style/NavItem"
android:drawableTop="@drawable/nav_lobby"
android:drawableTop="@drawable/nav_bubble_lobby"
android:text="@string/nav_lobby" />

<TextView
android:id="@+id/nav_watchlist"
style="@style/NavItem"
android:drawableTop="@drawable/nav_watchlist"
android:drawableTop="@drawable/nav_bubble_watchlist"
android:text="@string/nav_watchlist" />

<TextView
android:id="@+id/nav_train"
style="@style/NavItem"
android:drawableTop="@drawable/nav_train"
android:drawableTop="@drawable/nav_bubble_train"
android:text="@string/nav_train" />

<TextView
android:id="@+id/nav_account"
style="@style/NavItem"
android:drawableTop="@drawable/nav_account"
android:drawableTop="@drawable/nav_bubble_account"
android:text="@string/nav_account" />
</LinearLayout>
</app.cinemood.handy.NavBar>
</LinearLayout>
2 changes: 1 addition & 1 deletion android-app/app/src/main/res/values-v35/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<item name="android:colorPrimaryDark">@color/bg</item>
<item name="android:colorAccent">@color/gold</item>
<item name="android:statusBarColor">@color/bg</item>
<item name="android:navigationBarColor">@color/bg_light</item>
<item name="android:navigationBarColor">@color/bar</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowOptOutEdgeToEdgeEnforcement">true</item>
</style>
Expand Down
4 changes: 4 additions & 0 deletions android-app/app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
<resources>
<color name="bg">#2a0a14</color>
<color name="bg_light">#3d1220</color>
<!-- Navigationsleiste unten (wie in der Web-App) -->
<color name="bar">#45101f</color>
<color name="bar_edge">#7a2a3c</color>
<color name="bubble">#5a1628</color>
<color name="gold">#ffc94d</color>
<color name="cream">#f6e7da</color>
<color name="cream_dim">#c9b3a6</color>
Expand Down
13 changes: 6 additions & 7 deletions android-app/app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<item name="android:colorPrimaryDark">@color/bg</item>
<item name="android:colorAccent">@color/gold</item>
<item name="android:statusBarColor">@color/bg</item>
<item name="android:navigationBarColor">@color/bg_light</item>
<item name="android:navigationBarColor">@color/bar</item>
<item name="android:windowNoTitle">true</item>
</style>

Expand All @@ -27,15 +27,14 @@

<style name="NavItem">
<item name="android:layout_width">0dp</item>
<item name="android:layout_height">match_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_weight">1</item>
<item name="android:gravity">center</item>
<item name="android:paddingTop">8dp</item>
<item name="android:paddingBottom">6dp</item>
<item name="android:drawablePadding">2dp</item>
<item name="android:drawableTint">@color/nav_item</item>
<item name="android:gravity">center_horizontal</item>
<item name="android:paddingBottom">10dp</item>
<item name="android:drawablePadding">10dp</item>
<item name="android:textColor">@color/nav_item</item>
<item name="android:textSize">12sp</item>
<item name="android:textStyle">bold</item>
<item name="android:maxLines">1</item>
<item name="android:ellipsize">end</item>
<item name="android:background">@drawable/nav_item_bg</item>
Expand Down
2 changes: 1 addition & 1 deletion src/app/[lang]/fernseher/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default async function FernseherPage() {
<main className="mx-auto flex w-full max-w-md flex-1 flex-col gap-6 px-4 py-5">
<header className="flex items-center justify-between gap-3">
<Brand />
<nav className="flex items-center gap-4">
<nav className="flex min-w-0 flex-wrap items-center justify-end gap-x-4 gap-y-1">
<Link href="/watchlist" className="text-sm text-muted underline decoration-line underline-offset-4 hover:text-text">
{t.common.abspann}
</Link>
Expand Down
32 changes: 30 additions & 2 deletions src/app/[lang]/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -190,16 +190,44 @@ body {
Home-Balken (viewport-fit=cover). Oben Platz für die Uhrzeit, unten für die Navigationsleiste.
*/
html.app {
--app-nav-h: 6rem;
background: var(--velvet);
/*
iOS-Fehler bei Web-Apps mit durchsichtiger Statusleiste: Ist eine Seite kürzer als der Bildschirm,
rechnet Safari die Höhe ohne Statusleiste und alles mit "bottom: 0" rutscht um genau diese Höhe
nach oben (Leiste schwebt über einem leeren Streifen). Die Seite deshalb immer um die Statusleiste
höher machen, dann sitzt die Leiste auf jeder Seite unten.
*/
height: auto;
min-height: calc(100% + env(safe-area-inset-top));
}
html.app body {
min-height: calc(100vh + env(safe-area-inset-top));
overflow-x: clip;
padding-top: env(safe-area-inset-top);
padding-bottom: calc(4rem + env(safe-area-inset-bottom));
padding-bottom: calc(var(--app-nav-h) + env(safe-area-inset-bottom));
}
body {
padding-left: env(safe-area-inset-left);
padding-right: env(safe-area-inset-right);
}
.app-nav {
padding-bottom: env(safe-area-inset-bottom);
padding-bottom: max(0.6rem, env(safe-area-inset-bottom));
}
/*
Leiste unter den Bubbles: beginnt auf halber Bubble-Höhe, ist oben gerade und hat unter jeder
Bubble (Durchmesser 3.5rem) eine runde Mulde mit etwas Luft. Die Mulden kommen aus einer Maske,
die sich alle 100%/Anzahl wiederholt, so sitzt jede genau unter ihrem Eintrag.
*/
/* Leiste (SVG aus AppNav): beginnt auf halber Bubble-Höhe, Rand und Schatten folgen den Mulden */
.app-nav-edge {
position: absolute;
inset: 1.75rem 0 0 0;
filter: drop-shadow(0 -8px 14px rgb(0 0 0 / 0.4));
}
.app-nav-bubble {
box-shadow: inset 0 0 0 1px rgb(122 42 60 / 0.8), 0 6px 16px rgb(0 0 0 / 0.35);
}
.app-nav-bubble.bg-accent {
box-shadow: 0 6px 20px rgb(255 201 77 / 0.35);
}
2 changes: 1 addition & 1 deletion src/app/[lang]/konto/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default async function KontoPage() {
<main className="mx-auto flex w-full max-w-md flex-1 flex-col gap-6 px-4 py-5">
<header className="flex items-center justify-between gap-3">
<Brand />
<nav className="flex items-center gap-4">
<nav className="flex min-w-0 flex-wrap items-center justify-end gap-x-4 gap-y-1">
<Link href="/trainieren" className="text-sm text-muted underline decoration-line underline-offset-4 hover:text-text">
{t.common.train}
</Link>
Expand Down
2 changes: 1 addition & 1 deletion src/app/[lang]/trainieren/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default async function TrainPage() {
<main className="mx-auto flex w-full max-w-md flex-1 flex-col gap-6 px-4 py-5">
<header className="flex items-center justify-between gap-3">
<Brand />
<nav className="flex items-center gap-4">
<nav className="flex min-w-0 flex-wrap items-center justify-end gap-x-4 gap-y-1">
<Link href="/konto" className="text-sm text-muted underline decoration-line underline-offset-4 hover:text-text">
{t.common.account}
</Link>
Expand Down
2 changes: 1 addition & 1 deletion src/app/[lang]/watchlist/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default async function WatchlistPage() {
<main className="mx-auto flex w-full max-w-md flex-1 flex-col gap-6 px-4 py-5">
<header className="flex items-center justify-between gap-3">
<Brand />
<nav className="flex items-center gap-4">
<nav className="flex min-w-0 flex-wrap items-center justify-end gap-x-4 gap-y-1">
<Link href="/fernseher" className="text-sm text-muted underline decoration-line underline-offset-4 hover:text-text">
{t.common.tv}
</Link>
Expand Down
Loading
Loading