Browse Source

fix navigation

master
Samuel Vermeulen 4 months ago
parent
commit
c8182c06d5
  1. 11
      app/src/main/java/fr/svpro/radiomercure/MainActivity.java
  2. 21
      app/src/main/res/layout/activity_main.xml
  3. 34
      app/src/main/res/menu/menu_drawer.xml

11
app/src/main/java/fr/svpro/radiomercure/MainActivity.java

@ -2,7 +2,6 @@ package fr.svpro.radiomercure;
import android.Manifest;
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DownloadManager;
@ -11,7 +10,6 @@ import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.content.pm.PackageManager;
import android.graphics.Color;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
@ -19,15 +17,12 @@ import android.os.Environment;
import android.os.IBinder;
import android.os.PowerManager;
import android.provider.Settings;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.webkit.CookieManager;
import android.webkit.URLUtil;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
@ -39,11 +34,9 @@ import androidx.appcompat.widget.Toolbar;
import androidx.core.app.ActivityCompat;
import androidx.core.view.GravityCompat;
import androidx.drawerlayout.widget.DrawerLayout;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.navigation.NavigationView;
import com.google.android.material.snackbar.Snackbar;
public class MainActivity extends AppCompatActivity {
@ -108,6 +101,10 @@ public class MainActivity extends AppCompatActivity {
case R.id.exit:
System.exit(0);
break;
case R.id.about:
dialog.show();
break;
}
drawerLayout.closeDrawer(GravityCompat.START);

21
app/src/main/res/layout/activity_main.xml

@ -8,14 +8,6 @@
tools:openDrawer="start"
tools:context=".MainActivity">
<WebView
android:id="@+id/wv"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="62dp">
</WebView>
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
@ -30,8 +22,15 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/colorPrimaryVariant"
app:titleTextColor="@color/white"
app:popupTheme="@style/Theme.RadioMercure" />
app:popupTheme="@style/Theme.RadioMercure"
app:titleTextColor="@color/white" />
<WebView
android:id="@+id/wv"
android:layout_width="match_parent"
android:layout_height="match_parent">
</WebView>
</com.google.android.material.appbar.AppBarLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
@ -41,9 +40,9 @@
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="@color/white"
android:fitsSystemWindows="true"
app:headerLayout="@layout/drawer_header"
android:background="@color/white"
app:menu="@menu/menu_drawer">
</com.google.android.material.navigation.NavigationView>

34
app/src/main/res/menu/menu_drawer.xml

@ -1,18 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<group android:checkableBehavior="single">
<item
android:id="@+id/live"
android:icon="@android:drawable/ic_media_play"
android:title="@string/menu_live" />
<item android:title="Radio Mercure">
<menu>
<item
android:id="@+id/live"
android:icon="@android:drawable/ic_media_play"
android:title="@string/menu_live" />
<item
android:id="@+id/tel"
android:icon="@android:drawable/stat_sys_phone_call"
android:title="@string/menu_phone" />
<item
android:id="@+id/tel"
android:icon="@android:drawable/stat_sys_phone_call"
android:title="@string/menu_phone" />
</menu>
</group>
</item>
<item android:title="Options">
<menu>
@ -21,11 +23,21 @@
android:icon="@android:drawable/ic_popup_sync"
android:title="@string/menu_reload" />
</menu>
</item>
<item android:title="L'Application">
<menu>
<item
android:id="@+id/about"
android:icon="@android:drawable/ic_menu_info_details"
android:title="@string/menu_about" />
<item
android:id="@+id/exit"
android:icon="@android:drawable/ic_lock_power_off"
android:title="@string/menu_exit" />
</menu>
</item>
</menu>
Loading…
Cancel
Save