diff --git a/.travis.yml b/.travis.yml
index 90f1e50..95b7d11 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,28 +1,45 @@
language: android
jdk: oraclejdk8
sudo: required
-after_failure: "cat $TRAVIS_BUILD_DIR/app/build/outputs/lint-results-debug.xml"
+
notifications:
slack: pdfviewerplus:ODw20YfhNtVZkbdA4K3mVFnS
-before_install:
- - chmod +x gradlew
+env:
+ global:
+ - ANDROID_API_LEVEL=30
+ - ANDROID_BUILD_TOOLS_VERSION=29.0.2
+ - ANDROID_ABI=armeabi-v7a
android:
components:
+ - tools
- platform-tools
- tools
- - build-tools-28.0.3
- - android-21
- - android-29
- - sys-img-armeabi-v7a-android-21
- extra-android-m2repository
+ licenses:
+ - 'android-sdk-preview-license-52d11cd2'
+ - 'android-sdk-license-.+'
+ - 'google-gdk-license-.+'
+
+before_install:
+ - touch $HOME/.android/repositories.cfg
+ - yes | sdkmanager "platforms;android-30"
+ - yes | sdkmanager "build-tools;29.0.2"
+
+before_cache:
+ - rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
+ - rm -fr $HOME/.gradle/caches/*/plugin-resolution/
+
+cache:
+ directories:
+ - $HOME/.gradle/caches/
+ - $HOME/.gradle/wrapper/
+ - $HOME/.android/build-cache
before_script:
- # Create and start emulator
- - echo no | android create avd --force -n test -t android-21 --abi armeabi-v7a
- - emulator -avd test -no-skin -no-audio -no-window &
- - android-wait-for-emulator
- - adb shell input keyevent 82 &
+ - chmod +x gradlew
-script: ./gradlew connectedAndroidTest
+script:
+ - ./gradlew clean build
+ - ./gradlew test
diff --git a/README.md b/README.md
index 0388209..729eb1d 100755
--- a/README.md
+++ b/README.md
@@ -22,13 +22,14 @@
## Contribute
You can contribute to this project in many ways:
-* Fork and make pull requests
-* Help to translate the application (if so contact me --> gokulswamilive@gmail.com)
+* Fork and make pull requests (please target dev branch)
+* Help to translate the application (By making PR)
### Special Thanks!
| Github Users |
| ------------- |
+| [Fs00](https://github.com/Fs00) |
| [Etamuk](https://github.com/Etamuk) |
| [Raspbeguy](https://github.com/raspbeguy) |
| [Greynar](https://github.com/Greynar) |
diff --git a/app/build.gradle b/app/build.gradle
index 86a0333..6912554 100755
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -31,14 +31,14 @@ android {
abortOnError false
}
- buildToolsVersion "28.0.3"
- compileSdkVersion 29
+ buildToolsVersion "29.0.2"
+ compileSdkVersion 30
defaultConfig {
applicationId "com.gsnathan.pdfviewer"
minSdkVersion 21
- targetSdkVersion 29
- versionCode 24
- versionName "3.3"
+ targetSdkVersion 30
+ versionCode 25
+ versionName "3.4"
vectorDrawables.useSupportLibrary = true
javaCompileOptions {
@@ -61,17 +61,20 @@ android {
debug {
debuggable true
- useProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
+ }
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
- implementation 'androidx.appcompat:appcompat:1.1.0'
- implementation 'com.google.android.material:material:1.2.0-alpha05'
- implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
+ implementation 'androidx.appcompat:appcompat:1.2.0'
+ implementation 'com.google.android.material:material:1.3.0-beta01'
+ implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
//Intro Library
implementation 'com.github.paolorotolo:appintro:v5.1.0'
@@ -87,8 +90,8 @@ dependencies {
//Android Annotations Library (Proguard config not needed)
//compileOnly
- annotationProcessor 'org.androidannotations:androidannotations:4.5.2'
- implementation 'org.androidannotations:androidannotations-api:4.5.2'
+ annotationProcessor 'org.androidannotations:androidannotations:4.6.0'
+ implementation 'org.androidannotations:androidannotations-api:4.6.0'
//License Presenter Library (Proguard config not needed)
implementation 'com.github.franmontiel:AttributionPresenter:1.0.1'
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 5d2b2ea..1dc59ae 100755
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -19,11 +19,6 @@
-
-
-
-
-
@@ -72,12 +67,24 @@
-
+
+
+
+
+
+
+
+
+
+
+ android:theme="@style/Theme.Cyanea.Light.DarkActionBar">
1f)
hideBottomNavigationView((BottomNavigationView) findViewById(R.id.bottom_navigation));
else {
showBottomNavigationView((BottomNavigationView) findViewById(R.id.bottom_navigation));
@@ -241,11 +238,52 @@ void afterViews() {
}
setTitle(pdfFileName);
hideProgressDialog();
+ setBottomBarListeners();
handler.post(runnable);
}
+ private void setBottomBarListeners() {
+ BottomNavigationView bottomView = findViewById(R.id.bottom_navigation);
+ bottomView.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() {
+ @Override
+ public boolean onNavigationItemSelected(@NonNull MenuItem item) {
+ switch (item.getItemId()) {
+ case R.id.pickFile:
+ pickFile();
+ break;
+ case R.id.metaFile:
+ if (uri != null)
+ getMeta();
+ break;
+ case R.id.unlockFile:
+ if (uri != null)
+ unlockPDF();
+ break;
+ case R.id.shareFile:
+ if (uri != null)
+ shareFile();
+ break;
+ case R.id.printFile:
+ if (uri != null)
+ print(pdfFileName,
+ new PdfDocumentAdapter(getApplicationContext(), uri),
+ new PrintAttributes.Builder().build());
+ break;
+ default:
+ break;
+
+ }
+ return false;
+ }
+ });
+ // Workaround for https://issuetracker.google.com/issues/124153644
+ MaterialShapeDrawable viewBackground = (MaterialShapeDrawable) bottomView.getBackground();
+ viewBackground.setShadowCompatibilityMode(MaterialShapeDrawable.SHADOW_COMPAT_MODE_ALWAYS);
+ }
+
void setPdfViewConfiguration() {
pdfView.useBestQuality(prefManager.getBoolean("quality_pref", false));
+ pdfView.setMinZoom(0.5f);
pdfView.setMidZoom(2.0f);
pdfView.setMaxZoom(5.0f);
}
@@ -260,7 +298,7 @@ void setPageConfigurationAndLoad(PDFView.Configurator configurator) {
.scrollHandle(new DefaultScrollHandle(this))
.spacing(10) // in dp
.onPageError(this)
- .pageFitPolicy(FitPolicy.BOTH)
+ .pageFitPolicy(FitPolicy.WIDTH)
.password(PDF_PASSWORD)
.swipeHorizontal(prefManager.getBoolean("scroll_pref", false))
.autoSpacing(prefManager.getBoolean("scroll_pref", false))
@@ -271,10 +309,6 @@ void setPageConfigurationAndLoad(PDFView.Configurator configurator) {
void displayFromUri(Uri uri) {
pdfFileName = getFileName(uri);
- Utils.tempBool = true;
- SharedPreferences.Editor editor = prefManager.edit();
- editor.putString("uri", uri.toString());
- editor.apply();
String scheme = uri.getScheme();
if (scheme != null && scheme.contains("http")) {
@@ -333,7 +367,9 @@ String saveTempFileToFile(File tempFile) {
}
void navToSettings() {
- startActivity(Utils.navIntent(this, SettingsActivity.class));
+ Intent intent = new Intent(this, SettingsActivity.class);
+ intent.setData(uri);
+ startActivity(intent);
}
@OnActivityResult(REQUEST_CODE)
@@ -450,53 +486,8 @@ public void onPageError(int page, Throwable t) {
}
@Override
- public boolean onCreateOptionsMenu(Menu menu) {
+ public boolean onCreateOptionsMenu(@NotNull Menu menu) {
getMenuInflater().inflate(R.menu.menu, menu);
-
- BottomNavigationView bot_view = (BottomNavigationView) findViewById(R.id.bottom_navigation);
- Menu bottomMenu = bot_view.getMenu();
-
- for (int i = 0; i < bottomMenu.size() - 1; i++) {
- Drawable drawable = bottomMenu.getItem(i).getIcon();
- if (drawable != null) {
- drawable.mutate();
- drawable.setColorFilter(getResources().getColor(R.color.colorWhite), PorterDuff.Mode.SRC_ATOP);
- }
- }
- bot_view.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() {
- @Override
- public boolean onNavigationItemSelected(@NonNull MenuItem item) {
-
- switch (item.getItemId()) {
- case R.id.pickFile:
- pickFile();
- break;
- case R.id.metaFile:
- if (uri != null)
- getMeta();
- break;
- case R.id.unlockFile:
- if (uri != null)
- unlockPDF();
- break;
- case R.id.shareFile:
- if (uri != null)
- shareFile();
- break;
- case R.id.printFile:
- if (uri != null)
- print(pdfFileName,
- new PdfDocumentAdapter(getApplicationContext()),
- new PrintAttributes.Builder().build());
- break;
- default:
- break;
-
- }
-
- return false;
- }
- });
return true;
}
diff --git a/app/src/main/java/com/gsnathan/pdfviewer/PdfDocumentAdapter.java b/app/src/main/java/com/gsnathan/pdfviewer/PdfDocumentAdapter.java
index 6b2eea9..8c8c337 100644
--- a/app/src/main/java/com/gsnathan/pdfviewer/PdfDocumentAdapter.java
+++ b/app/src/main/java/com/gsnathan/pdfviewer/PdfDocumentAdapter.java
@@ -16,8 +16,11 @@
class PdfDocumentAdapter extends ThreadedPrintDocumentAdapter {
- PdfDocumentAdapter(Context ctxt) {
+ private final Uri documentUri;
+
+ PdfDocumentAdapter(Context ctxt, Uri documentUri) {
super(ctxt);
+ this.documentUri = documentUri;
}
@Override
@@ -66,7 +69,7 @@ public void run() {
}
}
- private static class PdfWriteJob extends WriteJob {
+ private class PdfWriteJob extends WriteJob {
PdfWriteJob(PageRange[] pages, ParcelFileDescriptor destination,
CancellationSignal cancellationSignal,
@@ -80,7 +83,7 @@ public void run() {
OutputStream out=null;
try {
- in= ctxt.getContentResolver().openInputStream(MainActivity.uri);
+ in= ctxt.getContentResolver().openInputStream(documentUri);
out=new FileOutputStream(destination.getFileDescriptor());
byte[] buf=new byte[16384];
diff --git a/app/src/main/java/com/gsnathan/pdfviewer/SettingsActivity.java b/app/src/main/java/com/gsnathan/pdfviewer/SettingsActivity.java
index 046ed13..41fdca7 100644
--- a/app/src/main/java/com/gsnathan/pdfviewer/SettingsActivity.java
+++ b/app/src/main/java/com/gsnathan/pdfviewer/SettingsActivity.java
@@ -1,9 +1,11 @@
package com.gsnathan.pdfviewer;
+import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.Configuration;
+import android.net.Uri;
import android.os.Bundle;
import android.preference.Preference;
import android.preference.PreferenceActivity;
@@ -15,6 +17,10 @@
import androidx.core.app.NavUtils;
+import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_DISABLED;
+import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_ENABLED;
+import static android.content.pm.PackageManager.DONT_KILL_APP;
+
/**
* A {@link PreferenceActivity} that presents a set of application settings. On
* handset devices, settings are presented as a single list. On tablets,
@@ -52,22 +58,12 @@ protected void onCreate(Bundle savedInstanceState) {
button.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
- String uriString = "";
try {
- SharedPreferences prefManager = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
- uriString = prefManager.getString("uri", "");
- Log.d("Hello", "Uri = " + uriString);
- if (uriString != null) {
- Intent intent = new Intent(getApplicationContext(), MainActivity_.class);
- intent.putExtra("uri", uriString);
- startActivity(intent);
- } else {
- Intent i = getBaseContext().getPackageManager().
- getLaunchIntentForPackage(getBaseContext().getPackageName());
- i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- startActivity(i);
- finish();
- }
+ Uri documentUri = getIntent().getData();
+ Intent intent = new Intent(SettingsActivity.this, MainActivity_.class);
+ intent.setData(documentUri);
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
+ startActivity(intent);
} catch (Exception e) {
e.printStackTrace();
}
@@ -76,6 +72,25 @@ public boolean onPreferenceClick(Preference preference) {
}
});
+ findPreference("show_in_launcher").setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
+ @Override
+ public boolean onPreferenceChange(Preference preference, Object newValue) {
+ try {
+ setLauncherAliasState((boolean) newValue);
+ return true;
+ } catch (Exception ignored) {
+ return false;
+ }
+ }
+ });
+ }
+
+ private void setLauncherAliasState(boolean enableAlias) {
+ getPackageManager().setComponentEnabledSetting(
+ new ComponentName(this, "com.gsnathan.pdfviewer.LauncherAlias"),
+ enableAlias ? COMPONENT_ENABLED_STATE_ENABLED : COMPONENT_ENABLED_STATE_DISABLED,
+ DONT_KILL_APP
+ );
}
private void setupActionBar() {
diff --git a/app/src/main/java/com/gsnathan/pdfviewer/Utils.java b/app/src/main/java/com/gsnathan/pdfviewer/Utils.java
index 5948bfa..86edc3a 100755
--- a/app/src/main/java/com/gsnathan/pdfviewer/Utils.java
+++ b/app/src/main/java/com/gsnathan/pdfviewer/Utils.java
@@ -44,24 +44,22 @@
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.ContextCompat;
+
import io.github.tonnyl.whatsnew.WhatsNew;
import io.github.tonnyl.whatsnew.item.WhatsNewItem;
public class Utils {
- public static boolean tempBool = false;
-
static void showLog(AppCompatActivity context) {
WhatsNew log = WhatsNew.newInstance(
- new WhatsNewItem("File Manager", "Enable on start of the app", R.drawable.star_icon),
- new WhatsNewItem("Zoom", "Changed from 3x to 5x", R.drawable.thumbs_icon)
+ new WhatsNewItem("Bugs", "A bunch of bug fixes.", R.drawable.star_icon)
);
- log.setTitleColor(ContextCompat.getColor(context, R.color.colorAccent));
+ log.setTitleColor(Color.BLACK);
log.setTitleText(context.getResources().getString(R.string.appChangelog));
log.setButtonText(context.getResources().getString(R.string.buttonLog));
log.setButtonBackground(ContextCompat.getColor(context, R.color.colorPrimary));
- log.setButtonTextColor(ContextCompat.getColor(context, R.color.colorAccent));
- log.setItemTitleColor(ContextCompat.getColor(context, R.color.colorAccent));
+ log.setButtonTextColor(Color.WHITE);
+ log.setItemTitleColor(Color.parseColor("#339999")); // same as icons
log.setItemContentColor(Color.parseColor("#808080"));
log.show(context.getSupportFragmentManager(), "Log");
diff --git a/app/src/main/res/layout/activity_about.xml b/app/src/main/res/layout/activity_about.xml
index 3dcfdc5..edc1ae8 100755
--- a/app/src/main/res/layout/activity_about.xml
+++ b/app/src/main/res/layout/activity_about.xml
@@ -30,22 +30,6 @@
android:layout_height="match_parent"
android:orientation="vertical">
-
-
-
-
-
-
-
+
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
- android:background="?android:attr/colorPrimary"
+ app:itemBackground="@color/cyanea_primary_reference"
android:minHeight="?android:attr/actionBarSize"
- app:itemIconTint="@color/colorWhite"
- app:itemTextColor="@color/colorWhite"
+ app:itemIconTint="?menuIconColor"
+ app:itemTextColor="?menuIconColor"
app:labelVisibilityMode="unlabeled"
app:menu="@menu/fab_menu" />
diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml
new file mode 100644
index 0000000..ba903bd
--- /dev/null
+++ b/app/src/main/res/values-pt-rBR/strings.xml
@@ -0,0 +1,114 @@
+
+
+
+ Pdf Viewer Plus
+ Selecionar arquivo
+ Não foi possível selecionar um arquivo. Verifique o status do gerenciador de arquivos.
+ Erro ao carregar a página, código do erro http:
+ Nós não podemos carregar esta página por alguma razão.
+ Falha na conexão segura.
+ Sobre
+ Versão
+ Repetir introdução
+ Gokul Swaminathan
+ E-mail
+ É claro que este app tem o código aberto. Você sempre tem o privilégio de fazer suas próprias modificações nele. O link do código fonte está na seção Sobre.
+ Liberdade
+ Pdf Viewer Plus
+ Um simples visualizador de documentos PDF
+ Licença
+ Política de privacidade
+
+
+ MIT License\n\nCopyright (©) 2018 Gokul Swaminathan\n\nPermission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+
+
+
+ Olá usuários,\n\nO Pdf Viewer Plus agora também está no F-Droid!
+
+
+ Registro de mudanças
+ Ok
+ Permissão de armazenamento
+ É claro que este app precisa de permissão para acessar o armazenamento do smartphone. Por favor, clique no botão e permita que o app leia o armazenamento interno. Sem isso, o aplicativo não vai funcionar corretamente.
+
+ Bibliotecas de código aberto
+ Github
+ Código fonte
+
+ Compartilhar arquivo
+ Imprimir arquivo
+ Notícia do desenvolvedor
+ Mudar tema
+ Informações do app
+ Informações do autor
+ Contribuidores
+
+ Seletor de temas
+
+ Temas
+ Selecione um tema pré-instalado
+
+ Cor primária
+ Exibida com mais frequência no seu aplicativo.
+
+ Cor de destaque
+ Destaca certas partes da interface.
+
+ Cor de fundo
+ A cor de fundo do conteúdo do aplicativo.
+ Aparência
+
+ Cor da barra de navegação
+ Aplicar a cor primária à barra de navegação
+ Senha
+ Desbloquear PDF seguro
+ Informações do arquivo
+ Renderização em alta qualidade
+ Configurações
+ Anti-Aliasing
+ Rolagem horizontal
+ Page Snap
+ Page Fling
+ Qualidade
+ Rolagem
+ Configurações
+ Recarregar PDF
+ Para aplicar as mudanças, o PDF deve ser recarregado.
+ Continuar
+
+
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
index 83a7fbf..47d049e 100755
--- a/app/src/main/res/values/colors.xml
+++ b/app/src/main/res/values/colors.xml
@@ -29,6 +29,7 @@
#00cc99
#ffffff
+
#2481a1
#00cc99
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index a55ee98..cead056 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -112,5 +112,6 @@
Reload PDF
In order to make changes, the PDF must be reloaded.
Continue
-
+ Show app in launcher
+ You may need to restart your launcher for this option to take effect
\ No newline at end of file
diff --git a/app/src/main/res/xml/preferences.xml b/app/src/main/res/xml/preferences.xml
index 6aef2f5..761a253 100644
--- a/app/src/main/res/xml/preferences.xml
+++ b/app/src/main/res/xml/preferences.xml
@@ -2,6 +2,11 @@
+
+
diff --git a/build.gradle b/build.gradle
index 63d7860..8ae5a20 100755
--- a/build.gradle
+++ b/build.gradle
@@ -32,7 +32,7 @@ buildscript {
maven { url "https://maven.google.com" }
}
dependencies {
- classpath 'com.android.tools.build:gradle:3.6.0'
+ classpath 'com.android.tools.build:gradle:4.1.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 0b7a0ce..ea0f040 100755
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
-#Sun Mar 01 16:36:51 CET 2020
+#Sun Dec 20 10:40:56 PST 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip