Skip to content
This repository was archived by the owner on Feb 4, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions app/src/main/java/com/gsnathan/pdfviewer/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -259,10 +259,12 @@ void configurePdfViewAndLoad(PDFView.Configurator viewConfigurator) {
} else {
viewBinding.pdfView.setBackgroundColor(0xFF212121);
}
float maxZoom = (float)(prefManager.getInt("max_zoom_pref", 4) + 1);
float midZoom = Math.min(2.0f, maxZoom);
viewBinding.pdfView.useBestQuality(prefManager.getBoolean("quality_pref", false));
viewBinding.pdfView.setMinZoom(0.5f);
viewBinding.pdfView.setMidZoom(2.0f);
viewBinding.pdfView.setMaxZoom(5.0f);
viewBinding.pdfView.setMidZoom(midZoom);
viewBinding.pdfView.setMaxZoom(maxZoom);
viewConfigurator
.defaultPage(pageNumber)
.onPageChange(this::setCurrentPage)
Expand Down
15 changes: 15 additions & 0 deletions app/src/main/java/com/gsnathan/pdfviewer/SettingsActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@
import android.os.Build;
import android.os.Bundle;
import android.preference.Preference;
import android.preference.PreferenceManager;
import android.util.Log;
import android.util.TypedValue;
import android.view.MenuItem;
import android.view.View;

import androidx.appcompat.app.ActionBar;
import androidx.appcompat.widget.Toolbar;
import androidx.preference.SeekBarPreference;

import com.jaredrummler.cyanea.app.CyaneaPreferenceActivity;

Expand Down Expand Up @@ -51,6 +53,19 @@ private void setupShowInLauncherPreference() {
}
});
}

Preference seekBar = (Preference)findPreference("max_zoom_pref");
int current_value = PreferenceManager.getDefaultSharedPreferences(this).getInt("max_zoom_pref",5);
String seekBarTitle = getResources().getString(R.string.maximum_zoom) + " " + String.valueOf(++current_value);
seekBar.setTitle(seekBarTitle);
seekBar.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object o) {
final int progress = Integer.valueOf(String.valueOf(o)) + 1;
preference.setTitle(getResources().getString(R.string.maximum_zoom) + " " + progress);
return true;
}
});
}

private void setOptionsListTopMargin() {
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/java/com/gsnathan/pdfviewer/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ static void showLog(AppCompatActivity context) {
new WhatsNewItem("Full screen mode", "A new button has been added to the bottom bar to read PDFs in full screen!", R.drawable.star_icon),
new WhatsNewItem("Keep the screen on while reading", "You can enable this feature in Settings.", R.drawable.star_icon),
new WhatsNewItem("Sharing improvements and fixes", "Including better support for third-party share dialogs.", R.drawable.star_icon),
new WhatsNewItem("Bugs", "A bunch of bug fixes and robustness improvements.", R.drawable.star_icon)
new WhatsNewItem("Bugs", "A bunch of bug fixes and robustness improvements.", R.drawable.star_icon),
new WhatsNewItem("Custom maximum zoom", "You can now set the maximum zoom.", R.drawable.star_icon)
);
log.setTitleColor(Color.BLACK);
log.setTitleText(context.getResources().getString(R.string.appChangelog));
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-it/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,6 @@
<string name="wrong_password">Password errata.</string>
<string name="dark_pdf">Modalità scura per il PDF</string>
<string name="keep_screen_on">Mantieni lo schermo acceso</string>
<string name="maximum_zoom">Zoom massimo:</string>
<string name="privacy_info">Questa app non raccoglie alcun dato.\nI seguenti permessi sono richiesti per fornire specifiche funzionalità dell\'applicazione:\n- <b>Internet</b>: aprire i PDF tramite link\n- <b>Archiviazione</b>: aprire file dalla memoria interna, salvare i PDF aperti tramite link</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -121,5 +121,6 @@

<string name="dark_pdf">Dark theme for PDF</string>
<string name="keep_screen_on">Keep the screen on</string>
<string name="maximum_zoom">Maximum zoom:</string>
<string name="privacy_info">This app does not collect any data.\nThe following permissions are required to provide specific features in the app:\n- <b>Internet</b>: open PDFs through links\n- <b>Storage</b>: open files from storage, save PDFs opened through links</string>
</resources>
10 changes: 8 additions & 2 deletions app/src/main/res/xml/preferences.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">

<SwitchPreference
android:defaultValue="true"
Expand All @@ -26,6 +26,12 @@
android:defaultValue="false"
android:title="@string/keep_screen_on" android:key="screen_on_pref"/>

<SeekBarPreference
android:defaultValue="4"
android:title="@string/maximum_zoom" android:key="max_zoom_pref"
android:max="9"
app:showSeekBarValue="true"/>

</PreferenceCategory>

<PreferenceCategory
Expand Down