Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified app/libs/WebViewCREA-legacy20-release.aar
Binary file not shown.
Binary file modified app/libs/WebViewCREA-standard-release.aar
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import android.text.format.DateFormat;
import android.view.LayoutInflater;
import android.view.View;
import android.view.Window;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
Expand All @@ -33,9 +34,13 @@ public class HistoryActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if(Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD){
requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
}
setContentView(R.layout.layout_history);

if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD) {
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.top_bar);
this.actionBarIcon = (ImageView) findViewById(R.id.top_bar_icon);
TextView actionBarTitle = (TextView) findViewById(R.id.top_bar_title);
if (actionBarTitle != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import android.util.TypedValue;
import android.view.View;
import android.view.Menu;
import android.view.Window;
import android.view.MenuItem;
import android.security.KeyChain;
import android.security.KeyChainAliasCallback;
Expand Down Expand Up @@ -101,9 +102,10 @@ protected void onCreate(Bundle savedInstanceState){
this.viewcodeExt = AssetUtils.readAssetAsString(getAssets(), "viewcodeExt.js");

if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD){
this.actionBarTitle = (TextView) findViewById(R.id.top_bar_title);
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.top_bar);
this.actionBar = (RelativeLayout) findViewById(R.id.top_bar_layout);
originalXmlBackground = actionBar.getBackground();
this.actionBarTitle = (TextView) findViewById(R.id.top_bar_title);
this.actionBarIcon = (ImageView) findViewById(R.id.top_bar_icon);
WebIconDatabase.getInstance().open(getDir("icons", MODE_PRIVATE).getPath());

Expand Down Expand Up @@ -172,14 +174,34 @@ public boolean shouldOverrideUrlLoading(WebView view, String url) {
@Override
public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {
String url = request.getUrl().toString();
if (url != null && url.startsWith(SCHEME_COLOR_PREFIX)) {
applyDynamicColor(url.substring(SCHEME_COLOR_PREFIX.length()));
return true;
}
if(url != null && url.startsWith(SCHEME_MARKS_PREFIX)){
Intent intent = new Intent(MainActivity.this, MarksActivity.class);
startActivity(intent);
return true;
if(url != null && !TextUtils.isEmpty(url)){
if (url.startsWith(SCHEME_COLOR_PREFIX)) {
applyDynamicColor(url.substring(SCHEME_COLOR_PREFIX.length()));
return true;
}else if(url.startsWith(SCHEME_MARKS_PREFIX)){
Intent intent = new Intent(MainActivity.this, MarksActivity.class);
startActivity(intent);
return true;
}else if(url.startsWith(SCHEME_HISTORY_PREFIX)){
Intent intent = new Intent(MainActivity.this, HistoryActivity.class);
startActivity(intent);
return true;
}else if(url.startsWith(SCHEME_SEARCH_PREFIX)){
String query = url.substring(SCHEME_SEARCH_PREFIX.length());
if(TextUtils.isEmpty(query)){
return true;
}
int selectedPos = SearchEngineManager.getSelectedEngineIndex(MainActivity.this);
List<SearchEngineManager.Engine> engines = SearchEngineManager.getEngines(MainActivity.this);
SearchEngineManager.Engine selectedEngine = engines.get(selectedPos);
try {
String searchUrl = String.format(selectedEngine.searchUrl, query);
creaClient.loadUrl(webView, searchUrl);
} catch (Exception e) {
creaClient.loadUrl(webView, selectedEngine.searchUrl.replace("%s", query));
}
return true;
}
}
if (openInExternalAppIfPossible(url)) {
return true;
Expand All @@ -189,6 +211,14 @@ public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request

@Override
public void onPageStarted(WebView view, String url, Bitmap favicon){
uniShowProgress();
}
@Override
public void onPatchStarted(WebView view, String url){
uniShowProgress();
}

private void uniShowProgress(){
progressBar.setVisibility(View.VISIBLE);
progressBar.bringToFront();
}
Expand Down Expand Up @@ -260,7 +290,7 @@ public void alias(String alias) {
}
};

creaClient.setWebChromeClient(webView, new WebChromeClient(){
webView.setWebChromeClient(new WebChromeClient(){
@Override
public void onReceivedTitle(WebView view, String title) {
super.onReceivedTitle(view, title);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.ListView;
Expand All @@ -27,8 +28,12 @@ public class MarksActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
if(Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD){
requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
}
setContentView(R.layout.layout_marks);
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD){
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.top_bar);
this.actionBarIcon = (ImageView) findViewById(R.id.top_bar_icon);
TextView actionBarTitle = (TextView) findViewById(R.id.top_bar_title);
actionBarTitle.setText(R.string.marks);
Expand Down
5 changes: 0 additions & 5 deletions app/src/main/res/layout-v8/layout_history.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@
android:orientation="vertical">


<include
android:id="@+id/top_bar_container"
layout="@layout/top_bar" />


<Button
android:id="@+id/btnClearHistory"
android:layout_width="match_parent"
Expand Down
3 changes: 0 additions & 3 deletions app/src/main/res/layout-v8/layout_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<include
android:id="@+id/top_bar_container"
layout="@layout/top_bar" />
<WebView
android:id="@+id/webview"
android:layout_width="match_parent"
Expand Down
3 changes: 0 additions & 3 deletions app/src/main/res/layout-v8/layout_marks.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<include
android:id="@+id/top_bar_container"
layout="@layout/top_bar" />
<ListView
android:id="@+id/listViewMarks"
android:layout_width="match_parent"
Expand Down
29 changes: 29 additions & 0 deletions app/src/main/res/layout-v8/top_bar.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/top_bar_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#000000">

<ImageView
android:id="@+id/top_bar_icon"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_centerVertical="true"
android:layout_marginLeft="8dp"
android:scaleType="fitCenter"
android:src="@drawable/ic_launcher" />

<TextView
android:id="@+id/top_bar_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="8dp"
android:text="@string/app_name"
android:textColor="#FFFFFF"
android:textSize="16sp"
android:textStyle="bold"
android:singleLine="true"
android:ellipsize="end" />
</RelativeLayout>
4 changes: 0 additions & 4 deletions app/src/main/res/layout/layout_history.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@
android:layout_height="fill_parent"
android:orientation="vertical">

<include
android:id="@+id/top_bar_container"
layout="@layout/top_bar" />

<Button
android:id="@+id/btnClearHistory"
android:layout_width="fill_parent"
Expand Down
3 changes: 0 additions & 3 deletions app/src/main/res/layout/layout_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<include
android:id="@+id/top_bar_container"
layout="@layout/top_bar" />
<WebView
android:id="@+id/webview"
android:layout_width="fill_parent"
Expand Down
3 changes: 0 additions & 3 deletions app/src/main/res/layout/layout_marks.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<include
android:id="@+id/top_bar_container"
layout="@layout/top_bar" />
<ListView
android:id="@+id/listViewMarks"
android:layout_width="fill_parent"
Expand Down
32 changes: 28 additions & 4 deletions app/src/main/res/layout/top_bar.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<View xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="0dp"
android:layout_height="0dp"
android:visibility="gone" />
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/top_bar_layout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#000000">

<ImageView
android:id="@+id/top_bar_icon"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_centerVertical="true"
android:layout_marginLeft="8dp"
android:scaleType="fitCenter"
android:src="@drawable/ic_launcher" />

<TextView
android:id="@+id/top_bar_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="8dp"
android:text="@string/app_name"
android:textColor="#FFFFFF"
android:textSize="16sp"
android:textStyle="bold"
android:singleLine="true"
android:ellipsize="end" />
</RelativeLayout>
5 changes: 4 additions & 1 deletion app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppTheme" parent="android:Theme.Black"></style>
<style name="AppTheme" parent="android:Theme.Black">
<item name="android:windowTitleSize">48dp</item>
<item name="android:windowTitleBackgroundStyle">@null</item>
</style>
</resources>