Merge branch 'develop' of https://github.com/readrops/Readrops into develop

This commit is contained in:
Shinokuni 2019-10-25 18:43:07 +02:00
commit fccc20698a
8 changed files with 67 additions and 10 deletions

View File

@ -242,6 +242,6 @@ public class ItemActivity extends AppCompatActivity {
Intent shareIntent = new Intent(Intent.ACTION_SEND); Intent shareIntent = new Intent(Intent.ACTION_SEND);
shareIntent.setType("text/plain"); shareIntent.setType("text/plain");
shareIntent.putExtra(Intent.EXTRA_TEXT, itemWithFeed.getItem().getTitle() + " - " + itemWithFeed.getItem().getLink()); shareIntent.putExtra(Intent.EXTRA_TEXT, itemWithFeed.getItem().getTitle() + " - " + itemWithFeed.getItem().getLink());
startActivity(Intent.createChooser(shareIntent, getString(R.string.share))); startActivity(Intent.createChooser(shareIntent, getString(R.string.share_article)));
} }
} }

View File

@ -1,9 +1,11 @@
package com.readrops.app.activities package com.readrops.app.activities
import android.annotation.SuppressLint import android.annotation.SuppressLint
import android.content.Intent
import android.graphics.drawable.ColorDrawable import android.graphics.drawable.ColorDrawable
import android.net.Uri import android.net.Uri
import android.os.Bundle import android.os.Bundle
import android.view.Menu
import android.view.MenuItem import android.view.MenuItem
import android.webkit.WebResourceRequest import android.webkit.WebResourceRequest
import android.webkit.WebSettings import android.webkit.WebSettings
@ -30,6 +32,8 @@ class WebViewActivity : AppCompatActivity() {
supportActionBar?.setBackgroundDrawable(ColorDrawable(actionBarColor)) supportActionBar?.setBackgroundDrawable(ColorDrawable(actionBarColor))
setWebViewSettings() setWebViewSettings()
binding.activityWebViewSwipe.setOnRefreshListener { binding.webView.reload() }
val url: String = intent.getStringExtra(WEB_URL) val url: String = intent.getStringExtra(WEB_URL)
binding.webView.loadUrl(url) binding.webView.loadUrl(url)
} }
@ -51,8 +55,10 @@ class WebViewActivity : AppCompatActivity() {
title = view?.title title = view?.title
supportActionBar?.subtitle = Uri.parse(view?.url).host supportActionBar?.subtitle = Uri.parse(view?.url).host
binding.activityWebViewSwipe.isRefreshing = false
super.onPageFinished(view, url) super.onPageFinished(view, url)
} }
} }
} }
@ -72,11 +78,29 @@ class WebViewActivity : AppCompatActivity() {
finish() finish()
return true return true
} }
R.id.web_view_refresh -> {
binding.webView.reload()
}
R.id.web_view_share -> {
shareLink()
}
} }
return super.onOptionsItemSelected(item) return super.onOptionsItemSelected(item)
} }
private fun shareLink() {
val intent = Intent(Intent.ACTION_SEND)
intent.type = "text/plain"
intent.putExtra(Intent.EXTRA_TEXT, binding.webView.url.toString())
startActivity(Intent.createChooser(intent, getString(R.string.share_url)))
}
override fun onCreateOptionsMenu(menu: Menu?): Boolean {
menuInflater.inflate(R.menu.webview_menu, menu)
return true
}
companion object { companion object {
const val WEB_URL = "webUrl" const val WEB_URL = "webUrl"
const val ACTION_BAR_COLOR = "actionBarColor" const val ACTION_BAR_COLOR = "actionBarColor"

View File

@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#FFFFFF"
android:viewportHeight="24.0" android:viewportWidth="24.0"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M17.65,6.35C16.2,4.9 14.21,4 12,4c-4.42,0 -7.99,3.58 -7.99,8s3.57,8 7.99,8c3.73,0 6.84,-2.55 7.73,-6h-2.08c-0.82,2.33 -3.04,4 -5.65,4 -3.31,0 -6,-2.69 -6,-6s2.69,-6 6,-6c1.66,0 3.14,0.69 4.22,1.78L13,11h7V4l-2.35,2.35z"/>
</vector>

View File

@ -21,16 +21,23 @@
</com.google.android.material.appbar.AppBarLayout> </com.google.android.material.appbar.AppBarLayout>
<androidx.core.widget.NestedScrollView <androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/activity_web_view_swipe"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"> app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior">
<WebView <androidx.core.widget.NestedScrollView
android:id="@+id/web_view"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" /> android:layout_height="match_parent">
</androidx.core.widget.NestedScrollView>
<WebView
android:id="@+id/web_view"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</androidx.core.widget.NestedScrollView>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout> </androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@ -10,7 +10,7 @@
<item <item
android:id="@+id/item_share" android:id="@+id/item_share"
android:title="@string/share" android:title="@string/share_article"
android:icon="@drawable/ic_share_white" android:icon="@drawable/ic_share_white"
app:showAsAction="ifRoom" /> app:showAsAction="ifRoom" />

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/web_view_share"
android:icon="@drawable/ic_share_white"
android:title="@string/share_article"
app:showAsAction="ifRoom" />
<item
android:id="@+id/web_view_refresh"
android:icon="@drawable/ic_refresh"
android:title="@string/actualize"
app:showAsAction="never" />
</menu>

View File

@ -20,7 +20,7 @@
<string name="read_time">%1$s min</string> <string name="read_time">%1$s min</string>
<string name="read_time_lower_than_1">Moins d\'une minute</string> <string name="read_time_lower_than_1">Moins d\'une minute</string>
<string name="read_time_one_minute">1 min</string> <string name="read_time_one_minute">1 min</string>
<string name="share">Partager l\'article</string> <string name="share_article">Partager l\'article</string>
<string name="open_url">Ouvrir le lien</string> <string name="open_url">Ouvrir le lien</string>
<string name="add_folder">Ajouter un dossier</string> <string name="add_folder">Ajouter un dossier</string>
<string name="feed_folder">Dossier du flux</string> <string name="feed_folder">Dossier du flux</string>
@ -91,5 +91,7 @@
<string name="open_items_in">Ouvrir les articles avec</string> <string name="open_items_in">Ouvrir les articles avec</string>
<string name="webview">Vue web</string> <string name="webview">Vue web</string>
<string name="external_navigator">Navigateur externe</string> <string name="external_navigator">Navigateur externe</string>
<string name="actualize">Actualiser</string>
<string name="share_url">Partager le lien</string>
</resources> </resources>

View File

@ -22,7 +22,7 @@
<string name="read_time_lower_than_1">Less than a minute</string> <string name="read_time_lower_than_1">Less than a minute</string>
<string name="read_time_one_minute">1 min</string> <string name="read_time_one_minute">1 min</string>
<string name="interpoint" translatable="false">·</string> <string name="interpoint" translatable="false">·</string>
<string name="share">Share Article</string> <string name="share_article">Share Article</string>
<string name="open_url">Open url</string> <string name="open_url">Open url</string>
<string name="add_folder">Add folder</string> <string name="add_folder">Add folder</string>
<string name="feed_folder">Feed folder</string> <string name="feed_folder">Feed folder</string>
@ -99,4 +99,6 @@
<string name="open_items_in">Open items in</string> <string name="open_items_in">Open items in</string>
<string name="webview">Webview</string> <string name="webview">Webview</string>
<string name="external_navigator">External navigator</string> <string name="external_navigator">External navigator</string>
<string name="actualize">Actualize</string>
<string name="share_url">Share url</string>
</resources> </resources>