Skip to content

Commit 3fe4dd0

Browse files
committed
shortcut
1 parent b13eec4 commit 3fe4dd0

34 files changed

+1566
-348
lines changed

android/jni/docview.cpp

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2056,6 +2056,89 @@ JNIEXPORT jstring JNICALL Java_org_coolreader_crengine_DocView_checkLinkInternal
20562056
return NULL;
20572057
}
20582058

2059+
/*
2060+
* Class: org_coolreader_crengine_DocView
2061+
* Method: getPageTextInternal
2062+
* Signature: (III)Ljava/lang/String;
2063+
*/
2064+
JNIEXPORT jstring JNICALL Java_org_coolreader_crengine_DocView_getPageTextInternal
2065+
(JNIEnv * _env, jobject _this, jboolean wrapWords, jint pageIndex)
2066+
{
2067+
CRJNIEnv env(_env);
2068+
DocViewNative * p = getNative(_env, _this);
2069+
if (!p) {
2070+
CRLog::error("Cannot get native view");
2071+
return NULL;
2072+
}
2073+
lString16 pageText;
2074+
if ( !p->_docview->isDocumentOpened() )
2075+
return NULL;
2076+
DocViewCallback callback( _env, p->_docview, _this );
2077+
2078+
pageText = p->_docview->getPageText(wrapWords, pageIndex);
2079+
if ( !pageText.empty() )
2080+
return env.toJavaString(pageText);
2081+
return NULL;
2082+
}
2083+
2084+
/*
2085+
* Class: org_coolreader_crengine_DocView
2086+
* Method: getPageCountInternal
2087+
* Signature: (III)Ljava/lang/String;
2088+
*/
2089+
JNIEXPORT jint JNICALL Java_org_coolreader_crengine_DocView_getPageCountInternal
2090+
(JNIEnv * _env, jobject _this)
2091+
{
2092+
CRJNIEnv env(_env);
2093+
DocViewNative * p = getNative(_env, _this);
2094+
if (!p) {
2095+
CRLog::error("Cannot get native view");
2096+
return NULL;
2097+
}
2098+
if ( !p->_docview->isDocumentOpened() )
2099+
return NULL;
2100+
DocViewCallback callback( _env, p->_docview, _this );
2101+
2102+
return p->_docview->getPageCount();
2103+
}
2104+
2105+
/*
2106+
* Class: org_coolreader_crengine_DocView
2107+
* Method: getVisiblePageCountInternal
2108+
* Signature: (III)Ljava/lang/String;
2109+
*/
2110+
JNIEXPORT jint JNICALL Java_org_coolreader_crengine_DocView_getVisiblePageCountInternal
2111+
(JNIEnv * _env, jobject _this)
2112+
{
2113+
CRJNIEnv env(_env);
2114+
DocViewNative * p = getNative(_env, _this);
2115+
if (!p) {
2116+
CRLog::error("Cannot get native view");
2117+
return NULL;
2118+
}
2119+
if ( !p->_docview->isDocumentOpened() )
2120+
return NULL;
2121+
DocViewCallback callback( _env, p->_docview, _this );
2122+
2123+
return p->_docview->getVisiblePageCount();
2124+
}
2125+
2126+
JNIEXPORT jint JNICALL Java_org_coolreader_crengine_DocView_getCurPageInternal
2127+
(JNIEnv * _env, jobject _this)
2128+
{
2129+
CRJNIEnv env(_env);
2130+
DocViewNative * p = getNative(_env, _this);
2131+
if (!p) {
2132+
CRLog::error("Cannot get native view");
2133+
return NULL;
2134+
}
2135+
if ( !p->_docview->isDocumentOpened() )
2136+
return NULL;
2137+
DocViewCallback callback( _env, p->_docview, _this );
2138+
2139+
return p->_docview->getCurPage();
2140+
}
2141+
20592142
/*
20602143
* Class: org_coolreader_crengine_DocView
20612144
* Method: goLinkInternal

android/jni/org_coolreader_crengine_DocView.h

Lines changed: 56 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

android/res/layout/book_info_dialog.xml

Lines changed: 32 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,38 @@
1010
android:layout_height="match_parent"
1111
android:orientation="vertical">
1212

13-
<Button android:id="@+id/btn_edit_info"
14-
android:layout_width="wrap_content"
15-
android:layout_height="wrap_content"
16-
android:layout_marginTop="5dip"
17-
android:layout_marginBottom="5dip"
18-
android:layout_marginLeft="5dip"
19-
android:layout_marginRight="5dip"
20-
android:focusable="false"
21-
android:focusableInTouchMode="false"
22-
android:text="@string/btn_edit_info"
23-
android:contentDescription="@string/btn_edit_info"/>
13+
<LinearLayout
14+
android:layout_width="match_parent"
15+
android:layout_height="wrap_content"
16+
android:orientation="horizontal">
17+
18+
<Button android:id="@+id/btn_edit_info"
19+
android:layout_width="wrap_content"
20+
android:layout_weight="1"
21+
android:layout_height="fill_parent"
22+
android:layout_marginTop="5dip"
23+
android:layout_marginBottom="5dip"
24+
android:layout_marginLeft="5dip"
25+
android:layout_marginRight="5dip"
26+
android:focusable="false"
27+
android:focusableInTouchMode="false"
28+
android:text="@string/btn_edit_info"
29+
android:contentDescription="@string/btn_edit_info"/>
30+
31+
<Button android:id="@+id/btn_shortcut"
32+
android:layout_width="wrap_content"
33+
android:layout_weight="1"
34+
android:layout_height="fill_parent"
35+
android:layout_marginTop="5dip"
36+
android:layout_marginBottom="5dip"
37+
android:layout_marginLeft="5dip"
38+
android:layout_marginRight="5dip"
39+
android:focusable="false"
40+
android:focusableInTouchMode="false"
41+
android:text="@string/btn_shortcut"
42+
android:contentDescription="@string/btn_shortcut"/>
43+
44+
</LinearLayout>
2445

2546
<TableLayout
2647
android:id="@+id/table"

android/res/layout/book_info_edit_dialog.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,17 @@
8080
android:focusableInTouchMode="false"
8181
android:background="@null"
8282
android:contentDescription="@string/dlg_button_book_delete"/>
83+
<ImageButton android:id="@+id/book_shortcut"
84+
android:layout_width="wrap_content"
85+
android:layout_height="wrap_content"
86+
android:layout_centerVertical="true"
87+
android:gravity="right"
88+
android:minWidth="?android:attr/listPreferredItemHeight"
89+
android:src="@drawable/cr3_browser_book_hc"
90+
android:focusable="false"
91+
android:focusableInTouchMode="false"
92+
android:background="@null"
93+
android:contentDescription="@string/btn_shortcut"/>
8394
</LinearLayout>
8495
<LinearLayout
8596
android:orientation="horizontal"

android/res/layout/goto_page_dlg.xml

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,40 +5,54 @@
55
android:layout_width="fill_parent"
66
android:layout_height="wrap_content"
77
android:minWidth="1200dip"
8-
android:layout_marginTop="20dip"
9-
android:layout_marginBottom="20dip"
10-
android:layout_marginLeft="20dip"
11-
android:layout_marginRight="20dip"
8+
android:layout_marginTop="5dip"
9+
android:layout_marginBottom="5dip"
10+
android:layout_marginLeft="5dip"
11+
android:layout_marginRight="5dip"
1212
>
1313
<TextView
1414
android:id="@+id/lbl_prompt"
1515
style="@style/TextAppearance.Medium"
1616
android:singleLine="false"
1717
android:maxLines="3"
18-
android:layout_margin="5dip"
18+
android:layout_margin="3dip"
1919
android:text="Page 34/1024 (25%) Chapter 1"
2020
android:layout_width="wrap_content"
2121
android:layout_height="wrap_content"/>
2222
<EditText
2323
android:id="@+id/input_field"
2424
android:layout_width="fill_parent"
2525
android:layout_height="wrap_content"
26-
android:layout_marginTop="10dip"
27-
android:layout_marginBottom="10dip"
28-
android:layout_marginLeft="10dip"
29-
android:layout_marginRight="10dip"
26+
android:layout_marginTop="3dip"
27+
android:layout_marginBottom="3dip"
28+
android:layout_marginLeft="3dip"
29+
android:layout_marginRight="3dip"
3030
style="@style/TextAppearance.Widget.EditText"
3131
android:singleLine="true"
3232
/>
3333
<SeekBar android:id="@+id/goto_position_seek_bar"
3434
android:layout_width="fill_parent"
3535
android:layout_height="wrap_content"
36-
android:layout_marginTop="8dip"
37-
android:layout_marginBottom="8dip"
36+
android:layout_marginTop="2dip"
37+
android:layout_marginBottom="2dip"
3838
android:layout_marginLeft="2dip"
39-
android:layout_marginRight="8dip"
39+
android:layout_marginRight="2dip"
4040
android:padding="10dip"
4141
android:max="100"
4242
android:progress="50"
4343
/>
44+
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
45+
android:id="@+id/pages_list"
46+
android:orientation="vertical"
47+
android:layout_weight="8"
48+
android:layout_width="fill_parent"
49+
android:layout_height="fill_parent"
50+
android:baselineAligned="false"
51+
android:layout_marginTop="8dip"
52+
android:layout_marginBottom="8dip"
53+
android:layout_marginLeft="4dip"
54+
android:layout_marginRight="4dip"
55+
>
56+
57+
</LinearLayout>
4458
</LinearLayout>

android/res/layout/goto_page_find_dlg.xml

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -11,38 +11,16 @@
1111
android:layout_marginRight="5dip"
1212
>
1313
<TextView
14-
android:id="@+id/lbl_prompt"
14+
android:id="@+id/lbl_find_text_pages"
1515
style="@style/TextAppearance.Medium"
1616
android:singleLine="false"
1717
android:maxLines="3"
1818
android:layout_margin="3dip"
19-
android:text="Page 34/1024 (25%) Chapter 1"
19+
android:text="find text"
2020
android:layout_width="wrap_content"
2121
android:layout_height="wrap_content"/>
22-
<EditText
23-
android:id="@+id/input_field"
24-
android:layout_width="fill_parent"
25-
android:layout_height="wrap_content"
26-
android:layout_marginTop="3dip"
27-
android:layout_marginBottom="3dip"
28-
android:layout_marginLeft="3dip"
29-
android:layout_marginRight="3dip"
30-
style="@style/TextAppearance.Widget.EditText"
31-
android:singleLine="true"
32-
/>
33-
<SeekBar android:id="@+id/goto_position_seek_bar"
34-
android:layout_width="fill_parent"
35-
android:layout_height="wrap_content"
36-
android:layout_marginTop="2dip"
37-
android:layout_marginBottom="2dip"
38-
android:layout_marginLeft="2dip"
39-
android:layout_marginRight="2dip"
40-
android:padding="10dip"
41-
android:max="100"
42-
android:progress="50"
43-
/>
4422
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
45-
android:id="@+id/pages_list"
23+
android:id="@+id/find_pages_list"
4624
android:orientation="vertical"
4725
android:layout_weight="8"
4826
android:layout_width="fill_parent"
@@ -53,6 +31,5 @@
5331
android:layout_marginLeft="4dip"
5432
android:layout_marginRight="4dip"
5533
>
56-
5734
</LinearLayout>
5835
</LinearLayout>

android/res/layout/page_item.xml

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<!--
3-
Book item layout for CR3 file browser
4-
-->
52

63
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
7-
android:id="@+id/dict_item_body"
4+
android:id="@+id/page_item_body"
85
android:orientation="horizontal"
96
android:layout_width="fill_parent"
107
android:layout_height="wrap_content"
@@ -15,7 +12,7 @@
1512
android:layout_marginRight="2dip"
1613
>
1714

18-
<LinearLayout android:id="@+id/shortcut_dict_item_sc_layout"
15+
<LinearLayout android:id="@+id/shortcut_page_item_sc_layout"
1916
android:orientation="vertical"
2017
android:layout_marginTop="3dip"
2118
android:layout_marginBottom="3dip"
@@ -27,7 +24,7 @@
2724
android:baselineAligned="false">
2825

2926

30-
<TextView android:id="@+id/dict_item_shortcut"
27+
<TextView android:id="@+id/page_item_shortcut"
3128
style="@style/TextAppearance.Medium"
3229
android:text="1"
3330
android:layout_width="wrap_content"
@@ -36,21 +33,23 @@
3633
android:layout_gravity="left" />
3734
</LinearLayout>
3835

39-
<LinearLayout android:id="@+id/dict_item_text"
36+
<LinearLayout android:id="@+id/page_item_text"
4037
android:orientation="vertical"
4138
android:layout_width="fill_parent"
4239
android:layout_height="wrap_content"
4340
android:layout_gravity="center_vertical|fill_horizontal"
4441
android:baselineAligned="false">
4542

4643

47-
<TextView android:id="@+id/dict_item_title"
48-
style="@style/TextAppearance.Large"
44+
<TextView android:id="@+id/page_item_title"
45+
style="@style/TextAppearance.Smaller"
4946
android:text="10% Title Text"
5047
android:layout_width="wrap_content"
5148
android:layout_height="wrap_content"
52-
android:singleLine="true"
49+
android:singleLine="false"
5350
android:ellipsize="end"
51+
android:textAppearance="?android:attr/textAppearanceSmall"
52+
android:maxLines="6"
5453
android:layout_gravity="left" />
5554
</LinearLayout>
5655
</LinearLayout>

0 commit comments

Comments
 (0)