Fix crash when playing youtube videos
This commit is contained in:
parent
4284bccab9
commit
62fd00c871
|
@ -47,6 +47,7 @@ android {
|
|||
packagingOptions {
|
||||
exclude 'META-INF/proguard/androidx-annotations.pro'
|
||||
}
|
||||
viewBinding.enabled = true
|
||||
}
|
||||
allprojects {
|
||||
repositories {
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
Changed:
|
||||
|
||||
|
||||
Fixed:
|
||||
- Crash when Youtube videos in timelines
|
|
@ -2141,7 +2141,11 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
|||
if (status.getReblog() == null) {
|
||||
if (status.getWebviewURL() != null) {
|
||||
String url = status.getWebviewURL().replaceAll("&", "&");
|
||||
holder.status_cardview_webview.loadUrl(url);
|
||||
try {
|
||||
holder.status_cardview_webview.loadUrl(url);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
holder.status_cardview_webview.setVisibility(View.VISIBLE);
|
||||
holder.status_cardview_video.setVisibility(View.VISIBLE);
|
||||
holder.webview_preview.setVisibility(View.GONE);
|
||||
|
@ -2153,7 +2157,11 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
|||
} else {
|
||||
if (status.getReblog().getWebviewURL() != null) {
|
||||
String url = status.getReblog().getWebviewURL().replaceAll("&", "&");
|
||||
holder.status_cardview_webview.loadUrl(url);
|
||||
try {
|
||||
holder.status_cardview_webview.loadUrl(url);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
holder.status_cardview_webview.setVisibility(View.VISIBLE);
|
||||
holder.status_cardview_video.setVisibility(View.VISIBLE);
|
||||
holder.webview_preview.setVisibility(View.GONE);
|
||||
|
|
|
@ -79,6 +79,7 @@ import android.view.WindowManager;
|
|||
import android.webkit.CookieManager;
|
||||
import android.webkit.MimeTypeMap;
|
||||
import android.webkit.URLUtil;
|
||||
import android.webkit.WebChromeClient;
|
||||
import android.webkit.WebSettings;
|
||||
import android.webkit.WebView;
|
||||
import android.widget.Button;
|
||||
|
@ -2222,7 +2223,12 @@ public class Helper {
|
|||
webView.getSettings().setAppCacheEnabled(true);
|
||||
webView.getSettings().setDatabaseEnabled(true);
|
||||
webView.getSettings().setCacheMode(WebSettings.LOAD_DEFAULT);
|
||||
|
||||
webView.setWebChromeClient(new WebChromeClient() {
|
||||
@Override
|
||||
public Bitmap getDefaultVideoPoster() {
|
||||
return Bitmap.createBitmap(50, 50, Bitmap.Config.ARGB_8888);
|
||||
}
|
||||
});
|
||||
boolean proxyEnabled = sharedpreferences.getBoolean(Helper.SET_PROXY_ENABLED, false);
|
||||
if (proxyEnabled) {
|
||||
String host = sharedpreferences.getString(Helper.SET_PROXY_HOST, "127.0.0.1");
|
||||
|
|
|
@ -76,6 +76,11 @@ public class MastalabWebChromeClient extends WebChromeClient implements MediaPla
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Bitmap getDefaultVideoPoster() {
|
||||
return Bitmap.createBitmap(50, 50, Bitmap.Config.ARGB_8888);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReceivedIcon(WebView view, Bitmap icon) {
|
||||
super.onReceivedIcon(view, icon);
|
||||
|
|
|
@ -1843,7 +1843,9 @@
|
|||
android:id="@+id/translation_key"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/your_api_key" />
|
||||
android:hint="@string/your_api_key"
|
||||
android:inputType="text"
|
||||
android:importantForAutofill="no" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
|
@ -2363,7 +2365,9 @@
|
|||
android:id="@+id/custom_sharing_url"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/settings_custom_sharing_url" />
|
||||
android:hint="@string/settings_custom_sharing_url"
|
||||
android:inputType="textUri"
|
||||
android:importantForAutofill="no" />
|
||||
|
||||
<!-- ADD TAGS -->
|
||||
<LinearLayout
|
||||
|
@ -2500,7 +2504,8 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:hint="@string/set_invidious_host"
|
||||
android:inputType="textWebEditText" />
|
||||
android:inputType="textWebEditText"
|
||||
android:importantForAutofill="no" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
|
@ -2675,7 +2680,7 @@
|
|||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/set_enable_crash_report_indication"
|
||||
android:text="@string/set_custom_tabs_indication"
|
||||
android:textColor="@color/mastodonC2"
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
|
|
|
@ -1226,4 +1226,5 @@
|
|||
<string name="action_announcements">Announcements</string>
|
||||
<string name="no_announcements">No announcements!</string>
|
||||
<string name="add_reaction">Add a reaction</string>
|
||||
<string name="set_custom_tabs_indication">Use your favourite browser inside the app. Uncheck this feature to open links externally.</string>
|
||||
</resources>
|
|
@ -6,7 +6,7 @@ buildscript {
|
|||
google()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.6.1'
|
||||
classpath 'com.android.tools.build:gradle:3.6.2'
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
|
|
Loading…
Reference in New Issue