Browse Source

Layout updates

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

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

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

Loading…
Cancel
Save