Browse Source

Added option to change rendering mode

master
Anthony Restaino 10 years ago
parent
commit
52fcf8fdc0
  1. 848
      res/layout/settings.xml
  2. 6
      res/values/strings.xml
  3. 21
      src/acr/browser/lightning/LightningView.java
  4. 81
      src/acr/browser/lightning/SettingsActivity.java

848
res/layout/settings.xml

@ -1,508 +1,540 @@ @@ -1,508 +1,540 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/scrollView1"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/scrollView1"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
android:layout_height="wrap_content"
android:orientation="vertical" >
<LinearLayout
<RelativeLayout
android:id="@+id/layoutLocation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
android:background="?android:attr/listChoiceBackgroundIndicator"
android:minHeight="60dp"
android:paddingBottom="10dp"
android:paddingRight="10dp"
android:paddingTop="10dp" >
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:paddingLeft="10dp"
android:paddingRight="60dp"
android:text="@string/location"
android:textAppearance="?android:attr/textAppearanceMedium" />
<RelativeLayout
android:id="@+id/layoutLocation"
android:layout_width="match_parent"
android:id="@+id/setR1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minHeight="60dp"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:background="?android:attr/listChoiceBackgroundIndicator"
android:paddingRight="10dp" >
android:layout_alignParentRight="true"
android:layout_centerVertical="true" >
</RelativeLayout>
</RelativeLayout>
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:paddingLeft="10dp"
android:paddingRight="60dp"
android:text="@string/location"
android:textAppearance="?android:attr/textAppearanceMedium" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#cdcdcd" />
<RelativeLayout
android:id="@+id/setR1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true" >
</RelativeLayout>
<RelativeLayout
android:id="@+id/layoutFullScreen"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:attr/listChoiceBackgroundIndicator"
android:minHeight="60dp"
android:paddingBottom="10dp"
android:paddingRight="10dp"
android:paddingTop="10dp" >
<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:paddingLeft="10dp"
android:paddingRight="60dp"
android:text="@string/fullscreen"
android:textAppearance="?android:attr/textAppearanceMedium" />
<RelativeLayout
android:id="@+id/setR2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true" >
</RelativeLayout>
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#cdcdcd" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#cdcdcd" />
<RelativeLayout
android:id="@+id/layoutFlash"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:attr/listChoiceBackgroundIndicator"
android:minHeight="60dp"
android:paddingBottom="10dp"
android:paddingRight="10dp"
android:paddingTop="10dp" >
<TextView
android:id="@+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:paddingLeft="10dp"
android:paddingRight="60dp"
android:text="@string/flash"
android:textAppearance="?android:attr/textAppearanceMedium" />
<RelativeLayout
android:id="@+id/layoutFullScreen"
android:layout_width="match_parent"
android:id="@+id/setR3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minHeight="60dp"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:background="?android:attr/listChoiceBackgroundIndicator"
android:paddingRight="10dp" >
android:layout_alignParentRight="true"
android:layout_centerVertical="true" >
</RelativeLayout>
</RelativeLayout>
<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:paddingLeft="10dp"
android:paddingRight="60dp"
android:text="@string/fullscreen"
android:textAppearance="?android:attr/textAppearanceMedium" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#cdcdcd" />
<RelativeLayout
android:id="@+id/setR2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true" >
</RelativeLayout>
<RelativeLayout
android:id="@+id/layoutAdBlock"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:attr/listChoiceBackgroundIndicator"
android:minHeight="60dp"
android:paddingBottom="10dp"
android:paddingRight="10dp"
android:paddingTop="10dp" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:paddingLeft="10dp"
android:paddingRight="60dp"
android:text="@string/block_ads"
android:textAppearance="?android:attr/textAppearanceMedium" />
<RelativeLayout
android:id="@+id/setR4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true" >
</RelativeLayout>
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#cdcdcd" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#cdcdcd" />
<RelativeLayout
android:id="@+id/layoutUseOrbot"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:attr/listChoiceBackgroundIndicator"
android:minHeight="60dp"
android:paddingBottom="10dp"
android:paddingRight="10dp"
android:paddingTop="10dp" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:paddingLeft="10dp"
android:paddingRight="60dp"
android:text="@string/enable_orbot"
android:textAppearance="?android:attr/textAppearanceMedium" />
<RelativeLayout
android:id="@+id/layoutFlash"
android:layout_width="match_parent"
android:id="@+id/setR5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true" >
</RelativeLayout>
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#cdcdcd" />
<RelativeLayout
android:id="@+id/layoutUserAgent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:attr/listChoiceBackgroundIndicator"
android:minHeight="60dp"
android:paddingBottom="10dp"
android:paddingTop="10dp" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minHeight="60dp"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:background="?android:attr/listChoiceBackgroundIndicator"
android:paddingRight="10dp" >
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:orientation="vertical" >
<TextView
android:id="@+id/textView4"
android:id="@+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:paddingLeft="10dp"
android:paddingRight="60dp"
android:text="@string/flash"
android:text="@string/agent"
android:textAppearance="?android:attr/textAppearanceMedium" />
<RelativeLayout
android:id="@+id/setR3"
<TextView
android:id="@+id/agentText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true" >
</RelativeLayout>
</RelativeLayout>
android:paddingLeft="10dp"
android:text="Small Text"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/light" />
</LinearLayout>
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#cdcdcd" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#cdcdcd" />
<RelativeLayout
android:id="@+id/layoutAdBlock"
android:layout_width="match_parent"
<RelativeLayout
android:id="@+id/layoutDownload"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:attr/listChoiceBackgroundIndicator"
android:minHeight="60dp"
android:paddingBottom="10dp"
android:paddingTop="10dp" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minHeight="60dp"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:background="?android:attr/listChoiceBackgroundIndicator"
android:paddingRight="10dp" >
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:orientation="vertical" >
<TextView
android:id="@+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:paddingLeft="10dp"
android:paddingRight="60dp"
android:text="@string/block_ads"
android:text="@string/download"
android:textAppearance="?android:attr/textAppearanceMedium" />
<RelativeLayout
android:id="@+id/setR4"
<TextView
android:id="@+id/downloadText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true" >
</RelativeLayout>
</RelativeLayout>
android:paddingLeft="10dp"
android:text="Small Text"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/light" />
</LinearLayout>
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#cdcdcd" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#cdcdcd" />
<RelativeLayout
android:id="@+id/layoutUseOrbot"
android:layout_width="match_parent"
<RelativeLayout
android:id="@+id/layoutHomepage"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:attr/listChoiceBackgroundIndicator"
android:minHeight="60dp"
android:paddingBottom="10dp"
android:paddingTop="10dp" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minHeight="60dp"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:background="?android:attr/listChoiceBackgroundIndicator"
android:paddingRight="10dp" >
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:orientation="vertical" >
<TextView
android:id="@+id/textView7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:paddingLeft="10dp"
android:paddingRight="60dp"
android:text="@string/enable_orbot"
android:text="@string/home"
android:textAppearance="?android:attr/textAppearanceMedium" />
<RelativeLayout
android:id="@+id/setR5"
<TextView
android:id="@+id/homepageText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true" >
</RelativeLayout>
</RelativeLayout>
android:paddingLeft="10dp"
android:text="Small Text"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/light" />
</LinearLayout>
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#cdcdcd" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#cdcdcd" />
<RelativeLayout
android:id="@+id/layoutUserAgent"
android:layout_width="match_parent"
<RelativeLayout
android:id="@+id/layoutSearch"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:attr/listChoiceBackgroundIndicator"
android:minHeight="60dp"
android:paddingBottom="10dp"
android:paddingTop="10dp" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minHeight="60dp"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:background="?android:attr/listChoiceBackgroundIndicator" >
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:orientation="vertical" >
<LinearLayout
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:orientation="vertical" >
<TextView
android:id="@+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:text="@string/agent"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="@+id/agentText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:text="Small Text"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/light" />
</LinearLayout>
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#cdcdcd" />
<RelativeLayout
android:id="@+id/layoutDownload"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="60dp"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:background="?android:attr/listChoiceBackgroundIndicator" >
android:paddingLeft="10dp"
android:text="@string/search"
android:textAppearance="?android:attr/textAppearanceMedium" />
<LinearLayout
<TextView
android:id="@+id/searchText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:orientation="vertical" >
<TextView
android:id="@+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:text="@string/download"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="@+id/downloadText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:text="Small Text"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/light" />
</LinearLayout>
</RelativeLayout>
android:paddingLeft="10dp"
android:text="Small Text"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/light" />
</LinearLayout>
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#cdcdcd" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#cdcdcd" />
<RelativeLayout
android:id="@+id/layoutHomepage"
android:layout_width="match_parent"
<LinearLayout
android:id="@+id/layoutRendering"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:attr/listChoiceBackgroundIndicator"
android:minHeight="60dp"
android:orientation="vertical"
android:paddingBottom="10dp"
android:paddingTop="10dp" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minHeight="60dp"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:background="?android:attr/listChoiceBackgroundIndicator" >
android:paddingLeft="10dp"
android:text="@string/rendering_mode"
android:textAppearance="?android:attr/textAppearanceMedium" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:orientation="vertical" >
<TextView
android:id="@+id/textView7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:text="@string/home"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="@+id/homepageText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:text="Small Text"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/light" />
</LinearLayout>
</RelativeLayout>
<TextView
android:id="@+id/renderText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:text="Small Text"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/light" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#cdcdcd" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#cdcdcd" />
<RelativeLayout
android:id="@+id/layoutSearch"
android:layout_width="match_parent"
<RelativeLayout
android:id="@+id/layoutAdvanced"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:attr/listChoiceBackgroundIndicator"
android:minHeight="60dp"
android:paddingBottom="10dp"
android:paddingTop="10dp" >
<TextView
android:id="@+id/textView8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minHeight="60dp"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:background="?android:attr/listChoiceBackgroundIndicator" >
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:paddingLeft="10dp"
android:text="@string/advanced"
android:textAppearance="?android:attr/textAppearanceMedium" />
</RelativeLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:orientation="vertical" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:text="@string/search"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="@+id/searchText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:text="Small Text"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/light" />
</LinearLayout>
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#cdcdcd" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#cdcdcd" />
<RelativeLayout
android:id="@+id/layoutSource"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:attr/listChoiceBackgroundIndicator"
android:minHeight="60dp"
android:paddingBottom="10dp"
android:paddingTop="10dp" >
<RelativeLayout
android:id="@+id/layoutAdvanced"
android:layout_width="match_parent"
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minHeight="60dp"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:background="?android:attr/listChoiceBackgroundIndicator" >
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:orientation="vertical" >
<TextView
android:id="@+id/textView8"
android:id="@+id/textView9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:paddingLeft="10dp"
android:text="@string/advanced"
android:text="@string/action_follow_me"
android:textAppearance="?android:attr/textAppearanceMedium" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#cdcdcd" />
<RelativeLayout
android:id="@+id/layoutSource"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="60dp"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:background="?android:attr/listChoiceBackgroundIndicator" >
<LinearLayout
<TextView
android:id="@+id/isImportAvailable"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:orientation="vertical" >
<TextView
android:id="@+id/textView9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:text="@string/action_follow_me"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="@+id/isImportAvailable"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:text="@string/url_twitter"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/light" />
</LinearLayout>
</RelativeLayout>
android:paddingLeft="10dp"
android:text="@string/url_twitter"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/light" />
</LinearLayout>
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#cdcdcd" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#cdcdcd" />
<RelativeLayout
android:id="@+id/layoutLicense"
android:layout_width="match_parent"
<RelativeLayout
android:id="@+id/layoutLicense"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:attr/listChoiceBackgroundIndicator"
android:minHeight="60dp"
android:paddingBottom="10dp"
android:paddingTop="10dp" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minHeight="60dp"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:background="?android:attr/listChoiceBackgroundIndicator" >
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:orientation="vertical" >
<LinearLayout
<TextView
android:id="@+id/textView10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:orientation="vertical" >
<TextView
android:id="@+id/textView10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:text="@string/licenses"
android:textAppearance="?android:attr/textAppearanceMedium" />
android:paddingLeft="10dp"
android:text="@string/licenses"
android:textAppearance="?android:attr/textAppearanceMedium" />
</LinearLayout>
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#cdcdcd" />
</LinearLayout>
</RelativeLayout>
<RelativeLayout
android:id="@+id/layoutVersion"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:attr/listChoiceBackgroundIndicator"
android:minHeight="60dp"
android:paddingBottom="10dp"
android:paddingTop="10dp" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#cdcdcd" />
<RelativeLayout
android:id="@+id/layoutVersion"
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minHeight="60dp"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:background="?android:attr/listChoiceBackgroundIndicator" >
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:orientation="vertical" >
<LinearLayout
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:orientation="vertical" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:text="@string/version"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="@+id/versionCode"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:text="Small Text"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/light" />
</LinearLayout>
</RelativeLayout>
android:paddingLeft="10dp"
android:text="@string/version"
android:textAppearance="?android:attr/textAppearanceMedium" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#cdcdcd" />
</LinearLayout>
</ScrollView>
<TextView
android:id="@+id/versionCode"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:text="Small Text"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/light" />
</LinearLayout>
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#cdcdcd" />
</LinearLayout>
</ScrollView>

