2.5.0.2
Advanced Settings are all a go, except "Incognito mode all the time", that one isn't functioning yet. Also, Incognito Mode isn't as up to date as the normal mode... I'll get around to it.
This commit is contained in:
parent
d127a90df4
commit
54d01d6a48
@ -1,103 +1,124 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="acr.browser.barebones"
|
||||
android:versionCode="44"
|
||||
android:versionName="2.5.0.1" >
|
||||
|
||||
<uses-sdk
|
||||
android:minSdkVersion="8"
|
||||
android:targetSdkVersion="17" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
|
||||
<uses-permission android:name="com.android.browser.permission.READ_HISTORY_BOOKMARKS"/>
|
||||
<uses-permission android:name="com.android.browser.permission.WRITE_HISTORY_BOOKMARKS"/>
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@drawable/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/AppTheme" >
|
||||
<activity
|
||||
android:name="acr.browser.barebones.Barebones"
|
||||
android:label="@string/app_name"
|
||||
android:configChanges="orientation|screenSize|keyboardHidden|keyboard"
|
||||
android:alwaysRetainTaskState="true"
|
||||
android:launchMode="singleTask"
|
||||
android:hardwareAccelerated="true"
|
||||
>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<category android:name="android.intent.category.APP_BROWSER" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<data android:scheme="http" />
|
||||
<data android:scheme="https" />
|
||||
<data android:scheme="about" />
|
||||
<data android:scheme="javascript" />
|
||||
</intent-filter>
|
||||
<!-- For these schemes where any of these particular MIME types
|
||||
have been supplied, we are a good candidate. -->
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<data android:scheme="http" />
|
||||
<data android:scheme="https" />
|
||||
<data android:scheme="inline" />
|
||||
<data android:mimeType="text/html"/>
|
||||
<data android:mimeType="text/plain"/>
|
||||
<data android:mimeType="application/xhtml+xml"/>
|
||||
<data android:mimeType="application/vnd.wap.xhtml+xml"/>
|
||||
</intent-filter>
|
||||
<!-- For viewing saved web archives. -->
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<data android:scheme="http" />
|
||||
<data android:scheme="https" />
|
||||
<data android:scheme="file" />
|
||||
<data android:mimeType="application/x-webarchive-xml"/>
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.WEB_SEARCH" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<data android:scheme="" />
|
||||
<data android:scheme="http" />
|
||||
<data android:scheme="https" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name="acr.browser.barebones.IncognitoMode"
|
||||
android:label="@string/app_name"
|
||||
android:configChanges="orientation|screenSize|keyboardHidden|keyboard"
|
||||
android:alwaysRetainTaskState="true"
|
||||
android:launchMode="singleTask"
|
||||
android:hardwareAccelerated="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.BAREBONESINCOGNITO" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name="acr.browser.barebones.Settings"
|
||||
android:configChanges="orientation|screenSize|keyboard"
|
||||
android:label="@string/app_name" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.BAREBONESSETTINGS" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="acr.browser.barebones"
|
||||
android:versionCode="44"
|
||||
android:versionName="2.5.0.2" >
|
||||
|
||||
<uses-sdk
|
||||
android:minSdkVersion="8"
|
||||
android:targetSdkVersion="18" />
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||
<uses-permission android:name="com.android.browser.permission.READ_HISTORY_BOOKMARKS" />
|
||||
<uses-permission android:name="com.android.browser.permission.WRITE_HISTORY_BOOKMARKS" />
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:hardwareAccelerated="true"
|
||||
android:icon="@drawable/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/AppTheme" >
|
||||
<activity
|
||||
android:name="acr.browser.barebones.activities.BarebonesActivity"
|
||||
android:alwaysRetainTaskState="true"
|
||||
android:configChanges="orientation|screenSize|keyboardHidden|keyboard|screenSize"
|
||||
android:label="@string/app_name"
|
||||
android:launchMode="singleTask" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<category android:name="android.intent.category.APP_BROWSER" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
|
||||
<data android:scheme="http" />
|
||||
<data android:scheme="https" />
|
||||
<data android:scheme="about" />
|
||||
<data android:scheme="javascript" />
|
||||
</intent-filter>
|
||||
<!--
|
||||
For these schemes where any of these particular MIME types
|
||||
have been supplied, we are a good candidate.
|
||||
-->
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
|
||||
<data android:scheme="http" />
|
||||
<data android:scheme="https" />
|
||||
<data android:scheme="inline" />
|
||||
<data android:mimeType="text/html" />
|
||||
<data android:mimeType="text/plain" />
|
||||
<data android:mimeType="application/xhtml+xml" />
|
||||
<data android:mimeType="application/vnd.wap.xhtml+xml" />
|
||||
</intent-filter>
|
||||
<!-- For viewing saved web archives. -->
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
|
||||
<data android:scheme="http" />
|
||||
<data android:scheme="https" />
|
||||
<data android:scheme="file" />
|
||||
<data android:mimeType="application/x-webarchive-xml" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.WEB_SEARCH" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
|
||||
<data android:scheme="" />
|
||||
<data android:scheme="http" />
|
||||
<data android:scheme="https" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name="acr.browser.barebones.activities.IncognitoModeActivity"
|
||||
android:alwaysRetainTaskState="true"
|
||||
android:configChanges="orientation|screenSize|keyboardHidden|keyboard"
|
||||
android:label="@string/app_name"
|
||||
android:launchMode="singleTask" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.BAREBONESINCOGNITO" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name="acr.browser.barebones.activities.SettingsActivity"
|
||||
android:configChanges="orientation|screenSize|keyboardHidden|keyboard"
|
||||
android:label="@string/app_name" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.SETTINGS" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name="acr.browser.barebones.activities.AdvancedSettingsActivity"
|
||||
android:configChanges="orientation|screenSize|keyboardHidden|keyboard"
|
||||
android:label="@string/title_activity_advanced_settings" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.ADVANCEDSETTINGS" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
BIN
Barebones.apk
BIN
Barebones.apk
Binary file not shown.
4
README
4
README
@ -1,4 +0,0 @@
|
||||
This is an open source webkit based browser.
|
||||
|
||||
I make money off a similar paid version which currently has unlimited tabs and unlimited bookmarks. Modifiying two values at the top of the main activity "barebones" will turn this into the paid version.
|
||||
Change static public int MAX_TABS and MAX_BOOKMARKS from 5 to 50 and you have the paid version.
|
41
README.md
Normal file
41
README.md
Normal file
@ -0,0 +1,41 @@
|
||||
#Lightning Browser
|
||||
#![](https://lh3.ggpht.com/HLSuHvg80_HMmgZ8GkmxMkHvovFu0_QcBqK-omS-JLGe8s-ChPQPYZZFXBRHEtHoQZQ=w150-rw)
|
||||
####Download
|
||||
* [APK File](https://github.com/anthonycr/Lightning-Browser/blob/master/Barebones.apk?raw=true)
|
||||
|
||||
* [Google Play](https://play.google.com/store/apps/details?id=acr.browser.barebones)
|
||||
|
||||
|
||||
####Features
|
||||
* Bookmarks
|
||||
|
||||
* History
|
||||
|
||||
* Multiple Search Engines (Google, Bing, Yahoo, StartPage, DuckDuckGo
|
||||
|
||||
* Incognito Mode
|
||||
|
||||
* Flash Support
|
||||
|
||||
* Privacy Aware
|
||||
|
||||
* ````#YOLOHOLO````
|
||||
|
||||
####Permissions Requested and Explained
|
||||
|
||||
* INTERNET: For accessing the web
|
||||
|
||||
* ````WRITE_EXTERNAL_STORAGE````: For downloading files from the browser
|
||||
|
||||
* ````READ_EXTERNAL_STORAGE````: For downloading files from the browser
|
||||
|
||||
* ````ACCESS_FINE_LOCATION````: For sites like Google Maps, it is disabled by default in settings and displays a pop-up asking if a site may use your location when it is enabled
|
||||
|
||||
* ````READ_HISTORY_BOOKMARKS````: To synchronize history and bookmarks between the stock browser and Lightning
|
||||
|
||||
* ````WRITE_HISTORY_BOOKMARKS````: To synchronize history and bookmarks between the stock browser and Lightning
|
||||
|
||||
####The Code
|
||||
* Code additions are always welcome
|
||||
* Please add translations/translation fixes as you see need
|
||||
* Change ````FinalVariables.MAX_TABS```` from 5 to 50 to change the Lightning to the paid version
|
Before Width: | Height: | Size: 141 KiB After Width: | Height: | Size: 141 KiB |
Binary file not shown.
Before Width: | Height: | Size: 3.2 KiB |
Binary file not shown.
Before Width: | Height: | Size: 165 B After Width: | Height: | Size: 191 B |
BIN
res/drawable-xxhdpi/ic_launcher.png
Normal file
BIN
res/drawable-xxhdpi/ic_launcher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 13 KiB |
@ -132,12 +132,13 @@
|
||||
android:layout_toRightOf="@+id/refreshLayout"
|
||||
android:background="@drawable/book"
|
||||
android:ems="10"
|
||||
android:hint="@string/google"
|
||||
android:hint="@string/search_hint"
|
||||
android:imeOptions="actionGo"
|
||||
android:inputType="textUri"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:singleLine="true" />
|
||||
android:singleLine="true"
|
||||
android:textColor="@color/dark" />
|
||||
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
||||
|
328
res/layout/advanced_settings.xml
Normal file
328
res/layout/advanced_settings.xml
Normal file
@ -0,0 +1,328 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:background="@drawable/bar" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:text="@string/advanced"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/advanced_back"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:paddingBottom="5dp"
|
||||
android:paddingLeft="5dp"
|
||||
android:paddingRight="5dp"
|
||||
android:paddingTop="5dp"
|
||||
android:src="@drawable/back" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<ScrollView
|
||||
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/r1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="56dp"
|
||||
android:background="@drawable/blueback"
|
||||
android:paddingRight="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:text="@string/password"
|
||||
android:paddingLeft="10dp"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cb1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView13"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:text="@string/recommended"
|
||||
android:paddingLeft="10dp"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/light" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/r2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="56dp"
|
||||
android:background="@drawable/blueback"
|
||||
android:paddingRight="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:text="@string/cache"
|
||||
android:paddingLeft="10dp"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cb2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/r3"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="56dp"
|
||||
android:background="@drawable/blueback"
|
||||
android:paddingRight="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:text="@string/java"
|
||||
android:paddingLeft="10dp"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cb3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView12"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:text="@string/recommended"
|
||||
android:paddingLeft="10dp"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/light" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/r4"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="56dp"
|
||||
android:background="@drawable/blueback"
|
||||
android:paddingRight="10dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView5"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:text="@string/reflow"
|
||||
android:paddingLeft="10dp"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cb4"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView15"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:text="@string/weird_look"
|
||||
android:paddingLeft="10dp"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/light" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/r5"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="56dp"
|
||||
android:background="@drawable/blueback"
|
||||
android:paddingRight="10dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView6"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:text="@string/block"
|
||||
android:paddingLeft="10dp"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cb5"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/r6"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="56dp"
|
||||
android:background="@drawable/blueback"
|
||||
android:paddingRight="10dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView7"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:text="@string/window"
|
||||
android:paddingLeft="10dp"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cb6"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignBaseline="@+id/textView7"
|
||||
android:layout_alignBottom="@+id/textView7"
|
||||
android:layout_alignParentRight="true"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView14"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:text="@string/recommended"
|
||||
android:paddingLeft="10dp"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/light" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/r7"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="56dp"
|
||||
android:background="@drawable/blueback"
|
||||
android:paddingRight="10dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView8"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:text="@string/always_incognito"
|
||||
android:paddingLeft="10dp"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cb7"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/r8"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="56dp"
|
||||
android:background="@drawable/blueback" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView9"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:text="@string/history"
|
||||
android:paddingLeft="10dp"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/r9"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="56dp"
|
||||
android:background="@drawable/blueback" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView10"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:text="@string/importbookmarks"
|
||||
android:paddingLeft="10dp"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/r10"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="56dp"
|
||||
android:background="@drawable/blueback" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView11"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:text="@string/size"
|
||||
android:paddingLeft="10dp"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
||||
</LinearLayout>
|
@ -1,162 +1,347 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent" android:layout_height="match_parent">
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<RelativeLayout android:id="@+id/relativeLayout1"
|
||||
android:layout_width="match_parent" android:layout_height="48dp"
|
||||
android:layout_alignParentLeft="true" android:layout_alignParentRight="true"
|
||||
android:layout_alignParentTop="true" android:background="@drawable/bar">
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:background="@drawable/bar" >
|
||||
|
||||
<TextView android:id="@+id/textView1" android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" android:layout_centerHorizontal="true"
|
||||
android:layout_centerVertical="true" android:text="@string/settings"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
<ImageView
|
||||
android:id="@+id/back"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:paddingBottom="5dp"
|
||||
android:paddingLeft="5dp"
|
||||
android:paddingRight="5dp"
|
||||
android:paddingTop="5dp"
|
||||
android:src="@drawable/back" />
|
||||
|
||||
<ImageView android:id="@+id/back" android:layout_width="48dp"
|
||||
android:layout_height="48dp" android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentTop="true" android:paddingBottom="5dp"
|
||||
android:paddingLeft="5dp" android:paddingRight="5dp"
|
||||
android:paddingTop="5dp" android:src="@drawable/back" />
|
||||
</RelativeLayout>
|
||||
<TextView
|
||||
android:id="@+id/textView1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:text="@string/settings_title"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge" />
|
||||
|
||||
<ScrollView android:id="@+id/scrollView1"
|
||||
android:layout_width="match_parent" android:layout_height="match_parent"
|
||||
android:layout_below="@+id/relativeLayout1">
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<ScrollView
|
||||
android:id="@+id/scrollView1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" >
|
||||
|
||||
<TextView android:id="@+id/textView4" android:layout_width="match_parent"
|
||||
android:layout_height="56dp"
|
||||
android:layout_centerHorizontal="true" android:background="#ff0099cc"
|
||||
android:gravity="center_vertical|center_horizontal" android:text="@string/settingshelp"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:textColor="#ffffffff" />
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<CheckBox android:id="@+id/password" android:layout_width="match_parent"
|
||||
android:layout_marginRight="20dp"
|
||||
android:layout_height="56dp" android:layout_below="@+id/saveTabs"
|
||||
android:text="@string/password"
|
||||
android:layout_marginLeft="20dp"
|
||||
/>
|
||||
<RelativeLayout
|
||||
android:id="@+id/layoutLocation"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="56dp"
|
||||
android:background="@drawable/blueback"
|
||||
android:paddingRight="10dp">
|
||||
|
||||
<EditText android:id="@+id/agent" android:layout_width="wrap_content"
|
||||
android:layout_height="56dp" android:layout_alignParentRight="true"
|
||||
android:layout_marginRight="20dp"
|
||||
android:layout_alignTop="@+id/textView2" android:layout_toRightOf="@+id/textView2"
|
||||
android:ems="10" android:inputType="textUri" android:background="@drawable/book"
|
||||
android:paddingLeft="10dp" android:paddingRight="10dp"
|
||||
android:singleLine="true" />
|
||||
<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:text="@string/location"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/setR1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true" >
|
||||
|
||||
<CheckBox android:id="@+id/flash" android:layout_width="match_parent"
|
||||
android:layout_marginRight="20dp"
|
||||
android:layout_height="56dp" android:layout_below="@+id/password"
|
||||
android:text="@string/flash"
|
||||
android:layout_marginLeft="20dp"
|
||||
/>
|
||||
</RelativeLayout>
|
||||
|
||||
<CheckBox android:id="@+id/historyClear"
|
||||
android:layout_marginRight="20dp"
|
||||
android:layout_width="match_parent" android:layout_height="56dp"
|
||||
android:layout_below="@+id/flash"
|
||||
android:text="@string/history"
|
||||
android:layout_marginLeft="20dp"
|
||||
/>
|
||||
</RelativeLayout>
|
||||
|
||||
<RadioButton android:id="@+id/radioDesktop"
|
||||
android:layout_width="match_parent" android:layout_height="56dp"
|
||||
android:layout_marginRight="20dp"
|
||||
android:layout_below="@+id/radioMobile"
|
||||
android:onClick="radioAgent" android:text="@string/desk"
|
||||
android:layout_marginLeft="20dp"
|
||||
/>
|
||||
|
||||
<RadioButton android:id="@+id/radioCustom"
|
||||
android:layout_width="match_parent" android:layout_height="56dp"
|
||||
android:layout_below="@+id/radioDesktop"
|
||||
android:onClick="radioAgent" android:text="@string/custom"
|
||||
android:layout_marginRight="20dp"
|
||||
android:layout_marginLeft="20dp"
|
||||
/>
|
||||
|
||||
<TextView android:id="@+id/textView2" android:layout_width="wrap_content"
|
||||
android:layout_height="56dp" android:layout_alignParentLeft="true"
|
||||
android:layout_below="@+id/radioCustom" android:gravity="center_vertical|center_horizontal"
|
||||
android:paddingLeft="10dp" android:paddingRight="5dp" android:text="@string/agent"
|
||||
android:layout_marginLeft="20dp"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="56dp"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_below="@+id/textView2"
|
||||
android:gravity="center_vertical|center_horizontal"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingRight="5dp"
|
||||
android:text="@string/home"
|
||||
android:layout_marginLeft="20dp"/>
|
||||
|
||||
<CheckBox android:id="@+id/fullScreen" android:layout_width="match_parent"
|
||||
android:layout_marginRight="20dp"
|
||||
android:layout_height="56dp" android:layout_below="@+id/historyClear"
|
||||
android:text="@string/fullscreen"
|
||||
android:layout_marginLeft="20dp"
|
||||
/>
|
||||
|
||||
<CheckBox android:id="@+id/java" android:layout_width="match_parent"
|
||||
android:layout_height="56dp" android:layout_below="@+id/fullScreen"
|
||||
android:layout_marginRight="20dp"
|
||||
android:text="@string/java"
|
||||
android:layout_marginLeft="20dp"
|
||||
/>
|
||||
|
||||
|
||||
|
||||
<RadioButton android:id="@+id/radioMobile"
|
||||
android:layout_width="match_parent" android:layout_height="56dp"
|
||||
android:layout_marginRight="20dp"
|
||||
android:layout_below="@+id/java"
|
||||
android:marqueeRepeatLimit="20" android:onClick="radioAgent"
|
||||
android:text="@string/mobile"
|
||||
android:layout_marginLeft="20dp"
|
||||
/>
|
||||
|
||||
<CheckBox android:id="@+id/saveTabs" android:layout_width="match_parent"
|
||||
android:layout_height="56dp" android:layout_below="@+id/location"
|
||||
android:layout_marginRight="20dp"
|
||||
android:text="@string/saveTab"
|
||||
android:layout_marginLeft="20dp"
|
||||
/>
|
||||
|
||||
<EditText android:id="@+id/homePage" android:layout_width="wrap_content"
|
||||
android:layout_height="56dp" android:layout_alignBaseline="@+id/textView3"
|
||||
android:layout_alignBottom="@+id/textView3"
|
||||
android:layout_alignLeft="@+id/agent"
|
||||
android:layout_alignParentRight="true" android:background="@drawable/book"
|
||||
android:ems="10" android:inputType="textUri" android:paddingLeft="10dp"
|
||||
android:layout_marginRight="20dp"
|
||||
android:paddingRight="10dp">
|
||||
|
||||
|
||||
</EditText>
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/location"
|
||||
android:layout_marginLeft="20dp"
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/layoutFullScreen"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="56dp"
|
||||
android:layout_below="@+id/textView4"
|
||||
|
||||
android:layout_marginRight="20dp"
|
||||
android:text="@string/location"/>
|
||||
android:background="@drawable/blueback"
|
||||
android:paddingRight="10dp">
|
||||
|
||||
</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: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" >
|
||||
|
||||
</ScrollView>
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/layoutFlash"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="56dp"
|
||||
android:background="@drawable/blueback"
|
||||
android:paddingRight="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:text="@string/flash"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
<RelativeLayout
|
||||
android:id="@+id/setR3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true" >
|
||||
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/layoutUserAgent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="56dp"
|
||||
android:background="@drawable/blueback" >
|
||||
|
||||
<TextView
|
||||
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:text="@string/agent"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/agentText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:paddingLeft="10dp"
|
||||
android:text="Small Text"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/light" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/layoutDownload"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="56dp"
|
||||
android:background="@drawable/blueback" >
|
||||
|
||||
<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:text="@string/download"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/downloadText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:paddingLeft="10dp"
|
||||
android:text="Small Text"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/light" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/layoutHomepage"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="56dp"
|
||||
android:background="@drawable/blueback" >
|
||||
|
||||
<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:text="@string/home"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/homepageText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:paddingLeft="10dp"
|
||||
android:text="Small Text"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/light" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/layoutSearch"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="56dp"
|
||||
android:background="@drawable/blueback" >
|
||||
|
||||
<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:text="@string/search"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/searchText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:paddingLeft="10dp"
|
||||
android:text="Small Text"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/light" />
|
||||
|
||||
</RelativeLayout>
|
||||
<RelativeLayout
|
||||
android:id="@+id/layoutAdvanced"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="56dp"
|
||||
android:background="@drawable/blueback" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView8"
|
||||
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:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/layoutSource"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="56dp"
|
||||
android:background="@drawable/blueback" >
|
||||
|
||||
<TextView
|
||||
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/source"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView14"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:paddingLeft="10dp"
|
||||
android:text="@string/github"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/light" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/layoutLicense"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="56dp"
|
||||
android:background="@drawable/blueback" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView10"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:paddingLeft="10dp"
|
||||
android:text="@string/license"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView20"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:paddingLeft="10dp"
|
||||
android:text="@string/apache"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/light" />
|
||||
|
||||
</RelativeLayout>
|
||||
<RelativeLayout
|
||||
android:id="@+id/layoutVersion"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="56dp"
|
||||
android:background="@drawable/blueback" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView10"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
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:layout_alignParentBottom="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:paddingLeft="10dp"
|
||||
android:text="Small Text"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/light" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
||||
</LinearLayout>
|
||||
|
@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
<item android:id="@+id/history" android:title="Cronologia" android:titleCondensed="Cronologia" android:orderInCategory="1"></item>
|
||||
<item android:id="@+id/allBookmarks" android:titleCondensed="Segnalibri" android:title="Segnalibri" android:orderInCategory="3"></item>
|
||||
<item android:id="@+id/incognito" android:title="Nuova tab" android:orderInCategory="5" android:titleCondensed="Nuova tab"></item>
|
||||
|
||||
|
||||
</menu>
|
@ -1,11 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
<item android:id="@+id/history" android:title="Cronologia" android:titleCondensed="Cronologia" android:orderInCategory="2"></item>
|
||||
<item android:id="@+id/bookmark" android:title="Aggiungi ai segnalibri" android:titleCondensed="Aggiungi ai segnalibri" android:orderInCategory="3"></item>
|
||||
<item android:id="@+id/allBookmarks" android:titleCondensed="Segnalibri" android:title="Segnalibri" android:orderInCategory="4"></item>
|
||||
<item android:id="@+id/share" android:title="Condividi" android:titleCondensed="Condividi" android:orderInCategory="5"></item>
|
||||
<item android:id="@+id/settings" android:title="Impostazioni" android:titleCondensed="Impostazioni" android:orderInCategory="7"></item>
|
||||
<item android:id="@+id/forward" android:title="Avanti" android:orderInCategory="1" android:titleCondensed="Avanti"></item>
|
||||
<item android:id="@+id/incognito" android:title="Apri Tab in Incognito" android:orderInCategory="6" android:titleCondensed="Apri Tab in Incognito"></item>
|
||||
<item android:id="@+id/history" android:title="History" android:titleCondensed="History" android:orderInCategory="1"></item>
|
||||
<item android:id="@+id/bookmark" android:title="Aggiungi ai preferiti" android:titleCondensed="Aggiungi ai preferiti" android:orderInCategory="2"></item>
|
||||
<item android:id="@+id/allBookmarks" android:titleCondensed="Segnalibri" android:title="Segnalibri" android:orderInCategory="3"></item>
|
||||
<item android:id="@+id/share" android:title="Azione" android:titleCondensed="Azione" android:orderInCategory="4"></item>
|
||||
<item android:id="@+id/settings" android:title="Impostazioni" android:titleCondensed="Impostazioni" android:orderInCategory="6"></item>
|
||||
<item android:id="@+id/forward" android:title="Avanti" android:orderInCategory="5" android:titleCondensed="Avanti"></item>
|
||||
|
||||
|
||||
</menu>
|
||||
</menu>
|
9
res/menu/advanced_settings.xml
Normal file
9
res/menu/advanced_settings.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
|
||||
<item
|
||||
android:id="@+id/action_settings"
|
||||
android:orderInCategory="100"
|
||||
android:showAsAction="never"
|
||||
android:title="@string/action_settings"/>
|
||||
|
||||
</menu>
|
@ -1,12 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
<item android:id="@+id/history" android:title="History" android:titleCondensed="History" android:orderInCategory="2"></item>
|
||||
<item android:id="@+id/bookmark" android:title="Add to bookmarks" android:titleCondensed="Add bookmark" android:orderInCategory="3"></item>
|
||||
<item android:id="@+id/allBookmarks" android:titleCondensed="Bookmarks" android:title="Bookmarks" android:orderInCategory="4"></item>
|
||||
<item android:id="@+id/share" android:title="Share" android:titleCondensed="Share" android:orderInCategory="5"></item>
|
||||
<item android:id="@+id/settings" android:title="Settings" android:titleCondensed="Settings" android:orderInCategory="7"></item>
|
||||
<item android:id="@+id/forward" android:title="Forward" android:orderInCategory="1" android:titleCondensed="Forward"></item>
|
||||
<item android:id="@+id/incognito" android:title="Incognito Tab" android:orderInCategory="6" android:titleCondensed="Incognito Tab"></item>
|
||||
<item android:id="@+id/history" android:title="History" android:titleCondensed="History" android:orderInCategory="1"></item>
|
||||
<item android:id="@+id/bookmark" android:title="Add to bookmarks" android:titleCondensed="Add bookmark" android:orderInCategory="2"></item>
|
||||
<item android:id="@+id/allBookmarks" android:titleCondensed="Bookmarks" android:title="Bookmarks" android:orderInCategory="3"></item>
|
||||
<item android:id="@+id/share" android:title="Share" android:titleCondensed="Share" android:orderInCategory="4"></item>
|
||||
<item android:id="@+id/settings" android:title="Settings" android:titleCondensed="Settings" android:orderInCategory="6"></item>
|
||||
<item android:id="@+id/incognito" android:title="Incognito Tab" android:orderInCategory="5" android:titleCondensed="Incognito Tab"></item>
|
||||
|
||||
|
||||
</menu>
|
||||
</menu>
|
9
res/menu/new_settings.xml
Normal file
9
res/menu/new_settings.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
|
||||
<item
|
||||
android:id="@+id/action_settings"
|
||||
android:orderInCategory="100"
|
||||
android:showAsAction="never"
|
||||
android:title="@string/action_settings"/>
|
||||
|
||||
</menu>
|
@ -1,22 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<string name="app_name">Lightning</string>
|
||||
<string name="google">Google</string>
|
||||
<string name="settings">Pengaturan Browser</string>
|
||||
<string name="location">Izinkan situs untuk mendeteksi lokasi anda</string>
|
||||
<string name="password">Simpan kata sandi</string>
|
||||
<string name="agent">Nama Perangkat</string>
|
||||
<string name="history">Hapus riwayat jika keluar</string>
|
||||
<string name="email">Kirim email</string>
|
||||
<string name="flash">Aktifkan Adobe Flash (jika terpasang)</string>
|
||||
<string name="mobile">Lihat dengan tampilan telpon</string>
|
||||
<string name="desk">Lihat dengan tampilan komputer</string>
|
||||
<string name="custom">Lihat dengan tampilan perangkat</string>
|
||||
<string name="home">Halaman Utama</string>
|
||||
<string name="settingshelp">Pengaturan hanya berlaku untuk TAB baru</string>
|
||||
<string name="fullscreen">Tampilan penuh</string>
|
||||
<string name="java">Aktifkan JavaScript</string>
|
||||
<string name="saveTab">Kembalikan TAB saat kembali</string>
|
||||
|
||||
</resources>
|
@ -7,16 +7,15 @@
|
||||
<string name="location">Consenti ai siti di accedere alla tua posizione</string>
|
||||
<string name="password">Salva le tue password</string>
|
||||
<string name="agent">User Agent</string>
|
||||
<string name="history">Cancella cronologia all\'uscita</string>
|
||||
<string name="email">Scrivi allo sviluppatore</string>
|
||||
<string name="history">Clear history on exit</string>
|
||||
<string name="email">Email me</string>
|
||||
<string name="flash">Abilita Adobe Flash</string>
|
||||
<string name="mobile">Visualizza come Mobile</string>
|
||||
<string name="desk">Visualizza come Desktop</string>
|
||||
<string name="custom">Visualizza come User Agent personalizzato</string>
|
||||
<string name="mobile">Visualizza come mobile</string>
|
||||
<string name="desk">Visualizza come desktop</string>
|
||||
<string name="custom">Visualizza come agente utente personalizzata</string>
|
||||
<string name="home">Homepage</string>
|
||||
<string name="settingshelp">Le impostazioni saranno valide solo per le nuove Tabs</string>
|
||||
<string name="fullscreen">Abilita schermo intero</string>
|
||||
<string name="java">Abilita JavaScript</string>
|
||||
<string name="saveTab">Recupera le Tabs in caso di chiusura imprevista</string>
|
||||
|
||||
</resources>
|
||||
<string name="settingshelp">Impostazioni valgono solo per le nuove schede</string>
|
||||
<string name="fullscreen">Enable fullscreen mode</string>
|
||||
<string name="java">Enable JavaScript</string>
|
||||
|
||||
</resources>
|
8
res/values-sw600dp/dimens.xml
Normal file
8
res/values-sw600dp/dimens.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<resources>
|
||||
|
||||
<!--
|
||||
Customize dimensions originally defined in res/values/dimens.xml (such as
|
||||
screen margins) for sw600dp devices (e.g. 7" tablets) here.
|
||||
-->
|
||||
|
||||
</resources>
|
9
res/values-sw720dp-land/dimens.xml
Normal file
9
res/values-sw720dp-land/dimens.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<resources>
|
||||
|
||||
<!--
|
||||
Customize dimensions originally defined in res/values/dimens.xml (such as
|
||||
screen margins) for sw720dp devices (e.g. 10" tablets) in landscape here.
|
||||
-->
|
||||
<dimen name="activity_horizontal_margin">128dp</dimen>
|
||||
|
||||
</resources>
|
@ -5,5 +5,6 @@
|
||||
<color name="press">#3333b5e5</color>
|
||||
<color name="black">#ff000000</color>
|
||||
<color name="dark">#ff3f3f3f</color>
|
||||
<color name="light">#ffa0a0a0</color>
|
||||
|
||||
</resources>
|
7
res/values/dimens.xml
Normal file
7
res/values/dimens.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<resources>
|
||||
|
||||
<!-- Default screen margins, per the Android Design guidelines. -->
|
||||
<dimen name="activity_horizontal_margin">16dp</dimen>
|
||||
<dimen name="activity_vertical_margin">16dp</dimen>
|
||||
|
||||
</resources>
|
@ -4,19 +4,42 @@
|
||||
<string name="app_name">Lightning</string>
|
||||
<string name="google">Google</string>
|
||||
<string name="settings">Browser Settings</string>
|
||||
<string name="location">Allow sites to access your location</string>
|
||||
<string name="location">Location Access</string>
|
||||
<string name="password">Save your passwords</string>
|
||||
<string name="agent">User Agent</string>
|
||||
<string name="history">Clear history on exit</string>
|
||||
<string name="history">Clear history</string>
|
||||
<string name="email">Email me</string>
|
||||
<string name="flash">Enable Adobe Flash (if it\'s installed)</string>
|
||||
<string name="flash">Enable Adobe Flash</string>
|
||||
<string name="mobile">View as Mobile</string>
|
||||
<string name="desk">View as Desktop</string>
|
||||
<string name="custom">View as custom user agent</string>
|
||||
<string name="home">Homepage</string>
|
||||
<string name="settingshelp">Settings only apply to new tabs</string>
|
||||
<string name="fullscreen">Enable fullscreen mode</string>
|
||||
<string name="fullscreen">Full-screen Mode</string>
|
||||
<string name="java">Enable JavaScript</string>
|
||||
<string name="saveTab">Restore your tabs if they\'re lost</string>
|
||||
<string name="settings_title">Settings</string>
|
||||
<string name="download">Download Location</string>
|
||||
<string name="advanced">Advanced Settings</string>
|
||||
<string name="source">Source Code</string>
|
||||
<string name="license">License</string>
|
||||
<string name="github">github.com/anthonycr/Lightning-Browser</string>
|
||||
<string name="apache">Apache License 2.0</string>
|
||||
<string name="title_activity_new_settings">NewSettings</string>
|
||||
<string name="action_settings">Settings</string>
|
||||
<string name="version">Application Version</string>
|
||||
<string name="cache">Clear cache on exit</string>
|
||||
<string name="reflow">Enable text reflow</string>
|
||||
<string name="block">Block Images</string>
|
||||
<string name="window">Allow sites to open new windows</string>
|
||||
<string name="always_incognito">Incognito always on</string>
|
||||
<string name="importbookmarks">Import bookmarks from Stock Browser (if available)</string>
|
||||
<string name="size">Text size</string>
|
||||
<string name="title_activity_advanced_settings">AdvancedSettings</string>
|
||||
<string name="hello_world">Hello world!</string>
|
||||
<string name="recommended">(Recommended)</string>
|
||||
<string name="weird_look">(Websites may look weird)</string>
|
||||
<string name="search">Search Engine</string>
|
||||
<string name="search_hint">Search</string>
|
||||
|
||||
</resources>
|
@ -1,58 +0,0 @@
|
||||
package acr.browser.barebones;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.animation.Animation;
|
||||
import android.webkit.WebView;
|
||||
|
||||
public final class AnthonyWebView extends WebView {
|
||||
|
||||
boolean move;
|
||||
int API = FinalVars.API;
|
||||
int hitTest;
|
||||
boolean showFullScreen = Barebones.showFullScreen;
|
||||
View uBar = Barebones.uBar;
|
||||
boolean uBarShows = Barebones.uBarShows;
|
||||
Animation slideUp = Barebones.slideUp;
|
||||
Animation slideDown = Barebones.slideDown;
|
||||
|
||||
public AnthonyWebView(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTouchEvent(MotionEvent event) {
|
||||
|
||||
switch (event.getAction()) {
|
||||
case MotionEvent.ACTION_DOWN: {
|
||||
try {
|
||||
hitTest = getHitTestResult().getType();
|
||||
} catch (NullPointerException e) {
|
||||
}
|
||||
if (API <= 10 && !Barebones.main[Barebones.pageId].hasFocus()) {
|
||||
Barebones.main[Barebones.pageId].requestFocus();
|
||||
}
|
||||
if (showFullScreen) {
|
||||
if (uBarShows) {
|
||||
uBar.startAnimation(slideUp);
|
||||
uBarShows = false;
|
||||
|
||||
} else if (Barebones.main[Barebones.pageId].getScrollY() <= 5
|
||||
&& !uBarShows && hitTest != 9) {
|
||||
|
||||
uBar.startAnimation(slideDown);
|
||||
uBarShows = true;
|
||||
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return super.onTouchEvent(event);
|
||||
}
|
||||
|
||||
}
|
@ -1,68 +0,0 @@
|
||||
package acr.browser.barebones;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.animation.Animation;
|
||||
import android.webkit.WebView;
|
||||
import android.widget.ZoomButtonsController;
|
||||
|
||||
public final class CustomWebView extends WebView {
|
||||
private float location;
|
||||
private boolean first = false;
|
||||
final int API = FinalVars.API;
|
||||
final boolean showFullScreen = Barebones.showFullScreen;
|
||||
final View uBar = Barebones.uBar;
|
||||
final Animation slideUp = Barebones.slideUp;
|
||||
final Animation slideDown = Barebones.slideDown;
|
||||
private ZoomButtonsController zoomControl;
|
||||
public CustomWebView(Context context) {
|
||||
super(context);
|
||||
getControls();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTouchEvent(MotionEvent event) {
|
||||
if(API<11&&zoomControl!=null){
|
||||
zoomControl.getZoomControls().setVisibility(View.INVISIBLE);
|
||||
}
|
||||
switch (event.getAction()) {
|
||||
case MotionEvent.ACTION_DOWN: {
|
||||
first = true;
|
||||
if (API <= 10 && !this.hasFocus()) {
|
||||
this.requestFocus();
|
||||
}
|
||||
location = event.getY();
|
||||
break;
|
||||
}
|
||||
case MotionEvent.ACTION_UP:{
|
||||
if (showFullScreen&&first) {
|
||||
if (uBar.isShown()&&this.getScrollY()<5) {
|
||||
uBar.startAnimation(slideUp);
|
||||
} else if (event.getY()>location && !uBar.isShown()) {
|
||||
uBar.startAnimation(slideDown);
|
||||
} else if (event.getY()<location && uBar.isShown()){
|
||||
uBar.startAnimation(slideUp);
|
||||
}
|
||||
first = false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return super.onTouchEvent(event);
|
||||
}
|
||||
private void getControls() {
|
||||
if(API<11){
|
||||
try {
|
||||
Class<?> webview = Class.forName("android.webkit.WebView");
|
||||
Method method = webview.getMethod("getZoomButtonsController");
|
||||
zoomControl = (ZoomButtonsController) method.invoke(this, null);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,68 +0,0 @@
|
||||
package acr.browser.barebones;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.animation.Animation;
|
||||
import android.webkit.WebView;
|
||||
import android.widget.ZoomButtonsController;
|
||||
|
||||
public final class IncognitoWebView extends WebView {
|
||||
private float location;
|
||||
private boolean first = false;
|
||||
final int API = FinalVars.API;
|
||||
final boolean showFullScreen = IncognitoMode.showFullScreen;
|
||||
final View uBar = IncognitoMode.uBar;
|
||||
final Animation slideUp = IncognitoMode.slideUp;
|
||||
final Animation slideDown = IncognitoMode.slideDown;
|
||||
private ZoomButtonsController zoomControl;
|
||||
public IncognitoWebView(Context context) {
|
||||
super(context);
|
||||
getControls();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTouchEvent(MotionEvent event) {
|
||||
if(API<11&&zoomControl!=null){
|
||||
zoomControl.getZoomControls().setVisibility(View.INVISIBLE);
|
||||
}
|
||||
switch (event.getAction()) {
|
||||
case MotionEvent.ACTION_DOWN: {
|
||||
first = true;
|
||||
if (API <= 10 && !this.hasFocus()) {
|
||||
this.requestFocus();
|
||||
}
|
||||
location = event.getY();
|
||||
break;
|
||||
}
|
||||
case MotionEvent.ACTION_UP:{
|
||||
if (showFullScreen&&first) {
|
||||
if (uBar.isShown()&&this.getScrollY()<5) {
|
||||
uBar.startAnimation(slideUp);
|
||||
} else if (event.getY()>location && !uBar.isShown()) {
|
||||
uBar.startAnimation(slideDown);
|
||||
} else if (event.getY()<location && uBar.isShown()){
|
||||
uBar.startAnimation(slideUp);
|
||||
}
|
||||
first = false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return super.onTouchEvent(event);
|
||||
}
|
||||
private void getControls() {
|
||||
if(API<11){
|
||||
try {
|
||||
Class<?> webview = Class.forName("android.webkit.WebView");
|
||||
Method method = webview.getMethod("getZoomButtonsController");
|
||||
zoomControl = (ZoomButtonsController) method.invoke(this, null);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,527 +0,0 @@
|
||||
package acr.browser.barebones;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.DialogInterface.OnCancelListener;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.View.OnKeyListener;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.webkit.WebView;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.CompoundButton.OnCheckedChangeListener;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RadioButton;
|
||||
import android.widget.TextView;
|
||||
import android.widget.TextView.OnEditorActionListener;
|
||||
|
||||
public class Settings extends Activity {
|
||||
private static final String preferences = "settings";
|
||||
private static boolean allowLocation;
|
||||
private static boolean deleteHistory;
|
||||
private static int enableFlash;
|
||||
private static boolean savePasswords;
|
||||
private static boolean fullScreen;
|
||||
private static boolean java;
|
||||
private static boolean saveTabs;
|
||||
private static String userAgent;
|
||||
private static String homepage;
|
||||
private static EditText agent;
|
||||
private static EditText h;
|
||||
private static SharedPreferences.Editor edit;
|
||||
private static int agentPicker;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
// TODO Auto-generated method stub
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.settings);
|
||||
TextView it = (TextView) findViewById(R.id.textView1);
|
||||
|
||||
agent = (EditText) findViewById(R.id.agent);
|
||||
agent.setSelectAllOnFocus(true);
|
||||
this.getWindow().setSoftInputMode(
|
||||
WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
|
||||
SharedPreferences settings = getSharedPreferences(preferences, 0);
|
||||
WebView test = new WebView(Settings.this);
|
||||
String user = test.getSettings().getUserAgentString();
|
||||
test.destroy();
|
||||
it.requestFocus();
|
||||
allowLocation = settings.getBoolean("location", false);
|
||||
saveTabs = settings.getBoolean("savetabs", true);
|
||||
savePasswords = settings.getBoolean("passwords", true);
|
||||
deleteHistory = settings.getBoolean("history", false);
|
||||
fullScreen = settings.getBoolean("fullscreen", false);
|
||||
enableFlash = settings.getInt("enableflash", 0);
|
||||
agentPicker = settings.getInt("agentchoose", 1);
|
||||
userAgent = settings.getString("agent", user);
|
||||
java = settings.getBoolean("java", true);
|
||||
homepage = settings.getString("home", FinalVars.HOMEPAGE);
|
||||
|
||||
agent.setText(userAgent);
|
||||
edit = settings.edit();
|
||||
final RadioButton m = (RadioButton) findViewById(R.id.radioMobile);
|
||||
final RadioButton d = (RadioButton) findViewById(R.id.radioDesktop);
|
||||
final RadioButton c = (RadioButton) findViewById(R.id.radioCustom);
|
||||
m.setOnClickListener(new OnClickListener(){
|
||||
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
d.setChecked(false);
|
||||
c.setChecked(false);
|
||||
edit.putInt("agentchoose", 1);
|
||||
edit.commit();
|
||||
}
|
||||
|
||||
});
|
||||
d.setOnClickListener(new OnClickListener(){
|
||||
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
m.setChecked(false);
|
||||
c.setChecked(false);
|
||||
edit.putInt("agentchoose", 2);
|
||||
edit.commit();
|
||||
}
|
||||
|
||||
});
|
||||
c.setOnClickListener(new OnClickListener(){
|
||||
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
m.setChecked(false);
|
||||
d.setChecked(false);
|
||||
edit.putInt("agentchoose", 3);
|
||||
edit.commit();
|
||||
}
|
||||
|
||||
});
|
||||
switch (agentPicker) {
|
||||
case 1:
|
||||
m.setChecked(true);
|
||||
d.setChecked(false);
|
||||
c.setChecked(false);
|
||||
break;
|
||||
case 2:
|
||||
m.setChecked(false);
|
||||
d.setChecked(true);
|
||||
c.setChecked(false);
|
||||
break;
|
||||
case 3:
|
||||
|
||||
m.setChecked(false);
|
||||
d.setChecked(false);
|
||||
c.setChecked(true);
|
||||
break;
|
||||
}
|
||||
back();
|
||||
location();
|
||||
passwords();
|
||||
clearHistory();
|
||||
saveTabs();
|
||||
getText();
|
||||
flash();
|
||||
getHome();
|
||||
full();
|
||||
java();
|
||||
}
|
||||
|
||||
void saveTabs(){
|
||||
final CheckBox tab = (CheckBox)findViewById(R.id.saveTabs);
|
||||
if(saveTabs){
|
||||
tab.setChecked(true);
|
||||
|
||||
}else{
|
||||
tab.setChecked(false);
|
||||
}
|
||||
tab.setOnCheckedChangeListener(new OnCheckedChangeListener(){
|
||||
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton arg0, boolean arg1) {
|
||||
// TODO Auto-generated method stub
|
||||
if(arg1){
|
||||
edit.putBoolean("savetabs", true);
|
||||
edit.commit();
|
||||
}else{
|
||||
edit.putBoolean("savetabs", false);
|
||||
edit.commit();
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
void getHome() {
|
||||
h = (EditText) findViewById(R.id.homePage);
|
||||
|
||||
TextView t = (TextView) findViewById(R.id.textView3);
|
||||
t.setBackgroundResource(R.drawable.button);
|
||||
TextView a = (TextView) findViewById(R.id.textView2);
|
||||
a.setBackgroundResource(R.drawable.button);
|
||||
h.setSelectAllOnFocus(true);
|
||||
h.setText(homepage);
|
||||
h.setSingleLine(true);
|
||||
h.setOnKeyListener(new OnKeyListener(){
|
||||
|
||||
@Override
|
||||
public boolean onKey(View arg0, int arg1, KeyEvent arg2) {
|
||||
// TODO Auto-generated method stub
|
||||
switch(arg1){
|
||||
case KeyEvent.KEYCODE_ENTER:
|
||||
String home;
|
||||
home = h.getText().toString();
|
||||
if(!home.contains("about:blank")&&!home.contains("about:home")){
|
||||
if(!home.contains("http://") && !home.contains("https://")){
|
||||
home = "http://"+home;
|
||||
}}
|
||||
edit.putString("home", home);
|
||||
edit.commit();
|
||||
return true;
|
||||
default: break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
});
|
||||
h.setOnEditorActionListener(new OnEditorActionListener() {
|
||||
|
||||
@Override
|
||||
public boolean onEditorAction(TextView v, int actionId,
|
||||
KeyEvent event) {
|
||||
// TODO Auto-generated method stub
|
||||
if (actionId == EditorInfo.IME_ACTION_GO
|
||||
|| actionId == EditorInfo.IME_ACTION_DONE
|
||||
|| actionId == EditorInfo.IME_ACTION_NEXT
|
||||
|| actionId == EditorInfo.IME_ACTION_SEND||actionId==EditorInfo.IME_ACTION_SEARCH||event.getAction()==KeyEvent.KEYCODE_ENTER) {
|
||||
String home = h.getText().toString();
|
||||
if(!h.getText().toString().contains("about:blank")&&!h.getText().toString().contains("about:home")){
|
||||
if(!h.getText().toString().contains("http://") && !h.getText().toString().contains("https://")){
|
||||
home = "http://"+h.getText().toString();
|
||||
}}
|
||||
edit.putString("home", home);
|
||||
edit.commit();
|
||||
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
imm.hideSoftInputFromWindow(agent.getWindowToken(), 0);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
public void radioAgent(View v) {
|
||||
|
||||
boolean checked = ((RadioButton) v).isChecked();
|
||||
switch (v.getId()) {
|
||||
case (R.id.radioMobile):
|
||||
if (checked) {
|
||||
edit.putInt("agentchoose", 1);
|
||||
edit.commit();
|
||||
|
||||
}
|
||||
break;
|
||||
case (R.id.radioDesktop):
|
||||
if (checked) {
|
||||
edit.putInt("agentchoose", 2);
|
||||
edit.commit();
|
||||
|
||||
}
|
||||
break;
|
||||
case (R.id.radioCustom):
|
||||
if (checked) {
|
||||
edit.putInt("agentchoose", 3);
|
||||
edit.commit();
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void back() {
|
||||
ImageView back = (ImageView) findViewById(R.id.back);
|
||||
back.setBackgroundResource(R.drawable.button);
|
||||
back.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// TODO Auto-generated method stub
|
||||
if (agentPicker == 3) {
|
||||
userAgent = agent.getText().toString();
|
||||
edit.putString("agent", userAgent);
|
||||
edit.commit();
|
||||
}
|
||||
String home = h.getText().toString();
|
||||
if(!h.getText().toString().contains("about:blank")&&!h.getText().toString().contains("about:home")){
|
||||
if(!h.getText().toString().contains("http://") && !h.getText().toString().contains("https://")){
|
||||
home = "http://"+h.getText().toString();
|
||||
}}
|
||||
edit.putString("home", home);
|
||||
edit.commit();
|
||||
finish();
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
void java(){
|
||||
final CheckBox full = (CheckBox)findViewById(R.id.java);
|
||||
if(java){
|
||||
full.setChecked(true);
|
||||
|
||||
}else{
|
||||
full.setChecked(false);
|
||||
}
|
||||
full.setOnCheckedChangeListener(new OnCheckedChangeListener(){
|
||||
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton arg0, boolean arg1) {
|
||||
// TODO Auto-generated method stub
|
||||
if(arg1){
|
||||
edit.putBoolean("java", true);
|
||||
edit.commit();
|
||||
}else{
|
||||
edit.putBoolean("java", false);
|
||||
edit.commit();
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
void full(){
|
||||
final CheckBox full = (CheckBox)findViewById(R.id.fullScreen);
|
||||
if(fullScreen){
|
||||
full.setChecked(true);
|
||||
|
||||
}else{
|
||||
full.setChecked(false);
|
||||
}
|
||||
full.setOnCheckedChangeListener(new OnCheckedChangeListener(){
|
||||
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton arg0, boolean arg1) {
|
||||
// TODO Auto-generated method stub
|
||||
if(arg1){
|
||||
edit.putBoolean("fullscreen", true);
|
||||
edit.commit();
|
||||
}else{
|
||||
edit.putBoolean("fullscreen", false);
|
||||
edit.commit();
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
void flash() {
|
||||
final CheckBox fla = (CheckBox) findViewById(R.id.flash);
|
||||
if (enableFlash == 1||enableFlash==2) {
|
||||
fla.setChecked(true);
|
||||
} else {
|
||||
fla.setChecked(false);
|
||||
}
|
||||
fla.setOnCheckedChangeListener(new OnCheckedChangeListener() {
|
||||
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton arg0, boolean isChecked) {
|
||||
// TODO Auto-generated method stub
|
||||
if (isChecked) {
|
||||
|
||||
DialogInterface.OnClickListener dialogClickListener = new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog,
|
||||
int which) {
|
||||
switch (which) {
|
||||
case DialogInterface.BUTTON_POSITIVE: {
|
||||
edit.putInt("enableflash", 1);
|
||||
edit.commit();
|
||||
break;
|
||||
}
|
||||
case DialogInterface.BUTTON_NEGATIVE: {
|
||||
edit.putInt("enableflash", 2);
|
||||
edit.commit();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
fla.setChecked(false);
|
||||
edit.putInt("enableflash", 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(
|
||||
Settings.this); // dialog
|
||||
builder.setMessage(
|
||||
"How do you want Flash enabled?")
|
||||
.setPositiveButton("Load on-demand",
|
||||
dialogClickListener)
|
||||
.setNegativeButton("Always load",
|
||||
dialogClickListener).show();
|
||||
builder.setOnCancelListener(new OnCancelListener(){
|
||||
|
||||
@Override
|
||||
public void onCancel(DialogInterface arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
edit.putInt("enableflash", 0);
|
||||
edit.commit();
|
||||
fla.setChecked(false);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
} else {
|
||||
edit.putInt("enableflash", 0);
|
||||
edit.commit();
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
void location() {
|
||||
CheckBox loc = (CheckBox) findViewById(R.id.location);
|
||||
if (allowLocation) {
|
||||
loc.setChecked(true);
|
||||
} else {
|
||||
loc.setChecked(false);
|
||||
}
|
||||
loc.setOnCheckedChangeListener(new OnCheckedChangeListener() {
|
||||
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton arg0, boolean isChecked) {
|
||||
// TODO Auto-generated method stub
|
||||
if (isChecked) {
|
||||
edit.putBoolean("location", true);
|
||||
edit.commit();
|
||||
} else {
|
||||
edit.putBoolean("location", false);
|
||||
edit.commit();
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
void getText() {
|
||||
agent.setOnKeyListener(new OnKeyListener(){
|
||||
|
||||
@Override
|
||||
public boolean onKey(View arg0, int arg1, KeyEvent arg2) {
|
||||
// TODO Auto-generated method stub
|
||||
switch(arg1){
|
||||
case KeyEvent.KEYCODE_ENTER:
|
||||
userAgent = agent.getText().toString();
|
||||
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
imm.hideSoftInputFromWindow(agent.getWindowToken(), 0);
|
||||
edit.putString("agent", userAgent);
|
||||
edit.commit();
|
||||
return true;
|
||||
default: break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
});
|
||||
agent.setOnEditorActionListener(new OnEditorActionListener() {
|
||||
|
||||
@Override
|
||||
public boolean onEditorAction(TextView v, int actionId,
|
||||
KeyEvent event) {
|
||||
// TODO Auto-generated method stub
|
||||
if (actionId == EditorInfo.IME_ACTION_GO
|
||||
|| actionId == EditorInfo.IME_ACTION_DONE
|
||||
|| actionId == EditorInfo.IME_ACTION_NEXT
|
||||
|| actionId == EditorInfo.IME_ACTION_SEND||actionId==EditorInfo.IME_ACTION_SEARCH||event.getAction()==KeyEvent.KEYCODE_ENTER) {
|
||||
userAgent = agent.getText().toString();
|
||||
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
imm.hideSoftInputFromWindow(agent.getWindowToken(), 0);
|
||||
edit.putString("agent", userAgent);
|
||||
edit.commit();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
void passwords() {
|
||||
CheckBox pass = (CheckBox) findViewById(R.id.password);
|
||||
if (savePasswords) {
|
||||
pass.setChecked(true);
|
||||
} else {
|
||||
pass.setChecked(false);
|
||||
}
|
||||
pass.setOnCheckedChangeListener(new OnCheckedChangeListener() {
|
||||
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton arg0, boolean isChecked) {
|
||||
// TODO Auto-generated method stub
|
||||
if (isChecked) {
|
||||
edit.putBoolean("passwords", true);
|
||||
edit.commit();
|
||||
} else {
|
||||
edit.putBoolean("passwords", false);
|
||||
edit.commit();
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
void clearHistory() {
|
||||
CheckBox clearHist = (CheckBox) findViewById(R.id.historyClear);
|
||||
if (deleteHistory) {
|
||||
clearHist.setChecked(true);
|
||||
} else {
|
||||
clearHist.setChecked(false);
|
||||
}
|
||||
clearHist.setOnCheckedChangeListener(new OnCheckedChangeListener() {
|
||||
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton arg0, boolean isChecked) {
|
||||
// TODO Auto-generated method stub
|
||||
if (isChecked) {
|
||||
edit.putBoolean("history", true);
|
||||
edit.commit();
|
||||
} else {
|
||||
edit.putBoolean("history", false);
|
||||
edit.commit();
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
// TODO Auto-generated method stub
|
||||
if (agentPicker == 3) {
|
||||
userAgent = agent.getText().toString();
|
||||
edit.putString("agent", userAgent);
|
||||
edit.commit();
|
||||
}
|
||||
String home = h.getText().toString();
|
||||
if(!h.getText().toString().contains("about:blank")&&!h.getText().toString().contains("about:home")){
|
||||
if(!h.getText().toString().contains("http://") && !h.getText().toString().contains("https://")){
|
||||
home = "http://"+h.getText().toString();
|
||||
}}
|
||||
edit.putString("home", home);
|
||||
edit.commit();
|
||||
super.onBackPressed();
|
||||
}
|
||||
}
|
@ -0,0 +1,469 @@
|
||||
package acr.browser.barebones.activities;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import acr.browser.barebones.R;
|
||||
import acr.browser.barebones.variables.BookmarkPageVariables;
|
||||
import acr.browser.barebones.variables.FinalVariables;
|
||||
import acr.browser.barebones.variables.Utils;
|
||||
import acr.browser.barebones.activities.BarebonesActivity;
|
||||
import android.os.Bundle;
|
||||
import android.provider.Browser;
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.SharedPreferences;
|
||||
import android.database.Cursor;
|
||||
import android.view.Menu;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.webkit.CookieManager;
|
||||
import android.webkit.CookieSyncManager;
|
||||
import android.webkit.WebIconDatabase;
|
||||
import android.webkit.WebViewDatabase;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.CompoundButton.OnCheckedChangeListener;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
|
||||
public class AdvancedSettingsActivity extends Activity {
|
||||
|
||||
// settings variables
|
||||
static boolean savePasswords, clearCache, enableJavaScript,
|
||||
enableTextReflow, blockImages, newWindow, incognitoAlways;
|
||||
static int defaultZoom, textSize;
|
||||
static final int API = FinalVariables.API;
|
||||
static final String preferences = "settings";
|
||||
static SharedPreferences settings;
|
||||
static SharedPreferences.Editor edit;
|
||||
static RelativeLayout r1, r2, r3, r4, r5, r6, r7, r8, r9, r10;
|
||||
static CheckBox cb1, cb2, cb3, cb4, cb5, cb6, cb7;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.advanced_settings);
|
||||
settings = getSharedPreferences(preferences, 0);
|
||||
edit = settings.edit();
|
||||
initialize();
|
||||
}
|
||||
|
||||
void initialize() {
|
||||
|
||||
r1 = (RelativeLayout) findViewById(R.id.r1);
|
||||
r2 = (RelativeLayout) findViewById(R.id.r2);
|
||||
r3 = (RelativeLayout) findViewById(R.id.r3);
|
||||
r4 = (RelativeLayout) findViewById(R.id.r4);
|
||||
r5 = (RelativeLayout) findViewById(R.id.r5);
|
||||
r6 = (RelativeLayout) findViewById(R.id.r6);
|
||||
r7 = (RelativeLayout) findViewById(R.id.r7);
|
||||
r8 = (RelativeLayout) findViewById(R.id.r8);
|
||||
r9 = (RelativeLayout) findViewById(R.id.r9);
|
||||
r10 = (RelativeLayout) findViewById(R.id.r10);
|
||||
|
||||
cb1 = (CheckBox) findViewById(R.id.cb1);
|
||||
cb2 = (CheckBox) findViewById(R.id.cb2);
|
||||
cb3 = (CheckBox) findViewById(R.id.cb3);
|
||||
cb4 = (CheckBox) findViewById(R.id.cb4);
|
||||
cb5 = (CheckBox) findViewById(R.id.cb5);
|
||||
cb6 = (CheckBox) findViewById(R.id.cb6);
|
||||
cb7 = (CheckBox) findViewById(R.id.cb7);
|
||||
|
||||
cb1.setChecked(settings.getBoolean("passwords", true));
|
||||
cb2.setChecked(settings.getBoolean("cache", false));
|
||||
cb3.setChecked(settings.getBoolean("java", true));
|
||||
cb4.setChecked(settings.getBoolean("textreflow", false));
|
||||
cb5.setChecked(settings.getBoolean("blockimages", false));
|
||||
cb6.setChecked(settings.getBoolean("newwindows", true));
|
||||
cb7.setChecked(settings.getBoolean("alwaysincognito", false));
|
||||
|
||||
r1(r1);
|
||||
r2(r2);
|
||||
r3(r3);
|
||||
r4(r4);
|
||||
r5(r5);
|
||||
r6(r6);
|
||||
r7(r7);
|
||||
r8(r8);
|
||||
r9(r9);
|
||||
r10(r10);
|
||||
cb1(cb1);
|
||||
cb2(cb2);
|
||||
cb3(cb3);
|
||||
cb4(cb4);
|
||||
cb5(cb5);
|
||||
cb6(cb6);
|
||||
cb7(cb7);
|
||||
back();
|
||||
}
|
||||
|
||||
void back() {
|
||||
ImageView back = (ImageView) findViewById(R.id.advanced_back);
|
||||
back.setBackgroundResource(R.drawable.button);
|
||||
back.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
finish();
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
static void cb1(CheckBox view) {
|
||||
view.setOnCheckedChangeListener(new OnCheckedChangeListener() {
|
||||
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView,
|
||||
boolean isChecked) {
|
||||
edit.putBoolean("passwords", isChecked);
|
||||
edit.commit();
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
void cb2(CheckBox view) {
|
||||
view.setOnCheckedChangeListener(new OnCheckedChangeListener() {
|
||||
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView,
|
||||
boolean isChecked) {
|
||||
edit.putBoolean("cache", isChecked);
|
||||
edit.commit();
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
void cb3(CheckBox view) {
|
||||
view.setOnCheckedChangeListener(new OnCheckedChangeListener() {
|
||||
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView,
|
||||
boolean isChecked) {
|
||||
edit.putBoolean("java", isChecked);
|
||||
edit.commit();
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
void cb4(CheckBox view) {
|
||||
view.setOnCheckedChangeListener(new OnCheckedChangeListener() {
|
||||
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView,
|
||||
boolean isChecked) {
|
||||
edit.putBoolean("textreflow", isChecked);
|
||||
edit.commit();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void cb5(CheckBox view) {
|
||||
view.setOnCheckedChangeListener(new OnCheckedChangeListener() {
|
||||
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView,
|
||||
boolean isChecked) {
|
||||
edit.putBoolean("blockimages", isChecked);
|
||||
edit.commit();
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
void cb6(CheckBox view) {
|
||||
view.setOnCheckedChangeListener(new OnCheckedChangeListener() {
|
||||
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView,
|
||||
boolean isChecked) {
|
||||
edit.putBoolean("newwindows", isChecked);
|
||||
edit.commit();
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
void cb7(CheckBox view) {
|
||||
view.setOnCheckedChangeListener(new OnCheckedChangeListener() {
|
||||
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView,
|
||||
boolean isChecked) {
|
||||
edit.putBoolean("alwaysincognito", isChecked);
|
||||
edit.commit();
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
void r1(RelativeLayout view) {
|
||||
view.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// TODO Auto-generated method stub
|
||||
cb1.setChecked(!cb1.isChecked());
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
void r2(RelativeLayout view) {
|
||||
view.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// TODO Auto-generated method stub
|
||||
cb2.setChecked(!cb2.isChecked());
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
void r3(RelativeLayout view) {
|
||||
view.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// TODO Auto-generated method stub
|
||||
cb3.setChecked(!cb3.isChecked());
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
void r4(RelativeLayout view) {
|
||||
view.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// TODO Auto-generated method stub
|
||||
cb4.setChecked(!cb4.isChecked());
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
void r5(RelativeLayout view) {
|
||||
view.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// TODO Auto-generated method stub
|
||||
cb5.setChecked(!cb5.isChecked());
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
void r6(RelativeLayout view) {
|
||||
view.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// TODO Auto-generated method stub
|
||||
cb6.setChecked(!cb6.isChecked());
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
void r7(RelativeLayout view) {
|
||||
view.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// TODO Auto-generated method stub
|
||||
cb7.setChecked(!cb7.isChecked());
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
void r8(RelativeLayout view) {
|
||||
view.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(
|
||||
AdvancedSettingsActivity.this); // dialog
|
||||
builder.setTitle("Clear History");
|
||||
builder.setMessage(
|
||||
"Would you like to clear all browser history?")
|
||||
.setPositiveButton("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("No",
|
||||
new DialogInterface.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface arg0,
|
||||
int arg1) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}).show();
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public void clearHistory() {
|
||||
CookieManager c = CookieManager.getInstance();
|
||||
CookieSyncManager.createInstance(this);
|
||||
c.removeAllCookie();
|
||||
AdvancedSettingsActivity.this.deleteDatabase("historyManager");
|
||||
BarebonesActivity.main[0].clearCache(true);
|
||||
WebViewDatabase m = WebViewDatabase
|
||||
.getInstance(AdvancedSettingsActivity.this);
|
||||
m.clearFormData();
|
||||
m.clearHttpAuthUsernamePassword();
|
||||
if (API < 18) {
|
||||
m.clearUsernamePassword();
|
||||
WebIconDatabase.getInstance().removeAllIcons();
|
||||
}
|
||||
if (!BarebonesActivity.noStockBrowser) {
|
||||
try {
|
||||
Browser.clearHistory(getContentResolver());
|
||||
} catch (NullPointerException ignored) {
|
||||
}
|
||||
}
|
||||
trimCache(AdvancedSettingsActivity.this);
|
||||
}
|
||||
|
||||
void r9(RelativeLayout view) {
|
||||
view.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
importFromStockBrowser();
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
void r10(RelativeLayout view) {
|
||||
view.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
AlertDialog.Builder picker = new AlertDialog.Builder(
|
||||
AdvancedSettingsActivity.this);
|
||||
picker.setTitle("Search Engine");
|
||||
CharSequence[] chars = { "Largest", "Large", "Normal", "Small", "Smallest"};
|
||||
|
||||
int n = settings.getInt("textsize", 3);
|
||||
|
||||
picker.setSingleChoiceItems(chars, n - 1,
|
||||
new DialogInterface.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog,
|
||||
int which) {
|
||||
edit.putInt("textsize", which+1);
|
||||
edit.commit();
|
||||
|
||||
}
|
||||
});
|
||||
picker.setNeutralButton("OK",
|
||||
new DialogInterface.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog,
|
||||
int which) {
|
||||
|
||||
}
|
||||
});
|
||||
picker.show();
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
void trimCache(Context context) {
|
||||
try {
|
||||
File dir = context.getCacheDir();
|
||||
|
||||
if (dir != null && dir.isDirectory()) {
|
||||
deleteDir(dir);
|
||||
}
|
||||
} catch (Exception ignored) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
boolean deleteDir(File dir) {
|
||||
if (dir != null && dir.isDirectory()) {
|
||||
String[] children = dir.list();
|
||||
for (String aChildren : children) {
|
||||
boolean success = deleteDir(new File(dir, aChildren));
|
||||
if (!success) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
// The directory is now empty so delete it
|
||||
return dir.delete();
|
||||
}
|
||||
|
||||
public void importFromStockBrowser() {
|
||||
if (!BarebonesActivity.noStockBrowser) {
|
||||
try {
|
||||
String[] proj = new String[] { Browser.BookmarkColumns.TITLE,
|
||||
Browser.BookmarkColumns.URL };
|
||||
String sel = Browser.BookmarkColumns.BOOKMARK + " = 1"; // 0 =
|
||||
// history,
|
||||
// 1 =
|
||||
// bookmark
|
||||
Cursor mCur;
|
||||
mCur = getContentResolver().query(Browser.BOOKMARKS_URI, proj,
|
||||
sel, null, null);
|
||||
mCur.moveToFirst();
|
||||
|
||||
String title = "";
|
||||
String url = "";
|
||||
|
||||
if (mCur.moveToFirst() && mCur.getCount() > 0) {
|
||||
while (mCur.isAfterLast() == false) {
|
||||
|
||||
title = mCur.getString(mCur
|
||||
.getColumnIndex(Browser.BookmarkColumns.TITLE));
|
||||
url = mCur.getString(mCur
|
||||
.getColumnIndex(Browser.BookmarkColumns.URL));
|
||||
Utils.addBookmark(getBaseContext(),title,url);
|
||||
mCur.moveToNext();
|
||||
}
|
||||
}
|
||||
} catch (NullPointerException ignored) {
|
||||
}
|
||||
}
|
||||
else{
|
||||
Utils.createInformativeDialog(getBaseContext(), "Error", "No browser was detected to import bookmarks from.");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
684
src/acr/browser/barebones/activities/SettingsActivity.java
Normal file
684
src/acr/browser/barebones/activities/SettingsActivity.java
Normal file
@ -0,0 +1,684 @@
|
||||
package acr.browser.barebones.activities;
|
||||
|
||||
import acr.browser.barebones.R;
|
||||
import acr.browser.barebones.R.drawable;
|
||||
import acr.browser.barebones.R.id;
|
||||
import acr.browser.barebones.R.layout;
|
||||
import acr.browser.barebones.variables.FinalVariables;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager.NameNotFoundException;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.CompoundButton.OnCheckedChangeListener;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RadioButton;
|
||||
import android.widget.RadioGroup;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.Switch;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
public class SettingsActivity extends Activity {
|
||||
static int API = FinalVariables.API;
|
||||
static final String preferences = "settings";
|
||||
static SharedPreferences.Editor edit;
|
||||
static int agentChoice;
|
||||
static String homepage;
|
||||
static TextView agentText;
|
||||
static TextView download;
|
||||
static int egg = 0;
|
||||
static String downloadLocation;
|
||||
static TextView homepageText;
|
||||
static SharedPreferences settings;
|
||||
static TextView searchText;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.settings);
|
||||
init();
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
public void init() {
|
||||
// settings storage
|
||||
settings = getSharedPreferences(preferences, 0);
|
||||
edit = settings.edit();
|
||||
|
||||
// initialize UI
|
||||
RelativeLayout layoutLocation = (RelativeLayout) findViewById(R.id.layoutLocation);
|
||||
RelativeLayout layoutFullScreen = (RelativeLayout) findViewById(R.id.layoutFullScreen);
|
||||
RelativeLayout layoutFlash = (RelativeLayout) findViewById(R.id.layoutFlash);
|
||||
ImageView back = (ImageView) findViewById(R.id.back);
|
||||
|
||||
searchText = (TextView) findViewById(R.id.searchText);
|
||||
|
||||
switch (settings.getInt("search", 1)) {
|
||||
case 1:
|
||||
searchText.setText("Google");
|
||||
break;
|
||||
case 2:
|
||||
searchText.setText("Bing");
|
||||
break;
|
||||
case 3:
|
||||
searchText.setText("Yahoo");
|
||||
break;
|
||||
case 4:
|
||||
searchText.setText("StartPage");
|
||||
break;
|
||||
case 5:
|
||||
searchText.setText("DuckDuckGo");
|
||||
break;
|
||||
}
|
||||
|
||||
back.setBackgroundResource(R.drawable.button);
|
||||
agentText = (TextView) findViewById(R.id.agentText);
|
||||
homepageText = (TextView) findViewById(R.id.homepageText);
|
||||
download = (TextView) findViewById(R.id.downloadText);
|
||||
|
||||
boolean locationBool = settings.getBoolean("location", false);
|
||||
int flashNum = settings.getInt("enableflash", 0);
|
||||
boolean fullScreenBool = settings.getBoolean("fullscreen", false);
|
||||
agentChoice = settings.getInt("agentchoose", 1);
|
||||
homepage = settings.getString("home", FinalVariables.HOMEPAGE);
|
||||
downloadLocation = settings.getString("download",
|
||||
FinalVariables.DOWNLOAD_LOCATION);
|
||||
|
||||
download.setText(downloadLocation);
|
||||
|
||||
int code = 0;
|
||||
|
||||
try {
|
||||
PackageInfo p = getPackageManager().getPackageInfo(
|
||||
getPackageName(), 0);
|
||||
code = p.versionCode;
|
||||
} catch (NameNotFoundException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
TextView version = (TextView) findViewById(R.id.versionCode);
|
||||
version.setText(code + "");
|
||||
|
||||
if (homepage.contains("about:home")) {
|
||||
homepageText.setText("Bookmarks");
|
||||
} else if (homepage.contains("about:blank")) {
|
||||
homepageText.setText("Blank Page");
|
||||
} else {
|
||||
homepageText.setText(homepage);
|
||||
}
|
||||
|
||||
switch (agentChoice) {
|
||||
case 1:
|
||||
agentText.setText("Default");
|
||||
break;
|
||||
case 2:
|
||||
agentText.setText("Desktop");
|
||||
break;
|
||||
case 3:
|
||||
agentText.setText("Mobile");
|
||||
break;
|
||||
}
|
||||
RelativeLayout r1, r2, r3;
|
||||
r1 = (RelativeLayout)findViewById(R.id.setR1);
|
||||
r2 = (RelativeLayout)findViewById(R.id.setR2);
|
||||
r3 = (RelativeLayout)findViewById(R.id.setR3);
|
||||
if (API >= 14) {
|
||||
Switch location = new Switch(this);
|
||||
Switch fullScreen = new Switch(this);
|
||||
Switch flash = new Switch(this);
|
||||
|
||||
|
||||
r1.addView(location);
|
||||
r2.addView(fullScreen);
|
||||
r3.addView(flash);
|
||||
location.setChecked(locationBool);
|
||||
fullScreen.setChecked(fullScreenBool);
|
||||
if (flashNum > 0) {
|
||||
flash.setChecked(true);
|
||||
} else {
|
||||
flash.setChecked(false);
|
||||
}
|
||||
|
||||
initSwitch(location, fullScreen, flash);
|
||||
clickListenerForSwitches(
|
||||
layoutLocation, layoutFullScreen, layoutFlash, location, fullScreen, flash);
|
||||
|
||||
} else {
|
||||
CheckBox location = new CheckBox(this);
|
||||
CheckBox fullScreen = new CheckBox(this);
|
||||
CheckBox flash = new CheckBox(this);
|
||||
|
||||
r1.addView(location);
|
||||
r2.addView(fullScreen);
|
||||
r3.addView(flash);
|
||||
|
||||
location.setChecked(locationBool);
|
||||
fullScreen.setChecked(fullScreenBool);
|
||||
if (flashNum > 0) {
|
||||
flash.setChecked(true);
|
||||
} else {
|
||||
flash.setChecked(false);
|
||||
}
|
||||
initCheckBox(location, fullScreen, flash);
|
||||
clickListenerForCheckBoxes(
|
||||
layoutLocation, layoutFullScreen, layoutFlash, location, fullScreen, flash);
|
||||
}
|
||||
|
||||
RelativeLayout agent = (RelativeLayout) findViewById(R.id.layoutUserAgent);
|
||||
RelativeLayout download = (RelativeLayout) findViewById(R.id.layoutDownload);
|
||||
RelativeLayout homepage = (RelativeLayout) findViewById(R.id.layoutHomepage);
|
||||
RelativeLayout advanced = (RelativeLayout) findViewById(R.id.layoutAdvanced);
|
||||
RelativeLayout source = (RelativeLayout) findViewById(R.id.layoutSource);
|
||||
RelativeLayout license = (RelativeLayout) findViewById(R.id.layoutLicense);
|
||||
|
||||
back(back);
|
||||
agent(agent);
|
||||
download(download);
|
||||
homepage(homepage);
|
||||
advanced(advanced);
|
||||
source(source);
|
||||
license(license);
|
||||
search();
|
||||
easterEgg();
|
||||
}
|
||||
|
||||
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(
|
||||
SettingsActivity.this);
|
||||
picker.setTitle("Search Engine");
|
||||
CharSequence[] chars = { "Google (Suggested)", "Bing", "Yahoo", "StartPage", "DuckDuckGo (Privacy)" };
|
||||
|
||||
int n = settings.getInt("search", 1);
|
||||
|
||||
picker.setSingleChoiceItems(chars, n - 1,
|
||||
new DialogInterface.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog,
|
||||
int which) {
|
||||
edit.putInt("search", which+1);
|
||||
edit.commit();
|
||||
switch (which+1) {
|
||||
case 1:
|
||||
searchText.setText("Google");
|
||||
break;
|
||||
case 2:
|
||||
searchText.setText("Bing");
|
||||
break;
|
||||
case 3:
|
||||
searchText.setText("Yahoo");
|
||||
break;
|
||||
case 4:
|
||||
searchText.setText("StartPage");
|
||||
break;
|
||||
case 5:
|
||||
searchText.setText("DuckDuckGo");
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
picker.setNeutralButton("OK",
|
||||
new DialogInterface.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog,
|
||||
int which) {
|
||||
|
||||
}
|
||||
});
|
||||
picker.show();
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
public void clickListenerForCheckBoxes(
|
||||
RelativeLayout one, RelativeLayout two, RelativeLayout three, final CheckBox loc,
|
||||
final CheckBox full, final CheckBox flash) {
|
||||
one.setOnClickListener(new OnClickListener(){
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
loc.setChecked(!loc.isChecked());
|
||||
}
|
||||
|
||||
});
|
||||
two.setOnClickListener(new OnClickListener(){
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
full.setChecked(!full.isChecked());
|
||||
}
|
||||
|
||||
});
|
||||
three.setOnClickListener(new OnClickListener(){
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
flash.setChecked(!flash.isChecked());
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
public void clickListenerForSwitches(
|
||||
RelativeLayout one, RelativeLayout two, RelativeLayout three, final Switch loc,
|
||||
final Switch full, final Switch flash) {
|
||||
one.setOnClickListener(new OnClickListener(){
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
loc.setChecked(!loc.isChecked());
|
||||
}
|
||||
|
||||
});
|
||||
two.setOnClickListener(new OnClickListener(){
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
full.setChecked(!full.isChecked());
|
||||
}
|
||||
|
||||
});
|
||||
three.setOnClickListener(new OnClickListener(){
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
flash.setChecked(!flash.isChecked());
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
public void easterEgg() {
|
||||
RelativeLayout easter = (RelativeLayout) findViewById(R.id.layoutVersion);
|
||||
easter.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
egg++;
|
||||
if (egg == 10) {
|
||||
Toast.makeText(SettingsActivity.this, "Almost There",
|
||||
Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
if (egg == 15) {
|
||||
Toast.makeText(SettingsActivity.this, "Easter Egg",
|
||||
Toast.LENGTH_SHORT).show();
|
||||
egg = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
public void initSwitch(Switch location, Switch fullscreen, Switch flash) {
|
||||
location.setOnCheckedChangeListener(new OnCheckedChangeListener() {
|
||||
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView,
|
||||
boolean isChecked) {
|
||||
edit.putBoolean("location", isChecked);
|
||||
edit.commit();
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
flash.setOnCheckedChangeListener(new OnCheckedChangeListener() {
|
||||
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView,
|
||||
boolean isChecked) {
|
||||
int n = 0;
|
||||
if (isChecked) {
|
||||
n = 1;
|
||||
}
|
||||
edit.putInt("enableflash", n);
|
||||
edit.commit();
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
fullscreen.setOnCheckedChangeListener(new OnCheckedChangeListener() {
|
||||
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView,
|
||||
boolean isChecked) {
|
||||
edit.putBoolean("fullscreen", isChecked);
|
||||
edit.commit();
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
public void initCheckBox(CheckBox location, CheckBox fullscreen, CheckBox flash) {
|
||||
location.setOnCheckedChangeListener(new OnCheckedChangeListener() {
|
||||
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView,
|
||||
boolean isChecked) {
|
||||
edit.putBoolean("location", isChecked);
|
||||
edit.commit();
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
flash.setOnCheckedChangeListener(new OnCheckedChangeListener() {
|
||||
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView,
|
||||
boolean isChecked) {
|
||||
int n = 0;
|
||||
if (isChecked) {
|
||||
n = 1;
|
||||
}
|
||||
edit.putInt("enableflash", n);
|
||||
edit.commit();
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
fullscreen.setOnCheckedChangeListener(new OnCheckedChangeListener() {
|
||||
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView,
|
||||
boolean isChecked) {
|
||||
edit.putBoolean("fullscreen", isChecked);
|
||||
edit.commit();
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
public void back(ImageView view) {
|
||||
view.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
finish();
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
public void agent(RelativeLayout view) {
|
||||
view.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
AlertDialog.Builder agentPicker = new AlertDialog.Builder(
|
||||
SettingsActivity.this);
|
||||
agentPicker.setTitle("User Agent");
|
||||
CharSequence[] chars = { "Default", "Desktop", "Mobile" };
|
||||
agentChoice = settings.getInt("agentchoose", 1);
|
||||
agentPicker.setSingleChoiceItems(chars, agentChoice - 1,
|
||||
new DialogInterface.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog,
|
||||
int which) {
|
||||
edit.putInt("agentchoose", which + 1);
|
||||
edit.commit();
|
||||
switch (which + 1) {
|
||||
case 1:
|
||||
agentText.setText("Default");
|
||||
break;
|
||||
case 2:
|
||||
agentText.setText("Desktop");
|
||||
break;
|
||||
case 3:
|
||||
agentText.setText("Mobile");
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
agentPicker.setNeutralButton("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 download(RelativeLayout view) {
|
||||
view.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
AlertDialog.Builder picker = new AlertDialog.Builder(
|
||||
SettingsActivity.this);
|
||||
picker.setTitle("Download Location");
|
||||
CharSequence[] chars = { "Default", "Custom" };
|
||||
downloadLocation = settings.getString("download",
|
||||
FinalVariables.DOWNLOAD_LOCATION);
|
||||
int n = -1;
|
||||
if (downloadLocation.contains(FinalVariables.DOWNLOAD_LOCATION)) {
|
||||
n = 1;
|
||||
} else {
|
||||
n = 2;
|
||||
}
|
||||
|
||||
picker.setSingleChoiceItems(chars, n - 1,
|
||||
new DialogInterface.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog,
|
||||
int which) {
|
||||
|
||||
switch (which + 1) {
|
||||
case 1:
|
||||
edit.putString("download",
|
||||
FinalVariables.DOWNLOAD_LOCATION);
|
||||
edit.commit();
|
||||
download.setText(FinalVariables.DOWNLOAD_LOCATION);
|
||||
break;
|
||||
case 2:
|
||||
downPicker();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
picker.setNeutralButton("OK",
|
||||
new DialogInterface.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog,
|
||||
int which) {
|
||||
|
||||
}
|
||||
});
|
||||
picker.show();
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
public void homePicker() {
|
||||
final AlertDialog.Builder homePicker = new AlertDialog.Builder(
|
||||
SettingsActivity.this);
|
||||
homePicker.setTitle("Custom Homepage");
|
||||
final EditText getHome = new EditText(SettingsActivity.this);
|
||||
homepage = settings.getString("home", FinalVariables.HOMEPAGE);
|
||||
if (!homepage.startsWith("about:")) {
|
||||
getHome.setText(homepage);
|
||||
} else {
|
||||
getHome.setText("http://www.google.com");
|
||||
}
|
||||
homePicker.setView(getHome);
|
||||
homePicker.setPositiveButton("OK",
|
||||
new DialogInterface.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
String text = getHome.getText().toString();
|
||||
edit.putString("home", text);
|
||||
edit.commit();
|
||||
homepageText.setText(text);
|
||||
}
|
||||
});
|
||||
homePicker.show();
|
||||
}
|
||||
|
||||
public void downPicker() {
|
||||
final AlertDialog.Builder downLocationPicker = new AlertDialog.Builder(
|
||||
SettingsActivity.this);
|
||||
downLocationPicker.setTitle("Custom Location");
|
||||
final EditText getDownload = new EditText(SettingsActivity.this);
|
||||
downloadLocation = settings.getString("download",
|
||||
FinalVariables.DOWNLOAD_LOCATION);
|
||||
getDownload.setText(downloadLocation);
|
||||
downLocationPicker.setView(getDownload);
|
||||
downLocationPicker.setPositiveButton("OK",
|
||||
new DialogInterface.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
String text = getDownload.getText().toString();
|
||||
edit.putString("download", text);
|
||||
edit.commit();
|
||||
download.setText(text);
|
||||
}
|
||||
});
|
||||
downLocationPicker.show();
|
||||
}
|
||||
|
||||
public void homepage(RelativeLayout view) {
|
||||
view.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
AlertDialog.Builder picker = new AlertDialog.Builder(
|
||||
SettingsActivity.this);
|
||||
picker.setTitle("Homepage");
|
||||
CharSequence[] chars = { "Bookmarks", "Blank Page", "Webpage" };
|
||||
homepage = settings.getString("home", FinalVariables.HOMEPAGE);
|
||||
int n = -1;
|
||||
if (homepage.contains("about:home")) {
|
||||
n = 1;
|
||||
} else if (homepage.contains("about:blank")) {
|
||||
n = 2;
|
||||
} else {
|
||||
n = 3;
|
||||
}
|
||||
|
||||
picker.setSingleChoiceItems(chars, n - 1,
|
||||
new DialogInterface.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog,
|
||||
int which) {
|
||||
|
||||
switch (which + 1) {
|
||||
case 1:
|
||||
edit.putString("home", "about:home");
|
||||
edit.commit();
|
||||
homepageText.setText("Bookmarks");
|
||||
break;
|
||||
case 2:
|
||||
edit.putString("home", "about:blank");
|
||||
edit.commit();
|
||||
homepageText.setText("Blank Page");
|
||||
break;
|
||||
case 3:
|
||||
homePicker();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
picker.setNeutralButton("OK",
|
||||
new DialogInterface.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog,
|
||||
int which) {
|
||||
|
||||
}
|
||||
});
|
||||
picker.show();
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
public void advanced(RelativeLayout view) {
|
||||
view.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
startActivity(new Intent(
|
||||
"android.intent.action.ADVANCEDSETTINGS"));
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
public void source(RelativeLayout view) {
|
||||
view.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
startActivity(new Intent(
|
||||
Intent.ACTION_VIEW,
|
||||
Uri.parse("https://github.com/anthonycr/Lightning-Browser")));
|
||||
finish();
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
public void license(RelativeLayout view) {
|
||||
view.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
startActivity(new Intent(Intent.ACTION_VIEW, Uri
|
||||
.parse("http://www.apache.org/licenses/LICENSE-2.0")));
|
||||
finish();
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
}
|
92
src/acr/browser/barebones/customwebview/CustomWebView.java
Normal file
92
src/acr/browser/barebones/customwebview/CustomWebView.java
Normal file
@ -0,0 +1,92 @@
|
||||
package acr.browser.barebones.customwebview;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import acr.browser.barebones.activities.BarebonesActivity;
|
||||
import acr.browser.barebones.variables.FinalVariables;
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.animation.Animation;
|
||||
import android.webkit.WebView;
|
||||
import android.widget.ZoomButtonsController;
|
||||
|
||||
public final class CustomWebView extends WebView {
|
||||
private float location;
|
||||
private boolean first = false;
|
||||
final int API = FinalVariables.API;
|
||||
final boolean showFullScreen = BarebonesActivity.showFullScreen;
|
||||
final View uBar = BarebonesActivity.uBar;
|
||||
final Animation slideUp = BarebonesActivity.slideUp;
|
||||
final Animation slideDown = BarebonesActivity.slideDown;
|
||||
private ZoomButtonsController zoomControl;
|
||||
private boolean zoomShouldDie = false;
|
||||
|
||||
public CustomWebView(Context context) {
|
||||
super(context);
|
||||
this.setBackgroundResource(0);
|
||||
|
||||
getControls();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTouchEvent(MotionEvent event) {
|
||||
|
||||
if (zoomShouldDie) {
|
||||
try {
|
||||
zoomControl.getZoomControls().setVisibility(View.INVISIBLE);
|
||||
} catch (IllegalArgumentException ignored) {
|
||||
}
|
||||
}
|
||||
switch (event.getAction()) {
|
||||
case MotionEvent.ACTION_DOWN: {
|
||||
first = true;
|
||||
if (API <= 10 && !this.hasFocus()) {
|
||||
this.requestFocus();
|
||||
}
|
||||
location = event.getY();
|
||||
break;
|
||||
}
|
||||
case MotionEvent.ACTION_UP: {
|
||||
if (showFullScreen && first) {
|
||||
if (uBar.isShown() && this.getScrollY() < 5) {
|
||||
uBar.startAnimation(slideUp);
|
||||
} else if (event.getY() > location && !uBar.isShown()) {
|
||||
uBar.startAnimation(slideDown);
|
||||
} else if (event.getY() < location && uBar.isShown()) {
|
||||
uBar.startAnimation(slideUp);
|
||||
}
|
||||
first = false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return super.onTouchEvent(event);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onWindowVisibilityChanged(int visibility) {
|
||||
if(API >= 11){
|
||||
this.setActivated(visibility == View.VISIBLE);
|
||||
}
|
||||
super.onWindowVisibilityChanged(visibility);
|
||||
}
|
||||
|
||||
private void getControls() {
|
||||
if (API < 11) {
|
||||
try {
|
||||
Class<?> webview = Class.forName("android.webkit.WebView");
|
||||
Method method = webview.getMethod("getZoomButtonsController");
|
||||
zoomControl = (ZoomButtonsController) method.invoke(this, (Object) null);
|
||||
if (zoomControl != null) {
|
||||
zoomShouldDie = true;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,76 @@
|
||||
package acr.browser.barebones.customwebview;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import acr.browser.barebones.activities.IncognitoModeActivity;
|
||||
import acr.browser.barebones.variables.FinalVariables;
|
||||
import android.content.Context;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.animation.Animation;
|
||||
import android.webkit.WebView;
|
||||
import android.widget.ZoomButtonsController;
|
||||
|
||||
public final class IncognitoWebView extends WebView {
|
||||
private float location;
|
||||
private boolean first = false;
|
||||
final int API = FinalVariables.API;
|
||||
final boolean showFullScreen = IncognitoModeActivity.showFullScreen;
|
||||
final View uBar = IncognitoModeActivity.uBar;
|
||||
final Animation slideUp = IncognitoModeActivity.slideUp;
|
||||
final Animation slideDown = IncognitoModeActivity.slideDown;
|
||||
private ZoomButtonsController zoomControl;
|
||||
|
||||
public IncognitoWebView(Context context) {
|
||||
super(context);
|
||||
getControls();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTouchEvent(MotionEvent event) {
|
||||
if (API < 11 && zoomControl != null) {
|
||||
try {
|
||||
zoomControl.getZoomControls().setVisibility(View.INVISIBLE);
|
||||
} catch (IllegalArgumentException ignored) {
|
||||
|
||||
}
|
||||
}
|
||||
switch (event.getAction()) {
|
||||
case MotionEvent.ACTION_DOWN: {
|
||||
first = true;
|
||||
if (API <= 10 && !this.hasFocus()) {
|
||||
this.requestFocus();
|
||||
}
|
||||
location = event.getY();
|
||||
break;
|
||||
}
|
||||
case MotionEvent.ACTION_UP: {
|
||||
if (showFullScreen && first) {
|
||||
if (uBar.isShown() && this.getScrollY() < 5) {
|
||||
uBar.startAnimation(slideUp);
|
||||
} else if (event.getY() > location && !uBar.isShown()) {
|
||||
uBar.startAnimation(slideDown);
|
||||
} else if (event.getY() < location && uBar.isShown()) {
|
||||
uBar.startAnimation(slideUp);
|
||||
}
|
||||
first = false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return super.onTouchEvent(event);
|
||||
}
|
||||
|
||||
private void getControls() {
|
||||
if (API < 11) {
|
||||
try {
|
||||
Class<?> webview = Class.forName("android.webkit.WebView");
|
||||
Method method = webview.getMethod("getZoomButtonsController");
|
||||
zoomControl = (ZoomButtonsController) method.invoke(this, null);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package acr.browser.barebones;
|
||||
package acr.browser.barebones.databases;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -9,7 +9,7 @@ import android.database.Cursor;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.database.sqlite.SQLiteOpenHelper;
|
||||
|
||||
class DatabaseHandler extends SQLiteOpenHelper {
|
||||
public class DatabaseHandler extends SQLiteOpenHelper {
|
||||
|
||||
// All Static variables
|
||||
// Database Version
|
||||
@ -52,9 +52,14 @@ class DatabaseHandler extends SQLiteOpenHelper {
|
||||
/**
|
||||
* All CRUD(Create, Read, Update, Delete) Operations
|
||||
*/
|
||||
|
||||
public void delete(String url){
|
||||
String n = getHistoryItem(url);
|
||||
deleteHistoryItem(n);
|
||||
}
|
||||
|
||||
// Adding new item
|
||||
void addHistoryItem(HistoryItem item) {
|
||||
public void addHistoryItem(HistoryItem item) {
|
||||
SQLiteDatabase db = this.getWritableDatabase();
|
||||
|
||||
ContentValues values = new ContentValues();
|
||||
@ -66,19 +71,18 @@ class DatabaseHandler extends SQLiteOpenHelper {
|
||||
}
|
||||
|
||||
// Getting single item
|
||||
HistoryItem getHistoryItem(int id) {
|
||||
String getHistoryItem(String url) {
|
||||
SQLiteDatabase db = this.getReadableDatabase();
|
||||
|
||||
Cursor cursor = db.query(TABLE_HISTORY, new String[] { KEY_ID,
|
||||
KEY_URL, KEY_TITLE}, KEY_ID + "=?",
|
||||
new String[] { String.valueOf(id) }, null, null, null, null);
|
||||
KEY_URL, KEY_TITLE}, KEY_URL + "=?",
|
||||
new String[] { url }, null, null, null, null);
|
||||
if (cursor != null)
|
||||
cursor.moveToFirst();
|
||||
|
||||
|
||||
String m = cursor.getString(0);
|
||||
cursor.close();
|
||||
// return item
|
||||
return new HistoryItem(Integer.parseInt(cursor.getString(0)),
|
||||
cursor.getString(1), cursor.getString(2));
|
||||
return m;
|
||||
}
|
||||
|
||||
// Getting All HistoryItems
|
||||
@ -101,7 +105,7 @@ class DatabaseHandler extends SQLiteOpenHelper {
|
||||
itemList.add(item);
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
|
||||
cursor.close();
|
||||
// return item list
|
||||
return itemList;
|
||||
}
|
||||
@ -120,10 +124,10 @@ class DatabaseHandler extends SQLiteOpenHelper {
|
||||
}
|
||||
|
||||
// Deleting single item
|
||||
public void deleteHistoryItem(HistoryItem item) {
|
||||
public void deleteHistoryItem(String id) {
|
||||
SQLiteDatabase db = this.getWritableDatabase();
|
||||
db.delete(TABLE_HISTORY, KEY_ID + " = ?",
|
||||
new String[] { String.valueOf(item.getID()) });
|
||||
new String[] { String.valueOf(id) });
|
||||
db.close();
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package acr.browser.barebones;
|
||||
package acr.browser.barebones.databases;
|
||||
|
||||
class HistoryItem {
|
||||
public class HistoryItem {
|
||||
|
||||
|
||||
//private variables
|
@ -1,16 +1,13 @@
|
||||
package acr.browser.barebones;
|
||||
package acr.browser.barebones.databases;
|
||||
|
||||
import android.text.SpannableString;
|
||||
import android.text.Spanned;
|
||||
import android.text.TextUtils;
|
||||
import android.widget.MultiAutoCompleteTextView.Tokenizer;
|
||||
|
||||
public class SpaceTokenizer implements Tokenizer {
|
||||
|
||||
@Override
|
||||
public int findTokenEnd(CharSequence text, int cursor) {
|
||||
int i = cursor;
|
||||
int len = text.length();
|
||||
//int i = cursor;
|
||||
//int len = text.length();
|
||||
|
||||
/*while (i < len) {
|
||||
if (text.charAt(i) == ' ') {
|
||||
@ -20,7 +17,7 @@ public class SpaceTokenizer implements Tokenizer {
|
||||
}
|
||||
}
|
||||
*/
|
||||
return len;
|
||||
return text.length();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -39,7 +36,10 @@ public class SpaceTokenizer implements Tokenizer {
|
||||
|
||||
@Override
|
||||
public CharSequence terminateToken(CharSequence text) {
|
||||
int i = text.length();
|
||||
//int i = text.length();
|
||||
if(text.charAt(text.length()-1) != ' '){
|
||||
text = text + " ";
|
||||
}
|
||||
return text;
|
||||
/*while (i > 0 && text.charAt(i - 1) == ' ') {
|
||||
i--;
|
@ -1,23 +1,23 @@
|
||||
package acr.browser.barebones;
|
||||
package acr.browser.barebones.variables;
|
||||
|
||||
class BookmarkPage {
|
||||
public class BookmarkPageVariables {
|
||||
public static final String Heading = "<!DOCTYPE html><html xmlns=\"http://www.w3.org/1999/xhtml\">"
|
||||
+ "<head><meta content=\"en-us\" http-equiv=\"Content-Language\" /><meta content=\"text/html; charset=utf-8\" http-equiv=\"Content-Type\" />"
|
||||
+ "<title>Bookmarks</title></head><style>"
|
||||
+ "div.shadow{-moz-box-shadow: 0px 0px 6px #111;-webkit-box-shadow: 0px 0px 6px #111;box-shadow: 0px 0px 6px #111;}"
|
||||
+ "body{color: gray;}"
|
||||
+ "body{color: gray;text-size: 10px}"
|
||||
+ "div {vertical-align: middle;background-color: #ffffff;}"
|
||||
+ "div.clickable {position:relative;}"
|
||||
+ "p.font{font-size: xx-large;font-family: \"Lucida Console\"}"
|
||||
+ "p.font{font-size: 1em;font-family: \"Lucida Console\"}"
|
||||
+ "div.clickable a {position:absolute;width:100%;height:100%;top:0;left:0;text-decoration:none; z-index:10; background-color:white;opacity: 0; filter: alpha(opacity=1);}"
|
||||
+ "div.space {height: 10px;}"
|
||||
+ "p{padding-top: 3mm;padding-bottom: 3mm;padding-right: 2mm;padding-left: 2mm;}"
|
||||
+ "img{padding-left: 2mm;padding-right: 2mm;}"
|
||||
+ "div.space {height: 0.7em;}"
|
||||
+ "p{padding-top: 0.5em;padding-bottom: 0.5em;padding-right: 0.5em;padding-left: 0.5em;}"
|
||||
+ "img{padding-left: 0em;padding-right: 0.5em;}"
|
||||
+ "</style><body bgcolor = #f2f2f2>";
|
||||
public static final String Part1 = "<div class=\"clickable\">"
|
||||
+ "<div class=\"shadow\">" + "<p class=\"font\">" + "<a href=\"";
|
||||
public static final String Part2 = "\"></a>"+
|
||||
"<img height=\"25\" width=\"25\" src='http://getfavicon.appspot.com/";
|
||||
"<img height=\"15px\" width=\"15px\" src='https://www.google.com/s2/favicons?domain=";
|
||||
public static final String Part3 = "'/>";
|
||||
public static final String Part4 = "</p></div></div>";
|
||||
public static final String End = "</body></html>";
|
@ -1,21 +1,25 @@
|
||||
package acr.browser.barebones;
|
||||
package acr.browser.barebones.variables;
|
||||
|
||||
import android.os.Environment;
|
||||
|
||||
|
||||
class FinalVars {
|
||||
public class FinalVariables {
|
||||
|
||||
public static final int MAX_TABS = 5;
|
||||
public static final int MAX_BOOKMARKS = 5;
|
||||
public static final int MAX_BOOKMARKS = 50;
|
||||
public static final boolean PAID_VERSION = false;
|
||||
public static final String DESKTOP_USER_AGENT = "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/20 Safari/537.17";
|
||||
public static final String MOBILE_USER_AGENT = "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_0 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8A293 Safari/6531.22.7";
|
||||
public static final int API = android.os.Build.VERSION.SDK_INT;
|
||||
public static final String YAHOO_SEARCH = "search.yahoo.com/search?p=";
|
||||
public static final String YAHOO_SEARCH = "http://search.yahoo.com/search?p=";
|
||||
public static final String GOOGLE_SEARCH = "https://www.google.com/search?client=lightning&q=";
|
||||
public static final String BING_SEARCH = "www.bing.com/search?q=";
|
||||
public static final String BING_SEARCH = "http://www.bing.com/search?q=";
|
||||
public static final String DUCK_SEARCH = "https://duckduckgo.com/?t=lightning&q=";
|
||||
public static final String STARTPAGE_SEARCH = "https://startpage.com/do/metasearch.pl?language=english&cat=web&query=";
|
||||
public static final String HOMEPAGE = "https://www.google.com/";
|
||||
public static final String SETTINGS_INTENT = "android.intent.action.BAREBONESSETTINGS";
|
||||
public static final String SETTINGS_INTENT = "android.intent.action.SETTINGS";
|
||||
public static final String INCOGNITO_INTENT = "android.intent.action.BAREBONESINCOGNITO";
|
||||
public static final String DOWNLOAD_LOCATION = Environment.getExternalStorageDirectory().toString()+Environment.DIRECTORY_DOWNLOADS;
|
||||
|
||||
|
||||
|
@ -1,12 +1,13 @@
|
||||
package acr.browser.barebones;
|
||||
package acr.browser.barebones.variables;
|
||||
|
||||
public class HistoryPage {
|
||||
public class HistoryPageVariables {
|
||||
public static final String Heading = "<!DOCTYPE html><html xmlns=\"http://www.w3.org/1999/xhtml\">"
|
||||
+ "<head><meta content=\"en-us\" http-equiv=\"Content-Language\" /><meta content=\"text/html; charset=utf-8\" http-equiv=\"Content-Type\" /><title>History</title></head><style>"
|
||||
+ "div.shadow {-moz-box-shadow: 0px 0px 6px #111;-webkit-box-shadow: 0px 0px 6px #111;box-shadow: 0px 0px 6px #111;}"
|
||||
+ "body{color: gray;}div.space {height: 10px;} div.extra{text-align: center;}div {vertical-align: middle;}"
|
||||
+ "div {background-color: #ffffff;}div.clickable {position:relative;}p.black{color: black;font-size: x-large;font-family: \"Lucida Console\"}"
|
||||
+ "p.font{font-size: large;font-family: \"Lucida Console\"}p{padding-left: 1mm;padding-right: 1mm;padding-top: 1mm;padding-bottom: 1mm;}"
|
||||
+ "body{color: gray;text-size: 10px}div.space {height: 0.7em;} div.extra{text-align: center;}div {vertical-align: middle;}"
|
||||
+ "div {background-color: #ffffff;}div.clickable {position:relative;}p.black{color: black;font-size: 1em;font-family: \"Lucida Console\"}"
|
||||
+ "p.font{font-size: 1em;font-family: \"Lucida Console\"}p.black{padding-left: 0.5em;padding-right: 0.5em;padding-top: 0.5em;padding-bottom: 0em;}"
|
||||
+ "p.font{padding-left: 0.5em;padding-right: 0.5em;padding-top: 0em;padding-bottom: 0.5em;}"
|
||||
+ "div.clickable a {position:absolute; width:100%;height:100%;top:0;left:0;text-decoration:none; z-index:10; background-color:white;opacity: 0;filter: alpha(opacity=1);}"
|
||||
+ "</style><body bgcolor = #f2f2f2>";
|
||||
|
174
src/acr/browser/barebones/variables/Utils.java
Normal file
174
src/acr/browser/barebones/variables/Utils.java
Normal file
@ -0,0 +1,174 @@
|
||||
package acr.browser.barebones.variables;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
|
||||
import acr.browser.barebones.databases.DatabaseHandler;
|
||||
import acr.browser.barebones.databases.HistoryItem;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.DownloadManager;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.database.Cursor;
|
||||
import android.database.DatabaseUtils;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.database.sqlite.SQLiteException;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Environment;
|
||||
import android.provider.Browser;
|
||||
import android.util.Log;
|
||||
import android.webkit.URLUtil;
|
||||
import android.widget.Toast;
|
||||
|
||||
public class Utils {
|
||||
public static void createInformativeDialog(Context context, String title,
|
||||
String message) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||
builder.setTitle(title);
|
||||
builder.setMessage(message)
|
||||
.setCancelable(true)
|
||||
.setPositiveButton("Ok",
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
}
|
||||
});
|
||||
AlertDialog alert = builder.create();
|
||||
alert.show();
|
||||
}
|
||||
|
||||
public static void addBookmark(Context context, String title, String url) {
|
||||
File book = new File(context.getFilesDir(), "bookmarks");
|
||||
File bookUrl = new File(context.getFilesDir(), "bookurl");
|
||||
try {
|
||||
BufferedReader readUrlRead = new BufferedReader(new FileReader(
|
||||
bookUrl));
|
||||
String u;
|
||||
int n = 0;
|
||||
while ((u = readUrlRead.readLine()) != null
|
||||
&& n < FinalVariables.MAX_BOOKMARKS) {
|
||||
if (u.contentEquals(url)) {
|
||||
readUrlRead.close();
|
||||
return;
|
||||
}
|
||||
n++;
|
||||
}
|
||||
readUrlRead.close();
|
||||
|
||||
} catch (FileNotFoundException ignored) {
|
||||
} catch (IOException ignored) {
|
||||
} catch (NullPointerException ignored) {
|
||||
}
|
||||
try {
|
||||
BufferedWriter bookWriter = new BufferedWriter(new FileWriter(book,
|
||||
true));
|
||||
BufferedWriter urlWriter = new BufferedWriter(new FileWriter(
|
||||
bookUrl, true));
|
||||
bookWriter.write(title);
|
||||
urlWriter.write(url);
|
||||
bookWriter.newLine();
|
||||
urlWriter.newLine();
|
||||
bookWriter.close();
|
||||
urlWriter.close();
|
||||
} catch (FileNotFoundException ignored) {
|
||||
} catch (IOException ignored) {
|
||||
} catch (NullPointerException ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
public static void updateHistory(final Context context,
|
||||
final ContentResolver content, final boolean noStockBrowser,
|
||||
final String url, final String title) {
|
||||
Runnable update = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!noStockBrowser) {
|
||||
try {
|
||||
Browser.updateVisitedHistory(content, url, true);
|
||||
} catch (NullPointerException ignored) {
|
||||
}
|
||||
}
|
||||
try {
|
||||
StringBuilder sb = new StringBuilder("url" + " = ");
|
||||
DatabaseUtils.appendEscapedSQLString(sb, url);
|
||||
DatabaseHandler historyHandler = new DatabaseHandler(
|
||||
context);
|
||||
SQLiteDatabase history = historyHandler.getReadableDatabase();
|
||||
Cursor cursor = history.query("history", new String[] { "id",
|
||||
"url", "title" }, sb.toString(), null, null, null,
|
||||
null);
|
||||
if (!cursor.moveToFirst()) {
|
||||
historyHandler.addHistoryItem(new HistoryItem(url,
|
||||
title));
|
||||
} else {
|
||||
historyHandler.delete(url);
|
||||
historyHandler.addHistoryItem(new HistoryItem(url,
|
||||
title));
|
||||
}
|
||||
historyHandler.close();
|
||||
cursor.close();
|
||||
history.close();
|
||||
} catch (IllegalStateException e) {
|
||||
Log.e("Barebones", "IllegalStateException in updateHistory");
|
||||
} catch (NullPointerException e) {
|
||||
Log.e("Barebones", "NullPointerException in updateHistory");
|
||||
} catch (SQLiteException e) {
|
||||
Log.e("Barebones", "SQLiteException in updateHistory");
|
||||
}
|
||||
}
|
||||
};
|
||||
if (url != null) {
|
||||
if (!url.startsWith("file://")) {
|
||||
new Thread(update).start();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.GINGERBREAD)
|
||||
public static void downloadFile(final Context context, final String url, final String contentDisposition, final String mimetype){
|
||||
try {
|
||||
Thread downloader = new Thread(new Runnable() {
|
||||
@SuppressLint("InlinedApi")
|
||||
@Override
|
||||
public void run() {
|
||||
DownloadManager download = (DownloadManager) context.getSystemService(Context.DOWNLOAD_SERVICE);
|
||||
Uri nice = Uri.parse(url);
|
||||
DownloadManager.Request it = new DownloadManager.Request(
|
||||
nice);
|
||||
String fileName = URLUtil.guessFileName(url,
|
||||
contentDisposition, mimetype);
|
||||
if (FinalVariables.API >= 11) {
|
||||
it.allowScanningByMediaScanner();
|
||||
it.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
|
||||
}
|
||||
|
||||
it.setDestinationInExternalPublicDir(
|
||||
Environment.DIRECTORY_DOWNLOADS, fileName);
|
||||
Log.i("Barebones", "Downloading" + fileName);
|
||||
download.enqueue(it);
|
||||
}
|
||||
});
|
||||
downloader.run();
|
||||
} catch (NullPointerException e) {
|
||||
Log.e("Barebones", "Problem downloading");
|
||||
Toast.makeText(context, "Error Downloading File",
|
||||
Toast.LENGTH_SHORT).show();
|
||||
} catch (IllegalArgumentException e) {
|
||||
Log.e("Barebones", "Problem downloading");
|
||||
Toast.makeText(context, "Error Downloading File",
|
||||
Toast.LENGTH_SHORT).show();
|
||||
} catch (SecurityException ignored) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user