From b51ae6cbc33980e1246289875c417b9a5017c097 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EC=A4=80=EC=84=B1?= Date: Sat, 16 Nov 2019 16:28:30 +0900 Subject: [PATCH 01/10] test the zoom --- app/build.gradle | 1 + app/libs/android-zoom-view.jar | Bin 0 -> 9375 bytes .../apps/Poche/ui/ReadArticleActivity.java | 4 +++ app/src/main/res/layout/zoom_item.xml | 25 ++++++++++++++++++ app/src/main/res/values-en/strings.xml | 1 - 5 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 app/libs/android-zoom-view.jar create mode 100644 app/src/main/res/layout/zoom_item.xml delete mode 120000 app/src/main/res/values-en/strings.xml diff --git a/app/build.gradle b/app/build.gradle index ca970d544..930f99165 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -73,4 +73,5 @@ dependencies { implementation 'com.mikepenz:aboutlibraries:7.0.4' implementation 'com.github.di72nn.wallabag-api-wrapper:api-wrapper:bc22fca' implementation 'org.slf4j:slf4j-android:1.7.29' + implementation files('libs/android-zoom-view.jar') } diff --git a/app/libs/android-zoom-view.jar b/app/libs/android-zoom-view.jar new file mode 100644 index 0000000000000000000000000000000000000000..3441e3b8978144b5727c18879e4817e1a7871f7f GIT binary patch literal 9375 zcmb7~1#BJ7lD5sv%*@Qpm}6$fn3>s*9Wygi%oH<2?AXW5K4x~z6f^UmX!Y;?_DXxD zt)7vpHKTWCNjo*>KZJH zGVfzxU^j{r;|lW3EFffgW`?PW=_WO{dCp(^JNpn|D)O*!je!v7gny*)|C}oS{QzBk zda-}#gR%bUINP&2JK5WqTbQzX+E{q8>Nz<%X#H`h{=cJOhGr*&V}ZgwUoA;YZ`Dt(@N(M*7fM||t4FVvenaJc^$Ij_ z0;4$!uRxQLWscYS9$U)C*b^Do64AmLQm0!{WZv%+Nl@69VMX7}CD^cj&d&_*VE1}b zmFhE!PmV_e;LyV?dJxMZE_}M@OnFN4wovvNi<^y)Lyt+MDKNrAa(GTh6a5fwibxnc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1agbMSzgx6Zpmo^yIoJ^&hO z6tneJ2<<3bhW&#KQd$=Cu)eckO)%v&`ls|@N3KE&J*`^cl&Ne>>Y4F};>Vl^; zj+!%OpBpRSjvZ4MH;zW14Z|+os*NLWhfz_G_x&lJWi^c_wM4Ec;``${kD0J(uFFEU%Spy!jL*yPEVE1^0~(erXShmNy6Hl zHb^kSyUe=O{HJE$%?BGo*zM0A)k+Yzh3JcKGTV^jn@x3t$IU=mUoMu~VjNVjo`0LL z@G!qT$Zc_?57Yp)0`Qz!&B{CgixN9a@Q7htYq-{)x1mE{S6XZB3tfa-t!2DSq;Y?b z^Vl=O=*PGftaHwc&zY{@dx*pq3^>Xh&DA|4S3O_fpN@X}yWd_!_zF*r2nI&O{?Gk3 z#=kKFe{KM?w=uJDG_zoF_jYg5m~<>=L+hcuLMhH)#U4AqZ})TU1;|kF*yWV*s}&zJNw(R*SUgG%SRnJ<7xxVP-{IPo&01?Q_QF4U^Z-1uN*PjNmAAGwSPJI%+x)i(6N6qbo*?t zluR3tE;mDFb`W`v%V!ty);5aya#+HpMx3G7BZ;yQ{l{k@*%ExgryCB*28AFru}_fv zwIG$8B!G!So}YNcrC#Xz-{9Ss>YTb|RF|)vq06%i{5LD2e@8ra$|OSv1Q-|> z^xqK=4uJ*sFD~YvK+9h)=6~A%M#=nB0QJ8-h|7U{y7ajSR z1^vNH{x|Xe0!jX<^*5#d=g + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values-en/strings.xml b/app/src/main/res/values-en/strings.xml deleted file mode 120000 index c2d3f2bde..000000000 --- a/app/src/main/res/values-en/strings.xml +++ /dev/null @@ -1 +0,0 @@ -../values/strings.xml \ No newline at end of file From 0798c174b3fdfbcef37b34c7840282df91bfed0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EC=A4=80=EC=84=B1?= Date: Sun, 17 Nov 2019 15:14:05 +0900 Subject: [PATCH 02/10] zoom the scroll Add a gesture function to the scroll view to insert the zoom-in out function. --- app/build.gradle | 1 + app/src/main/AndroidManifest.xml | 1 + .../apps/Poche/ui/ReadArticleActivity.java | 57 +++++++++++++++++-- .../gaulupeau/apps/Poche/ui/Zoomactivity.java | 40 +++++++++++++ app/src/main/res/layout/article.xml | 1 + app/src/main/res/layout/zoom_activity.xml | 16 ++++++ app/src/main/res/menu/option_article.xml | 3 + 7 files changed, 113 insertions(+), 6 deletions(-) create mode 100644 app/src/main/java/fr/gaulupeau/apps/Poche/ui/Zoomactivity.java create mode 100644 app/src/main/res/layout/zoom_activity.xml diff --git a/app/build.gradle b/app/build.gradle index 930f99165..031a6c87e 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -73,5 +73,6 @@ dependencies { implementation 'com.mikepenz:aboutlibraries:7.0.4' implementation 'com.github.di72nn.wallabag-api-wrapper:api-wrapper:bc22fca' implementation 'org.slf4j:slf4j-android:1.7.29' + implementation files('libs/android-zoom-view.jar') } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index eabe87f1d..2e04a4b6c 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -158,6 +158,7 @@ android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/provider_paths"/> + diff --git a/app/src/main/java/fr/gaulupeau/apps/Poche/ui/ReadArticleActivity.java b/app/src/main/java/fr/gaulupeau/apps/Poche/ui/ReadArticleActivity.java index fbc97a17e..1dfc94c3a 100644 --- a/app/src/main/java/fr/gaulupeau/apps/Poche/ui/ReadArticleActivity.java +++ b/app/src/main/java/fr/gaulupeau/apps/Poche/ui/ReadArticleActivity.java @@ -21,11 +21,13 @@ import android.view.Menu; import android.view.MenuItem; import android.view.MotionEvent; +import android.view.ScaleGestureDetector; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.view.Window; import android.view.WindowManager; +import android.view.animation.ScaleAnimation; import android.webkit.ConsoleMessage; import android.webkit.HttpAuthHandler; import android.webkit.WebChromeClient; @@ -79,7 +81,9 @@ public class ReadArticleActivity extends BaseActionBarActivity { public static final String EXTRA_ID = "ReadArticleActivity.id"; public static final String EXTRA_LIST_ARCHIVED = "ReadArticleActivity.archived"; public static final String EXTRA_LIST_FAVORITES = "ReadArticleActivity.favorites"; - + private float mscale= 1f; + private ScaleGestureDetector mScaleDetector; + GestureDetector gestureDetector; private static final String TAG = ReadArticleActivity.class.getSimpleName(); private static final String TAG_TTS_FRAGMENT = "ttsFragment"; @@ -174,6 +178,26 @@ public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.article); + gestureDetector= new GestureDetector(this,new GesturerListener()); + mScaleDetector = new ScaleGestureDetector(this,new ScaleGestureDetector.SimpleOnScaleGestureListener(){ + public boolean onScale(ScaleGestureDetector detector){ + float scale= 1-detector.getScaleFactor(); + float prevscale = mscale; + mscale += scale; + + if(mscale < 0.1f) + mscale=0.1f; + + if(mscale > 10f) + mscale=10f; + ScaleAnimation scaleAnimation= new ScaleAnimation(1f/prevscale, 1f/mscale,1f/prevscale, 1f/mscale,detector.getFocusX(),detector.getFocusY()); + scaleAnimation.setDuration(0); + scaleAnimation.setFillAfter(true); + scrollView.startAnimation(scaleAnimation); + return true; + } + }); + Intent intent = getIntent(); long articleID = intent.getLongExtra(EXTRA_ID, -1); @@ -213,6 +237,8 @@ public void onCreate(Bundle savedInstanceState) { scrollView = (ScrollView)findViewById(R.id.scroll); scrollViewLastChild = scrollView.getChildAt(scrollView.getChildCount() - 1); webViewContent = (WebView)findViewById(R.id.webViewContent); + webViewContent.getSettings().setDisplayZoomControls(true); + webViewContent.getSettings().setSupportZoom(true); loadingPlaceholder = (TextView)findViewById(R.id.tv_loading_article); bottomTools = (LinearLayout)findViewById(R.id.bottomTools); hrBar = findViewById(R.id.view1); @@ -225,7 +251,11 @@ public void onCreate(Bundle savedInstanceState) { } loadArticleToWebView(); - + webViewContent.getSettings().setSupportZoom(true); + webViewContent.getSettings().getTextZoom(); + webViewContent.getSettings().setDisplayZoomControls(true); + webViewContent.getSettings().getDisplayZoomControls(); + webViewContent.getSettings().supportZoom(); initButtons(); if(settings.isTtsVisible() && ttsFragment == null) { @@ -241,6 +271,9 @@ public void onCreate(Bundle savedInstanceState) { showDisableTouchToast(); } + + + EventBus.getDefault().register(this); } @@ -356,6 +389,9 @@ public boolean onOptionsItemSelected(MenuItem item) { case R.id.menuTTS: toggleTTS(true); break; + case R.id.magnifer: + + break; default: return super.onOptionsItemSelected(item); @@ -363,6 +399,12 @@ public boolean onOptionsItemSelected(MenuItem item) { return true; } + public boolean dispatchTouchEvent(MotionEvent ev){ + super.dispatchTouchEvent(ev); + mScaleDetector.onTouchEvent(ev); + gestureDetector.onTouchEvent(ev); + return gestureDetector.onTouchEvent(ev); + } @Override public boolean dispatchKeyEvent(KeyEvent event) { @@ -420,10 +462,7 @@ public boolean dispatchKeyEvent(KeyEvent event) { return super.dispatchKeyEvent(event); } - @Override - public boolean dispatchTouchEvent(MotionEvent ev) { - return disableTouch || super.dispatchTouchEvent(ev); - } + @Subscribe(threadMode = ThreadMode.MAIN) public void onArticlesChangedEvent(ArticlesChangedEvent event) { @@ -1368,5 +1407,11 @@ private void setFontSizeNew(WebView view, int size) { private void setFontSizeOld(WebView view, int size) { view.getSettings().setDefaultFontSize(size); } + private class GesturerListener extends GestureDetector.SimpleOnGestureListener{ + public boolean onDown(MotionEvent e){ + return true; + } + } } + diff --git a/app/src/main/java/fr/gaulupeau/apps/Poche/ui/Zoomactivity.java b/app/src/main/java/fr/gaulupeau/apps/Poche/ui/Zoomactivity.java new file mode 100644 index 000000000..c3071273b --- /dev/null +++ b/app/src/main/java/fr/gaulupeau/apps/Poche/ui/Zoomactivity.java @@ -0,0 +1,40 @@ +package fr.gaulupeau.apps.Poche.ui; + +import android.content.Context; +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.LinearLayout; +import android.widget.RelativeLayout; + +import androidx.annotation.RequiresPermission; +import androidx.appcompat.app.AppCompatActivity; + +import fr.gaulupeau.apps.InThePoche.R; +import pl.polidea.view.ZoomView; + +public class Zoomactivity extends AppCompatActivity { + private ReadArticleActivity readArticleActivity; + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.zoom_activity); + + View v = ((LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.article, null, false); + + LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); + + ZoomView zoomView = new ZoomView(this); + zoomView.addView(v); + zoomView.setLayoutParams(layoutParams); + zoomView.setMiniMapEnabled(true); // 좌측 상단 검은색 미니맵 설정 + zoomView.setMaxZoom(4f); // 줌 Max 배율 설정 1f 로 설정하면 줌 안됩니다. + zoomView.setMiniMapCaption("Mini Map Test"); //미니 맵 내용 + zoomView.setMiniMapCaptionSize(20); // 미니 맵 내용 글씨 크기 설정 + + RelativeLayout container = (RelativeLayout) findViewById(R.id.container); + container.addView(zoomView); + } + +} \ No newline at end of file diff --git a/app/src/main/res/layout/article.xml b/app/src/main/res/layout/article.xml index 75ae797ff..130e16856 100644 --- a/app/src/main/res/layout/article.xml +++ b/app/src/main/res/layout/article.xml @@ -19,6 +19,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" + android:id="@+id/a123" tools:ignore="WebViewLayout"> + + + + + + \ No newline at end of file diff --git a/app/src/main/res/menu/option_article.xml b/app/src/main/res/menu/option_article.xml index 0dbcd417e..14e48fd1b 100644 --- a/app/src/main/res/menu/option_article.xml +++ b/app/src/main/res/menu/option_article.xml @@ -58,4 +58,7 @@ android:id="@+id/menuTTS" android:checkable="true" android:title="@string/menuTTS"/> + From 3a159bf83377d476f2404f8eb95043ca0e24dd66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EC=A4=80=EC=84=B1?= Date: Sun, 17 Nov 2019 15:17:49 +0900 Subject: [PATCH 03/10] Remove unnecessary codes used for testing --- app/src/main/AndroidManifest.xml | 1 - .../apps/Poche/ui/ReadArticleActivity.java | 4 -- .../gaulupeau/apps/Poche/ui/Zoomactivity.java | 40 ------------------- app/src/main/res/layout/zoom_activity.xml | 16 -------- app/src/main/res/layout/zoom_item.xml | 25 ------------ app/src/main/res/menu/option_article.xml | 4 +- 6 files changed, 1 insertion(+), 89 deletions(-) delete mode 100644 app/src/main/java/fr/gaulupeau/apps/Poche/ui/Zoomactivity.java delete mode 100644 app/src/main/res/layout/zoom_activity.xml delete mode 100644 app/src/main/res/layout/zoom_item.xml diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 2e04a4b6c..eabe87f1d 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -158,7 +158,6 @@ android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/provider_paths"/> - diff --git a/app/src/main/java/fr/gaulupeau/apps/Poche/ui/ReadArticleActivity.java b/app/src/main/java/fr/gaulupeau/apps/Poche/ui/ReadArticleActivity.java index 1dfc94c3a..800ab00da 100644 --- a/app/src/main/java/fr/gaulupeau/apps/Poche/ui/ReadArticleActivity.java +++ b/app/src/main/java/fr/gaulupeau/apps/Poche/ui/ReadArticleActivity.java @@ -389,10 +389,6 @@ public boolean onOptionsItemSelected(MenuItem item) { case R.id.menuTTS: toggleTTS(true); break; - case R.id.magnifer: - - break; - default: return super.onOptionsItemSelected(item); } diff --git a/app/src/main/java/fr/gaulupeau/apps/Poche/ui/Zoomactivity.java b/app/src/main/java/fr/gaulupeau/apps/Poche/ui/Zoomactivity.java deleted file mode 100644 index c3071273b..000000000 --- a/app/src/main/java/fr/gaulupeau/apps/Poche/ui/Zoomactivity.java +++ /dev/null @@ -1,40 +0,0 @@ -package fr.gaulupeau.apps.Poche.ui; - -import android.content.Context; -import android.os.Bundle; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.LinearLayout; -import android.widget.RelativeLayout; - -import androidx.annotation.RequiresPermission; -import androidx.appcompat.app.AppCompatActivity; - -import fr.gaulupeau.apps.InThePoche.R; -import pl.polidea.view.ZoomView; - -public class Zoomactivity extends AppCompatActivity { - private ReadArticleActivity readArticleActivity; - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.zoom_activity); - - View v = ((LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.article, null, false); - - LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); - - ZoomView zoomView = new ZoomView(this); - zoomView.addView(v); - zoomView.setLayoutParams(layoutParams); - zoomView.setMiniMapEnabled(true); // 좌측 상단 검은색 미니맵 설정 - zoomView.setMaxZoom(4f); // 줌 Max 배율 설정 1f 로 설정하면 줌 안됩니다. - zoomView.setMiniMapCaption("Mini Map Test"); //미니 맵 내용 - zoomView.setMiniMapCaptionSize(20); // 미니 맵 내용 글씨 크기 설정 - - RelativeLayout container = (RelativeLayout) findViewById(R.id.container); - container.addView(zoomView); - } - -} \ No newline at end of file diff --git a/app/src/main/res/layout/zoom_activity.xml b/app/src/main/res/layout/zoom_activity.xml deleted file mode 100644 index f2f905091..000000000 --- a/app/src/main/res/layout/zoom_activity.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout/zoom_item.xml b/app/src/main/res/layout/zoom_item.xml deleted file mode 100644 index b2b5ba1e2..000000000 --- a/app/src/main/res/layout/zoom_item.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/menu/option_article.xml b/app/src/main/res/menu/option_article.xml index 14e48fd1b..02ec27c89 100644 --- a/app/src/main/res/menu/option_article.xml +++ b/app/src/main/res/menu/option_article.xml @@ -58,7 +58,5 @@ android:id="@+id/menuTTS" android:checkable="true" android:title="@string/menuTTS"/> - + From 9574fe06994b75d48a7fd053b617e337c0da20c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EC=A4=80=EC=84=B1?= Date: Sun, 17 Nov 2019 15:19:06 +0900 Subject: [PATCH 04/10] and reformat --- .../apps/Poche/ui/ReadArticleActivity.java | 345 +++++++++--------- app/src/main/res/layout/article.xml | 1 - app/src/main/res/menu/option_article.xml | 2 +- 3 files changed, 170 insertions(+), 178 deletions(-) diff --git a/app/src/main/java/fr/gaulupeau/apps/Poche/ui/ReadArticleActivity.java b/app/src/main/java/fr/gaulupeau/apps/Poche/ui/ReadArticleActivity.java index 800ab00da..d2e26f12b 100644 --- a/app/src/main/java/fr/gaulupeau/apps/Poche/ui/ReadArticleActivity.java +++ b/app/src/main/java/fr/gaulupeau/apps/Poche/ui/ReadArticleActivity.java @@ -11,13 +11,10 @@ import android.net.Uri; import android.os.Build; import android.os.Bundle; -import androidx.appcompat.app.ActionBar; -import androidx.appcompat.app.AlertDialog; import android.text.TextUtils; import android.util.Log; import android.view.GestureDetector; import android.view.KeyEvent; -import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.MotionEvent; @@ -37,11 +34,13 @@ import android.widget.FrameLayout; import android.widget.ImageButton; import android.widget.LinearLayout; -import android.widget.RelativeLayout; import android.widget.ScrollView; import android.widget.TextView; import android.widget.Toast; +import androidx.appcompat.app.ActionBar; +import androidx.appcompat.app.AlertDialog; + import com.di72nn.stuff.wallabag.apiwrapper.WallabagService; import org.greenrobot.eventbus.EventBus; @@ -49,11 +48,6 @@ import org.greenrobot.eventbus.ThreadMode; import org.greenrobot.greendao.query.QueryBuilder; -import fr.gaulupeau.apps.InThePoche.BuildConfig; -import fr.gaulupeau.apps.Poche.events.ArticlesChangedEvent; -import fr.gaulupeau.apps.Poche.events.FeedsChangedEvent; -import fr.gaulupeau.apps.Poche.network.ImageCacheUtils; - import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; @@ -64,6 +58,7 @@ import java.util.EnumSet; import java.util.List; +import fr.gaulupeau.apps.InThePoche.BuildConfig; import fr.gaulupeau.apps.InThePoche.R; import fr.gaulupeau.apps.Poche.App; import fr.gaulupeau.apps.Poche.data.DbConnection; @@ -72,28 +67,24 @@ import fr.gaulupeau.apps.Poche.data.dao.ArticleDao; import fr.gaulupeau.apps.Poche.data.dao.DaoSession; import fr.gaulupeau.apps.Poche.data.dao.entities.Article; +import fr.gaulupeau.apps.Poche.events.ArticlesChangedEvent; +import fr.gaulupeau.apps.Poche.events.FeedsChangedEvent; +import fr.gaulupeau.apps.Poche.network.ImageCacheUtils; import fr.gaulupeau.apps.Poche.service.ServiceHelper; import fr.gaulupeau.apps.Poche.tts.TtsFragment; -import pl.polidea.view.ZoomView; public class ReadArticleActivity extends BaseActionBarActivity { public static final String EXTRA_ID = "ReadArticleActivity.id"; public static final String EXTRA_LIST_ARCHIVED = "ReadArticleActivity.archived"; public static final String EXTRA_LIST_FAVORITES = "ReadArticleActivity.favorites"; - private float mscale= 1f; - private ScaleGestureDetector mScaleDetector; - GestureDetector gestureDetector; private static final String TAG = ReadArticleActivity.class.getSimpleName(); - private static final String TAG_TTS_FRAGMENT = "ttsFragment"; - private static final EnumSet CHANGE_SET_ACTIONS = EnumSet.of( ArticlesChangedEvent.ChangeType.FAVORITED, ArticlesChangedEvent.ChangeType.UNFAVORITED, ArticlesChangedEvent.ChangeType.ARCHIVED, ArticlesChangedEvent.ChangeType.UNARCHIVED); - private static final EnumSet CHANGE_SET_CONTENT = EnumSet.of( ArticlesChangedEvent.ChangeType.CONTENT_CHANGED, ArticlesChangedEvent.ChangeType.TITLE_CHANGED, @@ -103,7 +94,6 @@ public class ReadArticleActivity extends BaseActionBarActivity { ArticlesChangedEvent.ChangeType.URL_CHANGED, ArticlesChangedEvent.ChangeType.ESTIMATED_READING_TIME_CHANGED, ArticlesChangedEvent.ChangeType.FETCHED_IMAGES_CHANGED); - private static final EnumSet CHANGE_SET_PREV_NEXT = EnumSet.of( ArticlesChangedEvent.ChangeType.UNSPECIFIED, ArticlesChangedEvent.ChangeType.ADDED, @@ -113,7 +103,9 @@ public class ReadArticleActivity extends BaseActionBarActivity { ArticlesChangedEvent.ChangeType.FAVORITED, ArticlesChangedEvent.ChangeType.UNFAVORITED, ArticlesChangedEvent.ChangeType.CREATED_DATE_CHANGED); - + GestureDetector gestureDetector; + private float mscale = 1f; + private ScaleGestureDetector mScaleDetector; private Boolean contextFavorites; private Boolean contextArchived; @@ -161,36 +153,36 @@ public void onCreate(Bundle savedInstanceState) { settings = App.getInstance().getSettings(); - if(settings.isFullscreenArticleView()) { + if (settings.isFullscreenArticleView()) { requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags( WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN - ); + ); ActionBar actionBar = super.getSupportActionBar(); - if(actionBar != null) actionBar.hide(); + if (actionBar != null) actionBar.hide(); } - if(settings.isKeepScreenOn()) { + if (settings.isKeepScreenOn()) { getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); } super.onCreate(savedInstanceState); setContentView(R.layout.article); - gestureDetector= new GestureDetector(this,new GesturerListener()); - mScaleDetector = new ScaleGestureDetector(this,new ScaleGestureDetector.SimpleOnScaleGestureListener(){ - public boolean onScale(ScaleGestureDetector detector){ - float scale= 1-detector.getScaleFactor(); + gestureDetector = new GestureDetector(this, new GesturerListener()); + mScaleDetector = new ScaleGestureDetector(this, new ScaleGestureDetector.SimpleOnScaleGestureListener() { + public boolean onScale(ScaleGestureDetector detector) { + float scale = 1 - detector.getScaleFactor(); float prevscale = mscale; mscale += scale; - if(mscale < 0.1f) - mscale=0.1f; + if (mscale < 0.1f) + mscale = 0.1f; - if(mscale > 10f) - mscale=10f; - ScaleAnimation scaleAnimation= new ScaleAnimation(1f/prevscale, 1f/mscale,1f/prevscale, 1f/mscale,detector.getFocusX(),detector.getFocusY()); + if (mscale > 10f) + mscale = 10f; + ScaleAnimation scaleAnimation = new ScaleAnimation(1f / prevscale, 1f / mscale, 1f / prevscale, 1f / mscale, detector.getFocusX(), detector.getFocusY()); scaleAnimation.setDuration(0); scaleAnimation.setFillAfter(true); scrollView.startAnimation(scaleAnimation); @@ -202,17 +194,17 @@ public boolean onScale(ScaleGestureDetector detector){ Intent intent = getIntent(); long articleID = intent.getLongExtra(EXTRA_ID, -1); Log.d(TAG, "onCreate() articleId: " + articleID); - if(intent.hasExtra(EXTRA_LIST_FAVORITES)) { + if (intent.hasExtra(EXTRA_LIST_FAVORITES)) { contextFavorites = intent.getBooleanExtra(EXTRA_LIST_FAVORITES, false); } - if(intent.hasExtra(EXTRA_LIST_ARCHIVED)) { + if (intent.hasExtra(EXTRA_LIST_ARCHIVED)) { contextArchived = intent.getBooleanExtra(EXTRA_LIST_ARCHIVED, false); } DaoSession session = DbConnection.getSession(); articleDao = session.getArticleDao(); - if(!loadArticle(articleID)) { + if (!loadArticle(articleID)) { Log.e(TAG, "onCreate: Did not find article with ID: " + articleID); finish(); return; @@ -234,18 +226,18 @@ public boolean onScale(ScaleGestureDetector detector){ // article is loaded - update menu invalidateOptionsMenu(); - scrollView = (ScrollView)findViewById(R.id.scroll); + scrollView = findViewById(R.id.scroll); scrollViewLastChild = scrollView.getChildAt(scrollView.getChildCount() - 1); - webViewContent = (WebView)findViewById(R.id.webViewContent); + webViewContent = findViewById(R.id.webViewContent); webViewContent.getSettings().setDisplayZoomControls(true); webViewContent.getSettings().setSupportZoom(true); - loadingPlaceholder = (TextView)findViewById(R.id.tv_loading_article); - bottomTools = (LinearLayout)findViewById(R.id.bottomTools); + loadingPlaceholder = findViewById(R.id.tv_loading_article); + bottomTools = findViewById(R.id.bottomTools); hrBar = findViewById(R.id.view1); initWebView(); - if(ttsFragment != null) { + if (ttsFragment != null) { // is it ever executed? ttsFragment.onDocumentLoadStart(articleDomain, articleTitle, articleLanguage); } @@ -258,22 +250,20 @@ public boolean onScale(ScaleGestureDetector detector){ webViewContent.getSettings().supportZoom(); initButtons(); - if(settings.isTtsVisible() && ttsFragment == null) { - ttsFragment = (TtsFragment)getSupportFragmentManager() + if (settings.isTtsVisible() && ttsFragment == null) { + ttsFragment = (TtsFragment) getSupportFragmentManager() .findFragmentByTag(TAG_TTS_FRAGMENT); - if(ttsFragment == null) { + if (ttsFragment == null) { toggleTTS(false); } } - if(disableTouch) { + if (disableTouch) { showDisableTouchToast(); } - - EventBus.getDefault().register(this); } @@ -282,7 +272,7 @@ public void onResume() { super.onResume(); isResumed = true; - if(onPageFinishedCallPostponedUntilResume) { + if (onPageFinishedCallPostponedUntilResume) { onPageFinishedCallPostponedUntilResume = false; onPageFinished(); @@ -298,7 +288,7 @@ public void onPause() { @Override public void onStop() { - if(loadingFinished && article != null) { + if (loadingFinished && article != null) { cancelPositionRestoration(); OperationsHelper.setArticleProgress(this, article.getArticleId(), getReadingPosition()); @@ -322,7 +312,7 @@ public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.option_article, menu); - if(article != null) { + if (article != null) { boolean unread = article.getArchive() != null && !article.getArchive(); menu.findItem(R.id.menuArticleMarkAsRead).setVisible(unread); menu.findItem(R.id.menuArticleMarkAsUnread).setVisible(!unread); @@ -339,7 +329,7 @@ public boolean onCreateOptionsMenu(Menu menu) { @Override public boolean onOptionsItemSelected(MenuItem item) { - switch(item.getItemId()) { + switch (item.getItemId()) { case R.id.menuArticleMarkAsRead: case R.id.menuArticleMarkAsUnread: markAsReadAndClose(); @@ -395,7 +385,8 @@ public boolean onOptionsItemSelected(MenuItem item) { return true; } - public boolean dispatchTouchEvent(MotionEvent ev){ + + public boolean dispatchTouchEvent(MotionEvent ev) { super.dispatchTouchEvent(ev); mScaleDetector.onTouchEvent(ev); gestureDetector.onTouchEvent(ev); @@ -413,7 +404,7 @@ public boolean dispatchKeyEvent(KeyEvent event) { } if (triggerAction) { - if(code == disableTouchKeyCode && (disableTouch || disableTouchOptionEnabled)) { + if (code == disableTouchKeyCode && (disableTouch || disableTouchOptionEnabled)) { disableTouch = !disableTouch; settings.setDisableTouchLastState(disableTouch); @@ -459,19 +450,18 @@ public boolean dispatchKeyEvent(KeyEvent event) { } - @Subscribe(threadMode = ThreadMode.MAIN) public void onArticlesChangedEvent(ArticlesChangedEvent event) { Log.d(TAG, "onArticlesChangedEvent() started"); boolean updatePrevNext = false; - if(!Collections.disjoint(event.getInvalidateAllChanges(), CHANGE_SET_PREV_NEXT)) { + if (!Collections.disjoint(event.getInvalidateAllChanges(), CHANGE_SET_PREV_NEXT)) { updatePrevNext = true; } else { EnumSet changes; - if(contextArchived != null) { + if (contextArchived != null) { changes = contextArchived ? event.getArchiveFeedChanges() : event.getMainFeedChanges(); - } else if(contextFavorites != null && contextFavorites) { + } else if (contextFavorites != null && contextFavorites) { changes = event.getFavoriteFeedChanges(); } else { changes = EnumSet.copyOf(event.getMainFeedChanges()); @@ -479,19 +469,19 @@ public void onArticlesChangedEvent(ArticlesChangedEvent event) { changes.addAll(event.getFavoriteFeedChanges()); } - if(!Collections.disjoint(changes, CHANGE_SET_PREV_NEXT)) { + if (!Collections.disjoint(changes, CHANGE_SET_PREV_NEXT)) { updatePrevNext = true; } } - if(updatePrevNext) { + if (updatePrevNext) { Log.d(TAG, "onArticleChangedEvent() prev/next buttons changed"); updatePrevNextButtons(); } EnumSet changes = event.getArticleChanges(article); - if(changes == null) return; + if (changes == null) return; Log.d(TAG, "onArticlesChangedEvent() changes: " + changes); @@ -500,7 +490,7 @@ public void onArticlesChangedEvent(ArticlesChangedEvent event) { boolean updateTitle; boolean updateURL; - if(changes.contains(FeedsChangedEvent.ChangeType.UNSPECIFIED)) { + if (changes.contains(FeedsChangedEvent.ChangeType.UNSPECIFIED)) { updateActions = true; updateContent = true; updateTitle = true; @@ -512,7 +502,7 @@ public void onArticlesChangedEvent(ArticlesChangedEvent event) { updateURL = changes.contains(FeedsChangedEvent.ChangeType.URL_CHANGED); } - if(updateActions) { + if (updateActions) { Log.d(TAG, "onArticleChangedEvent() actions changed"); updateMarkAsReadButtonView(); @@ -520,20 +510,20 @@ public void onArticlesChangedEvent(ArticlesChangedEvent event) { invalidateOptionsMenu(); } - if(updateTitle) { + if (updateTitle) { Log.d(TAG, "onArticleChangedEvent() title changed"); articleTitle = article.getTitle(); setTitle(articleTitle); } - if(updateURL) { + if (updateURL) { Log.d(TAG, "onArticleChangedEvent() URL changed"); articleUrl = article.getUrl(); } - if(updateContent) { + if (updateContent) { Log.d(TAG, "onArticleChangedEvent() content changed"); // prepareToRestorePosition(true); @@ -561,10 +551,10 @@ private void initWebView() { @Override public boolean onConsoleMessage(ConsoleMessage cm) { boolean result = false; - if(ttsFragment != null) { + if (ttsFragment != null) { result = ttsFragment.onWebViewConsoleMessage(cm); } - if(!result) { + if (!result) { Log.d("WebView.onCM", String.format("%s @ %d: %s", cm.message(), cm.lineNumber(), cm.sourceId())); } @@ -610,7 +600,7 @@ public void onPageFinished(WebView view, String url) { @Override public boolean shouldOverrideUrlLoading(WebView webView, String url) { // If we try to open current URL, do not propose to save it, directly open browser - if(url.equals(articleUrl)) { + if (url.equals(articleUrl)) { openURL(url); } else { handleUrlClicked(url); @@ -624,13 +614,14 @@ public void onReceivedHttpAuthRequest(WebView view, HttpAuthHandler handler, String host, String realm) { Log.d(TAG, "onReceivedHttpAuthRequest() host: " + host + ", realm: " + realm); - if(!TextUtils.isEmpty(host)) { + if (!TextUtils.isEmpty(host)) { String httpAuthHost = settings.getUrl(); try { httpAuthHost = new URL(httpAuthHost).getHost(); - } catch(Exception ignored) {} + } catch (Exception ignored) { + } - if(host.contains(httpAuthHost)) { + if (host.contains(httpAuthHost)) { Log.d(TAG, "onReceivedHttpAuthRequest() host match"); handler.proceed(settings.getHttpAuthUsername(), settings.getHttpAuthPassword()); return; @@ -642,7 +633,7 @@ public void onReceivedHttpAuthRequest(WebView view, HttpAuthHandler handler, }); - if(fontSize != 100) setFontSize(webViewContent, fontSize); + if (fontSize != 100) setFontSize(webViewContent, fontSize); GestureDetector.SimpleOnGestureListener gestureListener = new GestureDetector.SimpleOnGestureListener() { @@ -651,33 +642,33 @@ public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float ve // note: e1 - previous event, e2 - current event // velocity* - velocity in pixels per second - if(!swipeArticles) return false; - if(e1 == null || e2 == null) return false; - if(e1.getPointerCount() > 1 || e2.getPointerCount() > 1) return false; + if (!swipeArticles) return false; + if (e1 == null || e2 == null) return false; + if (e1.getPointerCount() > 1 || e2.getPointerCount() > 1) return false; // if(Math.abs(e1.getY() - e2.getY()) > 150) { // Log.d("FLING", "not a horizontal fling (distance)"); // return false; // not a horizontal move (distance) // } - if(Math.abs(velocityX) < 80) { + if (Math.abs(velocityX) < 80) { Log.v("FLING", "too slow"); return false; // too slow } - if(Math.abs(velocityX / velocityY) < 3) { + if (Math.abs(velocityX / velocityY) < 3) { Log.v("FLING", "not a horizontal fling"); return false; // not a horizontal fling } float diff = e1.getX() - e2.getX(); - if(Math.abs(diff) < 80) { // configurable + if (Math.abs(diff) < 80) { // configurable Log.v("FLING", "too small distance"); return false; // too small distance } - if(diff > 0) { // right-to-left: next + if (diff > 0) { // right-to-left: next Log.v("FLING", "right-to-left: next"); openNextArticle(); } else { // left-to-right: prev @@ -689,20 +680,20 @@ public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float ve @Override public boolean onSingleTapConfirmed(MotionEvent e) { - if(!tapToScroll) return false; + if (!tapToScroll) return false; - if(e.getPointerCount() > 1) return false; + if (e.getPointerCount() > 1) return false; int viewHeight = scrollView.getHeight(); float y = e.getY() - scrollView.getScrollY(); - if(y > viewHeight * 0.25 && y < viewHeight * 0.75) { + if (y > viewHeight * 0.25 && y < viewHeight * 0.75) { int viewWidth = scrollView.getWidth(); float x = e.getX(); - if(x < viewWidth * 0.3) { // left part + if (x < viewWidth * 0.3) { // left part scroll(true, screenScrollingPercent, smoothScrolling, false); - } else if(x > viewWidth * 0.7) { // right part + } else if (x > viewWidth * 0.7) { // right part scroll(false, screenScrollingPercent, smoothScrolling, false); } } @@ -730,7 +721,7 @@ private String getHtmlPage() { String cssName; boolean highContrast = false; boolean weightedFont = false; - switch(Themes.getCurrentTheme()) { + switch (Themes.getCurrentTheme()) { case E_INK: weightedFont = true; case LIGHT_CONTRAST: @@ -753,18 +744,18 @@ private String getHtmlPage() { } List additionalClasses = new ArrayList<>(1); - if(highContrast) additionalClasses.add("high-contrast"); - if(weightedFont) additionalClasses.add("weighted-font"); - if(settings.isArticleFontSerif()) additionalClasses.add("serif-font"); - if(settings.isArticleTextAlignmentJustify()) additionalClasses.add("text-align-justify"); + if (highContrast) additionalClasses.add("high-contrast"); + if (weightedFont) additionalClasses.add("weighted-font"); + if (settings.isArticleFontSerif()) additionalClasses.add("serif-font"); + if (settings.isArticleTextAlignmentJustify()) additionalClasses.add("text-align-justify"); additionalClasses.add(settings.getHandlePreformattedTextOption()); String classAttr; - if(!additionalClasses.isEmpty()) { + if (!additionalClasses.isEmpty()) { StringBuilder sb = new StringBuilder(); sb.append(" class=\""); - for(String cl: additionalClasses) { + for (String cl : additionalClasses) { sb.append(cl).append(' '); } sb.append('"'); @@ -777,17 +768,17 @@ private String getHtmlPage() { String htmlBase; try { htmlBase = readRawString(R.raw.webview_htmlbase); - } catch(Exception e) { + } catch (Exception e) { // should not happen throw new RuntimeException("Couldn't load raw resource", e); } String htmlContent = getHtmlContent(); List imgURLs = ImageCacheUtils.findImageUrlsInHtml(htmlContent); - if(imgURLs != null && imgURLs.size() > 0) { + if (imgURLs != null && imgURLs.size() > 0) { String wbgURL = ImageCacheUtils.getWallabagUrl(); - for(String imageURL: imgURLs) { - if(imageURL.startsWith(ImageCacheUtils.WALLABAG_RELATIVE_URL_PATH)) { + for (String imageURL : imgURLs) { + if (imageURL.startsWith(ImageCacheUtils.WALLABAG_RELATIVE_URL_PATH)) { htmlContent = htmlContent.replace(imageURL, wbgURL + imageURL); Log.d(TAG, "getHtmlPage() prefixing wallabag server URL " + wbgURL + " to the image path " + imageURL); } @@ -816,14 +807,14 @@ private String getHtmlContent() { estimatedReadingTime > 0 ? estimatedReadingTime : "< 1"); String previewPicture = ""; - if(settings.isPreviewImageEnabled() && !TextUtils.isEmpty(article.getPreviewPictureURL())) { + if (settings.isPreviewImageEnabled() && !TextUtils.isEmpty(article.getPreviewPictureURL())) { previewPicture = "
"; } htmlContent = estimatedReadingTimeString + previewPicture + htmlContent; - if(BuildConfig.DEBUG) Log.d(TAG, "getHtmlContent() htmlContent: " + htmlContent); + if (BuildConfig.DEBUG) Log.d(TAG, "getHtmlContent() htmlContent: " + htmlContent); - if(settings.isImageCacheEnabled()) { + if (settings.isImageCacheEnabled()) { Log.d(TAG, "getHtmlContent() replacing image links to cached versions in htmlContent"); htmlContent = ImageCacheUtils.replaceImagesInHtmlContent( htmlContent, article.getArticleId().longValue()); @@ -838,12 +829,12 @@ private void initButtons() { } private void updateMarkAsReadButtonView() { - Button buttonMarkRead = (Button)findViewById(R.id.btnMarkRead); - Button buttonMarkUnread = (Button)findViewById(R.id.btnMarkUnread); + Button buttonMarkRead = findViewById(R.id.btnMarkRead); + Button buttonMarkUnread = findViewById(R.id.btnMarkUnread); boolean archived = article.getArchive(); - buttonMarkRead.setVisibility(!archived ? View.VISIBLE: View.GONE); - buttonMarkUnread.setVisibility(archived ? View.VISIBLE: View.GONE); + buttonMarkRead.setVisibility(!archived ? View.VISIBLE : View.GONE); + buttonMarkUnread.setVisibility(archived ? View.VISIBLE : View.GONE); OnClickListener onClickListener = new OnClickListener() { @@ -865,8 +856,8 @@ private void updatePrevNextButtons() { } private void updatePrevNextButtonViews() { - ImageButton buttonGoPrevious = (ImageButton)findViewById(R.id.btnGoPrevious); - ImageButton buttonGoNext = (ImageButton)findViewById(R.id.btnGoNext); + ImageButton buttonGoPrevious = findViewById(R.id.btnGoPrevious); + ImageButton buttonGoNext = findViewById(R.id.btnGoNext); buttonGoPrevious.setVisibility(previousArticleID == null ? View.GONE : View.VISIBLE); buttonGoNext.setVisibility(nextArticleID == null ? View.GONE : View.VISIBLE); @@ -896,22 +887,22 @@ private void loadingFinished() { restoreReadingPosition(); - if(ttsFragment != null) { + if (ttsFragment != null) { ttsFragment.onDocumentLoadFinished(webViewContent, scrollView); } } private void handleUrlClicked(final String url) { Log.d(TAG, "handleUrlClicked() url: " + url); - if(TextUtils.isEmpty(url)) return; + if (TextUtils.isEmpty(url)) return; // TODO: fancy dialog AlertDialog.Builder builder = new AlertDialog.Builder(this); @SuppressLint("InflateParams") // it's ok to inflate with null for AlertDialog - View v = getLayoutInflater().inflate(R.layout.dialog_title_url, null); + View v = getLayoutInflater().inflate(R.layout.dialog_title_url, null); - TextView tv = (TextView)v.findViewById(R.id.tv_dialog_title_url); + TextView tv = v.findViewById(R.id.tv_dialog_title_url); tv.setText(url); builder.setCustomTitle(v); @@ -947,10 +938,10 @@ public void onClick(DialogInterface dialog, int which) { private void openURL(String url) { Log.d(TAG, "openURL() url: " + url); - if(TextUtils.isEmpty(url)) return; + if (TextUtils.isEmpty(url)) return; Uri uri = Uri.parse(url); - if(uri.getScheme() == null) { + if (uri.getScheme() == null) { Log.i(TAG, "openURL() scheme is null, appending default scheme"); uri = Uri.parse("http://" + url); } @@ -959,7 +950,7 @@ private void openURL(String url) { Intent intent = new Intent(Intent.ACTION_VIEW, uri); try { startActivity(intent); - } catch(ActivityNotFoundException e) { + } catch (ActivityNotFoundException e) { Log.w(TAG, "openURL() failed to open URL", e); Toast.makeText(this, R.string.message_couldNotOpenUrl, Toast.LENGTH_SHORT).show(); } @@ -976,21 +967,21 @@ private void toggleFavorite() { } private void shareArticle() { - shareArticle(articleTitle, articleUrl); + shareArticle(articleTitle, articleUrl); } - private void shareArticle(String articleTitle , String articleUrl) { + private void shareArticle(String articleTitle, String articleUrl) { String shareText = articleUrl; - if(!TextUtils.isEmpty(articleTitle)) shareText = articleTitle + " " + shareText; + if (!TextUtils.isEmpty(articleTitle)) shareText = articleTitle + " " + shareText; - if(settings.isAppendWallabagMentionEnabled()) { + if (settings.isAppendWallabagMentionEnabled()) { shareText += getString(R.string.share_text_extra); } Intent send = new Intent(Intent.ACTION_SEND); send.setType("text/plain"); - if(!TextUtils.isEmpty(articleTitle)) send.putExtra(Intent.EXTRA_SUBJECT, articleTitle); + if (!TextUtils.isEmpty(articleTitle)) send.putExtra(Intent.EXTRA_SUBJECT, articleTitle); send.putExtra(Intent.EXTRA_TEXT, shareText); startActivity(Intent.createChooser(send, getString(R.string.share_article_title))); @@ -1021,14 +1012,14 @@ private void showChangeTitleDialog() { @SuppressLint("InflateParams") // ok for dialogs final View view = getLayoutInflater().inflate(R.layout.dialog_change_title, null); - ((TextView)view.findViewById(R.id.editText_title)).setText(articleTitle); + ((TextView) view.findViewById(R.id.editText_title)).setText(articleTitle); builder.setView(view); builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { - TextView textView = (TextView)view.findViewById(R.id.editText_title); + TextView textView = view.findViewById(R.id.editText_title); changeTitle(textView.getText().toString()); } }); @@ -1053,7 +1044,7 @@ private void openOriginal() { } private void copyURLToClipboard() { - copyURLToClipboard(articleUrl); + copyURLToClipboard(articleUrl); } private void copyURLToClipboard(String url) { @@ -1068,23 +1059,23 @@ private void showDownloadFileDialog() { builder.setTitle(R.string.dialog_title_downloadFileFormat) .setItems(R.array.options_downloadFormat_values, new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int which) { - String selectedFormat = getResources() - .getStringArray(R.array.options_downloadFormat_values)[which]; - - WallabagService.ResponseFormat format; - try { - format = WallabagService.ResponseFormat.valueOf(selectedFormat); - } catch(IllegalArgumentException e) { - Log.e(TAG, "showDownloadFileDialog() unknown selected format: " - + selectedFormat); - format = WallabagService.ResponseFormat.PDF; - } - - ServiceHelper.downloadArticleAsFile(getApplicationContext(), - article.getArticleId(), format, null); - } - }); + public void onClick(DialogInterface dialog, int which) { + String selectedFormat = getResources() + .getStringArray(R.array.options_downloadFormat_values)[which]; + + WallabagService.ResponseFormat format; + try { + format = WallabagService.ResponseFormat.valueOf(selectedFormat); + } catch (IllegalArgumentException e) { + Log.e(TAG, "showDownloadFileDialog() unknown selected format: " + + selectedFormat); + format = WallabagService.ResponseFormat.PDF; + } + + ServiceHelper.downloadArticleAsFile(getApplicationContext(), + article.getArticleId(), format, null); + } + }); builder.show(); } @@ -1093,7 +1084,7 @@ private void changeFontSize(boolean increase) { int step = 5; fontSize += step * (increase ? 1 : -1); - if(!increase && fontSize < 5) fontSize = 5; + if (!increase && fontSize < 5) fontSize = 5; setFontSize(webViewContent, fontSize); @@ -1103,21 +1094,21 @@ private void changeFontSize(boolean increase) { } private void openArticle(Long id) { - if(ttsFragment != null) { + if (ttsFragment != null) { ttsFragment.onOpenNewArticle(); } Intent intent = new Intent(this, ReadArticleActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); intent.putExtra(ReadArticleActivity.EXTRA_ID, id); - if(contextFavorites != null) intent.putExtra(EXTRA_LIST_FAVORITES, contextFavorites); - if(contextArchived != null) intent.putExtra(EXTRA_LIST_ARCHIVED, contextArchived); + if (contextFavorites != null) intent.putExtra(EXTRA_LIST_FAVORITES, contextFavorites); + if (contextArchived != null) intent.putExtra(EXTRA_LIST_ARCHIVED, contextArchived); startActivity(intent); } public boolean openPreviousArticle() { - if(previousArticleID != null) { + if (previousArticleID != null) { openArticle(previousArticleID); return true; } @@ -1127,7 +1118,7 @@ public boolean openPreviousArticle() { } public boolean openNextArticle() { - if(nextArticleID != null) { + if (nextArticleID != null) { openArticle(nextArticleID); return true; } @@ -1137,29 +1128,29 @@ public boolean openNextArticle() { } private void scroll(boolean up, float percent, boolean smooth, boolean keyUsed) { - if(scrollView == null) return; + if (scrollView == null) return; int viewHeight = scrollView.getHeight(); int yOffset = scrollView.getScrollY(); int newYOffset = yOffset; - int step = (int)(viewHeight * percent / 100); - if(up) { + int step = (int) (viewHeight * percent / 100); + if (up) { newYOffset -= step; } else { newYOffset += step; } - if(newYOffset != yOffset) { - if(smooth) { + if (newYOffset != yOffset) { + if (smooth) { scrollView.smoothScrollTo(scrollView.getScrollX(), newYOffset); } else { scrollView.scrollTo(scrollView.getScrollX(), newYOffset); } } - if(!up && keyUsed && newYOffset + viewHeight > scrollViewLastChild.getBottom()) { - if(scrolledOverBottom > 1) { + if (!up && keyUsed && newYOffset + viewHeight > scrollViewLastChild.getBottom()) { + if (scrolledOverBottom > 1) { scrolledOverBottom--; Toast.makeText(this, getString(R.string.scrolledOverBottom, scrolledOverBottom), Toast.LENGTH_SHORT).show(); @@ -1183,7 +1174,7 @@ private double getReadingPosition() { totalHeight -= viewHeight; double position = totalHeight >= 0 ? yOffset * 1. / totalHeight : 0; - if(position > 100) position = 100; + if (position > 100) position = 100; Log.d(TAG, "getReadingPosition() position: " + position); @@ -1193,7 +1184,7 @@ private double getReadingPosition() { private void restoreReadingPosition() { Log.d(TAG, "restoreReadingPosition() articleProgress: " + articleProgress); - if(articleProgress != null) { + if (articleProgress != null) { int viewHeight = scrollView.getHeight(); int totalHeight = scrollView.getChildAt(0).getHeight(); @@ -1202,7 +1193,7 @@ private void restoreReadingPosition() { totalHeight -= viewHeight; - int yOffset = totalHeight > 0 ? ((int)Math.round(articleProgress * totalHeight)) : 0; + int yOffset = totalHeight > 0 ? ((int) Math.round(articleProgress * totalHeight)) : 0; Log.v(TAG, "restoreReadingPosition() yOffset: " + yOffset); @@ -1212,18 +1203,18 @@ private void restoreReadingPosition() { public boolean toggleTTS(boolean autoPlay) { boolean result; - if(ttsFragment == null) { + if (ttsFragment == null) { ttsFragment = TtsFragment.newInstance(autoPlay); getSupportFragmentManager() - .beginTransaction() - .add(R.id.viewMain, ttsFragment, TAG_TTS_FRAGMENT) - .commit(); + .beginTransaction() + .add(R.id.viewMain, ttsFragment, TAG_TTS_FRAGMENT) + .commit(); settings.setTtsVisible(true); ttsFragment.onDocumentLoadStart(articleDomain, articleTitle, articleLanguage); - if(loadingFinished) { + if (loadingFinished) { ttsFragment.onDocumentLoadFinished(webViewContent, scrollView); } @@ -1249,7 +1240,7 @@ public boolean toggleTTS(boolean autoPlay) { private boolean loadArticle(long id) { article = getArticle(id); - if(article == null) return false; + if (article == null) return false; articleTitle = article.getTitle(); Log.d(TAG, "loadArticle() articleTitle: " + articleTitle); @@ -1272,17 +1263,17 @@ private Article getArticle(long articleID) { private Long getAdjacentArticle(boolean previous) { QueryBuilder
qb = articleDao.queryBuilder(); - if(previous) qb.where(ArticleDao.Properties.ArticleId.gt(article.getArticleId())); + if (previous) qb.where(ArticleDao.Properties.ArticleId.gt(article.getArticleId())); else qb.where(ArticleDao.Properties.ArticleId.lt(article.getArticleId())); - if(contextFavorites != null) qb.where(ArticleDao.Properties.Favorite.eq(contextFavorites)); - if(contextArchived != null) qb.where(ArticleDao.Properties.Archive.eq(contextArchived)); + if (contextFavorites != null) qb.where(ArticleDao.Properties.Favorite.eq(contextFavorites)); + if (contextArchived != null) qb.where(ArticleDao.Properties.Archive.eq(contextArchived)); - if(previous) qb.orderAsc(ArticleDao.Properties.ArticleId); + if (previous) qb.orderAsc(ArticleDao.Properties.ArticleId); else qb.orderDesc(ArticleDao.Properties.ArticleId); List
l = qb.limit(1).list(); - if(!l.isEmpty()) { + if (!l.isEmpty()) { return l.get(0).getId(); } @@ -1296,16 +1287,17 @@ private String readRawString(int id) throws IOException { StringBuilder sb = new StringBuilder(); String s; - while((s = reader.readLine()) != null) { + while ((s = reader.readLine()) != null) { sb.append(s).append('\n'); } return sb.toString(); } finally { - if(reader != null) { + if (reader != null) { try { reader.close(); - } catch(IOException ignored) {} + } catch (IOException ignored) { + } } } } @@ -1313,10 +1305,10 @@ private String readRawString(int id) throws IOException { private void onPageFinished() { Log.d(TAG, "onPageFinished() started"); - if(!isResumed) { + if (!isResumed) { onPageFinishedCallPostponedUntilResume = true; - if(ttsFragment != null) { + if (ttsFragment != null) { ttsFragment.onDocumentLoadFinished(webViewContent, scrollView); } return; @@ -1329,8 +1321,8 @@ private void onPageFinished() { @Override public void run() { // "< 50" is workaround for https://github.com/wallabag/android-app/issues/178 - if(webViewContent.getHeight() < 50) { - if(++counter > 1000) { + if (webViewContent.getHeight() < 50) { + if (++counter > 1000) { Log.d(TAG, "onPageFinished() exiting by counter" + "; calling loadingFinished() anyway"); loadingFinished(); @@ -1348,7 +1340,7 @@ public void run() { } private void prepareToRestorePosition(boolean savePosition) { - if(savePosition) articleProgress = getReadingPosition(); + if (savePosition) articleProgress = getReadingPosition(); webViewHeightBeforeUpdate = webViewContent.getHeight(); } @@ -1361,8 +1353,8 @@ private void restorePositionAfterUpdate() { @Override public void run() { - if(webViewContent.getHeight() == webViewHeightBeforeUpdate) { - if(++counter > 1000) { + if (webViewContent.getHeight() == webViewHeightBeforeUpdate) { + if (++counter > 1000) { Log.d(TAG, "restorePositionAfterUpdate() giving up"); return; } @@ -1379,15 +1371,15 @@ public void run() { } private void cancelPositionRestoration() { - if(positionRestorationRunnable != null) { + if (positionRestorationRunnable != null) { Log.d(TAG, "cancelPositionRestoration() trying to cancel previous task"); - if(webViewContent != null) webViewContent.removeCallbacks(positionRestorationRunnable); + if (webViewContent != null) webViewContent.removeCallbacks(positionRestorationRunnable); positionRestorationRunnable = null; } } private void setFontSize(WebView view, int size) { - if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { setFontSizeNew(view, size); } else { setFontSizeOld(view, size); @@ -1403,8 +1395,9 @@ private void setFontSizeNew(WebView view, int size) { private void setFontSizeOld(WebView view, int size) { view.getSettings().setDefaultFontSize(size); } - private class GesturerListener extends GestureDetector.SimpleOnGestureListener{ - public boolean onDown(MotionEvent e){ + + private class GesturerListener extends GestureDetector.SimpleOnGestureListener { + public boolean onDown(MotionEvent e) { return true; } } diff --git a/app/src/main/res/layout/article.xml b/app/src/main/res/layout/article.xml index 130e16856..75ae797ff 100644 --- a/app/src/main/res/layout/article.xml +++ b/app/src/main/res/layout/article.xml @@ -19,7 +19,6 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" - android:id="@+id/a123" tools:ignore="WebViewLayout"> - + From 595da87092dfd5d1d92bb5e5691dbd83ade1ca7f Mon Sep 17 00:00:00 2001 From: junseong kim Date: Sun, 17 Nov 2019 22:36:47 +0900 Subject: [PATCH 05/10] Update build.gradle --- app/build.gradle | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 031a6c87e..ca970d544 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -73,6 +73,4 @@ dependencies { implementation 'com.mikepenz:aboutlibraries:7.0.4' implementation 'com.github.di72nn.wallabag-api-wrapper:api-wrapper:bc22fca' implementation 'org.slf4j:slf4j-android:1.7.29' - - implementation files('libs/android-zoom-view.jar') } From 7dc01f557bb84c05424769d1fa92263f86c6f86f Mon Sep 17 00:00:00 2001 From: saechimdaeki Date: Sun, 17 Nov 2019 22:44:06 +0900 Subject: [PATCH 06/10] delete the zoom-view.jar --- app/libs/android-zoom-view.jar | Bin 9375 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 app/libs/android-zoom-view.jar diff --git a/app/libs/android-zoom-view.jar b/app/libs/android-zoom-view.jar deleted file mode 100644 index 3441e3b8978144b5727c18879e4817e1a7871f7f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 9375 zcmb7~1#BJ7lD5sv%*@Qpm}6$fn3>s*9Wygi%oH<2?AXW5K4x~z6f^UmX!Y;?_DXxD zt)7vpHKTWCNjo*>KZJH zGVfzxU^j{r;|lW3EFffgW`?PW=_WO{dCp(^JNpn|D)O*!je!v7gny*)|C}oS{QzBk zda-}#gR%bUINP&2JK5WqTbQzX+E{q8>Nz<%X#H`h{=cJOhGr*&V}ZgwUoA;YZ`Dt(@N(M*7fM||t4FVvenaJc^$Ij_ z0;4$!uRxQLWscYS9$U)C*b^Do64AmLQm0!{WZv%+Nl@69VMX7}CD^cj&d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z*E4^X<$Chy9c`wgYNVA3j)jjnc2AI zh>&rZu2Qy!tFI`+5DIN)SCnycfHss6j^nKC2E$`L9b1agbMSzgx6Zpmo^yIoJ^&hO z6tneJ2<<3bhW&#KQd$=Cu)eckO)%v&`ls|@N3KE&J*`^cl&Ne>>Y4F};>Vl^; zj+!%OpBpRSjvZ4MH;zW14Z|+os*NLWhfz_G_x&lJWi^c_wM4Ec;``${kD0J(uFFEU%Spy!jL*yPEVE1^0~(erXShmNy6Hl zHb^kSyUe=O{HJE$%?BGo*zM0A)k+Yzh3JcKGTV^jn@x3t$IU=mUoMu~VjNVjo`0LL z@G!qT$Zc_?57Yp)0`Qz!&B{CgixN9a@Q7htYq-{)x1mE{S6XZB3tfa-t!2DSq;Y?b z^Vl=O=*PGftaHwc&zY{@dx*pq3^>Xh&DA|4S3O_fpN@X}yWd_!_zF*r2nI&O{?Gk3 z#=kKFe{KM?w=uJDG_zoF_jYg5m~<>=L+hcuLMhH)#U4AqZ})TU1;|kF*yWV*s}&zJNw(R*SUgG%SRnJ<7xxVP-{IPo&01?Q_QF4U^Z-1uN*PjNmAAGwSPJI%+x)i(6N6qbo*?t zluR3tE;mDFb`W`v%V!ty);5aya#+HpMx3G7BZ;yQ{l{k@*%ExgryCB*28AFru}_fv zwIG$8B!G!So}YNcrC#Xz-{9Ss>YTb|RF|)vq06%i{5LD2e@8ra$|OSv1Q-|> z^xqK=4uJ*sFD~YvK+9h)=6~A%M#=nB0QJ8-h|7U{y7ajSR z1^vNH{x|Xe0!jX<^*5#d=g Date: Wed, 20 Nov 2019 00:39:01 +0900 Subject: [PATCH 07/10] recover (sry) --- app/src/main/res/values-en/strings.xml | 1 + 1 file changed, 1 insertion(+) create mode 100644 app/src/main/res/values-en/strings.xml diff --git a/app/src/main/res/values-en/strings.xml b/app/src/main/res/values-en/strings.xml new file mode 100644 index 000000000..c2d3f2bde --- /dev/null +++ b/app/src/main/res/values-en/strings.xml @@ -0,0 +1 @@ +../values/strings.xml \ No newline at end of file From b5bd53e6b86e60a410ff37cbcd3a5cb3ae13780e Mon Sep 17 00:00:00 2001 From: saechimdaeki Date: Wed, 20 Nov 2019 00:53:10 +0900 Subject: [PATCH 08/10] Revert "recover (sry)" This reverts commit 91d4e68585eeec858567f18d7c296c203f2a3311. --- app/src/main/res/values-en/strings.xml | 1 - 1 file changed, 1 deletion(-) delete mode 100644 app/src/main/res/values-en/strings.xml diff --git a/app/src/main/res/values-en/strings.xml b/app/src/main/res/values-en/strings.xml deleted file mode 100644 index c2d3f2bde..000000000 --- a/app/src/main/res/values-en/strings.xml +++ /dev/null @@ -1 +0,0 @@ -../values/strings.xml \ No newline at end of file From 427422a16ba3da2eb881c60a11317c81d63d60ce Mon Sep 17 00:00:00 2001 From: saechimdaeki Date: Sun, 24 Nov 2019 21:48:19 +0900 Subject: [PATCH 09/10] original size --- .../fr/gaulupeau/apps/Poche/ui/ReadArticleActivity.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/fr/gaulupeau/apps/Poche/ui/ReadArticleActivity.java b/app/src/main/java/fr/gaulupeau/apps/Poche/ui/ReadArticleActivity.java index d2e26f12b..be4954461 100644 --- a/app/src/main/java/fr/gaulupeau/apps/Poche/ui/ReadArticleActivity.java +++ b/app/src/main/java/fr/gaulupeau/apps/Poche/ui/ReadArticleActivity.java @@ -176,21 +176,17 @@ public boolean onScale(ScaleGestureDetector detector) { float scale = 1 - detector.getScaleFactor(); float prevscale = mscale; mscale += scale; - if (mscale < 0.1f) mscale = 0.1f; - if (mscale > 10f) mscale = 10f; ScaleAnimation scaleAnimation = new ScaleAnimation(1f / prevscale, 1f / mscale, 1f / prevscale, 1f / mscale, detector.getFocusX(), detector.getFocusY()); scaleAnimation.setDuration(0); - scaleAnimation.setFillAfter(true); + scaleAnimation.setFillAfter(false); scrollView.startAnimation(scaleAnimation); return true; } }); - - Intent intent = getIntent(); long articleID = intent.getLongExtra(EXTRA_ID, -1); Log.d(TAG, "onCreate() articleId: " + articleID); @@ -390,6 +386,7 @@ public boolean dispatchTouchEvent(MotionEvent ev) { super.dispatchTouchEvent(ev); mScaleDetector.onTouchEvent(ev); gestureDetector.onTouchEvent(ev); + return gestureDetector.onTouchEvent(ev); } From 115b36ab48713458a064c6454894e51360278e47 Mon Sep 17 00:00:00 2001 From: saechimdaeki Date: Sun, 24 Nov 2019 23:38:28 +0900 Subject: [PATCH 10/10] duration --- .../fr/gaulupeau/apps/Poche/ui/ReadArticleActivity.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/fr/gaulupeau/apps/Poche/ui/ReadArticleActivity.java b/app/src/main/java/fr/gaulupeau/apps/Poche/ui/ReadArticleActivity.java index be4954461..1931f2b40 100644 --- a/app/src/main/java/fr/gaulupeau/apps/Poche/ui/ReadArticleActivity.java +++ b/app/src/main/java/fr/gaulupeau/apps/Poche/ui/ReadArticleActivity.java @@ -181,9 +181,11 @@ public boolean onScale(ScaleGestureDetector detector) { if (mscale > 10f) mscale = 10f; ScaleAnimation scaleAnimation = new ScaleAnimation(1f / prevscale, 1f / mscale, 1f / prevscale, 1f / mscale, detector.getFocusX(), detector.getFocusY()); - scaleAnimation.setDuration(0); - scaleAnimation.setFillAfter(false); + scaleAnimation.setDuration(1000); + //1second after return original size scrollView.startAnimation(scaleAnimation); + + scaleAnimation.setFillAfter(false); return true; } });