Browse Source

Share option

master
Samuel Vermeulen 2 months ago
parent
commit
3e6ae820c5
  1. 4
      app/build.gradle
  2. 30
      app/src/main/java/fr/svpro/radiomercure/MainActivity.java
  3. 1
      app/src/main/res/layout/activity_main.xml
  4. 5
      app/src/main/res/menu/menu_drawer.xml
  5. 14
      app/src/main/res/menu/option.xml
  6. 1
      app/src/main/res/values/strings.xml

4
app/build.gradle

@ -22,8 +22,8 @@ android {
applicationId "fr.svpro.radiomercure"
minSdk 26
targetSdk 32
versionCode 201
versionName '2.0.1'
versionCode 202
versionName '2.0.2'
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

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

@ -17,6 +17,7 @@ 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.webkit.CookieManager;
import android.webkit.URLUtil;
@ -66,7 +67,7 @@ public class MainActivity extends AppCompatActivity {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//menu
//menu latéral
navigationView = findViewById(R.id.navigation_drawer);
navigationView.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() {
@ -111,6 +112,15 @@ public class MainActivity extends AppCompatActivity {
web.loadUrl(URL_PLATEFORM + "/map");
break;
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.privacy:
web.loadUrl(URL_PLATEFORM + "/pages/politique-de-confidentialite");
break;
@ -210,6 +220,24 @@ public class MainActivity extends AppCompatActivity {
}
/*public boolean onCreateOptionsMenu(Menu menuOpt) {
getMenuInflater().inflate(R.menu.option,menuOpt);
return super.onCreateOptionsMenu(menuOpt);
}*/
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
int id = item.getItemId();
switch (id) {
case R.id.share:
web.clearCache(true);
Toast.makeText(this, "Rechargement...", Toast.LENGTH_SHORT).show();
return true;
default:
return super.onOptionsItemSelected(item);
}
}
private void createDialog()
{
dialog=new Dialog(this);

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

@ -17,6 +17,7 @@
style="@style/Widget.Material3.AppBarLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:pointerIcon="copy"
tools:ignore="WebViewLayout">
<androidx.appcompat.widget.Toolbar

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

@ -43,6 +43,11 @@
android:icon="@android:drawable/ic_menu_mapmode"
android:title="@string/menu_podmap" />
<item
android:id="@+id/share"
android:icon="@android:drawable/ic_menu_share"
android:title="@string/menu_share" />
<item
android:id="@+id/privacy"
android:icon="@android:drawable/stat_sys_warning"

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

@ -10,17 +10,11 @@
android:id="@+id/refresh"
android:title="@string/menu_reload" />
<!-- <item
android:id="@+id/live"
android:icon="@android:drawable/ic_media_play"
app:showAsAction="ifRoom"
android:title="@string/menu_live" /> -->
<item
android:id="@+id/tel"
android:icon="@android:drawable/stat_sys_phone_call"
android:title="@string/menu_phone"
app:showAsAction="ifRoom" />
android:id="@+id/share"
android:icon="@android:drawable/ic_menu_share"
app:showAsAction="ifRoom"
android:title="@string/menu_share" />
<item
android:id="@+id/exit"

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

@ -36,6 +36,7 @@
<string name="menu_promouvoir">Promouvoir</string>
<string name="menu_radio_mercure">Radio Mercure</string>
<string name="menu_application">Application</string>
<string name="menu_share">Partager la page</string>
<string name="menu_politique_de_confidentialit">Politique de Confidentialité</string>
</resources>
Loading…
Cancel
Save