Browse Source

Dialog About

master
Samuel Vermeulen 3 months ago
parent
commit
052d2c9463
  1. 1
      .idea/misc.xml
  2. BIN
      Logo512x512.png
  3. 22
      app/src/main/java/fr/svpro/radiomercure/MainActivity.java
  4. BIN
      app/src/main/res/drawable/presentation_pstore.png
  5. 51
      app/src/main/res/layout/about_dialog.xml
  6. 4
      app/src/main/res/menu/option.xml
  7. 3
      app/src/main/res/values/strings.xml

1
.idea/misc.xml

@ -4,6 +4,7 @@
<option name="filePathToZoomLevelMap">
<map>
<entry key="..\:/Users/samue/GIT/RadioMercure/app/src/main/res/drawable/ic_launcher_background.xml" value="0.2355" />
<entry key="..\:/Users/samue/GIT/RadioMercure/app/src/main/res/layout/about_dialog.xml" value="0.33" />
<entry key="..\:/Users/samue/GIT/RadioMercure/app/src/main/res/layout/activity_main.xml" value="0.11402623612512613" />
<entry key="..\:/Users/samue/GIT/RadioMercure/app/src/main/res/menu/option.xml" value="0.33" />
</map>

BIN
Logo512x512.png

Before

Width: 512  |  Height: 512  |  Size: 1.0 MiB

After

Width: 512  |  Height: 512  |  Size: 80 KiB

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

@ -6,6 +6,7 @@ import androidx.core.app.ActivityCompat;
import android.Manifest;
import android.app.Activity;
import android.app.Dialog;
import android.app.DownloadManager;
import android.content.ActivityNotFoundException;
import android.content.Intent;
@ -25,6 +26,7 @@ import android.webkit.URLUtil;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.TextView;
import android.widget.Toast;
import java.io.IOException;
@ -35,6 +37,8 @@ public class MainActivity extends AppCompatActivity {
private WebView web;
private String url, userAgent, contentDisposition, mimeType;
private Menu menu;
private Dialog dialog;
private TextView tv_close;
@Override
protected void onCreate(Bundle savedInstanceState) {
@ -80,8 +84,22 @@ public class MainActivity extends AppCompatActivity {
}
});
createDialog();
}
private void createDialog()
{
dialog=new Dialog(this);
dialog.setTitle("A Propos de l'Application");
dialog.setContentView(R.layout.about_dialog);
tv_close= (TextView) dialog.findViewById(R.id.tv_close);
tv_close.setOnClickListener(v -> dialog.dismiss());
}
private void TelechargemntPodcast() {
DownloadManager.Request request = new DownloadManager.Request(Uri.parse(url));
@ -134,6 +152,10 @@ public class MainActivity extends AppCompatActivity {
System.exit(0);
return true;
case R.id.about:
dialog.show();
return true;
default:
return super.onOptionsItemSelected(item);
}

BIN
app/src/main/res/drawable/presentation_pstore.png

After

Width: 1024  |  Height: 500  |  Size: 456 KiB

51
app/src/main/res/layout/about_dialog.xml

@ -0,0 +1,51 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ImageView
android:id="@+id/iv_logo"
android:layout_width="match_parent"
android:layout_height="314dp"
android:layout_gravity="center_horizontal"
android:padding="5dp"
app:srcCompat="@drawable/presentation_pstore" />
<TextView
android:id="@+id/tv_nom"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:paddingLeft="24dp"
android:paddingTop="24dp"
android:paddingRight="24dp"
android:paddingBottom="20dp"
android:text="@string/dialog_txt"
android:textAlignment="center"
android:textAppearance="?android:attr/textAppearanceLarge" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="52dp"
android:gravity="center_vertical|end"
android:orientation="horizontal"
android:padding="8dp">
<TextView
android:id="@+id/tv_close"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:height="48dp"
android:gravity="center_vertical|center_horizontal"
android:padding="5dp"
android:text="@string/dialog_close"
android:clickable="true"
android:textAlignment="center"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="@color/purple_700" />
</LinearLayout>
</LinearLayout>

4
app/src/main/res/menu/option.xml

@ -2,6 +2,10 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/about"
android:title="@string/menu_about" />
<item
android:id="@+id/refresh"
android:title="@string/menu_reload" />

3
app/src/main/res/values/strings.xml

@ -2,4 +2,7 @@
<string name="app_name">Radio Mercure</string>
<string name="menu_exit">Quitter</string>
<string name="menu_reload">Relancer...</string>
<string name="menu_about">A Propos...</string>
<string name="dialog_close">Fermer</string>
<string name="dialog_txt">Application conçue par Samuel Vermeulen</string>
</resources>
Loading…
Cancel
Save