Ajout FLoatActionButton
This commit is contained in:
parent
dc7eb0f6da
commit
37ed83810a
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
@ -5,7 +5,7 @@
|
|||||||
<map>
|
<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/drawable/ic_launcher_background.xml" value="0.2355" />
|
||||||
<entry key="..\:/Users/samue/GIT/RadioMercure/app/src/main/res/layout/about_dialog.xml" value="0.5" />
|
<entry key="..\:/Users/samue/GIT/RadioMercure/app/src/main/res/layout/about_dialog.xml" value="0.5" />
|
||||||
<entry key="..\:/Users/samue/GIT/RadioMercure/app/src/main/res/layout/activity_main.xml" value="0.1755050505050505" />
|
<entry key="..\:/Users/samue/GIT/RadioMercure/app/src/main/res/layout/activity_main.xml" value="0.33" />
|
||||||
<entry key="..\:/Users/samue/GIT/RadioMercure/app/src/main/res/menu/option.xml" value="0.33" />
|
<entry key="..\:/Users/samue/GIT/RadioMercure/app/src/main/res/menu/option.xml" value="0.33" />
|
||||||
</map>
|
</map>
|
||||||
</option>
|
</option>
|
||||||
|
@ -19,6 +19,7 @@ import android.os.PowerManager;
|
|||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
|
import android.view.View;
|
||||||
import android.webkit.CookieManager;
|
import android.webkit.CookieManager;
|
||||||
import android.webkit.URLUtil;
|
import android.webkit.URLUtil;
|
||||||
import android.webkit.WebSettings;
|
import android.webkit.WebSettings;
|
||||||
@ -32,6 +33,9 @@ import androidx.annotation.RequiresApi;
|
|||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import androidx.core.app.ActivityCompat;
|
import androidx.core.app.ActivityCompat;
|
||||||
|
|
||||||
|
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||||
|
import com.google.android.material.snackbar.Snackbar;
|
||||||
|
|
||||||
public class MainActivity extends AppCompatActivity {
|
public class MainActivity extends AppCompatActivity {
|
||||||
|
|
||||||
private static final int WRITE_EXTERNAL_STORAGE_RC = 100;
|
private static final int WRITE_EXTERNAL_STORAGE_RC = 100;
|
||||||
@ -44,17 +48,33 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
private static final String NUMERO_TEL_RADIO = "+33375411456";
|
private static final String NUMERO_TEL_RADIO = "+33375411456";
|
||||||
private MediaPlayerService player;
|
private MediaPlayerService player;
|
||||||
boolean serviceBound = false;
|
boolean serviceBound = false;
|
||||||
|
private FloatingActionButton fbtn_live;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
versionName = BuildConfig.VERSION_NAME;
|
versionName = BuildConfig.VERSION_NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@SuppressLint({"SetJavaScriptEnabled", "WrongViewCast", "JavascriptInterface"})
|
@SuppressLint({"SetJavaScriptEnabled", "WrongViewCast", "JavascriptInterface"})
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_main);
|
setContentView(R.layout.activity_main);
|
||||||
|
|
||||||
|
fbtn_live = (FloatingActionButton) findViewById(R.id.fbtn_live);
|
||||||
|
fbtn_live.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@RequiresApi(api = Build.VERSION_CODES.O)
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
Snackbar.make(v, "Vous écoutez Radio Mercure en direct", Snackbar.LENGTH_LONG)
|
||||||
|
.setAction("Action", null).show();
|
||||||
|
lectureAudio("https://live.radiomercure.fr/on-air/live");
|
||||||
|
fbtn_live.setImageResource(android.R.drawable.ic_media_pause);
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
//------Demande d'autorisation de désactiver l'optimisation de la batterie------//
|
//------Demande d'autorisation de désactiver l'optimisation de la batterie------//
|
||||||
AlertDialog.Builder dialogOptBattery = new AlertDialog.Builder(this);
|
AlertDialog.Builder dialogOptBattery = new AlertDialog.Builder(this);
|
||||||
dialogOptBattery.setMessage(R.string.dialog_battery_msg)
|
dialogOptBattery.setMessage(R.string.dialog_battery_msg)
|
||||||
@ -206,11 +226,11 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case R.id.live:
|
//case R.id.live:
|
||||||
lectureAudio("https://live.radiomercure.fr/on-air/live");
|
//lectureAudio("https://live.radiomercure.fr/on-air/live");
|
||||||
//Toast.makeText(this, "Vous écoutez Radio Mercure en direct", Toast.LENGTH_SHORT).show();
|
//Toast.makeText(this, "Vous écoutez Radio Mercure en direct", Toast.LENGTH_SHORT).show();
|
||||||
|
|
||||||
return true;
|
//return true;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
@ -259,11 +279,11 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
playerIntent.putExtra("media",chemin);
|
playerIntent.putExtra("media",chemin);
|
||||||
startService(playerIntent);
|
startService(playerIntent);
|
||||||
bindService(playerIntent, serviceConnection, Context.BIND_AUTO_CREATE);
|
bindService(playerIntent, serviceConnection, Context.BIND_AUTO_CREATE);
|
||||||
Toast.makeText(this, "Lecture", Toast.LENGTH_SHORT).show();
|
//Toast.makeText(this, "Lecture", Toast.LENGTH_SHORT).show();
|
||||||
} else {
|
} else {
|
||||||
onDestroy();
|
onDestroy();
|
||||||
reStart();
|
reStart();
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,26 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
tools:context=".MainActivity">
|
tools:context=".MainActivity">
|
||||||
|
|
||||||
|
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||||
|
android:id="@+id/fbtn_live"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentEnd="true"
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
|
android:layout_marginEnd="16dp"
|
||||||
|
android:layout_marginBottom="16dp"
|
||||||
|
android:backgroundTint="#FF5722"
|
||||||
|
android:clickable="true"
|
||||||
|
android:contentDescription="@string/menu_live"
|
||||||
|
android:src="@android:drawable/ic_media_play"
|
||||||
|
app:tint="@null"
|
||||||
|
android:focusable="true" />
|
||||||
|
|
||||||
<WebView
|
<WebView
|
||||||
android:id="@+id/wv"
|
android:id="@+id/wv"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -10,11 +10,11 @@
|
|||||||
android:id="@+id/refresh"
|
android:id="@+id/refresh"
|
||||||
android:title="@string/menu_reload" />
|
android:title="@string/menu_reload" />
|
||||||
|
|
||||||
<item
|
<!-- <item
|
||||||
android:id="@+id/live"
|
android:id="@+id/live"
|
||||||
android:icon="@android:drawable/ic_media_play"
|
android:icon="@android:drawable/ic_media_play"
|
||||||
app:showAsAction="ifRoom"
|
app:showAsAction="ifRoom"
|
||||||
android:title="@string/menu_live" />
|
android:title="@string/menu_live" /> -->
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/tel"
|
android:id="@+id/tel"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user