Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
P
PDF Viewer Scanner White ago
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
kuxulei
PDF Viewer Scanner White ago
Commits
d12ec596
Commit
d12ec596
authored
Sep 26, 2024
by
wanglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
...
parent
8217742d
Show whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
399 additions
and
231 deletions
+399
-231
SheetBar.java
.../java/com/cherry/lib/doc/office/ss/sheetbar/SheetBar.java
+64
-89
SheetButton.java
...va/com/cherry/lib/doc/office/ss/sheetbar/SheetButton.java
+72
-54
SheetbarResManager.java
...cherry/lib/doc/office/ss/sheetbar/SheetbarResManager.java
+107
-88
ResConstant.java
library/src/main/java/com/wxiwei/office/res/ResConstant.java
+70
-0
ResKit.java
library/src/main/java/com/wxiwei/office/res/ResKit.java
+86
-0
ss_sheetbar_bg.png
...c/main/java/com/wxiwei/office/res/icon/ss_sheetbar_bg.png
+0
-0
ss_sheetbar_button_focus_left.png
.../wxiwei/office/res/icon/ss_sheetbar_button_focus_left.png
+0
-0
ss_sheetbar_button_focus_middle.png
...xiwei/office/res/icon/ss_sheetbar_button_focus_middle.png
+0
-0
ss_sheetbar_button_focus_right.png
...wxiwei/office/res/icon/ss_sheetbar_button_focus_right.png
+0
-0
ss_sheetbar_button_normal_left.png
...wxiwei/office/res/icon/ss_sheetbar_button_normal_left.png
+0
-0
ss_sheetbar_button_normal_middle.png
...iwei/office/res/icon/ss_sheetbar_button_normal_middle.png
+0
-0
ss_sheetbar_button_normal_right.png
...xiwei/office/res/icon/ss_sheetbar_button_normal_right.png
+0
-0
ss_sheetbar_button_push_left.png
...m/wxiwei/office/res/icon/ss_sheetbar_button_push_left.png
+0
-0
ss_sheetbar_button_push_middle.png
...wxiwei/office/res/icon/ss_sheetbar_button_push_middle.png
+0
-0
ss_sheetbar_button_push_right.png
.../wxiwei/office/res/icon/ss_sheetbar_button_push_right.png
+0
-0
ss_sheetbar_separated_horizontal.png
...iwei/office/res/icon/ss_sheetbar_separated_horizontal.png
+0
-0
ss_sheetbar_shadow_left.png
...va/com/wxiwei/office/res/icon/ss_sheetbar_shadow_left.png
+0
-0
ss_sheetbar_shadow_right.png
...a/com/wxiwei/office/res/icon/ss_sheetbar_shadow_right.png
+0
-0
No files found.
library/src/main/java/com/cherry/lib/doc/office/ss/sheetbar/SheetBar.java
View file @
d12ec596
...
...
@@ -18,11 +18,11 @@ import android.graphics.drawable.Drawable;
import
android.view.Gravity
;
import
android.view.View
;
import
android.view.View.OnClickListener
;
import
android.view.ViewGroup
;
import
android.widget.HorizontalScrollView
;
import
android.widget.LinearLayout
;
/**
*
* <p>
* <p>
* Read版本: Read V1.0
...
...
@@ -37,38 +37,30 @@ import android.widget.LinearLayout;
* <p>
* <p>
*/
public
class
SheetBar
extends
HorizontalScrollView
implements
OnClickListener
{
public
class
SheetBar
extends
HorizontalScrollView
implements
OnClickListener
{
public
SheetBar
(
Context
context
)
{
public
SheetBar
(
Context
context
)
{
super
(
context
);
}
public
SheetBar
(
Context
context
,
IControl
control
,
int
minimumWidth
)
{
public
SheetBar
(
Context
context
,
IControl
control
,
int
minimumWidth
)
{
super
(
context
);
this
.
control
=
control
;
this
.
setVerticalFadingEdgeEnabled
(
false
);
this
.
setFadingEdgeLength
(
0
);
if
(
minimumWidth
==
getResources
().
getDisplayMetrics
().
widthPixels
)
{
if
(
minimumWidth
==
getResources
().
getDisplayMetrics
().
widthPixels
)
{
this
.
minimumWidth
=
-
1
;
}
else
{
}
else
{
this
.
minimumWidth
=
minimumWidth
;
}
init
();
}
/**
*
*
*/
public
void
onConfigurationChanged
(
Configuration
newConfig
)
{
public
void
onConfigurationChanged
(
Configuration
newConfig
)
{
sheetbarFrame
.
setMinimumWidth
(
minimumWidth
==
-
1
?
getResources
().
getDisplayMetrics
().
widthPixels
:
minimumWidth
);
}
...
...
@@ -76,13 +68,11 @@ public class SheetBar extends HorizontalScrollView implements OnClickListener
/**
*
*/
private
void
init
()
{
private
void
init
()
{
Context
context
=
this
.
getContext
();
sheetbarFrame
=
new
LinearLayout
(
context
);
sheetbarFrame
.
setGravity
(
Gravity
.
BOTTOM
);
sheetbarResManager
=
new
SheetbarResManager
(
context
);
// Drawable drawable = sheetbarResManager.getDrawable(SheetbarResConstant.RESID_SHEETBAR_BG);
...
...
@@ -93,8 +83,7 @@ public class SheetBar extends HorizontalScrollView implements OnClickListener
// sheetbarResManager.getDrawable(SheetbarResConstant.RESID_SHEETBAR_BG);
sheetbarFrame
.
setBackground
(
drawable
);
sheetbarFrame
.
setOrientation
(
LinearLayout
.
HORIZONTAL
);
sheetbarFrame
.
setMinimumWidth
(
minimumWidth
==
-
1
?
getResources
().
getDisplayMetrics
().
widthPixels
:
minimumWidth
);
sheetbarFrame
.
setMinimumWidth
(
minimumWidth
==
-
1
?
getResources
().
getDisplayMetrics
().
widthPixels
:
minimumWidth
);
sheetbarHeight
=
drawable
.
getIntrinsicHeight
();
drawable
=
sheetbarResManager
.
getDrawable
((
short
)
R
.
drawable
.
ss_sheetbar_shadow_left
);
...
...
@@ -105,24 +94,23 @@ public class SheetBar extends HorizontalScrollView implements OnClickListener
sheetbarFrame
.
addView
(
left
,
parmas
);
// sheetButton
@
SuppressWarnings
(
"unchecked"
)
Vector
<
String
>
vec
=
(
Vector
<
String
>)
control
.
getActionValue
(
EventConstant
.
SS_GET_ALL_SHEET_NAME
,
null
);
@SuppressWarnings
(
"unchecked"
)
Vector
<
String
>
vec
=
(
Vector
<
String
>)
control
.
getActionValue
(
EventConstant
.
SS_GET_ALL_SHEET_NAME
,
null
);
drawable
=
sheetbarResManager
.
getDrawable
(
SheetbarResConstant
.
RESID_SHEETBUTTON_NORMAL_LEFT
);
LayoutParams
parmasButton
=
new
LayoutParams
(
LayoutParams
.
WRAP_CONTENT
,
LayoutParams
.
WRAP_CONTENT
);
int
count
=
vec
.
size
();
for
(
int
i
=
0
;
i
<
count
;
i
++)
{
for
(
int
i
=
0
;
i
<
count
;
i
++)
{
SheetButton
sb
=
new
SheetButton
(
context
,
vec
.
get
(
i
),
i
,
sheetbarResManager
);
if
(
currentSheet
==
null
)
{
if
(
currentSheet
==
null
)
{
currentSheet
=
sb
;
currentSheet
.
changeFocus
(
true
);
}
sb
.
setOnClickListener
(
this
);
sheetbarFrame
.
addView
(
sb
,
parmasButton
);
if
(
i
<
count
-
1
)
{
if
(
i
<
count
-
1
)
{
View
view
=
new
View
(
context
);
drawable
=
sheetbarResManager
.
getDrawable
(
SheetbarResConstant
.
RESID_SHEETBAR_SEPARATOR_H
);
view
.
setBackground
(
drawable
);
...
...
@@ -137,18 +125,17 @@ public class SheetBar extends HorizontalScrollView implements OnClickListener
sheetbarFrame
.
addView
(
right
,
parmas
);
//
addView
(
sheetbarFrame
,
new
LayoutParams
(
LayoutParams
.
WRAP_CONTENT
,
sheetbarHeight
));
LayoutParams
addLayoutParams
=
new
LayoutParams
(
LayoutParams
.
WRAP_CONTENT
,
70
);
addView
(
sheetbarFrame
,
addLayoutParams
);
}
/**
*
*
*/
public
void
onClick
(
View
v
)
{
public
void
onClick
(
View
v
)
{
currentSheet
.
changeFocus
(
false
);
SheetButton
sb
=
(
SheetButton
)
v
;
SheetButton
sb
=
(
SheetButton
)
v
;
sb
.
changeFocus
(
true
);
currentSheet
=
sb
;
...
...
@@ -157,25 +144,22 @@ public class SheetBar extends HorizontalScrollView implements OnClickListener
/**
* set focus sheet button(called when clicked document hyperlink)
*
* @param index
*/
public
void
setFocusSheetButton
(
int
index
)
{
if
(
currentSheet
.
getSheetIndex
()
==
index
)
{
public
void
setFocusSheetButton
(
int
index
)
{
if
(
currentSheet
.
getSheetIndex
()
==
index
)
{
return
;
}
int
count
=
sheetbarFrame
.
getChildCount
();
View
view
=
null
;
for
(
int
i
=
0
;
i
<
count
;
i
++)
{
for
(
int
i
=
0
;
i
<
count
;
i
++)
{
view
=
sheetbarFrame
.
getChildAt
(
i
);
if
(
view
instanceof
SheetButton
&&
((
SheetButton
)
view
).
getSheetIndex
()
==
index
)
{
if
(
view
instanceof
SheetButton
&&
((
SheetButton
)
view
).
getSheetIndex
()
==
index
)
{
currentSheet
.
changeFocus
(
false
);
currentSheet
=
(
SheetButton
)
view
;
currentSheet
=
(
SheetButton
)
view
;
currentSheet
.
changeFocus
(
true
);
break
;
}
...
...
@@ -184,19 +168,15 @@ public class SheetBar extends HorizontalScrollView implements OnClickListener
//sheetbar scrolled
int
screenWidth
=
control
.
getActivity
().
getWindowManager
().
getDefaultDisplay
().
getWidth
();
int
barWidth
=
sheetbarFrame
.
getWidth
();
if
(
barWidth
>
screenWidth
)
{
if
(
barWidth
>
screenWidth
)
{
int
left
=
view
.
getLeft
();
int
right
=
view
.
getRight
();
int
off
=
(
screenWidth
-
(
right
-
left
))
/
2
;
off
=
left
-
off
;
if
(
off
<
0
)
{
if
(
off
<
0
)
{
off
=
0
;
}
else
if
(
off
+
screenWidth
>
barWidth
)
{
}
else
if
(
off
+
screenWidth
>
barWidth
)
{
off
=
barWidth
-
screenWidth
;
}
...
...
@@ -207,30 +187,25 @@ public class SheetBar extends HorizontalScrollView implements OnClickListener
/**
* @return Returns the sheetbarHeight.
*/
public
int
getSheetbarHeight
()
{
public
int
getSheetbarHeight
()
{
return
sheetbarHeight
;
}
/**
*
*/
public
void
dispose
()
{
public
void
dispose
()
{
sheetbarResManager
.
dispose
();
sheetbarResManager
=
null
;
currentSheet
=
null
;
if
(
sheetbarFrame
!=
null
)
{
if
(
sheetbarFrame
!=
null
)
{
int
count
=
sheetbarFrame
.
getChildCount
();
View
v
;
for
(
int
i
=
0
;
i
<
count
;
i
++)
{
for
(
int
i
=
0
;
i
<
count
;
i
++)
{
v
=
sheetbarFrame
.
getChildAt
(
i
);
if
(
v
instanceof
SheetButton
)
{
((
SheetButton
)
v
).
dispose
();
if
(
v
instanceof
SheetButton
)
{
((
SheetButton
)
v
).
dispose
();
}
}
sheetbarFrame
=
null
;
...
...
library/src/main/java/com/cherry/lib/doc/office/ss/sheetbar/SheetButton.java
View file @
d12ec596
...
...
@@ -6,14 +6,22 @@
*/
package
com
.
cherry
.
lib
.
doc
.
office
.
ss
.
sheetbar
;
import
android.annotation.SuppressLint
;
import
android.content.Context
;
import
android.graphics.Color
;
import
android.graphics.drawable.Drawable
;
import
android.util.Log
;
import
android.view.Gravity
;
import
android.view.MotionEvent
;
import
android.view.View
;
import
android.widget.LinearLayout
;
import
android.widget.TextView
;
import
androidx.core.content.ContextCompat
;
import
com.cherry.lib.doc.R
;
/**
* sheet表名称按钮
* <p>
...
...
@@ -30,18 +38,16 @@ import android.widget.TextView;
* <p>
* <p>
*/
public
class
SheetButton
extends
LinearLayout
{
@SuppressLint
(
"ViewConstructor"
)
public
class
SheetButton
extends
LinearLayout
{
private
static
final
int
FONT_SIZE
=
18
;
//
private
static
final
int
SHEET_BUTTON_MIN_WIDTH
=
100
;
/**
*
* @param context
*/
public
SheetButton
(
Context
context
,
String
sheetName
,
int
sheetIndex
,
SheetbarResManager
sheetbarResManager
)
{
public
SheetButton
(
Context
context
,
String
sheetName
,
int
sheetIndex
,
SheetbarResManager
sheetbarResManager
)
{
super
(
context
);
setOrientation
(
HORIZONTAL
);
this
.
sheetIndex
=
sheetIndex
;
...
...
@@ -53,22 +59,35 @@ public class SheetButton extends LinearLayout
/**
*
*/
private
void
init
(
Context
context
,
String
sheetName
)
{
private
void
init
(
Context
context
,
String
sheetName
)
{
//左边图标
left
=
new
View
(
context
);
left
.
setBackgroundDrawable
(
sheetbarResManager
.
getDrawable
(
SheetbarResConstant
.
RESID_SHEETBUTTON_NORMAL_LEFT
));
Drawable
leftDrawable
=
sheetbarResManager
.
getDrawable
(
SheetbarResConstant
.
RESID_SHEETBUTTON_NORMAL_LEFT
);
if
(
leftDrawable
!=
null
)
{
Log
.
e
(
"SheetButton"
,
"leftDrawable=null"
);
}
else
{
Log
.
e
(
"SheetButton"
,
"leftDrawable!=null"
);
}
left
.
setBackgroundDrawable
(
leftDrawable
);
addView
(
left
);
//
textView
=
new
TextView
(
context
);
textView
.
setBackgroundDrawable
(
sheetbarResManager
.
getDrawable
(
SheetbarResConstant
.
RESID_SHEETBUTTON_NORMAL_MIDDLE
));
Drawable
middleDrawable
=
ContextCompat
.
getDrawable
(
context
,
R
.
drawable
.
ss_sheetbar_button_focus_middle
);
sheetbarResManager
.
getDrawable
(
SheetbarResConstant
.
RESID_SHEETBUTTON_NORMAL_MIDDLE
);
if
(
middleDrawable
==
null
)
{
Log
.
e
(
"SheetButton"
,
"middleDrawable=null"
);
}
else
{
Log
.
e
(
"SheetButton"
,
"middleDrawable!=null"
);
}
textView
.
setBackgroundDrawable
(
middleDrawable
);
textView
.
setText
(
sheetName
);
textView
.
setTextSize
(
FONT_SIZE
);
textView
.
setGravity
(
Gravity
.
CENTER
);
textView
.
setTextColor
(
Color
.
BLACK
);
int
w
=
(
int
)
textView
.
getPaint
().
measureText
(
sheetName
);
int
w
=
(
int
)
textView
.
getPaint
().
measureText
(
sheetName
);
w
=
Math
.
max
(
w
,
SHEET_BUTTON_MIN_WIDTH
);
addView
(
textView
,
new
LayoutParams
(
w
,
LayoutParams
.
MATCH_PARENT
));
...
...
@@ -79,18 +98,14 @@ public class SheetButton extends LinearLayout
}
/**
*
*
*/
public
boolean
onTouchEvent
(
MotionEvent
event
)
{
public
boolean
onTouchEvent
(
MotionEvent
event
)
{
int
action
=
event
.
getAction
();
switch
(
action
)
{
switch
(
action
)
{
case
MotionEvent
.
ACTION_DOWN
:
case
MotionEvent
.
ACTION_MOVE
:
if
(!
active
)
{
if
(!
active
)
{
left
.
setBackgroundDrawable
(
sheetbarResManager
.
getDrawable
(
SheetbarResConstant
.
RESID_SHEETBUTTON_PUSH_LEFT
));
textView
.
setBackgroundDrawable
(
sheetbarResManager
.
getDrawable
(
SheetbarResConstant
.
RESID_SHEETBUTTON_PUSH_MIDDLE
));
right
.
setBackgroundDrawable
(
sheetbarResManager
.
getDrawable
(
SheetbarResConstant
.
RESID_SHEETBUTTON_PUSH_RIGHT
));
...
...
@@ -99,8 +114,7 @@ public class SheetButton extends LinearLayout
case
MotionEvent
.
ACTION_UP
:
case
MotionEvent
.
ACTION_CANCEL
:
if
(!
active
)
{
if
(!
active
)
{
left
.
setBackgroundDrawable
(
sheetbarResManager
.
getDrawable
(
SheetbarResConstant
.
RESID_SHEETBUTTON_NORMAL_LEFT
));
textView
.
setBackgroundDrawable
(
sheetbarResManager
.
getDrawable
(
SheetbarResConstant
.
RESID_SHEETBUTTON_NORMAL_MIDDLE
));
right
.
setBackgroundDrawable
(
sheetbarResManager
.
getDrawable
(
SheetbarResConstant
.
RESID_SHEETBUTTON_NORMAL_RIGHT
));
...
...
@@ -113,31 +127,34 @@ public class SheetButton extends LinearLayout
/**
* 选中或取消选中用到
*/
public
void
changeFocus
(
boolean
gainFocus
)
{
public
void
changeFocus
(
boolean
gainFocus
)
{
active
=
gainFocus
;
left
.
setBackgroundDrawable
(
gainFocus
?
sheetbarResManager
.
getDrawable
(
SheetbarResConstant
.
RESID_SHEETBUTTON_FOCUS_LEFT
)
:
Log
.
e
(
"SheetButton"
,
"changeFocus="
+
gainFocus
);
left
.
setBackgroundDrawable
(
gainFocus
?
sheetbarResManager
.
getDrawable
(
SheetbarResConstant
.
RESID_SHEETBUTTON_FOCUS_LEFT
)
:
sheetbarResManager
.
getDrawable
(
SheetbarResConstant
.
RESID_SHEETBUTTON_NORMAL_LEFT
));
textView
.
setBackgroundDrawable
(
gainFocus
?
sheetbarResManager
.
getDrawable
(
SheetbarResConstant
.
RESID_SHEETBUTTON_FOCUS_MIDDLE
)
:
textView
.
setBackgroundDrawable
(
gainFocus
?
sheetbarResManager
.
getDrawable
(
SheetbarResConstant
.
RESID_SHEETBUTTON_FOCUS_MIDDLE
)
:
sheetbarResManager
.
getDrawable
(
SheetbarResConstant
.
RESID_SHEETBUTTON_NORMAL_MIDDLE
));
right
.
setBackgroundDrawable
(
gainFocus
?
sheetbarResManager
.
getDrawable
(
SheetbarResConstant
.
RESID_SHEETBUTTON_FOCUS_RIGHT
)
:
right
.
setBackgroundDrawable
(
gainFocus
?
sheetbarResManager
.
getDrawable
(
SheetbarResConstant
.
RESID_SHEETBUTTON_FOCUS_RIGHT
)
:
sheetbarResManager
.
getDrawable
(
SheetbarResConstant
.
RESID_SHEETBUTTON_NORMAL_RIGHT
));
}
/**
*
*/
public
int
getSheetIndex
()
{
public
int
getSheetIndex
()
{
return
this
.
sheetIndex
;
}
/**
*
*/
public
void
dispose
()
{
public
void
dispose
()
{
sheetbarResManager
=
null
;
left
=
null
;
...
...
@@ -147,7 +164,8 @@ public class SheetButton extends LinearLayout
private
SheetbarResManager
sheetbarResManager
;
//
private
int
sheetIndex
;;
private
int
sheetIndex
;
;
// 左边图标
private
View
left
;
// 中间文本
...
...
library/src/main/java/com/cherry/lib/doc/office/ss/sheetbar/SheetbarResManager.java
View file @
d12ec596
...
...
@@ -8,6 +8,11 @@ package com.cherry.lib.doc.office.ss.sheetbar;
import
android.content.Context
;
import
android.graphics.drawable.Drawable
;
import
android.util.Log
;
import
androidx.core.content.ContextCompat
;
import
com.cherry.lib.doc.R
;
/**
* TODO: 文件注释
...
...
@@ -25,10 +30,8 @@ import android.graphics.drawable.Drawable;
* <p>
* <p>
*/
public
class
SheetbarResManager
{
public
SheetbarResManager
(
Context
context
)
{
public
class
SheetbarResManager
{
public
SheetbarResManager
(
Context
context
)
{
this
.
context
=
context
;
ClassLoader
loader
=
context
.
getClassLoader
();
...
...
@@ -38,11 +41,11 @@ public class SheetbarResManager
SheetbarResConstant
.
RESNAME_SHEETBAR_BG
);
//shadow
sheetbarLeftShadow
=
Drawable
.
createFromResourceStream
(
context
.
getResources
(),
null
,
sheetbarLeftShadow
=
Drawable
.
createFromResourceStream
(
context
.
getResources
(),
null
,
loader
.
getResourceAsStream
(
SheetbarResConstant
.
RESNAME_SHEETBAR_SHADOW_LEFT
),
SheetbarResConstant
.
RESNAME_SHEETBAR_SHADOW_LEFT
);
sheetbarRightShadow
=
Drawable
.
createFromResourceStream
(
context
.
getResources
(),
null
,
sheetbarRightShadow
=
Drawable
.
createFromResourceStream
(
context
.
getResources
(),
null
,
loader
.
getResourceAsStream
(
SheetbarResConstant
.
RESNAME_SHEETBAR_SHADOW_RIGHT
),
SheetbarResConstant
.
RESNAME_SHEETBAR_SHADOW_RIGHT
);
...
...
@@ -52,44 +55,58 @@ public class SheetbarResManager
SheetbarResConstant
.
RESNAME_SHEETBAR_SEPARATOR_H
);
//normal state
normalLeft
=
Drawable
.
createFromResourceStream
(
context
.
getResources
(),
null
,
loader
.
getResourceAsStream
(
SheetbarResConstant
.
RESNAME_SHEETBUTTON_NORMAL_LEFT
),
SheetbarResConstant
.
RESNAME_SHEETBUTTON_NORMAL_LEFT
);
normalRight
=
Drawable
.
createFromResourceStream
(
context
.
getResources
(),
null
,
loader
.
getResourceAsStream
(
SheetbarResConstant
.
RESNAME_SHEETBUTTON_NORMAL_RIGHT
),
SheetbarResConstant
.
RESNAME_SHEETBUTTON_NORMAL_RIGHT
);
normalMiddle
=
Drawable
.
createFromResourceStream
(
context
.
getResources
(),
null
,
loader
.
getResourceAsStream
(
SheetbarResConstant
.
RESNAME_SHEETBUTTON_NORMAL_MIDDLE
),
SheetbarResConstant
.
RESNAME_SHEETBUTTON_NORMAL_MIDDLE
);
normalLeft
=
ContextCompat
.
getDrawable
(
context
,
R
.
drawable
.
ss_sheetbar_button_normal_left
);
// Drawable.createFromResourceStream(context.getResources(), null,
// loader.getResourceAsStream(SheetbarResConstant.RESNAME_SHEETBUTTON_NORMAL_LEFT),
// SheetbarResConstant.RESNAME_SHEETBUTTON_NORMAL_LEFT);
normalRight
=
ContextCompat
.
getDrawable
(
context
,
R
.
drawable
.
ss_sheetbar_button_normal_right
);
// Drawable.createFromResourceStream(context.getResources(), null,
// loader.getResourceAsStream(SheetbarResConstant.RESNAME_SHEETBUTTON_NORMAL_RIGHT),
// SheetbarResConstant.RESNAME_SHEETBUTTON_NORMAL_RIGHT);
normalMiddle
=
ContextCompat
.
getDrawable
(
context
,
R
.
drawable
.
ss_sheetbar_button_normal_middle
);
// Drawable.createFromResourceStream(context.getResources(), null,
// loader.getResourceAsStream(SheetbarResConstant.RESNAME_SHEETBUTTON_NORMAL_MIDDLE),
// SheetbarResConstant.RESNAME_SHEETBUTTON_NORMAL_MIDDLE);
//push state
pushLeft
=
Drawable
.
createFromResourceStream
(
context
.
getResources
(),
null
,
loader
.
getResourceAsStream
(
SheetbarResConstant
.
RESNAME_SHEETBUTTON_PUSH_LEFT
),
SheetbarResConstant
.
RESNAME_SHEETBUTTON_PUSH_LEFT
);
pushMiddle
=
Drawable
.
createFromResourceStream
(
context
.
getResources
(),
null
,
loader
.
getResourceAsStream
(
SheetbarResConstant
.
RESNAME_SHEETBUTTON_PUSH_MIDDLE
),
SheetbarResConstant
.
RESNAME_SHEETBUTTON_PUSH_MIDDLE
);
pushRight
=
Drawable
.
createFromResourceStream
(
context
.
getResources
(),
null
,
loader
.
getResourceAsStream
(
SheetbarResConstant
.
RESNAME_SHEETBUTTON_PUSH_RIGHT
),
SheetbarResConstant
.
RESNAME_SHEETBUTTON_PUSH_RIGHT
);
pushMiddle
=
ContextCompat
.
getDrawable
(
context
,
R
.
drawable
.
ss_sheetbar_button_push_middle
);
// Drawable.createFromResourceStream(context.getResources(), null,
// loader.getResourceAsStream(SheetbarResConstant.RESNAME_SHEETBUTTON_PUSH_MIDDLE),
// SheetbarResConstant.RESNAME_SHEETBUTTON_PUSH_MIDDLE);
pushRight
=
ContextCompat
.
getDrawable
(
context
,
R
.
drawable
.
ss_sheetbar_button_push_right
);
// Drawable.createFromResourceStream(context.getResources(), null,
// loader.getResourceAsStream(SheetbarResConstant.RESNAME_SHEETBUTTON_PUSH_RIGHT),
// SheetbarResConstant.RESNAME_SHEETBUTTON_PUSH_RIGHT);
//focus state
focusLeft
=
Drawable
.
createFromResourceStream
(
context
.
getResources
(),
null
,
loader
.
getResourceAsStream
(
SheetbarResConstant
.
RESNAME_SHEETBUTTON_FOCUS_LEFT
),
SheetbarResConstant
.
RESNAME_SHEETBUTTON_FOCUS_LEFT
);
focusMiddle
=
Drawable
.
createFromResourceStream
(
context
.
getResources
(),
null
,
loader
.
getResourceAsStream
(
SheetbarResConstant
.
RESNAME_SHEETBUTTON_FOCUS_MIDDLE
),
SheetbarResConstant
.
RESNAME_SHEETBUTTON_FOCUS_MIDDLE
);
focusRight
=
Drawable
.
createFromResourceStream
(
context
.
getResources
(),
null
,
loader
.
getResourceAsStream
(
SheetbarResConstant
.
RESNAME_SHEETBUTTON_FOCUS_RIGHT
),
SheetbarResConstant
.
RESNAME_SHEETBUTTON_FOCUS_RIGHT
);
focusLeft
=
ContextCompat
.
getDrawable
(
context
,
R
.
drawable
.
ss_sheetbar_button_focus_left
);
// Drawable.createFromResourceStream(context.getResources(), null,
// loader.getResourceAsStream(SheetbarResConstant.RESNAME_SHEETBUTTON_FOCUS_LEFT),
// SheetbarResConstant.RESNAME_SHEETBUTTON_FOCUS_LEFT);
focusMiddle
=
ContextCompat
.
getDrawable
(
context
,
R
.
drawable
.
ss_sheetbar_button_focus_middle
);
// Drawable.createFromResourceStream(context.getResources(), null,
// loader.getResourceAsStream(SheetbarResConstant.RESNAME_SHEETBUTTON_FOCUS_MIDDLE),
// SheetbarResConstant.RESNAME_SHEETBUTTON_FOCUS_MIDDLE);
focusRight
=
ContextCompat
.
getDrawable
(
context
,
R
.
drawable
.
ss_sheetbar_button_focus_right
);
// Drawable.createFromResourceStream(context.getResources(), null,
// loader.getResourceAsStream(SheetbarResConstant.RESNAME_SHEETBUTTON_FOCUS_RIGHT),
// SheetbarResConstant.RESNAME_SHEETBUTTON_FOCUS_RIGHT);
}
public
Drawable
getDrawable
(
short
resID
)
{
switch
(
resID
)
{
public
Drawable
getDrawable
(
short
resID
)
{
switch
(
resID
)
{
case
SheetbarResConstant
.
RESID_SHEETBAR_BG
:
return
sheetbarBG
;
...
...
@@ -106,9 +123,10 @@ public class SheetbarResManager
return
normalLeft
;
case
SheetbarResConstant
.
RESID_SHEETBUTTON_NORMAL_MIDDLE
:
return
Drawable
.
createFromResourceStream
(
context
.
getResources
(),
null
,
context
.
getClassLoader
().
getResourceAsStream
(
SheetbarResConstant
.
RESNAME_SHEETBUTTON_NORMAL_MIDDLE
),
SheetbarResConstant
.
RESNAME_SHEETBUTTON_NORMAL_MIDDLE
);
return
ContextCompat
.
getDrawable
(
context
,
R
.
drawable
.
ss_sheetbar_button_normal_middle
);
// return Drawable.createFromResourceStream(context.getResources(), null,
// context.getClassLoader().getResourceAsStream(SheetbarResConstant.RESNAME_SHEETBUTTON_NORMAL_MIDDLE),
// SheetbarResConstant.RESNAME_SHEETBUTTON_NORMAL_MIDDLE);
case
SheetbarResConstant
.
RESID_SHEETBUTTON_NORMAL_RIGHT
:
return
normalRight
;
...
...
@@ -125,8 +143,10 @@ public class SheetbarResManager
case
SheetbarResConstant
.
RESID_SHEETBUTTON_FOCUS_LEFT
:
return
focusLeft
;
case
SheetbarResConstant
.
RESID_SHEETBUTTON_FOCUS_MIDDLE
:
case
SheetbarResConstant
.
RESID_SHEETBUTTON_FOCUS_MIDDLE
:
{
Log
.
e
(
"SheetbarResManager"
,
"RESID_SHEETBUTTON_FOCUS_MIDDLE"
);
return
focusMiddle
;
}
case
SheetbarResConstant
.
RESID_SHEETBUTTON_FOCUS_RIGHT
:
return
focusRight
;
...
...
@@ -135,8 +155,7 @@ public class SheetbarResManager
return
null
;
}
public
void
dispose
()
{
public
void
dispose
()
{
sheetbarBG
=
null
;
sheetbarLeftShadow
=
null
;
...
...
library/src/main/java/com/wxiwei/office/res/ResConstant.java
0 → 100644
View file @
d12ec596
/*
* 文件名称: ResConstant.java
*
* 编译器: android2.2
* 时间: 上午11:31:49
*/
package
com
.
wxiwei
.
office
.
res
;
/**
* 国际化的资源常量
* <p>
* <p>
* Read版本: Read V1.0
* <p>
* 作者: ljj8494
* <p>
* 日期: 2012-8-13
* <p>
* 负责人: ljj8494
* <p>
* 负责小组:
* <p>
* <p>
*/
public
class
ResConstant
{
//
public
static
final
String
BUTTON_OK
=
"OK"
;
//
public
static
final
String
BUTTON_CANCEL
=
"Cancel"
;
//
public
static
final
String
DIALOG_ENCODING_TITLE
=
"Text Encoding"
;
//
public
static
final
String
DIALOG_LOADING
=
"Loading, please wait..."
;
//
public
static
final
String
DIALOG_INSUFFICIENT_MEMORY
=
"Unable to complete operation due to insufficient memory"
;
//
public
static
final
String
DIALOG_SYSTEM_CRASH
=
"System crash, terminate running"
;
//
public
static
final
String
DIALOG_FORMAT_ERROR
=
"Bad file"
;
//
public
static
final
String
DIALOG_OLD_DOCUMENT
=
"The document is too old - Office 95 or older, which is not supported"
;
//
public
static
final
String
DIALOG_PARSE_ERROR
=
"File parsing error"
;
//
public
static
final
String
DIALOG_RTF_FILE
=
"The document is really a RTF file, which is not supported"
;
//
public
static
final
String
DIALOG_PDF_SEARCHING
=
"Searching..."
;
//
public
static
final
String
DIALOG_FIND_NOT_FOUND
=
"Content not found"
;
//
public
static
final
String
DIALOG_FIND_TO_BEGIN
=
"Search to the document begin"
;
//
public
static
final
String
DIALOG_FIND_TO_END
=
"Search to the document end"
;
//
public
static
final
String
DIALOG_ENTER_PASSWORD
=
"Enter Password"
;
//
public
static
final
String
DIALOG_CANNOT_ENCRYPTED_FILE
=
"Cannot process encrypted file"
;
//
public
static
final
String
DIALOG_PASSWORD_INCORRECT
=
"Password is incorrect!"
;
//
public
static
final
String
EXIT_SLIDESHOW
=
"End of slideshow, tap to exit."
;
//
public
static
final
String
SD_CARD_ERROR
=
"SD Card Error"
;
//
public
static
final
String
SD_CARD_WRITEDENIED
=
"SD Card write permission denied"
;
//
public
static
final
String
SD_CARD_NOSPACELEFT
=
"SD Card has no space left"
;
}
library/src/main/java/com/wxiwei/office/res/ResKit.java
0 → 100644
View file @
d12ec596
/*
* 文件名称: ResKit.java
*
* 编译器: android2.2
* 时间: 下午9:03:08
*/
package
com
.
wxiwei
.
office
.
res
;
import
java.lang.reflect.Field
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
*
* <p>
* <p>
* Read版本: Read V1.0
* <p>
* 作者: ljj8494
* <p>
* 日期: 2012-9-20
* <p>
* 负责人: ljj8494
* <p>
* 负责小组:
* <p>
* <p>
*/
public
class
ResKit
{
//
private
static
ResKit
kit
=
new
ResKit
();
/**
*
*/
public
ResKit
()
{
try
{
res
=
new
HashMap
<
String
,
String
>();
// load "ResConstant"
Class
cls
=
Class
.
forName
(
"com.wxiwei.office.res.ResConstant"
);
// get all fields
Field
[]
fields
=
cls
.
getDeclaredFields
();
for
(
Field
field
:
fields
)
{
res
.
put
(
field
.
getName
(),
(
String
)
field
.
get
(
null
));
}
}
catch
(
Exception
e
)
{
}
}
/**
*
*/
public
static
ResKit
instance
()
{
return
kit
;
}
/**
*
*/
public
boolean
hasResName
(
String
resName
)
{
return
res
.
containsKey
(
resName
);
}
/**
*
* @param resName
* @return
*/
public
String
getLocalString
(
String
resName
)
{
return
res
.
get
(
resName
);
}
//
private
Map
<
String
,
String
>
res
;
}
library/src/main/java/com/wxiwei/office/res/icon/ss_sheetbar_bg.png
0 → 100644
View file @
d12ec596
2.97 KB
library/src/main/java/com/wxiwei/office/res/icon/ss_sheetbar_button_focus_left.png
0 → 100644
View file @
d12ec596
2.96 KB
library/src/main/java/com/wxiwei/office/res/icon/ss_sheetbar_button_focus_middle.png
0 → 100644
View file @
d12ec596
2.77 KB
library/src/main/java/com/wxiwei/office/res/icon/ss_sheetbar_button_focus_right.png
0 → 100644
View file @
d12ec596
2.94 KB
library/src/main/java/com/wxiwei/office/res/icon/ss_sheetbar_button_normal_left.png
0 → 100644
View file @
d12ec596
2.94 KB
library/src/main/java/com/wxiwei/office/res/icon/ss_sheetbar_button_normal_middle.png
0 → 100644
View file @
d12ec596
2.77 KB
library/src/main/java/com/wxiwei/office/res/icon/ss_sheetbar_button_normal_right.png
0 → 100644
View file @
d12ec596
2.92 KB
library/src/main/java/com/wxiwei/office/res/icon/ss_sheetbar_button_push_left.png
0 → 100644
View file @
d12ec596
3.15 KB
library/src/main/java/com/wxiwei/office/res/icon/ss_sheetbar_button_push_middle.png
0 → 100644
View file @
d12ec596
2.79 KB
library/src/main/java/com/wxiwei/office/res/icon/ss_sheetbar_button_push_right.png
0 → 100644
View file @
d12ec596
3.09 KB
library/src/main/java/com/wxiwei/office/res/icon/ss_sheetbar_separated_horizontal.png
0 → 100644
View file @
d12ec596
2.76 KB
library/src/main/java/com/wxiwei/office/res/icon/ss_sheetbar_shadow_left.png
0 → 100644
View file @
d12ec596
2.83 KB
library/src/main/java/com/wxiwei/office/res/icon/ss_sheetbar_shadow_right.png
0 → 100644
View file @
d12ec596
2.81 KB
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment