Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
Sobot_module_Dev
Project
Overview
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sobot_android
Sobot_module_Dev
Commits
04b868ae
Commit
04b868ae
authored
Nov 21, 2024
by
zhengnw@sobot.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
widget 1.2.9
parent
e700e43c
Show whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
437 additions
and
942 deletions
+437
-942
MainActivity.java
app/src/main/java/com/sobot/moduletest/MainActivity.java
+18
-18
sobot-widget-publish-mavencentral.gradle
sobot_widget/sobot-widget-publish-mavencentral.gradle
+1
-1
SobotBasePopupWindow.java
...java/com/sobot/widget/popwindow/SobotBasePopupWindow.java
+284
-0
ClassicsHeader.java
...om/sobot/widget/refresh/layout/header/ClassicsHeader.java
+4
-3
SobotBaseActivity.java
...main/java/com/sobot/widget/ui/base/SobotBaseActivity.java
+8
-4
CalendarUtil.java
...n/java/com/sobot/widget/ui/calenderview/CalendarUtil.java
+0
-4
CalendarViewDelegate.java
...om/sobot/widget/ui/calenderview/CalendarViewDelegate.java
+0
-7
CustomWeekBar.java
.../java/com/sobot/widget/ui/calenderview/CustomWeekBar.java
+37
-16
LunarCalendar.java
.../java/com/sobot/widget/ui/calenderview/LunarCalendar.java
+0
-389
MonthViewPager.java
...java/com/sobot/widget/ui/calenderview/MonthViewPager.java
+0
-1
SolarTermUtil.java
.../java/com/sobot/widget/ui/calenderview/SolarTermUtil.java
+0
-69
TrunkBranchAnnals.java
...a/com/sobot/widget/ui/calenderview/TrunkBranchAnnals.java
+0
-91
WeekBar.java
...c/main/java/com/sobot/widget/ui/calenderview/WeekBar.java
+39
-20
WeekViewPager.java
.../java/com/sobot/widget/ui/calenderview/WeekViewPager.java
+0
-1
sobot_common_layout_titlebar.xml
...dget/src/main/res/layout/sobot_common_layout_titlebar.xml
+29
-17
strings.xml
sobot_widget/src/main/res/values-en/strings.xml
+8
-2
strings_calender.xml
sobot_widget/src/main/res/values-en/strings_calender.xml
+0
-148
strings.xml
sobot_widget/src/main/res/values/strings.xml
+9
-1
strings_calender.xml
sobot_widget/src/main/res/values/strings_calender.xml
+0
-150
No files found.
app/src/main/java/com/sobot/moduletest/MainActivity.java
View file @
04b868ae
...
@@ -229,28 +229,28 @@ public class MainActivity extends SobotBaseActivity {
...
@@ -229,28 +229,28 @@ public class MainActivity extends SobotBaseActivity {
map1
.
put
(
"way"
,
"10"
);
map1
.
put
(
"way"
,
"10"
);
map1
.
put
(
"ack"
,
"1"
);
map1
.
put
(
"ack"
,
"1"
);
map1
.
put
(
"version"
,
"3.3.9"
);
map1
.
put
(
"version"
,
"3.3.9"
);
SobotLoginTools
.
getInstance
().
doLogin
(
MainActivity
.
this
,
getSobotBaseContext
(),
true
,
"https://api-c-test.sobot.com/text"
,
"https://api-c-test.sobot.com/text"
,
"zengzhi@zhichi.com"
,
"Xiaoxin818"
,
""
,
map1
,
new
SobotResultBlock
()
{
// SobotLoginTools.getInstance().doLogin(MainActivity.this, getSobotBaseContext(), true, "https://api-c-test.sobot.com/text", "https://api-c-test.sobot.com/text", "zengzhi@zhichi.com", "Xiaoxin818", "",map1, new SobotResultBlock() {
@Override
public
void
resultBolok
(
SobotResultCode
code
,
String
msg
,
Object
obj
)
{
if
(
code
==
SobotResultCode
.
CODE_SUCCEEDED
)
{
SobotLoginTools
.
getInstance
().
checkExpiresToken
();
// SobotLogUtils.i(SobotLoginTools.getInstance().getAccessToken() + "");
SobotLogUtils
.
i
(
SobotLoginTools
.
getInstance
().
getToken
()
+
""
);
SobotLogUtils
.
i
(
SobotLoginTools
.
getInstance
().
getServiceInfo
().
getStatus
()
+
"====登录状态======"
);
if
(
obj
instanceof
SobotServiceInfoModel
)
{
SobotLogUtils
.
i
(
"默认登录状态===="
+
((
SobotServiceInfoModel
)
obj
).
getDefaultAppLoginStatus
());
}
}
else
{
SobotLogUtils
.
i
(
"code ="
+
code
+
",msg="
+
msg
+
",obj="
+
obj
);
}
// SobotLoginTools.getInstance().logOut(MainActivity.this, "https://test-branche1.sobot.com/text", "zhengnw@zhichi.com", new SobotResultBlock() {
// @Override
// @Override
// public void resultBolok(SobotResultCode code, String msg, Object obj) {
// public void resultBolok(SobotResultCode code, String msg, Object obj) {
//
// if(code==SobotResultCode.CODE_SUCCEEDED) {
// SobotLoginTools.getInstance().checkExpiresToken();
//// SobotLogUtils.i(SobotLoginTools.getInstance().getAccessToken() + "");
// SobotLogUtils.i(SobotLoginTools.getInstance().getToken() + "");
// SobotLogUtils.i(SobotLoginTools.getInstance().getServiceInfo().getStatus() + "====登录状态======");
// if (obj instanceof SobotServiceInfoModel) {
// SobotLogUtils.i("默认登录状态====" + ((SobotServiceInfoModel) obj).getDefaultAppLoginStatus());
// }
// }else{
// SobotLogUtils.i("code =" + code+",msg="+msg+",obj="+obj);
// }
//// SobotLoginTools.getInstance().logOut(MainActivity.this, "https://test-branche1.sobot.com/text", "zhengnw@zhichi.com", new SobotResultBlock() {
//// @Override
//// public void resultBolok(SobotResultCode code, String msg, Object obj) {
////
//// }
//// });
// }
// }
// });
// });
}
});
// SobotLoginTools.getInstance().loginWithAppkey(MainActivity.this, getSobotBaseContext(), true, "https://api-c.sobot.com/text", "https://api-c.soboten.com/text", "zhengnw@zhichi.com", "b83B6E072W29", "4ce7ca987fcf43beb17ed1eca84dd760", map1, new SobotResultBlock() {
// SobotLoginTools.getInstance().loginWithAppkey(MainActivity.this, getSobotBaseContext(), true, "https://api-c.sobot.com/text", "https://api-c.soboten.com/text", "zhengnw@zhichi.com", "b83B6E072W29", "4ce7ca987fcf43beb17ed1eca84dd760", map1, new SobotResultBlock() {
// @Override
// @Override
...
...
sobot_widget/sobot-widget-publish-mavencentral.gradle
View file @
04b868ae
...
@@ -12,7 +12,7 @@ task androidSourcesJar(type: Jar) {
...
@@ -12,7 +12,7 @@ task androidSourcesJar(type: Jar) {
ext
{
ext
{
PUBLISH_GROUP_ID
=
"com.sobot.library"
//项目包名
PUBLISH_GROUP_ID
=
"com.sobot.library"
//项目包名
PUBLISH_ARTIFACT_ID
=
'widget_x'
//项目名
PUBLISH_ARTIFACT_ID
=
'widget_x'
//项目名
PUBLISH_VERSION
=
'1.2.
8.2
'
//版本号
PUBLISH_VERSION
=
'1.2.
9
'
//版本号
}
}
...
...
sobot_widget/src/main/java/com/sobot/widget/popwindow/SobotBasePopupWindow.java
0 → 100644
View file @
04b868ae
package
com
.
sobot
.
widget
.
popwindow
;
import
android.content.Context
;
import
android.graphics.Rect
;
import
android.graphics.drawable.ColorDrawable
;
import
android.os.Build
;
import
android.util.DisplayMetrics
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.view.WindowManager
;
import
android.widget.PopupWindow
;
import
androidx.annotation.RequiresApi
;
public
class
SobotBasePopupWindow
{
private
Context
mContext
;
private
int
mWidth
;
private
int
mHeight
;
private
boolean
mIsFocusable
=
true
;
private
boolean
mIsOutside
=
true
;
private
int
mResLayoutId
=
-
1
;
private
View
mContentView
;
private
PopupWindow
mPopupWindow
;
private
int
mAnimationStyle
=
-
1
;
private
boolean
mClippEnable
=
true
;
//default is true
private
boolean
mIgnoreCheekPress
=
false
;
private
int
mInputMode
=
-
1
;
private
PopupWindow
.
OnDismissListener
mOnDismissListener
;
private
int
mSoftInputMode
=
-
1
;
private
boolean
mTouchable
=
true
;
//default is ture
private
View
.
OnTouchListener
mOnTouchListener
;
private
SobotBasePopupWindow
(
Context
context
)
{
mContext
=
context
;
}
public
int
getWidth
()
{
return
mWidth
;
}
public
int
getHeight
()
{
return
mHeight
;
}
public
boolean
isShow
()
{
return
mPopupWindow
!=
null
&&
mPopupWindow
.
isShowing
();
}
/**
* @param anchor
* @param xOff
* @param yOff
* @return
*/
public
SobotBasePopupWindow
showAsDropDown
(
View
anchor
,
int
xOff
,
int
yOff
)
{
if
(
mPopupWindow
!=
null
)
{
mPopupWindow
.
showAsDropDown
(
anchor
,
xOff
,
yOff
);
}
return
this
;
}
public
SobotBasePopupWindow
showAsDropDown
(
View
anchor
)
{
if
(
mPopupWindow
!=
null
)
{
//兼容7.1以上手机失效问题
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
N
)
{
Rect
rect
=
new
Rect
();
anchor
.
getGlobalVisibleRect
(
rect
);
//测量
DisplayMetrics
dm
=
new
DisplayMetrics
();
WindowManager
windowManager
=
(
WindowManager
)
mContext
.
getSystemService
(
Context
.
WINDOW_SERVICE
);
windowManager
.
getDefaultDisplay
().
getRealMetrics
(
dm
);
int
heightPixels
=
dm
.
heightPixels
;
int
h
=
heightPixels
-
rect
.
bottom
;
mPopupWindow
.
setHeight
(
h
);
}
mPopupWindow
.
showAsDropDown
(
anchor
);
}
return
this
;
}
@RequiresApi
(
api
=
Build
.
VERSION_CODES
.
KITKAT
)
public
SobotBasePopupWindow
showAsDropDown
(
View
anchor
,
int
xOff
,
int
yOff
,
int
gravity
)
{
if
(
mPopupWindow
!=
null
)
{
mPopupWindow
.
showAsDropDown
(
anchor
,
xOff
,
yOff
,
gravity
);
}
return
this
;
}
/**
* 相对于父控件的位置(通过设置Gravity.CENTER,下方Gravity.BOTTOM等 ),可以设置具体位置坐标
*
* @param parent
* @param gravity
* @param x the popup's x location offset
* @param y the popup's y location offset
* @return
*/
public
SobotBasePopupWindow
showAtLocation
(
View
parent
,
int
gravity
,
int
x
,
int
y
)
{
if
(
mPopupWindow
!=
null
)
{
mPopupWindow
.
showAtLocation
(
parent
,
gravity
,
x
,
y
);
}
return
this
;
}
/**
* 添加一些属性设置
*
* @param popupWindow
*/
private
void
apply
(
PopupWindow
popupWindow
)
{
popupWindow
.
setClippingEnabled
(
mClippEnable
);
if
(
mIgnoreCheekPress
)
{
popupWindow
.
setIgnoreCheekPress
();
}
if
(
mInputMode
!=
-
1
)
{
popupWindow
.
setInputMethodMode
(
mInputMode
);
}
if
(
mSoftInputMode
!=
-
1
)
{
popupWindow
.
setSoftInputMode
(
mSoftInputMode
);
}
if
(
mOnDismissListener
!=
null
)
{
popupWindow
.
setOnDismissListener
(
mOnDismissListener
);
}
if
(
mOnTouchListener
!=
null
)
{
popupWindow
.
setTouchInterceptor
(
mOnTouchListener
);
}
popupWindow
.
setTouchable
(
mTouchable
);
}
private
PopupWindow
build
()
{
if
(
mContentView
==
null
)
{
mContentView
=
LayoutInflater
.
from
(
mContext
).
inflate
(
mResLayoutId
,
null
);
}
if
(
mWidth
!=
0
&&
mHeight
!=
0
)
{
mPopupWindow
=
new
PopupWindow
(
mContentView
,
mWidth
,
mHeight
);
}
else
{
mPopupWindow
=
new
PopupWindow
(
mContentView
,
ViewGroup
.
LayoutParams
.
WRAP_CONTENT
,
ViewGroup
.
LayoutParams
.
WRAP_CONTENT
);
}
if
(
mAnimationStyle
!=
-
1
)
{
mPopupWindow
.
setAnimationStyle
(
mAnimationStyle
);
}
apply
(
mPopupWindow
);
//设置一些属性
mPopupWindow
.
setFocusable
(
mIsFocusable
);
mPopupWindow
.
setBackgroundDrawable
(
new
ColorDrawable
());
mPopupWindow
.
setOutsideTouchable
(
mIsOutside
);
if
(
mWidth
==
0
||
mHeight
==
0
)
{
mPopupWindow
.
getContentView
().
measure
(
View
.
MeasureSpec
.
UNSPECIFIED
,
View
.
MeasureSpec
.
UNSPECIFIED
);
//如果外面没有设置宽高的情况下,计算宽高并赋值
mWidth
=
mPopupWindow
.
getContentView
().
getMeasuredWidth
();
mHeight
=
mPopupWindow
.
getContentView
().
getMeasuredHeight
();
}
mPopupWindow
.
update
();
return
mPopupWindow
;
}
public
View
getmContentView
()
{
return
mContentView
;
}
public
void
setmContentView
(
View
mContentView
)
{
this
.
mContentView
=
mContentView
;
}
/**
* 关闭popWindow
*/
public
void
dissmiss
()
{
if
(
mPopupWindow
!=
null
)
{
mPopupWindow
.
dismiss
();
}
}
public
static
class
PopupWindowBuilder
{
private
SobotBasePopupWindow
mHwbPopWindow
;
public
PopupWindowBuilder
(
Context
context
)
{
mHwbPopWindow
=
new
SobotBasePopupWindow
(
context
);
}
public
PopupWindowBuilder
size
(
int
width
,
int
height
)
{
mHwbPopWindow
.
mWidth
=
width
;
mHwbPopWindow
.
mHeight
=
height
;
return
this
;
}
public
PopupWindowBuilder
setFocusable
(
boolean
focusable
)
{
mHwbPopWindow
.
mIsFocusable
=
focusable
;
return
this
;
}
public
PopupWindowBuilder
setView
(
int
resLayoutId
)
{
mHwbPopWindow
.
mResLayoutId
=
resLayoutId
;
mHwbPopWindow
.
mContentView
=
null
;
return
this
;
}
public
PopupWindowBuilder
setView
(
View
view
)
{
mHwbPopWindow
.
mContentView
=
view
;
mHwbPopWindow
.
mResLayoutId
=
-
1
;
return
this
;
}
public
PopupWindowBuilder
setOutsideTouchable
(
boolean
outsideTouchable
)
{
mHwbPopWindow
.
mIsOutside
=
outsideTouchable
;
return
this
;
}
/**
* 设置弹窗动画
*
* @param animationStyle
* @return
*/
public
PopupWindowBuilder
setAnimationStyle
(
int
animationStyle
)
{
mHwbPopWindow
.
mAnimationStyle
=
animationStyle
;
return
this
;
}
public
PopupWindowBuilder
setClippingEnable
(
boolean
enable
)
{
mHwbPopWindow
.
mClippEnable
=
enable
;
return
this
;
}
public
PopupWindowBuilder
setIgnoreCheekPress
(
boolean
ignoreCheekPress
)
{
mHwbPopWindow
.
mIgnoreCheekPress
=
ignoreCheekPress
;
return
this
;
}
public
PopupWindowBuilder
setInputMethodMode
(
int
mode
)
{
mHwbPopWindow
.
mInputMode
=
mode
;
return
this
;
}
public
PopupWindowBuilder
setOnDissmissListener
(
PopupWindow
.
OnDismissListener
onDissmissListener
)
{
mHwbPopWindow
.
mOnDismissListener
=
onDissmissListener
;
return
this
;
}
public
PopupWindowBuilder
setSoftInputMode
(
int
softInputMode
)
{
mHwbPopWindow
.
mSoftInputMode
=
softInputMode
;
return
this
;
}
public
PopupWindowBuilder
setTouchable
(
boolean
touchable
)
{
mHwbPopWindow
.
mTouchable
=
touchable
;
return
this
;
}
public
PopupWindowBuilder
setTouchIntercepter
(
View
.
OnTouchListener
touchIntercepter
)
{
mHwbPopWindow
.
mOnTouchListener
=
touchIntercepter
;
return
this
;
}
public
SobotBasePopupWindow
create
()
{
//构建PopWindow
mHwbPopWindow
.
build
();
return
mHwbPopWindow
;
}
}
}
\ No newline at end of file
sobot_widget/src/main/java/com/sobot/widget/refresh/layout/header/ClassicsHeader.java
View file @
04b868ae
...
@@ -210,7 +210,8 @@ public class ClassicsHeader extends ClassicsAbstract<ClassicsHeader> implements
...
@@ -210,7 +210,8 @@ public class ClassicsHeader extends ClassicsAbstract<ClassicsHeader> implements
}
else
{
}
else
{
mTextUpdate
=
context
.
getString
(
R
.
string
.
sobot_srl_header_update
);
mTextUpdate
=
context
.
getString
(
R
.
string
.
sobot_srl_header_update
);
}
}
mLastUpdateFormat
=
new
SimpleDateFormat
(
mTextUpdate
,
Locale
.
getDefault
());
mLastUpdateFormat
=
new
SimpleDateFormat
(
"MM-dd HH:mm"
);
ta
.
recycle
();
ta
.
recycle
();
...
@@ -299,7 +300,7 @@ public class ClassicsHeader extends ClassicsAbstract<ClassicsHeader> implements
...
@@ -299,7 +300,7 @@ public class ClassicsHeader extends ClassicsAbstract<ClassicsHeader> implements
public
ClassicsHeader
setLastUpdateTime
(
Date
time
)
{
public
ClassicsHeader
setLastUpdateTime
(
Date
time
)
{
final
View
thisView
=
this
;
final
View
thisView
=
this
;
mLastTime
=
time
;
mLastTime
=
time
;
mLastUpdateText
.
setText
(
mLastUpdateFormat
.
format
(
time
));
mLastUpdateText
.
setText
(
String
.
format
(
mTextUpdate
,
mLastUpdateFormat
.
format
(
time
)
));
if
(
mShared
!=
null
&&
!
thisView
.
isInEditMode
())
{
if
(
mShared
!=
null
&&
!
thisView
.
isInEditMode
())
{
mShared
.
edit
().
putLong
(
KEY_LAST_UPDATE_TIME
,
time
.
getTime
()).
apply
();
mShared
.
edit
().
putLong
(
KEY_LAST_UPDATE_TIME
,
time
.
getTime
()).
apply
();
}
}
...
@@ -309,7 +310,7 @@ public class ClassicsHeader extends ClassicsAbstract<ClassicsHeader> implements
...
@@ -309,7 +310,7 @@ public class ClassicsHeader extends ClassicsAbstract<ClassicsHeader> implements
public
ClassicsHeader
setTimeFormat
(
DateFormat
format
)
{
public
ClassicsHeader
setTimeFormat
(
DateFormat
format
)
{
mLastUpdateFormat
=
format
;
mLastUpdateFormat
=
format
;
if
(
mLastTime
!=
null
)
{
if
(
mLastTime
!=
null
)
{
mLastUpdateText
.
setText
(
mLastUpdateFormat
.
format
(
mLastTime
));
mLastUpdateText
.
setText
(
String
.
format
(
mTextUpdate
,
mLastUpdateFormat
.
format
(
mLastTime
)
));
}
}
return
this
;
return
this
;
}
}
...
...
sobot_widget/src/main/java/com/sobot/widget/ui/base/SobotBaseActivity.java
View file @
04b868ae
...
@@ -19,13 +19,12 @@ import android.view.View;
...
@@ -19,13 +19,12 @@ import android.view.View;
import
android.view.Window
;
import
android.view.Window
;
import
android.view.WindowManager
;
import
android.view.WindowManager
;
import
android.webkit.WebView
;
import
android.webkit.WebView
;
import
android.widget.ImageView
;
import
android.widget.LinearLayout
;
import
android.widget.LinearLayout
;
import
android.widget.RelativeLayout
;
import
android.widget.RelativeLayout
;
import
android.widget.TextView
;
import
android.widget.TextView
;
import
androidx.annotation.Nullable
;
import
androidx.annotation.Nullable
;
import
androidx.appcompat.app.AppCompatActivity
;
import
androidx.appcompat.app.AppCompatDelegate
;
import
androidx.core.app.ActivityCompat
;
import
androidx.core.app.ActivityCompat
;
import
androidx.core.content.ContextCompat
;
import
androidx.core.content.ContextCompat
;
import
androidx.fragment.app.FragmentActivity
;
import
androidx.fragment.app.FragmentActivity
;
...
@@ -126,7 +125,7 @@ public abstract class SobotBaseActivity extends FragmentActivity {
...
@@ -126,7 +125,7 @@ public abstract class SobotBaseActivity extends FragmentActivity {
if
(
view
instanceof
WebView
&&
view
.
getParent
()
instanceof
LinearLayout
)
{
if
(
view
instanceof
WebView
&&
view
.
getParent
()
instanceof
LinearLayout
)
{
LinearLayout
.
LayoutParams
layoutParams
=
(
LinearLayout
.
LayoutParams
)
view
.
getLayoutParams
();
LinearLayout
.
LayoutParams
layoutParams
=
(
LinearLayout
.
LayoutParams
)
view
.
getLayoutParams
();
layoutParams
.
rightMargin
=
(
rect
.
right
>
110
?
110
:
rect
.
right
)
+
14
;
layoutParams
.
rightMargin
=
(
rect
.
right
>
110
?
110
:
rect
.
right
)
+
14
;
layoutParams
.
leftMargin
=
(
rect
.
right
>
110
?
110
:
rect
.
right
)
+
14
;
layoutParams
.
leftMargin
=
(
Math
.
min
(
rect
.
right
,
110
)
)
+
14
;
view
.
setLayoutParams
(
layoutParams
);
view
.
setLayoutParams
(
layoutParams
);
}
else
if
(
view
instanceof
WebView
&&
view
.
getParent
()
instanceof
RelativeLayout
)
{
}
else
if
(
view
instanceof
WebView
&&
view
.
getParent
()
instanceof
RelativeLayout
)
{
RelativeLayout
.
LayoutParams
layoutParams
=
(
RelativeLayout
.
LayoutParams
)
view
.
getLayoutParams
();
RelativeLayout
.
LayoutParams
layoutParams
=
(
RelativeLayout
.
LayoutParams
)
view
.
getLayoutParams
();
...
@@ -180,7 +179,7 @@ public abstract class SobotBaseActivity extends FragmentActivity {
...
@@ -180,7 +179,7 @@ public abstract class SobotBaseActivity extends FragmentActivity {
public
void
changeAppLanguage
()
{
public
void
changeAppLanguage
()
{
try
{
try
{
Locale
locale
=
(
Locale
)
SobotSharedPreferencesUtil
.
getInstance
(
getSobotBase
Context
()).
get
(
"SobotLanguage"
,
Locale
.
class
);
Locale
locale
=
(
Locale
)
SobotSharedPreferencesUtil
.
getInstance
(
getSobotBase
Activity
()).
get
(
"SobotLanguage"
,
Locale
.
class
);
if
(
locale
==
null
)
{
if
(
locale
==
null
)
{
//获取系统语言
//获取系统语言
locale
=
getSysPreferredLocale
();
locale
=
getSysPreferredLocale
();
...
@@ -273,6 +272,10 @@ public abstract class SobotBaseActivity extends FragmentActivity {
...
@@ -273,6 +272,10 @@ public abstract class SobotBaseActivity extends FragmentActivity {
return
findViewById
(
getResId
(
"sobot_tv_right"
));
return
findViewById
(
getResId
(
"sobot_tv_right"
));
}
}
protected
ImageView
getRightIcon
()
{
return
findViewById
(
getResId
(
"call_icon"
));
}
protected
View
getTitleView
()
{
protected
View
getTitleView
()
{
return
findViewById
(
getResId
(
"sobot_text_title"
));
return
findViewById
(
getResId
(
"sobot_text_title"
));
}
}
...
@@ -633,6 +636,7 @@ public abstract class SobotBaseActivity extends FragmentActivity {
...
@@ -633,6 +636,7 @@ public abstract class SobotBaseActivity extends FragmentActivity {
intent
.
putExtra
(
"selectType"
,
selectType
);
intent
.
putExtra
(
"selectType"
,
selectType
);
startActivityForResult
(
intent
,
SobotBaseConstant
.
REQUEST_CODE_PICTURE
);
startActivityForResult
(
intent
,
SobotBaseConstant
.
REQUEST_CODE_PICTURE
);
}
}
/**
/**
* 检查存储权限
* 检查存储权限
*
*
...
...
sobot_widget/src/main/java/com/sobot/widget/ui/calenderview/CalendarUtil.java
View file @
04b868ae
...
@@ -634,7 +634,6 @@ public final class CalendarUtil {
...
@@ -634,7 +634,6 @@ public final class CalendarUtil {
if
(
calendarDate
.
equals
(
currentDate
))
{
if
(
calendarDate
.
equals
(
currentDate
))
{
calendarDate
.
setCurrentDay
(
true
);
calendarDate
.
setCurrentDay
(
true
);
}
}
LunarCalendar
.
setupLunarCalendar
(
calendarDate
);
mItems
.
add
(
calendarDate
);
mItems
.
add
(
calendarDate
);
}
}
return
mItems
;
return
mItems
;
...
@@ -701,7 +700,6 @@ public final class CalendarUtil {
...
@@ -701,7 +700,6 @@ public final class CalendarUtil {
if
(
selectCalendar
.
equals
(
mDelegate
.
getCurrentDay
()))
{
if
(
selectCalendar
.
equals
(
mDelegate
.
getCurrentDay
()))
{
selectCalendar
.
setCurrentDay
(
true
);
selectCalendar
.
setCurrentDay
(
true
);
}
}
LunarCalendar
.
setupLunarCalendar
(
selectCalendar
);
selectCalendar
.
setCurrentMonth
(
true
);
selectCalendar
.
setCurrentMonth
(
true
);
mItems
.
add
(
selectCalendar
);
mItems
.
add
(
selectCalendar
);
...
@@ -715,7 +713,6 @@ public final class CalendarUtil {
...
@@ -715,7 +713,6 @@ public final class CalendarUtil {
if
(
calendarDate
.
equals
(
mDelegate
.
getCurrentDay
()))
{
if
(
calendarDate
.
equals
(
mDelegate
.
getCurrentDay
()))
{
calendarDate
.
setCurrentDay
(
true
);
calendarDate
.
setCurrentDay
(
true
);
}
}
LunarCalendar
.
setupLunarCalendar
(
calendarDate
);
calendarDate
.
setCurrentMonth
(
true
);
calendarDate
.
setCurrentMonth
(
true
);
mItems
.
add
(
calendarDate
);
mItems
.
add
(
calendarDate
);
}
}
...
@@ -808,7 +805,6 @@ public final class CalendarUtil {
...
@@ -808,7 +805,6 @@ public final class CalendarUtil {
calendar
.
setCurrentMonth
(
calendar
.
getYear
()
==
delegate
.
getCurrentDay
().
getYear
()
&&
calendar
.
setCurrentMonth
(
calendar
.
getYear
()
==
delegate
.
getCurrentDay
().
getYear
()
&&
calendar
.
getMonth
()
==
delegate
.
getCurrentDay
().
getMonth
());
calendar
.
getMonth
()
==
delegate
.
getCurrentDay
().
getMonth
());
calendar
.
setCurrentDay
(
calendar
.
equals
(
delegate
.
getCurrentDay
()));
calendar
.
setCurrentDay
(
calendar
.
equals
(
delegate
.
getCurrentDay
()));
LunarCalendar
.
setupLunarCalendar
(
calendar
);
return
calendar
;
return
calendar
;
}
}
...
...
sobot_widget/src/main/java/com/sobot/widget/ui/calenderview/CalendarViewDelegate.java
View file @
04b868ae
...
@@ -424,7 +424,6 @@ final class CalendarViewDelegate {
...
@@ -424,7 +424,6 @@ final class CalendarViewDelegate {
CalendarViewDelegate
(
Context
context
,
@Nullable
AttributeSet
attrs
)
{
CalendarViewDelegate
(
Context
context
,
@Nullable
AttributeSet
attrs
)
{
TypedArray
array
=
context
.
obtainStyledAttributes
(
attrs
,
R
.
styleable
.
Sobot_CalendarView
);
TypedArray
array
=
context
.
obtainStyledAttributes
(
attrs
,
R
.
styleable
.
Sobot_CalendarView
);
LunarCalendar
.
init
(
context
);
mCalendarPadding
=
(
int
)
array
.
getDimension
(
R
.
styleable
.
Sobot_CalendarView_sobot_calendar_padding
,
0
);
mCalendarPadding
=
(
int
)
array
.
getDimension
(
R
.
styleable
.
Sobot_CalendarView_sobot_calendar_padding
,
0
);
mCalendarPaddingLeft
=
(
int
)
array
.
getDimension
(
R
.
styleable
.
Sobot_CalendarView_sobot_calendar_padding_left
,
0
);
mCalendarPaddingLeft
=
(
int
)
array
.
getDimension
(
R
.
styleable
.
Sobot_CalendarView_sobot_calendar_padding_left
,
0
);
...
@@ -557,7 +556,6 @@ final class CalendarViewDelegate {
...
@@ -557,7 +556,6 @@ final class CalendarViewDelegate {
mCurrentDate
.
setMonth
(
CalendarUtil
.
getDate
(
"MM"
,
d
));
mCurrentDate
.
setMonth
(
CalendarUtil
.
getDate
(
"MM"
,
d
));
mCurrentDate
.
setDay
(
CalendarUtil
.
getDate
(
"dd"
,
d
));
mCurrentDate
.
setDay
(
CalendarUtil
.
getDate
(
"dd"
,
d
));
mCurrentDate
.
setCurrentDay
(
true
);
mCurrentDate
.
setCurrentDay
(
true
);
LunarCalendar
.
setupLunarCalendar
(
mCurrentDate
);
setRange
(
mMinYear
,
mMinYearMonth
,
mMaxYear
,
mMaxYearMonth
);
setRange
(
mMinYear
,
mMinYearMonth
,
mMaxYear
,
mMaxYearMonth
);
try
{
try
{
...
@@ -969,7 +967,6 @@ final class CalendarViewDelegate {
...
@@ -969,7 +967,6 @@ final class CalendarViewDelegate {
mCurrentDate
.
setYear
(
CalendarUtil
.
getDate
(
"yyyy"
,
d
));
mCurrentDate
.
setYear
(
CalendarUtil
.
getDate
(
"yyyy"
,
d
));
mCurrentDate
.
setMonth
(
CalendarUtil
.
getDate
(
"MM"
,
d
));
mCurrentDate
.
setMonth
(
CalendarUtil
.
getDate
(
"MM"
,
d
));
mCurrentDate
.
setDay
(
CalendarUtil
.
getDate
(
"dd"
,
d
));
mCurrentDate
.
setDay
(
CalendarUtil
.
getDate
(
"dd"
,
d
));
LunarCalendar
.
setupLunarCalendar
(
mCurrentDate
);
}
}
@SuppressWarnings
(
"unused"
)
@SuppressWarnings
(
"unused"
)
...
@@ -1068,7 +1065,6 @@ final class CalendarViewDelegate {
...
@@ -1068,7 +1065,6 @@ final class CalendarViewDelegate {
calendar
.
setMonth
(
mCurrentDate
.
getMonth
());
calendar
.
setMonth
(
mCurrentDate
.
getMonth
());
calendar
.
setDay
(
mCurrentDate
.
getDay
());
calendar
.
setDay
(
mCurrentDate
.
getDay
());
calendar
.
setCurrentDay
(
true
);
calendar
.
setCurrentDay
(
true
);
LunarCalendar
.
setupLunarCalendar
(
calendar
);
return
calendar
;
return
calendar
;
}
}
...
@@ -1078,7 +1074,6 @@ final class CalendarViewDelegate {
...
@@ -1078,7 +1074,6 @@ final class CalendarViewDelegate {
calendar
.
setMonth
(
mMinYearMonth
);
calendar
.
setMonth
(
mMinYearMonth
);
calendar
.
setDay
(
mMinYearDay
);
calendar
.
setDay
(
mMinYearDay
);
calendar
.
setCurrentDay
(
calendar
.
equals
(
mCurrentDate
));
calendar
.
setCurrentDay
(
calendar
.
equals
(
mCurrentDate
));
LunarCalendar
.
setupLunarCalendar
(
calendar
);
return
calendar
;
return
calendar
;
}
}
...
@@ -1089,7 +1084,6 @@ final class CalendarViewDelegate {
...
@@ -1089,7 +1084,6 @@ final class CalendarViewDelegate {
calendar
.
setMonth
(
mMaxYearMonth
);
calendar
.
setMonth
(
mMaxYearMonth
);
calendar
.
setDay
(
mMaxYearDay
);
calendar
.
setDay
(
mMaxYearDay
);
calendar
.
setCurrentDay
(
calendar
.
equals
(
mCurrentDate
));
calendar
.
setCurrentDay
(
calendar
.
equals
(
mCurrentDate
));
LunarCalendar
.
setupLunarCalendar
(
calendar
);
return
calendar
;
return
calendar
;
}
}
...
@@ -1183,7 +1177,6 @@ final class CalendarViewDelegate {
...
@@ -1183,7 +1177,6 @@ final class CalendarViewDelegate {
calendar
.
setYear
(
date
.
get
(
java
.
util
.
Calendar
.
YEAR
));
calendar
.
setYear
(
date
.
get
(
java
.
util
.
Calendar
.
YEAR
));
calendar
.
setMonth
(
date
.
get
(
java
.
util
.
Calendar
.
MONTH
)
+
1
);
calendar
.
setMonth
(
date
.
get
(
java
.
util
.
Calendar
.
MONTH
)
+
1
);
calendar
.
setDay
(
date
.
get
(
java
.
util
.
Calendar
.
DAY_OF_MONTH
));
calendar
.
setDay
(
date
.
get
(
java
.
util
.
Calendar
.
DAY_OF_MONTH
));
LunarCalendar
.
setupLunarCalendar
(
calendar
);
updateCalendarScheme
(
calendar
);
updateCalendarScheme
(
calendar
);
if
(
mCalendarInterceptListener
!=
null
&&
if
(
mCalendarInterceptListener
!=
null
&&
mCalendarInterceptListener
.
onCalendarIntercept
(
calendar
))
{
mCalendarInterceptListener
.
onCalendarIntercept
(
calendar
))
{
...
...
sobot_widget/src/main/java/com/sobot/widget/ui/calenderview/CustomWeekBar.java
View file @
04b868ae
...
@@ -38,25 +38,46 @@ public class CustomWeekBar extends WeekBar {
...
@@ -38,25 +38,46 @@ public class CustomWeekBar extends WeekBar {
@Override
@Override
protected
void
onWeekStartChange
(
int
weekStart
)
{
protected
void
onWeekStartChange
(
int
weekStart
)
{
for
(
int
i
=
0
;
i
<
getChildCount
();
i
++)
{
for
(
int
i
=
0
;
i
<
getChildCount
();
i
++)
{
((
TextView
)
getChildAt
(
i
)).
setText
(
getWeekString
(
i
,
weekStart
));
int
receId
=
0
;
if
(
weekStart
==
1
)
{
//周日开始
if
(
i
==
0
){
receId
=
R
.
string
.
calendar_day
;
}
else
if
(
i
==
1
)
{
receId
=
R
.
string
.
calendar_one
;
}
else
if
(
i
==
2
)
{
receId
=
R
.
string
.
calendar_two
;
}
else
if
(
i
==
3
)
{
receId
=
R
.
string
.
calendar_three
;
}
else
if
(
i
==
4
)
{
receId
=
R
.
string
.
calendar_four
;
}
else
if
(
i
==
5
)
{
receId
=
R
.
string
.
calendar_five
;
}
else
if
(
i
==
6
)
{
receId
=
R
.
string
.
calendar_six
;
}
}
}
else
if
(
weekStart
==
2
)
{
//周一开始
if
(
i
==
0
)
{
receId
=
R
.
string
.
calendar_one
;
}
else
if
(
i
==
1
)
{
receId
=
R
.
string
.
calendar_two
;
}
else
if
(
i
==
2
)
{
receId
=
R
.
string
.
calendar_three
;
}
else
if
(
i
==
3
)
{
receId
=
R
.
string
.
calendar_four
;
}
else
if
(
i
==
4
)
{
receId
=
R
.
string
.
calendar_five
;
}
else
if
(
i
==
5
)
{
receId
=
R
.
string
.
calendar_six
;
}
else
if
(
i
==
6
)
{
receId
=
R
.
string
.
calendar_day
;
}
}
/**
* 或者周文本,这个方法仅供父类使用
* @param index index
* @param weekStart weekStart
* @return 或者周文本
*/
private
String
getWeekString
(
int
index
,
int
weekStart
)
{
String
[]
weeks
=
getContext
().
getResources
().
getStringArray
(
R
.
array
.
sobot_week_string_array
);
if
(
weekStart
==
1
)
{
return
weeks
[
index
];
}
}
if
(
weekStart
==
2
)
{
if
(
receId
!=
0
)
{
return
weeks
[
index
==
6
?
0
:
index
+
1
]
;
((
TextView
)
getChildAt
(
i
)).
setText
(
receId
)
;
}
}
return
weeks
[
index
==
0
?
6
:
index
-
1
];
}
}
}
}
}
sobot_widget/src/main/java/com/sobot/widget/ui/calenderview/LunarCalendar.java
deleted
100644 → 0
View file @
e700e43c
/*
* Copyright (C) 2016 huanghaibin_dev <huanghaibin_dev@163.com>
* WebSite https://github.com/MiracleTimes-Dev
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com
.
sobot
.
widget
.
ui
.
calenderview
;
import
android.annotation.SuppressLint
;
import
android.content.Context
;
import
android.text.TextUtils
;
import
com.sobot.widget.R
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* 农历计算相关
*/
@SuppressWarnings
(
"all"
)
public
final
class
LunarCalendar
{
static
void
init
(
Context
context
)
{
if
(
MONTH_STR
!=
null
)
{
return
;
}
TrunkBranchAnnals
.
init
(
context
);
SolarTermUtil
.
init
(
context
);
MONTH_STR
=
context
.
getResources
().
getStringArray
(
R
.
array
.
sobot_lunar_first_of_month
);
TRADITION_FESTIVAL_STR
=
context
.
getResources
().
getStringArray
(
R
.
array
.
sobot_tradition_festival
);
DAY_STR
=
context
.
getResources
().
getStringArray
(
R
.
array
.
sobot_lunar_str
);
SPECIAL_FESTIVAL_STR
=
context
.
getResources
().
getStringArray
(
R
.
array
.
sobot_special_festivals
);
SOLAR_CALENDAR
=
context
.
getResources
().
getStringArray
(
R
.
array
.
sobot_solar_festival
);
}
/**
* 农历月份第一天转写
*/
private
static
String
[]
MONTH_STR
=
null
;
/**
* 传统农历节日
*/
private
static
String
[]
TRADITION_FESTIVAL_STR
=
null
;
/**
* 农历大写
*/
private
static
String
[]
DAY_STR
=
null
;
/**
* 特殊节日的数组
*/
private
static
String
[]
SPECIAL_FESTIVAL_STR
=
null
;
/**
* 特殊节日、母亲节和父亲节,感恩节等
*/
@SuppressLint
(
"UseSparseArrays"
)
private
static
final
Map
<
Integer
,
String
[]>
SPECIAL_FESTIVAL
=
new
HashMap
<>();
/**
* 公历节日
*/
private
static
String
[]
SOLAR_CALENDAR
=
null
;
/**
* 保存每年24节气
*/
@SuppressLint
(
"UseSparseArrays"
)
private
static
final
Map
<
Integer
,
String
[]>
SOLAR_TERMS
=
new
HashMap
<>();
/**
* 返回传统农历节日
*
* @param year 农历年
* @param month 农历月
* @param day 农历日
* @return 返回传统农历节日
*/
private
static
String
getTraditionFestival
(
int
year
,
int
month
,
int
day
)
{
if
(
month
==
12
)
{
int
count
=
daysInLunarMonth
(
year
,
month
);
if
(
day
==
count
)
{
return
TRADITION_FESTIVAL_STR
[
0
];
//除夕
}
}
String
text
=
getString
(
month
,
day
);
String
festivalStr
=
""
;
for
(
String
festival
:
TRADITION_FESTIVAL_STR
)
{
if
(
festival
.
contains
(
text
))
{
festivalStr
=
festival
.
replace
(
text
,
""
);
break
;
}
}
return
festivalStr
;
}
/**
* 数字转换为汉字月份
*
* @param month 月
* @param leap 1==闰月
* @return 数字转换为汉字月份
*/
private
static
String
numToChineseMonth
(
int
month
,
int
leap
)
{
if
(
leap
==
1
)
{
return
"闰"
+
MONTH_STR
[
month
-
1
];
}
return
MONTH_STR
[
month
-
1
];
}
/**
* 数字转换为农历节日或者日期
*
* @param month 月
* @param day 日
* @param leap 1==闰月
* @return 数字转换为汉字日
*/
private
static
String
numToChinese
(
int
month
,
int
day
,
int
leap
)
{
if
(
day
==
1
)
{
return
numToChineseMonth
(
month
,
leap
);
}
return
DAY_STR
[
day
-
1
];
}
/**
* 用来表示1900年到2099年间农历年份的相关信息,共24位bit的16进制表示,其中:
* 1. 前4位表示该年闰哪个月;
* 2. 5-17位表示农历年份13个月的大小月分布,0表示小,1表示大;
* 3. 最后7位表示农历年首(正月初一)对应的公历日期。
* <p/>
* 以2014年的数据0x955ABF为例说明:
* 1001 0101 0101 1010 1011 1111
* 闰九月 农历正月初一对应公历1月31号
*/
private
static
final
int
[]
LUNAR_INFO
=
{
0x04bd8
,
0x04ae0
,
0x0a570
,
0x054d5
,
0x0d260
,
0x0d950
,
0x16554
,
0x056a0
,
0x09ad0
,
0x055d2
,
//1900-1909
0x04ae0
,
0x0a5b6
,
0x0a4d0
,
0x0d250
,
0x1d255
,
0x0b540
,
0x0d6a0
,
0x0ada2
,
0x095b0
,
0x14977
,
//1910-1919
0x04970
,
0x0a4b0
,
0x0b4b5
,
0x06a50
,
0x06d40
,
0x1ab54
,
0x02b60
,
0x09570
,
0x052f2
,
0x04970
,
//1920-1929
0x06566
,
0x0d4a0
,
0x0ea50
,
0x06e95
,
0x05ad0
,
0x02b60
,
0x186e3
,
0x092e0
,
0x1c8d7
,
0x0c950
,
//1930-1939
0x0d4a0
,
0x1d8a6
,
0x0b550
,
0x056a0
,
0x1a5b4
,
0x025d0
,
0x092d0
,
0x0d2b2
,
0x0a950
,
0x0b557
,
//1940-1949
0x06ca0
,
0x0b550
,
0x15355
,
0x04da0
,
0x0a5b0
,
0x14573
,
0x052b0
,
0x0a9a8
,
0x0e950
,
0x06aa0
,
//1950-1959
0x0aea6
,
0x0ab50
,
0x04b60
,
0x0aae4
,
0x0a570
,
0x05260
,
0x0f263
,
0x0d950
,
0x05b57
,
0x056a0
,
//1960-1969
0x096d0
,
0x04dd5
,
0x04ad0
,
0x0a4d0
,
0x0d4d4
,
0x0d250
,
0x0d558
,
0x0b540
,
0x0b6a0
,
0x195a6
,
//1970-1979
0x095b0
,
0x049b0
,
0x0a974
,
0x0a4b0
,
0x0b27a
,
0x06a50
,
0x06d40
,
0x0af46
,
0x0ab60
,
0x09570
,
//1980-1989
0x04af5
,
0x04970
,
0x064b0
,
0x074a3
,
0x0ea50
,
0x06b58
,
0x055c0
,
0x0ab60
,
0x096d5
,
0x092e0
,
//1990-1999
0x0c960
,
0x0d954
,
0x0d4a0
,
0x0da50
,
0x07552
,
0x056a0
,
0x0abb7
,
0x025d0
,
0x092d0
,
0x0cab5
,
//2000-2009
0x0a950
,
0x0b4a0
,
0x0baa4
,
0x0ad50
,
0x055d9
,
0x04ba0
,
0x0a5b0
,
0x15176
,
0x052b0
,
0x0a930
,
//2010-2019
0x07954
,
0x06aa0
,
0x0ad50
,
0x05b52
,
0x04b60
,
0x0a6e6
,
0x0a4e0
,
0x0d260
,
0x0ea65
,
0x0d530
,
//2020-2029
0x05aa0
,
0x076a3
,
0x096d0
,
0x04afb
,
0x04ad0
,
0x0a4d0
,
0x1d0b6
,
0x0d250
,
0x0d520
,
0x0dd45
,
//2030-2039
0x0b5a0
,
0x056d0
,
0x055b2
,
0x049b0
,
0x0a577
,
0x0a4b0
,
0x0aa50
,
0x1b255
,
0x06d20
,
0x0ada0
,
//2040-2049
0x14b63
,
0x09370
,
0x049f8
,
0x04970
,
0x064b0
,
0x168a6
,
0x0ea50
,
0x06b20
,
0x1a6c4
,
0x0aae0
,
//2050-2059
0x0a2e0
,
0x0d2e3
,
0x0c960
,
0x0d557
,
0x0d4a0
,
0x0da50
,
0x05d55
,
0x056a0
,
0x0a6d0
,
0x055d4
,
//2060-2069
0x052d0
,
0x0a9b8
,
0x0a950
,
0x0b4a0
,
0x0b6a6
,
0x0ad50
,
0x055a0
,
0x0aba4
,
0x0a5b0
,
0x052b0
,
//2070-2079
0x0b273
,
0x06930
,
0x07337
,
0x06aa0
,
0x0ad50
,
0x14b55
,
0x04b60
,
0x0a570
,
0x054e4
,
0x0d160
,
//2080-2089
0x0e968
,
0x0d520
,
0x0daa0
,
0x16aa6
,
0x056d0
,
0x04ae0
,
0x0a9d4
,
0x0a2d0
,
0x0d150
,
0x0f252
,
//2090-2099
0x0d520
};
/**
* 农历 year年month月的总天数,总共有13个月包括闰月
*
* @param year 将要计算的年份
* @param month 将要计算的月份
* @return 传回农历 year年month月的总天数
*/
public
static
int
daysInLunarMonth
(
int
year
,
int
month
)
{
if
((
LUNAR_INFO
[
year
-
CalendarViewDelegate
.
MIN_YEAR
]
&
(
0x10000
>>
month
))
==
0
)
return
29
;
else
return
30
;
}
/**
* 获取公历节日
*
* @param month 公历月份
* @param day 公历日期
* @return 公历节日
*/
private
static
String
gregorianFestival
(
int
month
,
int
day
)
{
String
text
=
getString
(
month
,
day
);
String
solar
=
""
;
for
(
String
aMSolarCalendar
:
SOLAR_CALENDAR
)
{
if
(
aMSolarCalendar
.
contains
(
text
))
{
solar
=
aMSolarCalendar
.
replace
(
text
,
""
);
break
;
}
}
return
solar
;
}
private
static
String
getString
(
int
month
,
int
day
)
{
return
(
month
>=
10
?
String
.
valueOf
(
month
)
:
"0"
+
month
)
+
(
day
>=
10
?
day
:
"0"
+
day
);
}
/**
* 返回24节气
*
* @param year 年
* @param month 月
* @param day 日
* @return 返回24节气
*/
private
static
String
getSolarTerm
(
int
year
,
int
month
,
int
day
)
{
if
(!
SOLAR_TERMS
.
containsKey
(
year
))
{
SOLAR_TERMS
.
put
(
year
,
SolarTermUtil
.
getSolarTerms
(
year
));
}
String
[]
solarTerm
=
SOLAR_TERMS
.
get
(
year
);
String
text
=
year
+
getString
(
month
,
day
);
String
solar
=
""
;
assert
solarTerm
!=
null
;
for
(
String
solarTermName
:
solarTerm
)
{
if
(
solarTermName
.
contains
(
text
))
{
solar
=
solarTermName
.
replace
(
text
,
""
);
break
;
}
}
return
solar
;
}
/**
* 获取农历节日
*
* @param year 年
* @param month 月
* @param day 日
* @return 农历节日
*/
public
static
String
getLunarText
(
int
year
,
int
month
,
int
day
)
{
String
termText
=
LunarCalendar
.
getSolarTerm
(
year
,
month
,
day
);
String
solar
=
LunarCalendar
.
gregorianFestival
(
month
,
day
);
if
(!
TextUtils
.
isEmpty
(
solar
))
return
solar
;
if
(!
TextUtils
.
isEmpty
(
termText
))
return
termText
;
int
[]
lunar
=
LunarUtil
.
solarToLunar
(
year
,
month
,
day
);
String
festival
=
getTraditionFestival
(
lunar
[
0
],
lunar
[
1
],
lunar
[
2
]);
if
(!
TextUtils
.
isEmpty
(
festival
))
return
festival
;
return
LunarCalendar
.
numToChinese
(
lunar
[
1
],
lunar
[
2
],
lunar
[
3
]);
}
/**
* 获取特殊计算方式的节日
* 如:每年五月的第二个星期日为母亲节,六月的第三个星期日为父亲节
* 每年11月第四个星期四定为"感恩节"
*
* @param year year
* @param month month
* @param day day
* @return 获取西方节日
*/
private
static
String
getSpecialFestival
(
int
year
,
int
month
,
int
day
)
{
if
(!
SPECIAL_FESTIVAL
.
containsKey
(
year
))
{
SPECIAL_FESTIVAL
.
put
(
year
,
getSpecialFestivals
(
year
));
}
String
[]
specialFestivals
=
SPECIAL_FESTIVAL
.
get
(
year
);
String
text
=
year
+
getString
(
month
,
day
);
String
solar
=
""
;
assert
specialFestivals
!=
null
;
for
(
String
special
:
specialFestivals
)
{
if
(
special
.
contains
(
text
))
{
solar
=
special
.
replace
(
text
,
""
);
break
;
}
}
return
solar
;
}
/**
* 获取每年的母亲节和父亲节和感恩节
* 特殊计算方式的节日
*
* @param year 年
* @return 获取每年的母亲节和父亲节、感恩节
*/
private
static
String
[]
getSpecialFestivals
(
int
year
)
{
String
[]
festivals
=
new
String
[
3
];
java
.
util
.
Calendar
date
=
java
.
util
.
Calendar
.
getInstance
();
date
.
set
(
year
,
4
,
1
);
int
week
=
date
.
get
(
java
.
util
.
Calendar
.
DAY_OF_WEEK
);
int
startDiff
=
7
-
week
+
1
;
if
(
startDiff
==
7
)
{
festivals
[
0
]
=
dateToString
(
year
,
5
,
startDiff
+
1
)
+
SPECIAL_FESTIVAL_STR
[
0
];
}
else
{
festivals
[
0
]
=
dateToString
(
year
,
5
,
startDiff
+
7
+
1
)
+
SPECIAL_FESTIVAL_STR
[
0
];
}
date
.
set
(
year
,
5
,
1
);
week
=
date
.
get
(
java
.
util
.
Calendar
.
DAY_OF_WEEK
);
startDiff
=
7
-
week
+
1
;
if
(
startDiff
==
7
)
{
festivals
[
1
]
=
dateToString
(
year
,
6
,
startDiff
+
7
+
1
)
+
SPECIAL_FESTIVAL_STR
[
1
];
}
else
{
festivals
[
1
]
=
dateToString
(
year
,
6
,
startDiff
+
7
+
7
+
1
)
+
SPECIAL_FESTIVAL_STR
[
1
];
}
date
.
set
(
year
,
10
,
1
);
week
=
date
.
get
(
java
.
util
.
Calendar
.
DAY_OF_WEEK
);
startDiff
=
7
-
week
+
1
;
if
(
startDiff
<=
2
)
{
festivals
[
2
]
=
dateToString
(
year
,
11
,
startDiff
+
21
+
5
)
+
SPECIAL_FESTIVAL_STR
[
2
];
}
else
{
festivals
[
2
]
=
dateToString
(
year
,
11
,
startDiff
+
14
+
5
)
+
SPECIAL_FESTIVAL_STR
[
2
];
}
return
festivals
;
}
private
static
String
dateToString
(
int
year
,
int
month
,
int
day
)
{
return
year
+
getString
(
month
,
day
);
}
/**
* 初始化各种农历、节日
*
* @param calendar calendar
*/
public
static
void
setupLunarCalendar
(
Calendar
calendar
)
{
int
year
=
calendar
.
getYear
();
int
month
=
calendar
.
getMonth
();
int
day
=
calendar
.
getDay
();
calendar
.
setWeekend
(
CalendarUtil
.
isWeekend
(
calendar
));
calendar
.
setWeek
(
CalendarUtil
.
getWeekFormCalendar
(
calendar
));
Calendar
lunarCalendar
=
new
Calendar
();
calendar
.
setLunarCalendar
(
lunarCalendar
);
int
[]
lunar
=
LunarUtil
.
solarToLunar
(
year
,
month
,
day
);
lunarCalendar
.
setYear
(
lunar
[
0
]);
lunarCalendar
.
setMonth
(
lunar
[
1
]);
lunarCalendar
.
setDay
(
lunar
[
2
]);
calendar
.
setLeapYear
(
CalendarUtil
.
isLeapYear
(
year
));
if
(
lunar
[
3
]
==
1
)
{
//如果是闰月
calendar
.
setLeapMonth
(
lunar
[
1
]);
lunarCalendar
.
setLeapMonth
(
lunar
[
1
]);
}
String
solarTerm
=
LunarCalendar
.
getSolarTerm
(
year
,
month
,
day
);
String
gregorian
=
LunarCalendar
.
gregorianFestival
(
month
,
day
);
String
festival
=
getTraditionFestival
(
lunar
[
0
],
lunar
[
1
],
lunar
[
2
]);
String
lunarText
=
LunarCalendar
.
numToChinese
(
lunar
[
1
],
lunar
[
2
],
lunar
[
3
]);
if
(
TextUtils
.
isEmpty
(
gregorian
))
{
gregorian
=
getSpecialFestival
(
year
,
month
,
day
);
}
calendar
.
setSolarTerm
(
solarTerm
);
calendar
.
setGregorianFestival
(
gregorian
);
calendar
.
setTraditionFestival
(
festival
);
lunarCalendar
.
setTraditionFestival
(
festival
);
lunarCalendar
.
setSolarTerm
(
solarTerm
);
if
(!
TextUtils
.
isEmpty
(
solarTerm
))
{
calendar
.
setLunar
(
solarTerm
);
}
else
if
(!
TextUtils
.
isEmpty
(
gregorian
))
{
calendar
.
setLunar
(
gregorian
);
}
else
if
(!
TextUtils
.
isEmpty
(
festival
))
{
calendar
.
setLunar
(
festival
);
}
else
{
calendar
.
setLunar
(
lunarText
);
}
lunarCalendar
.
setLunar
(
lunarText
);
}
/**
* 获取农历节日
*
* @param calendar calendar
* @return 获取农历节日
*/
public
static
String
getLunarText
(
Calendar
calendar
)
{
return
getLunarText
(
calendar
.
getYear
(),
calendar
.
getMonth
(),
calendar
.
getDay
());
}
}
sobot_widget/src/main/java/com/sobot/widget/ui/calenderview/MonthViewPager.java
View file @
04b868ae
...
@@ -305,7 +305,6 @@ public final class MonthViewPager extends ViewPager {
...
@@ -305,7 +305,6 @@ public final class MonthViewPager extends ViewPager {
calendar
.
setMonth
(
month
);
calendar
.
setMonth
(
month
);
calendar
.
setDay
(
day
);
calendar
.
setDay
(
day
);
calendar
.
setCurrentDay
(
calendar
.
equals
(
mDelegate
.
getCurrentDay
()));
calendar
.
setCurrentDay
(
calendar
.
equals
(
mDelegate
.
getCurrentDay
()));
LunarCalendar
.
setupLunarCalendar
(
calendar
);
mDelegate
.
mIndexCalendar
=
calendar
;
mDelegate
.
mIndexCalendar
=
calendar
;
mDelegate
.
mSelectedCalendar
=
calendar
;
mDelegate
.
mSelectedCalendar
=
calendar
;
mDelegate
.
updateSelectCalendarScheme
();
mDelegate
.
updateSelectCalendarScheme
();
...
...
sobot_widget/src/main/java/com/sobot/widget/ui/calenderview/SolarTermUtil.java
View file @
04b868ae
...
@@ -27,15 +27,6 @@ import com.sobot.widget.R;
...
@@ -27,15 +27,6 @@ import com.sobot.widget.R;
public
final
class
SolarTermUtil
{
public
final
class
SolarTermUtil
{
static
void
init
(
Context
context
)
{
SOLAR_TERMS
=
context
.
getResources
().
getStringArray
(
R
.
array
.
sobot_solar_term
);
}
/**
* 24节气
*/
private
static
String
SOLAR_TERMS
[]
=
null
;
/**
/**
* 每弧度的角秒数
* 每弧度的角秒数
*/
*/
...
@@ -573,66 +564,6 @@ public final class SolarTermUtil {
...
@@ -573,66 +564,6 @@ public final class SolarTermUtil {
}
}
/**
* 获得某一年24节气
*
* @param year 年
* @return 24节气
*/
public
static
String
[]
getSolarTerms
(
int
year
)
{
String
[]
solarTerms
=
new
String
[
24
];
String
[]
preOffset
=
getSolarTermsPreOffset
(
year
-
1
);
String
[]
nextOffset
=
getSolarTermsNextOffset
(
year
-
1
);
System
.
arraycopy
(
preOffset
,
0
,
solarTerms
,
0
,
preOffset
.
length
);
System
.
arraycopy
(
nextOffset
,
0
,
solarTerms
,
22
,
nextOffset
.
length
);
double
jd
=
365.2422
*
(
year
-
2000
),
q
;
for
(
int
i
=
0
;
i
<
19
;
i
++)
{
q
=
getTimeFromAngle
(
jd
+
i
*
15.2
,
i
*
15
,
0
);
q
=
q
+
J2000
+
(
double
)
8
/
24
;
// 计算第i个节气(i=0是春分),结果转为北京时
Time
time
=
setFromJulian
(
q
,
true
);
solarTerms
[
i
+
3
]
=
time
.
toString
()
+
SOLAR_TERMS
[
i
];
}
return
solarTerms
;
}
/**
* 要获得2018年24节气需要传入2017年
*
* @param year 要获得2018年24节气需要传入2017年
* @return 返回 立春 雨水 惊蛰
*/
private
static
String
[]
getSolarTermsPreOffset
(
int
year
)
{
String
[]
solarTerms
=
new
String
[
3
];
double
jd
=
365.2422
*
(
year
-
2000
),
q
;
for
(
int
i
=
21
;
i
<
24
;
i
++)
{
q
=
getTimeFromAngle
(
jd
+
i
*
15.2
,
i
*
15
,
0
);
q
=
q
+
J2000
+
(
double
)
8
/
24
;
// 计算第i个节气(i=0是春分)
Time
time
=
setFromJulian
(
q
,
true
);
solarTerms
[
i
-
21
]
=
time
.
toString
()
+
SOLAR_TERMS
[
i
];
}
return
solarTerms
;
}
/**
* 要获得2018年24节气需要传入2017年
*
* @param year 要获得2018年24节气需要传入2017年
* @return 返回 小寒大寒
*/
private
static
String
[]
getSolarTermsNextOffset
(
int
year
)
{
String
[]
solarTerms
=
new
String
[
2
];
double
jd
=
365.2422
*
(
year
-
2000
),
q
;
for
(
int
i
=
19
;
i
<
21
;
i
++)
{
q
=
getTimeFromAngle
(
jd
+
i
*
15.2
,
i
*
15
,
0
);
q
=
q
+
J2000
+
(
double
)
8
/
24
;
// 计算第i个节气(i=0是春分)
Time
time
=
setFromJulian
(
q
,
true
);
solarTerms
[
i
-
19
]
=
time
.
toString
()
+
SOLAR_TERMS
[
i
];
}
return
solarTerms
;
}
/**
/**
* 章动
* 章动
...
...
sobot_widget/src/main/java/com/sobot/widget/ui/calenderview/TrunkBranchAnnals.java
deleted
100644 → 0
View file @
e700e43c
package
com
.
sobot
.
widget
.
ui
.
calenderview
;
import
android.content.Context
;
import
com.sobot.widget.R
;
/**
* 干支纪年算法
*/
@SuppressWarnings
(
"unused"
)
public
final
class
TrunkBranchAnnals
{
/**
* 天干字符串
*/
private
static
String
[]
TRUNK_STR
=
null
;
/**
* 地支字符串
*/
private
static
String
[]
BRANCH_STR
=
null
;
/**
* 单独使用请先调用这个方法
* @param context context
*/
public
static
void
init
(
Context
context
)
{
if
(
TRUNK_STR
!=
null
)
{
return
;
}
TRUNK_STR
=
context
.
getResources
().
getStringArray
(
R
.
array
.
sobot_trunk_string_array
);
BRANCH_STR
=
context
.
getResources
().
getStringArray
(
R
.
array
.
sobot_branch_string_array
);
}
/**
* 获取某一年对应天干文字
*
* @param year 年份
* @return 天干由甲到癸,每10一轮回
*/
@SuppressWarnings
(
"all"
)
public
static
String
getTrunkString
(
int
year
)
{
return
TRUNK_STR
[
getTrunkInt
(
year
)];
}
/**
* 获取某一年对应天干,
*
* @param year 年份
* @return 4 5 6 7 8 9 10 1 2 3
*/
@SuppressWarnings
(
"all"
)
public
static
int
getTrunkInt
(
int
year
)
{
int
trunk
=
year
%
10
;
return
trunk
==
0
?
9
:
trunk
-
1
;
}
/**
* 获取某一年对应地支文字
*
* @param year 年份
* @return 地支由子到亥,每12一轮回
*/
@SuppressWarnings
(
"all"
)
public
static
String
getBranchString
(
int
year
)
{
return
BRANCH_STR
[
getBranchInt
(
year
)];
}
/**
* 获取某一年对应地支
*
* @param year 年份
* @return 4 5 6 7 8 9 10 11 12 1 2 3
*/
@SuppressWarnings
(
"all"
)
public
static
int
getBranchInt
(
int
year
)
{
int
branch
=
year
%
12
;
return
branch
==
0
?
11
:
branch
-
1
;
}
/**
* 获取干支纪年
*
* @param year 年份
* @return 干支纪年
*/
public
static
String
getTrunkBranchYear
(
int
year
)
{
return
String
.
format
(
"%s%s"
,
getTrunkString
(
year
),
getBranchString
(
year
));
}
}
sobot_widget/src/main/java/com/sobot/widget/ui/calenderview/WeekBar.java
View file @
04b868ae
...
@@ -96,7 +96,45 @@ public class WeekBar extends LinearLayout {
...
@@ -96,7 +96,45 @@ public class WeekBar extends LinearLayout {
return
;
return
;
}
}
for
(
int
i
=
0
;
i
<
getChildCount
();
i
++)
{
for
(
int
i
=
0
;
i
<
getChildCount
();
i
++)
{
((
TextView
)
getChildAt
(
i
)).
setText
(
getWeekString
(
i
,
weekStart
));
int
receId
=
0
;
if
(
weekStart
==
1
)
{
//周日开始
if
(
i
==
0
){
receId
=
R
.
string
.
calendar_day
;
}
else
if
(
i
==
1
)
{
receId
=
R
.
string
.
calendar_one
;
}
else
if
(
i
==
2
)
{
receId
=
R
.
string
.
calendar_two
;
}
else
if
(
i
==
3
)
{
receId
=
R
.
string
.
calendar_three
;
}
else
if
(
i
==
4
)
{
receId
=
R
.
string
.
calendar_four
;
}
else
if
(
i
==
5
)
{
receId
=
R
.
string
.
calendar_five
;
}
else
if
(
i
==
6
)
{
receId
=
R
.
string
.
calendar_six
;
}
}
else
if
(
weekStart
==
2
)
{
//周一开始
if
(
i
==
0
)
{
receId
=
R
.
string
.
calendar_one
;
}
else
if
(
i
==
1
)
{
receId
=
R
.
string
.
calendar_two
;
}
else
if
(
i
==
2
)
{
receId
=
R
.
string
.
calendar_three
;
}
else
if
(
i
==
3
)
{
receId
=
R
.
string
.
calendar_four
;
}
else
if
(
i
==
4
)
{
receId
=
R
.
string
.
calendar_five
;
}
else
if
(
i
==
5
)
{
receId
=
R
.
string
.
calendar_six
;
}
else
if
(
i
==
6
)
{
receId
=
R
.
string
.
calendar_day
;
}
}
if
(
receId
!=
0
)
{
((
TextView
)
getChildAt
(
i
)).
setText
(
receId
);
}
}
}
}
}
...
@@ -119,25 +157,6 @@ public class WeekBar extends LinearLayout {
...
@@ -119,25 +157,6 @@ public class WeekBar extends LinearLayout {
return
week
==
CalendarViewDelegate
.
WEEK_START_WITH_SAT
?
0
:
week
;
return
week
==
CalendarViewDelegate
.
WEEK_START_WITH_SAT
?
0
:
week
;
}
}
/**
* 或者周文本,这个方法仅供父类使用
*
* @param index index
* @param weekStart weekStart
* @return 或者周文本
*/
private
String
getWeekString
(
int
index
,
int
weekStart
)
{
String
[]
weeks
=
getContext
().
getResources
().
getStringArray
(
R
.
array
.
sobot_week_string_array
);
if
(
weekStart
==
CalendarViewDelegate
.
WEEK_START_WITH_SUN
)
{
return
weeks
[
index
];
}
if
(
weekStart
==
CalendarViewDelegate
.
WEEK_START_WITH_MON
)
{
return
weeks
[
index
==
6
?
0
:
index
+
1
];
}
return
weeks
[
index
==
0
?
6
:
index
-
1
];
}
@Override
@Override
protected
void
onMeasure
(
int
widthMeasureSpec
,
int
heightMeasureSpec
)
{
protected
void
onMeasure
(
int
widthMeasureSpec
,
int
heightMeasureSpec
)
{
if
(
mDelegate
!=
null
)
{
if
(
mDelegate
!=
null
)
{
...
...
sobot_widget/src/main/java/com/sobot/widget/ui/calenderview/WeekViewPager.java
View file @
04b868ae
...
@@ -184,7 +184,6 @@ public final class WeekViewPager extends ViewPager {
...
@@ -184,7 +184,6 @@ public final class WeekViewPager extends ViewPager {
calendar
.
setMonth
(
month
);
calendar
.
setMonth
(
month
);
calendar
.
setDay
(
day
);
calendar
.
setDay
(
day
);
calendar
.
setCurrentDay
(
calendar
.
equals
(
mDelegate
.
getCurrentDay
()));
calendar
.
setCurrentDay
(
calendar
.
equals
(
mDelegate
.
getCurrentDay
()));
LunarCalendar
.
setupLunarCalendar
(
calendar
);
mDelegate
.
mIndexCalendar
=
calendar
;
mDelegate
.
mIndexCalendar
=
calendar
;
mDelegate
.
mSelectedCalendar
=
calendar
;
mDelegate
.
mSelectedCalendar
=
calendar
;
mDelegate
.
updateSelectCalendarScheme
();
mDelegate
.
updateSelectCalendarScheme
();
...
...
sobot_widget/src/main/res/layout/sobot_common_layout_titlebar.xml
View file @
04b868ae
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<
Relative
Layout
xmlns:android=
"http://schemas.android.com/apk/res/android"
<
Linear
Layout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
android:id=
"@+id/sobot_layout_titlebar"
android:id=
"@+id/sobot_layout_titlebar"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"@dimen/sobot_titlebar_height"
android:layout_height=
"@dimen/sobot_titlebar_height"
android:orientation=
"vertical"
android:background=
"@color/sobot_color_title_bar_bg"
>
android:background=
"@color/sobot_color_title_bar_bg"
>
<
Relative
Layout
<
Linear
Layout
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
android:layout_centerVertical=
"true"
android:orientation=
"horizontal"
>
android:orientation=
"horizontal"
>
<TextView
<TextView
...
@@ -27,13 +27,9 @@
...
@@ -27,13 +27,9 @@
<LinearLayout
<LinearLayout
android:id=
"@+id/sobot_header_center_ll"
android:id=
"@+id/sobot_header_center_ll"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"match_parent"
android:layout_centerInParent=
"true"
android:layout_marginStart=
"80dp"
android:layout_marginLeft=
"80dp"
android:layout_marginEnd=
"80dp"
android:layout_marginRight=
"80dp"
android:gravity=
"center"
android:gravity=
"center"
android:layout_weight=
"1"
android:orientation=
"horizontal"
>
android:orientation=
"horizontal"
>
<com.sobot.widget.ui.image.SobotRCImageView
<com.sobot.widget.ui.image.SobotRCImageView
...
@@ -52,8 +48,6 @@
...
@@ -52,8 +48,6 @@
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"6dp"
android:layout_marginStart=
"6dp"
android:layout_marginLeft=
"6dp"
android:layout_marginLeft=
"6dp"
android:layout_toEndOf=
"@id/sobot_avatar_iv"
android:layout_toRightOf=
"@id/sobot_avatar_iv"
android:ellipsize=
"end"
android:ellipsize=
"end"
android:singleLine=
"true"
android:singleLine=
"true"
android:textColor=
"@color/sobot_color_title_bar_title"
android:textColor=
"@color/sobot_color_title_bar_title"
...
@@ -67,8 +61,6 @@
...
@@ -67,8 +61,6 @@
android:id=
"@+id/sobot_tv"
android:id=
"@+id/sobot_tv"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
android:layout_alignParentEnd=
"true"
android:layout_alignParentRight=
"true"
android:gravity=
"center_vertical"
android:gravity=
"center_vertical"
android:orientation=
"horizontal"
>
android:orientation=
"horizontal"
>
...
@@ -76,6 +68,9 @@
...
@@ -76,6 +68,9 @@
android:id=
"@+id/sobot_tv_close"
android:id=
"@+id/sobot_tv_close"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
android:maxWidth=
"80dp"
android:lines=
"1"
android:ellipsize=
"end"
android:layout_marginEnd=
"10dp"
android:layout_marginEnd=
"10dp"
android:layout_marginRight=
"10dp"
android:layout_marginRight=
"10dp"
android:drawablePadding=
"5dp"
android:drawablePadding=
"5dp"
...
@@ -90,6 +85,9 @@
...
@@ -90,6 +85,9 @@
android:id=
"@+id/sobot_tv_right_third"
android:id=
"@+id/sobot_tv_right_third"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
android:maxWidth=
"80dp"
android:lines=
"1"
android:ellipsize=
"end"
android:layout_marginEnd=
"10dp"
android:layout_marginEnd=
"10dp"
android:layout_marginRight=
"10dp"
android:layout_marginRight=
"10dp"
android:drawablePadding=
"5dp"
android:drawablePadding=
"5dp"
...
@@ -102,6 +100,9 @@
...
@@ -102,6 +100,9 @@
android:id=
"@+id/sobot_tv_right_second"
android:id=
"@+id/sobot_tv_right_second"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
android:maxWidth=
"80dp"
android:lines=
"1"
android:ellipsize=
"end"
android:layout_marginEnd=
"10dp"
android:layout_marginEnd=
"10dp"
android:layout_marginRight=
"10dp"
android:layout_marginRight=
"10dp"
android:gravity=
"center_vertical"
android:gravity=
"center_vertical"
...
@@ -114,6 +115,9 @@
...
@@ -114,6 +115,9 @@
android:id=
"@+id/sobot_tv_right"
android:id=
"@+id/sobot_tv_right"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:maxWidth=
"80dp"
android:lines=
"1"
android:ellipsize=
"end"
android:drawablePadding=
"5dp"
android:drawablePadding=
"5dp"
android:gravity=
"center_vertical|end"
android:gravity=
"center_vertical|end"
android:paddingEnd=
"10dp"
android:paddingEnd=
"10dp"
...
@@ -121,9 +125,17 @@
...
@@ -121,9 +125,17 @@
android:textColor=
"@color/sobot_color_title_bar_menu_text"
android:textColor=
"@color/sobot_color_title_bar_menu_text"
android:textSize=
"@dimen/sobot_titlebar_title_size"
android:textSize=
"@dimen/sobot_titlebar_title_size"
android:visibility=
"gone"
/>
android:visibility=
"gone"
/>
<ImageView
android:id=
"@+id/call_icon"
android:layout_width=
"36dp"
android:layout_height=
"36dp"
android:gravity=
"center_vertical|end"
android:paddingEnd=
"10dp"
android:paddingRight=
"10dp"
android:scaleType=
"centerInside"
android:visibility=
"gone"
/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</RelativeLayout>
<View
<View
android:id=
"@+id/sobot_title_line"
android:id=
"@+id/sobot_title_line"
...
@@ -132,4 +144,4 @@
...
@@ -132,4 +144,4 @@
android:layout_alignParentBottom=
"true"
android:layout_alignParentBottom=
"true"
android:background=
"@color/sobot_common_line_gray"
/>
android:background=
"@color/sobot_common_line_gray"
/>
</RelativeLayout>
</LinearLayout>
\ No newline at end of file
\ No newline at end of file
sobot_widget/src/main/res/values-en/strings.xml
View file @
04b868ae
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
<string
name=
"sobot_srl_header_loading"
>
Wait For Loading…
</string>
<string
name=
"sobot_srl_header_loading"
>
Wait For Loading…
</string>
<string
name=
"sobot_srl_header_finish"
>
Refresh Success
</string>
<string
name=
"sobot_srl_header_finish"
>
Refresh Success
</string>
<string
name=
"sobot_srl_header_failed"
>
Refresh Failed
</string>
<string
name=
"sobot_srl_header_failed"
>
Refresh Failed
</string>
<string
name=
"sobot_srl_header_update"
>
\'Last Update\'
M-d HH:mm
</string>
<string
name=
"sobot_srl_header_update"
>
\'Last Update\'
%s
</string>
<string
name=
"sobot_srl_header_secondary"
>
Release To Second Floor
</string>
<string
name=
"sobot_srl_header_secondary"
>
Release To Second Floor
</string>
<string
name=
"sobot_no_data_string"
>
No data
</string>
<string
name=
"sobot_no_data_string"
>
No data
</string>
...
@@ -51,5 +51,11 @@
...
@@ -51,5 +51,11 @@
<string
name=
"sobot_str_goto_setting_info"
>
Currently, only partial access to photos or videos is allowed
</string>
<string
name=
"sobot_str_goto_setting_info"
>
Currently, only partial access to photos or videos is allowed
</string>
<string
name=
"sobot_str_goto_setting_allow"
>
Allow all>
</string>
<string
name=
"sobot_str_goto_setting_allow"
>
Allow all>
</string>
<string
name=
"sobot_button_send"
>
Send
</string>
<string
name=
"sobot_button_send"
>
Send
</string>
<string
name=
"calendar_one"
>
Mon.
</string>
<string
name=
"calendar_two"
>
Tue.
</string>
<string
name=
"calendar_three"
>
Wed.
</string>
<string
name=
"calendar_four"
>
Thu.
</string>
<string
name=
"calendar_five"
>
Fri.
</string>
<string
name=
"calendar_six"
>
Sat.
</string>
<string
name=
"calendar_day"
>
Sun.
</string>
</resources>
</resources>
sobot_widget/src/main/res/values-en/strings_calender.xml
View file @
04b868ae
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<resources
xmlns:tools=
"http://schemas.android.com/tools"
>
<resources
xmlns:tools=
"http://schemas.android.com/tools"
>
<string-array
name=
"sobot_lunar_first_of_month"
>
<item>
春节
</item>
<item>
二月
</item>
<item>
三月
</item>
<item>
四月
</item>
<item>
五月
</item>
<item>
六月
</item>
<item>
七月
</item>
<item>
八月
</item>
<item>
九月
</item>
<item>
十月
</item>
<item>
冬月
</item>
<item>
腊月
</item>
</string-array>
<string-array
name=
"sobot_tradition_festival"
>
<item>
除夕
</item>
<item>
0101春节
</item>
<item>
0115元宵
</item>
<item>
0505端午
</item>
<item>
0707七夕
</item>
<item>
0815中秋
</item>
<item>
0909重阳
</item>
</string-array>
<string-array
name=
"sobot_lunar_str"
>
<item>
初一
</item>
<item>
初二
</item>
<item>
初三
</item>
<item>
初四
</item>
<item>
初五
</item>
<item>
初六
</item>
<item>
初七
</item>
<item>
初八
</item>
<item>
初九
</item>
<item>
初十
</item>
<item>
十一
</item>
<item>
十二
</item>
<item>
十三
</item>
<item>
十四
</item>
<item>
十五
</item>
<item>
十六
</item>
<item>
十七
</item>
<item>
十八
</item>
<item>
十九
</item>
<item>
二十
</item>
<item>
廿一
</item>
<item>
廿二
</item>
<item>
廿三
</item>
<item>
廿四
</item>
<item>
廿五
</item>
<item>
廿六
</item>
<item>
廿七
</item>
<item>
廿八
</item>
<item>
廿九
</item>
<item>
三十
</item>
</string-array>
<string-array
name=
"sobot_solar_festival"
tools:ignore=
"InconsistentArrays"
>
<item>
0101元旦
</item>
<item>
0214情人节
</item>
<item>
0308妇女节
</item>
<item>
0312植树节
</item>
<item>
0315消权日
</item>
<item>
0401愚人节
</item>
<item>
0422地球日
</item>
<item>
0501劳动节
</item>
<item>
0504青年节
</item>
<item>
0601儿童节
</item>
<item>
0701建党节
</item>
<item>
0801建军节
</item>
<item>
0910教师节
</item>
<item>
1001国庆节
</item>
<item>
1031万圣节
</item>
<item>
1111光棍节
</item>
<item>
1224平安夜
</item>
<item>
1225圣诞节
</item>
</string-array>
<string-array
name=
"sobot_solar_term"
>
<item>
春分
</item>
<item>
清明
</item>
<item>
谷雨
</item>
<item>
立夏
</item>
<item>
小满
</item>
<item>
芒种
</item>
<item>
夏至
</item>
<item>
小暑
</item>
<item>
大暑
</item>
<item>
立秋
</item>
<item>
处暑
</item>
<item>
白露
</item>
<item>
秋分
</item>
<item>
寒露
</item>
<item>
霜降
</item>
<item>
立冬
</item>
<item>
小雪
</item>
<item>
大雪
</item>
<item>
冬至
</item>
<item>
小寒
</item>
<item>
大寒
</item>
<item>
立春
</item>
<item>
雨水
</item>
<item>
惊蛰
</item>
</string-array>
<string-array
name=
"sobot_special_festivals"
>
<item>
母亲节
</item>
<item>
父亲节
</item>
<item>
感恩节
</item>
</string-array>
<string
name=
"sobot_sun"
>
Sun
</string>
<string
name=
"sobot_sun"
>
Sun
</string>
<string
name=
"sobot_mon"
>
Mon
</string>
<string
name=
"sobot_mon"
>
Mon
</string>
...
@@ -120,16 +9,6 @@
...
@@ -120,16 +9,6 @@
<string
name=
"sobot_fri"
>
Fri
</string>
<string
name=
"sobot_fri"
>
Fri
</string>
<string
name=
"sobot_sat"
>
Sat
</string>
<string
name=
"sobot_sat"
>
Sat
</string>
<string-array
name=
"sobot_week_string_array"
>
<item>
Sun
</item>
<item>
Mon
</item>
<item>
Tue
</item>
<item>
Wed
</item>
<item>
Thu
</item>
<item>
Fri
</item>
<item>
Sat
</item>
</string-array>
<string-array
name=
"sobot_year_view_week_string_array"
>
<string-array
name=
"sobot_year_view_week_string_array"
>
<item>
S
</item>
<item>
S
</item>
<item>
M
</item>
<item>
M
</item>
...
@@ -169,18 +48,6 @@
...
@@ -169,18 +48,6 @@
</integer-array>
</integer-array>
<string-array
name=
"sobot_trunk_string_array"
>
<item>
辛
</item>
<item>
壬
</item>
<item>
癸
</item>
<item>
甲
</item>
<item>
乙
</item>
<item>
丙
</item>
<item>
丁
</item>
<item>
戊
</item>
<item>
己
</item>
<item>
庚
</item>
</string-array>
<integer-array
name=
"sobot_branch_integer_array"
>
<integer-array
name=
"sobot_branch_integer_array"
>
<item>
1
</item>
<item>
1
</item>
...
@@ -197,19 +64,5 @@
...
@@ -197,19 +64,5 @@
<item>
12
</item>
<item>
12
</item>
</integer-array>
</integer-array>
<string-array
name=
"sobot_branch_string_array"
>
<item>
酉
</item>
<item>
戌
</item>
<item>
亥
</item>
<item>
子
</item>
<item>
丑
</item>
<item>
寅
</item>
<item>
卯
</item>
<item>
辰
</item>
<item>
巳
</item>
<item>
午
</item>
<item>
未
</item>
<item>
申
</item>
</string-array>
</resources>
</resources>
\ No newline at end of file
sobot_widget/src/main/res/values/strings.xml
View file @
04b868ae
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
<string
name=
"sobot_srl_header_release"
>
释放立即刷新
</string>
<string
name=
"sobot_srl_header_release"
>
释放立即刷新
</string>
<string
name=
"sobot_srl_header_finish"
>
刷新完成
</string>
<string
name=
"sobot_srl_header_finish"
>
刷新完成
</string>
<string
name=
"sobot_srl_header_failed"
>
刷新失败
</string>
<string
name=
"sobot_srl_header_failed"
>
刷新失败
</string>
<string
name=
"sobot_srl_header_update"
>
上次更新
M-d HH:mm
</string>
<string
name=
"sobot_srl_header_update"
>
上次更新
%s
</string>
<string
name=
"sobot_srl_header_secondary"
>
释放进入二楼
</string>
<string
name=
"sobot_srl_header_secondary"
>
释放进入二楼
</string>
<string
name=
"sobot_srl_footer_pulling"
>
上拉加载更多
</string>
<string
name=
"sobot_srl_footer_pulling"
>
上拉加载更多
</string>
...
@@ -51,4 +51,12 @@
...
@@ -51,4 +51,12 @@
<string
name=
"sobot_str_goto_setting_info"
>
当前仅允许访问部分照片或视频
</string>
<string
name=
"sobot_str_goto_setting_info"
>
当前仅允许访问部分照片或视频
</string>
<string
name=
"sobot_str_goto_setting_allow"
>
允许全部 >
</string>
<string
name=
"sobot_str_goto_setting_allow"
>
允许全部 >
</string>
<string
name=
"sobot_button_send"
>
发送
</string>
<string
name=
"sobot_button_send"
>
发送
</string>
<string
name=
"calendar_day"
>
日
</string>
<string
name=
"calendar_one"
>
一
</string>
<string
name=
"calendar_two"
>
二
</string>
<string
name=
"calendar_three"
>
三
</string>
<string
name=
"calendar_four"
>
四
</string>
<string
name=
"calendar_five"
>
五
</string>
<string
name=
"calendar_six"
>
六
</string>
</resources>
</resources>
sobot_widget/src/main/res/values/strings_calender.xml
View file @
04b868ae
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<resources
xmlns:tools=
"http://schemas.android.com/tools"
>
<resources
xmlns:tools=
"http://schemas.android.com/tools"
>
<string-array
name=
"sobot_lunar_first_of_month"
>
<item>
春节
</item>
<item>
二月
</item>
<item>
三月
</item>
<item>
四月
</item>
<item>
五月
</item>
<item>
六月
</item>
<item>
七月
</item>
<item>
八月
</item>
<item>
九月
</item>
<item>
十月
</item>
<item>
冬月
</item>
<item>
腊月
</item>
</string-array>
<string-array
name=
"sobot_tradition_festival"
>
<item>
除夕
</item>
<item>
0101春节
</item>
<item>
0115元宵
</item>
<item>
0505端午
</item>
<item>
0707七夕
</item>
<item>
0815中秋
</item>
<item>
0909重阳
</item>
</string-array>
<string-array
name=
"sobot_lunar_str"
>
<item>
初一
</item>
<item>
初二
</item>
<item>
初三
</item>
<item>
初四
</item>
<item>
初五
</item>
<item>
初六
</item>
<item>
初七
</item>
<item>
初八
</item>
<item>
初九
</item>
<item>
初十
</item>
<item>
十一
</item>
<item>
十二
</item>
<item>
十三
</item>
<item>
十四
</item>
<item>
十五
</item>
<item>
十六
</item>
<item>
十七
</item>
<item>
十八
</item>
<item>
十九
</item>
<item>
二十
</item>
<item>
廿一
</item>
<item>
廿二
</item>
<item>
廿三
</item>
<item>
廿四
</item>
<item>
廿五
</item>
<item>
廿六
</item>
<item>
廿七
</item>
<item>
廿八
</item>
<item>
廿九
</item>
<item>
三十
</item>
</string-array>
<string-array
name=
"sobot_solar_festival"
tools:ignore=
"InconsistentArrays"
>
<item>
0101元旦
</item>
<item>
0214情人节
</item>
<item>
0308妇女节
</item>
<item>
0312植树节
</item>
<item>
0315消权日
</item>
<item>
0401愚人节
</item>
<item>
0422地球日
</item>
<item>
0501劳动节
</item>
<item>
0504青年节
</item>
<item>
0601儿童节
</item>
<item>
0701建党节
</item>
<item>
0801建军节
</item>
<item>
0910教师节
</item>
<item>
1001国庆节
</item>
<item>
1031万圣节
</item>
<item>
1111光棍节
</item>
<item>
1224平安夜
</item>
<item>
1225圣诞节
</item>
</string-array>
<string-array
name=
"sobot_solar_term"
>
<item>
春分
</item>
<item>
清明
</item>
<item>
谷雨
</item>
<item>
立夏
</item>
<item>
小满
</item>
<item>
芒种
</item>
<item>
夏至
</item>
<item>
小暑
</item>
<item>
大暑
</item>
<item>
立秋
</item>
<item>
处暑
</item>
<item>
白露
</item>
<item>
秋分
</item>
<item>
寒露
</item>
<item>
霜降
</item>
<item>
立冬
</item>
<item>
小雪
</item>
<item>
大雪
</item>
<item>
冬至
</item>
<item>
小寒
</item>
<item>
大寒
</item>
<item>
立春
</item>
<item>
雨水
</item>
<item>
惊蛰
</item>
</string-array>
<string-array
name=
"sobot_special_festivals"
>
<item>
母亲节
</item>
<item>
父亲节
</item>
<item>
感恩节
</item>
</string-array>
<string
name=
"sobot_sun"
>
日
</string>
<string
name=
"sobot_sun"
>
日
</string>
<string
name=
"sobot_mon"
>
一
</string>
<string
name=
"sobot_mon"
>
一
</string>
...
@@ -121,16 +10,6 @@
...
@@ -121,16 +10,6 @@
<string
name=
"sobot_sat"
>
六
</string>
<string
name=
"sobot_sat"
>
六
</string>
<string-array
name=
"sobot_week_string_array"
>
<item>
周日
</item>
<item>
周一
</item>
<item>
周二
</item>
<item>
周三
</item>
<item>
周四
</item>
<item>
周五
</item>
<item>
周六
</item>
</string-array>
<string-array
name=
"sobot_year_view_week_string_array"
>
<string-array
name=
"sobot_year_view_week_string_array"
>
<item>
日
</item>
<item>
日
</item>
<item>
一
</item>
<item>
一
</item>
...
@@ -170,18 +49,6 @@
...
@@ -170,18 +49,6 @@
</integer-array>
</integer-array>
<string-array
name=
"sobot_trunk_string_array"
>
<item>
辛
</item>
<item>
壬
</item>
<item>
癸
</item>
<item>
甲
</item>
<item>
乙
</item>
<item>
丙
</item>
<item>
丁
</item>
<item>
戊
</item>
<item>
己
</item>
<item>
庚
</item>
</string-array>
<integer-array
name=
"sobot_branch_integer_array"
>
<integer-array
name=
"sobot_branch_integer_array"
>
<item>
1
</item>
<item>
1
</item>
...
@@ -197,20 +64,4 @@
...
@@ -197,20 +64,4 @@
<item>
11
</item>
<item>
11
</item>
<item>
12
</item>
<item>
12
</item>
</integer-array>
</integer-array>
<string-array
name=
"sobot_branch_string_array"
>
<item>
酉
</item>
<item>
戌
</item>
<item>
亥
</item>
<item>
子
</item>
<item>
丑
</item>
<item>
寅
</item>
<item>
卯
</item>
<item>
辰
</item>
<item>
巳
</item>
<item>
午
</item>
<item>
未
</item>
<item>
申
</item>
</string-array>
</resources>
</resources>
\ No newline at end of file
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