Browse Source

Ajout fonction appel téléphone radio

pull/1/head
Samuel Vermeulen 6 months ago
parent
commit
7fa7d65377
  1. 9
      app/src/main/java/fr/svpro/radiomercure/MainActivity.java
  2. 5
      app/src/main/res/menu/option.xml
  3. 1
      app/src/main/res/values/strings.xml

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

@ -3,8 +3,8 @@ package fr.svpro.radiomercure;
import android.Manifest;
import android.app.Dialog;
import android.app.DownloadManager;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
@ -33,6 +33,7 @@ public class MainActivity extends AppCompatActivity {
private TextView tv_close;
private TextView tv_version;
private static String versionName;
private static final String NUMERO_TEL_RADIO = "0375411456";
static {
versionName = BuildConfig.VERSION_NAME;
@ -156,6 +157,12 @@ public class MainActivity extends AppCompatActivity {
dialog.show();
return true;
case R.id.tel:
Intent intent = new Intent(Intent.ACTION_DIAL);
intent.setData(Uri.parse("tel:" + NUMERO_TEL_RADIO));
startActivity(intent);
return true;
default:
return super.onOptionsItemSelected(item);
}

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

@ -10,6 +10,11 @@
android:id="@+id/refresh"
android:title="@string/menu_reload" />
<item
android:id="@+id/tel"
android:icon="@android:drawable/stat_sys_phone_call"
android:title="@string/menu_phone"
app:showAsAction="ifRoom" />
<item
android:id="@+id/exit"
android:icon="@android:drawable/ic_lock_power_off"

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

@ -1,6 +1,7 @@
<resources>
<string name="app_name">Radio Mercure</string>
<string name="menu_exit">Quitter</string>
<string name="menu_phone">Appeler la Radio</string>
<string name="menu_reload">Relancer...</string>
<string name="menu_about">A Propos...</string>
<string name="dialog_close">Fermer</string>

Loading…
Cancel
Save