From d214ef23827fcecdbef5cb70905782e99e301e6a Mon Sep 17 00:00:00 2001 From: mhutti1 Date: Thu, 4 Aug 2016 21:01:35 +0100 Subject: [PATCH] Android First attempt at improving welcome #27 --- CHANGELOG | 1 + assets/www/static.css | 8 +- res/raw/welcome.html | 76 +++++++++++++------ .../kiwixmobile/KiwixMobileActivity.java | 25 ++++-- .../kiwix/kiwixmobile/ZimManageActivity.java | 5 ++ 5 files changed, 81 insertions(+), 34 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 1f2e2be0e..db795c713 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -6,6 +6,7 @@ NEW: Download manager NEW: Improved ZIM management NEW: Build against newer version of Android NDK/SDK NEW: Bookmarks for multiple articles with the same title can be created +NEW: Splash Screen and improved Welcome Screen FIXED: Opening problem with ZIM filenames with special characters FIXED: Useless "w820dp" language FIXED: Failing he, id, yi locales diff --git a/assets/www/static.css b/assets/www/static.css index 863d96e85..882e502d7 100644 --- a/assets/www/static.css +++ b/assets/www/static.css @@ -12,7 +12,6 @@ body { font-family: georgia,times new roman,serif; color: #666666; font-size: 90%; - background: none repeat scroll 0 0 #EEF8FB; } h1, h2 { @@ -87,9 +86,10 @@ a.button:hover { } img { - width: 30%; - max-width: 100px; - float: right; + width: 80%; + display: block; + margin: auto; + padding: 0.4em; } div.alert { diff --git a/res/raw/welcome.html b/res/raw/welcome.html index 002553b5f..fec53139b 100644 --- a/res/raw/welcome.html +++ b/res/raw/welcome.html @@ -11,45 +11,71 @@ - + + Get Content
-

1. Download Offline Files

+

Kiwix allows you offline access to websites such as Wikipedia in a highly compressed form. +

+
+

What does Kiwix do?

-

Kiwix allows to read websites like Wikipedia off-line. Try our 2.4MB - Wikipedia demo file containing a few articles about singer Ray Charles from the - English Wikipedia:

- Ray-Charles-Demo.zim +

Kiwix is an offline content reader. It acts very much like a browser but instead + of accessing online web pages, it reads content from a file in ZIM + format.

-

Offline content is available at kiwix.org. You can - create your own books in Wikipedia, refer to the help for further details.

- -
Warning! This download will take place in - your browser. Don't forget to come back to Kiwix once download is complete! -
+

While Kiwix has been originaly designed to provide Wikipedia offline, it also reads other + contents.

-
-

2. Take a drink break!

- +
+

Where is the content?

-

Downloads can take a long time, go mind your regular business and come back once - done.

+

Our content is hosted on the kiwix website.

+ +

They are available as ZIM files. There are a lot of them:

+
    +
  • Wikipedia is available separately for each language
  • +
  • Other contents like Wikileaks or Wikisource are also available
  • +
+ +

You can either download your choosen ZIM files in-app or carefuly select the one(s) you want and + download from a Desktop computer before transfering the ZIM files to your SD card.

+ +

ZIM files download in-app are located in the external storage directory in a folder entitled Kiwix.

-
-

3. Open the file in Kiwix!

+
+

How to use large ZIM files?

-

Click the Open File - button in the toolbar at the top and select the ZIM file you downloaded. That's - It!

+

If your ZIM file is larger than 4GB, you might not be able to store it on your SD card + due to filesystem limitations.

+ +

Downloading in-app automaticaly handles larger files, splitting them up for you. -

Now, enjoy your content, and take a look at the help page once bored.

+

If however you are downloading on another device, you may need to split the ZIM file up using the fololwing software:

+
    +
  • On Microsoft Windows: HJ-Split +
  • +
  • On Apple Mac OSX: Split&Concat +
  • +
  • On GNU/Linux and with the console: split --bytes=4000M my_big_file.zim +
  • +
+

Note: your resulting files must be named my_big_file.zimaa, + my_big_file.zimab, etc.