6
res/values/strings.xml

@ -172,4 +172,10 @@ @@ -172,4 +172,10 @@
<string name="freeware">Freeware</string>
<string name="android_open_source_project">Android Open Source Project</string>
<string name="hphosts_ad_server_list">hpHosts Ad Server List</string>
<string name="deleted_tab">Reopened old tab</string>
<string name="rendering_mode">Rendering Mode</string>
<string name="name_inverted">Inverted</string>
<string name="name_grayscale">Grayscale</string>
<string name="name_inverted_grayscale">Inverted Grayscale</string>
<string name="name_normal">Normal</string>
</resources>

21
src/acr/browser/lightning/LightningView.java

@ -266,6 +266,9 @@ public class LightningView { @@ -266,6 +266,9 @@ public class LightningView {
} else if (mSettings == null) {
return;
}
setColorMode(mPreferences.getInt(PreferenceConstants.RENDERING_MODE, 0));
mSettings.setGeolocationEnabled(mPreferences
.getBoolean(PreferenceConstants.LOCATION, false));
if (API < 19) {
@ -355,7 +358,6 @@ public class LightningView { @@ -355,7 +358,6 @@ public class LightningView {
@SuppressWarnings("deprecation")
@SuppressLint({ "SetJavaScriptEnabled", "NewApi" })
public void initializeSettings(WebSettings settings, Context context) {
this.setNormalRendering();
if (API < 18) {
settings.setAppCacheMaxSize(Long.MAX_VALUE);
}
@ -432,7 +434,7 @@ public class LightningView { @@ -432,7 +434,7 @@ public class LightningView {
public void setNormalRendering() {
mWebView.setLayerType(View.LAYER_TYPE_NONE, mPaint);
}
public void setSoftwareRendering() {
mWebView.setLayerType(View.LAYER_TYPE_SOFTWARE, mPaint);
}
@ -441,18 +443,33 @@ public class LightningView { @@ -441,18 +443,33 @@ public class LightningView {
switch (mode) {
case 0:
mPaint.setColorFilter(null);
setNormalRendering();
break;
case 1:
ColorMatrixColorFilter filterInvert = new ColorMatrixColorFilter(
mNegativeColorArray);
mPaint.setColorFilter(filterInvert);
setHardwareRendering();
break;
case 2:
ColorMatrix cm = new ColorMatrix();
cm.setSaturation(0);
ColorMatrixColorFilter filterGray = new ColorMatrixColorFilter(cm);
mPaint.setColorFilter(filterGray);
setHardwareRendering();
break;
case 3:
ColorMatrix matrix = new ColorMatrix();
matrix.set(mNegativeColorArray);
ColorMatrix matrixGray = new ColorMatrix();
matrixGray.setSaturation(0);
ColorMatrix concat = new ColorMatrix();
concat.setConcat(matrix, matrixGray);
ColorMatrixColorFilter filterInvertGray = new ColorMatrixColorFilter(concat);
mPaint.setColorFilter(filterInvertGray);
setHardwareRendering();
break;
}
}

81
src/acr/browser/lightning/SettingsActivity.java

@ -33,29 +33,18 @@ import info.guardianproject.onionkit.ui.OrbotHelper; @@ -33,29 +33,18 @@ import info.guardianproject.onionkit.ui.OrbotHelper;
public class SettingsActivity extends Activity {
private static int API = android.os.Build.VERSION.SDK_INT;
private SharedPreferences.Editor mEditPrefs;
private int mAgentChoice;
private String mHomepage;
private TextView mAgentTextView;
private TextView mDownloadTextView;
private int mEasterEggCounter;
private String mDownloadLocation;
private TextView mHomepageText;
private SharedPreferences mPreferences;
private TextView mSearchText;
private TextView mRenderText;
private Context mContext;
private Activity mActivity;
@Override
@ -98,6 +87,7 @@ public class SettingsActivity extends Activity { @@ -98,6 +87,7 @@ public class SettingsActivity extends Activity {
RelativeLayout layoutOrbot = (RelativeLayout) findViewById(R.id.layoutUseOrbot);
mSearchText = (TextView) findViewById(R.id.searchText);
mRenderText = (TextView) findViewById(R.id.renderText);
switch (mPreferences.getInt(PreferenceConstants.SEARCH, 1)) {
case 0:
@ -134,6 +124,21 @@ public class SettingsActivity extends Activity { @@ -134,6 +124,21 @@ public class SettingsActivity extends Activity {
mSearchText.setText("Yandex");
}
switch (mPreferences.getInt(PreferenceConstants.RENDERING_MODE, 0)) {
case 0:
mRenderText.setText(mContext.getString(R.string.name_normal));
break;
case 1:
mRenderText.setText(mContext.getString(R.string.name_inverted));
break;
case 2:
mRenderText.setText(mContext.getString(R.string.name_grayscale));
break;
case 3:
mRenderText.setText(mContext.getString(R.string.name_inverted_grayscale));
break;
}
mAgentTextView = (TextView) findViewById(R.id.agentText);
mHomepageText = (TextView) findViewById(R.id.homepageText);
mDownloadTextView = (TextView) findViewById(R.id.downloadText);
@ -244,6 +249,7 @@ public class SettingsActivity extends Activity { @@ -244,6 +249,7 @@ public class SettingsActivity extends Activity {
advanced(advanced);
source(source);
search();
renderPicker();
easterEgg();
}
@ -318,6 +324,57 @@ public class SettingsActivity extends Activity { @@ -318,6 +324,57 @@ public class SettingsActivity extends Activity {
});
}
public void renderPicker() {
LinearLayout layout = (LinearLayout) findViewById(R.id.layoutRendering);
layout.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
AlertDialog.Builder picker = new AlertDialog.Builder(mActivity);
picker.setTitle(getResources().getString(R.string.rendering_mode));
CharSequence[] chars = { mContext.getString(R.string.name_normal),
mContext.getString(R.string.name_inverted),
mContext.getString(R.string.name_grayscale),
mContext.getString(R.string.name_inverted_grayscale) };
int n = mPreferences.getInt(PreferenceConstants.RENDERING_MODE, 0);
picker.setSingleChoiceItems(chars, n, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
mEditPrefs.putInt(PreferenceConstants.RENDERING_MODE, which).apply();
switch (which) {
case 0:
mRenderText.setText(mContext.getString(R.string.name_normal));
break;
case 1:
mRenderText.setText(mContext.getString(R.string.name_inverted));
break;
case 2:
mRenderText.setText(mContext.getString(R.string.name_grayscale));
break;
case 3:
mRenderText.setText(mContext
.getString(R.string.name_inverted_grayscale));
break;
}
}
});
picker.setNeutralButton(getResources().getString(R.string.action_ok),
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
picker.show();
}
});
}
public void searchUrlPicker() {
final AlertDialog.Builder urlPicker = new AlertDialog.Builder(this);

Loading…
Cancel
Save