rhodes 7.5.1 → 7.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (180) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +319 -0
  3. data/README.md +3 -15
  4. data/Rakefile +3 -0
  5. data/appveyor.yml +37 -32
  6. data/azure-pipelines.yml +1 -1
  7. data/bin/rhodes-setup +22 -8
  8. data/extensions/emdk3-manager/ext/platform/android/src/com/rho/emdk3/EMDK3Extension.java +14 -5
  9. data/extensions/instrumentation/ext/platform/android/src/com/rho/instrumentation/Instrumentation.java +29 -15
  10. data/extensions/rhoconnect-push/ext/rhoconnect-push/platform/android/src/com/rhomobile/rhoelements/ans/ANSManager.java +1 -1
  11. data/extensions/rhoelementsext/ext/rhoelementsext/platform/android/rhoelements_temp/src/com/rho/rhoelements/ElementsCore.java +12 -9
  12. data/extensions/rhoelementsext/ext/rhoelementsext/platform/android/rhoelements_temp/src/com/rho/rhoelements/graphics/BatteryIndicator.java +2 -2
  13. data/lib/commonAPI/barcode/ext/platform/qt/Barcode.pro +1 -1
  14. data/lib/commonAPI/barcode/ext/platform/qt/Barcode.pro.erb +2 -2
  15. data/lib/commonAPI/barcode/ext/platform/qt/src/qzxing/QZXing.pri +9 -21
  16. data/lib/commonAPI/barcode/ext.yml +1 -0
  17. data/lib/commonAPI/bluetooth/ext/platform/qt/Bluetooth.pro +1 -1
  18. data/lib/commonAPI/bluetooth/ext/platform/qt/Bluetooth.pro.erb +1 -1
  19. data/lib/commonAPI/bluetooth/ext/platform/qt/src/bluetooth/bluetoothhelper.h +1 -1
  20. data/lib/commonAPI/coreapi/RhoSystemApi.rb +6 -0
  21. data/lib/commonAPI/coreapi/ext/Intent.xml +4 -0
  22. data/lib/commonAPI/coreapi/ext/platform/android/src/com/rho/intent/IntentSingleton.java +6 -0
  23. data/lib/commonAPI/coreapi/ext/platform/android/src/com/rho/notification/Notification.java +2 -1
  24. data/lib/commonAPI/coreapi/ext/platform/android/src/com/rho/notification/NotificationScheduler.java +1 -1
  25. data/lib/commonAPI/coreapi/ext/platform/android/src/com/rho/webview/WebViewSingleton.java +40 -27
  26. data/lib/commonAPI/coreapi/ext/platform/iphone/cpp_based_impl/SystemImpl.mm +5 -6
  27. data/lib/commonAPI/coreapi/ext/platform/iphone/impl/Intent.h +1 -1
  28. data/lib/commonAPI/coreapi/ext/platform/iphone/impl/Intent.m +3 -1
  29. data/lib/commonAPI/coreapi/ext/platform/iphone/impl/NotificationSingleton.h +2 -1
  30. data/lib/commonAPI/coreapi/ext/platform/iphone/impl/NotificationSingleton.m +10 -0
  31. data/lib/commonAPI/coreapi/ext/platform/wm/src/IntentImpl.cpp +3 -0
  32. data/lib/commonAPI/coreapi/ext/shared/SystemImplBase.cpp +13 -0
  33. data/lib/commonAPI/coreapi/ext/shared/SystemImplBase.h +2 -0
  34. data/lib/commonAPI/coreapi/ext/system.xml +3 -0
  35. data/lib/commonAPI/mediacapture/ext/platform/android/ApplicationCameraActivity.erb +2 -2
  36. data/lib/commonAPI/mediacapture/ext/platform/android/ApplicationFileProvider.erb +1 -1
  37. data/lib/commonAPI/mediacapture/ext/platform/android/ext_java.files +1 -0
  38. data/lib/commonAPI/mediacapture/ext/platform/android/src/com/rho/camera/CameraObject.java +8 -4
  39. data/lib/commonAPI/mediacapture/ext/platform/android/src/com/rho/camera/CameraRhoListener.java +8 -0
  40. data/lib/commonAPI/mediacapture/ext/platform/android/src/com/rho/mediacapture/RhoCameraFileProvider.java +6 -0
  41. data/lib/commonAPI/mediacapture/ext/platform/qt/MediaCapture.pro.erb +1 -1
  42. data/lib/commonAPI/mediacapture/ext/platform/qt/Mediacapture.pro +1 -1
  43. data/lib/commonAPI/signature/ext/platform/iphone/impl/readme.txt +7 -0
  44. data/lib/commonAPI/signature/ext/platform/qt/Signature.pro +3 -10
  45. data/lib/commonAPI/signature/ext/platform/qt/Signature.pro.erb +2 -2
  46. data/lib/extensions/fcm-push/ext/iphone/Podfile +15 -2
  47. data/lib/extensions/fcm-push/ext/iphone/fcm-push.xcodeproj/project.pbxproj +6 -7
  48. data/lib/extensions/nfc/ext/platform/android/src/com/rhomobile/nfc/Nfc.java +2 -1
  49. data/lib/extensions/serialport/ext/serialport.pro +1 -1
  50. data/platform/android/Rhodes/jni/include/rhodes/JNIRhodes.h +1 -0
  51. data/platform/android/Rhodes/jni/src/fileapi.cpp +4 -0
  52. data/platform/android/Rhodes/res/drawable/baseline_check_24.xml +5 -0
  53. data/platform/android/Rhodes/res/drawable/baseline_check_240.xml +5 -0
  54. data/platform/android/Rhodes/res/drawable/baseline_close_24.xml +5 -0
  55. data/platform/android/Rhodes/res/drawable/baseline_close_240.xml +5 -0
  56. data/platform/android/Rhodes/res/layout/overlay_layout.xml +39 -0
  57. data/platform/android/Rhodes/res/layout/perrmission_alert_dialog.xml +267 -0
  58. data/platform/android/Rhodes/src/com/rhomobile/rhodes/BaseActivity.java +183 -66
  59. data/platform/android/Rhodes/src/com/rhomobile/rhodes/LocalFileProvider.java +38 -6
  60. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhoFileProvider.java +32 -0
  61. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesActivity.java +529 -89
  62. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesApplication.java +26 -4
  63. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesService.java +256 -160
  64. data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/AbstractRhoExtension.java +14 -3
  65. data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/IRhoExtManager.java +4 -0
  66. data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/IRhoExtension.java +5 -4
  67. data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/RhoExtManagerImpl.java +79 -38
  68. data/platform/android/Rhodes/src/com/rhomobile/rhodes/geolocation/GeoLocation.java +6 -1
  69. data/platform/android/Rhodes/src/com/rhomobile/rhodes/kioskservices/CallReceiver.java +22 -0
  70. data/platform/android/Rhodes/src/com/rhomobile/rhodes/kioskservices/IKioskMode.java +11 -0
  71. data/platform/android/Rhodes/src/com/rhomobile/rhodes/kioskservices/KioskManager.java +18 -0
  72. data/platform/android/Rhodes/src/com/rhomobile/rhodes/kioskservices/MyAccessibilityService.java +230 -0
  73. data/platform/android/Rhodes/src/com/rhomobile/rhodes/kioskservices/MyNotificationListenerService.java +16 -0
  74. data/platform/android/Rhodes/src/com/rhomobile/rhodes/kioskservices/MyOverlayService.java +197 -0
  75. data/platform/android/Rhodes/src/com/rhomobile/rhodes/kioskservices/PermissionManager.java +232 -0
  76. data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/SimpleMainView.java +34 -8
  77. data/platform/android/Rhodes/src/com/rhomobile/rhodes/permissioncheck/CheckDrawable.java +53 -0
  78. data/platform/android/Rhodes/src/com/rhomobile/rhodes/permissioncheck/PermissionListGenerate.java +366 -0
  79. data/platform/android/Rhodes/src/com/rhomobile/rhodes/rhodes.iml +11 -0
  80. data/platform/android/Rhodes/src/com/rhomobile/rhodes/socket/SSLImpl.java +1 -0
  81. data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/GoogleWebView.java +782 -41
  82. data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/RhoInputConnectionWrapper.java +146 -0
  83. data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/RhoInputListener.java +21 -0
  84. data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/RhoWebViewClient.java +92 -32
  85. data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/TauWebViewOptions.java +118 -0
  86. data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/WebSettingsProviderBase.java +18 -17
  87. data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/WebSettingsProviderEclairMR1.java +4 -4
  88. data/platform/android/build/RhodesSRC_build.files +13 -0
  89. data/platform/android/build/android-repack.rake +8 -1
  90. data/platform/android/build/android.rake +118 -51
  91. data/platform/android/build/android_tools.rb +1 -1
  92. data/platform/android/build/androidcommon.rb +13 -7
  93. data/platform/android/build/config.yml +4 -1
  94. data/platform/android/build/manifest_generator.rb +14 -10
  95. data/platform/android/build/maven_deps_extractor.rb +7 -1
  96. data/platform/android/build/ndkwrapper.rb +12 -0
  97. data/platform/android/proguard/proguard-base-rules.pro +5 -0
  98. data/platform/android/proguard/proguard.jar +0 -0
  99. data/platform/iphone/Classes/RhoAppBaseLib-Bridging-Header.h +4 -0
  100. data/platform/iphone/Classes/RhoAppBaseStandaloneLib-Bridging-Header.h +4 -0
  101. data/platform/iphone/Classes/RhoCryptAESGCM.swift +105 -0
  102. data/platform/iphone/Classes/RhoUIWebView.h +1 -1
  103. data/platform/iphone/Classes/RhoUIWebView.m +1 -1
  104. data/platform/iphone/Classes/RhoWKWebView.h +1 -1
  105. data/platform/iphone/Classes/RhoWKWebView.mm +32 -4
  106. data/platform/iphone/Classes/RhoWebView.h +1 -1
  107. data/platform/iphone/Classes/RhoWebViewFabrique.m +7 -1
  108. data/platform/iphone/Classes/SimpleMainView.m +5 -5
  109. data/platform/iphone/Classes/URLProtocol/CRhoURLProtocol.m +21 -10
  110. data/platform/iphone/Classes/rho/net/IPhoneNetRequest.mm +4 -0
  111. data/platform/iphone/Framework/RhoApplication/RhoApplication.xcodeproj/project.pbxproj +1 -1
  112. data/platform/iphone/Framework/Rhodes/Rhodes.xcodeproj/project.pbxproj +1 -1
  113. data/platform/iphone/RhoAppBaseLib/RhoAppBaseLib.xcodeproj/project.pbxproj +46 -1
  114. data/platform/iphone/RhoLib/RhoLib.xcodeproj/project.pbxproj +1 -1
  115. data/platform/iphone/curl/curl.xcodeproj/project.pbxproj +4 -1
  116. data/platform/iphone/rbuild/iphone.rake +9 -8
  117. data/platform/iphone/rhoextlib/rhoextlib.xcodeproj/project.pbxproj +4 -1
  118. data/platform/iphone/rhorubylib/rhorubylib.xcodeproj/project.pbxproj +1 -1
  119. data/platform/iphone/rhosynclib/rhosynclib.xcodeproj/project.pbxproj +1 -1
  120. data/platform/osx/bin/RhoSimulator/RhoSimulator.app.zip +0 -0
  121. data/platform/sailfish/build/{harbour-SailfishRhodes.pro.erb → SailfishRhodes.pro.erb} +10 -17
  122. data/platform/sailfish/build/rhodes.pro.erb +7 -17
  123. data/platform/sailfish/build/rpm/SailfishRhodes.desktop.erb +12 -0
  124. data/platform/sailfish/build/rpm/SailfishRhodes.erb +2 -0
  125. data/platform/sailfish/build/rpm/SailfishRhodes.spec.erb +43 -0
  126. data/platform/sailfish/build/rubylib.pro.erb +29 -29
  127. data/platform/sailfish/build/sailfish.rake +188 -180
  128. data/platform/sailfish/keys/regular_cert.pem +14 -0
  129. data/platform/sailfish/keys/regular_key.pem +4 -0
  130. data/platform/shared/common/RhodesApp.cpp +33 -9
  131. data/platform/shared/common/iphone/RhoCryptImpl.mm +130 -54
  132. data/platform/shared/qt/RhoSimulator.pro +1 -1
  133. data/platform/shared/qt/rhodes/rhodes.pro +4 -11
  134. data/platform/shared/qt/sailfish/SailfishRhodes.desktop +3 -4
  135. data/platform/shared/qt/sailfish/SailfishRhodes.pro +9 -10
  136. data/platform/shared/qt/sailfish/icons/108x108/108x108.png +0 -0
  137. data/platform/shared/qt/sailfish/privileges/sailfishrhodes +2 -0
  138. data/platform/shared/qt/sailfish/qml/pages/FirstPageWK.qml +7 -11
  139. data/platform/shared/qt/sailfish/qml/{harbour-sailfishrhodes.qml → sailfishrhodes.qml} +1 -1
  140. data/platform/shared/qt/sailfish/rpm/sailfishrhodes.spec +80 -0
  141. data/platform/shared/qt/sailfish/rpm/{harbour-sailfishrhodes.yaml → sailfishrhodes.yaml} +2 -2
  142. data/platform/shared/qt/sailfish/src/QtMainWindow.cpp +1 -1
  143. data/platform/shared/qt/sailfish/src/QtMainWindow.h +1 -1
  144. data/platform/shared/qt/sailfish/src/main.cpp +6 -38
  145. data/platform/shared/qt/sailfish/src/rootdelegate.h +2 -14
  146. data/platform/shared/ruby/aurora/ruby/config.h +386 -0
  147. data/platform/shared/ruby/aurora/ruby/constdefs.c +5866 -0
  148. data/platform/shared/ruby/aurora/ruby/constdefs.h +1788 -0
  149. data/platform/shared/sqlite/crypto.c +14 -0
  150. data/platform/win32/RhoSimulator/RhoSimulator.exe +0 -0
  151. data/platform/win32/build/rhodes.nsi +3 -3
  152. data/platform/win32/build/win32.rake +1 -1
  153. data/rakefile.rb +3 -0
  154. data/res/build-tools/iphonesim/build/Release/iphonesim_8 +4 -4
  155. data/res/generators/templates/application/AndroidManifest.erb +26 -5
  156. data/res/generators/templates/application/build.yml +14 -10
  157. data/res/generators/templates/application/resources/android/res/xml/provider_paths.xml +4 -0
  158. data/res/generators/templates/application/rhoconfig.txt +10 -1
  159. data/res/generators/templates/iphone_project/Bremen8.xcodeproj/project.pbxproj +24 -1
  160. data/res/generators/templates/iphone_project/Classes/SimpleSwiftClass.swift +20 -0
  161. data/res/generators/templates/iphone_project/Classes/rhorunner-Bridging-Header.h +4 -0
  162. data/rhobuild.yml.example +3 -3
  163. data/rhodes.gemspec +4 -2
  164. data/version +1 -1
  165. metadata +81 -26
  166. data/platform/sailfish/build/rho_build.cmd.erb +0 -14
  167. data/platform/sailfish/build/rho_clean.cmd.erb +0 -14
  168. data/platform/sailfish/build/rho_deploy.cmd.erb +0 -15
  169. data/platform/sailfish/build/rho_rpm.cmd.erb +0 -14
  170. data/platform/sailfish/build/rho_rpmvalidation.cmd.erb +0 -14
  171. data/platform/sailfish/build/rpm/harbour-SailfishRhodes.desktop.erb +0 -7
  172. data/platform/sailfish/build/rpm/harbour-SailfishRhodes.erb +0 -2
  173. data/platform/sailfish/build/rpm/harbour-SailfishRhodes.yaml.erb +0 -37
  174. data/platform/shared/qt/sailfish/harbour-sailfishrhodes.desktop +0 -6
  175. data/platform/shared/qt/sailfish/icons/108x108/harbour-sailfishrhodes.png +0 -0
  176. data/platform/shared/qt/sailfish/privileges/harbour-sailfishrhodes +0 -2
  177. data/platform/shared/qt/sailfish/qml/pages/FirstPageWE.qml +0 -236
  178. /data/platform/shared/qt/sailfish/icons/128x128/{harbour-sailfishrhodes.png → sailfishrhodes.png} +0 -0
  179. /data/platform/shared/qt/sailfish/icons/172x172/{harbour-sailfishrhodes.png → sailfishrhodes.png} +0 -0
  180. /data/platform/shared/qt/sailfish/icons/86x86/{harbour-sailfishrhodes.png → sailfishrhodes.png} +0 -0
