Browse Source

Added option to disable history sync with Google

master
Anthony Restaino 10 years ago
parent
commit
ff56ca1d31
  1. 168
      res/layout/advanced_settings.xml
  2. 1
      res/values/strings.xml
  3. 35
      src/acr/browser/lightning/AdvancedSettingsActivity.java
  4. 20
      src/acr/browser/lightning/BrowserActivity.java
  5. 3
      src/acr/browser/lightning/PreferenceConstants.java

168
res/layout/advanced_settings.xml

@ -13,11 +13,11 @@ @@ -13,11 +13,11 @@
android:id="@+id/r1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:attr/listChoiceBackgroundIndicator"
android:minHeight="60dp"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:background="?android:attr/listChoiceBackgroundIndicator"
android:paddingRight="10dp" >
android:paddingRight="10dp"
android:paddingTop="10dp" >
<LinearLayout
android:layout_width="wrap_content"
@ -65,11 +65,11 @@ @@ -65,11 +65,11 @@
android:id="@+id/r2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:attr/listChoiceBackgroundIndicator"
android:minHeight="60dp"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:background="?android:attr/listChoiceBackgroundIndicator"
android:paddingRight="10dp" >
android:paddingRight="10dp"
android:paddingTop="10dp" >
<TextView
android:id="@+id/textView3"
@ -96,16 +96,16 @@ @@ -96,16 +96,16 @@
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#cdcdcd" />
<RelativeLayout
android:id="@+id/rClearHistoryExit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:attr/listChoiceBackgroundIndicator"
android:minHeight="60dp"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:background="?android:attr/listChoiceBackgroundIndicator"
android:paddingRight="10dp" >
android:paddingRight="10dp"
android:paddingTop="10dp" >
<TextView
android:layout_width="wrap_content"
@ -131,16 +131,16 @@ @@ -131,16 +131,16 @@
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#cdcdcd" />
<RelativeLayout
android:id="@+id/rClearCookiesExit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:attr/listChoiceBackgroundIndicator"
android:minHeight="60dp"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:background="?android:attr/listChoiceBackgroundIndicator"
android:paddingRight="10dp" >
android:paddingRight="10dp"
android:paddingTop="10dp" >
<TextView
android:layout_width="wrap_content"
@ -171,11 +171,11 @@ @@ -171,11 +171,11 @@
android:id="@+id/r3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:attr/listChoiceBackgroundIndicator"
android:minHeight="60dp"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:background="?android:attr/listChoiceBackgroundIndicator"
android:paddingRight="10dp" >
android:paddingRight="10dp"
android:paddingTop="10dp" >
<LinearLayout
android:layout_width="wrap_content"
@ -223,11 +223,11 @@ @@ -223,11 +223,11 @@
android:id="@+id/r4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:attr/listChoiceBackgroundIndicator"
android:minHeight="60dp"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:background="?android:attr/listChoiceBackgroundIndicator"
android:paddingRight="10dp" >
android:paddingRight="10dp"
android:paddingTop="10dp" >
<TextView
android:id="@+id/textView5"
@ -258,11 +258,11 @@ @@ -258,11 +258,11 @@
android:id="@+id/r5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:attr/listChoiceBackgroundIndicator"
android:minHeight="60dp"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:background="?android:attr/listChoiceBackgroundIndicator"
android:paddingRight="10dp" >
android:paddingRight="10dp"
android:paddingTop="10dp" >
<TextView
android:id="@+id/textView6"
@ -294,11 +294,11 @@ @@ -294,11 +294,11 @@
android:id="@+id/r6"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:attr/listChoiceBackgroundIndicator"
android:minHeight="60dp"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:background="?android:attr/listChoiceBackgroundIndicator"
android:paddingRight="10dp" >
android:paddingRight="10dp"
android:paddingTop="10dp" >
<LinearLayout
android:layout_width="wrap_content"
@ -345,11 +345,11 @@ @@ -345,11 +345,11 @@
android:id="@+id/r7"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:attr/listChoiceBackgroundIndicator"
android:minHeight="60dp"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:background="?android:attr/listChoiceBackgroundIndicator"
android:paddingRight="10dp" >
android:paddingRight="10dp"
android:paddingTop="10dp" >
<LinearLayout
android:layout_width="wrap_content"
@ -396,11 +396,11 @@ @@ -396,11 +396,11 @@
android:id="@+id/rIncognitoCookies"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:attr/listChoiceBackgroundIndicator"
android:minHeight="60dp"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:background="?android:attr/listChoiceBackgroundIndicator"
android:paddingRight="10dp" >
android:paddingRight="10dp"
android:paddingTop="10dp" >
<LinearLayout
android:layout_width="wrap_content"
@ -437,11 +437,11 @@ @@ -437,11 +437,11 @@
android:id="@+id/r11"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:attr/listChoiceBackgroundIndicator"
android:minHeight="60dp"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:background="?android:attr/listChoiceBackgroundIndicator"
android:paddingRight="10dp" >
android:paddingRight="10dp"
android:paddingTop="10dp" >
<LinearLayout
android:layout_width="wrap_content"
@ -488,11 +488,11 @@ @@ -488,11 +488,11 @@
android:id="@+id/r12"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:attr/listChoiceBackgroundIndicator"
android:minHeight="60dp"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:background="?android:attr/listChoiceBackgroundIndicator"
android:paddingRight="10dp" >
android:paddingRight="10dp"
android:paddingTop="10dp" >
<LinearLayout
android:layout_width="wrap_content"
@ -539,11 +539,11 @@ @@ -539,11 +539,11 @@
android:id="@+id/r13"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:attr/listChoiceBackgroundIndicator"
android:minHeight="60dp"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:background="?android:attr/listChoiceBackgroundIndicator"
android:paddingRight="10dp" >
android:paddingRight="10dp"
android:paddingTop="10dp" >
<TextView
android:layout_width="wrap_content"
@ -574,11 +574,11 @@ @@ -574,11 +574,11 @@
android:id="@+id/r14"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:attr/listChoiceBackgroundIndicator"
android:minHeight="60dp"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:background="?android:attr/listChoiceBackgroundIndicator"
android:paddingRight="10dp" >
android:paddingRight="10dp"
android:paddingTop="10dp" >
<TextView
android:layout_width="wrap_content"
@ -609,11 +609,11 @@ @@ -609,11 +609,11 @@
android:id="@+id/rGoogleSuggestions"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:attr/listChoiceBackgroundIndicator"
android:minHeight="60dp"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:background="?android:attr/listChoiceBackgroundIndicator"
android:paddingRight="10dp" >
android:paddingRight="10dp"
android:paddingTop="10dp" >
<LinearLayout
android:layout_width="wrap_content"
@ -648,6 +648,56 @@ @@ -648,6 +648,56 @@
android:layout_centerVertical="true" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#cdcdcd" />
<RelativeLayout
android:id="@+id/rBrowserHistory"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:attr/listChoiceBackgroundIndicator"
android:minHeight="60dp"
android:paddingBottom="10dp"
android:paddingRight="10dp"
android:paddingTop="10dp" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:orientation="vertical" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingRight="30dp"
android:text="@string/sync_history"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="@+id/isBrowserAvailable"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:text="text"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/light" />
</LinearLayout>
<CheckBox
android:id="@+id/cbBrowserHistory"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="1dp"
@ -659,10 +709,10 @@ @@ -659,10 +709,10 @@
android:id="@+id/rClearCache"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:attr/listChoiceBackgroundIndicator"
android:minHeight="60dp"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:background="?android:attr/listChoiceBackgroundIndicator" >
android:paddingTop="10dp" >
<TextView
android:layout_width="wrap_content"
@ -682,13 +732,13 @@ @@ -682,13 +732,13 @@
android:background="#cdcdcd" />
<RelativeLayout
android:id="@+id/r8"
android:id="@+id/rClearHistory"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:attr/listChoiceBackgroundIndicator"
android:minHeight="60dp"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:background="?android:attr/listChoiceBackgroundIndicator" >
android:paddingTop="10dp" >
<TextView
android:layout_width="wrap_content"
@ -711,10 +761,10 @@ @@ -711,10 +761,10 @@
android:id="@+id/r15"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:attr/listChoiceBackgroundIndicator"
android:minHeight="60dp"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:background="?android:attr/listChoiceBackgroundIndicator" >
android:paddingTop="10dp" >
<TextView
android:layout_width="wrap_content"
@ -737,10 +787,10 @@ @@ -737,10 +787,10 @@
android:id="@+id/r9"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:attr/listChoiceBackgroundIndicator"
android:minHeight="60dp"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:background="?android:attr/listChoiceBackgroundIndicator" >
android:paddingTop="10dp" >
<LinearLayout
android:layout_width="wrap_content"
@ -778,10 +828,10 @@ @@ -778,10 +828,10 @@
android:id="@+id/r10"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:attr/listChoiceBackgroundIndicator"
android:minHeight="60dp"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:background="?android:attr/listChoiceBackgroundIndicator" >
android:paddingTop="10dp" >
<TextView
android:layout_width="wrap_content"
@ -794,4 +844,4 @@ @@ -794,4 +844,4 @@
</RelativeLayout>
</LinearLayout>
</ScrollView>
</ScrollView>

