ajout activity infos radios
This commit is contained in:
parent
d24275b396
commit
51438a9a53
@ -8,12 +8,15 @@
|
|||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
android:dataExtractionRules="@xml/data_extraction_rules"
|
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||||
android:fullBackupContent="@xml/backup_rules"
|
android:fullBackupContent="@xml/backup_rules"
|
||||||
android:icon="@mipmap/ic_launcher"
|
android:icon="@drawable/baseline_radio_24"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:roundIcon="@mipmap/ic_launcher_round"
|
android:roundIcon="@drawable/baseline_radio_24"
|
||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/Theme.JsonTest"
|
android:theme="@style/Theme.JsonTest"
|
||||||
tools:targetApi="31">
|
tools:targetApi="31">
|
||||||
|
<activity
|
||||||
|
android:name=".InfoActivity"
|
||||||
|
android:exported="false" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".MainActivity"
|
android:name=".MainActivity"
|
||||||
android:exported="true">
|
android:exported="true">
|
||||||
|
64
app/src/main/java/fr/svpro/rsd/InfoActivity.java
Normal file
64
app/src/main/java/fr/svpro/rsd/InfoActivity.java
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
package fr.svpro.rsd;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.squareup.picasso.Picasso;
|
||||||
|
|
||||||
|
public class InfoActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
TextView nomStation, tags, language;
|
||||||
|
ImageView logoStation;
|
||||||
|
Button bShare, bSite;
|
||||||
|
|
||||||
|
@SuppressLint("MissingInflatedId")
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_info);
|
||||||
|
setTitle("Infos Radio");
|
||||||
|
|
||||||
|
logoStation = (ImageView) findViewById(R.id.ivLogo);
|
||||||
|
nomStation = (TextView) findViewById(R.id.name);
|
||||||
|
tags = (TextView) findViewById(R.id.tags);
|
||||||
|
language = (TextView) findViewById(R.id.lang);
|
||||||
|
bShare = (Button) findViewById(R.id.share);
|
||||||
|
bSite = (Button) findViewById(R.id.siteWeb);
|
||||||
|
|
||||||
|
String faviconURL = getIntent().getStringExtra("logo");
|
||||||
|
Picasso.get().load(faviconURL).error(R.drawable.baseline_radio_24).into(logoStation);
|
||||||
|
nomStation.setText(getIntent().getStringExtra("name"));
|
||||||
|
tags.setText(getIntent().getStringExtra("tags"));
|
||||||
|
language.setText(getIntent().getStringExtra("lang"));
|
||||||
|
String siteWeb = getIntent().getStringExtra("site");
|
||||||
|
String streamURL = getIntent().getStringExtra("stream");
|
||||||
|
|
||||||
|
bShare.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||||
|
intent.setDataAndType(Uri.parse(streamURL),"audio/*");
|
||||||
|
startActivity(intent);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
bSite.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||||
|
intent.setData(Uri.parse(siteWeb));
|
||||||
|
startActivity(intent);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -65,10 +65,10 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
private final static String URL = "https://radiobrowser.weblib.re/json/stations";
|
private final static String URL = "https://radiobrowser.weblib.re/json/stations";
|
||||||
private ListView listView;
|
private ListView listView;
|
||||||
private EditText etRecherche;
|
private EditText etRecherche;
|
||||||
private Button bRecherche, bShare, bSite;
|
private Button bRecherche;
|
||||||
public RadioButton rechNom, rechPays;
|
public RadioButton rechNom, rechPays;
|
||||||
public String siteWeb;
|
public String siteWeb;
|
||||||
private String nomStation, streamURL, byFiltre, faviconURL;
|
private String nomStation, streamURL, byFiltre, faviconURL, tagStation, langStation;
|
||||||
public ImageView ivLogo;
|
public ImageView ivLogo;
|
||||||
ArrayList<HashMap<String, String>> arrayList;
|
ArrayList<HashMap<String, String>> arrayList;
|
||||||
|
|
||||||
@ -83,8 +83,8 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
etRecherche = (EditText) findViewById(R.id.etRecherche);
|
etRecherche = (EditText) findViewById(R.id.etRecherche);
|
||||||
listView = (ListView) findViewById(R.id.listView);
|
listView = (ListView) findViewById(R.id.listView);
|
||||||
bRecherche = (Button) findViewById(R.id.recherche);
|
bRecherche = (Button) findViewById(R.id.recherche);
|
||||||
bShare = (Button) findViewById(R.id.share);
|
/*bShare = (Button) findViewById(R.id.share);
|
||||||
bSite = (Button) findViewById(R.id.siteWeb);
|
bSite = (Button) findViewById(R.id.siteWeb);*/
|
||||||
rechNom = (RadioButton) findViewById(R.id.rech_nom);
|
rechNom = (RadioButton) findViewById(R.id.rech_nom);
|
||||||
rechPays = (RadioButton) findViewById(R.id.rech_pays);
|
rechPays = (RadioButton) findViewById(R.id.rech_pays);
|
||||||
ivLogo = (ImageView) findViewById(R.id.ivLogo);
|
ivLogo = (ImageView) findViewById(R.id.ivLogo);
|
||||||
@ -93,8 +93,8 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
setTitle("Recherche en cours....");
|
setTitle("Recherche en cours....");
|
||||||
bShare.setVisibility(View.INVISIBLE);
|
/*bShare.setVisibility(View.INVISIBLE);
|
||||||
bSite.setVisibility(View.INVISIBLE);
|
bSite.setVisibility(View.INVISIBLE);*/
|
||||||
parse();
|
parse();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -178,22 +178,31 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
siteWeb = arrayList.get(position).get("homepage");
|
siteWeb = arrayList.get(position).get("homepage");
|
||||||
streamURL = arrayList.get(position).get("url");
|
streamURL = arrayList.get(position).get("url");
|
||||||
faviconURL = arrayList.get(position).get("favicon");
|
faviconURL = arrayList.get(position).get("favicon");
|
||||||
if (Objects.requireNonNull(arrayList.get(position).get("favicon")).isEmpty()) {
|
tagStation = arrayList.get(position).get("tags");
|
||||||
Picasso.get().load(R.drawable.ic_launcher_foreground).into(ivLogo);
|
langStation = arrayList.get(position).get("language");
|
||||||
} else {
|
//Picasso.get().load(faviconURL).error(R.drawable.baseline_radio_24).into(ivLogo);
|
||||||
Picasso.get().load(faviconURL).into(ivLogo);
|
|
||||||
}
|
|
||||||
|
|
||||||
setTitle(nomStation);
|
setTitle(nomStation);
|
||||||
bShare.setVisibility(View.VISIBLE);
|
/*bShare.setVisibility(View.VISIBLE);
|
||||||
if (Objects.requireNonNull(arrayList.get(position).get("homepage")).isEmpty()) {
|
if (Objects.requireNonNull(arrayList.get(position).get("homepage")).isEmpty()) {
|
||||||
bSite.setVisibility(View.INVISIBLE);
|
bSite.setVisibility(View.INVISIBLE);
|
||||||
} else {
|
} else {
|
||||||
bSite.setVisibility(View.VISIBLE);
|
bSite.setVisibility(View.VISIBLE);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
|
Intent intent = new Intent(MainActivity.this,InfoActivity.class);
|
||||||
|
intent.putExtra("logo",faviconURL);
|
||||||
|
intent.putExtra("name",nomStation);
|
||||||
|
intent.putExtra("tags",tagStation);
|
||||||
|
intent.putExtra("lang",langStation);
|
||||||
|
intent.putExtra("site",siteWeb);
|
||||||
|
intent.putExtra("stream",streamURL);
|
||||||
|
startActivity(intent);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
bShare.setOnClickListener(new View.OnClickListener() {
|
/* bShare.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||||
@ -208,7 +217,7 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
intent.setData(Uri.parse(siteWeb));
|
intent.setData(Uri.parse(siteWeb));
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
});
|
});*/
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
5
app/src/main/res/drawable/baseline_radio_24.xml
Normal file
5
app/src/main/res/drawable/baseline_radio_24.xml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<vector android:height="24dp" android:tint="#AF1515"
|
||||||
|
android:viewportHeight="24" android:viewportWidth="24"
|
||||||
|
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<path android:fillColor="@android:color/white" android:pathData="M3.24,6.15C2.51,6.43 2,7.17 2,8v12c0,1.1 0.89,2 2,2h16c1.11,0 2,-0.9 2,-2L22,8c0,-1.11 -0.89,-2 -2,-2L8.3,6l8.26,-3.34L15.88,1 3.24,6.15zM7,20c-1.66,0 -3,-1.34 -3,-3s1.34,-3 3,-3 3,1.34 3,3 -1.34,3 -3,3zM20,12h-2v-2h-2v2L4,12L4,8h16v4z"/>
|
||||||
|
</vector>
|
78
app/src/main/res/layout/activity_info.xml
Normal file
78
app/src/main/res/layout/activity_info.xml
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
<?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="horizontal">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="10dp"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/ivLogo"
|
||||||
|
android:layout_width="100dp"
|
||||||
|
android:layout_height="100dp"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_weight="0.5"
|
||||||
|
android:src="@drawable/ic_launcher_foreground" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/name"
|
||||||
|
android:text="Name"
|
||||||
|
android:layout_marginTop="5dp"
|
||||||
|
android:layout_marginBottom="5dp"
|
||||||
|
android:layout_weight="0.5"
|
||||||
|
android:textSize="30dp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textColor="@color/black" />
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tags"
|
||||||
|
android:text="tags"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textColor="#5d5d5d"
|
||||||
|
android:textSize="20dp"
|
||||||
|
android:textAlignment="center"
|
||||||
|
/>
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/lang"
|
||||||
|
android:text="lang"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textColor="#5d5d5d"
|
||||||
|
android:textSize="20dp"
|
||||||
|
android:textAlignment="center"
|
||||||
|
/>
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/siteWeb"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Site WEB..."
|
||||||
|
android:visibility="visible" />
|
||||||
|
<Button
|
||||||
|
android:id="@+id/share"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Partager..."
|
||||||
|
android:visibility="visible" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</LinearLayout>
|
@ -91,13 +91,13 @@
|
|||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<ImageView
|
<!-- <ImageView
|
||||||
android:id="@+id/ivLogo"
|
android:id="@+id/ivLogo"
|
||||||
android:layout_width="100dp"
|
android:layout_width="100dp"
|
||||||
android:layout_height="100dp"
|
android:layout_height="100dp"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:src="@drawable/ic_launcher_foreground" />
|
android:src="@drawable/baseline_radio_24" />
|
||||||
|
-->
|
||||||
<ListView
|
<ListView
|
||||||
android:id="@+id/listView"
|
android:id="@+id/listView"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user