@@ -2,6 +2,10 @@ package com.rhomobile.rhodes.webview;
2
2
 
3
3
  import java.io.File;
4
4
  import java.io.FileOutputStream;
5
+ import java.util.Timer;
6
+ import java.util.TimerTask;
7
+ import java.util.HashMap;
8
+ import java.util.Map;
5
9
 
6
10
  import com.rhomobile.rhodes.LocalFileProvider;
7
11
  import com.rhomobile.rhodes.Logger;
@@ -14,24 +18,640 @@ import com.rhomobile.rhodes.osfunctionality.OsVersionManager;
14
18
  import com.rhomobile.rhodes.util.PerformOnUiThread;
15
19
  import com.rhomobile.rhodes.RhoConf;
16
20
 
21
+ import android.util.Log;
17
22
  import android.app.Activity;
18
23
  import android.graphics.Bitmap;
19
24
  import android.graphics.Canvas;
20
25
  import android.graphics.Picture;
26
+ import android.graphics.Rect;
21
27
  import android.net.Uri;
22
28
  import android.os.Build;
23
29
  import android.view.View;
24
30
  import android.view.ViewGroup;
31
+ import android.view.ViewGroup.LayoutParams;
25
32
  import android.webkit.URLUtil;
26
33
  import android.webkit.WebBackForwardList;
