Anthony Restaino
10 years ago
23 changed files with 2635 additions and 2045 deletions
@ -0,0 +1,130 @@
@@ -0,0 +1,130 @@
|
||||
<?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" > |
||||
|
||||
<LinearLayout |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:orientation="vertical" > |
||||
|
||||
<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" > |
||||
|
||||
<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/textView1" |
||||
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> |
||||
|
||||
<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" |
||||
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:layout_alignParentLeft="true" |
||||
android:layout_centerVertical="true" |
||||
android:orientation="vertical" > |
||||
|
||||
<TextView |
||||
android:id="@+id/textView12" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
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" /> |
||||
|
||||
<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="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> |
||||
|
||||
<LinearLayout |
||||
android:layout_width="match_parent" |
||||
android:layout_height="1dp" |
||||
android:layout_marginLeft="5dp" |
||||
android:layout_marginRight="5dp" |
||||
android:background="#cdcdcd" /> |
||||
|
||||
</LinearLayout> |
||||
|
||||
</ScrollView> |
@ -0,0 +1,247 @@
@@ -0,0 +1,247 @@
|
||||
<?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" > |
||||
|
||||
<LinearLayout |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:orientation="vertical" > |
||||
|
||||
<RelativeLayout |
||||
android:id="@+id/rHideStatusBar" |
||||
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="30dp" |
||||
android:text="@string/fullScreenOption" |
||||
android:textAppearance="?android:attr/textAppearanceMedium" /> |
||||
|
||||
<CheckBox |
||||
android:id="@+id/cbHideStatusBar" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_alignParentRight="true" |
||||
android:layout_centerVertical="true" /> |
||||
</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/rFullScreen" |
||||
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="30dp" |
||||
android:text="@string/fullscreen" |
||||
android:textAppearance="?android:attr/textAppearanceMedium" /> |
||||
|
||||
<CheckBox |
||||
android:id="@+id/cbFullScreen" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_alignParentRight="true" |
||||
android:layout_centerVertical="true" /> |
||||
</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/rWideViewPort" |
||||
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" > |
||||
|
||||
<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/textView1" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:paddingLeft="10dp" |
||||
android:paddingRight="30dp" |
||||
android:text="@string/wideViewPort" |
||||
android:textAppearance="?android:attr/textAppearanceMedium" /> |
||||
|
||||
<TextView |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:paddingLeft="10dp" |
||||
android:paddingRight="30dp" |
||||
android:text="@string/recommended" |
||||
android:textAppearance="?android:attr/textAppearanceSmall" |
||||
android:textColor="@color/light" /> |
||||
</LinearLayout> |
||||
|
||||
<CheckBox |
||||
android:id="@+id/cbWideViewPort" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_alignParentRight="true" |
||||
android:layout_centerVertical="true" /> |
||||
</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/rOverView" |
||||
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" > |
||||
|
||||
<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/textView2" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:paddingLeft="10dp" |
||||
android:paddingRight="30dp" |
||||
android:text="@string/overViewMode" |
||||
android:textAppearance="?android:attr/textAppearanceMedium" /> |
||||
|
||||
<TextView |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:paddingLeft="10dp" |
||||
android:paddingRight="30dp" |
||||
android:text="@string/recommended" |
||||
android:textAppearance="?android:attr/textAppearanceSmall" |
||||
android:textColor="@color/light" /> |
||||
</LinearLayout> |
||||
|
||||
<CheckBox |
||||
android:id="@+id/cbOverView" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_alignParentRight="true" |
||||
android:layout_centerVertical="true" /> |
||||
</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/rTextReflow" |
||||
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_centerVertical="true" |
||||
android:paddingLeft="10dp" |
||||
android:paddingRight="30dp" |
||||
android:text="@string/reflow" |
||||
android:textAppearance="?android:attr/textAppearanceMedium" /> |
||||
|
||||
<CheckBox |
||||
android:id="@+id/cbTextReflow" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_alignParentRight="true" |
||||
android:layout_centerVertical="true" /> |
||||
</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/rTextSize" |
||||
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:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_alignParentLeft="true" |
||||
android:layout_centerVertical="true" |
||||
android:paddingLeft="10dp" |
||||
android:text="@string/size" |
||||
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" /> |
||||
|
||||
</LinearLayout> |
||||
|
||||
</ScrollView> |
@ -0,0 +1,231 @@
@@ -0,0 +1,231 @@
|
||||
<?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" > |
||||
|
||||
<LinearLayout |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:orientation="vertical" > |
||||
|
||||
<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:layout_alignParentLeft="true" |
||||
android:layout_centerVertical="true" |
||||
android:orientation="vertical" > |
||||
|
||||
<TextView |
||||
android:id="@+id/textView4" |
||||
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: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: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/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> |
||||
|
||||
<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" |
||||
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: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/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> |
||||
|
||||
<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" |
||||
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: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" /> |
||||
|
||||
<RelativeLayout |
||||
android:id="@+id/rGoogleSuggestions" |
||||
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" > |
||||
|
||||
<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:paddingRight="30dp" |
||||
android:text="@string/google_suggestions" |
||||
android:textAppearance="?android:attr/textAppearanceMedium" /> |
||||
|
||||
<TextView |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:paddingLeft="10dp" |
||||
android:paddingRight="30dp" |
||||
android:text="@string/powered_by_google" |
||||
android:textAppearance="?android:attr/textAppearanceSmall" |
||||
android:textColor="@color/light" /> |
||||
</LinearLayout> |
||||
|
||||
<CheckBox |
||||
android:id="@+id/cbGoogleSuggestions" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_alignParentRight="true" |
||||
android:layout_centerVertical="true" /> |
||||
</RelativeLayout> |
||||
|
||||
<LinearLayout |
||||
android:layout_width="match_parent" |
||||
android:layout_height="1dp" |
||||
android:layout_marginLeft="5dp" |
||||
android:layout_marginRight="5dp" |
||||
android:background="#cdcdcd" /> |
||||
|
||||
</LinearLayout> |
||||
|
||||
</ScrollView> |
@ -0,0 +1,336 @@
@@ -0,0 +1,336 @@
|
||||
<?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" > |
||||
|
||||
<LinearLayout |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:orientation="vertical" > |
||||
|
||||
<RelativeLayout |
||||
android:id="@+id/rLocation" |
||||
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/textView1" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_alignParentLeft="true" |
||||
android:layout_centerVertical="true" |
||||
android:paddingLeft="10dp" |
||||
android:paddingRight="30dp" |
||||
android:text="@string/location" |
||||
android:textAppearance="?android:attr/textAppearanceMedium" /> |
||||
|
||||
<CheckBox |
||||
android:id="@+id/cbLocation" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_alignParentRight="true" |
||||
android:layout_centerVertical="true" /> |
||||
</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/rSavePasswords" |
||||
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" > |
||||
|
||||
<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/textView2" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:paddingLeft="10dp" |
||||
android:paddingRight="30dp" |
||||
android:text="@string/password" |
||||
android:textAppearance="?android:attr/textAppearanceMedium" /> |
||||
|
||||
<TextView |
||||
android:id="@+id/textView3" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:paddingLeft="10dp" |
||||
android:paddingRight="30dp" |
||||
android:text="@string/recommended" |
||||
android:textAppearance="?android:attr/textAppearanceSmall" |
||||
android:textColor="@color/light" /> |
||||
</LinearLayout> |
||||
|
||||
<CheckBox |
||||
android:id="@+id/cbSavePasswords" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_alignParentRight="true" |
||||
android:layout_centerVertical="true" /> |
||||
</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/rClearCacheExit" |
||||
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="30dp" |
||||
android:text="@string/cache" |
||||
android:textAppearance="?android:attr/textAppearanceMedium" /> |
||||
|
||||
<CheckBox |
||||
android:id="@+id/cbClearCacheExit" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_alignParentRight="true" |
||||
android:layout_centerVertical="true" /> |
||||
</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/rClearHistoryExit" |
||||
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="30dp" |
||||
android:text="@string/clear_history_exit" |
||||
android:textAppearance="?android:attr/textAppearanceMedium" /> |
||||
|
||||
<CheckBox |
||||
android:id="@+id/cbClearHistoryExit" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_alignParentRight="true" |
||||
android:layout_centerVertical="true" /> |
||||
</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/rClearCookiesExit" |
||||
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="30dp" |
||||
android:text="@string/clear_cookies_exit" |
||||
android:textAppearance="?android:attr/textAppearanceMedium" /> |
||||
|
||||
<CheckBox |
||||
android:id="@+id/cbClearCookiesExit" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_alignParentRight="true" |
||||
android:layout_centerVertical="true" /> |
||||
</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/rBrowserHistory" |
||||
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" > |
||||
|
||||
<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:paddingRight="30dp" |
||||
android:text="@string/sync_history" |
||||
android:textAppearance="?android:attr/textAppearanceMedium" /> |
||||
|
||||
<TextView |
||||
android:id="@+id/isBrowserAvailable" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:paddingLeft="10dp" |
||||
android:text="text" |
||||
android:textAppearance="?android:attr/textAppearanceSmall" |
||||
android:textColor="@color/light" /> |
||||
</LinearLayout> |
||||
|
||||
<CheckBox |
||||
android:id="@+id/cbBrowserHistory" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_alignParentRight="true" |
||||
android:layout_centerVertical="true" /> |
||||
</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/rClearCache" |
||||
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:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_alignParentLeft="true" |
||||
android:layout_centerVertical="true" |
||||
android:paddingLeft="10dp" |
||||
android:text="@string/clear_cache" |
||||
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/rClearHistory" |
||||
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:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_alignParentLeft="true" |
||||
android:layout_centerVertical="true" |
||||
android:paddingLeft="10dp" |
||||
android:text="@string/history" |
||||
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/rClearCookies" |
||||
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:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_alignParentLeft="true" |
||||
android:layout_centerVertical="true" |
||||
android:paddingLeft="10dp" |
||||
android:text="@string/clear_cookies" |
||||
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" /> |
||||
|
||||
</LinearLayout> |
||||
|
||||
</ScrollView> |
@ -0,0 +1,126 @@
@@ -0,0 +1,126 @@
|
||||
/* |
||||
* Copyright 2014 A.C.R. Development |
||||
*/ |
||||
package acr.browser.lightning; |
||||
|
||||
import android.app.ActionBar; |
||||
import android.app.Activity; |
||||
import android.content.Context; |
||||
import android.content.Intent; |
||||
import android.content.SharedPreferences; |
||||
import android.content.pm.PackageInfo; |
||||
import android.content.pm.PackageManager.NameNotFoundException; |
||||
import android.net.Uri; |
||||
import android.os.Bundle; |
||||
import android.view.MenuItem; |
||||
import android.view.View; |
||||
import android.view.View.OnClickListener; |
||||
import android.view.WindowManager; |
||||
import android.widget.RelativeLayout; |
||||
import android.widget.TextView; |
||||
|
||||
public class AboutSettingsActivity extends Activity { |
||||
|
||||
// mPreferences variables
|
||||
private static final int API = android.os.Build.VERSION.SDK_INT; |
||||
private SharedPreferences mPreferences; |
||||
private int mEasterEggCounter; |
||||
private Context mContext; |
||||
|
||||
@Override |
||||
protected void onCreate(Bundle savedInstanceState) { |
||||
super.onCreate(savedInstanceState); |
||||
setContentView(R.layout.about_settings); |
||||
|
||||
ActionBar actionBar = getActionBar(); |
||||
if (actionBar != null) { |
||||
actionBar.setHomeButtonEnabled(true); |
||||
actionBar.setDisplayHomeAsUpEnabled(true); |
||||
} |
||||
|
||||
mPreferences = getSharedPreferences(PreferenceConstants.PREFERENCES, 0); |
||||
if (mPreferences.getBoolean(PreferenceConstants.HIDE_STATUS_BAR, false)) { |
||||
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, |
||||
WindowManager.LayoutParams.FLAG_FULLSCREEN); |
||||
} |
||||
|
||||
mContext = this; |
||||
initialize(); |
||||
} |
||||
|
||||
@Override |
||||
public boolean onOptionsItemSelected(MenuItem item) { |
||||
finish(); |
||||
return true; |
||||
} |
||||
|
||||
private void initialize() { |
||||
|
||||
String code = "HOLO"; |
||||
|
||||
try { |
||||
PackageInfo p = getPackageManager().getPackageInfo(getPackageName(), 0); |
||||
code = p.versionName; |
||||
} catch (NameNotFoundException e) { |
||||
// TODO add logging
|
||||
e.printStackTrace(); |
||||
} |
||||
|
||||
TextView version = (TextView) findViewById(R.id.versionCode); |
||||
version.setText(code + ""); |
||||
|
||||
RelativeLayout licenses; |
||||
licenses = (RelativeLayout) findViewById(R.id.layoutLicense); |
||||
|
||||
licenses.setOnClickListener(new OnClickListener() { |
||||
|
||||
@Override |
||||
public void onClick(View arg0) { |
||||
// NOTE: In order to comply with the open source license,
|
||||
// it is advised that you leave this code so that the License
|
||||
// Activity may be viewed by the user.
|
||||
startActivity(new Intent(mContext, LicenseActivity.class)); |
||||
} |
||||
|
||||
}); |
||||
|
||||
RelativeLayout source = (RelativeLayout) findViewById(R.id.layoutSource); |
||||
|
||||
source(source); |
||||
easterEgg(); |
||||
} |
||||
|
||||
public void easterEgg() { |
||||
RelativeLayout easter = (RelativeLayout) findViewById(R.id.layoutVersion); |
||||
easter.setOnClickListener(new OnClickListener() { |
||||
|
||||
@Override |
||||
public void onClick(View v) { |
||||
mEasterEggCounter++; |
||||
if (mEasterEggCounter == 10) { |
||||
|
||||
startActivity(new Intent(Intent.ACTION_VIEW, Uri |
||||
.parse("http://imgs.xkcd.com/comics/compiling.png"), mContext, |
||||
MainActivity.class)); |
||||
finish(); |
||||
mEasterEggCounter = 0; |
||||
} |
||||
} |
||||
|
||||
}); |
||||
} |
||||
|
||||
public void source(RelativeLayout view) { |
||||
view.setOnClickListener(new OnClickListener() { |
||||
|
||||
@Override |
||||
public void onClick(View v) { |
||||
startActivity(new Intent(Intent.ACTION_VIEW, Uri |
||||
.parse("http://twitter.com/ACRDevelopment"), mContext, MainActivity.class)); |
||||
finish(); |
||||
} |
||||
|
||||
}); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,261 @@
@@ -0,0 +1,261 @@
|
||||
/* |
||||
* Copyright 2014 A.C.R. Development |
||||
*/ |
||||
package acr.browser.lightning; |
||||
|
||||
import android.app.ActionBar; |
||||
import android.app.Activity; |
||||
import android.app.AlertDialog; |
||||
import android.content.Context; |
||||
import android.content.DialogInterface; |
||||
import android.content.SharedPreferences; |
||||
import android.os.Bundle; |
||||
import android.view.MenuItem; |
||||
import android.view.View; |
||||
import android.view.View.OnClickListener; |
||||
import android.view.WindowManager; |
||||
import android.widget.CheckBox; |
||||
import android.widget.CompoundButton; |
||||
import android.widget.CompoundButton.OnCheckedChangeListener; |
||||
import android.widget.RelativeLayout; |
||||
|
||||
public class DisplaySettingsActivity extends Activity { |
||||
|
||||
// mPreferences variables
|
||||
private static final int API = android.os.Build.VERSION.SDK_INT; |
||||
private SharedPreferences mPreferences; |
||||
private SharedPreferences.Editor mEditPrefs; |
||||
private CheckBox cbHideStatusBar, cbFullScreen, cbWideViewPort, cbOverView, cbTextReflow; |
||||
private Context mContext; |
||||
|
||||
@Override |
||||
protected void onCreate(Bundle savedInstanceState) { |
||||
super.onCreate(savedInstanceState); |
||||
setContentView(R.layout.display_settings); |
||||
|
||||
ActionBar actionBar = getActionBar(); |
||||
if (actionBar != null) { |
||||
actionBar.setHomeButtonEnabled(true); |
||||
actionBar.setDisplayHomeAsUpEnabled(true); |
||||
} |
||||
|
||||
mPreferences = getSharedPreferences(PreferenceConstants.PREFERENCES, 0); |
||||
if (mPreferences.getBoolean(PreferenceConstants.HIDE_STATUS_BAR, false)) { |
||||
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, |
||||
WindowManager.LayoutParams.FLAG_FULLSCREEN); |
||||
} |
||||
|
||||
// TODO WARNING: SharedPreferences.edit() without a corresponding
|
||||
// commit() or apply() call
|
||||
mEditPrefs = mPreferences.edit(); |
||||
|
||||
mContext = this; |
||||
initialize(); |
||||
} |
||||
|
||||
@Override |
||||
public boolean onOptionsItemSelected(MenuItem item) { |
||||
finish(); |
||||
return true; |
||||
} |
||||
|
||||
private void initialize() { |
||||
|
||||
RelativeLayout rHideStatusBar, rFullScreen, rWideViewPort, rOverView, rTextReflow, rTextSize; |
||||
|
||||
rHideStatusBar = (RelativeLayout) findViewById(R.id.rHideStatusBar); |
||||
rFullScreen = (RelativeLayout) findViewById(R.id.rFullScreen); |
||||
rWideViewPort = (RelativeLayout) findViewById(R.id.rWideViewPort); |
||||
rOverView = (RelativeLayout) findViewById(R.id.rOverView); |
||||
rTextReflow = (RelativeLayout) findViewById(R.id.rTextReflow); |
||||
rTextSize = (RelativeLayout) findViewById(R.id.rTextSize); |
||||
|
||||
cbHideStatusBar = (CheckBox) findViewById(R.id.cbHideStatusBar); |
||||
cbFullScreen = (CheckBox) findViewById(R.id.cbFullScreen); |
||||
cbWideViewPort = (CheckBox) findViewById(R.id.cbWideViewPort); |
||||
cbOverView = (CheckBox) findViewById(R.id.cbOverView); |
||||
cbTextReflow = (CheckBox) findViewById(R.id.cbTextReflow); |
||||
|
||||
cbHideStatusBar.setChecked(mPreferences.getBoolean(PreferenceConstants.HIDE_STATUS_BAR, false)); |
||||
cbFullScreen.setChecked(mPreferences.getBoolean(PreferenceConstants.FULL_SCREEN, false)); |
||||
cbWideViewPort.setChecked(mPreferences.getBoolean(PreferenceConstants.USE_WIDE_VIEWPORT, true)); |
||||
cbOverView.setChecked(mPreferences.getBoolean(PreferenceConstants.OVERVIEW_MODE, true)); |
||||
cbTextReflow.setChecked(mPreferences.getBoolean(PreferenceConstants.TEXT_REFLOW, false)); |
||||
cbTextReflow.setEnabled(API < 19); |
||||
if (API >= 19) { |
||||
mEditPrefs.putBoolean(PreferenceConstants.TEXT_REFLOW, false); |
||||
mEditPrefs.commit(); |
||||
} |
||||
|
||||
rHideStatusBar(rHideStatusBar); |
||||
rFullScreen(rFullScreen); |
||||
rWideViewPort(rWideViewPort); |
||||
rOverView(rOverView); |
||||
rTextReflow(rTextReflow); |
||||
rTextSize(rTextSize); |
||||
cbHideStatusBar(cbHideStatusBar); |
||||
cbFullScreen(cbFullScreen); |
||||
cbWideViewPort(cbWideViewPort); |
||||
cbOverView(cbOverView); |
||||
cbTextReflow(cbTextReflow); |
||||
} |
||||
|
||||
private void cbHideStatusBar(CheckBox view) { |
||||
view.setOnCheckedChangeListener(new OnCheckedChangeListener() { |
||||
|
||||
@Override |
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { |
||||
mEditPrefs.putBoolean(PreferenceConstants.HIDE_STATUS_BAR, isChecked); |
||||
mEditPrefs.commit(); |
||||
} |
||||
|
||||
}); |
||||
} |
||||
|
||||
private void cbFullScreen(CheckBox view) { |
||||
view.setOnCheckedChangeListener(new OnCheckedChangeListener() { |
||||
|
||||
@Override |
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { |
||||
mEditPrefs.putBoolean(PreferenceConstants.FULL_SCREEN, isChecked); |
||||
mEditPrefs.commit(); |
||||
} |
||||
|
||||
}); |
||||
} |
||||
|
||||
|
||||
private void cbWideViewPort(CheckBox view) { |
||||
view.setOnCheckedChangeListener(new OnCheckedChangeListener() { |
||||
|
||||
@Override |
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { |
||||
mEditPrefs.putBoolean(PreferenceConstants.USE_WIDE_VIEWPORT, isChecked); |
||||
mEditPrefs.commit(); |
||||
} |
||||
|
||||
}); |
||||
} |
||||
|
||||
private void cbOverView(CheckBox view) { |
||||
view.setOnCheckedChangeListener(new OnCheckedChangeListener() { |
||||
|
||||
@Override |
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { |
||||
mEditPrefs.putBoolean(PreferenceConstants.OVERVIEW_MODE, isChecked); |
||||
mEditPrefs.commit(); |
||||
} |
||||
|
||||
}); |
||||
} |
||||
|
||||
private void cbTextReflow(CheckBox view) { |
||||
view.setOnCheckedChangeListener(new OnCheckedChangeListener() { |
||||
|
||||
@Override |
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { |
||||
mEditPrefs.putBoolean(PreferenceConstants.TEXT_REFLOW, isChecked); |
||||
mEditPrefs.commit(); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
private void rHideStatusBar(RelativeLayout view) { |
||||
view.setOnClickListener(new OnClickListener() { |
||||
|
||||
@Override |
||||
public void onClick(View v) { |
||||
cbHideStatusBar.setChecked(!cbHideStatusBar.isChecked()); |
||||
} |
||||
|
||||
}); |
||||
} |
||||
|
||||
private void rFullScreen(RelativeLayout view) { |
||||
view.setOnClickListener(new OnClickListener() { |
||||
|
||||
@Override |
||||
public void onClick(View v) { |
||||
cbFullScreen.setChecked(!cbFullScreen.isChecked()); |
||||
} |
||||
|
||||
}); |
||||
} |
||||
|
||||
private void rWideViewPort(RelativeLayout view) { |
||||
view.setOnClickListener(new OnClickListener() { |
||||
|
||||
@Override |
||||
public void onClick(View v) { |
||||
// TODO Auto-generated method stub
|
||||
cbWideViewPort.setChecked(!cbWideViewPort.isChecked()); |
||||
} |
||||
|
||||
}); |
||||
|
||||
} |
||||
|
||||
private void rOverView(RelativeLayout view) { |
||||
view.setOnClickListener(new OnClickListener() { |
||||
|
||||
@Override |
||||
public void onClick(View v) { |
||||
// TODO Auto-generated method stub
|
||||
cbOverView.setChecked(!cbOverView.isChecked()); |
||||
} |
||||
|
||||
}); |
||||
} |
||||
|
||||
private void rTextReflow(RelativeLayout view) { |
||||
view.setOnClickListener(new OnClickListener() { |
||||
|
||||
@Override |
||||
public void onClick(View v) { |
||||
// TODO Auto-generated method stub
|
||||
if (API < 19) { |
||||
cbTextReflow.setChecked(!cbTextReflow.isChecked()); |
||||
} else { |
||||
Utils.createInformativeDialog(mContext, |
||||
getResources().getString(R.string.title_warning), getResources() |
||||
.getString(R.string.dialog_reflow_warning)); |
||||
} |
||||
} |
||||
|
||||
}); |
||||
} |
||||
|
||||
private void rTextSize(RelativeLayout view) { |
||||
view.setOnClickListener(new OnClickListener() { |
||||
|
||||
@Override |
||||
public void onClick(View v) { |
||||
AlertDialog.Builder picker = new AlertDialog.Builder(DisplaySettingsActivity.this); |
||||
picker.setTitle(getResources().getString(R.string.title_text_size)); |
||||
|
||||
int n = mPreferences.getInt(PreferenceConstants.TEXT_SIZE, 3); |
||||
|
||||
picker.setSingleChoiceItems(R.array.text_size, n - 1, |
||||
new DialogInterface.OnClickListener() { |
||||
|
||||
@Override |
||||
public void onClick(DialogInterface dialog, int which) { |
||||
mEditPrefs.putInt(PreferenceConstants.TEXT_SIZE, which + 1); |
||||
mEditPrefs.commit(); |
||||
|
||||
} |
||||
}); |
||||
picker.setNeutralButton(getResources().getString(R.string.action_ok), |
||||
new DialogInterface.OnClickListener() { |
||||
|
||||
@Override |
||||
public void onClick(DialogInterface dialog, int which) { |
||||
|
||||
} |
||||
}); |
||||
picker.show(); |
||||
} |
||||
|
||||
}); |
||||
} |
||||
} |
@ -0,0 +1,564 @@
@@ -0,0 +1,564 @@
|
||||
/* |
||||
* Copyright 2014 A.C.R. Development |
||||
*/ |
||||
package acr.browser.lightning; |
||||
|
||||
import android.app.ActionBar; |
||||
import android.app.Activity; |
||||
import android.app.AlertDialog; |
||||
import android.content.DialogInterface; |
||||
import android.content.DialogInterface.OnCancelListener; |
||||
import android.content.SharedPreferences; |
||||
import android.graphics.Color; |
||||
import android.os.Bundle; |
||||
import android.os.Environment; |
||||
import android.util.Log; |
||||
import android.util.TypedValue; |
||||
import android.view.MenuItem; |
||||
import android.view.View; |
||||
import android.view.View.OnClickListener; |
||||
import android.view.WindowManager; |
||||
import android.widget.CheckBox; |
||||
import android.widget.CompoundButton; |
||||
import android.widget.CompoundButton.OnCheckedChangeListener; |
||||
import android.widget.EditText; |
||||
import android.widget.LinearLayout; |
||||
import android.widget.RelativeLayout; |
||||
import android.widget.TextView; |
||||
|
||||
public class GeneralSettingsActivity extends Activity { |
||||
|
||||
// mPreferences variables
|
||||
private static final int API = android.os.Build.VERSION.SDK_INT; |
||||
private SharedPreferences mPreferences; |
||||
private SharedPreferences.Editor mEditPrefs; |
||||
private int mAgentChoice; |
||||
private String mHomepage; |
||||
private TextView mAgentTextView; |
||||
private TextView mDownloadTextView; |
||||
private String mDownloadLocation; |
||||
private TextView mHomepageText; |
||||
private TextView mSearchText; |
||||
private CheckBox cbSearchSuggestions; |
||||
private Activity mActivity; |
||||
|
||||
@Override |
||||
protected void onCreate(Bundle savedInstanceState) { |
||||
super.onCreate(savedInstanceState); |
||||
setContentView(R.layout.general_settings); |
||||
|
||||
ActionBar actionBar = getActionBar(); |
||||
if (actionBar != null) { |
||||
actionBar.setHomeButtonEnabled(true); |
||||
actionBar.setDisplayHomeAsUpEnabled(true); |
||||
} |
||||
|
||||
mPreferences = getSharedPreferences(PreferenceConstants.PREFERENCES, 0); |
||||
if (mPreferences.getBoolean(PreferenceConstants.HIDE_STATUS_BAR, false)) { |
||||
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, |
||||
WindowManager.LayoutParams.FLAG_FULLSCREEN); |
||||
} |
||||
|
||||
// TODO WARNING: SharedPreferences.edit() without a corresponding
|
||||
// commit() or apply() call
|
||||
mEditPrefs = mPreferences.edit(); |
||||
|
||||
mActivity = this; |
||||
initialize(); |
||||
} |
||||
|
||||
@Override |
||||
public boolean onOptionsItemSelected(MenuItem item) { |
||||
finish(); |
||||
return true; |
||||
} |
||||
|
||||
private void initialize() { |
||||
|
||||
mSearchText = (TextView) findViewById(R.id.searchText); |
||||
|
||||
switch (mPreferences.getInt(PreferenceConstants.SEARCH, 1)) { |
||||
case 0: |
||||
mSearchText.setText(getResources().getString(R.string.custom_url)); |
||||
break; |
||||
case 1: |
||||
mSearchText.setText("Google"); |
||||
break; |
||||
case 2: |
||||
mSearchText.setText("Android Search"); |
||||
break; |
||||
case 3: |
||||
mSearchText.setText("Bing"); |
||||
break; |
||||
case 4: |
||||
mSearchText.setText("Yahoo"); |
||||
break; |
||||
case 5: |
||||
mSearchText.setText("StartPage"); |
||||
break; |
||||
case 6: |
||||
mSearchText.setText("StartPage (Mobile)"); |
||||
break; |
||||
case 7: |
||||
mSearchText.setText("DuckDuckGo"); |
||||
break; |
||||
case 8: |
||||
mSearchText.setText("DuckDuckGo Lite"); |
||||
break; |
||||
case 9: |
||||
mSearchText.setText("Baidu"); |
||||
break; |
||||
case 10: |
||||
mSearchText.setText("Yandex"); |
||||
} |
||||
|
||||
mAgentTextView = (TextView) findViewById(R.id.agentText); |
||||
mHomepageText = (TextView) findViewById(R.id.homepageText); |
||||
mDownloadTextView = (TextView) findViewById(R.id.downloadText); |
||||
mAgentChoice = mPreferences.getInt(PreferenceConstants.USER_AGENT, 1); |
||||
mHomepage = mPreferences.getString(PreferenceConstants.HOMEPAGE, Constants.HOMEPAGE); |
||||
mDownloadLocation = mPreferences.getString(PreferenceConstants.DOWNLOAD_DIRECTORY, |
||||
Environment.DIRECTORY_DOWNLOADS); |
||||
|
||||
mDownloadTextView.setText(Constants.EXTERNAL_STORAGE + '/' + mDownloadLocation); |
||||
|
||||
if (mHomepage.contains("about:home")) { |
||||
mHomepageText.setText(getResources().getString(R.string.action_homepage)); |
||||
} else if (mHomepage.contains("about:blank")) { |
||||
mHomepageText.setText(getResources().getString(R.string.action_blank)); |
||||
} else if (mHomepage.contains("about:bookmarks")) { |
||||
mHomepageText.setText(getResources().getString(R.string.action_bookmarks)); |
||||
} else { |
||||
mHomepageText.setText(mHomepage); |
||||
} |
||||
|
||||
switch (mAgentChoice) { |
||||
case 1: |
||||
mAgentTextView.setText(getResources().getString(R.string.agent_default)); |
||||
break; |
||||
case 2: |
||||
mAgentTextView.setText(getResources().getString(R.string.agent_desktop)); |
||||
break; |
||||
case 3: |
||||
mAgentTextView.setText(getResources().getString(R.string.agent_mobile)); |
||||
break; |
||||
case 4: |
||||
mAgentTextView.setText(getResources().getString(R.string.agent_custom)); |
||||
} |
||||
|
||||
RelativeLayout rSearchSuggestions; |
||||
rSearchSuggestions = (RelativeLayout) findViewById(R.id.rGoogleSuggestions); |
||||
|
||||
cbSearchSuggestions = (CheckBox) findViewById(R.id.cbGoogleSuggestions); |
||||
|
||||
cbSearchSuggestions.setChecked(mPreferences.getBoolean( |
||||
PreferenceConstants.GOOGLE_SEARCH_SUGGESTIONS, true)); |
||||
|
||||
RelativeLayout agent = (RelativeLayout) findViewById(R.id.layoutUserAgent); |
||||
RelativeLayout download = (RelativeLayout) findViewById(R.id.layoutDownload); |
||||
RelativeLayout homepage = (RelativeLayout) findViewById(R.id.layoutHomepage); |
||||
|
||||
agent(agent); |
||||
download(download); |
||||
homepage(homepage); |
||||
search(); |
||||
|
||||
rSearchSuggestions(rSearchSuggestions); |
||||
cbSearchSuggestions(cbSearchSuggestions); |
||||
} |
||||
|
||||
public void search() { |
||||
RelativeLayout search = (RelativeLayout) findViewById(R.id.layoutSearch); |
||||
search.setOnClickListener(new OnClickListener() { |
||||
|
||||
@Override |
||||
public void onClick(View v) { |
||||
AlertDialog.Builder picker = new AlertDialog.Builder(mActivity); |
||||
picker.setTitle(getResources().getString(R.string.title_search_engine)); |
||||
CharSequence[] chars = { getResources().getString(R.string.custom_url), "Google", |
||||
"Android Search", "Bing", "Yahoo", "StartPage", "StartPage (Mobile)", |
||||
"DuckDuckGo (Privacy)", "DuckDuckGo Lite (Privacy)", "Baidu (Chinese)", |
||||
"Yandex (Russian)" }; |
||||
|
||||
int n = mPreferences.getInt(PreferenceConstants.SEARCH, 1); |
||||
|
||||
picker.setSingleChoiceItems(chars, n, new DialogInterface.OnClickListener() { |
||||
|
||||
@Override |
||||
public void onClick(DialogInterface dialog, int which) { |
||||
mEditPrefs.putInt(PreferenceConstants.SEARCH, which); |
||||
mEditPrefs.commit(); |
||||
switch (which) { |
||||
case 0: |
||||
searchUrlPicker(); |
||||
break; |
||||
case 1: |
||||
mSearchText.setText("Google"); |
||||
break; |
||||
case 2: |
||||
mSearchText.setText("Android Search"); |
||||
break; |
||||
case 3: |
||||
mSearchText.setText("Bing"); |
||||
break; |
||||
case 4: |
||||
mSearchText.setText("Yahoo"); |
||||
break; |
||||
case 5: |
||||
mSearchText.setText("StartPage"); |
||||
break; |
||||
case 6: |
||||
mSearchText.setText("StartPage (Mobile)"); |
||||
break; |
||||
case 7: |
||||
mSearchText.setText("DuckDuckGo"); |
||||
break; |
||||
case 8: |
||||
mSearchText.setText("DuckDuckGo Lite"); |
||||
break; |
||||
case 9: |
||||
mSearchText.setText("Baidu"); |
||||
break; |
||||
case 10: |
||||
mSearchText.setText("Yandex"); |
||||
} |
||||
} |
||||
}); |
||||
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); |
||||
|
||||
urlPicker.setTitle(getResources().getString(R.string.custom_url)); |
||||
final EditText getSearchUrl = new EditText(this); |
||||
|
||||
String mSearchUrl = mPreferences.getString(PreferenceConstants.SEARCH_URL, |
||||
Constants.GOOGLE_SEARCH); |
||||
getSearchUrl.setText(mSearchUrl); |
||||
urlPicker.setView(getSearchUrl); |
||||
urlPicker.setPositiveButton(getResources().getString(R.string.action_ok), |
||||
new DialogInterface.OnClickListener() { |
||||
|
||||
@Override |
||||
public void onClick(DialogInterface dialog, int which) { |
||||
String text = getSearchUrl.getText().toString(); |
||||
mEditPrefs.putString(PreferenceConstants.SEARCH_URL, text); |
||||
mEditPrefs.commit(); |
||||
mSearchText.setText(getResources().getString(R.string.custom_url) + ": " |
||||
+ text); |
||||
} |
||||
}); |
||||
urlPicker.show(); |
||||
} |
||||
|
||||
public void agent(RelativeLayout view) { |
||||
view.setOnClickListener(new OnClickListener() { |
||||
|
||||
@Override |
||||
public void onClick(View v) { |
||||
AlertDialog.Builder agentPicker = new AlertDialog.Builder(mActivity); |
||||
agentPicker.setTitle(getResources().getString(R.string.title_user_agent)); |
||||
mAgentChoice = mPreferences.getInt(PreferenceConstants.USER_AGENT, 1); |
||||
agentPicker.setSingleChoiceItems(R.array.user_agent, mAgentChoice - 1, |
||||
new DialogInterface.OnClickListener() { |
||||
|
||||
@Override |
||||
public void onClick(DialogInterface dialog, int which) { |
||||
mEditPrefs.putInt(PreferenceConstants.USER_AGENT, which + 1); |
||||
mEditPrefs.commit(); |
||||
switch (which + 1) { |
||||
case 1: |
||||
mAgentTextView.setText(getResources().getString( |
||||
R.string.agent_default)); |
||||
break; |
||||
case 2: |
||||
mAgentTextView.setText(getResources().getString( |
||||
R.string.agent_desktop)); |
||||
break; |
||||
case 3: |
||||
mAgentTextView.setText(getResources().getString( |
||||
R.string.agent_mobile)); |
||||
break; |
||||
case 4: |
||||
mAgentTextView.setText(getResources().getString( |
||||
R.string.agent_custom)); |
||||
agentPicker(); |
||||
break; |
||||
} |
||||
} |
||||
}); |
||||
agentPicker.setNeutralButton(getResources().getString(R.string.action_ok), |
||||
new DialogInterface.OnClickListener() { |
||||
|
||||
@Override |
||||
public void onClick(DialogInterface dialog, int which) { |
||||
// TODO Auto-generated method stub
|
||||
|
||||
} |
||||
|
||||
}); |
||||
agentPicker.setOnCancelListener(new DialogInterface.OnCancelListener() { |
||||
|
||||
@Override |
||||
public void onCancel(DialogInterface dialog) { |
||||
// TODO Auto-generated method stub
|
||||
Log.i("Cancelled", ""); |
||||
} |
||||
}); |
||||
agentPicker.show(); |
||||
|
||||
} |
||||
|
||||
}); |
||||
} |
||||
|
||||
public void agentPicker() { |
||||
final AlertDialog.Builder agentStringPicker = new AlertDialog.Builder(mActivity); |
||||
|
||||
agentStringPicker.setTitle(getResources().getString(R.string.title_user_agent)); |
||||
final EditText getAgent = new EditText(this); |
||||
agentStringPicker.setView(getAgent); |
||||
agentStringPicker.setPositiveButton(getResources().getString(R.string.action_ok), |
||||
new DialogInterface.OnClickListener() { |
||||
|
||||
@Override |
||||
public void onClick(DialogInterface dialog, int which) { |
||||
String text = getAgent.getText().toString(); |
||||
mEditPrefs.putString(PreferenceConstants.USER_AGENT_STRING, text); |
||||
mEditPrefs.commit(); |
||||
mAgentTextView.setText(getResources().getString(R.string.agent_custom)); |
||||
} |
||||
}); |
||||
agentStringPicker.show(); |
||||
} |
||||
|
||||
public void download(RelativeLayout view) { |
||||
view.setOnClickListener(new OnClickListener() { |
||||
|
||||
@Override |
||||
public void onClick(View v) { |
||||
|
||||
AlertDialog.Builder picker = new AlertDialog.Builder(mActivity); |
||||
picker.setTitle(getResources().getString(R.string.title_download_location)); |
||||
mDownloadLocation = mPreferences.getString(PreferenceConstants.DOWNLOAD_DIRECTORY, |
||||
Environment.DIRECTORY_DOWNLOADS); |
||||
int n; |
||||
if (mDownloadLocation.contains(Environment.DIRECTORY_DOWNLOADS)) { |
||||
n = 1; |
||||
} else { |
||||
n = 2; |
||||
} |
||||
|
||||
picker.setSingleChoiceItems(R.array.download_folder, n - 1, |
||||
new DialogInterface.OnClickListener() { |
||||
|
||||
@Override |
||||
public void onClick(DialogInterface dialog, int which) { |
||||
|
||||
switch (which + 1) { |
||||
case 1: |
||||
mEditPrefs.putString( |
||||
PreferenceConstants.DOWNLOAD_DIRECTORY, |
||||
Environment.DIRECTORY_DOWNLOADS); |
||||
mEditPrefs.commit(); |
||||
mDownloadTextView.setText(Constants.EXTERNAL_STORAGE + '/' |
||||
+ Environment.DIRECTORY_DOWNLOADS); |
||||
break; |
||||
case 2: |
||||
downPicker(); |
||||
|
||||
break; |
||||
} |
||||
} |
||||
}); |
||||
picker.setNeutralButton(getResources().getString(R.string.action_ok), |
||||
new DialogInterface.OnClickListener() { |
||||
|
||||
@Override |
||||
public void onClick(DialogInterface dialog, int which) { |
||||
|
||||
} |
||||
}); |
||||
picker.show(); |
||||
} |
||||
|
||||
}); |
||||
} |
||||
|
||||
public void homePicker() { |
||||
final AlertDialog.Builder homePicker = new AlertDialog.Builder(mActivity); |
||||
homePicker.setTitle(getResources().getString(R.string.title_custom_homepage)); |
||||
final EditText getHome = new EditText(this); |
||||
mHomepage = mPreferences.getString(PreferenceConstants.HOMEPAGE, Constants.HOMEPAGE); |
||||
if (!mHomepage.startsWith("about:")) { |
||||
getHome.setText(mHomepage); |
||||
} else { |
||||
getHome.setText("http://www.google.com"); |
||||
} |
||||
homePicker.setView(getHome); |
||||
homePicker.setPositiveButton(getResources().getString(R.string.action_ok), |
||||
new DialogInterface.OnClickListener() { |
||||
|
||||
@Override |
||||
public void onClick(DialogInterface dialog, int which) { |
||||
String text = getHome.getText().toString(); |
||||
mEditPrefs.putString(PreferenceConstants.HOMEPAGE, text); |
||||
mEditPrefs.commit(); |
||||
mHomepageText.setText(text); |
||||
} |
||||
}); |
||||
homePicker.show(); |
||||
} |
||||
|
||||
@SuppressWarnings("deprecation") |
||||
public void downPicker() { |
||||
final AlertDialog.Builder downLocationPicker = new AlertDialog.Builder(mActivity); |
||||
LinearLayout layout = new LinearLayout(this); |
||||
downLocationPicker.setTitle(getResources().getString(R.string.title_download_location)); |
||||
final EditText getDownload = new EditText(this); |
||||
getDownload.setBackgroundResource(0); |
||||
mDownloadLocation = mPreferences.getString(PreferenceConstants.DOWNLOAD_DIRECTORY, |
||||
Environment.DIRECTORY_DOWNLOADS); |
||||
int padding = Utils.convertToDensityPixels(this, 10); |
||||
|
||||
LinearLayout.LayoutParams lparams = new LinearLayout.LayoutParams( |
||||
LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT); |
||||
|
||||
getDownload.setLayoutParams(lparams); |
||||
getDownload.setTextColor(Color.DKGRAY); |
||||
getDownload.setText(mDownloadLocation); |
||||
getDownload.setPadding(0, padding, padding, padding); |
||||
|
||||
TextView v = new TextView(this); |
||||
v.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18); |
||||
v.setTextColor(Color.DKGRAY); |
||||
v.setText(Constants.EXTERNAL_STORAGE + '/'); |
||||
v.setPadding(padding, padding, 0, padding); |
||||
layout.addView(v); |
||||
layout.addView(getDownload); |
||||
if (API < 16) { |
||||
layout.setBackgroundDrawable(getResources().getDrawable(android.R.drawable.edit_text)); |
||||
} else { |
||||
layout.setBackground(getResources().getDrawable(android.R.drawable.edit_text)); |
||||
} |
||||
downLocationPicker.setView(layout); |
||||
downLocationPicker.setPositiveButton(getResources().getString(R.string.action_ok), |
||||
new DialogInterface.OnClickListener() { |
||||
|
||||
@Override |
||||
public void onClick(DialogInterface dialog, int which) { |
||||
String text = getDownload.getText().toString(); |
||||
mEditPrefs.putString(PreferenceConstants.DOWNLOAD_DIRECTORY, text); |
||||
mEditPrefs.commit(); |
||||
mDownloadTextView.setText(Constants.EXTERNAL_STORAGE + '/' + text); |
||||
} |
||||
}); |
||||
downLocationPicker.show(); |
||||
} |
||||
|
||||
public void homepage(RelativeLayout view) { |
||||
view.setOnClickListener(new OnClickListener() { |
||||
|
||||
@Override |
||||
public void onClick(View v) { |
||||
AlertDialog.Builder picker = new AlertDialog.Builder(mActivity); |
||||
picker.setTitle(getResources().getString(R.string.home)); |
||||
mHomepage = mPreferences |
||||
.getString(PreferenceConstants.HOMEPAGE, Constants.HOMEPAGE); |
||||
int n; |
||||
if (mHomepage.contains("about:home")) { |
||||
n = 1; |
||||
} else if (mHomepage.contains("about:blank")) { |
||||
n = 2; |
||||
} else if (mHomepage.contains("about:bookmarks")) { |
||||
n = 3; |
||||
} else { |
||||
n = 4; |
||||
} |
||||
|
||||
picker.setSingleChoiceItems(R.array.homepage, n - 1, |
||||
new DialogInterface.OnClickListener() { |
||||
|
||||
@Override |
||||
public void onClick(DialogInterface dialog, int which) { |
||||
|
||||
switch (which + 1) { |
||||
case 1: |
||||
mEditPrefs.putString(PreferenceConstants.HOMEPAGE, |
||||
"about:home"); |
||||
mEditPrefs.commit(); |
||||
mHomepageText.setText(getResources().getString( |
||||
R.string.action_homepage)); |
||||
break; |
||||
case 2: |
||||
mEditPrefs.putString(PreferenceConstants.HOMEPAGE, |
||||
"about:blank"); |
||||
mEditPrefs.commit(); |
||||
mHomepageText.setText(getResources().getString( |
||||
R.string.action_blank)); |
||||
break; |
||||
case 3: |
||||
mEditPrefs.putString(PreferenceConstants.HOMEPAGE, |
||||
"about:bookmarks"); |
||||
mEditPrefs.commit(); |
||||
mHomepageText.setText(getResources().getString( |
||||
R.string.action_bookmarks)); |
||||
|
||||
break; |
||||
case 4: |
||||
homePicker(); |
||||
|
||||
break; |
||||
} |
||||
} |
||||
}); |
||||
picker.setNeutralButton(getResources().getString(R.string.action_ok), |
||||
new DialogInterface.OnClickListener() { |
||||
|
||||
@Override |
||||
public void onClick(DialogInterface dialog, int which) { |
||||
|
||||
} |
||||
}); |
||||
picker.show(); |
||||
} |
||||
|
||||
}); |
||||
} |
||||
|
||||
private void cbSearchSuggestions(CheckBox view) { |
||||
view.setOnCheckedChangeListener(new OnCheckedChangeListener() { |
||||
|
||||
@Override |
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { |
||||
mEditPrefs.putBoolean(PreferenceConstants.GOOGLE_SEARCH_SUGGESTIONS, isChecked); |
||||
mEditPrefs.commit(); |
||||
} |
||||
|
||||
}); |
||||
} |
||||
|
||||
private void rSearchSuggestions(RelativeLayout view) { |
||||
view.setOnClickListener(new OnClickListener() { |
||||
|
||||
@Override |
||||
public void onClick(View arg0) { |
||||
cbSearchSuggestions.setChecked(!cbSearchSuggestions.isChecked()); |
||||
} |
||||
|
||||
}); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,419 @@
@@ -0,0 +1,419 @@
|
||||
/* |
||||
* Copyright 2014 A.C.R. Development |
||||
*/ |
||||
package acr.browser.lightning; |
||||
|
||||
import android.app.ActionBar; |
||||
import android.app.Activity; |
||||
import android.app.AlertDialog; |
||||
import android.content.Context; |
||||
import android.content.DialogInterface; |
||||
import android.content.SharedPreferences; |
||||
import android.os.Bundle; |
||||
import android.os.Handler; |
||||
import android.os.Message; |
||||
import android.provider.Browser; |
||||
import android.view.MenuItem; |
||||
import android.view.View; |
||||
import android.view.View.OnClickListener; |
||||
import android.view.WindowManager; |
||||
import android.webkit.*; |
||||
import android.widget.CheckBox; |
||||
import android.widget.CompoundButton; |
||||
import android.widget.CompoundButton.OnCheckedChangeListener; |
||||
import android.widget.RelativeLayout; |
||||
import android.widget.TextView; |
||||
|
||||
public class PrivacySettingsActivity extends Activity { |
||||
|
||||
// mPreferences variables
|
||||
private static final int API = android.os.Build.VERSION.SDK_INT; |
||||
private SharedPreferences mPreferences; |
||||
private SharedPreferences.Editor mEditPrefs; |
||||
private CheckBox cbLocation, cbSavePasswords, cbClearCacheExit, cbClearHistoryExit, cbClearCookiesExit; |
||||
private Context mContext; |
||||
private boolean mSystemBrowser; |
||||
private Handler messageHandler; |
||||
|
||||
@Override |
||||
protected void onCreate(Bundle savedInstanceState) { |
||||
super.onCreate(savedInstanceState); |
||||
setContentView(R.layout.privacy_settings); |
||||
|
||||
ActionBar actionBar = getActionBar(); |
||||
if (actionBar != null) { |
||||
actionBar.setHomeButtonEnabled(true); |
||||
actionBar.setDisplayHomeAsUpEnabled(true); |
||||
} |
||||
|
||||
mPreferences = getSharedPreferences(PreferenceConstants.PREFERENCES, 0); |
||||
if (mPreferences.getBoolean(PreferenceConstants.HIDE_STATUS_BAR, false)) { |
||||
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, |
||||
WindowManager.LayoutParams.FLAG_FULLSCREEN); |
||||
} |
||||
|
||||
// TODO WARNING: SharedPreferences.edit() without a corresponding
|
||||
// commit() or apply() call
|
||||
mEditPrefs = mPreferences.edit(); |
||||
|
||||
mSystemBrowser = mPreferences.getBoolean(PreferenceConstants.SYSTEM_BROWSER_PRESENT, false); |
||||
mContext = this; |
||||
initialize(); |
||||
} |
||||
|
||||
@Override |
||||
public boolean onOptionsItemSelected(MenuItem item) { |
||||
finish(); |
||||
return true; |
||||
} |
||||
|
||||
private void initialize() { |
||||
|
||||
RelativeLayout rLocation, rSavePasswords, rClearCacheExit, rClearHistoryExit, rClearCookiesExit, rClearCache, rClearHistory, rClearCookies; |
||||
|
||||
rLocation = (RelativeLayout) findViewById(R.id.rLocation); |
||||
rSavePasswords = (RelativeLayout) findViewById(R.id.rSavePasswords); |
||||
rClearCacheExit = (RelativeLayout) findViewById(R.id.rClearCacheExit); |
||||
rClearHistoryExit = (RelativeLayout) findViewById(R.id.rClearHistoryExit); |
||||
rClearCookiesExit = (RelativeLayout) findViewById(R.id.rClearCookiesExit); |
||||
rClearCache = (RelativeLayout) findViewById(R.id.rClearCache); |
||||
rClearHistory = (RelativeLayout) findViewById(R.id.rClearHistory); |
||||
rClearCookies = (RelativeLayout) findViewById(R.id.rClearCookies); |
||||
|
||||
cbLocation = (CheckBox) findViewById(R.id.cbLocation); |
||||
cbSavePasswords = (CheckBox) findViewById(R.id.cbSavePasswords); |
||||
cbClearCacheExit = (CheckBox) findViewById(R.id.cbClearCacheExit); |
||||
cbClearHistoryExit = (CheckBox) findViewById(R.id.cbClearHistoryExit); |
||||
cbClearCookiesExit = (CheckBox) findViewById(R.id.cbClearCookiesExit); |
||||
|
||||
cbLocation.setChecked(mPreferences.getBoolean(PreferenceConstants.LOCATION, false)); |
||||
cbSavePasswords.setChecked(mPreferences.getBoolean(PreferenceConstants.SAVE_PASSWORDS, true)); |
||||
cbClearCacheExit.setChecked(mPreferences.getBoolean(PreferenceConstants.CLEAR_CACHE_EXIT, false)); |
||||
cbClearHistoryExit.setChecked(mPreferences.getBoolean( |
||||
PreferenceConstants.CLEAR_HISTORY_EXIT, false)); |
||||
cbClearCookiesExit.setChecked(mPreferences.getBoolean( |
||||
PreferenceConstants.CLEAR_COOKIES_EXIT, false)); |
||||
|
||||
rLocation(rLocation); |
||||
rSavePasswords(rSavePasswords); |
||||
rClearCacheExit(rClearCacheExit); |
||||
rClearHistoryExit(rClearHistoryExit); |
||||
rClearCookiesExit(rClearCookiesExit); |
||||
rClearCache(rClearCache); |
||||
rClearHistory(rClearHistory); |
||||
rClearCookies(rClearCookies); |
||||
cbLocation(cbLocation); |
||||
cbSavePasswords(cbSavePasswords); |
||||
cbClearCacheExit(cbClearCacheExit); |
||||
cbClearHistoryExit(cbClearHistoryExit); |
||||
cbClearCookiesExit(cbClearCookiesExit); |
||||
|
||||
TextView syncHistory = (TextView) findViewById(R.id.isBrowserAvailable); |
||||
|
||||
RelativeLayout layoutSyncHistory = (RelativeLayout) findViewById(R.id.rBrowserHistory); |
||||
final CheckBox cbSyncHistory = (CheckBox) findViewById(R.id.cbBrowserHistory); |
||||
layoutSyncHistory.setOnClickListener(new OnClickListener() { |
||||
|
||||
@Override |
||||
public void onClick(View v) { |
||||
cbSyncHistory.setChecked(!cbSyncHistory.isChecked()); |
||||
} |
||||
|
||||
}); |
||||
cbSyncHistory.setOnCheckedChangeListener(new OnCheckedChangeListener() { |
||||
|
||||
@Override |
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { |
||||
mEditPrefs.putBoolean(PreferenceConstants.SYNC_HISTORY, isChecked).apply(); |
||||
} |
||||
|
||||
}); |
||||
|
||||
if (!mSystemBrowser) { |
||||
cbSyncHistory.setChecked(false); |
||||
cbSyncHistory.setEnabled(false); |
||||
syncHistory.setText(getResources().getString(R.string.stock_browser_unavailable)); |
||||
} else { |
||||
cbSyncHistory.setEnabled(true); |
||||
cbSyncHistory.setChecked(mPreferences |
||||
.getBoolean(PreferenceConstants.SYNC_HISTORY, true)); |
||||
syncHistory.setText(getResources().getString(R.string.stock_browser_available)); |
||||
} |
||||
|
||||
messageHandler = new MessageHandler(mContext); |
||||
} |
||||
|
||||
private static class MessageHandler extends Handler { |
||||
|
||||
Context mHandlerContext; |
||||
|
||||
public MessageHandler(Context context) { |
||||
this.mHandlerContext = context; |
||||
} |
||||
|
||||
@Override |
||||
public void handleMessage(Message msg) { |
||||
switch (msg.what) { |
||||
case 1: |
||||
Utils.showToast(mHandlerContext, |
||||
mHandlerContext.getResources() |
||||
.getString(R.string.message_clear_history)); |
||||
break; |
||||
case 2: |
||||
Utils.showToast( |
||||
mHandlerContext, |
||||
mHandlerContext.getResources().getString( |
||||
R.string.message_cookies_cleared)); |
||||
break; |
||||
} |
||||
super.handleMessage(msg); |
||||
} |
||||
} |
||||
|
||||
private void cbLocation(CheckBox view) { |
||||
view.setOnCheckedChangeListener(new OnCheckedChangeListener() { |
||||
|
||||
@Override |
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { |
||||
mEditPrefs.putBoolean(PreferenceConstants.LOCATION, isChecked); |
||||
mEditPrefs.commit(); |
||||
} |
||||
|
||||
}); |
||||
} |
||||
|
||||
private void cbSavePasswords(CheckBox view) { |
||||
view.setOnCheckedChangeListener(new OnCheckedChangeListener() { |
||||
|
||||
@Override |
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { |
||||
mEditPrefs.putBoolean(PreferenceConstants.SAVE_PASSWORDS, isChecked); |
||||
mEditPrefs.commit(); |
||||
} |
||||
|
||||
}); |
||||
} |
||||
|
||||
private void cbClearCacheExit(CheckBox view) { |
||||
view.setOnCheckedChangeListener(new OnCheckedChangeListener() { |
||||
|
||||
@Override |
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { |
||||
mEditPrefs.putBoolean(PreferenceConstants.CLEAR_CACHE_EXIT, isChecked); |
||||
mEditPrefs.commit(); |
||||
} |
||||
|
||||
}); |
||||
} |
||||
|
||||
private void cbClearHistoryExit(CheckBox view) { |
||||
view.setOnCheckedChangeListener(new OnCheckedChangeListener() { |
||||
|
||||
@Override |
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { |
||||
mEditPrefs.putBoolean(PreferenceConstants.CLEAR_HISTORY_EXIT, isChecked); |
||||
mEditPrefs.commit(); |
||||
} |
||||
|
||||
}); |
||||
} |
||||
|
||||
private void cbClearCookiesExit(CheckBox view) { |
||||
view.setOnCheckedChangeListener(new OnCheckedChangeListener() { |
||||
|
||||
@Override |
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { |
||||
mEditPrefs.putBoolean(PreferenceConstants.CLEAR_COOKIES_EXIT, isChecked); |
||||
mEditPrefs.commit(); |
||||
} |
||||
|
||||
}); |
||||
} |
||||
|
||||
private void rLocation(RelativeLayout view) { |
||||
view.setOnClickListener(new OnClickListener() { |
||||
|
||||
@Override |
||||
public void onClick(View v) { |
||||
// TODO Auto-generated method stub
|
||||
cbLocation.setChecked(!cbLocation.isChecked()); |
||||
} |
||||
|
||||
}); |
||||
} |
||||
|
||||
private void rSavePasswords(RelativeLayout view) { |
||||
view.setOnClickListener(new OnClickListener() { |
||||
|
||||
@Override |
||||
public void onClick(View v) { |
||||
// TODO Auto-generated method stub
|
||||
cbSavePasswords.setChecked(!cbSavePasswords.isChecked()); |
||||
} |
||||
|
||||
}); |
||||
} |
||||
|
||||
private void rClearCacheExit(RelativeLayout view) { |
||||
view.setOnClickListener(new OnClickListener() { |
||||
|
||||
@Override |
||||
public void onClick(View v) { |
||||
// TODO Auto-generated method stub
|
||||
cbClearCacheExit.setChecked(!cbClearCacheExit.isChecked()); |
||||
} |
||||
|
||||
}); |
||||
} |
||||
|
||||
private void rClearHistoryExit(RelativeLayout view) { |
||||
view.setOnClickListener(new OnClickListener() { |
||||
|
||||
@Override |
||||
public void onClick(View v) { |
||||
// TODO Auto-generated method stub
|
||||
cbClearHistoryExit.setChecked(!cbClearHistoryExit.isChecked()); |
||||
} |
||||
|
||||
}); |
||||
} |
||||
|
||||
private void rClearCookiesExit(RelativeLayout view) { |
||||
view.setOnClickListener(new OnClickListener() { |
||||
|
||||
@Override |
||||
public void onClick(View v) { |
||||
// TODO Auto-generated method stub
|
||||
cbClearCookiesExit.setChecked(!cbClearCookiesExit.isChecked()); |
||||
} |
||||
|
||||
}); |
||||
} |
||||
|
||||
private void rClearHistory(RelativeLayout view) { |
||||
view.setOnClickListener(new OnClickListener() { |
||||
|
||||
@Override |
||||
public void onClick(View v) { |
||||
AlertDialog.Builder builder = new AlertDialog.Builder(PrivacySettingsActivity.this); // dialog
|
||||
builder.setTitle(getResources().getString(R.string.title_clear_history)); |
||||
builder.setMessage(getResources().getString(R.string.dialog_history)) |
||||
.setPositiveButton(getResources().getString(R.string.action_yes), |
||||
new DialogInterface.OnClickListener() { |
||||
|
||||
@Override |
||||
public void onClick(DialogInterface arg0, int arg1) { |
||||
Thread clear = new Thread(new Runnable() { |
||||
|
||||
@Override |
||||
public void run() { |
||||
clearHistory(); |
||||
} |
||||
|
||||
}); |
||||
clear.start(); |
||||
} |
||||
|
||||
}) |
||||
.setNegativeButton(getResources().getString(R.string.action_no), |
||||
new DialogInterface.OnClickListener() { |
||||
|
||||
@Override |
||||
public void onClick(DialogInterface arg0, int arg1) { |
||||
// TODO Auto-generated method stub
|
||||
|
||||
} |
||||
|
||||
}).show(); |
||||
} |
||||
|
||||
}); |
||||
} |
||||
|
||||
private void rClearCookies(RelativeLayout view) { |
||||
view.setOnClickListener(new OnClickListener() { |
||||
|
||||
@Override |
||||
public void onClick(View v) { |
||||
AlertDialog.Builder builder = new AlertDialog.Builder(PrivacySettingsActivity.this); // dialog
|
||||
builder.setTitle(getResources().getString(R.string.title_clear_cookies)); |
||||
builder.setMessage(getResources().getString(R.string.dialog_cookies)) |
||||
.setPositiveButton(getResources().getString(R.string.action_yes), |
||||
new DialogInterface.OnClickListener() { |
||||
|
||||
@Override |
||||
public void onClick(DialogInterface arg0, int arg1) { |
||||
Thread clear = new Thread(new Runnable() { |
||||
|
||||
@Override |
||||
public void run() { |
||||
clearCookies(); |
||||
} |
||||
|
||||
}); |
||||
clear.start(); |
||||
} |
||||
|
||||
}) |
||||
.setNegativeButton(getResources().getString(R.string.action_no), |
||||
new DialogInterface.OnClickListener() { |
||||
|
||||
@Override |
||||
public void onClick(DialogInterface arg0, int arg1) { |
||||
|
||||
} |
||||
|
||||
}).show(); |
||||
} |
||||
|
||||
}); |
||||
} |
||||
|
||||
private void rClearCache(RelativeLayout view) { |
||||
view.setOnClickListener(new OnClickListener() { |
||||
|
||||
@Override |
||||
public void onClick(View v) { |
||||
// TODO Auto-generated method stub
|
||||
clearCache(); |
||||
} |
||||
|
||||
}); |
||||
|
||||
} |
||||
|
||||
public void clearCache() { |
||||
WebView webView = new WebView(this); |
||||
webView.clearCache(true); |
||||
webView.destroy(); |
||||
Utils.showToast(mContext, getResources().getString(R.string.message_cache_cleared)); |
||||
} |
||||
|
||||
@SuppressWarnings("deprecation") |
||||
public void clearHistory() { |
||||
deleteDatabase(HistoryDatabaseHandler.DATABASE_NAME); |
||||
WebViewDatabase m = WebViewDatabase.getInstance(this); |
||||
m.clearFormData(); |
||||
m.clearHttpAuthUsernamePassword(); |
||||
if (API < 18) { |
||||
m.clearUsernamePassword(); |
||||
WebIconDatabase.getInstance().removeAllIcons(); |
||||
} |
||||
if (mSystemBrowser) { |
||||
try { |
||||
Browser.clearHistory(getContentResolver()); |
||||
} catch (Exception ignored) { |
||||
} |
||||
} |
||||
SettingsController.setClearHistory(true); |
||||
Utils.trimCache(this); |
||||
messageHandler.sendEmptyMessage(1); |
||||
} |
||||
|
||||
public void clearCookies() { |
||||
CookieManager c = CookieManager.getInstance(); |
||||
CookieSyncManager.createInstance(this); |
||||
c.removeAllCookie(); |
||||
messageHandler.sendEmptyMessage(2); |
||||
} |
||||
} |
Loading…
Reference in new issue