mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-23 04:33:54 -04:00
Merge branch 'master' into custom_app
This commit is contained in:
commit
e2f0da2208
@ -16,19 +16,15 @@
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
||||
|
||||
|
||||
<uses-sdk
|
||||
android:minSdkVersion="9"
|
||||
android:targetSdkVersion="21"/>
|
||||
<application
|
||||
android:icon="@drawable/kiwix_icon"
|
||||
android:label="@string/app_name"
|
||||
android:allowBackup="true"
|
||||
android:hardwareAccelerated="true">
|
||||
android:hardwareAccelerated="true"
|
||||
android:theme="@style/AppStyle">
|
||||
<activity
|
||||
android:name=".KiwixMobileActivity"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/AppStyle"
|
||||
android:configChanges="orientation|keyboardHidden|screenSize|locale">
|
||||
|
||||
<intent-filter>
|
||||
@ -90,23 +86,10 @@
|
||||
</intent-filter>
|
||||
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".settings.KiwixSettingsActivityGB"
|
||||
android:theme="@style/AppStyle"/>
|
||||
<activity android:name=".settings.KiwixSettingsActivityHC"/>
|
||||
<activity
|
||||
android:name=".LibraryActivity"
|
||||
android:theme="@style/AppStyle"/>
|
||||
|
||||
<provider
|
||||
android:name=".ZimContentProvider"
|
||||
android:authorities="org.kiwix.zim.base"
|
||||
android:exported="true"/>
|
||||
|
||||
<activity
|
||||
android:name=".ZimFileSelectActivity"
|
||||
android:icon="@drawable/kiwix_icon"
|
||||
android:theme="@style/AppStyle"
|
||||
android:label="@string/choose_file">
|
||||
<!-- TODO -->
|
||||
<intent-filter>
|
||||
@ -118,5 +101,13 @@
|
||||
<data android:mimeType="*/*"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity android:name=".settings.KiwixSettingsActivity"/>
|
||||
|
||||
<provider
|
||||
android:name=".ZimContentProvider"
|
||||
android:authorities="org.kiwix.zim.base"
|
||||
android:exported="true"/>
|
||||
|
||||
</application>
|
||||
</manifest>
|
||||
|
@ -6,9 +6,11 @@ buildscript {
|
||||
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:1.2+'
|
||||
classpath 'com.jakewharton.sdkmanager:gradle-plugin:0.12.+'
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: 'android-sdk-manager'
|
||||
apply plugin: 'com.android.application'
|
||||
|
||||
repositories {
|
||||
@ -16,8 +18,8 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile 'com.android.support:support-v4:21.0.3'
|
||||
compile 'com.actionbarsherlock:actionbarsherlock:4.4.0@aar'
|
||||
compile 'com.android.support:appcompat-v7:22.2.0'
|
||||
compile 'com.android.support:support-v4:22.2.0'
|
||||
compile files("$buildDir/native-libs/native-libs.jar")
|
||||
|
||||
}
|
||||
@ -27,7 +29,7 @@ android {
|
||||
buildToolsVersion "21.1.2"
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 9
|
||||
minSdkVersion 14
|
||||
targetSdkVersion 21
|
||||
}
|
||||
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 1.6 KiB |
Binary file not shown.
Before Width: | Height: | Size: 1.3 KiB |
Binary file not shown.
Before Width: | Height: | Size: 1.8 KiB |
@ -27,7 +27,6 @@
|
||||
android:imeOptions="actionGo|flagNoExtractUi"
|
||||
android:inputType="text|textCapWords"
|
||||
android:maxLines="1"
|
||||
android:background="@android:color/background_dark"
|
||||
android:textColor="@android:color/white"
|
||||
android:selectAllOnFocus="true"/>
|
||||
|
||||
|
26
res/layout/slider_preference_dialog.xml
Normal file
26
res/layout/slider_preference_dialog.xml
Normal file
@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/slider_preference_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:paddingTop="8dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/message"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"/>
|
||||
|
||||
<SeekBar
|
||||
android:id="@+id/slider_preference_seekbar"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="12dp"
|
||||
android:paddingTop="12dp"/>
|
||||
|
||||
</LinearLayout>
|
@ -1,11 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_rescan_fs"
|
||||
android:icon="@drawable/action_refresh"
|
||||
android:title="@string/menu_rescan_fs"
|
||||
android:showAsAction="always"/>
|
||||
app:showAsAction="always"/>
|
||||
|
||||
</menu>
|
@ -1,94 +1,95 @@
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_search"
|
||||
android:icon="@drawable/action_search"
|
||||
android:title="@string/menu_search"
|
||||
android:visible="false"
|
||||
android:showAsAction="ifRoom"/>
|
||||
app:showAsAction="ifRoom"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_back"
|
||||
android:title="@string/menu_back"
|
||||
android:icon="@drawable/navigation_back"
|
||||
android:visible="false"
|
||||
android:showAsAction="ifRoom"/>
|
||||
app:showAsAction="ifRoom"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_bookmarks"
|
||||
android:icon="@drawable/action_bookmarks"
|
||||
android:showAsAction="always"
|
||||
android:title="@string/menu_bookmarks"
|
||||
android:visible="false"/>
|
||||
android:visible="false"
|
||||
app:showAsAction="always"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_randomarticle"
|
||||
android:icon="@drawable/action_randomarticle"
|
||||
android:title="@string/menu_randomarticle"
|
||||
android:visible="false"
|
||||
android:showAsAction="ifRoom"/>
|
||||
app:showAsAction="ifRoom"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_home"
|
||||
android:title="@string/menu_home"
|
||||
android:icon="@drawable/action_home"
|
||||
android:visible="false"
|
||||
android:showAsAction="ifRoom"/>
|
||||
app:showAsAction="ifRoom"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_openfile"
|
||||
android:title="@string/menu_openfile"
|
||||
android:icon="@drawable/device_access_sd_storage"
|
||||
android:showAsAction="ifRoom"/>
|
||||
app:showAsAction="ifRoom"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_forward"
|
||||
android:title="@string/menu_forward"
|
||||
android:icon="@drawable/navigation_forward"
|
||||
android:visible="false"
|
||||
android:showAsAction="never"/>
|
||||
app:showAsAction="never"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_searchintext"
|
||||
android:icon="@drawable/action_search"
|
||||
android:title="@string/menu_searchintext"
|
||||
android:visible="false"
|
||||
android:showAsAction="never"/>
|
||||
app:showAsAction="never"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_fullscreen"
|
||||
android:icon="@drawable/action_search"
|
||||
android:title="@string/menu_fullscreen"
|
||||
android:visible="false"
|
||||
android:showAsAction="never"/>
|
||||
app:showAsAction="never"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_read_aloud"
|
||||
android:title="@string/menu_read_aloud"
|
||||
android:visible="false"
|
||||
android:showAsAction="never"/>
|
||||
app:showAsAction="never"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_settings"
|
||||
android:title="@string/menu_settings"
|
||||
android:icon="@drawable/navigation_forward"
|
||||
android:showAsAction="never"/>
|
||||
app:showAsAction="never"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_help"
|
||||
android:title="@string/menu_help"
|
||||
android:icon="@drawable/action_help"
|
||||
android:showAsAction="never"/>
|
||||
app:showAsAction="never"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_share"
|
||||
android:title="@string/menu_share"
|
||||
android:icon="@drawable/action_share"
|
||||
android:showAsAction="ifRoom"/>
|
||||
app:showAsAction="ifRoom"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_exit"
|
||||
android:title="@string/menu_exit"
|
||||
android:showAsAction="never"/>
|
||||
app:showAsAction="never"/>
|
||||
|
||||
</menu>
|
||||
|
@ -14,14 +14,15 @@
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<item
|
||||
android:id="@+id/find_prev"
|
||||
android:icon="@drawable/ic_find_previous_holo_dark"
|
||||
android:showAsAction="always"/>
|
||||
app:showAsAction="always"/>
|
||||
<item
|
||||
android:id="@+id/find_next"
|
||||
android:icon="@drawable/ic_find_next_holo_dark"
|
||||
android:showAsAction="always"/>
|
||||
app:showAsAction="always"/>
|
||||
</menu>
|
||||
|
@ -1,47 +1,63 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>Kiwix Hilfe</title>
|
||||
<meta charset="UTF-8"/>
|
||||
<title>Kiwix Hilfe</title>
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link href="file:///android_asset/www/bootstrap/css/bootstrap.css" rel="stylesheet">
|
||||
<link href="file:///android_asset/www/bootstrap/css/bootstrap-responsive.css" rel="stylesheet">
|
||||
<link href="file:///android_asset/www/static.css" rel="stylesheet">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link href="file:///android_asset/www/bootstrap/css/bootstrap.css" rel="stylesheet">
|
||||
<link href="file:///android_asset/www/bootstrap/css/bootstrap-responsive.css" rel="stylesheet">
|
||||
<link href="file:///android_asset/www/static.css" rel="stylesheet">
|
||||
</head>
|
||||
|
||||
<body class="help" lang="de-DE">
|
||||
|
||||
<div id="content-wrapper">
|
||||
|
||||
<section id="what-does-kiwix-do">
|
||||
<h2>Was macht Kiwix?</h2>
|
||||
<p><em>Kiwix</em> ist zum Lesen von Offline-Inhalten. Es ähnelt sehr stark einem Browser. Statt eine Seite über die Internetverbindung zu laden liest es Inhalte aus einer vorher heruntergeladenen oder kopierten Datei im <em>ZIM-Format</em>.</p>
|
||||
<p>Es wurde ursprünglich entwickelt, um die Wikipedia offline zu verwenden, kann aber inzwischen auch andere Inhalte lesen.</p>
|
||||
</section>
|
||||
<section id="what-does-kiwix-do">
|
||||
<h2>Was macht Kiwix?</h2>
|
||||
|
||||
<section id="where-do-i-find-content">
|
||||
<h2>Wo finde ich die Inhalte?</h2>
|
||||
<p>Inhalte gibt es auf der <a href="http://www.kiwix.org/m/">Kiwix-Website</a>.</p>
|
||||
<p>Sie sind als ZIM-Dateien erhältlich. Es gibt <strong>viele</strong> verschiedene:</p>
|
||||
<ul>
|
||||
<li>Die Wikipedia ist in jeder Sprache erhältlich</li>
|
||||
<li>Andere Inhalte, wie Wikileaks oder Wikisource, sind ebenfalls verfügbar.</li>
|
||||
</ul>
|
||||
<p>Überleg dir, welche Inhalte du verwenden möchtest, und starte den Download. Speichere die Datei auf die Speicherkarte und öffne sie in Kiwix.</p>
|
||||
<p>Abhängig von der Internetverbindung auf deinem Mobilgerät ist es empfehlenswert grössere Dateien mit einem PC herunterzuladen, und die Datei danach auf die Speicherkarte zu kopieren.</p>
|
||||
<p>ZIM-Dateien der gesamten Wikipedia, sind zum Beispiel <strong>mehrere Gigabyte</strong> gross.</p>
|
||||
<p><em>Kiwix</em> ist zum Lesen von Offline-Inhalten. Es ähnelt sehr stark einem Browser.
|
||||
Statt eine Seite über die Internetverbindung zu laden liest es Inhalte aus einer vorher
|
||||
heruntergeladenen oder kopierten Datei im <em>ZIM-Format</em>.</p>
|
||||
|
||||
</section>
|
||||
<p>Es wurde ursprünglich entwickelt, um die Wikipedia offline zu verwenden, kann aber
|
||||
inzwischen auch andere Inhalte lesen.</p>
|
||||
</section>
|
||||
|
||||
<section id="intro">
|
||||
<h1>Danke, dass du Kiwix gewählt hast!</h1>
|
||||
<p>Wir freuen uns, dass wir dich als Kiwixnutzer begrüssen dürfen. Wir unterstützen dich gern, damit du unser Programm bestmöglichst nutzen kannst.</p>
|
||||
<p>Bitte gib uns Rückmeldung auf <a href="http://kiwix.org">kiwix.org</a>.</p>
|
||||
</section>
|
||||
<section id="where-do-i-find-content">
|
||||
<h2>Wo finde ich die Inhalte?</h2>
|
||||
|
||||
<p>Inhalte gibt es auf der <a href="http://www.kiwix.org/m/">Kiwix-Website</a>.</p>
|
||||
|
||||
<p>Sie sind als ZIM-Dateien erhältlich. Es gibt <strong>viele</strong> verschiedene:</p>
|
||||
<ul>
|
||||
<li>Die Wikipedia ist in jeder Sprache erhältlich</li>
|
||||
<li>Andere Inhalte, wie Wikileaks oder Wikisource, sind ebenfalls verfügbar.</li>
|
||||
</ul>
|
||||
<p>Überleg dir, welche Inhalte du verwenden möchtest, und starte den Download. Speichere die
|
||||
Datei auf die Speicherkarte und öffne sie in Kiwix.</p>
|
||||
|
||||
<p>Abhängig von der Internetverbindung auf deinem Mobilgerät ist es empfehlenswert grössere
|
||||
Dateien mit einem PC herunterzuladen, und die Datei danach auf die Speicherkarte zu
|
||||
kopieren.</p>
|
||||
|
||||
<p>ZIM-Dateien der gesamten Wikipedia, sind zum Beispiel <strong>mehrere Gigabyte</strong>
|
||||
gross.</p>
|
||||
|
||||
</section>
|
||||
|
||||
<section id="intro">
|
||||
<h1>Danke, dass du Kiwix gewählt hast!</h1>
|
||||
|
||||
<p>Wir freuen uns, dass wir dich als Kiwixnutzer begrüssen dürfen. Wir unterstützen dich
|
||||
gern, damit du unser Programm bestmöglichst nutzen kannst.</p>
|
||||
|
||||
<p>Bitte gib uns Rückmeldung auf <a href="http://kiwix.org">kiwix.org</a>.</p>
|
||||
</section>
|
||||
|
||||
|
||||
<!-- Invalid zim removed here, check final english version if it should be added again -->
|
||||
<!-- Invalid zim removed here, check final english version if it should be added again -->
|
||||
|
||||
</div>
|
||||
|
||||
|
@ -1,40 +1,59 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>Wilkommen zu Kiwix!</title>
|
||||
<meta charset="UTF-8"/>
|
||||
<title>Wilkommen zu Kiwix!</title>
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link href="file:///android_asset/www/bootstrap/css/bootstrap.css" rel="stylesheet">
|
||||
<link href="file:///android_asset/www/bootstrap/css/bootstrap-responsive.css" rel="stylesheet">
|
||||
<link href="file:///android_asset/www/static.css" rel="stylesheet">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link href="file:///android_asset/www/bootstrap/css/bootstrap.css" rel="stylesheet">
|
||||
<link href="file:///android_asset/www/bootstrap/css/bootstrap-responsive.css" rel="stylesheet">
|
||||
<link href="file:///android_asset/www/static.css" rel="stylesheet">
|
||||
</head>
|
||||
|
||||
<body class="welcome" lang="de">
|
||||
|
||||
<div id="content-wrapper">
|
||||
|
||||
<section id="step1">
|
||||
<h2><span>1.</span> Inhalte runterladen</h2>
|
||||
<p><strong>Kiwix</strong> ist ein Leseprogramm für Offline-Inhalte, das perfekt auf die Wikipedia zugeschnitten ist. Nach nur <strong>2 Schritten</strong> kannst du Kiwix genießen.</p>
|
||||
<p>Probier doch unsere Wikipedia-Demo-Datei aus!</p>
|
||||
<a class="button" href="http://download.kiwix.org/zim/wikipedia_en_ray_charles.zim">Ray-Charles-Demo.zim</a>
|
||||
<p>Das ist eine 2MB-ZIM-Datei mit Artikeln über <em>Ray Charles</em> aus der englischen Wikipedia.</p>
|
||||
<p>Offline Inhalte sind auf <a href="http://www.kiwix.org/m/">kiwix.org</a> zu Verfügung.</p>
|
||||
<div class="alert alert-info"><strong>Beachte!</strong> Der Download wird in deinem Browser durchgeführt. Denk daran, wieder zu Kiwix zurück zu kommen, sobald der Download fertig ist!</div>
|
||||
</section>
|
||||
<section id="step1">
|
||||
<h2><span>1.</span> Inhalte runterladen</h2>
|
||||
|
||||
<section id="step2">
|
||||
<h2><span>2.</span> Mach eine Kaffee-Pause!</h2>
|
||||
<img src="coffee.png">
|
||||
<p>Downloads können lang dauern, mach inzwischen etwas anderes, und komm zurück sobald der Download fertig bist.</p>
|
||||
</section>
|
||||
<p><strong>Kiwix</strong> ist ein Leseprogramm für Offline-Inhalte, das perfekt auf die
|
||||
Wikipedia zugeschnitten ist. Nach nur <strong>2 Schritten</strong> kannst du Kiwix
|
||||
genießen.</p>
|
||||
|
||||
<section id="step3">
|
||||
<h2><span>3.</span> Öffne die Datei in Kiwix!</h2>
|
||||
<p>Klicke <span><a href="content://org.kiwix.ui/selectzimfile">Datei öffnen</a></span> im Menu oben, und wähle dann die ZIM-Datei die du runtergeladen hast aus. <strong>Das war's schon!</strong></p>
|
||||
<p>Genieße jetzt die Inhalte, und sobald dir langweilig wird schau auf auf <a href="content://org.kiwix.ui/gotohelp">Hilfe</a>.</p>
|
||||
</section>
|
||||
<p>Probier doch unsere Wikipedia-Demo-Datei aus!</p>
|
||||
<a class="button" href="http://download.kiwix.org/zim/wikipedia_en_ray_charles.zim">Ray-Charles-Demo.zim</a>
|
||||
|
||||
<p>Das ist eine 2MB-ZIM-Datei mit Artikeln über <em>Ray Charles</em> aus der englischen
|
||||
Wikipedia.</p>
|
||||
|
||||
<p>Offline Inhalte sind auf <a href="http://www.kiwix.org/m/">kiwix.org</a> zu Verfügung.
|
||||
</p>
|
||||
|
||||
<div class="alert alert-info"><strong>Beachte!</strong> Der Download wird in deinem Browser
|
||||
durchgeführt. Denk daran, wieder zu Kiwix zurück zu kommen, sobald der Download fertig
|
||||
ist!
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section id="step2">
|
||||
<h2><span>2.</span> Mach eine Kaffee-Pause!</h2>
|
||||
<img src="coffee.png">
|
||||
|
||||
<p>Downloads können lang dauern, mach inzwischen etwas anderes, und komm zurück sobald der
|
||||
Download fertig bist.</p>
|
||||
</section>
|
||||
|
||||
<section id="step3">
|
||||
<h2><span>3.</span> Öffne die Datei in Kiwix!</h2>
|
||||
|
||||
<p>Klicke <span><a href="content://org.kiwix.ui/selectzimfile">Datei öffnen</a></span> im
|
||||
Menu oben, und wähle dann die ZIM-Datei die du runtergeladen hast aus. <strong>Das war's
|
||||
schon!</strong></p>
|
||||
|
||||
<p>Genieße jetzt die Inhalte, und sobald dir langweilig wird schau auf auf <a
|
||||
href="content://org.kiwix.ui/gotohelp">Hilfe</a>.</p>
|
||||
</section>
|
||||
|
||||
</div>
|
||||
|
||||
|
@ -1,54 +1,82 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>Aide Kiwix</title>
|
||||
<meta charset="UTF-8"/>
|
||||
<title>Aide Kiwix</title>
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link href="file:///android_asset/www/bootstrap/css/bootstrap.css" rel="stylesheet">
|
||||
<link href="file:///android_asset/www/bootstrap/css/bootstrap-responsive.css" rel="stylesheet">
|
||||
<link href="file:///android_asset/www/static.css" rel="stylesheet">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link href="file:///android_asset/www/bootstrap/css/bootstrap.css" rel="stylesheet">
|
||||
<link href="file:///android_asset/www/bootstrap/css/bootstrap-responsive.css" rel="stylesheet">
|
||||
<link href="file:///android_asset/www/static.css" rel="stylesheet">
|
||||
</head>
|
||||
|
||||
<body class="help" lang="fr-FR">
|
||||
|
||||
<div id="content-wrapper">
|
||||
|
||||
<section id="intro">
|
||||
<h1>Merci d'avoir choisi Kiwix !</h1>
|
||||
<p>Nous sommes très heureux de vous savoir utilisateur de Kiwix et voulons vous assurer de notre volonté d'assistance dans l'utilisation de cette <em>App</em>.</p>
|
||||
<p>N'hésitez pas à nous laisser un mot via <a href="mailto:contact@kiwix.org">contact@kiwix.org</a>.</p>
|
||||
</section>
|
||||
<section id="intro">
|
||||
<h1>Merci d'avoir choisi Kiwix !</h1>
|
||||
|
||||
<section id="what-does-kiwix-do">
|
||||
<h2>À quoi sert Kiwix ?</h2>
|
||||
<p><em>Kiwix</em> est un lecteur de contenu hors-ligne. Il se comporte comme un navigateur Web mais au lieu d'accéder à des <em>pages web en ligne</em>, il lit des contenu depuis un fichier nommé <em>fichier ZIM</em>.</p>
|
||||
<p>Bien que destiné originellement à diffuser Wikipédia hors-ligne, il lit aussi de nombreux autres contenus.</p>
|
||||
</section>
|
||||
<p>Nous sommes très heureux de vous savoir utilisateur de Kiwix et voulons vous assurer de
|
||||
notre volonté d'assistance dans l'utilisation de cette <em>App</em>.</p>
|
||||
|
||||
<section id="where-do-i-find-content">
|
||||
<h2>Où trouver des contenus ?</h2>
|
||||
<p>Les contenus sont accessible depuis <a href="http://kiwix.org/m/">le site web de Kiwix</a>.</p>
|
||||
<p>Ils sont disponibles sous la forme de fichiers ZIM. Il en existe <strong>un très grand nombre</strong>:</p>
|
||||
<ul>
|
||||
<li>Wikipédia est disponible indépendamment dans de nombreuses langues.</li>
|
||||
<li>D'autres contenus comme Wikileaks ou WikiSource sont aussi disponible.</li>
|
||||
</ul>
|
||||
<p>Sélectionnez soigneusement celui ou ceux qui vous intéressent et lancez le téléchargement. Déposez les fichiers téléchargés sur votre carte SD puis ouvrez les avec Kiwix.</p>
|
||||
<p>En fonction des contenus voulus et de votre connexion Internet, il peut être préférable de télécharger les fichiers depuis un ordinateur et de les transférer ensuite sur la carte SD.</p>
|
||||
</section>
|
||||
<p>N'hésitez pas à nous laisser un mot via <a href="mailto:contact@kiwix.org">contact@kiwix.org</a>.
|
||||
</p>
|
||||
</section>
|
||||
|
||||
<section id="large-zim">
|
||||
<h2>Comment utiliser de très gros fichiers ZIM ?</h2>
|
||||
<p>Si votre fichier ZIM pèse plus de 4Gio, vous pourriez avoir des difficultés à le stocker sur votre carte SD (limitations du système de fichiers).</p>
|
||||
<p>Si vous souhaitez utiliser un fichier ZIM de plus de 4Gio, il faut le découper en utilisant l'un de ces logiciels:</p>
|
||||
<ul>
|
||||
<li> Pour Microsoft Windows: <a rel="nofollow" class="external text" href="http://www.jaist.ac.jp/~hoangle/filesj/">FSJ-Lite</a></li>
|
||||
<li> Pour Apple Mac OSX: <a rel="nofollow" class="external text" href="http://loekjehe.home.xs4all.nl/Split&Concat/">Split&Concat</a></li>
|
||||
<li> Pour GNU/Linux, dans le terminal : <code>split --bytes=4000M my_big_file.zim</code></li>
|
||||
</ul>
|
||||
<p><strong>Note:</strong> les fichiers ainsi créés doivent être nommés <code>my_big_file.zimaa</code>, <code>my_big_file.zimab</code>, etc.</p>
|
||||
</section>
|
||||
<section id="what-does-kiwix-do">
|
||||
<h2>À quoi sert Kiwix ?</h2>
|
||||
|
||||
<p><em>Kiwix</em> est un lecteur de contenu hors-ligne. Il se comporte comme un navigateur
|
||||
Web mais au lieu d'accéder à des <em>pages web en ligne</em>, il lit des contenu depuis
|
||||
un fichier nommé <em>fichier ZIM</em>.</p>
|
||||
|
||||
<p>Bien que destiné originellement à diffuser Wikipédia hors-ligne, il lit aussi de nombreux
|
||||
autres contenus.</p>
|
||||
</section>
|
||||
|
||||
<section id="where-do-i-find-content">
|
||||
<h2>Où trouver des contenus ?</h2>
|
||||
|
||||
<p>Les contenus sont accessible depuis <a href="http://kiwix.org/m/">le site web de
|
||||
Kiwix</a>.</p>
|
||||
|
||||
<p>Ils sont disponibles sous la forme de fichiers ZIM. Il en existe <strong>un très grand
|
||||
nombre</strong>:</p>
|
||||
<ul>
|
||||
<li>Wikipédia est disponible indépendamment dans de nombreuses langues.</li>
|
||||
<li>D'autres contenus comme Wikileaks ou WikiSource sont aussi disponible.</li>
|
||||
</ul>
|
||||
<p>Sélectionnez soigneusement celui ou ceux qui vous intéressent et lancez le
|
||||
téléchargement. Déposez les fichiers téléchargés sur votre carte SD puis ouvrez les avec
|
||||
Kiwix.</p>
|
||||
|
||||
<p>En fonction des contenus voulus et de votre connexion Internet, il peut être préférable
|
||||
de télécharger les fichiers depuis un ordinateur et de les transférer ensuite sur la
|
||||
carte SD.</p>
|
||||
</section>
|
||||
|
||||
<section id="large-zim">
|
||||
<h2>Comment utiliser de très gros fichiers ZIM ?</h2>
|
||||
|
||||
<p>Si votre fichier ZIM pèse plus de 4Gio, vous pourriez avoir des difficultés à le stocker
|
||||
sur votre carte SD (limitations du système de fichiers).</p>
|
||||
|
||||
<p>Si vous souhaitez utiliser un fichier ZIM de plus de 4Gio, il faut le découper en
|
||||
utilisant l'un de ces logiciels:</p>
|
||||
<ul>
|
||||
<li> Pour Microsoft Windows: <a rel="nofollow" class="external text"
|
||||
href="http://www.jaist.ac.jp/~hoangle/filesj/">FSJ-Lite</a>
|
||||
</li>
|
||||
<li> Pour Apple Mac OSX: <a rel="nofollow" class="external text"
|
||||
href="http://loekjehe.home.xs4all.nl/Split&Concat/">Split&Concat</a>
|
||||
</li>
|
||||
<li> Pour GNU/Linux, dans le terminal : <code>split --bytes=4000M my_big_file.zim</code>
|
||||
</li>
|
||||
</ul>
|
||||
<p><strong>Note:</strong> les fichiers ainsi créés doivent être nommés <code>my_big_file.zimaa</code>,
|
||||
<code>my_big_file.zimab</code>, etc.</p>
|
||||
</section>
|
||||
|
||||
</div>
|
||||
|
||||
|
@ -1,41 +1,58 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>Bienvenue sur Kiwix!</title>
|
||||
<meta charset="UTF-8"/>
|
||||
<title>Bienvenue sur Kiwix!</title>
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link href="file:///android_asset/www/bootstrap/css/bootstrap.css" rel="stylesheet">
|
||||
<link href="file:///android_asset/www/bootstrap/css/bootstrap-responsive.css" rel="stylesheet">
|
||||
<link href="file:///android_asset/www/static.css" rel="stylesheet">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link href="file:///android_asset/www/bootstrap/css/bootstrap.css" rel="stylesheet">
|
||||
<link href="file:///android_asset/www/bootstrap/css/bootstrap-responsive.css" rel="stylesheet">
|
||||
<link href="file:///android_asset/www/static.css" rel="stylesheet">
|
||||
</head>
|
||||
|
||||
<body class="welcome" lang="en-US">
|
||||
|
||||
<div id="content-wrapper">
|
||||
|
||||
<section id="step1">
|
||||
<h2><span>1.</span> Télécharger un contenu</h2>
|
||||
<p><strong>Kiwix</strong> est un lecteur de contenus hors-ligne, parfaitement adpaté à Wikipédia. Profiter de Kiwix ne nécessite que <strong>2 petites étapes</strong>.</p>
|
||||
<section id="step1">
|
||||
<h2><span>1.</span> Télécharger un contenu</h2>
|
||||
|
||||
<p>Pourquoi ne pas commencer par Ray Charles ?</p>
|
||||
<a class="button" href="http://download.kiwix.org/zim/wikipedia_en_ray_charles.zim">Ray-Charles-Demo.zim</a>
|
||||
<p>C'est un petit fichier ZIM de 2Mio contenant des articles de Wikipedia (en anglais) sur le chanteur <em>Ray Charles</em>.</p>
|
||||
<p>Ce n'est qu'un exemple! Consultez <a href="http://www.kiwix.org/m/">kiwix.org</a> et l'<a href="content://org.kiwix.ui/gotohelp">Aide</a> pour télécharger d'autres contenus comme Wikipédia par exemple.</p>
|
||||
<div class="alert alert-info"><strong>Attention !</strong> Ce téléchargement aura lieu dans votre navigateur. N'oubliez pas de revenir une fois le téléchargement terminé.</div>
|
||||
</section>
|
||||
<p><strong>Kiwix</strong> est un lecteur de contenus hors-ligne, parfaitement adpaté à
|
||||
Wikipédia. Profiter de Kiwix ne nécessite que <strong>2 petites étapes</strong>.</p>
|
||||
|
||||
<section id="step2">
|
||||
<h2><span>2.</span> Faîtes une pause !</h2>
|
||||
<img src="coffee.png">
|
||||
<p>Les téléchargements peuvent être très long ; profitez en pour vaquer à vos occupations habituelles et revenez une fois le fichier ZIM sur votre carte SD.</p>
|
||||
</section>
|
||||
<p>Pourquoi ne pas commencer par Ray Charles ?</p>
|
||||
<a class="button" href="http://download.kiwix.org/zim/wikipedia_en_ray_charles.zim">Ray-Charles-Demo.zim</a>
|
||||
|
||||
<section id="step3">
|
||||
<h2><span>3.</span> Ouvrez le fichier ZIM !</h2>
|
||||
<p>Cliquez sur le bouton <span><a href="content://org.kiwix.ui/selectzimfile">Charger un fichier</a></span> du menu de la barre d'outils en haut et choisissez le fichier ZIM que vous avez téléchargé. <strong>C'est tout !</strong></p>
|
||||
<p>Maintenant, profitez de votre contenu et jetez un œil à l'<a href="content://org.kiwix.ui/gotohelp">Aide</a> à l'occasion.</p>
|
||||
</section>
|
||||
<p>C'est un petit fichier ZIM de 2Mio contenant des articles de Wikipedia (en anglais) sur
|
||||
le chanteur <em>Ray Charles</em>.</p>
|
||||
|
||||
<p>Ce n'est qu'un exemple! Consultez <a href="http://www.kiwix.org/m/">kiwix.org</a> et l'<a
|
||||
href="content://org.kiwix.ui/gotohelp">Aide</a> pour télécharger d'autres contenus
|
||||
comme Wikipédia par exemple.</p>
|
||||
|
||||
<div class="alert alert-info"><strong>Attention !</strong> Ce téléchargement aura lieu dans
|
||||
votre navigateur. N'oubliez pas de revenir une fois le téléchargement terminé.
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section id="step2">
|
||||
<h2><span>2.</span> Faîtes une pause !</h2>
|
||||
<img src="coffee.png">
|
||||
|
||||
<p>Les téléchargements peuvent être très long ; profitez en pour vaquer à vos occupations
|
||||
habituelles et revenez une fois le fichier ZIM sur votre carte SD.</p>
|
||||
</section>
|
||||
|
||||
<section id="step3">
|
||||
<h2><span>3.</span> Ouvrez le fichier ZIM !</h2>
|
||||
|
||||
<p>Cliquez sur le bouton <span><a href="content://org.kiwix.ui/selectzimfile">Charger un
|
||||
fichier</a></span> du menu de la barre d'outils en haut et choisissez le fichier ZIM que
|
||||
vous avez téléchargé. <strong>C'est tout !</strong></p>
|
||||
|
||||
<p>Maintenant, profitez de votre contenu et jetez un œil à l'<a
|
||||
href="content://org.kiwix.ui/gotohelp">Aide</a> à l'occasion.</p>
|
||||
</section>
|
||||
|
||||
</div>
|
||||
|
||||
|
@ -1,54 +1,76 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>Kiwix Help</title>
|
||||
<meta charset="UTF-8"/>
|
||||
<title>Kiwix Help</title>
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link href="file:///android_asset/www/bootstrap/css/bootstrap.css" rel="stylesheet">
|
||||
<link href="file:///android_asset/www/bootstrap/css/bootstrap-responsive.css" rel="stylesheet">
|
||||
<link href="file:///android_asset/www/static.css" rel="stylesheet">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link href="file:///android_asset/www/bootstrap/css/bootstrap.css" rel="stylesheet">
|
||||
<link href="file:///android_asset/www/bootstrap/css/bootstrap-responsive.css" rel="stylesheet">
|
||||
<link href="file:///android_asset/www/static.css" rel="stylesheet">
|
||||
</head>
|
||||
|
||||
<body class="help" lang="en-US">
|
||||
|
||||
<div id="content-wrapper">
|
||||
|
||||
<section id="what-does-kiwix-do">
|
||||
<h2>What does Kiwix do?</h2>
|
||||
<p><em>Kiwix</em> is an offline content reader. It acts very much like a browser but instead of accessing <em>online web pages</em>, it reads content from a file in <em>ZIM format</em>.</p>
|
||||
<p>While Kiwix has been originaly designed to provide Wikipedia offline, it also reads other contents.</p>
|
||||
</section>
|
||||
<section id="what-does-kiwix-do">
|
||||
<h2>What does Kiwix do?</h2>
|
||||
|
||||
<section id="where-do-i-find-content">
|
||||
<h2>Where is the content?</h2>
|
||||
<p>The contents are located on the <a href="http://kiwix.org/m/">kiwix website</a>.</p>
|
||||
<p>They are available as ZIM files. There are <strong>a lot</strong> of them:</p>
|
||||
<ul>
|
||||
<li>Wikipedia is available separately for each language</li>
|
||||
<li>Other contents like Wikileaks or Wikisource are also available</li>
|
||||
</ul>
|
||||
<p>Carefuly select the one(s) you want and launch the download. Put the resulting files on your SD card then open them with Kiwix.</p>
|
||||
<p>Depending on the content and your Internet connection on this device, it might be preferable to download from a Desktop computer and transfer to your SD card.</p>
|
||||
</section>
|
||||
<p><em>Kiwix</em> is an offline content reader. It acts very much like a browser but instead
|
||||
of accessing <em>online web pages</em>, it reads content from a file in <em>ZIM
|
||||
format</em>.</p>
|
||||
|
||||
<section id="large-zim">
|
||||
<h2>How to use large ZIM files?</h2>
|
||||
<p>If your ZIM file weighs more than 4GB, you might not be able to store it on your SD card due to filesystem limitations.</p>
|
||||
<p>In this case, please split it using one of the following software:</p>
|
||||
<ul>
|
||||
<li> On Microsoft Windows: <a rel="nofollow" class="external text" href="http://www.jaist.ac.jp/~hoangle/filesj/">FSJ-Lite</a></li>
|
||||
<li> On Apple Mac OSX: <a rel="nofollow" class="external text" href="http://loekjehe.home.xs4all.nl/Split&Concat/">Split&Concat</a></li>
|
||||
<li> On GNU/Linux and with the console: <code>split --bytes=4000M my_big_file.zim</code></li>
|
||||
</ul>
|
||||
<p><strong>Note:</strong> your resulting files must be named <code>my_big_file.zimaa</code>, <code>my_big_file.zimab</code>, etc.</p>
|
||||
</section>
|
||||
<p>While Kiwix has been originaly designed to provide Wikipedia offline, it also reads other
|
||||
contents.</p>
|
||||
</section>
|
||||
|
||||
<section id="intro">
|
||||
<h1>Thank you for choosing Kiwix!</h1>
|
||||
<p>We are glad to have you on board and would like assure you we are available to assist you in making the best use of this software.</p>
|
||||
<p>Please leave us a note at <a href="mailto:contact@kiwix.org">contact@kiwix.org</a>.</p>
|
||||
</section>
|
||||
<section id="where-do-i-find-content">
|
||||
<h2>Where is the content?</h2>
|
||||
|
||||
<p>The contents are located on the <a href="http://kiwix.org/m/">kiwix website</a>.</p>
|
||||
|
||||
<p>They are available as ZIM files. There are <strong>a lot</strong> of them:</p>
|
||||
<ul>
|
||||
<li>Wikipedia is available separately for each language</li>
|
||||
<li>Other contents like Wikileaks or Wikisource are also available</li>
|
||||
</ul>
|
||||
<p>Carefuly select the one(s) you want and launch the download. Put the resulting files on
|
||||
your SD card then open them with Kiwix.</p>
|
||||
|
||||
<p>Depending on the content and your Internet connection on this device, it might be
|
||||
preferable to download from a Desktop computer and transfer to your SD card.</p>
|
||||
</section>
|
||||
|
||||
<section id="large-zim">
|
||||
<h2>How to use large ZIM files?</h2>
|
||||
|
||||
<p>If your ZIM file weighs more than 4GB, you might not be able to store it on your SD card
|
||||
due to filesystem limitations.</p>
|
||||
|
||||
<p>In this case, please split it using one of the following software:</p>
|
||||
<ul>
|
||||
<li> On Microsoft Windows: <a rel="nofollow" class="external text"
|
||||
href="http://www.jaist.ac.jp/~hoangle/filesj/">FSJ-Lite</a>
|
||||
</li>
|
||||
<li> On Apple Mac OSX: <a rel="nofollow" class="external text"
|
||||
href="http://loekjehe.home.xs4all.nl/Split&Concat/">Split&Concat</a>
|
||||
</li>
|
||||
<li> On GNU/Linux and with the console: <code>split --bytes=4000M my_big_file.zim</code>
|
||||
</li>
|
||||
</ul>
|
||||
<p><strong>Note:</strong> your resulting files must be named <code>my_big_file.zimaa</code>,
|
||||
<code>my_big_file.zimab</code>, etc.</p>
|
||||
</section>
|
||||
|
||||
<section id="intro">
|
||||
<h1>Thank you for choosing Kiwix!</h1>
|
||||
|
||||
<p>We are glad to have you on board and would like assure you we are available to assist you
|
||||
in making the best use of this software.</p>
|
||||
|
||||
<p>Please leave us a note at <a href="mailto:contact@kiwix.org">contact@kiwix.org</a>.</p>
|
||||
</section>
|
||||
|
||||
</div>
|
||||
|
||||
|
@ -1,38 +1,54 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>Welcome to Kiwix!</title>
|
||||
<meta charset="UTF-8"/>
|
||||
<title>Welcome to Kiwix!</title>
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link href="file:///android_asset/www/bootstrap/css/bootstrap.css" rel="stylesheet">
|
||||
<link href="file:///android_asset/www/bootstrap/css/bootstrap-responsive.css" rel="stylesheet">
|
||||
<link href="file:///android_asset/www/static.css" rel="stylesheet">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link href="file:///android_asset/www/bootstrap/css/bootstrap.css" rel="stylesheet">
|
||||
<link href="file:///android_asset/www/bootstrap/css/bootstrap-responsive.css" rel="stylesheet">
|
||||
<link href="file:///android_asset/www/static.css" rel="stylesheet">
|
||||
</head>
|
||||
|
||||
<body class="welcome" lang="en-US">
|
||||
|
||||
<div id="content-wrapper">
|
||||
|
||||
<section id="step1">
|
||||
<h2><span>1.</span> Download Offline Files</h2>
|
||||
<p><strong>Kiwix</strong> allows to read websites like Wikipedia off-line. Try our 2.4MB Wikipedia demo file containing a few articles about singer <em>Ray Charles</em> from the English Wikipedia:</p>
|
||||
<a class="button" href="http://download.kiwix.org/zim/wikipedia_en_ray_charles.zim">Ray-Charles-Demo.zim</a>
|
||||
<p>Offline content is available at <a href="http://www.kiwix.org/m/">kiwix.org</a>. You can create your own books in Wikipedia, refer to the <a href="content://org.kiwix.ui/gotohelp">help</a> for further details.</p>
|
||||
<div class="alert alert-info"><strong>Warning!</strong> This download will take place in your browser. Don't forget to come back to Kiwix once download is complete!</div>
|
||||
</section>
|
||||
<section id="step1">
|
||||
<h2><span>1.</span> Download Offline Files</h2>
|
||||
|
||||
<section id="step2">
|
||||
<h2><span>2.</span> Take a drink break!</h2>
|
||||
<img src="coffee.png">
|
||||
<p>Downloads can take a long time, go mind your regular business and come back once done.</p>
|
||||
</section>
|
||||
<p><strong>Kiwix</strong> allows to read websites like Wikipedia off-line. Try our 2.4MB
|
||||
Wikipedia demo file containing a few articles about singer <em>Ray Charles</em> from the
|
||||
English Wikipedia:</p>
|
||||
<a class="button" href="http://download.kiwix.org/zim/wikipedia_en_ray_charles.zim">Ray-Charles-Demo.zim</a>
|
||||
|
||||
<section id="step3">
|
||||
<h2><span>3.</span> Open the file in Kiwix!</h2>
|
||||
<p>Click the <span><a href="content://org.kiwix.ui/selectzimfile">Open File</a></span> button in the toolbar at the top and select the ZIM file you downloaded. <strong>That's It!</strong></p>
|
||||
<p>Now, enjoy your content, and take a look at the <a href="content://org.kiwix.ui/gotohelp">help</a> page once bored.</p>
|
||||
</section>
|
||||
<p>Offline content is available at <a href="http://www.kiwix.org/m/">kiwix.org</a>. You can
|
||||
create your own books in Wikipedia, refer to the <a
|
||||
href="content://org.kiwix.ui/gotohelp">help</a> for further details.</p>
|
||||
|
||||
<div class="alert alert-info"><strong>Warning!</strong> This download will take place in
|
||||
your browser. Don't forget to come back to Kiwix once download is complete!
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section id="step2">
|
||||
<h2><span>2.</span> Take a drink break!</h2>
|
||||
<img src="coffee.png">
|
||||
|
||||
<p>Downloads can take a long time, go mind your regular business and come back once
|
||||
done.</p>
|
||||
</section>
|
||||
|
||||
<section id="step3">
|
||||
<h2><span>3.</span> Open the file in Kiwix!</h2>
|
||||
|
||||
<p>Click the <span><a href="content://org.kiwix.ui/selectzimfile">Open File</a></span>
|
||||
button in the toolbar at the top and select the ZIM file you downloaded. <strong>That's
|
||||
It!</strong></p>
|
||||
|
||||
<p>Now, enjoy your content, and take a look at the <a
|
||||
href="content://org.kiwix.ui/gotohelp">help</a> page once bored.</p>
|
||||
</section>
|
||||
|
||||
</div>
|
||||
|
||||
|
9
res/values/attrs.xml
Normal file
9
res/values/attrs.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<resources>
|
||||
|
||||
<declare-styleable name="SliderPreference">
|
||||
<attr name="android:summary"/>
|
||||
</declare-styleable>
|
||||
|
||||
</resources>
|
@ -1,11 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string-array
|
||||
name="pref_zoom_entryvalues"
|
||||
translatable="false">
|
||||
<item>automatic</item>
|
||||
<string-array name="pref_zoom_entryvalues" translatable="false">
|
||||
<item>small</item>
|
||||
<item>medium</item>
|
||||
<item>large</item>
|
||||
</string-array>
|
||||
|
||||
</resources>
|
@ -1,12 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<style name="AppStyle" parent="Theme.Sherlock">
|
||||
<item name="actionBarTabTextStyle">@style/TabTextStyle</item>
|
||||
</style>
|
||||
|
||||
<style name="TabTextStyle" parent="Widget.Sherlock.ActionBar.TabText">
|
||||
<item name="android:textAllCaps">false</item>
|
||||
</style>
|
||||
<style name="AppStyle" parent="Theme.AppCompat"/>
|
||||
|
||||
</resources>
|
@ -3,18 +3,6 @@
|
||||
android:key="pref_display"
|
||||
android:title="@string/pref_display_title">
|
||||
|
||||
<ListPreference
|
||||
android:key="pref_zoom"
|
||||
android:title="@string/pref_zoom_title"
|
||||
android:dialogTitle="@string/pref_zoom_dialogtitle"
|
||||
android:entries="@array/pref_zoom_entries"
|
||||
android:entryValues="@array/pref_zoom_entryvalues"
|
||||
android:defaultValue="automatic"/>
|
||||
<CheckBoxPreference
|
||||
android:key="pref_zoom_enabled"
|
||||
android:title="@string/pref_zoom_enable"
|
||||
android:summary="@string/pref_zoom_enable_summary"
|
||||
android:defaultValue="false"/>
|
||||
<CheckBoxPreference
|
||||
android:key="pref_nightmode"
|
||||
android:title="@string/pref_nightmode"
|
||||
@ -26,6 +14,20 @@
|
||||
android:summary="@string/pref_backtotop_summary"
|
||||
android:defaultValue="false"/>
|
||||
|
||||
<CheckBoxPreference
|
||||
android:key="pref_zoom_enabled"
|
||||
android:title="@string/pref_zoom_enable"
|
||||
android:summary="@string/pref_zoom_enable_summary"
|
||||
android:defaultValue="false"/>
|
||||
|
||||
<org.kiwix.kiwixmobile.settings.SliderPreference
|
||||
android:key="pref_zoom"
|
||||
android:title="@string/pref_zoom_title"
|
||||
android:summary="@array/pref_zoom_entryvalues"
|
||||
android:dialogMessage="0"
|
||||
android:defaultValue="250.0"
|
||||
android:enabled="false"/>
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory
|
||||
|
@ -1,36 +0,0 @@
|
||||
/*
|
||||
* Copyright 2013 Rashiq Ahmad <rashiq.z@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
package org.kiwix.kiwixmobile;
|
||||
|
||||
|
||||
import android.os.Build;
|
||||
|
||||
public class BackwardsCompatibilityTools {
|
||||
|
||||
public static final boolean newApi() {
|
||||
|
||||
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB;
|
||||
}
|
||||
|
||||
public static final boolean equalsOrNewThanApi(int api) {
|
||||
|
||||
return Build.VERSION.SDK_INT >= api;
|
||||
}
|
||||
}
|
@ -19,16 +19,16 @@
|
||||
|
||||
package org.kiwix.kiwixmobile;
|
||||
|
||||
import com.actionbarsherlock.view.ActionMode;
|
||||
import com.actionbarsherlock.view.Menu;
|
||||
import com.actionbarsherlock.view.MenuItem;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.v7.view.ActionMode;
|
||||
import android.text.Editable;
|
||||
import android.text.Selection;
|
||||
import android.text.Spannable;
|
||||
import android.text.TextWatcher;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.webkit.WebView;
|
||||
|
@ -20,14 +20,8 @@
|
||||
package org.kiwix.kiwixmobile;
|
||||
|
||||
|
||||
import com.actionbarsherlock.app.ActionBar;
|
||||
import com.actionbarsherlock.app.SherlockFragmentActivity;
|
||||
import com.actionbarsherlock.view.MenuItem;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.ClipData;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
@ -39,11 +33,14 @@ import android.support.v4.app.FragmentManager;
|
||||
import android.support.v4.app.FragmentStatePagerAdapter;
|
||||
import android.support.v4.app.FragmentTransaction;
|
||||
import android.support.v4.view.ViewPager;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.Log;
|
||||
import android.util.SparseArray;
|
||||
import android.view.DragEvent;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewParent;
|
||||
@ -55,10 +52,8 @@ import android.widget.Spinner;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import static org.kiwix.kiwixmobile.BackwardsCompatibilityTools.equalsOrNewThanApi;
|
||||
import static org.kiwix.kiwixmobile.BackwardsCompatibilityTools.newApi;
|
||||
|
||||
public class KiwixMobileActivity extends SherlockFragmentActivity implements ActionBar.TabListener,
|
||||
public class KiwixMobileActivity extends AppCompatActivity implements ActionBar.TabListener,
|
||||
View.OnLongClickListener, KiwixMobileFragment.FragmentCommunicator,
|
||||
BookmarkDialog.BookmarkDialogListener {
|
||||
|
||||
@ -95,12 +90,8 @@ public class KiwixMobileActivity extends SherlockFragmentActivity implements Act
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
// startActivity(new Intent(this, LibraryActivity.class));
|
||||
|
||||
requestWindowFeature(Window.FEATURE_PROGRESS);
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
setProgressBarVisibility(true);
|
||||
|
||||
handleLocaleCheck();
|
||||
@ -109,10 +100,9 @@ public class KiwixMobileActivity extends SherlockFragmentActivity implements Act
|
||||
|
||||
// Set an OnDragListener on the entire View. Now we can track,
|
||||
// if the user drags the Tab outside the View
|
||||
if (newApi()) {
|
||||
setUpOnDragListener();
|
||||
getWindow().getDecorView().setOnDragListener(mOnDragListener);
|
||||
}
|
||||
|
||||
setUpOnDragListener();
|
||||
getWindow().getDecorView().setOnDragListener(mOnDragListener);
|
||||
|
||||
mViewPagerAdapter = new ViewPagerAdapter(getSupportFragmentManager());
|
||||
|
||||
@ -142,9 +132,7 @@ public class KiwixMobileActivity extends SherlockFragmentActivity implements Act
|
||||
|
||||
private void setUpViewPagerAndActionBar() {
|
||||
|
||||
if (equalsOrNewThanApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)) {
|
||||
mActionBar.setHomeButtonEnabled(false);
|
||||
}
|
||||
mActionBar.setHomeButtonEnabled(false);
|
||||
|
||||
mViewPager.setAdapter(mViewPagerAdapter);
|
||||
// set the amount of pages, that the ViewPager adapter should keep in cache
|
||||
@ -304,24 +292,22 @@ public class KiwixMobileActivity extends SherlockFragmentActivity implements Act
|
||||
mCompatCallback.setActive();
|
||||
mCompatCallback.setWebView(mCurrentFragment.webView);
|
||||
mCompatCallback.showSoftInput();
|
||||
startActionMode(mCompatCallback);
|
||||
startSupportActionMode(mCompatCallback);
|
||||
break;
|
||||
|
||||
case R.id.menu_forward:
|
||||
if (mCurrentFragment.webView.canGoForward()) {
|
||||
mCurrentFragment.webView.goForward();
|
||||
if (newApi()) {
|
||||
invalidateOptionsMenu();
|
||||
}
|
||||
invalidateOptionsMenu();
|
||||
}
|
||||
break;
|
||||
|
||||
case R.id.menu_back:
|
||||
if (mCurrentFragment.webView.canGoBack()) {
|
||||
mCurrentFragment.webView.goBack();
|
||||
if (newApi()) {
|
||||
invalidateOptionsMenu();
|
||||
}
|
||||
|
||||
invalidateOptionsMenu();
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
@ -650,16 +636,11 @@ public class KiwixMobileActivity extends SherlockFragmentActivity implements Act
|
||||
|
||||
mCurrentDraggedTab = (Integer) v.getTag(R.id.action_bar_tab_id);
|
||||
|
||||
if (newApi()) {
|
||||
onLongClickOperation(v);
|
||||
} else {
|
||||
compatOnLongClickOperation();
|
||||
}
|
||||
onLongClickOperation(v);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
|
||||
private void onLongClickOperation(View v) {
|
||||
|
||||
View.DragShadowBuilder shadowBuilder = new View.DragShadowBuilder(v);
|
||||
@ -674,21 +655,6 @@ public class KiwixMobileActivity extends SherlockFragmentActivity implements Act
|
||||
v.startDrag(data, shadowBuilder, v, 0);
|
||||
}
|
||||
|
||||
private void compatOnLongClickOperation() {
|
||||
|
||||
AlertDialog.Builder dialog = new AlertDialog.Builder(this);
|
||||
|
||||
dialog.setTitle(getString(R.string.remove_tab));
|
||||
dialog.setMessage(getString(R.string.remove_tab_confirm));
|
||||
dialog.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
removeTabAt(mCurrentDraggedTab);
|
||||
}
|
||||
});
|
||||
dialog.setNegativeButton(android.R.string.no, null);
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
//These two methods are used with the BookmarkDialog.
|
||||
@Override
|
||||
public void onListItemSelect(String choice) {
|
||||
|
@ -19,14 +19,9 @@
|
||||
|
||||
package org.kiwix.kiwixmobile;
|
||||
|
||||
import com.actionbarsherlock.app.SherlockFragment;
|
||||
import com.actionbarsherlock.view.Menu;
|
||||
import com.actionbarsherlock.view.MenuInflater;
|
||||
|
||||
import org.kiwix.kiwixmobile.settings.Constants;
|
||||
import org.kiwix.kiwixmobile.settings.KiwixSettingsActivityGB;
|
||||
import org.kiwix.kiwixmobile.settings.KiwixSettingsActivityHC;
|
||||
import org.kiwix.kiwixmobile.settings.SettingsHelper;
|
||||
import org.kiwix.kiwixmobile.settings.KiwixSettingsActivity;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.annotation.TargetApi;
|
||||
@ -50,15 +45,18 @@ import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.text.Editable;
|
||||
import android.text.InputType;
|
||||
import android.text.TextWatcher;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.Log;
|
||||
import android.view.ContextMenu;
|
||||
import android.view.DragEvent;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.View.MeasureSpec;
|
||||
@ -99,9 +97,8 @@ import java.io.OutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
import static org.kiwix.kiwixmobile.BackwardsCompatibilityTools.newApi;
|
||||
|
||||
public class KiwixMobileFragment extends SherlockFragment {
|
||||
public class KiwixMobileFragment extends Fragment {
|
||||
|
||||
public static final String TAG_KIWIX = "kiwix";
|
||||
|
||||
@ -109,23 +106,15 @@ public class KiwixMobileFragment extends SherlockFragment {
|
||||
|
||||
private static final String TAG_CURRENTARTICLE = "currentarticle";
|
||||
|
||||
private static final String PREF_ZOOM = "pref_zoom";
|
||||
|
||||
private static final String PREF_NIGHTMODE = "pref_nightmode";
|
||||
|
||||
private static final String PREF_ZOOM_ENABLED = "pref_zoom_enabled";
|
||||
|
||||
private static final String PREF_KIWIX_MOBILE = "kiwix-mobile";
|
||||
|
||||
private static final String PREF_BACKTOTOP = "pref_backtotop";
|
||||
|
||||
private static final String AUTOMATIC = "automatic";
|
||||
private static final String PREF_ZOOM = "pref_zoom";
|
||||
|
||||
private static final String MEDIUM = "medium";
|
||||
|
||||
private static final String SMALL = "small";
|
||||
|
||||
private static final String LARGE = "large";
|
||||
private static final String PREF_ZOOM_ENABLED = "pref_zoom_enabled";
|
||||
|
||||
private static final int ZIMFILESELECT_REQUEST_CODE = 1234;
|
||||
|
||||
@ -151,9 +140,9 @@ public class KiwixMobileFragment extends SherlockFragment {
|
||||
|
||||
protected int requestWebReloadOnFinished;
|
||||
|
||||
private boolean isBacktotopEnabled;
|
||||
private boolean mIsBacktotopEnabled;
|
||||
|
||||
private SharedPreferences mySharedPreferences;
|
||||
private SharedPreferences mSharedPreferences;
|
||||
|
||||
private ArrayAdapter<String> adapter;
|
||||
|
||||
@ -167,6 +156,8 @@ public class KiwixMobileFragment extends SherlockFragment {
|
||||
|
||||
private KiwixTextToSpeech tts;
|
||||
|
||||
private boolean mIsZoomEnabled;
|
||||
|
||||
@SuppressLint("SetJavaScriptEnabled")
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
@ -180,7 +171,7 @@ public class KiwixMobileFragment extends SherlockFragment {
|
||||
requestWebReloadOnFinished = 0;
|
||||
requestInitAllMenuItems = false;
|
||||
nightMode = false;
|
||||
isBacktotopEnabled = false;
|
||||
mIsBacktotopEnabled = false;
|
||||
isFullscreenOpened = false;
|
||||
}
|
||||
|
||||
@ -246,9 +237,7 @@ public class KiwixMobileFragment extends SherlockFragment {
|
||||
|
||||
manageExternalLaunchAndRestoringViewState(savedInstanceState);
|
||||
|
||||
if (newApi()) {
|
||||
setUpTabDeleteCross();
|
||||
}
|
||||
setUpTabDeleteCross();
|
||||
|
||||
return root;
|
||||
}
|
||||
@ -261,7 +250,7 @@ public class KiwixMobileFragment extends SherlockFragment {
|
||||
editor.putString(TAG_CURRENTZIMFILE, ZimContentProvider.getZimFile());
|
||||
|
||||
// Commit the edits!
|
||||
editor.commit();
|
||||
editor.apply();
|
||||
|
||||
// Save bookmarks
|
||||
saveBookmarks();
|
||||
@ -435,11 +424,8 @@ public class KiwixMobileFragment extends SherlockFragment {
|
||||
});
|
||||
|
||||
// Create the adapter and set it to the AutoCompleteTextView
|
||||
if (newApi()) {
|
||||
adapter = new AutoCompleteAdapter(getActivity(), android.R.layout.simple_list_item_1);
|
||||
} else {
|
||||
adapter = new AutoCompleteAdapter(getActivity(), R.layout.simple_list_item);
|
||||
}
|
||||
|
||||
adapter = new AutoCompleteAdapter(getActivity(), android.R.layout.simple_list_item_1);
|
||||
|
||||
articleSearchtextView.setAdapter(adapter);
|
||||
articleSearchtextView.setOnItemClickListener(new OnItemClickListener() {
|
||||
@ -490,11 +476,28 @@ public class KiwixMobileFragment extends SherlockFragment {
|
||||
|
||||
private void setUpWebView() {
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
WebView.setWebContentsDebuggingEnabled(true);
|
||||
}
|
||||
|
||||
// webView.getSettings().setLoadsImagesAutomatically(false);
|
||||
// Does not make much sense to cache data from zim files.(Not clear whether
|
||||
// this actually has any effect)
|
||||
webView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
|
||||
webView.setWebChromeClient(new MyWebChromeClient());
|
||||
|
||||
// Should basically resemble the behavior when setWebClient not done
|
||||
// (i.p. internal urls load in webview, external urls in browser)
|
||||
// as currently no custom setWebViewClient required it is commented
|
||||
// However, it must notify the bookmark system when a page is finished loading
|
||||
// so that it can refresh the menu.
|
||||
webView.setWebViewClient(new MyWebViewClient());
|
||||
|
||||
webView.setOnPageChangedListener(new KiwixWebView.OnPageChangeListener() {
|
||||
|
||||
@Override
|
||||
public void onPageChanged(int page, int maxPages) {
|
||||
if (isBacktotopEnabled) {
|
||||
if (mIsBacktotopEnabled) {
|
||||
if (webView.getScrollY() > 200) {
|
||||
if (mBackToTopButton.getVisibility() == View.INVISIBLE) {
|
||||
mBackToTopButton.setText(R.string.button_backtotop);
|
||||
@ -653,28 +656,12 @@ public class KiwixMobileFragment extends SherlockFragment {
|
||||
}
|
||||
});
|
||||
|
||||
// JS includes will not happen unless we enable JS
|
||||
webView.getSettings().setJavaScriptEnabled(true);
|
||||
|
||||
mBackToTopButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
webView.pageUp(true);
|
||||
}
|
||||
});
|
||||
|
||||
// webView.getSettings().setLoadsImagesAutomatically(false);
|
||||
// Does not make much sense to cache data from zim files.(Not clear whether
|
||||
// this actually has any effect)
|
||||
webView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
|
||||
webView.setWebChromeClient(new MyWebChromeClient());
|
||||
|
||||
// Should basically resemble the behavior when setWebClient not done
|
||||
// (i.p. internal urls load in webview, external urls in browser)
|
||||
// as currently no custom setWebViewClient required it is commented
|
||||
// However, it must notify the bookmark system when a page is finished loading
|
||||
// so that it can refresh the menu.
|
||||
webView.setWebViewClient(new MyWebViewClient());
|
||||
}
|
||||
|
||||
private void setUpExitFullscreenButton() {
|
||||
@ -739,7 +726,7 @@ public class KiwixMobileFragment extends SherlockFragment {
|
||||
}
|
||||
break;
|
||||
case PREFERENCES_REQUEST_CODE:
|
||||
if (resultCode == SettingsHelper.RESULT_RESTART) {
|
||||
if (resultCode == KiwixSettingsActivity.RESULT_RESTART) {
|
||||
getActivity().finish();
|
||||
startActivity(new Intent(getActivity(), KiwixMobileActivity.class));
|
||||
}
|
||||
@ -787,39 +774,25 @@ public class KiwixMobileFragment extends SherlockFragment {
|
||||
|
||||
public void loadPrefs() {
|
||||
|
||||
mySharedPreferences = PreferenceManager.getDefaultSharedPreferences(getActivity());
|
||||
mSharedPreferences = PreferenceManager.getDefaultSharedPreferences(getActivity());
|
||||
boolean nightMode = mSharedPreferences.getBoolean(PREF_NIGHTMODE, false);
|
||||
mIsBacktotopEnabled = mSharedPreferences.getBoolean(PREF_BACKTOTOP, false);
|
||||
mIsZoomEnabled = mSharedPreferences.getBoolean(PREF_ZOOM_ENABLED, false);
|
||||
|
||||
String pref_zoom = mySharedPreferences.getString(PREF_ZOOM, AUTOMATIC);
|
||||
Boolean pref_zoom_enabled = mySharedPreferences.getBoolean(PREF_ZOOM_ENABLED, false);
|
||||
Boolean pref_nightmode = mySharedPreferences.getBoolean(PREF_NIGHTMODE, false);
|
||||
isBacktotopEnabled = mySharedPreferences.getBoolean(PREF_BACKTOTOP, false);
|
||||
|
||||
if (pref_zoom.equals(AUTOMATIC)) {
|
||||
setDefaultZoom();
|
||||
} else if (pref_zoom.equals(MEDIUM)) {
|
||||
webView.getSettings().setDefaultZoom(WebSettings.ZoomDensity.MEDIUM);
|
||||
} else if (pref_zoom.equals(SMALL)) {
|
||||
webView.getSettings().setDefaultZoom(WebSettings.ZoomDensity.FAR);
|
||||
} else if (pref_zoom.equals(LARGE)) {
|
||||
webView.getSettings().setDefaultZoom(WebSettings.ZoomDensity.CLOSE);
|
||||
if (mIsZoomEnabled) {
|
||||
int zoomScale = (int) mSharedPreferences.getFloat(PREF_ZOOM, 100.0f);
|
||||
webView.setInitialScale(zoomScale);
|
||||
} else {
|
||||
Log.w(TAG_KIWIX,
|
||||
"pref_displayZoom value (" + pref_zoom + " unknown. Assuming automatic");
|
||||
webView.getSettings().setDefaultZoom(WebSettings.ZoomDensity.MEDIUM);
|
||||
webView.setInitialScale(0);
|
||||
}
|
||||
|
||||
// Pinch to zoom
|
||||
// This seems to suffer from a bug in Android. If you set to "false" this only apply after a restart of the app.
|
||||
Log.d(TAG_KIWIX, "pref_zoom_enabled value (" + pref_zoom_enabled + ")");
|
||||
webView.disableZoomControlls(pref_zoom_enabled);
|
||||
|
||||
if (!isBacktotopEnabled) {
|
||||
if (!mIsBacktotopEnabled) {
|
||||
mBackToTopButton.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
|
||||
// Night mode status
|
||||
Log.d(TAG_KIWIX, "pref_nightmode value (" + pref_nightmode + ")");
|
||||
if (nightMode != pref_nightmode) {
|
||||
Log.d(TAG_KIWIX, "nightMode value (" + nightMode + ")");
|
||||
if (this.nightMode != nightMode) {
|
||||
ToggleNightMode();
|
||||
}
|
||||
}
|
||||
@ -839,12 +812,7 @@ public class KiwixMobileFragment extends SherlockFragment {
|
||||
}
|
||||
|
||||
public void selectSettings() {
|
||||
Intent i;
|
||||
if (newApi()) {
|
||||
i = new Intent(getActivity(), KiwixSettingsActivityHC.class);
|
||||
} else {
|
||||
i = new Intent(getActivity(), KiwixSettingsActivityGB.class);
|
||||
}
|
||||
Intent i = new Intent(getActivity(), KiwixSettingsActivity.class);
|
||||
startActivityForResult(i, PREFERENCES_REQUEST_CODE);
|
||||
}
|
||||
|
||||
@ -907,7 +875,7 @@ public class KiwixMobileFragment extends SherlockFragment {
|
||||
if (file.exists()) {
|
||||
if (ZimContentProvider.setZimFile(file.getAbsolutePath()) != null) {
|
||||
|
||||
getSherlockActivity().getSupportActionBar()
|
||||
((AppCompatActivity) getActivity()).getSupportActionBar()
|
||||
.setSubtitle(ZimContentProvider.getZimFileTitle());
|
||||
|
||||
// Apparently with webView.clearHistory() only history before currently (fully)
|
||||
@ -989,7 +957,7 @@ public class KiwixMobileFragment extends SherlockFragment {
|
||||
} else {
|
||||
bookmarks.remove(title);
|
||||
}
|
||||
getSherlockActivity().supportInvalidateOptionsMenu();
|
||||
getActivity().supportInvalidateOptionsMenu();
|
||||
}
|
||||
|
||||
public void viewBookmarks() {
|
||||
@ -1049,8 +1017,10 @@ public class KiwixMobileFragment extends SherlockFragment {
|
||||
|
||||
if (articleUrl != null) {
|
||||
// hideSearchBar();
|
||||
|
||||
webView.loadUrl(Uri.parse(ZimContentProvider.CONTENT_URI
|
||||
+ articleUrl).toString());
|
||||
|
||||
} else {
|
||||
String errorString = String
|
||||
.format(getResources().getString(R.string.error_articlenotfound),
|
||||
@ -1080,11 +1050,6 @@ public class KiwixMobileFragment extends SherlockFragment {
|
||||
return openArticle(articleUrl);
|
||||
}
|
||||
|
||||
public boolean isTablet(Context context) {
|
||||
return (context.getResources().getConfiguration().screenLayout
|
||||
& Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_LARGE;
|
||||
}
|
||||
|
||||
public void hideSearchBar() {
|
||||
// Hide searchbar
|
||||
articleSearchBar.setVisibility(View.GONE);
|
||||
@ -1126,37 +1091,6 @@ public class KiwixMobileFragment extends SherlockFragment {
|
||||
}
|
||||
}
|
||||
|
||||
public void setDefaultZoom() {
|
||||
DisplayMetrics metrics = new DisplayMetrics();
|
||||
getActivity().getWindowManager().getDefaultDisplay().getMetrics(metrics);
|
||||
|
||||
// Cleaner than approach used in 1.0 to set CLOSE for tables, MEDIUM for phones.
|
||||
// However, unfortunately at least on Samsung Galaxy Tab 2 density is medium.
|
||||
// Anyway, user can now override so it should be ok.
|
||||
switch (metrics.densityDpi) {
|
||||
|
||||
case DisplayMetrics.DENSITY_HIGH:
|
||||
Log.d(TAG_KIWIX, "setDefaultZoom for Display DENSITY_HIGH-> ZoomDensity.FAR ");
|
||||
webView.getSettings().setDefaultZoom(WebSettings.ZoomDensity.FAR);
|
||||
break;
|
||||
|
||||
case DisplayMetrics.DENSITY_MEDIUM:
|
||||
Log.d(TAG_KIWIX, "setDefaultZoom for Display DENSITY_MEDIUM-> ZoomDensity.MEDIUM ");
|
||||
webView.getSettings().setDefaultZoom(WebSettings.ZoomDensity.MEDIUM);
|
||||
break;
|
||||
|
||||
case DisplayMetrics.DENSITY_LOW:
|
||||
Log.d(TAG_KIWIX, "setDefaultZoom for Display DENSITY_LOW-> ZoomDensity.CLOSE ");
|
||||
webView.getSettings().setDefaultZoom(WebSettings.ZoomDensity.CLOSE);
|
||||
break;
|
||||
|
||||
default:
|
||||
Log.d(TAG_KIWIX, "setDefaultZoom for Display OTHER -> ZoomDensity.MEDIUM ");
|
||||
webView.getSettings().setDefaultZoom(WebSettings.ZoomDensity.MEDIUM);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void readAloud() {
|
||||
tts.readAloud();
|
||||
}
|
||||
@ -1246,8 +1180,8 @@ public class KiwixMobileFragment extends SherlockFragment {
|
||||
}
|
||||
|
||||
if (progress > 20) {
|
||||
if (getSherlockActivity() != null) {
|
||||
getSherlockActivity().supportInvalidateOptionsMenu();
|
||||
if (getActivity() != null) {
|
||||
getActivity().supportInvalidateOptionsMenu();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1343,7 +1277,7 @@ public class KiwixMobileFragment extends SherlockFragment {
|
||||
"<html><body>" + errorString + "</body></html>", "text/html", "utf-8",
|
||||
failingUrl);
|
||||
String title = getResources().getString(R.string.app_name);
|
||||
getSherlockActivity().getSupportActionBar().setTitle(title);
|
||||
((AppCompatActivity) getActivity()).getSupportActionBar().setTitle(title);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -1355,13 +1289,14 @@ public class KiwixMobileFragment extends SherlockFragment {
|
||||
title = webView.getTitle();
|
||||
}
|
||||
|
||||
if (getSherlockActivity().getSupportActionBar().getTabCount() < 2) {
|
||||
getSherlockActivity().getSupportActionBar().setTitle(title);
|
||||
if (((AppCompatActivity) getActivity()).getSupportActionBar().getTabCount() < 2) {
|
||||
((AppCompatActivity) getActivity()).getSupportActionBar().setTitle(title);
|
||||
}
|
||||
|
||||
if (getSherlockActivity().getSupportActionBar().getNavigationMode()
|
||||
if (((AppCompatActivity) getActivity()).getSupportActionBar().getNavigationMode()
|
||||
== ActionBar.NAVIGATION_MODE_TABS) {
|
||||
getSherlockActivity().getSupportActionBar().getSelectedTab().setText(title);
|
||||
((AppCompatActivity) getActivity()).getSupportActionBar().getSelectedTab()
|
||||
.setText(title);
|
||||
}
|
||||
|
||||
// Workaround for #643
|
||||
|
@ -64,35 +64,27 @@ public class KiwixTextToSpeech {
|
||||
}
|
||||
}
|
||||
});
|
||||
if (BackwardsCompatibilityTools
|
||||
.equalsOrNewThanApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1)) {
|
||||
tts.setOnUtteranceProgressListener(new UtteranceProgressListener() {
|
||||
@Override
|
||||
public void onStart(String utteranceId) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDone(String utteranceId) {
|
||||
Log.e(TAG_KIWIX, "TextToSpeech: " + utteranceId);
|
||||
onSpeakingListener.onSpeakingEnded();
|
||||
}
|
||||
tts.setOnUtteranceProgressListener(new UtteranceProgressListener() {
|
||||
@Override
|
||||
public void onStart(String utteranceId) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String utteranceId) {
|
||||
Log.e(TAG_KIWIX, "TextToSpeech: " + utteranceId);
|
||||
onSpeakingListener.onSpeakingEnded();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
tts.setOnUtteranceCompletedListener(new TextToSpeech.OnUtteranceCompletedListener() {
|
||||
@Override
|
||||
public void onUtteranceCompleted(String utteranceId) {
|
||||
onSpeakingListener.onSpeakingEnded();
|
||||
}
|
||||
});
|
||||
}
|
||||
@Override
|
||||
public void onDone(String utteranceId) {
|
||||
Log.e(TAG_KIWIX, "TextToSpeech: " + utteranceId);
|
||||
onSpeakingListener.onSpeakingEnded();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String utteranceId) {
|
||||
Log.e(TAG_KIWIX, "TextToSpeech: " + utteranceId);
|
||||
onSpeakingListener.onSpeakingEnded();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Starts speaking the WebView content aloud (or stops it if TTS is speaking now).
|
||||
*/
|
||||
|
@ -20,18 +20,13 @@
|
||||
package org.kiwix.kiwixmobile;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.MotionEvent;
|
||||
import android.webkit.WebChromeClient;
|
||||
import android.webkit.WebSettings.LayoutAlgorithm;
|
||||
import android.webkit.WebView;
|
||||
import android.webkit.WebViewClient;
|
||||
import android.widget.ZoomButtonsController;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import static org.kiwix.kiwixmobile.BackwardsCompatibilityTools.newApi;
|
||||
|
||||
public class KiwixWebView extends WebView {
|
||||
|
||||
@ -59,20 +54,12 @@ public class KiwixWebView extends WebView {
|
||||
}
|
||||
|
||||
private void init() {
|
||||
setWebChromeClient(new WebChromeClient());
|
||||
setWebViewClient(new WebViewClient());
|
||||
// setWebChromeClient(new WebChromeClient());
|
||||
// setWebViewClient(new WebViewClient());
|
||||
getSettings().setJavaScriptEnabled(true);
|
||||
getSettings().setSupportMultipleWindows(true);
|
||||
getSettings().setSupportZoom(true);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
|
||||
// Avoid crash with WebViewClassic
|
||||
try {
|
||||
getSettings().setLayoutAlgorithm(LayoutAlgorithm.TEXT_AUTOSIZING);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
disableZoomControlls();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -101,20 +88,14 @@ public class KiwixWebView extends WebView {
|
||||
}
|
||||
}
|
||||
|
||||
public void disableZoomControlls(boolean disable) {
|
||||
public void disableZoomControlls() {
|
||||
|
||||
mDisableZoomControlls = disable;
|
||||
|
||||
if (newApi()) {
|
||||
getSettings().setBuiltInZoomControls(true);
|
||||
getSettings().setDisplayZoomControls(disable);
|
||||
} else {
|
||||
getZoomControlls();
|
||||
}
|
||||
getSettings().setBuiltInZoomControls(true);
|
||||
getSettings().setDisplayZoomControls(false);
|
||||
}
|
||||
|
||||
// Use reflection to hide the zoom controlls
|
||||
private void getZoomControlls() {
|
||||
private void getZoomControls() {
|
||||
try {
|
||||
Class webview = Class.forName("android.webkit.WebView");
|
||||
Method method = webview.getMethod("getZoomButtonsController");
|
||||
|
@ -181,6 +181,21 @@ public class ZimContentProvider extends ContentProvider {
|
||||
}
|
||||
}
|
||||
|
||||
private static String getFilePath(Uri articleUri) {
|
||||
String filePath = articleUri.toString();
|
||||
int pos = articleUri.toString().indexOf(CONTENT_URI.toString());
|
||||
if (pos != -1) {
|
||||
filePath = articleUri.toString().substring(
|
||||
CONTENT_URI.toString().length());
|
||||
}
|
||||
// Remove fragment (#...) as not supported by zimlib
|
||||
pos = filePath.indexOf("#");
|
||||
if (pos != -1) {
|
||||
filePath = filePath.substring(0, pos);
|
||||
}
|
||||
return filePath;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreate() {
|
||||
jniKiwix = new JNIKiwix();
|
||||
@ -348,19 +363,4 @@ public class ZimContentProvider extends ContentProvider {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static String getFilePath(Uri articleUri) {
|
||||
String filePath = articleUri.toString();
|
||||
int pos = articleUri.toString().indexOf(CONTENT_URI.toString());
|
||||
if (pos != -1) {
|
||||
filePath = articleUri.toString().substring(
|
||||
CONTENT_URI.toString().length());
|
||||
}
|
||||
// Remove fragment (#...) as not supported by zimlib
|
||||
pos = filePath.indexOf("#");
|
||||
if (pos != -1) {
|
||||
filePath = filePath.substring(0, pos);
|
||||
}
|
||||
return filePath;
|
||||
}
|
||||
}
|
@ -19,12 +19,7 @@
|
||||
|
||||
package org.kiwix.kiwixmobile;
|
||||
|
||||
import com.actionbarsherlock.app.SherlockFragmentActivity;
|
||||
import com.actionbarsherlock.view.Menu;
|
||||
import com.actionbarsherlock.view.MenuInflater;
|
||||
import com.actionbarsherlock.view.MenuItem;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.database.Cursor;
|
||||
@ -37,7 +32,11 @@ import android.support.v4.app.LoaderManager;
|
||||
import android.support.v4.content.CursorLoader;
|
||||
import android.support.v4.content.Loader;
|
||||
import android.support.v4.widget.SimpleCursorAdapter;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.util.Log;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.animation.AlphaAnimation;
|
||||
@ -53,7 +52,7 @@ import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ZimFileSelectActivity extends SherlockFragmentActivity
|
||||
public class ZimFileSelectActivity extends AppCompatActivity
|
||||
implements LoaderManager.LoaderCallbacks<Cursor>, OnItemClickListener {
|
||||
|
||||
public static final String TAG_KIWIX = "kiwix";
|
||||
@ -99,7 +98,6 @@ public class ZimFileSelectActivity extends SherlockFragmentActivity
|
||||
}
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
|
||||
@Override
|
||||
public Loader<Cursor> onCreateLoader(int i, Bundle bundle) {
|
||||
|
||||
@ -183,7 +181,7 @@ public class ZimFileSelectActivity extends SherlockFragmentActivity
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
final MenuInflater inflater = getSupportMenuInflater();
|
||||
final MenuInflater inflater = getMenuInflater();
|
||||
inflater.inflate(R.menu.fileselector, menu);
|
||||
return super.onCreateOptionsMenu(menu);
|
||||
}
|
||||
|
167
src/org/kiwix/kiwixmobile/settings/KiwixSettingsActivity.java
Normal file
167
src/org/kiwix/kiwixmobile/settings/KiwixSettingsActivity.java
Normal file
@ -0,0 +1,167 @@
|
||||
/*
|
||||
* Copyright 2013 Rashiq Ahmad <rashiq.z@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
package org.kiwix.kiwixmobile.settings;
|
||||
|
||||
import org.kiwix.kiwixmobile.LanguageUtils;
|
||||
import org.kiwix.kiwixmobile.R;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Bundle;
|
||||
import android.preference.EditTextPreference;
|
||||
import android.preference.ListPreference;
|
||||
import android.preference.Preference;
|
||||
import android.preference.PreferenceFragment;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.widget.BaseAdapter;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public class KiwixSettingsActivity extends AppCompatActivity {
|
||||
|
||||
public static final int RESULT_RESTART = 1236;
|
||||
|
||||
public static final String PREF_LANG = "pref_language_chooser";
|
||||
|
||||
public static final String PREF_VERSION = "pref_version";
|
||||
|
||||
public static final String PREF_ZOOM_ENABLED = "pref_zoom_enabled";
|
||||
|
||||
public static final String PREF_ZOOM = "pref_zoom";
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
getFragmentManager().beginTransaction().replace(android.R.id.content, new PrefsFragment())
|
||||
.commit();
|
||||
}
|
||||
|
||||
public static class PrefsFragment extends PreferenceFragment implements
|
||||
SharedPreferences.OnSharedPreferenceChangeListener {
|
||||
|
||||
|
||||
private SliderPreference mSlider;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
addPreferencesFromResource(R.xml.preferences);
|
||||
|
||||
mSlider = (SliderPreference) getPrefrence(PREF_ZOOM);
|
||||
setSliderState();
|
||||
setUpSettings();
|
||||
new LanguageUtils(getActivity()).changeFont(getActivity().getLayoutInflater());
|
||||
}
|
||||
|
||||
private void setSliderState() {
|
||||
boolean enabled = getPreferenceManager().getSharedPreferences().getBoolean(
|
||||
PREF_ZOOM_ENABLED, false);
|
||||
if (enabled) {
|
||||
mSlider.setEnabled(true);
|
||||
} else {
|
||||
mSlider.setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
getPreferenceScreen().getSharedPreferences()
|
||||
.registerOnSharedPreferenceChangeListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
getPreferenceScreen().getSharedPreferences()
|
||||
.unregisterOnSharedPreferenceChangeListener(this);
|
||||
}
|
||||
|
||||
public void setUpSettings() {
|
||||
|
||||
setUpLanguageChooser(PREF_LANG);
|
||||
setAppVersionNumber();
|
||||
}
|
||||
|
||||
private void setUpLanguageChooser(String preferenceId) {
|
||||
|
||||
ListPreference languageList = (ListPreference) getPrefrence(preferenceId);
|
||||
LanguageUtils languageUtils = new LanguageUtils(getActivity());
|
||||
|
||||
languageList.setTitle(Locale.getDefault().getDisplayLanguage());
|
||||
languageList.setEntries(languageUtils.getValues().toArray(new String[0]));
|
||||
languageList.setEntryValues(languageUtils.getKeys().toArray(new String[0]));
|
||||
languageList.setDefaultValue(Locale.getDefault().toString());
|
||||
languageList.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
|
||||
if (!newValue.equals(Locale.getDefault().toString())) {
|
||||
|
||||
LanguageUtils.handleLocaleChange(getActivity(), newValue.toString());
|
||||
// Request a restart when the user returns to the Activity, that called this Activity
|
||||
restartActivity();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void restartActivity() {
|
||||
getActivity().setResult(RESULT_RESTART);
|
||||
getActivity().finish();
|
||||
getActivity().startActivity(new Intent(getActivity(), getActivity().getClass()));
|
||||
}
|
||||
|
||||
private void setAppVersionNumber() {
|
||||
String version;
|
||||
|
||||
try {
|
||||
version = getActivity().getPackageManager()
|
||||
.getPackageInfo("org.kiwix.kiwixmobile", 0).versionName;
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
return;
|
||||
}
|
||||
EditTextPreference versionPref = (EditTextPreference) PrefsFragment.this
|
||||
.findPreference(PREF_VERSION);
|
||||
versionPref.setSummary(version);
|
||||
}
|
||||
|
||||
private Preference getPrefrence(String preferenceId) {
|
||||
return PrefsFragment.this.findPreference(preferenceId);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
|
||||
|
||||
if (key.equals(PREF_ZOOM_ENABLED)) {
|
||||
setSliderState();
|
||||
}
|
||||
if (key.equals(PREF_ZOOM)) {
|
||||
mSlider.setSummary(mSlider.getSummary());
|
||||
((BaseAdapter) getPreferenceScreen().getRootAdapter()).notifyDataSetChanged();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,37 +0,0 @@
|
||||
/*
|
||||
* Copyright 2013 Rashiq Ahmad <rashiq.z@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
package org.kiwix.kiwixmobile.settings;
|
||||
|
||||
import org.kiwix.kiwixmobile.LanguageUtils;
|
||||
import org.kiwix.kiwixmobile.R;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceActivity;
|
||||
|
||||
public class KiwixSettingsActivityGB extends PreferenceActivity {
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
addPreferencesFromResource(R.xml.preferences);
|
||||
new SettingsHelper(this).setUpSettings();
|
||||
new LanguageUtils(this).changeFont(getLayoutInflater());
|
||||
}
|
||||
}
|
@ -1,51 +0,0 @@
|
||||
/*
|
||||
* Copyright 2013 Rashiq Ahmad <rashiq.z@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
package org.kiwix.kiwixmobile.settings;
|
||||
|
||||
import org.kiwix.kiwixmobile.LanguageUtils;
|
||||
import org.kiwix.kiwixmobile.R;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceFragment;
|
||||
|
||||
public class KiwixSettingsActivityHC extends Activity {
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
getFragmentManager().beginTransaction().replace(android.R.id.content, new PrefsFragment())
|
||||
.commit();
|
||||
}
|
||||
|
||||
public class PrefsFragment extends PreferenceFragment {
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
// Load the preferences from an XML resource
|
||||
addPreferencesFromResource(R.xml.preferences);
|
||||
new SettingsHelper(this).setUpSettings();
|
||||
new LanguageUtils(getActivity()).changeFont(getLayoutInflater());
|
||||
}
|
||||
}
|
||||
}
|
@ -1,142 +0,0 @@
|
||||
/*
|
||||
* Copyright 2013 Rashiq Ahmad <rashiq.z@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
package org.kiwix.kiwixmobile.settings;
|
||||
|
||||
|
||||
import org.kiwix.kiwixmobile.LanguageUtils;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.preference.EditTextPreference;
|
||||
import android.preference.ListPreference;
|
||||
import android.preference.Preference;
|
||||
import android.preference.PreferenceActivity;
|
||||
import android.preference.PreferenceFragment;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import static org.kiwix.kiwixmobile.BackwardsCompatibilityTools.newApi;
|
||||
|
||||
|
||||
public class SettingsHelper {
|
||||
|
||||
public static final int RESULT_RESTART = 1236;
|
||||
|
||||
private Object mPreference;
|
||||
|
||||
public SettingsHelper(Object preference) {
|
||||
mPreference = preference;
|
||||
setUpSettings();
|
||||
}
|
||||
|
||||
public void setUpSettings() {
|
||||
prepareListPreferenceForAutoSummary("pref_zoom");
|
||||
setUpLanguageChooser("pref_language_chooser");
|
||||
setAppVersionNumber();
|
||||
}
|
||||
|
||||
private void prepareListPreferenceForAutoSummary(String preferenceId) {
|
||||
|
||||
ListPreference prefList = (ListPreference) getPrefrence(preferenceId);
|
||||
|
||||
prefList.setDefaultValue(prefList.getEntryValues()[0]);
|
||||
String summary = prefList.getValue();
|
||||
|
||||
if (summary == null) {
|
||||
prefList.setValue((String) prefList.getEntryValues()[0]);
|
||||
summary = prefList.getValue();
|
||||
}
|
||||
|
||||
prefList.setSummary(prefList.getEntries()[prefList.findIndexOfValue(summary)]);
|
||||
prefList.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
||||
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
if (preference instanceof ListPreference) {
|
||||
ListPreference listPreference = ((ListPreference) preference);
|
||||
preference.setSummary(listPreference.getEntries()
|
||||
[listPreference.findIndexOfValue(newValue.toString())]);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void setUpLanguageChooser(String preferenceId) {
|
||||
|
||||
ListPreference languageList = (ListPreference) getPrefrence(preferenceId);
|
||||
LanguageUtils languageUtils = new LanguageUtils(getContext());
|
||||
|
||||
languageList.setTitle(Locale.getDefault().getDisplayLanguage());
|
||||
languageList.setEntries(languageUtils.getValues().toArray(new String[0]));
|
||||
languageList.setEntryValues(languageUtils.getKeys().toArray(new String[0]));
|
||||
languageList.setDefaultValue(Locale.getDefault().toString());
|
||||
languageList.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
|
||||
if (!newValue.equals(Locale.getDefault().toString())) {
|
||||
|
||||
LanguageUtils.handleLocaleChange(getContext(), newValue.toString());
|
||||
// Request a restart when the user returns to the Activity, that called this Activity
|
||||
restartActivity();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void restartActivity() {
|
||||
getContext().setResult(RESULT_RESTART);
|
||||
getContext().finish();
|
||||
getContext().startActivity(new Intent(getContext(), getContext().getClass()));
|
||||
}
|
||||
|
||||
private void setAppVersionNumber() {
|
||||
String version;
|
||||
|
||||
try {
|
||||
version = getContext().getPackageManager()
|
||||
.getPackageInfo("org.kiwix.kiwixmobile", 0).versionName;
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
return;
|
||||
}
|
||||
EditTextPreference versionPref = (EditTextPreference) getPrefrence("pref_version");
|
||||
versionPref.setSummary(version);
|
||||
}
|
||||
|
||||
private Activity getContext() {
|
||||
if (newApi()) {
|
||||
return ((PreferenceFragment) mPreference).getActivity();
|
||||
}
|
||||
|
||||
return ((PreferenceActivity) mPreference);
|
||||
}
|
||||
|
||||
private Preference getPrefrence(String preferenceId) {
|
||||
|
||||
if (newApi()) {
|
||||
return ((PreferenceFragment) mPreference).findPreference(preferenceId);
|
||||
}
|
||||
|
||||
return ((PreferenceActivity) mPreference).findPreference(preferenceId);
|
||||
}
|
||||
}
|
151
src/org/kiwix/kiwixmobile/settings/SliderPreference.java
Normal file
151
src/org/kiwix/kiwixmobile/settings/SliderPreference.java
Normal file
@ -0,0 +1,151 @@
|
||||
package org.kiwix.kiwixmobile.settings;
|
||||
|
||||
import org.kiwix.kiwixmobile.R;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.preference.DialogPreference;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.widget.SeekBar;
|
||||
import android.widget.TextView;
|
||||
|
||||
public class SliderPreference extends DialogPreference {
|
||||
|
||||
protected final static int SEEKBAR_MAX = 500;
|
||||
|
||||
protected int mSeekBarValue;
|
||||
|
||||
protected CharSequence[] mSummaries;
|
||||
|
||||
private TextView mMessage;
|
||||
|
||||
/**
|
||||
* @param context
|
||||
* @param attrs
|
||||
*/
|
||||
public SliderPreference(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
setup(context, attrs);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param context
|
||||
* @param attrs
|
||||
* @param defStyle
|
||||
*/
|
||||
public SliderPreference(Context context, AttributeSet attrs, int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
setup(context, attrs);
|
||||
}
|
||||
|
||||
private void setup(Context context, AttributeSet attrs) {
|
||||
setDialogLayoutResource(R.layout.slider_preference_dialog);
|
||||
updateSummaryText(context, attrs);
|
||||
}
|
||||
|
||||
public void updateSummaryText(Context context, AttributeSet attrs) {
|
||||
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.SliderPreference);
|
||||
try {
|
||||
setSummary(a.getTextArray(R.styleable.SliderPreference_android_summary));
|
||||
} catch (Exception e) {
|
||||
// Do nothing
|
||||
}
|
||||
a.recycle();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object onGetDefaultValue(TypedArray a, int index) {
|
||||
return a.getFloat(index, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onSetInitialValue(boolean restoreValue, Object defaultValue) {
|
||||
setValue(restoreValue ? getPersistedFloat(mSeekBarValue) : (Float) defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CharSequence getSummary() {
|
||||
if (mSummaries != null && mSummaries.length > 0) {
|
||||
double piece = SEEKBAR_MAX / mSummaries.length;
|
||||
int index = (int) (mSeekBarValue / piece);
|
||||
if (index == mSummaries.length){
|
||||
--index;
|
||||
}
|
||||
return mSummaries[index];
|
||||
} else {
|
||||
return super.getSummary();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSummary(int summaryResId) {
|
||||
try {
|
||||
//noinspection ResourceType
|
||||
setSummary(getContext().getResources().getStringArray(summaryResId));
|
||||
} catch (Exception e) {
|
||||
super.setSummary(summaryResId);
|
||||
}
|
||||
}
|
||||
|
||||
public void setSummary(CharSequence[] summaries) {
|
||||
mSummaries = summaries;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSummary(CharSequence summary) {
|
||||
super.setSummary(summary);
|
||||
}
|
||||
|
||||
public float getValue() {
|
||||
return mSeekBarValue;
|
||||
}
|
||||
|
||||
public void setValue(float value) {
|
||||
if (shouldPersist()) {
|
||||
persistFloat(value);
|
||||
}
|
||||
if (value != mSeekBarValue) {
|
||||
mSeekBarValue = (int) value;
|
||||
notifyChanged();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected View onCreateDialogView() {
|
||||
View view = super.onCreateDialogView();
|
||||
mMessage = (TextView) view.findViewById(R.id.message);
|
||||
mMessage.setText(String.valueOf(mSeekBarValue));
|
||||
SeekBar seekbar = (SeekBar) view.findViewById(R.id.slider_preference_seekbar);
|
||||
seekbar.setMax(SEEKBAR_MAX);
|
||||
seekbar.setProgress(mSeekBarValue);
|
||||
seekbar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
|
||||
|
||||
@Override
|
||||
public void onStopTrackingTouch(SeekBar seekBar) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStartTrackingTouch(SeekBar seekBar) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
|
||||
if (fromUser) {
|
||||
mSeekBarValue = progress;
|
||||
mMessage.setText(String.valueOf(mSeekBarValue));
|
||||
}
|
||||
}
|
||||
});
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDialogClosed(boolean positiveResult) {
|
||||
if (positiveResult && callChangeListener(mSeekBarValue)) {
|
||||
setValue(mSeekBarValue);
|
||||
}
|
||||
super.onDialogClosed(positiveResult);
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user