34
+ import android.webkit.WebHistoryItem;
27
35
  import android.webkit.WebChromeClient;
28
36
  import android.webkit.WebSettings;
29
37
  import android.webkit.WebViewClient;
30
38
  import android.webkit.CookieManager;
39
+ import android.view.ViewTreeObserver.OnGlobalLayoutListener;
40
+
41
+ import android.widget.EditText;
42
+ import android.widget.TextView;
43
+ import android.text.InputType;
44
+
45
+ import android.view.inputmethod.InputMethodManager;
46
+ import android.view.inputmethod.InputConnection;
47
+ import android.view.inputmethod.InputConnectionWrapper;
48
+ import android.view.inputmethod.BaseInputConnection;
49
+ import android.view.inputmethod.EditorInfo;
50
+ import android.view.inputmethod.ExtractedTextRequest;
51
+ import android.view.inputmethod.ExtractedText;
52
+ import android.view.inputmethod.CompletionInfo;
53
+ import android.view.inputmethod.CorrectionInfo;
54
+ import android.view.inputmethod.InputContentInfo;
55
+
56
+
57
+ import android.content.Context;
58
+ import android.view.View;
59
+ import android.view.WindowManager;
60
+ import android.view.Display;
61
+ import android.view.MotionEvent;
62
+
63
+ import android.content.SharedPreferences;
64
+ import android.provider.Settings;
65
+
66
+ import android.os.Looper;
67
+ import android.os.Handler;
68
+ import android.util.TypedValue;
69
+ import android.os.Bundle;
70
+ import android.view.KeyEvent;
71
+
72
+ import android.view.inputmethod.SurroundingText;
73
+
74
+ //import android.annotation.IntRange;
75
+ //import android.annotation.NonNull;
76
+ //import android.annotation.Nullable;
77
+
78
+ //import android.os.LocaleList;
79
+ //import java.util.Locale;
31
80
 
32
81
 
