A hungry fox saw some fine bunches of grapes hanging from a vine that was trained along a high trellis and did his best to reach them by jumping as high as he could into the air. But it was all in vain for they were just out of reach. So he gave up trying and walked away with an air of dignity and unconcern remarking 'I thought those grapes were ripe but I see now they are quite sour'.
12 |
13 |
14 |
--------------------------------------------------------------------------------
/assets/book/02.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mbharadwaj/BakerAndroid/0403b0e2d8f954eda2349b8520dce23400482b67/assets/book/02.jpg
--------------------------------------------------------------------------------
/assets/book/css/book.css:
--------------------------------------------------------------------------------
1 | body {
2 | font-family: Arial, sans-serif;
3 | font-size: 75%;
4 | }
5 |
6 | #wrapper {
7 | border: 0px;
8 | width: 100%;
9 | height: 100%;
10 | }
11 |
12 | #wrapper h1 {
13 | font-size: 1.8em;
14 | text-align: center;
15 | }
16 |
17 | #wrapper h2 {
18 | font-size: 1.6em;
19 | text-align: center;
20 | }
21 |
22 | #wrapper p {
23 | font-size: 1.2em;
24 | text-align: left;
25 | }
26 |
27 | #wrapper img.left {
28 | float: left;
29 | padding: 5px 10px 0 0;
30 | width: 50%;
31 | height: 50%;
32 | }
33 |
34 | #wrapper img.right {
35 | float: right;
36 | padding: 5px 0 0 10px;
37 | width: 50%;
38 | height: 50%;
39 | }
40 |
41 | #wrapper img.center {
42 | float: center;
43 | width: 50%;
44 | height: 50%;
45 | }
46 |
47 | #wrapper img.cover {
48 | float: center;
49 | padding: 10px;
50 | width: 50%;
51 | height: 50%;
52 | }
53 |
--------------------------------------------------------------------------------
/build.properties:
--------------------------------------------------------------------------------
1 | # This file is used to override default values used by the Ant build system.
2 | #
3 | # This file must be checked in Version Control Systems, as it is
4 | # integral to the build system of your project.
5 |
6 | # This file is only used by the Ant script.
7 |
8 | # You can use this to override default values such as
9 | # 'source.dir' for the location of your java source folder and
10 | # 'out.dir' for the location of your output folder.
11 |
12 | # You can also use it define how the release builds are signed by declaring
13 | # the following properties:
14 | # 'key.store' for the location of your keystore and
15 | # 'key.alias' for the name of the key to use.
16 | # The password will be asked during the build when you use the 'release' target.
17 |
18 |
--------------------------------------------------------------------------------
/build.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
8 |
9 |
10 |
27 |
28 |
29 |
33 |
34 |
35 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
47 |
48 |
50 |
62 |
63 |
64 |
82 |
83 |
84 |
85 |
--------------------------------------------------------------------------------
/default.properties:
--------------------------------------------------------------------------------
1 | # This file is automatically generated by Android Tools.
2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3 | #
4 | # This file must be checked in Version Control Systems.
5 | #
6 | # To customize properties used by the Ant build system use,
7 | # "build.properties", and override values to adapt the script to your
8 | # project structure.
9 |
10 | # Project target.
11 | target=android-9
12 |
--------------------------------------------------------------------------------
/local.properties:
--------------------------------------------------------------------------------
1 | # This file is automatically generated by Android Tools.
2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3 | #
4 | # This file must *NOT* be checked in Version Control Systems,
5 | # as it contains information specific to your local configuration.
6 |
7 | # location of the SDK. This is only used by Ant
8 | # For customization when using a Version Control System, please read the
9 | # header note.
10 | sdk.dir=/Users/mbharadwaj/android-sdk-mac_86
11 |
--------------------------------------------------------------------------------
/out/production/BakerAndroid/BakerAndroid.apk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mbharadwaj/BakerAndroid/0403b0e2d8f954eda2349b8520dce23400482b67/out/production/BakerAndroid/BakerAndroid.apk
--------------------------------------------------------------------------------
/out/production/BakerAndroid/BakerAndroid.apk.res:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mbharadwaj/BakerAndroid/0403b0e2d8f954eda2349b8520dce23400482b67/out/production/BakerAndroid/BakerAndroid.apk.res
--------------------------------------------------------------------------------
/out/production/BakerAndroid/BakerAndroid.apk.unaligned:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mbharadwaj/BakerAndroid/0403b0e2d8f954eda2349b8520dce23400482b67/out/production/BakerAndroid/BakerAndroid.apk.unaligned
--------------------------------------------------------------------------------
/out/production/BakerAndroid/classes.dex:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mbharadwaj/BakerAndroid/0403b0e2d8f954eda2349b8520dce23400482b67/out/production/BakerAndroid/classes.dex
--------------------------------------------------------------------------------
/out/production/BakerAndroid/com/nineapp/android/baker/MainActivity$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mbharadwaj/BakerAndroid/0403b0e2d8f954eda2349b8520dce23400482b67/out/production/BakerAndroid/com/nineapp/android/baker/MainActivity$1.class
--------------------------------------------------------------------------------
/out/production/BakerAndroid/com/nineapp/android/baker/MainActivity.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mbharadwaj/BakerAndroid/0403b0e2d8f954eda2349b8520dce23400482b67/out/production/BakerAndroid/com/nineapp/android/baker/MainActivity.class
--------------------------------------------------------------------------------
/out/production/BakerAndroid/com/nineapp/android/baker/R$attr.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mbharadwaj/BakerAndroid/0403b0e2d8f954eda2349b8520dce23400482b67/out/production/BakerAndroid/com/nineapp/android/baker/R$attr.class
--------------------------------------------------------------------------------
/out/production/BakerAndroid/com/nineapp/android/baker/R$drawable.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mbharadwaj/BakerAndroid/0403b0e2d8f954eda2349b8520dce23400482b67/out/production/BakerAndroid/com/nineapp/android/baker/R$drawable.class
--------------------------------------------------------------------------------
/out/production/BakerAndroid/com/nineapp/android/baker/R$id.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mbharadwaj/BakerAndroid/0403b0e2d8f954eda2349b8520dce23400482b67/out/production/BakerAndroid/com/nineapp/android/baker/R$id.class
--------------------------------------------------------------------------------
/out/production/BakerAndroid/com/nineapp/android/baker/R$layout.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mbharadwaj/BakerAndroid/0403b0e2d8f954eda2349b8520dce23400482b67/out/production/BakerAndroid/com/nineapp/android/baker/R$layout.class
--------------------------------------------------------------------------------
/out/production/BakerAndroid/com/nineapp/android/baker/R$string.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mbharadwaj/BakerAndroid/0403b0e2d8f954eda2349b8520dce23400482b67/out/production/BakerAndroid/com/nineapp/android/baker/R$string.class
--------------------------------------------------------------------------------
/out/production/BakerAndroid/com/nineapp/android/baker/R.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mbharadwaj/BakerAndroid/0403b0e2d8f954eda2349b8520dce23400482b67/out/production/BakerAndroid/com/nineapp/android/baker/R.class
--------------------------------------------------------------------------------
/proguard.cfg:
--------------------------------------------------------------------------------
1 | -optimizationpasses 5
2 | -dontusemixedcaseclassnames
3 | -dontskipnonpubliclibraryclasses
4 | -dontpreverify
5 | -verbose
6 | -optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
7 |
8 | -keep public class * extends android.app.Activity
9 | -keep public class * extends android.app.Application
10 | -keep public class * extends android.app.Service
11 | -keep public class * extends android.content.BroadcastReceiver
12 | -keep public class * extends android.content.ContentProvider
13 | -keep public class com.android.vending.licensing.ILicensingService
14 |
15 | -keepclasseswithmembernames class * {
16 | native ;
17 | }
18 |
19 | -keepclasseswithmembernames class * {
20 | public (android.content.Context, android.util.AttributeSet);
21 | }
22 |
23 | -keepclasseswithmembernames class * {
24 | public (android.content.Context, android.util.AttributeSet, int);
25 | }
26 |
27 | -keepclassmembers enum * {
28 | public static **[] values();
29 | public static ** valueOf(java.lang.String);
30 | }
31 |
32 | -keep class * implements android.os.Parcelable {
33 | public static final android.os.Parcelable$Creator *;
34 | }
35 |
--------------------------------------------------------------------------------
/res/drawable-hdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mbharadwaj/BakerAndroid/0403b0e2d8f954eda2349b8520dce23400482b67/res/drawable-hdpi/icon.png
--------------------------------------------------------------------------------
/res/drawable-ldpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mbharadwaj/BakerAndroid/0403b0e2d8f954eda2349b8520dce23400482b67/res/drawable-ldpi/icon.png
--------------------------------------------------------------------------------
/res/drawable-mdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mbharadwaj/BakerAndroid/0403b0e2d8f954eda2349b8520dce23400482b67/res/drawable-mdpi/icon.png
--------------------------------------------------------------------------------
/res/layout/main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | MainActivity
4 |
5 |
--------------------------------------------------------------------------------
/src/com/nineapp/android/baker/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.nineapp.android.baker;
2 |
3 | import android.app.Activity;
4 | import android.os.Bundle;
5 | import android.view.Display;
6 | import android.view.MotionEvent;
7 | import android.view.View;
8 | import android.webkit.WebSettings;
9 | import android.webkit.WebView;
10 |
11 | import java.io.IOException;
12 | import java.util.ArrayList;
13 | import java.util.List;
14 |
15 | public class MainActivity extends Activity {
16 | private final int THRESHOLD_TEN = 10;
17 | private final double TWENTY_PERCENT = 0.2;
18 | private final double THIRTY_PERCENT = 0.3;
19 | private final double SEVENTY_PERCENT = 0.7;
20 | private final double EIGHTY_PERCENT = 0.8;
21 |
22 |
23 | private float downXValue;
24 | private float downYValue;
25 |
26 | private int numberOfPages;
27 | private int currentPage = -1;
28 |
29 | private WebView webView;
30 | List htmlFiles;
31 |
32 | @Override
33 | public void onCreate(Bundle savedInstanceState) {
34 | super.onCreate(savedInstanceState);
35 | setContentView(R.layout.main);
36 |
37 | htmlFiles = loadBook();
38 | numberOfPages = htmlFiles.size();
39 |
40 | webView = (WebView) findViewById(R.id.webview);
41 | final WebSettings settings = webView.getSettings();
42 | settings.setJavaScriptEnabled(true);
43 |
44 | webView.setOnTouchListener(new View.OnTouchListener() {
45 | public boolean onTouch(View view, MotionEvent motionEvent) {
46 | return handleTouch(view, motionEvent);
47 | }
48 | });
49 |
50 | showNextPage();
51 | }
52 |
53 | private void showNextPage() {
54 | currentPage++;
55 | if (currentPage > numberOfPages - 1) {
56 | currentPage = numberOfPages - 1;
57 | }
58 | webView.loadUrl(String.format("file:///android_asset/book/%s", htmlFiles.get(currentPage)));
59 | }
60 |
61 | private void showPreviousPage() {
62 | currentPage--;
63 | if (currentPage < 0) {
64 | currentPage = 0;
65 | }
66 | webView.loadUrl(String.format("file:///android_asset/book/%s", htmlFiles.get(currentPage)));
67 | }
68 |
69 | private List loadBook() {
70 | List htmlFiles = new ArrayList();
71 | try {
72 | String[] files = getAssets().list("book");
73 | for (String file : files) {
74 | if (file.endsWith(".html")) {
75 | htmlFiles.add(file);
76 | }
77 | }
78 | } catch (IOException e) {
79 | e.printStackTrace();
80 | }
81 | return htmlFiles;
82 |
83 | }
84 |
85 | private boolean handleTouch(View v, MotionEvent evt) {
86 | switch (evt.getAction() & MotionEvent.ACTION_MASK) {
87 | case MotionEvent.ACTION_DOWN:
88 | downXValue = evt.getRawX();
89 | downYValue = evt.getRawY();
90 | Display display = getWindowManager().getDefaultDisplay();
91 | int width = display.getWidth();
92 | double xNavLowBound = width * TWENTY_PERCENT;
93 | double xNavMidLowBound = width * THIRTY_PERCENT;
94 | double xNavMidUpBound = width * SEVENTY_PERCENT;
95 | double xNavUpBound = width * EIGHTY_PERCENT;
96 | int height = display.getHeight();
97 | double yNavLowBound = height * TWENTY_PERCENT;
98 | double yNavMidLowBound = height * THIRTY_PERCENT;
99 | double yNavMidUpBound = height * SEVENTY_PERCENT;
100 | double yNavUpBound = height * EIGHTY_PERCENT;
101 | final boolean xIsToLeftOfScreen = downXValue < xNavLowBound;
102 | final boolean xIsToRightOfScreen = downXValue > xNavUpBound;
103 | final boolean yIsToTopOfScreen = downYValue < yNavMidLowBound;
104 | final boolean xIsMiddleOfScreen = isBetween(downXValue, xNavMidLowBound, xNavMidUpBound);
105 | final boolean yIsMiddleOfScreen = isBetween(downYValue, yNavMidLowBound, yNavMidUpBound);
106 | if (xIsToLeftOfScreen && yIsMiddleOfScreen) {
107 | showPreviousPage();
108 | } else if (xIsToRightOfScreen && yIsMiddleOfScreen) {
109 | showNextPage();
110 | }
111 | break;
112 | case MotionEvent.ACTION_UP:
113 | float currentX = evt.getRawX();
114 | float difference = Math.abs(downXValue - currentX);
115 |
116 | if ((downXValue < currentX) && (difference > THRESHOLD_TEN)) {
117 | showPreviousPage();
118 | }
119 |
120 | if ((downXValue > currentX) && (difference > THRESHOLD_TEN)) {
121 | showNextPage();
122 | }
123 | break;
124 | }
125 | return true;
126 | }
127 |
128 | private boolean isBetween(float xy, double lower, double upper) {
129 | return (xy > lower) && (xy < upper);
130 | }
131 |
132 | }
133 |
--------------------------------------------------------------------------------