This commit is contained in:
Jon Atkins 2013-12-08 03:52:06 +00:00
commit 3904ba69bb
14 changed files with 50 additions and 24 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 555 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 892 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 393 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 601 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 712 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 958 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

View File

@ -19,20 +19,20 @@
android:showAsAction="ifRoom" android:showAsAction="ifRoom"
android:title="@string/layer_chooser"> android:title="@string/layer_chooser">
</item> </item>
<item
android:id="@+id/reload_button"
android:icon="@drawable/ic_action_refresh"
android:orderInCategory="110"
android:showAsAction="never"
android:title="@string/reload">
</item>
<item <item
android:id="@+id/toggle_fullscreen" android:id="@+id/toggle_fullscreen"
android:icon="@drawable/ic_action_full_screen" android:icon="@drawable/ic_action_full_screen"
android:orderInCategory="120" android:orderInCategory="110"
android:showAsAction="ifRoom" android:showAsAction="ifRoom"
android:title="@string/toggle_fullscreen"> android:title="@string/toggle_fullscreen">
</item> </item>
<item
android:id="@+id/reload_button"
android:icon="@drawable/ic_action_refresh"
android:orderInCategory="120"
android:showAsAction="ifRoom"
android:title="@string/reload">
</item>
<item <item
android:id="@+id/menu_clear_cookies" android:id="@+id/menu_clear_cookies"
android:orderInCategory="130" android:orderInCategory="130"
@ -41,7 +41,6 @@
</item> </item>
<item <item
android:id="@+id/action_settings" android:id="@+id/action_settings"
android:icon="@drawable/ic_action_settings"
android:orderInCategory="200" android:orderInCategory="200"
android:showAsAction="never" android:showAsAction="never"
android:title="@string/action_settings"> android:title="@string/action_settings">

View File

@ -150,9 +150,9 @@
<string name="msg_copied">Copied to clipboard…</string> <string name="msg_copied">Copied to clipboard…</string>
<string name="notice_do_not_show_again">Do not show again</string> <string name="notice_do_not_show_again">Do not show again</string>
<string name="tab_map">Map</string> <string name="tab_map">Locate</string>
<string name="tab_share">Share</string> <string name="tab_share">Share</string>
<string name="tab_browser">Browser</string> <string name="tab_browser">Intel</string>
<string name="label_highlighter">Highlighter</string> <string name="label_highlighter">Highlighter</string>
<string name="label_base_layer">Base Layer</string> <string name="label_base_layer">Base Layer</string>

View File

@ -324,6 +324,12 @@ public class IITC_Mobile extends Activity implements OnSharedPreferenceChangeLis
super.onStop(); super.onStop();
} }
@Override
protected void onDestroy() {
unregisterReceiver(mBroadcastReceiver);
super.onDestroy();
}
@Override @Override
public void onConfigurationChanged(Configuration newConfig) { public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig); super.onConfigurationChanged(newConfig);

View File

