5
5
import android .content .res .*;
6
6
import android .net .*;
7
7
import android .os .*;
8
- import android .support .v4 .app .FragmentTransaction ;
8
+ import android .support .v4 .app .* ;
9
9
import android .util .*;
10
10
import android .view .*;
11
11
import android .webkit .*;
12
12
import android .widget .*;
13
13
14
14
import com .actionbarsherlock .app .*;
15
- import com .actionbarsherlock .app .ActionBar ;
16
15
import com .actionbarsherlock .app .ActionBar .*;
17
16
import com .actionbarsherlock .view .Menu ;
18
17
import com .actionbarsherlock .view .MenuItem ;
29
28
* TODO doc
30
29
*/
31
30
@ EActivity (R .layout .activity_main )
32
- @ SuppressLint ("SetJavaScriptEnabled" )
31
+ @ SuppressLint ({ "Registered" } )
33
32
public class MainActivity extends SherlockActivity implements
34
33
TabListener , OnNavigationListener , IUpbWebViewCallback {
35
34
36
35
private static final String ASSETS_LOADING_HTML = "file:///android_asset/loading.html" ;
37
36
private static final String ASSETS_OFFLINE_HTML = "file:///android_asset/offline.html" ;
38
- public final static int FILECHOOSER_REQUEST_CODE = 1 ;
37
+ public final static int FILE_CHOOSER_REQUEST_CODE = 1 ;
39
38
private final String TAG = getClass ().getSimpleName ();
40
39
41
40
/**
@@ -78,10 +77,12 @@ public void onCreate(Bundle savedInstanceState) {
78
77
void afterViews () {
79
78
mCurrentUrl = generateURL (getString (R .string .actionbar_restaurants_url ));
80
79
mMainWebView .setCallback (this );
81
- // ASSETS_LOADING_HTML is loaded to show that something's happening
80
+ // ASSETS_LOADING_HTML is loaded to show that something is happening
82
81
mMainWebView .loadUrl (ASSETS_LOADING_HTML );
83
82
mMainWebView .loadUrl (mCurrentUrl );
84
83
84
+ setSupportProgressBarVisibility (true );
85
+ setSupportProgressBarIndeterminateVisibility (true );
85
86
initActionBar ();
86
87
initNavigation ();
87
88
}
@@ -91,8 +92,6 @@ private void initActionBar() {
91
92
actionBar .setHomeButtonEnabled (true );
92
93
actionBar .setDisplayShowHomeEnabled (true );
93
94
actionBar .setDisplayShowTitleEnabled (false );
94
- setSupportProgressBarVisibility (true );
95
- setSupportProgressBarIndeterminateVisibility (true );
96
95
}
97
96
98
97
private void initNavigation () {
@@ -122,7 +121,7 @@ public void onRestoreInstanceState(Bundle savedInstanceState) {
122
121
@ Override
123
122
protected void onActivityResult (int requestCode , int resultCode ,
124
123
Intent intent ) {
125
- if (requestCode == FILECHOOSER_REQUEST_CODE ) {
124
+ if (requestCode == FILE_CHOOSER_REQUEST_CODE ) {
126
125
if (null == mUploadMessage )
127
126
return ;
128
127
Uri result = intent == null || resultCode != RESULT_OK ? null
@@ -148,17 +147,6 @@ public void onConfigurationChanged(Configuration newConfig) {
148
147
invalidateOptionsMenu ();
149
148
}
150
149
151
- protected synchronized void removeOfflineNotice () {
152
- if (offlineMode ) {
153
- offlineMode = false ;
154
- if (mMainWebView .canGoBack ())
155
- mMainWebView .goBack ();
156
- else
157
- loadWebView (generateURL (getString (R .string .actionbar_restaurants_url )));
158
- mMainWebView .clearHistory ();
159
- }
160
- }
161
-
162
150
@ Override
163
151
public synchronized void displayOfflineNotice () {
164
152
if (!offlineMode ) {
@@ -214,7 +202,7 @@ private void loadHomeScreen() {
214
202
}
215
203
216
204
/**
217
- * loads a specific view for the current webview
205
+ * loads a specific view for the current web view
218
206
*/
219
207
private void loadWebView (String url ) {
220
208
mCurrentUrl = url ;
0 commit comments