Optimisation + Nouveaux Graphiques
This commit is contained in:
parent
9878d7ba6c
commit
240380c1b4
@ -19,11 +19,15 @@ import android.os.PowerManager;
|
||||
import android.provider.Settings;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.webkit.CookieManager;
|
||||
import android.webkit.URLUtil;
|
||||
import android.webkit.ValueCallback;
|
||||
import android.webkit.WebChromeClient;
|
||||
import android.webkit.WebSettings;
|
||||
import android.webkit.WebView;
|
||||
import android.webkit.WebViewClient;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
@ -46,11 +50,14 @@ public class MainActivity extends AppCompatActivity {
|
||||
private WebView web;
|
||||
private String url, userAgent, contentDisposition, mimeType;
|
||||
private Dialog dialog;
|
||||
private ImageView iv_svpro, iv_navHeader;
|
||||
private TextView tv_close, tv_version;
|
||||
private static String versionName;
|
||||
private static final String NUMERO_TEL_RADIO = "+33375411456";
|
||||
private static final String URL_PLATEFORM = "https://podcast.radiomercure.fr"; //"https://www.radiomercure.fr/?playerbar-pageinicial";
|
||||
private static final String URL_ADMIN = "https://podcast.radiomercure.fr/cp-admin";
|
||||
private static final String URL_STREAM = "https://live.radiomercure.fr/on-air/live";
|
||||
private static final String URL_SVPRO = "https://samuel.vermeulen.pro";
|
||||
private MediaPlayerService player;
|
||||
boolean serviceBound = false;
|
||||
|
||||
@ -62,13 +69,15 @@ public class MainActivity extends AppCompatActivity {
|
||||
private NavigationView navigationView;
|
||||
private DrawerLayout drawerLayout;
|
||||
private Toolbar toolbar;
|
||||
private ValueCallback<Uri> mUploadMessage;
|
||||
private final static int FILECHOOSER_RESULTCODE = 1;
|
||||
|
||||
@SuppressLint({"SetJavaScriptEnabled", "WrongViewCast", "JavascriptInterface", "MissingInflatedId"})
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
|
||||
createDialog();
|
||||
//menu latéral
|
||||
navigationView = findViewById(R.id.navigation_drawer);
|
||||
|
||||
@ -132,7 +141,6 @@ public class MainActivity extends AppCompatActivity {
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
drawerLayout.closeDrawer(GravityCompat.START);
|
||||
return true;
|
||||
}
|
||||
@ -174,7 +182,7 @@ public class MainActivity extends AppCompatActivity {
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------//
|
||||
|
||||
//WebBiew affichage du site
|
||||
//------WebBiew configuration-----------------------------------------------------------------//
|
||||
web = findViewById(R.id.wv);
|
||||
web.setWebViewClient(new WebViewClient());
|
||||
web.getSettings().setUserAgentString("Mozilla/5.0 "+ getApplicationInfo().packageName);
|
||||
@ -185,17 +193,28 @@ public class MainActivity extends AppCompatActivity {
|
||||
web.getSettings().setDatabaseEnabled(true);
|
||||
web.getSettings().setDomStorageEnabled(true);
|
||||
web.getSettings().setCacheMode(WebSettings.LOAD_DEFAULT);
|
||||
// web.getSettings().setAppCachePath(web.getContext().getCacheDir().getAbsolutePath());
|
||||
web.getSettings().setUseWideViewPort(true);
|
||||
web.getSettings().setLoadWithOverviewMode(true);
|
||||
web.getSettings().setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
|
||||
web.getSettings().setAllowFileAccessFromFileURLs(true);
|
||||
//Log.w("AGENT", web.getSettings().getUserAgentString());
|
||||
//if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
|
||||
// web.getSettings().setAllowFileAccessFromFileURLs(true);
|
||||
//}
|
||||
//------------------------------------------------------------------------------------------------//
|
||||
web.loadUrl(URL_PLATEFORM);
|
||||
//------Files Chooser-----------------------------------------------------------------------------//
|
||||
web.setWebChromeClient(new WebChromeClient() {
|
||||
public void onProgressChanged(WebView view, int progress) {
|
||||
|
||||
}
|
||||
|
||||
public void openFileChooser(ValueCallback uploadMsg, String acceptType) {
|
||||
mUploadMessage = uploadMsg;
|
||||
Intent i = new Intent(Intent.ACTION_GET_CONTENT);
|
||||
i.addCategory(Intent.CATEGORY_OPENABLE);
|
||||
i.setType("*/*");
|
||||
startActivityForResult(Intent.createChooser(i, "Browser"), FILECHOOSER_RESULTCODE);
|
||||
}
|
||||
});
|
||||
//------------------------------------------------------------------------------------------------//
|
||||
//------Link Download-----------------------------------------------------------------------------//
|
||||
web.setDownloadListener((url, userAgent, contentDisposition, mimeType, contentLength) -> {
|
||||
MainActivity.this.url = url;
|
||||
MainActivity.this.userAgent = userAgent;
|
||||
@ -212,8 +231,7 @@ public class MainActivity extends AppCompatActivity {
|
||||
TelechargemntPodcast();
|
||||
}
|
||||
});
|
||||
|
||||
createDialog();
|
||||
//------------------------------------------------------------------------------------------------//
|
||||
|
||||
// Ouverture depuis liens externes
|
||||
Intent appLinkIntent = getIntent();
|
||||
@ -221,7 +239,6 @@ public class MainActivity extends AppCompatActivity {
|
||||
Uri appLinkData = appLinkIntent.getData();
|
||||
handleIntent(getIntent());
|
||||
}
|
||||
|
||||
protected void onNewIntent(Intent intent) {
|
||||
super.onNewIntent(intent);
|
||||
handleIntent(intent);
|
||||
@ -284,8 +301,31 @@ public class MainActivity extends AppCompatActivity {
|
||||
|
||||
tv_close= (TextView) dialog.findViewById(R.id.tv_close);
|
||||
tv_version = (TextView) dialog.findViewById(R.id.tv_version);
|
||||
iv_navHeader = (ImageView) dialog.findViewById(R.id.iv_navHeader);
|
||||
iv_svpro = (ImageView) dialog.findViewById(R.id.iv_svpro);
|
||||
tv_close.setOnClickListener(v -> dialog.dismiss());
|
||||
tv_version.setText(getString(R.string.app_version) + versionName);
|
||||
|
||||
// Click logo => Ouverture site auteur
|
||||
iv_svpro.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Intent intent = new Intent();
|
||||
intent.setAction(Intent.ACTION_VIEW);
|
||||
intent.addCategory(Intent.CATEGORY_BROWSABLE);
|
||||
intent.setData(Uri.parse(URL_SVPRO));
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
// easter egg pour admin
|
||||
iv_navHeader.setOnLongClickListener(new View.OnLongClickListener() {
|
||||
@Override
|
||||
public boolean onLongClick(View view) {
|
||||
web.loadUrl(URL_ADMIN);
|
||||
dialog.dismiss();
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
BIN
app/src/main/res/drawable/appli_android_splash.png
Normal file
BIN
app/src/main/res/drawable/appli_android_splash.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 543 KiB |
BIN
app/src/main/res/drawable/banni_re.png
Normal file
BIN
app/src/main/res/drawable/banni_re.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 87 KiB |
BIN
app/src/main/res/drawable/navheader.png
Normal file
BIN
app/src/main/res/drawable/navheader.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 525 KiB |
@ -3,7 +3,7 @@
|
||||
<item
|
||||
android:drawable="@drawable/bg_gradient"/>
|
||||
<item>
|
||||
<bitmap android:gravity="center"
|
||||
android:src="@drawable/logo_menu"/>
|
||||
<bitmap android:gravity="fill"
|
||||
android:src="@drawable/appli_android_splash"/>
|
||||
</item>
|
||||
</layer-list>
|
@ -6,13 +6,14 @@
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_logo"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="275dp"
|
||||
android:id="@+id/iv_navHeader"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="210dp"
|
||||
android:paddingTop="0dp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:contentDescription="Bannière"
|
||||
android:padding="5dp"
|
||||
app:srcCompat="@drawable/presentation_pstore" />
|
||||
android:longClickable="true"
|
||||
app:srcCompat="@drawable/navheader" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_version"
|
||||
@ -20,18 +21,18 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="20dp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/white"
|
||||
android:background="#FF5722"
|
||||
android:textAlignment="center"
|
||||
android:paddingTop="10dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:text="@string/dialog_version" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_svpro"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="124dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="151dp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_weight="0"
|
||||
app:srcCompat="@drawable/svpro_logo" />
|
||||
android:clickable="true"
|
||||
app:srcCompat="@drawable/banni_re" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
|
@ -12,26 +12,17 @@
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="50dp"
|
||||
android:layout_gravity="center"
|
||||
android:textSize="30dp"
|
||||
android:textColor="@color/white"
|
||||
android:textStyle="bold"
|
||||
android:text="@string/splash_txt" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_version"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:textSize="20dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:text="@string/app_version"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/white"
|
||||
android:background="#FF5722"
|
||||
android:textSize="20dp"
|
||||
android:textStyle="bold" />
|
||||
</LinearLayout>
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="170dp"
|
||||
android:background="@drawable/presentation_pstore"
|
||||
android:background="@drawable/navheader"
|
||||
android:gravity="bottom"
|
||||
android:orientation="vertical"
|
||||
android:padding="16dp"/>
|
Loading…
x
Reference in New Issue
Block a user