33
82
  public class GoogleWebView implements IRhoWebView {
34
- private static final String TAG = GoogleWebView.class.getSimpleName();
83
+ private static final String TAG = GoogleWebView.class.getSimpleName();
84
+
85
+ private static String tauSipValue = "com.tau.taubrowser/com.tau.TauKeyboard";
86
+
87
+ public static String mSavedEnabledInputMethods = null;
88
+ public static String mSavedDefaultInputMethod = null;
89
+
90
+ private boolean mIsCanRunAgain = true;
91
+
92
+ private boolean mIsShouldKillKeyboardMethodUse = true;
93
+
94
+ Timer mKillKeyboardTimer = null;
95
+
96
+ private static boolean ourShouldDisableKeyboard = false;
97
+
98
+ private OnGlobalLayoutListener mOnGlobalLayoutListener = null;
99
+
100
+
101
+
102
+
103
+ /*
104
+ public class RhoInputConnectionWrapper extends InputConnectionWrapper {
105
+ private String TAG = RhoInputConnectionWrapper.class.getSimpleName();
106
+
107
+ public RhoInputConnectionWrapper(InputConnection connection) {
108
+ super(connection, true);
109
+ }
110
+
111
+ /*
112
+ @Override
113
+ public CharSequence getTextBeforeCursor(int n, int flags) {
114
+ Logger.I(this.TAG, ".getTextBeforeCursor()");
115
+ hideAnyKeyboard();
116
+ return super.getTextBeforeCursor(n, flags);
117
+ }
118
+
119
+ @Override
120
+ public CharSequence getTextAfterCursor(int n, int flags) {
121
+ Logger.T(this.TAG, ".getTextAfterCursor()");
122
+ hideAnyKeyboard();
123
+ return super.getTextAfterCursor(n, flags);
124
+ }
125
+
126
+ @Override
127
+ public CharSequence getSelectedText(int flags) {
128
+ Logger.T(this.TAG, ".getSelectedText()");
129
+ hideAnyKeyboard();
130
+ return super.getSelectedText(flags);
131
+ }
132
+
133
+ @Override
134
+ public SurroundingText getSurroundingText(int beforeLength, int afterLength, int flags) {
135
+ Logger.T(this.TAG, ".getSurroundingText()");
136
+ hideAnyKeyboard();
137
+ return super.getSurroundingText(beforeLength, afterLength, flags);
138
+ }
139
+
140
+ @Override
141
+ public int getCursorCapsMode(int reqModes) {
142
+ Logger.T(this.TAG, ".getCursorCapsMode()");
143
+ hideAnyKeyboard();
144
+ return super.getCursorCapsMode(reqModes);
145
+ }
146
+
147
+ @Override
148
+ public ExtractedText getExtractedText(ExtractedTextRequest request, int flags) {
149
+ Logger.T(this.TAG, ".getExtractedText()");
150
+ hideAnyKeyboard();
151
+ return super.getExtractedText(request, flags);
152
+ }
153
+
154
+ @Override
155
+ public boolean setComposingText(CharSequence text, int newCursorPosition) {
156
+ Logger.T(this.TAG, ".setComposingText()");
157
+ hideAnyKeyboard();
158
+ return super.setComposingText(text, newCursorPosition);
159
+ }
160
+
161
+ //@Override
162
+ //public boolean setComposingText(@NonNull CharSequence text,
163
+ // int newCursorPosition, @Nullable TextAttribute textAttribute) {
164
+ // hideAnyKeyboard();
165
+ // return super.setComposingText(text, newCursorPosition, textAttribute);
166
+ //}
167
+
168
+ @Override
169
+ public boolean setComposingRegion(int start, int end) {
170
+ Logger.T(this.TAG, ".setComposingRegion()");
171
+ hideAnyKeyboard();
172
+ return super.setComposingRegion(start, end);
173
+ }
174
+
175
+ //@Override
176
+ //public boolean setComposingRegion(int start, int end, @Nullable TextAttribute textAttribute) {
177
+ // hideAnyKeyboard();
178
+ // return super.setComposingRegion(start, end, textAttribute);
179
+ //}
180
+
181
+ @Override
182
+ public boolean finishComposingText() {
183
+ Logger.T(this.TAG, ".finishComposingText()");
184
+ hideAnyKeyboard();
185
+ return super.finishComposingText();
186
+ }
187
+
188
+ @Override
189
+ public boolean commitText(CharSequence text, int newCursorPosition) {
190
+ Logger.T(this.TAG, ".commitText()");
191
+ hideAnyKeyboard();
192
+ return super.commitText(text, newCursorPosition);
193
+ }
194
+
195
+ //@Override
196
+ //public boolean commitText(@NonNull CharSequence text, int newCursorPosition,
197
+ // @Nullable TextAttribute textAttribute) {
198
+ // hideAnyKeyboard();
199
+ // return super.commitText(text, newCursorPosition, textAttribute);
200
+ //}
201
+
202
+ @Override
203
+ public boolean commitCompletion(CompletionInfo text) {
204
+ Logger.T(this.TAG, ".commitCompletion()");
205
+ hideAnyKeyboard();
206
+ return super.commitCompletion(text);
207
+ }
208
+
209
+ @Override
210
+ public boolean commitCorrection(CorrectionInfo correctionInfo) {
211
+ Logger.T(this.TAG, ".commitContent()");
212
+ hideAnyKeyboard();
213
+ return super.commitCorrection(correctionInfo);
214
+ }
215
+
216
+ @Override
217
+ public boolean setSelection(int start, int end) {
218
+ Logger.T(this.TAG, ".setSelection()");
219
+ hideAnyKeyboard();
220
+ return super.setSelection(start, end);
221
+ }
222
+
223
+ @Override
224
+ public boolean performEditorAction(int editorAction) {
225
+ Logger.T(this.TAG, ".performEditorAction()");
226
+ hideAnyKeyboard();
227
+ return super.performEditorAction(editorAction);
228
+ }
229
+
230
+ @Override
231
+ public boolean performContextMenuAction(int id) {
232
+ Logger.T(this.TAG, ".performContextMenuAction()");
233
+ hideAnyKeyboard();
234
+ return super.performContextMenuAction(id);
235
+ }
236
+
237
+ @Override
238
+ public boolean beginBatchEdit() {
239
+ Logger.T(this.TAG, ".beginBatchEdit()");
240
+ hideAnyKeyboard();
241
+ return super.beginBatchEdit();
242
+ }
243
+
244
+ @Override
245
+ public boolean endBatchEdit() {
246
+ Logger.T(this.TAG, ".endBatchEdit()");
247
+ hideAnyKeyboard();
248
+ return super.endBatchEdit();
249
+ }
250
+
251
+ @Override
252
+ public boolean sendKeyEvent(KeyEvent event) {
253
+ Logger.T(this.TAG, ".sendKeyEvent()");
254
+ hideAnyKeyboard();
255
+ return super.sendKeyEvent(event);
256
+ }
257
+
258
+ @Override
259
+ public boolean clearMetaKeyStates(int states) {
260
+ Logger.T(this.TAG, ".clearMetaKeyStates()");
261
+ hideAnyKeyboard();
262
+ return super.clearMetaKeyStates(states);
263
+ }
264
+
265
+ @Override
266
+ public boolean reportFullscreenMode(boolean enabled) {
267
+ Logger.T(this.TAG, ".reportFullscreenMode()");
268
+ //hideAnyKeyboard();
269
+ boolean h = false;
270
+ try {
271
+ h = super.reportFullscreenMode(enabled);
272
+ }
273
+ catch (Exception ex) {
274
+ Logger.E(this.TAG, ".reportFullscreenMode() ERROR = "+ex.getMessage());
275
+ }
276
+ return h;
277
+ }
278
+
279
+ @Override
280
+ public boolean performSpellCheck() {
281
+ Logger.T(this.TAG, ".performSpellCheck()");
282
+ hideAnyKeyboard();
283
+ return super.performSpellCheck();
284
+ }
285
+
286
+ @Override
287
+ public boolean performPrivateCommand(String action, Bundle data) {
288
+ Logger.T(this.TAG, ".performPrivateCommand()");
289
+ hideAnyKeyboard();
290
+ return super.performPrivateCommand(action, data);
291
+ }
292
+
293
+ @Override
294
+ public boolean requestCursorUpdates(int cursorUpdateMode) {
295
+ Logger.T(this.TAG, ".requestCursorUpdates()");
296
+ hideAnyKeyboard();
297
+ return super.requestCursorUpdates(cursorUpdateMode);
298
+ }
299
+
300
+ @Override
301
+ public Handler getHandler() {
302
+ Logger.T(this.TAG, ".getHandler()");
303
+ //hideAnyKeyboard();
304
+ Handler h = null;
305
+ try {
306
+ h = super.getHandler();
307
+ }
308
+ catch (Exception ex) {
309
+ Logger.E(this.TAG, ".getHandler() ERROR = "+ex.getMessage());
310
+ }
311
+ if (h == null) {
312
+ h = new Handler(Looper.getMainLooper());
313
+ }
314
+ return h;
315
+ }
316
+
317
+ @Override
318
+ public void closeConnection() {
319
+ Logger.T(this.TAG, ".closeConnection()");
320
+ //hideAnyKeyboard();
321
+ try {
322
+ super.closeConnection();
323
+ }
324
+ catch (Exception ex) {
325
+ Logger.E(this.TAG, ".closeConnection() ERROR = "+ex.getMessage());
326
+ }
327
+ }
328
+
329
+ @Override
330
+ public boolean commitContent(InputContentInfo inputContentInfo, int flags, Bundle opts) {
331
+ Logger.T(this.TAG, ".commitContent()");
332
+ hideAnyKeyboard();
333
+ return super.commitContent(inputContentInfo, flags, opts);
334
+ }
335
+
336
+ @Override
337
+ public boolean setImeConsumesInput(boolean imeConsumesInput) {
338
+ Logger.T(this.TAG, ".setImeConsumesInput()");
339
+ hideAnyKeyboard();
340
+ return super.setImeConsumesInput(imeConsumesInput);
341
+ }
342
+
343
+ private void hideAnyKeyboard() {
344
+ if (ourShouldDisableKeyboard) {
345
+ if (mIsShouldKillKeyboardMethodUse) {
346
+ hideKeyboard();
347
+ }
348
+ }
349
+ }
350
+
351
+ }
352
+ */
353
+
354
+
355
+ public class TauWebView extends android.webkit.WebView {
356
+
357
+ private String TAG = TauWebView.class.getSimpleName();
358
+
359
+
360
+ public void setDisableKeyboard(boolean disable) {
361
+ ourShouldDisableKeyboard = disable;
362
+ if (disable) {
363
+ setupOurTauKeyboard();
364
+ }
365
+ else {
366
+ restoreKeyboardSettings();
367
+ }
368
+ }
369
+
370
+ public TauWebView(Activity activity) {
371
+ super(activity);
372
+
373
+ //if (ourShouldDisableKeyboard) {
374
+ setupOurTauKeyboard();
375
+ RhodesActivity.safeGetInstance().getWindow().setSoftInputMode(android.view.WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
376
+
377
+ //if (mIsShouldKillKeyboardMethodUse ) {
378
+ final TauWebView me = this;
379
+ setOnTouchListener(new View.OnTouchListener() {
380
+
381
+ private int mCurrentMax = 0;
382
+
383
+ @Override
384
+ public boolean onTouch(View v, MotionEvent event) {
385
+ Logger.I(TAG, "TauWebView.onTouch");
386
+ if ((event.getActionMasked() == MotionEvent.ACTION_UP) || (event.getActionMasked() == MotionEvent.ACTION_POINTER_UP)) {
387
+ if ((event.getPointerCount() == 3) && (mCurrentMax == 3)) {
388
+ RhodesActivity.onTripleTap();
389
+ }
390
+ if ((event.getPointerCount() == 4) && (mCurrentMax == 4)) {
391
+ RhodesActivity.onQuadroTap();
392
+ }
393
+ if (event.getPointerCount() == 1) {
394
+ mCurrentMax = 0;
395
+ }
396
+ }
397
+ else if (event.getAction() == MotionEvent.ACTION_CANCEL) {
398
+ mCurrentMax = 0;
399
+ }
400
+ else if ((event.getActionMasked() == MotionEvent.ACTION_DOWN) || (event.getActionMasked() == MotionEvent.ACTION_POINTER_DOWN)) {
401
+ Logger.I(TAG, "TauWebView.onTouch COUNT = " + String.valueOf(event.getPointerCount()));
402
+ if (event.getPointerCount() > mCurrentMax) {
403
+ mCurrentMax = event.getPointerCount();
404
+ }
405
+ }
406
+ //ViewGroup activityRootView = ((ViewGroup) RhodesActivity.safeGetInstance().findViewById(android.R.id.content));
407
+ //recursiveLoopChildrenForTextEdit(activityRootView);
408
+ //RhodesActivity.safeGetInstance().getWindow().setFlags( WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM,
409
+ // WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
410
+ if ( ourShouldDisableKeyboard && mIsShouldKillKeyboardMethodUse) {
411
+ hideKeyboard();
412
+ }
413
+ return false;
414
+ }
415
+ });
416
+ //}
417
+ //}
418
+ }
419
+
420
+
421
+ private boolean isAutorizationDisable = false;
422
+
423
+ public void setDisableHTTPAuthorisation(boolean sa) {
424
+ isAutorizationDisable = sa;
425
+ }
426
+
427
+
428
+
429
+ public void loadUrl(String url) {
430
+ Logger.I(this.TAG, "TauWebView.loadUrl url = " + url);
431
+ ///*
432
+ if (isAutorizationDisable) {
433
+ HashMap<String, String> extraHeaders = new HashMap<String, String>();
434
+ extraHeaders.put("Authorization", "");
435
+ //isAutorizationDisable = false;
436
+ Logger.I(this.TAG, "TauWebView.loadUrl disable Authorization !");
437
+ loadUrl(url, extraHeaders);
438
+ return;
439
+ }
440
+ //*/
441
+ super.loadUrl(url);
442
+ }
443
+
444
+ public void loadUrl (String url, Map<String, String> additionalHttpHeaders) {
445
+ Logger.I(this.TAG, "TauWebView.loadUrl url,additionalHttpHeaders = " + url);
446
+ /*
447
+ if (isAutorizationDisable) {
448
+ HashMap<String, String> extraHeaders = new HashMap<String, String>();
449
+ extraHeaders.put("Authorization", "");
450
+ isAutorizationDisable = false;
451
+ super.loadUrl(url, extraHeaders);
452
+ return;
453
+ }
454
+ */
455
+ super.loadUrl(url, additionalHttpHeaders);
456
+ }
457
+
458
+ private InputConnection inputConnection = null;
459
+ private RhoInputConnectionWrapper rhoInputConnectionWrapper = null;
460
+
461
+ public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
462
+ if (ourShouldDisableKeyboard) {
463
+ outAttrs.privateImeOptions = "tau browser!";
464
+ if (mIsShouldKillKeyboardMethodUse) {
465
+ //recursiveLoopChildrenForTextEdit(this);
466
+ hideKeyboard();
467
+ outAttrs.imeOptions = EditorInfo.IME_ACTION_DONE;
468
+ outAttrs.inputType = EditorInfo.TYPE_NULL;
469
+ //outAttrs.hintLocales = new LocaleList(new Locale("en", "US"));
470
+ }
471
+ }
472
+ InputConnection super_connection = super.onCreateInputConnection(outAttrs);
473
+ inputConnection = super_connection;
474
+
475
+ if (ourShouldDisableKeyboard) {
476
+ if (mIsShouldKillKeyboardMethodUse) {
477
+ //outAttrs.hintLocales = new LocaleList(new Locale("en", "US"));
478
+ outAttrs.imeOptions = EditorInfo.IME_ACTION_DONE;
479
+ outAttrs.inputType = EditorInfo.TYPE_NULL;
480
+ hideKeyboard();
481
+ //ViewGroup activityRootView = ((ViewGroup) RhodesActivity.safeGetInstance().findViewById(android.R.id.content));
482
+ //recursiveLoopChildrenForTextEdit(activityRootView);
483
+ }
484
+ }
485
+ if (RhoConf.isExist("override_web_view_input_connection") && RhoConf.getBool("override_web_view_input_connection")){
486
+ rhoInputConnectionWrapper = new RhoInputConnectionWrapper(super_connection);
487
+ return rhoInputConnectionWrapper;
488
+ }else
489
+ return inputConnection;
490
+ }
491
+
492
+ public void recursiveLoopChildrenForTextEdit(ViewGroup parent) {
493
+ for (int i = 0; i < parent.getChildCount(); i++) {
494
+ final View child = parent.getChildAt(i);
495
+
496
+ //child.setBackgroundColor(0xFF00FF00);
497
+ if (child instanceof TextView) {
498
+ TextView et = (TextView)child;
499
+ et.setRawInputType(InputType.TYPE_CLASS_TEXT);
500
+ et.setTextIsSelectable(true);
501
+ et.setBackgroundColor(0xFF00FF00);
502
+ //et.setInputType(InputType.TYPE_CLASS_TEXT);
503
+ }
504
+
505
+ if (child instanceof ViewGroup) {
506
+ recursiveLoopChildrenForTextEdit((ViewGroup) child);
507
+ } else {
508
+ if (child != null) {
509
+ }
510
+ }
511
+ }
512
+ }
513
+ }
514
+
515
+
516
+ private void setupOurTauKeyboard() {
517
+ if (ourShouldDisableKeyboard) {
518
+ Logger.I(this.TAG, "TAU KEYBOARD setupOurTauKeyboard() ourShouldDisableKeyboard == true");
519
+ try {
520
+ mIsShouldKillKeyboardMethodUse = true;
521
+ RhodesActivity.safeGetInstance();
522
+ Context context = RhodesActivity.getContext();
523
+ String enabledInputmethods = Settings.Secure.getString(context.getContentResolver(), "enabled_input_methods");
524
+ Logger.I(this.TAG, "TAU KEYBOARD enabled_input_methods = " + enabledInputmethods);
525
+
526
+ String default_input_method_local = Settings.Secure.getString(context.getContentResolver(), "default_input_method");
527
+ Logger.I(this.TAG, "TAU KEYBOARD default_input_method = " + default_input_method_local);
528
+
529
+ boolean hasError = false;
530
+ if (!enabledInputmethods.contains(tauSipValue)) {
531
+ // should be added !
532
+ boolean res_added = Settings.Secure.putString(context.getContentResolver(), "enabled_input_methods", enabledInputmethods+":"+tauSipValue);
533
+ Logger.I(this.TAG, "TAU KEYBOARD add our keyboard to enabled_input_methods res_added = " + res_added);
534
+ if (res_added) {
535
+ mSavedEnabledInputMethods = enabledInputmethods;
536
+ }
537
+ else {
538
+ hasError = true;
539
+ }
540
+ }
541
+ else {
542
+ Logger.I(this.TAG, "TAU KEYBOARD enabled_input_methods already has tau keyboard");
543
+ }
544
+
545
+ if (!hasError) {
546
+ boolean res_def = Settings.Secure.putString(context.getContentResolver(), "default_input_method", tauSipValue);
547
+ Logger.I(this.TAG, "TAU KEYBOARD set our keyboard to default_input_method res_def = " + res_def);
548
+ if (res_def) {
549
+ mSavedDefaultInputMethod = default_input_method_local;
550
+ //if (mSavedDefaultInputMethod == null) {
551
+ mSavedDefaultInputMethod = "com.google.android.inputmethod.latin/com.android.inputmethod.latin.LatinIME";
552
+ //}
553
+ }
554
+ else {
555
+ hasError = true;
556
+ }
557
+ }
558
+ if (!hasError) {
559
+ mIsShouldKillKeyboardMethodUse = false;
560
+ }
561
+
562
+ } catch (Exception e) {
563
+ Logger.E(this.TAG, "TAU KEYBOARD Exception = " + e.getMessage());
564
+ }
565
+
566
+ if (mIsShouldKillKeyboardMethodUse) {
567
+ Logger.E(this.TAG, "TAU KEYBOARD no android.permission.WRITE_SECURE_SETTINGS permission - use alternative method !");
568
+
569
+ if (mKillKeyboardTimer != null) {
570
+ mKillKeyboardTimer.cancel();
571
+ }
572
+
573
+ mKillKeyboardTimer = new Timer();
574
+
575
+ //Update the elapsed time every second
576
+ mKillKeyboardTimer.schedule(new TimerTask() {
577
+ @Override
578
+ public void run() {
579
+ //hideKeyboardNow();
580
+ ///*
581
+ if (mIsCanRunAgain) {
582
+ mIsCanRunAgain = false;
583
+ new Handler(Looper.getMainLooper()).post(new Runnable() {
584
+ @Override
585
+ public void run() {
586
+ hideKeyboardNow();
587
+ mIsCanRunAgain = true;
588
+ }
589
+ });
590
+ }
591
+ //*/
592
+ }
593
+ }, 100, 5);
594
+ }
595
+ setKeyboardListener();
596
+ }
597
+ }
598
+
599
+
600
+ private void restoreKeyboardSettings() {
601
+ Logger.I(this.TAG, "TAU KEYBOARD restoreKeyboardSettings()");
602
+ if (mKillKeyboardTimer != null) {
603
+ mKillKeyboardTimer.cancel();
604
+ mKillKeyboardTimer = null;
605
+ }
606
+ if (mSavedEnabledInputMethods != null) {
607
+ String to_restore = mSavedEnabledInputMethods;
608
+ mSavedEnabledInputMethods = null;
609
+ Logger.I(this.TAG, "TAU KEYBOARD restore saved enabled_input_methods");
610
+ try {
611
+ RhodesActivity.safeGetInstance();
612
+ Context context = RhodesActivity.getContext();
613
+ Settings.Secure.putString(context.getContentResolver(), "enabled_input_methods", to_restore);
614
+ } catch (Exception e) {
615
+ Logger.E(this.TAG, "TAU KEYBOARD Exception = " + e.getMessage());
616
+ }
617
+ }
618
+ if (mSavedDefaultInputMethod != null) {
619
+ String to_restore = mSavedDefaultInputMethod;
620
+ mSavedDefaultInputMethod = null;
621
+ Logger.I(this.TAG, "TAU KEYBOARD restore saved default_input_method");
622
+ try {
623
+ RhodesActivity.safeGetInstance();
624
+ Context context = RhodesActivity.getContext();
625
+ Settings.Secure.putString(context.getContentResolver(), "default_input_method", to_restore);
626
+ } catch (Exception e) {
627
+ Logger.E(this.TAG, "TAU KEYBOARD Exception = " + e.getMessage());
628
+ }
629
+ }
630
+ removeKeyboardListener();
631
+ }
632
+
633
+
634
+ public final void setKeyboardListener() {
635
+ removeKeyboardListener();
636
+ final View activityRootView = ((ViewGroup) RhodesActivity.safeGetInstance().findViewById(android.R.id.content)).getChildAt(0);
637
+ if (mOnGlobalLayoutListener != null) {
638
+ activityRootView.getViewTreeObserver().addOnGlobalLayoutListener(mOnGlobalLayoutListener);
639
+ }
640
+ }
641
+
642
+ public final void removeKeyboardListener() {
643
+ final View activityRootView = ((ViewGroup) RhodesActivity.safeGetInstance().findViewById(android.R.id.content)).getChildAt(0);
644
+
645
+ if (mOnGlobalLayoutListener != null) {
646
+ try {
647
+ activityRootView.getViewTreeObserver().removeOnGlobalLayoutListener(mOnGlobalLayoutListener);
648
+ } catch (Exception e) {
649
+
650
+ }
651
+ }
652
+ }
653
+
654
+
35
655
 
36
656
  private WebChromeClient mChromeClient;
37
657
  private WebViewClient mWebViewClient;
@@ -42,11 +662,44 @@ public class GoogleWebView implements IRhoWebView {
42
662
  private TextZoom mTextZoom = TextZoom.NORMAL;
43
663
  private IRhoConfig mConfig;
44
664
 
665
+ private boolean mIsBackDisabled = false;
666
+
45
667
  public GoogleWebView(Activity activity) {
46
- mWebView = new android.webkit.WebView(activity);
668
+ mWebView = new TauWebView(activity);
47
669
  mWebView.getSettings().setLoadWithOverviewMode(true);
48
670
  mWebView.getSettings().setUseWideViewPort(true);
49
671
 
672
+ tauSipValue = activity.getApplicationContext().getPackageName()+"/com.tau.TauKeyboard";
673
+
674
+ //if (ourShouldDisableKeyboard) {
675
+ mOnGlobalLayoutListener = new OnGlobalLayoutListener() {
676
+
677
+ @Override
678
+ public void onGlobalLayout() {
679
+ if (ourShouldDisableKeyboard) {
680
+ hideKeyboard();
681
+ }
682
+ }
683
+
684
+ };
685
+
686
+
687
+ mWebView.setOnTouchListener(new View.OnTouchListener() {
688
+ public boolean onTouch(View v, MotionEvent event) {
689
+ if (ourShouldDisableKeyboard) {
690
+ hideKeyboard();
691
+ }
692
+ return false;
693
+ }
694
+ });
695
+
696
+
697
+ // will be set by request only
698
+ //if (mIsShouldKillKeyboardMethodUse) {
699
+ // setKeyboardListener();
700
+ //}
701
+ //}
702
+
50
703
  synchronized(mInitialized) {
51
704
  if (!mInitialized) {
52
705
  mWebView.clearCache(true);
@@ -57,10 +710,52 @@ public class GoogleWebView implements IRhoWebView {
57
710
  mChromeClient = new RhoWebChromeClient(activity, this);
58
711
  }
59
712
 
713
+ private void hideKeyboardNow() {
714
+ try {
715
+ Activity ctx = RhodesActivity.safeGetInstance();
716
+ if (ctx != null) {
717
+ InputMethodManager imm = (InputMethodManager) ctx.getSystemService(Context.INPUT_METHOD_SERVICE);
718
+ if (imm != null) {
719
+ imm.hideSoftInputFromWindow(getView().getApplicationWindowToken(), 0);
720
+ if (ctx.getCurrentFocus() != null) {
721
+ imm.hideSoftInputFromWindow(ctx.getCurrentFocus().getWindowToken(), 0);
722
+ }
723
+ }
724
+ }
725
+ }
726
+ catch (Throwable e) {
727
+ Logger.E(TAG, e);
728
+ }
729
+ }
730
+
731
+ private void hideKeyboard() {
732
+ if(Looper.getMainLooper().getThread() == Thread.currentThread()) {
733
+ hideKeyboardNow();
734
+ }
735
+ else {
736
+ PerformOnUiThread.exec(new Runnable() {
737
+ @Override
738
+ public void run() {
739
+ hideKeyboardNow();
740
+ }
741
+ });
742
+ }
743
+ PerformOnUiThread.exec(new Runnable() {
744
+ @Override
745
+ public void run() {
746
+ hideKeyboardNow();
747
+ }
748
+ }, 10);
749
+ }
750
+
751
+ public void setBackDisabled(boolean value) {
752
+ mIsBackDisabled = value;
753
+ }
754
+
60
755
  private static void initWebStuff(Activity activity) {
61
756
 
62
757
  Logger.I(TAG, "Initialize Google WEbView staff");
63
-
758
+
64
759
  OsVersionManager.registerSelector(IWebSettingsProvider.class, WebSettingsProviderBase.class.getCanonicalName());
65
760
  OsVersionManager.registerSelector(Build.VERSION_CODES.ECLAIR, IWebSettingsProvider.class, WebSettingsProviderEclair.class.getCanonicalName());
66
761
  OsVersionManager.registerSelector(Build.VERSION_CODES.ECLAIR_MR1, IWebSettingsProvider.class, WebSettingsProviderEclairMR1.class.getCanonicalName());
@@ -71,14 +766,14 @@ public class GoogleWebView implements IRhoWebView {
71
766
 
72
767
  mInitialized = true;
73
768
  }
74
-
769
+
75
770
  private void applyWebSettings() {
76
771
  Logger.I(TAG, "applyWebSettings");
77
772
  // PerformOnUiThread.exec(new Runnable() {
78
773
  // @Override
79
774
  // public void run() {
80
775
  Logger.I(TAG, "Web settings is applying now >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
81
-
776
+
82
777
  double z = getConfig().getDouble(WebViewConfig.PAGE_ZOOM);
83
778
  mWebView.setInitialScale((int)(z * 100));
84
779
  mWebView.setVerticalScrollBarEnabled(true);
@@ -87,31 +782,31 @@ public class GoogleWebView implements IRhoWebView {
87
782
  mWebView.setHorizontalScrollbarOverlay(true);
88
783
  mWebView.setFocusableInTouchMode(true);
89
784
  int sdkVersion = Build.VERSION.SDK_INT;
90
-
785
+
91
786
  if ( sdkVersion >= 21 ) {
92
- Logger.I(TAG, "Enabling third-party cookies");
93
- CookieManager cm = CookieManager.getInstance();
94
- try {
95
- java.lang.reflect.Method mtdAllow3Party = cm.getClass().getMethod("setAcceptThirdPartyCookies", android.webkit.WebView.class, boolean.class);
96
- mtdAllow3Party.invoke(cm,mWebView,true);
97
- Logger.I(TAG, "Enabling third-party cookies done");
98
- } catch (SecurityException e) {
99
- Logger.W(TAG, "Can't allow third-party cookies explicily due to SecurityException");
100
- } catch (NoSuchMethodException e) {
101
- Logger.W(TAG, "Can't allow third-party cookies explicily due to NoSuchMethodException");
102
- } catch ( Exception e ) {
103
- Logger.E(TAG, "Can't allow third-party cookies explicily due to exception: " + e.toString() );
104
- }
787
+ //Logger.I(TAG, "Enabling third-party cookies");
788
+ //CookieManager cm = CookieManager.getInstance();
789
+ //try {
790
+ //java.lang.reflect.Method mtdAllow3Party = cm.getClass().getMethod("setAcceptThirdPartyCookies", android.webkit.WebView.class, boolean.class);
791
+ //mtdAllow3Party.invoke(cm,mWebView,true);
792
+ //Logger.I(TAG, "Enabling third-party cookies done");
793
+ //} catch (SecurityException e) {
794
+ //Logger.W(TAG, "Can't allow third-party cookies explicily due to SecurityException");
795
+ //} catch (NoSuchMethodException e) {
796
+ //Logger.W(TAG, "Can't allow third-party cookies explicily due to NoSuchMethodException");
797
+ //} catch ( Exception e ) {
798
+ //Logger.E(TAG, "Can't allow third-party cookies explicily due to exception: " + e.toString() );
799
+ //}
105
800
  }
106
-
801
+
107
802
  /* if(sdkVersion <19){
108
803
  mWebView.getSettings().setLoadWithOverviewMode(true);
109
804
  mWebView.getSettings().setUseWideViewPort(true);
110
805
  }*/
111
-
806
+
112
807
  IWebSettingsProvider provider = OsVersionManager.getFeature(IWebSettingsProvider.class);
113
808
  provider.fillSettings(mWebView.getSettings(), mConfig);
114
-
809
+
115
810
  RhodesActivity.safeGetInstance().notifyUiCreated();
116
811
  // }
117
812
  // });
@@ -128,13 +823,13 @@ public class GoogleWebView implements IRhoWebView {
128
823
  }
129
824
  });
130
825
  }
131
-
826
+
132
827
  @Override
133
828
  public void setConfig(IRhoConfig config) {
134
829
  mConfig = config;
135
830
  applyWebSettings();
136
831
  }
137
-
832
+
138
833
  public IRhoConfig getConfig() {
139
834
  return mConfig;
140
835
  }
@@ -161,11 +856,50 @@ public class GoogleWebView implements IRhoWebView {
161
856
 
162
857
  @Override
163
858
  public void goBack() {
859
+ if (mIsBackDisabled) {
860
+ return;
861
+ }
862
+ try {
863
+ WebBackForwardList history = mWebView.copyBackForwardList();
864
+ int current_index = history.getCurrentIndex();
865
+ if (current_index > 0) {
866
+ // can go back
867
+ WebHistoryItem item = history.getItemAtIndex(current_index-1);
868
+ if (item != null) {
869
+ String url = item.getUrl();
870
+ if (url != null) {
871
+ // inform about back with this url
872
+ RhoExtManager.getImplementationInstance().onGoBack(mWebView, getUrl(), url);
873
+ }
874
+ }
875
+ }
876
+ }
877
+ catch (Throwable e) {
878
+ Logger.E(TAG, e);
879
+ }
164
880
  mWebView.goBack();
165
881
  }
166
882
 
167
883
  @Override
168
884
  public void goForward() {
885
+ try {
886
+ WebBackForwardList history = mWebView.copyBackForwardList();
887
+ int current_index = history.getCurrentIndex();
888
+ if (current_index > 0) {
889
+ // can go back
890
+ WebHistoryItem item = history.getItemAtIndex(current_index-1);
891
+ if (item != null) {
892
+ String url = item.getUrl();
893
+ if (url != null) {
894
+ // inform about back with this url
895
+ RhoExtManager.getImplementationInstance().onGoForward(mWebView, getUrl(), url);
896
+ }
897
+ }
898
+ }
899
+ }
900
+ catch (Throwable e) {
901
+ Logger.E(TAG, e);
902
+ }
169
903
  mWebView.goForward();
170
904
  }
171
905
 
@@ -190,7 +924,7 @@ public class GoogleWebView implements IRhoWebView {
190
924
  @Override
191
925
  public void loadUrl(String url) {
192
926
  Logger.profStart("BROWSER_PAGE");
193
-
927
+
194
928
  RhoExtManager.getImplementationInstance().onBeforeNavigate(mWebView, url);
195
929
 
196
930
  Uri uri = LocalFileProvider.overrideUri(Uri.parse(url));
@@ -252,7 +986,7 @@ public class GoogleWebView implements IRhoWebView {
252
986
  }
253
987
  mWebView.getSettings().setTextSize(googleTextZoom);
254
988
  }
255
-
989
+
256
990
  @Override
257
991
  public TextZoom getTextZoom()
258
992
  {
@@ -266,19 +1000,26 @@ public class GoogleWebView implements IRhoWebView {
266
1000
 
267
1001
  @Override
268
1002
  public void onPause() {
1003
+ // lost foreground - restore keyboard settings !
1004
+ restoreKeyboardSettings();
1005
+
1006
+
269
1007
  //AndroidFunctionalityManager.getAndroidFunctionality().pauseWebView(mWebView,true);
270
1008
  }
271
1009
 
272
1010
  @Override
273
1011
  public void onResume() {
1012
+ setupOurTauKeyboard();
1013
+
274
1014
  //AndroidFunctionalityManager.getAndroidFunctionality().pauseWebView(mWebView,false);
275
1015
  }
276
1016
 
277
1017
  @Override
278
1018
  public void destroy() {
1019
+ restoreKeyboardSettings();
279
1020
  mWebView.destroy();
280
1021
  }
281
-
1022
+
282
1023
  @Override
283
1024
  public WebBackForwardList copyBackForwardList() {
284
1025
  return mWebView.copyBackForwardList();
@@ -301,26 +1042,26 @@ public class GoogleWebView implements IRhoWebView {
301
1042
  break;
302
1043
  }
303
1044
  }
304
-
1045
+
305
1046
  private void saveJpeg(String path) {
306
1047
  Picture picture = mWebView.capturePicture();
307
-
1048
+
308
1049
  if ( ( picture == null ) || ( picture.getWidth() == 0 ) || picture.getHeight() == 0 ) {
309
1050
  Logger.E(TAG, "Can't capture picture from WebView.");
310
1051
  return;
311
1052
  }
312
-
313
- Bitmap bitmap = Bitmap.createBitmap( picture.getWidth(), picture.getHeight(), Bitmap.Config.ARGB_8888);
314
- Canvas canvas = new Canvas(bitmap);
315
- picture.draw(canvas);
316
- FileOutputStream fos = null;
317
- try {
318
- fos = new FileOutputStream(path);
319
- if ( fos != null )
320
- {
321
- bitmap.compress(Bitmap.CompressFormat.JPEG, 90, fos );
322
- fos.close();
323
- }
1053
+
1054
+ Bitmap bitmap = Bitmap.createBitmap( picture.getWidth(), picture.getHeight(), Bitmap.Config.ARGB_8888);
1055
+ Canvas canvas = new Canvas(bitmap);
1056
+ picture.draw(canvas);
1057
+ FileOutputStream fos = null;
1058
+ try {
1059
+ fos = new FileOutputStream(path);
1060
+ if ( fos != null )
1061
+ {
1062
+ bitmap.compress(Bitmap.CompressFormat.JPEG, 90, fos );
1063
+ fos.close();
1064
+ }
324
1065
  }
325
1066
  catch (Throwable e){
326
1067
  Logger.E(TAG, e);