@ -71,7 +71,15 @@ public class IITC_WebView extends WebView {
@Override @Override
public void run() { public void run() {
if (isInFullscreen() && (getFullscreenStatus() & (FS_NAVBAR)) != 0) { if (isInFullscreen() && (getFullscreenStatus() & (FS_NAVBAR)) != 0) {
setSystemUiVisibility(SYSTEM_UI_FLAG_HIDE_NAVIGATION); int systemUiVisibility = SYSTEM_UI_FLAG_HIDE_NAVIGATION;
// in immersive mode the user can interact with the app while the navbar is hidden
// this mode is available since KitKat
// you can leave this mode by swiping down from the top of the screen. this does only work
// when the app is in total-fullscreen mode
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT && (mFullscreenStatus & FS_SYSBAR) != 0) {
systemUiVisibility |= SYSTEM_UI_FLAG_IMMERSIVE;
}
setSystemUiVisibility(systemUiVisibility);
} }
} }
}; };
@ -165,12 +173,7 @@ public class IITC_WebView extends WebView {
public void loadJS(String js) { public void loadJS(String js) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
evaluateJavascript(js, new ValueCallback<String>() { evaluateJavascript(js, null);
@Override
public void onReceiveValue(String value) {
// maybe we want to add stuff here
}
});
} else { } else {
// if in edit text mode, don't load javascript otherwise the keyboard closes. // if in edit text mode, don't load javascript otherwise the keyboard closes.
HitTestResult testResult = getHitTestResult(); HitTestResult testResult = getHitTestResult();
@ -190,20 +193,22 @@ public class IITC_WebView extends WebView {
@Override @Override
public boolean onTouchEvent(MotionEvent event) { public boolean onTouchEvent(MotionEvent event) {
getHandler().removeCallbacks(mNavHider); getHandler().removeCallbacks(mNavHider);
getHandler().postDelayed(mNavHider, 2000); getHandler().postDelayed(mNavHider, 3000);
return super.onTouchEvent(event); return super.onTouchEvent(event);
} }
@Override @Override
public void setSystemUiVisibility(int visibility) { public void setSystemUiVisibility(int visibility) {
getHandler().postDelayed(mNavHider, 2000); if ((visibility & SYSTEM_UI_FLAG_HIDE_NAVIGATION) == 0) {
getHandler().postDelayed(mNavHider, 3000);
}
super.setSystemUiVisibility(visibility); super.setSystemUiVisibility(visibility);
} }
@Override @Override
public void onWindowFocusChanged(boolean hasWindowFocus) { public void onWindowFocusChanged(boolean hasWindowFocus) {
if (hasWindowFocus) { if (hasWindowFocus) {
getHandler().postDelayed(mNavHider, 2000); getHandler().postDelayed(mNavHider, 3000);
} else { } else {
getHandler().removeCallbacks(mNavHider); getHandler().removeCallbacks(mNavHider);
} }
@ -225,7 +230,7 @@ public class IITC_WebView extends WebView {
attrs.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN; attrs.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN;
} }
if ((mFullscreenStatus & FS_NAVBAR) != 0) { if ((mFullscreenStatus & FS_NAVBAR) != 0) {
setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION); getHandler().post(mNavHider);
} }
if ((mFullscreenStatus & FS_STATUSBAR) != 0) { if ((mFullscreenStatus & FS_STATUSBAR) != 0) {
loadUrl("javascript: $('#updatestatus').hide();"); loadUrl("javascript: $('#updatestatus').hide();");

View File

@ -9,6 +9,7 @@ import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo; import android.content.pm.ResolveInfo;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.util.Pair; import android.util.Pair;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
@ -37,6 +38,10 @@ public class IntentListView extends ListView {
} }
private class IntentAdapter extends ArrayAdapter<ResolveInfo> { private class IntentAdapter extends ArrayAdapter<ResolveInfo> {
// actually the mdpi pixel size is 48, but this looks ugly...so scale icons down for listView
private static final int MDPI_PX = 36;
private IntentAdapter() { private IntentAdapter() {
super(IntentListView.this.getContext(), android.R.layout.simple_list_item_1); super(IntentListView.this.getContext(), android.R.layout.simple_list_item_1);
} }
@ -48,11 +53,19 @@ public class IntentListView extends ListView {
ActivityInfo info = getItem(position).activityInfo; ActivityInfo info = getItem(position).activityInfo;
CharSequence label = info.loadLabel(mPackageManager); CharSequence label = info.loadLabel(mPackageManager);
// get icon and scale it manually to ensure that all have the same size
Drawable icon = info.loadIcon(mPackageManager); Drawable icon = info.loadIcon(mPackageManager);
DisplayMetrics dm = new DisplayMetrics();
((Activity) getContext()).getWindowManager().getDefaultDisplay().getMetrics(dm);
float densityScale = dm.density;
float scaledWidth = MDPI_PX * densityScale;
float scaledHeight = MDPI_PX * densityScale;
icon.setBounds(0,0,Math.round(scaledWidth),Math.round(scaledHeight));
view.setText(label); view.setText(label);
view.setCompoundDrawablePadding((int) getResources().getDimension(R.dimen.icon_margin)); view.setCompoundDrawablePadding((int) getResources().getDimension(R.dimen.icon_margin));
view.setCompoundDrawablesWithIntrinsicBounds(icon, null, null, null); view.setCompoundDrawables(icon, null, null, null);
return view; return view;
} }

View File

@ -81,7 +81,7 @@ public class ShareActivity extends FragmentActivity implements ActionBar.TabList
String geoUri = "geo:" + mLl; String geoUri = "geo:" + mLl;
Intent geoIntent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(geoUri)); Intent geoIntent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(geoUri));
intents.add(geoIntent); intents.add(geoIntent);
addTab(intents, R.string.tab_map, R.drawable.ic_action_map); addTab(intents, R.string.tab_map, R.drawable.ic_action_place);
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(getUrl())); Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(getUrl()));
addTab(intent, R.string.tab_browser, R.drawable.ic_action_web_site); addTab(intent, R.string.tab_browser, R.drawable.ic_action_web_site);
@ -122,6 +122,9 @@ public class ShareActivity extends FragmentActivity implements ActionBar.TabList
setupShareIntent(intent.getStringExtra("shareString")); setupShareIntent(intent.getStringExtra("shareString"));
} }
// show portal name as action bar title, if available
if (mTitle != getString(R.string.app_name)) actionBar.setTitle(mTitle);
mViewPager = (ViewPager) findViewById(R.id.pager); mViewPager = (ViewPager) findViewById(R.id.pager);
mViewPager.setAdapter(mFragmentAdapter); mViewPager.setAdapter(mFragmentAdapter);