Skip to content

Commit 145d2c1

Browse files
author
JulesG10
committed
design update + bug fix -> new app version
1 parent 556cc1c commit 145d2c1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+1843
-1674
lines changed

android/app/build.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
apply plugin: 'com.android.application'
22

33
android {
4-
54
namespace 'com.fouflix.julesg10'
65
compileSdkVersion rootProject.ext.compileSdkVersion
76
defaultConfig {

android/app/capacitor.build.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ android {
1010
apply from: "../capacitor-cordova-android-plugins/cordova.variables.gradle"
1111
dependencies {
1212
implementation project(':capacitor-app')
13-
implementation project(':capacitor-app-launcher')
1413
implementation project(':capacitor-network')
1514
implementation project(':capacitor-preferences')
1615
implementation project(':capacitor-status-bar')

android/app/release/output-metadata.json

Lines changed: 0 additions & 20 deletions
This file was deleted.

android/app/src/main/AndroidManifest.xml

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,40 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.fouflix.julesg10">
3+
<uses-permission android:name="android.permission.INTERNET" />
4+
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
5+
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
36

4-
<application
5-
android:allowBackup="true"
6-
android:icon="@mipmap/ic_launcher"
7-
android:label="@string/app_name"
8-
android:roundIcon="@mipmap/ic_launcher"
9-
android:supportsRtl="true" android:theme="@style/AppTheme">
7+
<application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name"
8+
android:roundIcon="@mipmap/ic_launcher" android:supportsRtl="true" android:theme="@style/AppTheme">
109

1110
<activity
1211
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode"
13-
android:name="com.fouflix.julesg10.MainActivity"
12+
android:name=".MainActivity"
1413
android:label="@string/title_activity_main"
15-
android:theme="@style/AppTheme.NoActionBarLaunch"
14+
android:theme="@style/AppTheme.NoActionBar"
1615
android:launchMode="singleTask" android:exported="true"
1716
android:screenOrientation="portrait"
18-
android:immersive="true"
17+
android:immersive="true"
1918
android:turnScreenOn="true"
2019
android:hardwareAccelerated="true"
2120
android:resizeableActivity="true"
22-
android:supportsPictureInPicture="true" >
21+
android:supportsPictureInPicture="true">
2322

2423
<intent-filter>
2524
<action android:name="android.intent.action.MAIN" />
2625
<category android:name="android.intent.category.LAUNCHER" />
2726
</intent-filter>
27+
28+
<intent-filter>
29+
<action android:name="android.intent.action.VIEW" />
30+
<category android:name="android.intent.category.DEFAULT" />
31+
<category android:name="android.intent.category.BROWSABLE" />
32+
<data android:scheme="@string/custom_url_scheme" />
33+
</intent-filter>
2834
</activity>
2935

30-
<activity
31-
android:name="com.fouflix.julesg10.FlouFlixActivity"
32-
android:exported="true"
33-
android:label="Ajouter dans FlouFlix"
34-
android:icon="@drawable/flouflix_icon">
36+
<activity android:name="com.fouflix.julesg10.FlouFlixActivity" android:exported="true"
37+
android:label="Ajouter dans FlouFlix" android:icon="@drawable/flouflix_icon">
3538

3639
<intent-filter>
3740
<action android:name="android.intent.action.VIEW" />
@@ -63,7 +66,7 @@
6366
</activity>
6467

6568

66-
<!-- <service
69+
<!-- <service
6770
android:name="com.fouflix.julesg10.FlouFlixTileService"
6871
android:label="FlouFlix Scan"
6972
android:permission="android.permission.BIND_QUICK_SETTINGS_TILE"
@@ -81,11 +84,10 @@
8184
android:resource="@xml/file_paths"></meta-data>
8285
</provider>
8386

84-
<meta-data android:name="com.google.android.gms.cast.framework.OPTIONS_PROVIDER_CLASS_NAME"
85-
android:value="com.google.android.exoplayer2.ext.cast.DefaultCastOptionsProvider" />
87+
<meta-data android:name="com.google.android.gms.cast.framework.OPTIONS_PROVIDER_CLASS_NAME" android:value="com.google.android.exoplayer2.ext.cast.DefaultCastOptionsProvider" />
88+
89+
8690
</application>
8791

88-
<!-- Permissions -->
89-
<uses-permission android:name="android.permission.INTERNET" />
90-
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
92+
9193
</manifest>

android/app/src/main/java/com/fouflix/julesg10/FlouFlixActivity.java

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import java.io.BufferedReader;
1313
import java.io.InputStream;
1414
import java.io.InputStreamReader;
15+
import java.util.concurrent.ExecutionException;
1516

1617
public class FlouFlixActivity extends AppCompatActivity {
1718

@@ -20,12 +21,31 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
2021
super.onCreate(savedInstanceState);
2122

2223
Intent intent = getIntent();
24+
if(intent == null)
25+
{
26+
return;
27+
}
2328
Intent main = new Intent(this, MainActivity.class);
24-
main.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
25-
main.putExtra("text", this.extractQuery(intent));
26-
main.putExtra("file", this.extractFile(intent));
29+
main.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK |
30+
Intent.FLAG_ACTIVITY_CLEAR_TOP |
31+
Intent.FLAG_ACTIVITY_SINGLE_TOP);
32+
33+
String text = this.extractQuery(intent);
34+
if(text != null)
35+
{
36+
main.putExtra("text", text);
37+
}
2738

28-
this.startActivity(main);
39+
String file = this.extractFile(intent);
40+
if(file != null)
41+
{
42+
main.putExtra("file", file);
43+
}
44+
45+
try{
46+
this.startActivity(main);
47+
}catch (Exception ignore)
48+
{}
2949
this.finish();
3050
}
3151

@@ -46,12 +66,9 @@ private String extractQuery(Intent intent)
4666
}
4767

4868
private String extractFile(Intent intent) {
49-
Uri file = intent.getParcelableExtra(Intent.EXTRA_STREAM);
50-
if(file == null)
51-
{
52-
file = intent.getData();
53-
}
69+
if (intent == null) return null;
5470

71+
Uri file = intent.getData() == null ? intent.getParcelableExtra(Intent.EXTRA_STREAM) : intent.getData();
5572
if (file == null) return null;
5673

5774
StringBuilder fileContent = new StringBuilder();
Lines changed: 21 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package com.fouflix.julesg10;
22

3+
import android.content.BroadcastReceiver;
4+
import android.content.Context;
35
import android.content.Intent;
46

57
import com.getcapacitor.JSObject;
@@ -16,31 +18,26 @@ public class FlouFlixPlugin extends Plugin {
1618

1719
private String EVENT_SHARE_TEXT_DATA = "onTextDataShared";
1820
private String EVENT_READY_CREATE = "onReadyCreate";
19-
private String EVENT_PLAY_LAST = "onPlayLast";
20-
private String EVENT_PLAY_NEXT = "onPlayNext";
21+
private String EVENT_PLAY = "onPlay";
2122

2223
private FlouFlixData data;
2324

2425
public void load()
2526
{
2627
this.data = new FlouFlixData(getContext());
27-
}
2828

29-
@PluginMethod
30-
public void setData(PluginCall call)
31-
{
32-
String value = call.getString("value");
33-
this.data.set(value);
34-
call.resolve();
3529
}
3630

3731
@PluginMethod
38-
public void getData(PluginCall call)
32+
public void setData(PluginCall call)
3933
{
4034
JSObject ret = new JSObject();
41-
String value = this.data.get();
42-
ret.put("value", value);
43-
call.resolve(ret);
35+
ret.put("next", call.getString("next"));
36+
ret.put("last", call.getString("last"));
37+
ret.put("nextTitle", call.getString("nextTitle"));
38+
ret.put("lastTitle", call.getString("lastTitle"));
39+
this.data.set(ret.toString());
40+
call.resolve();
4441
}
4542

4643
@Override
@@ -51,18 +48,23 @@ protected void handleOnNewIntent(Intent intent) {
5148
{
5249
return;
5350
}
54-
if(this.checkIntentAction(intent,"next", EVENT_PLAY_NEXT))
55-
{
56-
return;
57-
}
5851

59-
if(this.checkIntentAction(intent,"last", EVENT_PLAY_LAST))
52+
String url = intent.getStringExtra("play");
53+
if(url != null && url.length() != 0)
6054
{
55+
JSObject ret = new JSObject();
56+
ret.put("state", true);
57+
ret.put("url", url);
58+
this.notifyListeners(EVENT_PLAY, ret, true);
6159
return;
6260
}
6361

64-
if(this.checkIntentAction(intent,"ready", EVENT_READY_CREATE))
62+
if(intent.getBooleanExtra("ready", false))
6563
{
64+
JSObject ret = new JSObject();
65+
ret.put("state", true);
66+
ret.put("url", "");
67+
this.notifyListeners(EVENT_READY_CREATE, ret, true);
6668
return;
6769
}
6870

@@ -83,17 +85,4 @@ protected void handleOnNewIntent(Intent intent) {
8385
this.notifyListeners(EVENT_SHARE_TEXT_DATA, ret, true);
8486
}
8587

86-
87-
private boolean checkIntentAction(Intent intent, String key, String event)
88-
{
89-
JSObject ret = new JSObject();
90-
if(intent.getBooleanExtra(key, false))
91-
{
92-
ret.put("last", true);
93-
this.notifyListeners(event, ret, true);
94-
return true;
95-
}
96-
97-
return false;
98-
}
9988
}

android/app/src/main/java/com/fouflix/julesg10/MainActivity.java

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ public void onDestroy() {
6262
@Override
6363
protected void onPostCreate(@Nullable Bundle savedInstanceState) {
6464
super.onPostCreate(savedInstanceState);
65-
getBridge().getWebView().setBackgroundColor(Color.parseColor("#161616"));
65+
getBridge().getWebView().setBackgroundColor(Color.parseColor("#141414"));
66+
6667
}
6768

6869
private Intent createIntent()
@@ -80,22 +81,26 @@ private void createShortcutWatch(String id, String id2)
8081
String value = data.get();
8182
JSObject obj = new JSObject(value == null ? "": value);
8283

83-
String lastTitle = obj.getString("last_title", "");
84-
if(lastTitle.length() != 0)
84+
String lastUrl = obj.getString("last", "");
85+
String lastT = obj.getString("lastTitle", "");
86+
lastT =( lastT.length() == 0 ? "Dernier épisode" : lastT);
87+
if(lastUrl.length() != 0)
8588
{
8689
Intent lasti = this.createIntent();
87-
lasti.putExtra("last", true);
90+
lasti.putExtra("play", lastUrl);
8891

89-
this.shortcutCreate(lasti,"Regarder "+lastTitle, lastTitle, R.drawable.play_icon, id);
92+
this.shortcutCreate(lasti, lastT, lastT, R.drawable.play_icon, id);
9093
}
9194

92-
String nextTitle = obj.getString("next_title", "");
93-
if(nextTitle.length() != 0)
95+
String nextUrl = obj.getString("next", "");
96+
String nextT = obj.getString("nextTitle", "Épisode suivant");
97+
nextT = (nextT.length() == 0 ? "Épisode suivant" : nextT);
98+
if(nextUrl.length() != 0)
9499
{
95100
Intent nexti = this.createIntent();
96-
nexti.putExtra("next", true);
101+
nexti.putExtra("play", nextUrl);
97102

98-
this.shortcutCreate(nexti,"Regarder "+nextTitle, nextTitle, R.drawable.play_icon, id2);
103+
this.shortcutCreate(nexti,nextT, nextT, R.drawable.play_icon, id2);
99104
}
100105
} catch (JSONException e) {}
101106

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@
44
xmlns:tools="http://schemas.android.com/tools"
55
android:layout_width="match_parent"
66
android:layout_height="match_parent"
7-
android:background="#161616"
7+
android:background="#141414"
88
tools:context=".MainActivity">
99

1010
<WebView
11+
android:id="@+id/webview"
1112
android:layout_width="match_parent"
1213
android:layout_height="match_parent"
13-
android:background="#161616" />
14+
android:background="#141414" />
1415
</androidx.coordinatorlayout.widget.CoordinatorLayout>

android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ buildscript {
77
mavenCentral()
88
}
99
dependencies {
10-
classpath 'com.android.tools.build:gradle:7.3.0'
10+
classpath 'com.android.tools.build:gradle:7.2.1'
1111
classpath 'com.google.gms:google-services:4.3.13'
1212

1313
// NOTE: Do not place your application dependencies here; they belong

android/capacitor.settings.gradle

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ project(':capacitor-android').projectDir = new File('../node_modules/@capacitor/
55
include ':capacitor-app'
66
project(':capacitor-app').projectDir = new File('../node_modules/@capacitor/app/android')
77

8-
include ':capacitor-app-launcher'
9-
project(':capacitor-app-launcher').projectDir = new File('../node_modules/@capacitor/app-launcher/android')
10-
118
include ':capacitor-network'
129
project(':capacitor-network').projectDir = new File('../node_modules/@capacitor/network/android')
1310

0 commit comments

Comments
 (0)