1
res/values/strings.xml

@ -178,4 +178,5 @@ @@ -178,4 +178,5 @@
<string name="name_grayscale">Grayscale</string>
<string name="name_inverted_grayscale">Inverted Grayscale</string>
<string name="name_normal">Normal</string>
<string name="sync_history">Sync history with Google</string>
</resources>

35
src/acr/browser/lightning/AdvancedSettingsActivity.java

@ -29,18 +29,12 @@ public class AdvancedSettingsActivity extends Activity { @@ -29,18 +29,12 @@ public class AdvancedSettingsActivity extends Activity {
// mPreferences variables
private static final int API = android.os.Build.VERSION.SDK_INT;
private SharedPreferences mPreferences;
private SharedPreferences.Editor mEditPrefs;
private CheckBox cb1, cb2, cb3, cb4, cb5, cb6, cb7, cb8, cb9, cb10, cb11, cbIncognitoCookies,
cbSearchSuggestions, cbClearHistoryExit, cbClearCookiesExit;
private Context mContext;
private boolean mSystemBrowser;
private Handler messageHandler;
@Override
@ -88,7 +82,7 @@ public class AdvancedSettingsActivity extends Activity { @@ -88,7 +82,7 @@ public class AdvancedSettingsActivity extends Activity {
r5 = (RelativeLayout) findViewById(R.id.r5);
r6 = (RelativeLayout) findViewById(R.id.r6);
r7 = (RelativeLayout) findViewById(R.id.r7);
r8 = (RelativeLayout) findViewById(R.id.r8);
r8 = (RelativeLayout) findViewById(R.id.rClearHistory);
r9 = (RelativeLayout) findViewById(R.id.r9);
r10 = (RelativeLayout) findViewById(R.id.r10);
r11 = (RelativeLayout) findViewById(R.id.r11);
@ -178,11 +172,38 @@ public class AdvancedSettingsActivity extends Activity { @@ -178,11 +172,38 @@ public class AdvancedSettingsActivity extends Activity {
cbSearchSuggestions(cbSearchSuggestions);
TextView importBookmarks = (TextView) findViewById(R.id.isImportAvailable);
TextView syncHistory = (TextView) findViewById(R.id.isBrowserAvailable);
RelativeLayout layoutSyncHistory = (RelativeLayout) findViewById(R.id.rBrowserHistory);
final CheckBox cbSyncHistory = (CheckBox) findViewById(R.id.cbBrowserHistory);
layoutSyncHistory.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
cbSyncHistory.setChecked(!cbSyncHistory.isChecked());
}
});
cbSyncHistory.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
mEditPrefs.putBoolean(PreferenceConstants.SYNC_HISTORY, isChecked).apply();
}
});
if (!mSystemBrowser) {
cbSyncHistory.setChecked(false);
cbSyncHistory.setEnabled(false);
importBookmarks.setText(getResources().getString(R.string.stock_browser_unavailable));
syncHistory.setText(getResources().getString(R.string.stock_browser_unavailable));
} else {
cbSyncHistory.setEnabled(true);
cbSyncHistory.setChecked(mPreferences
.getBoolean(PreferenceConstants.SYNC_HISTORY, true));
importBookmarks.setText(getResources().getString(R.string.stock_browser_available));
syncHistory.setText(getResources().getString(R.string.stock_browser_available));
}
messageHandler = new MessageHandler(mContext);

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

