Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b931d0ce7d |
No files matched your search
@@ -62,6 +62,7 @@ dependencies {
|
||||
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
|
||||
implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0'
|
||||
implementation 'androidx.preference:preference:1.1.1'
|
||||
implementation 'androidx.webkit:webkit:1.3.0-alpha02'
|
||||
implementation 'androidx.camera:camera-camera2:1.0.0-beta03'
|
||||
implementation 'androidx.camera:camera-lifecycle:1.0.0-beta03'
|
||||
implementation 'androidx.camera:camera-view:1.0.0-alpha10'
|
||||
|
||||
@@ -17,7 +17,6 @@ import android.content.res.Configuration;
|
||||
import android.content.res.TypedArray;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Typeface;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
@@ -27,10 +26,7 @@ import android.os.Handler;
|
||||
import android.provider.MediaStore;
|
||||
import android.support.v4.media.session.MediaSessionCompat;
|
||||
import android.text.Editable;
|
||||
import android.text.Spannable;
|
||||
import android.text.SpannableString;
|
||||
import android.text.TextWatcher;
|
||||
import android.text.style.TypefaceSpan;
|
||||
import android.util.Base64;
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
@@ -39,6 +35,7 @@ import android.view.Menu;
|
||||
import android.view.WindowManager;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.webkit.WebView;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
@@ -66,7 +63,6 @@ import androidx.core.app.NotificationManagerCompat;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.core.content.FileProvider;
|
||||
import androidx.core.content.res.ResourcesCompat;
|
||||
import androidx.core.graphics.TypefaceCompat;
|
||||
import androidx.core.graphics.drawable.DrawableCompat;
|
||||
import androidx.core.view.GravityCompat;
|
||||
import androidx.core.view.OnApplyWindowInsetsListener;
|
||||
@@ -342,6 +338,8 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
// workaround to fix dark theme because https://issuetracker.google.com/issues/37124582
|
||||
new WebView(this);
|
||||
AppCompatDelegate.setDefaultNightMode(isDarkMode() ? AppCompatDelegate.MODE_NIGHT_YES : AppCompatDelegate.MODE_NIGHT_NO);
|
||||
|
||||
initKeyStore();
|
||||
@@ -544,15 +542,6 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||
}
|
||||
}
|
||||
|
||||
public void setActionBarTitle(int stringResourceId) {
|
||||
ActionBar actionBar = getSupportActionBar();
|
||||
if (actionBar != null) {
|
||||
SpannableString spannable = new SpannableString(getString(stringResourceId));
|
||||
spannable.setSpan(new TypefaceSpan("inter"), 0, spannable.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
actionBar.setTitle(spannable);
|
||||
}
|
||||
}
|
||||
|
||||
public void addScreenOrientationListener(ScreenOrientationListener listener) {
|
||||
if (!screenOrientationListeners.contains(listener)) {
|
||||
screenOrientationListeners.add(listener);
|
||||
|
||||
@@ -503,8 +503,10 @@ public class ChannelFormFragment extends BaseFragment implements
|
||||
activity.addFilePickerListener(this);
|
||||
activity.addWalletBalanceListener(this);
|
||||
|
||||
activity.setActionBarTitle(editMode ? R.string.edit_channel : R.string.create_a_channel);
|
||||
|
||||
ActionBar actionBar = activity.getSupportActionBar();
|
||||
if (actionBar != null) {
|
||||
actionBar.setTitle(editMode ? R.string.edit_channel : R.string.create_a_channel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -542,7 +544,10 @@ public class ChannelFormFragment extends BaseFragment implements
|
||||
LbryAnalytics.setCurrentScreen(activity, "Channel Form", "ChannelForm");
|
||||
activity.addStoragePermissionListener(this);
|
||||
if (editMode) {
|
||||
activity.setActionBarTitle(R.string.edit_channel);
|
||||
ActionBar actionBar = activity.getSupportActionBar();
|
||||
if (actionBar != null) {
|
||||
actionBar.setTitle(R.string.edit_channel);
|
||||
}
|
||||
}
|
||||
}
|
||||
String filterText = Helper.getValue(inputTagFilter.getText());
|
||||
|
||||
@@ -37,6 +37,8 @@ import androidx.media.session.MediaButtonReceiver;
|
||||
import androidx.preference.PreferenceManager;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.webkit.WebSettingsCompat;
|
||||
import androidx.webkit.WebViewFeature;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.github.chrisbanes.photoview.PhotoView;
|
||||
@@ -174,6 +176,9 @@ public class FileViewFragment extends BaseFragment implements
|
||||
private View layoutDisplayArea;
|
||||
private View layoutResolving;
|
||||
|
||||
private WebView webView;
|
||||
private boolean webViewAdded;
|
||||
|
||||
public View onCreateView(@NonNull LayoutInflater inflater,
|
||||
ViewGroup container, Bundle savedInstanceState) {
|
||||
View root = inflater.inflate(R.layout.fragment_file_view, container, false);
|
||||
@@ -360,11 +365,30 @@ public class FileViewFragment extends BaseFragment implements
|
||||
}
|
||||
|
||||
private void initWebView(View root) {
|
||||
WebView webView = root.findViewById(R.id.file_view_webview);
|
||||
webView.setWebViewClient(new LbryWebViewClient(getContext()));
|
||||
WebSettings webSettings = webView.getSettings();
|
||||
webSettings.setAllowFileAccess(true);
|
||||
webSettings.setJavaScriptEnabled(true);
|
||||
Context ctx = getContext();
|
||||
if (ctx != null) {
|
||||
if (webView == null) {
|
||||
webView = new WebView(ctx);
|
||||
webView.setLayoutParams(new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT));
|
||||
webView.setWebViewClient(new LbryWebViewClient(ctx));
|
||||
WebSettings webSettings = webView.getSettings();
|
||||
webSettings.setAllowFileAccess(true);
|
||||
webSettings.setJavaScriptEnabled(true);
|
||||
}
|
||||
|
||||
if (!webViewAdded && root != null) {
|
||||
((RelativeLayout) root.findViewById(R.id.file_view_webview_container)).addView(webView);
|
||||
webViewAdded = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void applyThemeToWebView() {
|
||||
Context context = getContext();
|
||||
if (context instanceof MainActivity && webView != null && WebViewFeature.isFeatureSupported(WebViewFeature.FORCE_DARK)) {
|
||||
MainActivity activity = (MainActivity) context;
|
||||
WebSettingsCompat.setForceDark(webView.getSettings(), activity.isDarkMode() ? WebSettingsCompat.FORCE_DARK_ON : WebSettingsCompat.FORCE_DARK_OFF);
|
||||
}
|
||||
}
|
||||
|
||||
private void logUrlEvent(String url) {
|
||||
@@ -545,6 +569,13 @@ public class FileViewFragment extends BaseFragment implements
|
||||
activity.removeStoragePermissionListener(this);
|
||||
//activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
|
||||
}
|
||||
|
||||
if (webView != null) {
|
||||
webView.removeAllViews();
|
||||
webView.loadUrl("about:blank");
|
||||
webView.destroy();
|
||||
webView = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void setPlayerForPlayerView() {
|
||||
@@ -1585,7 +1616,9 @@ public class FileViewFragment extends BaseFragment implements
|
||||
} else if (mediaType.startsWith("text")) {
|
||||
// show web view (and parse markdown too)
|
||||
View container = root.findViewById(R.id.file_view_webview_container);
|
||||
WebView webView = root.findViewById(R.id.file_view_webview);
|
||||
initWebView(root);
|
||||
applyThemeToWebView();
|
||||
|
||||
if (Arrays.asList("text/markdown", "text/md").contains(mediaType.toLowerCase())) {
|
||||
loadMarkdownFromFile(claimFile.getDownloadPath());
|
||||
} else {
|
||||
@@ -1610,8 +1643,9 @@ public class FileViewFragment extends BaseFragment implements
|
||||
@Override
|
||||
public void onSuccess(String text) {
|
||||
String html = buildMarkdownHtml(text);
|
||||
WebView webView = getView().findViewById(R.id.file_view_webview);
|
||||
webView.loadData(html, "text/html", "utf-8");
|
||||
if (webView != null) {
|
||||
webView.loadData(html, "text/html", "utf-8");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -180,7 +180,10 @@ public class AboutFragment extends BaseFragment implements SdkStatusListener {
|
||||
activity.lockDrawer();
|
||||
activity.hideFloatingWalletBalance();
|
||||
|
||||
activity.setActionBarTitle(R.string.about_lbry);
|
||||
ActionBar actionBar = activity.getSupportActionBar();
|
||||
if (actionBar != null) {
|
||||
actionBar.setTitle(R.string.about_lbry);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,10 @@ public class SettingsFragment extends PreferenceFragmentCompat implements Shared
|
||||
activity.lockDrawer();
|
||||
activity.hideFloatingWalletBalance();
|
||||
|
||||
activity.setActionBarTitle(R.string.settings);
|
||||
ActionBar actionBar = activity.getSupportActionBar();
|
||||
if (actionBar != null) {
|
||||
actionBar.setTitle(R.string.settings);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -499,7 +499,10 @@ public class PublishFormFragment extends BaseFragment implements
|
||||
activity.addFilePickerListener(this);
|
||||
activity.addWalletBalanceListener(this);
|
||||
|
||||
activity.setActionBarTitle(editMode ? R.string.edit_content : R.string.new_publish);
|
||||
ActionBar actionBar = activity.getSupportActionBar();
|
||||
if (actionBar != null) {
|
||||
actionBar.setTitle(editMode ? R.string.edit_content : R.string.new_publish);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -886,7 +889,10 @@ public class PublishFormFragment extends BaseFragment implements
|
||||
LbryAnalytics.setCurrentScreen(activity, "Channel Form", "ChannelForm");
|
||||
activity.addStoragePermissionListener(this);
|
||||
if (editMode) {
|
||||
activity.setActionBarTitle(R.string.edit_content);
|
||||
ActionBar actionBar = activity.getSupportActionBar();
|
||||
if (actionBar != null) {
|
||||
actionBar.setTitle(R.string.edit_content);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@ import android.widget.ProgressBar;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.ActionBar;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.recyclerview.widget.DividerItemDecoration;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
@@ -49,9 +48,7 @@ public class TransactionHistoryFragment extends BaseFragment implements Transact
|
||||
Context context = getContext();
|
||||
LinearLayoutManager llm = new LinearLayoutManager(context);
|
||||
transactionList.setLayoutManager(llm);
|
||||
DividerItemDecoration itemDecoration = new DividerItemDecoration(context, DividerItemDecoration.VERTICAL);
|
||||
itemDecoration.setDrawable(ContextCompat.getDrawable(context, R.drawable.thin_divider));
|
||||
transactionList.addItemDecoration(itemDecoration);
|
||||
transactionList.addItemDecoration(new DividerItemDecoration(context, DividerItemDecoration.VERTICAL));
|
||||
|
||||
transactionList.addOnScrollListener(new RecyclerView.OnScrollListener() {
|
||||
@Override
|
||||
@@ -136,7 +133,10 @@ public class TransactionHistoryFragment extends BaseFragment implements Transact
|
||||
activity.showNavigationBackIcon();
|
||||
activity.lockDrawer();
|
||||
|
||||
activity.setActionBarTitle(R.string.transaction_history);
|
||||
ActionBar actionBar = activity.getSupportActionBar();
|
||||
if (actionBar != null) {
|
||||
actionBar.setTitle(R.string.transaction_history);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -633,9 +633,6 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="gone">
|
||||
<WebView
|
||||
android:id="@+id/file_view_webview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</RelativeLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
Reference in new issue
Block a user