optimisation
This commit is contained in:
parent
a5ed9f22a5
commit
67e0f1e607
@ -48,6 +48,10 @@ dependencies {
|
|||||||
implementation 'com.google.android.material:material:1.8.0'
|
implementation 'com.google.android.material:material:1.8.0'
|
||||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
||||||
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
|
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
|
||||||
|
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.5.1'
|
||||||
|
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1'
|
||||||
|
implementation 'androidx.navigation:navigation-fragment:2.5.3'
|
||||||
|
implementation 'androidx.navigation:navigation-ui:2.5.3'
|
||||||
testImplementation 'junit:junit:4.13.2'
|
testImplementation 'junit:junit:4.13.2'
|
||||||
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
|
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
|
||||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
|
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
|
||||||
|
@ -15,10 +15,11 @@
|
|||||||
android:requestLegacyExternalStorage="true"
|
android:requestLegacyExternalStorage="true"
|
||||||
android:roundIcon="@drawable/logo512x512"
|
android:roundIcon="@drawable/logo512x512"
|
||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/Theme.RadioMercure">
|
android:theme="@style/Theme.NavigationDrawer">
|
||||||
<activity
|
<activity
|
||||||
android:name=".MainActivity"
|
android:name=".MainActivity"
|
||||||
android:exported="true"
|
android:exported="true"
|
||||||
|
android:theme="@style/Theme.NavigationDrawer.NoActionBar"
|
||||||
android:screenOrientation="portrait">
|
android:screenOrientation="portrait">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
@ -2,7 +2,6 @@ package fr.svpro.radiomercure;
|
|||||||
|
|
||||||
import android.Manifest;
|
import android.Manifest;
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.app.ActionBar;
|
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.app.DownloadManager;
|
import android.app.DownloadManager;
|
||||||
@ -11,8 +10,6 @@ import android.content.Context;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.ServiceConnection;
|
import android.content.ServiceConnection;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.graphics.Color;
|
|
||||||
import android.graphics.drawable.ColorDrawable;
|
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@ -30,7 +27,6 @@ import android.webkit.WebViewClient;
|
|||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import androidx.annotation.ColorInt;
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.RequiresApi;
|
import androidx.annotation.RequiresApi;
|
||||||
import androidx.appcompat.app.ActionBarDrawerToggle;
|
import androidx.appcompat.app.ActionBarDrawerToggle;
|
||||||
@ -39,6 +35,7 @@ import androidx.appcompat.widget.Toolbar;
|
|||||||
import androidx.core.app.ActivityCompat;
|
import androidx.core.app.ActivityCompat;
|
||||||
import androidx.core.view.GravityCompat;
|
import androidx.core.view.GravityCompat;
|
||||||
import androidx.drawerlayout.widget.DrawerLayout;
|
import androidx.drawerlayout.widget.DrawerLayout;
|
||||||
|
|
||||||
import com.google.android.material.navigation.NavigationView;
|
import com.google.android.material.navigation.NavigationView;
|
||||||
|
|
||||||
public class MainActivity extends AppCompatActivity {
|
public class MainActivity extends AppCompatActivity {
|
||||||
@ -225,20 +222,39 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
public boolean onCreateOptionsMenu(Menu menuOpt) {
|
public boolean onCreateOptionsMenu(Menu menuOpt) {
|
||||||
getMenuInflater().inflate(R.menu.option,menuOpt);
|
getMenuInflater().inflate(R.menu.option,menuOpt);
|
||||||
return super.onCreateOptionsMenu(menuOpt);
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
|
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
|
||||||
int id = item.getItemId();
|
int id = item.getItemId();
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case R.id.share:
|
case R.id.clear_cache:
|
||||||
web.clearCache(true);
|
web.clearCache(true);
|
||||||
Toast.makeText(this, "Rechargement...", Toast.LENGTH_SHORT).show();
|
Toast.makeText(this, "Effacement du cache...", Toast.LENGTH_SHORT).show();
|
||||||
|
reStart();
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
case R.id.share:
|
||||||
|
String urlPage = web.getUrl();
|
||||||
|
Intent share = new Intent(Intent.ACTION_SEND);
|
||||||
|
share.setType("text/plain");
|
||||||
|
share.putExtra(Intent.EXTRA_SUBJECT, "Partager page...");
|
||||||
|
share.putExtra(Intent.EXTRA_TEXT, urlPage);
|
||||||
|
startActivity(Intent.createChooser(share, "Partager sur..."));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case R.id.about:
|
||||||
|
dialog.show();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case R.id.exit:
|
||||||
|
System.exit(0);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createDialog()
|
private void createDialog()
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
android:id="@+id/drawer_layout"
|
android:id="@+id/drawer_layout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:fitsSystemWindows="true"
|
||||||
tools:openDrawer="start"
|
tools:openDrawer="start"
|
||||||
tools:context=".MainActivity">
|
tools:context=".MainActivity">
|
||||||
|
|
||||||
@ -14,43 +15,38 @@
|
|||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<com.google.android.material.appbar.AppBarLayout
|
<com.google.android.material.appbar.AppBarLayout
|
||||||
style="@style/Widget.Material3.DrawerLayout"
|
style="@style/Theme.NavigationDrawer.AppBarOverlay"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content">
|
||||||
android:pointerIcon="copy"
|
|
||||||
tools:ignore="WebViewLayout">
|
|
||||||
|
|
||||||
<androidx.appcompat.widget.Toolbar
|
<androidx.appcompat.widget.Toolbar
|
||||||
android:id="@+id/toolBar"
|
android:id="@+id/toolBar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="?attr/actionBarSize"
|
||||||
android:layout_gravity="start|top"
|
|
||||||
android:background="?attr/colorPrimaryVariant"
|
android:background="?attr/colorPrimaryVariant"
|
||||||
app:popupTheme="@style/Widget.Material3.PopupMenu.Overflow"
|
app:popupTheme="@style/Theme.NavigationDrawer.PopupOverlay"
|
||||||
app:titleTextColor="@color/white" />
|
app:titleTextColor="@color/white" />
|
||||||
|
|
||||||
|
|
||||||
</com.google.android.material.appbar.AppBarLayout>
|
</com.google.android.material.appbar.AppBarLayout>
|
||||||
|
|
||||||
|
<WebView
|
||||||
|
android:id="@+id/wv"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginTop="55dp">
|
||||||
|
|
||||||
|
</WebView>
|
||||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||||
|
|
||||||
<WebView
|
|
||||||
android:id="@+id/wv"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_marginTop="55dp">
|
|
||||||
|
|
||||||
</WebView>
|
|
||||||
|
|
||||||
<com.google.android.material.navigation.NavigationView
|
<com.google.android.material.navigation.NavigationView
|
||||||
android:id="@+id/navigation_drawer"
|
android:id="@+id/navigation_drawer"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_gravity="start"
|
android:layout_gravity="start"
|
||||||
android:background="@color/white"
|
android:background="@color/white"
|
||||||
app:itemTextColor="#FF5722"
|
app:itemTextColor="@color/black"
|
||||||
android:fitsSystemWindows="true"
|
android:fitsSystemWindows="false"
|
||||||
app:headerLayout="@layout/drawer_header"
|
app:headerLayout="@layout/drawer_header"
|
||||||
|
app:itemIconTint="?attr/colorPrimary"
|
||||||
app:menu="@menu/menu_drawer">
|
app:menu="@menu/menu_drawer">
|
||||||
|
|
||||||
</com.google.android.material.navigation.NavigationView>
|
</com.google.android.material.navigation.NavigationView>
|
||||||
|
@ -7,8 +7,8 @@
|
|||||||
android:title="@string/menu_about" />
|
android:title="@string/menu_about" />
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/refresh"
|
android:id="@+id/clear_cache"
|
||||||
android:title="@string/menu_reload" />
|
android:title="@string/menu_cache" />
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/share"
|
android:id="@+id/share"
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
<string name="menu_phone">Appeler la Radio</string>
|
<string name="menu_phone">Appeler la Radio</string>
|
||||||
<string name="menu_mail">Nous Contacter</string>
|
<string name="menu_mail">Nous Contacter</string>
|
||||||
<string name="menu_live">Ecouter en direct</string>
|
<string name="menu_live">Ecouter en direct</string>
|
||||||
<string name="menu_reload">Relancer...</string>
|
<string name="menu_cache">Vider le Cache...</string>
|
||||||
<string name="menu_about">A Propos...</string>
|
<string name="menu_about">A Propos...</string>
|
||||||
<string name="menu_podmap">PodMap</string>
|
<string name="menu_podmap">PodMap</string>
|
||||||
<string name="menu_home">Tous les Podcasts</string>
|
<string name="menu_home">Tous les Podcasts</string>
|
||||||
|
@ -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.RadioMercure" parent="Theme.Material3.Light.NoActionBar">
|
<style name="Theme.NavigationDrawer" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
|
||||||
<!-- Primary brand color. -->
|
<!-- Primary brand color. -->
|
||||||
<item name="colorPrimary">#FF5722</item>
|
<item name="colorPrimary">#FF5722</item>
|
||||||
<item name="colorPrimaryVariant">#FF5722</item>
|
<item name="colorPrimaryVariant">#FF5722</item>
|
||||||
@ -13,4 +13,10 @@
|
|||||||
<item name="android:statusBarColor">?attr/colorPrimaryVariant</item>
|
<item name="android:statusBarColor">?attr/colorPrimaryVariant</item>
|
||||||
<!-- Customize your theme here. -->
|
<!-- Customize your theme here. -->
|
||||||
</style>
|
</style>
|
||||||
|
<style name="Theme.NavigationDrawer.NoActionBar">
|
||||||
|
<item name="windowActionBar">false</item>
|
||||||
|
<item name="windowNoTitle">true</item>
|
||||||
|
</style>
|
||||||
|
<style name="Theme.NavigationDrawer.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar"/>
|
||||||
|
<style name="Theme.NavigationDrawer.PopupOverlay" parent="ThemeOverlay.AppCompat.Light"/>
|
||||||
</resources>
|
</resources>
|
Loading…
x
Reference in New Issue
Block a user