|
|
@ -190,8 +190,13 @@ public class BrowserActivity extends Activity implements BrowserController { |
|
|
|
mDrawer = (RelativeLayout) findViewById(R.id.drawer); |
|
|
|
mDrawer = (RelativeLayout) findViewById(R.id.drawer); |
|
|
|
mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); |
|
|
|
mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); |
|
|
|
mDrawerList = (ListView) findViewById(R.id.left_drawer); |
|
|
|
mDrawerList = (ListView) findViewById(R.id.left_drawer); |
|
|
|
|
|
|
|
mDrawerList.setDivider(null); |
|
|
|
|
|
|
|
mDrawerList.setDividerHeight(0); |
|
|
|
mDrawerRight = (LinearLayout) findViewById(R.id.right_drawer); |
|
|
|
mDrawerRight = (LinearLayout) findViewById(R.id.right_drawer); |
|
|
|
mDrawerListRight = (ListView) findViewById(R.id.right_drawer_list); |
|
|
|
mDrawerListRight = (ListView) findViewById(R.id.right_drawer_list); |
|
|
|
|
|
|
|
mDrawerListRight.setDivider(null); |
|
|
|
|
|
|
|
mDrawerListRight.setDividerHeight(0); |
|
|
|
|
|
|
|
setNavigationDrawerWidth(); |
|
|
|
mWebpageBitmap = BitmapFactory.decodeResource(getResources(), |
|
|
|
mWebpageBitmap = BitmapFactory.decodeResource(getResources(), |
|
|
|
R.drawable.ic_webpage); |
|
|
|
R.drawable.ic_webpage); |
|
|
|
mActionBar = getActionBar(); |
|
|
|
mActionBar = getActionBar(); |
|
|
@ -437,8 +442,10 @@ public class BrowserActivity extends Activity implements BrowserController { |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
mDrawerLayout.setDrawerListener(mDrawerToggle); |
|
|
|
mDrawerLayout.setDrawerListener(mDrawerToggle); |
|
|
|
mDrawerLayout.setDrawerShadow(R.drawable.drawer_right_shadow, GravityCompat.END); |
|
|
|
mDrawerLayout.setDrawerShadow(R.drawable.drawer_right_shadow, |
|
|
|
mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START); |
|
|
|
GravityCompat.END); |
|
|
|
|
|
|
|
mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, |
|
|
|
|
|
|
|
GravityCompat.START); |
|
|
|
initializePreferences(); |
|
|
|
initializePreferences(); |
|
|
|
initializeTabs(); |
|
|
|
initializeTabs(); |
|
|
|
|
|
|
|
|
|
|
@ -527,6 +534,30 @@ public class BrowserActivity extends Activity implements BrowserController { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void setNavigationDrawerWidth() { |
|
|
|
|
|
|
|
int width = getResources().getDisplayMetrics().widthPixels * 4 / 5; |
|
|
|
|
|
|
|
int maxWidth = Utils.convertToDensityPixels(mContext, 300); |
|
|
|
|
|
|
|
if (width > maxWidth) { |
|
|
|
|
|
|
|
DrawerLayout.LayoutParams params = (android.support.v4.widget.DrawerLayout.LayoutParams) mDrawer |
|
|
|
|
|
|
|
.getLayoutParams(); |
|
|
|
|
|
|
|
params.width = maxWidth; |
|
|
|
|
|
|
|
mDrawer.setLayoutParams(params); |
|
|
|
|
|
|
|
DrawerLayout.LayoutParams paramsRight = (android.support.v4.widget.DrawerLayout.LayoutParams) mDrawerRight |
|
|
|
|
|
|
|
.getLayoutParams(); |
|
|
|
|
|
|
|
paramsRight.width = maxWidth; |
|
|
|
|
|
|
|
mDrawerRight.setLayoutParams(paramsRight); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
DrawerLayout.LayoutParams params = (android.support.v4.widget.DrawerLayout.LayoutParams) mDrawer |
|
|
|
|
|
|
|
.getLayoutParams(); |
|
|
|
|
|
|
|
params.width = width; |
|
|
|
|
|
|
|
mDrawer.setLayoutParams(params); |
|
|
|
|
|
|
|
DrawerLayout.LayoutParams paramsRight = (android.support.v4.widget.DrawerLayout.LayoutParams) mDrawerRight |
|
|
|
|
|
|
|
.getLayoutParams(); |
|
|
|
|
|
|
|
paramsRight.width = width; |
|
|
|
|
|
|
|
mDrawerRight.setLayoutParams(paramsRight); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
/* |
|
|
|
* Override this class |
|
|
|
* Override this class |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -669,6 +700,13 @@ public class BrowserActivity extends Activity implements BrowserController { |
|
|
|
// The action bar home/up action should open or close the drawer.
|
|
|
|
// The action bar home/up action should open or close the drawer.
|
|
|
|
// ActionBarDrawerToggle will take care of this.
|
|
|
|
// ActionBarDrawerToggle will take care of this.
|
|
|
|
if (mDrawerToggle.onOptionsItemSelected(item)) { |
|
|
|
if (mDrawerToggle.onOptionsItemSelected(item)) { |
|
|
|
|
|
|
|
if (mDrawerLayout.isDrawerOpen(mDrawerRight)) { |
|
|
|
|
|
|
|
mDrawerLayout.closeDrawer(mDrawerRight); |
|
|
|
|
|
|
|
mDrawerLayout.openDrawer(mDrawer); |
|
|
|
|
|
|
|
} else if (mDrawerLayout.isDrawerOpen(mDrawer)) { |
|
|
|
|
|
|
|
mDrawerLayout.closeDrawer(mDrawer); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
mDrawerToggle.syncState(); |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
// Handle action buttons
|
|
|
|
// Handle action buttons
|
|
|
@ -1094,14 +1132,16 @@ public class BrowserActivity extends Activity implements BrowserController { |
|
|
|
Log.i(Constants.LOGTAG, "Cache Cleared"); |
|
|
|
Log.i(Constants.LOGTAG, "Cache Cleared"); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
if (mPreferences.getBoolean(PreferenceConstants.CLEAR_HISTORY_EXIT, |
|
|
|
if (mPreferences.getBoolean( |
|
|
|
false) && !isIncognito()) { |
|
|
|
PreferenceConstants.CLEAR_HISTORY_EXIT, false) |
|
|
|
|
|
|
|
&& !isIncognito()) { |
|
|
|
clearHistory(); |
|
|
|
clearHistory(); |
|
|
|
Log.i(Constants.LOGTAG, "History Cleared"); |
|
|
|
Log.i(Constants.LOGTAG, "History Cleared"); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
if (mPreferences.getBoolean(PreferenceConstants.CLEAR_COOKIES_EXIT, |
|
|
|
if (mPreferences.getBoolean( |
|
|
|
false) && !isIncognito()) { |
|
|
|
PreferenceConstants.CLEAR_COOKIES_EXIT, false) |
|
|
|
|
|
|
|
&& !isIncognito()) { |
|
|
|
clearCookies(); |
|
|
|
clearCookies(); |
|
|
|
Log.i(Constants.LOGTAG, "Cookies Cleared"); |
|
|
|
Log.i(Constants.LOGTAG, "Cookies Cleared"); |
|
|
|
|
|
|
|
|
|
|
@ -1163,8 +1203,7 @@ public class BrowserActivity extends Activity implements BrowserController { |
|
|
|
|
|
|
|
|
|
|
|
public void clearHistory() { |
|
|
|
public void clearHistory() { |
|
|
|
this.deleteDatabase(DatabaseHandler.DATABASE_NAME); |
|
|
|
this.deleteDatabase(DatabaseHandler.DATABASE_NAME); |
|
|
|
WebViewDatabase m = WebViewDatabase |
|
|
|
WebViewDatabase m = WebViewDatabase.getInstance(this); |
|
|
|
.getInstance(this); |
|
|
|
|
|
|
|
m.clearFormData(); |
|
|
|
m.clearFormData(); |
|
|
|
m.clearHttpAuthUsernamePassword(); |
|
|
|
m.clearHttpAuthUsernamePassword(); |
|
|
|
if (API < 18) { |
|
|
|
if (API < 18) { |
|
|
@ -1915,6 +1954,10 @@ public class BrowserActivity extends Activity implements BrowserController { |
|
|
|
mDrawerLayout.openDrawer(mDrawerRight); |
|
|
|
mDrawerLayout.openDrawer(mDrawerRight); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void closeDrawers() { |
|
|
|
|
|
|
|
mDrawerLayout.closeDrawers(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
/** |
|
|
|
/** |
|
|
|
* open the HTML bookmarks page, parameter view is the WebView that should show the page |
|
|
|
* open the HTML bookmarks page, parameter view is the WebView that should show the page |
|
|
|