+
+

Thank you for choosing Kiwix!

+ +

We are glad to have you on board and would appreciate any feedback or suggestions.

+
+ +
diff --git a/src/org/kiwix/kiwixmobile/KiwixMobileActivity.java b/src/org/kiwix/kiwixmobile/KiwixMobileActivity.java index d634bb5dc..4250222a6 100644 --- a/src/org/kiwix/kiwixmobile/KiwixMobileActivity.java +++ b/src/org/kiwix/kiwixmobile/KiwixMobileActivity.java @@ -80,6 +80,7 @@ import android.widget.RelativeLayout; import android.widget.TextView; import android.widget.Toast; + import org.json.JSONArray; import org.kiwix.kiwixmobile.database.BookmarksDao; import org.kiwix.kiwixmobile.database.KiwixDatabase; @@ -454,7 +455,6 @@ public class KiwixMobileActivity extends AppCompatActivity { loadPrefs(); updateTitle(ZimContentProvider.getZimFileTitle()); - if (IS_WIDGET_STAR && ZimContentProvider.getId() != null) { goToBookmarks(); } else if (IS_WIDGET_SEARCH_INTENT && ZimContentProvider.getId() != null) { @@ -920,7 +920,8 @@ public class KiwixMobileActivity extends AppCompatActivity { // Load from resource. Use with base url as else no images can be embedded. // Note that this leads inclusion of welcome page in browser history // This is not perfect, but good enough. (and would be significant effort to remove file) - getCurrentWebView().loadUrl("file:///android_res/raw/help.html"); + newTab(); + getCurrentWebView().loadUrl("file:///android_res/raw/welcome.html"); } } @@ -1540,6 +1541,22 @@ public class KiwixMobileActivity extends AppCompatActivity { startActivityForResult(target, REQUEST_FILE_SELECT); } + public void downloadZimFiles() { + refreshBookmarks(); + final Intent target = new Intent(this, ZimManageActivity.class); + target.setAction(Intent.ACTION_GET_CONTENT); + target.putExtra(ZimManageActivity.TAB_EXTRA,1); + // The MIME data type filter + target.setType("//"); + // Only return URIs that can be opened with ContentResolver + target.addCategory(Intent.CATEGORY_OPENABLE); + // Force use of our file selection component. + // (Note may make sense to just define a custom intent instead) + + startActivityForResult(target, REQUEST_FILE_SELECT); + } + + public void selectSettings() { final String zimFile = ZimContentProvider.getZimFile(); Intent i = new Intent(this, KiwixSettingsActivity.class); @@ -1761,9 +1778,7 @@ public class KiwixMobileActivity extends AppCompatActivity { } else if (url.startsWith(ZimContentProvider.UI_URI.toString())) { // To handle links which access user interface (i.p. used in help page) if (url.equals(ZimContentProvider.UI_URI.toString() + "selectzimfile")) { - manageZimFiles(); - } else if (url.equals(ZimContentProvider.UI_URI.toString() + "gotohelp")) { - showHelp(); + downloadZimFiles(); } else { Log.e(TAG_KIWIX, "UI Url " + url + " not supported."); } diff --git a/src/org/kiwix/kiwixmobile/ZimManageActivity.java b/src/org/kiwix/kiwixmobile/ZimManageActivity.java index 06bcbe8bd..d9d2086d0 100644 --- a/src/org/kiwix/kiwixmobile/ZimManageActivity.java +++ b/src/org/kiwix/kiwixmobile/ZimManageActivity.java @@ -56,6 +56,8 @@ public class ZimManageActivity extends AppCompatActivity { public boolean downloading = false; + public static final String TAB_EXTRA = "TAB"; + private Menu mMenu; @@ -77,6 +79,9 @@ public class ZimManageActivity extends AppCompatActivity { TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs); tabLayout.setupWithViewPager(mViewPager); + getIntent().getIntExtra(TAB_EXTRA,0); + mViewPager.setCurrentItem(getIntent().getIntExtra(TAB_EXTRA,0)); + } private void setUpToolbar() {