Browse Source

Layout updates

master
Anthony Restaino 10 years ago
parent
commit
b822573a2f
  1. 13
      res/layout/activity_main.xml
  2. 17
      src/acr/browser/lightning/BrowserActivity.java

13
res/layout/activity_main.xml

@ -78,8 +78,7 @@
android:minHeight="?android:attr/listPreferredItemHeightSmall" android:minHeight="?android:attr/listPreferredItemHeightSmall"
android:text="@string/action_new_tab" android:text="@string/action_new_tab"
android:textAppearance="?android:attr/textAppearanceListItemSmall" android:textAppearance="?android:attr/textAppearanceListItemSmall"
android:textColor="@color/black" android:textColor="@color/black" />
android:textStyle="bold" />
</RelativeLayout> </RelativeLayout>
<View <View
@ -87,7 +86,7 @@
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="1dp" android:layout_height="1dp"
android:layout_below="@+id/new_tab_button" android:layout_below="@+id/new_tab_button"
android:background="#bababa" /> android:background="@color/gray_list_bg" />
<ListView <ListView
android:id="@+id/left_drawer" android:id="@+id/left_drawer"
@ -104,7 +103,7 @@
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="1dp" android:layout_height="1dp"
android:layout_above="@+id/linearLayout1" android:layout_above="@+id/linearLayout1"
android:background="#bababa" /> android:background="@color/gray_list_bg" />
<LinearLayout <LinearLayout
android:id="@+id/linearLayout1" android:id="@+id/linearLayout1"
@ -170,7 +169,6 @@
android:id="@+id/bookmark_title" android:id="@+id/bookmark_title"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:background="@drawable/list_bg" android:background="@drawable/list_bg"
android:gravity="center_vertical" android:gravity="center_vertical"
android:orientation="horizontal" > android:orientation="horizontal" >
@ -201,14 +199,13 @@
android:minHeight="?android:attr/listPreferredItemHeightSmall" android:minHeight="?android:attr/listPreferredItemHeightSmall"
android:text="@string/action_bookmarks" android:text="@string/action_bookmarks"
android:textAppearance="?android:attr/textAppearanceListItemSmall" android:textAppearance="?android:attr/textAppearanceListItemSmall"
android:textColor="@color/black" android:textColor="@color/black" />
android:textStyle="bold" />
</RelativeLayout> </RelativeLayout>
<View <View
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="1dp" android:layout_height="1dp"
android:background="#bababa" /> android:background="@color/gray_list_bg" />
<ListView <ListView
android:id="@+id/right_drawer_list" android:id="@+id/right_drawer_list"

17
src/acr/browser/lightning/BrowserActivity.java

@ -55,8 +55,10 @@ import info.guardianproject.onionkit.ui.OrbotHelper;
import info.guardianproject.onionkit.web.WebkitProxy; import info.guardianproject.onionkit.web.WebkitProxy;
import java.io.*; import java.io.*;
import java.net.HttpURLConnection;
import java.net.URI; import java.net.URI;
import java.net.URISyntaxException; import java.net.URISyntaxException;
import java.net.URL;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.util.*; import java.util.*;
@ -1606,7 +1608,11 @@ public class BrowserActivity extends Activity implements BrowserController {
if (!image.exists()) { if (!image.exists()) {
try { try {
// if not, download it... // if not, download it...
InputStream in = new java.net.URL(urldisplay).openStream(); URL url = new URL(urldisplay);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setDoInput(true);
connection.connect();
InputStream in = connection.getInputStream();
if (in != null) { if (in != null) {
mIcon = BitmapFactory.decodeStream(in); mIcon = BitmapFactory.decodeStream(in);
@ -1614,12 +1620,15 @@ public class BrowserActivity extends Activity implements BrowserController {
// ...and cache it // ...and cache it
if (mIcon != null) { if (mIcon != null) {
FileOutputStream fos = new FileOutputStream(image); FileOutputStream fos = new FileOutputStream(image);
mIcon.compress(Bitmap.CompressFormat.PNG, 85, fos); mIcon.compress(Bitmap.CompressFormat.PNG, 100, fos);
fos.flush(); fos.flush();
fos.close(); fos.close();
Log.i(Constants.TAG, "Downloaded: " + urldisplay);
} }
} catch (Exception e) { } catch (Exception e) {
} finally {
} }
} else { } else {
// if it exists, retrieve it from the cache // if it exists, retrieve it from the cache
@ -1638,7 +1647,7 @@ public class BrowserActivity extends Activity implements BrowserController {
// ...and cache it // ...and cache it
if (mIcon != null) { if (mIcon != null) {
FileOutputStream fos = new FileOutputStream(image); FileOutputStream fos = new FileOutputStream(image);
mIcon.compress(Bitmap.CompressFormat.PNG, 85, fos); mIcon.compress(Bitmap.CompressFormat.PNG, 100, fos);
fos.flush(); fos.flush();
fos.close(); fos.close();
} }
@ -1690,7 +1699,7 @@ public class BrowserActivity extends Activity implements BrowserController {
animator.setDuration(200); animator.setDuration(200);
animator.setInterpolator(new DecelerateInterpolator()); animator.setInterpolator(new DecelerateInterpolator());
animator.start(); animator.start();
} else { } else if (n < mProgressBar.getProgress()) {
ObjectAnimator animator = ObjectAnimator.ofInt(mProgressBar, "progress", 0, n); ObjectAnimator animator = ObjectAnimator.ofInt(mProgressBar, "progress", 0, n);
animator.setDuration(200); animator.setDuration(200);
animator.setInterpolator(new DecelerateInterpolator()); animator.setInterpolator(new DecelerateInterpolator());

Loading…
Cancel
Save