@ -394,7 +394,7 @@ public class BrowserActivity extends Activity implements BrowserController { @@ -394,7 +394,7 @@ public class BrowserActivity extends Activity implements BrowserController {
}
});
mNewTab.setOnLongClickListener(new OnLongClickListener() {
@Override
@ -1734,7 +1734,8 @@ public class BrowserActivity extends Activity implements BrowserController { @@ -1734,7 +1734,8 @@ public class BrowserActivity extends Activity implements BrowserController {
Runnable update = new Runnable() {
@Override
public void run() {
if (isSystemBrowserAvailable()) {
if (isSystemBrowserAvailable()
&& mPreferences.getBoolean(PreferenceConstants.SYNC_HISTORY, true)) {
try {
Browser.updateVisitedHistory(getContentResolver(), url, true);
} catch (NullPointerException ignored) {
@ -1775,26 +1776,15 @@ public class BrowserActivity extends Activity implements BrowserController { @@ -1775,26 +1776,15 @@ public class BrowserActivity extends Activity implements BrowserController {
}
}
};
if (url != null) {
if (!url.startsWith(Constants.FILE)) {
new Thread(update).start();
}
if (url != null && !url.startsWith(Constants.FILE)) {
new Thread(update).start();
}
}
/**
* 1, 2, 3, testing... is there a system browser that has some nice
* bookmarks for us?
*/
public boolean isSystemBrowserAvailable() {
return mSystemBrowser;
}
/**
* 1, 2, 3, testing... is there a system browser that has some nice
* bookmarks for us? helper method for isSystemBrowserAvailable
*/
public boolean getSystemBrowser() {
Cursor c = null;
String[] columns = new String[] { "url", "title" };

3
src/acr/browser/lightning/PreferenceConstants.java

@ -39,7 +39,8 @@ public final class PreferenceConstants { @@ -39,7 +39,8 @@ public final class PreferenceConstants {
public static final String CLEAR_COOKIES_EXIT = "clearCookiesExit";
public static final String SAVE_URL = "saveUrl";
public static final String RENDERING_MODE = "renderMode";
public static final String SYNC_HISTORY = "syncHistory";
public static final String USE_PROXY = "useProxy";
public static final String USE_PROXY_HOST = "useProxyHost";
public static final String USE_PROXY_PORT = "useProxyPort";

Loading…
Cancel
Save