mirror of
https://gitee.com/51danju/workclock.git
synced 2025-06-08 03:44:05 +08:00
增加时间文字的间距,底框设置
This commit is contained in:
parent
6736591324
commit
07061787eb
@ -11,6 +11,7 @@
|
||||
android:sharedUserId="android.uid.system"
|
||||
android:name=".ClockApplication"
|
||||
tools:replace="android:theme"
|
||||
android:installLocation="internalOnly"
|
||||
android:theme="@style/Theme.AppCompat.Light.NoActionBar.FullScreen">
|
||||
|
||||
<activity android:name=".MainActivity" android:screenOrientation="sensorLandscape">
|
||||
@ -30,6 +31,14 @@
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
<service android:name=".service.ProximityService" />
|
||||
<receiver
|
||||
android:name=".BootReceiver"
|
||||
android:enabled="true"
|
||||
android:exported="true">
|
||||
<intent-filter android:priority="1000">
|
||||
<action android:name="android.intent.action.BOOT_COMPLETED"></action>
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
</application>
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK"/>
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||
@ -39,6 +48,8 @@
|
||||
tools:ignore="ProtectedPermissions" />
|
||||
<uses-permission android:name="android.permission.REAL_GET_TASKS"
|
||||
tools:ignore="ProtectedPermissions" />
|
||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"></uses-permission>
|
||||
|
||||
|
||||
|
||||
</manifest>
|
26
app/src/main/java/clock/socoolby/com/clock/BootReceiver.java
Normal file
26
app/src/main/java/clock/socoolby/com/clock/BootReceiver.java
Normal file
@ -0,0 +1,26 @@
|
||||
package clock.socoolby.com.clock;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
public class BootReceiver extends BroadcastReceiver
|
||||
{
|
||||
public BootReceiver()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent)
|
||||
{
|
||||
if (intent.getAction().equals("android.intent.action.BOOT_COMPLETED"))
|
||||
{
|
||||
|
||||
if(ClockApplication.getInstance().model.isBootStart()) {
|
||||
Intent i = new Intent(context, MainActivity.class);
|
||||
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -15,8 +15,8 @@ import com.openbravo.data.loader.dialect.SQLite.SQLite;
|
||||
import clock.socoolby.com.clock.dao.base.ThemeUIDao;
|
||||
import clock.socoolby.com.clock.dao.base.TimeFontStyleDao;
|
||||
import clock.socoolby.com.clock.db.WorkClockDatabase;
|
||||
import clock.socoolby.com.clock.protocol.BusinessService;
|
||||
import clock.socoolby.com.clock.model.DateModel;
|
||||
import clock.socoolby.com.clock.net.BusinessService;
|
||||
import clock.socoolby.com.clock.utils.FileUtils;
|
||||
import clock.socoolby.com.clock.model.SharePerferenceModel;
|
||||
import e.odbo.DB;
|
||||
|
@ -0,0 +1,202 @@
|
||||
package clock.socoolby.com.clock;
|
||||
|
||||
public class FamousQuotesManager {
|
||||
|
||||
public static final String[] FAMOUS_QUOTES=new String[]{
|
||||
"人生在勤,不索何获?——张衡",
|
||||
"尊重人不应该胜于尊重真理。——柏拉图",
|
||||
"血沃中原肥劲草,寒凝大地发春华。——鲁迅",
|
||||
"读书百遍,其义自见。——陈遇",
|
||||
"真理是时间的女儿。——达·芬奇",
|
||||
"宽恕而不忘却,就如同把斧头埋在土里而把斧柄留在外面一样。——美国.巴斯克里",
|
||||
"君子喻于义,小人喻于利。——孔丘",
|
||||
"差以毫厘,谬以千里。——《汉书》",
|
||||
"它山之石,可以攻玉。——《诗经·小雅》",
|
||||
"从善如登,从恶如崩。——《国语》",
|
||||
"生活就是战斗。——柯罗连科",
|
||||
"一个伟大的人有两颗心:一颗心流血,一颗心宽容。——纪伯伦",
|
||||
"吃一堑,长一智。——古谚语",
|
||||
"锲而舍之,朽木不折;锲而不舍,金石可镂。——荀况",
|
||||
"天下事有难易乎,为之,则难者亦易矣;不为,则易者亦难矣。——彭端叔",
|
||||
"坚持真理的人是伟大的。——雨果",
|
||||
"星星之火,可以燎原。——尚书",
|
||||
"地不耕种,再肥沃也长不出果实;人不学习,再聪明也目不识丁。——西塞罗",
|
||||
"国耻未雪,何由成名?——李白",
|
||||
"操千曲而后晓声,观千剑而后识器。——刘勰",
|
||||
"辱,莫大于不知耻。——王通",
|
||||
"不满足是向上的车轮。——鲁迅",
|
||||
"出师未捷身先死,长使英雄泪沾襟。——杜甫",
|
||||
"度尽劫波兄弟在,相逢一笑泯恩仇。——鲁迅",
|
||||
"先天下之忧而忧,后天下之乐而乐。——范仲淹",
|
||||
"天意怜幽草,人间重晚晴。——李商隐",
|
||||
"土扶可城墙,积德为厚地。——李白",
|
||||
"忍耐是痛苦的,但它的结果是甜蜜的。——法.卢梭",
|
||||
"臣心一片磁针石,不指南方不肯休。——文天祥",
|
||||
"学问是苦根上长出来的甜果。——李嘉图",
|
||||
"学而不思则罔,思而不学则殆。——孔子",
|
||||
"私心胜者,可以灭公。——林逋",
|
||||
"不积跬步,无以至千里;不积小流,无以成江海。——荀况",
|
||||
"不责人小过,不发人阴私,不念人旧恶——三者可以养德,也可以远害。——洪应明",
|
||||
"学无止境。——荀子",
|
||||
"学而不厌,诲人不倦。——孔子",
|
||||
"天时不如地利,地利不如人和。——《孟子》",
|
||||
"春蚕到死丝方尽,蜡炬成灰泪始干。——李商隐",
|
||||
"心事浩茫连广宇,于无声处听惊雷。——鲁迅",
|
||||
"仓廪实则知礼节,衣食足则知荣辱。——《管子》",
|
||||
"深以刻薄为戒,每事当从忠厚。——薜渲",
|
||||
"春风得意马蹄疾,一日看尽长安花。——孟郊",
|
||||
"静以修身,俭以养德。——诸葛亮",
|
||||
"白日莫闲过,青春不再来。——林宽",
|
||||
"提出一个问题,往往比解决一个问题更重要。——爱因斯坦",
|
||||
"宽宏精神是一切事物中最伟大的。——欧文",
|
||||
"世界上最宽阔的是海洋,比海洋更宽阔的是天空,比天空更宽阔的是人的胸怀。——法.雨果",
|
||||
"天下兴亡,匹夫有责。——顾炎武",
|
||||
"宽容意味着尊重别人的任何信念。——爱因斯坦",
|
||||
"踏破铁鞋无觅处,得来全不费功夫。——《水浒传》",
|
||||
"上下同欲者胜。——孙武",
|
||||
"沉舟侧畔千帆过,病树前头万木春。——刘禹锡",
|
||||
"唯宽可以容人,唯厚可以载物。——薜渲",
|
||||
"读书破万卷,下笔如有神。——杜甫",
|
||||
"海纳百川有容乃大,山高万仞无欲则刚。——林则徐",
|
||||
"贫而无谄,富而无骄。——子贡",
|
||||
"君子忧道不忧贫。——孔丘",
|
||||
"有时宽容引起的道德震动比惩罚更强烈。——原苏联.苏霍姆林斯基",
|
||||
"志当存高远。——诸葛亮",
|
||||
"察己则可以知人,察今则可以知古。——《吕氏春秋》",
|
||||
"不会宽容别人的人,是不配受别人宽容的,但谁能说自己是不需要宽容的呢?——屠格涅夫",
|
||||
"天行有常,不为尧存,不为桀亡。——《苟子》",
|
||||
"采得百花成蜜后,为谁辛苦为谁甜。——罗隐",
|
||||
"信言不美,美言不信。善者不辩,辩者不善。——老子",
|
||||
"不知则问,不能则学。——董仲舒",
|
||||
"希望是厄运的忠实的姐妹。——普希金",
|
||||
"必须有勇气正视无情的真理。——列宁",
|
||||
"桃李不言,下自成蹊。——史记",
|
||||
"知耻近乎勇。——孔丘",
|
||||
"新沐者必弹冠,新浴者必振衣。——屈原",
|
||||
"小荷才露尖尖角,早有蜻蜓立上头。——杨万里",
|
||||
"只有人的劳动才是神圣的。——高尔基",
|
||||
"夕阳无限好,只是近黄昏。——李商隐",
|
||||
"燕雀安知鸿鹄之志哉!——陈涉",
|
||||
"人心不是靠武力征服,而是靠爱和宽容大度征服。——斯宾诺",
|
||||
"业精于勤,荒于嬉。——韩愈",
|
||||
"没有宽宏大量的心肠,便算不上真正的英雄。——俄.普希金",
|
||||
"春色满园关不住,一枝红杏出墙来。——叶绍翁",
|
||||
"要知天下事,须读古人书。——冯梦龙",
|
||||
"尺有所短,寸有所长。——屈原",
|
||||
"学然后知不足。——礼记",
|
||||
"长风破浪会有时,直挂云帆济沧海。——李白"
|
||||
};
|
||||
|
||||
|
||||
public static final String[] POETRY_OF_THE_TANG_DYNASTY=new String[]{
|
||||
"珠箔因风起,飞蛾入最能。不教人夜作,方便杀明灯。--【春夜裁缝】蒋维翰",
|
||||
"空山不见人,但闻人语响。返景入深林,复照青苔上。--鹿柴 唐代:王维",
|
||||
"千山鸟飞绝,万径人踪灭。孤舟蓑笠翁,独钓寒江雪。--江雪 唐代:柳宗元",
|
||||
"白日依山尽,黄河入海流。欲穷千里目,更上一层楼。--登鹳雀楼 唐代:王之涣",
|
||||
"驿外断桥边,寂寞开无主。已是黄昏独自愁,更著风和雨。无意苦争春,一任群芳妒。零落成泥碾作尘,只有香如故。--卜算子·咏梅 宋代:陆游",
|
||||
"昨夜雨疏风骤,浓睡不消残酒。试问卷帘人,却道海棠依旧。知否,知否?应是绿肥红瘦.--如梦令·昨夜雨疏风骤 宋代:李清照"
|
||||
};
|
||||
|
||||
public static final String[] KONGZI=new String[]{
|
||||
"三人行,必有我师焉,择其善者而从之,择其不善者而改之。",
|
||||
"三军可夺帅也,匹夫不可夺志也!",
|
||||
"君子欲讷于言而敏于行。",
|
||||
"言未及之而言谓之躁,言及之而不言谓之隐,未见颜色而言谓之瞽。",
|
||||
"无欲速,无见小利。欲速,则不达;见小利,则大事不成。",
|
||||
"执德不弘,信道不笃,焉能为有,焉能为亡。",
|
||||
"过而不改,是谓过矣!",
|
||||
"好直不好学,其蔽也绞;好勇不好学,其蔽也乱;好刚不好学,其蔽也狂。",
|
||||
"人无远虑,必有近忧。",
|
||||
"君子食无求饱,居无求安,敏于事而慎于言,就有道而正焉,可谓好学也已。",
|
||||
"恭而无礼则劳,慎而无礼则葸,勇而无礼则乱,直而无礼则绞。",
|
||||
"己所不欲,匆施于人。",
|
||||
"居处恭,执事敬,与人忠。",
|
||||
"躬自厚而薄责于人,则远怨矣。",
|
||||
"与朋友交,言而有信。以文会友,以友辅仁。",
|
||||
"君子名之必可言也,言之必可行也,君子于其言,无所苟而已矣。",
|
||||
"君子义以为质,礼以行之,孙以出之,(www.lz13.cn)信以成之。君子哉!",
|
||||
"孔子曰:“能行五者于天下为仁矣。”请问之。曰:“恭宽信敏惠。恭则不侮,宽则得众,信则人任焉,敏则有功,惠则足以使人”。",
|
||||
"益者三友,损者三友。友直,友谅,友多闻,益矣。友便辟,友善柔,友便佞,损矣。",
|
||||
"可与言而不与之言,失人;不可与言而与之言,失言。知者不失人,亦不失言。",
|
||||
"过,则匆惮改。",
|
||||
"士不可不弘毅,任重而道远。仁以为己任,不亦重乎?死而后己,不亦远乎?",
|
||||
"君子敬而无失,与人恭而有礼,四海之内皆兄弟也,言忠信,行笃敬,虽蛮貊之邦,行矣。言不忠信,行不笃敬,虽州里,行乎哉?",
|
||||
"以文会友,以友辅仁。",
|
||||
"行己有耻,使于四方,不辱君命,可谓士矣。",
|
||||
"己欲立而立人,己欲达而达人。",
|
||||
"见贤思齐焉,见不贤而内自省也。"
|
||||
};
|
||||
|
||||
public static final String[] LAOZI=new String[]{
|
||||
"太上,不知有之;其次,亲而誉之;其次,畏之;其次,侮之。信不足焉,有不信焉。",
|
||||
"宠辱若惊,贵大患若身。",
|
||||
"江海所以能为百谷王者,以其善下之。——《道德经》第六十六章",
|
||||
"金玉满堂,莫之能守。富贵而骄,自遗其咎。功遂身退,天之道。——《道德经》第九章",
|
||||
"五色令人目盲;五音令人耳聋;五味令人口爽;驰骋畋猎,令人心发狂;难得之货,令人行妨。是以圣人为腹不为目,故去彼取此。",
|
||||
"人之所畏,不可不畏。",
|
||||
"上善若水,水善利万物而不争,处众人之所恶,故几于道。居善地,心善渊,与善仁,言善信,正善治,事善能,动善时。",
|
||||
"天下皆知美之为美,斯恶已,皆知善之为善,斯不善已……",
|
||||
"居善地,心善渊,与善仁,言善信,政善治,事善能,动善时。夫唯不争,故无尤。",
|
||||
"持而盈之,不如其已;揣而锐之,不可长保。金玉满堂,莫之能守;富贵而骄,自遗其咎。功遂身退,天之道也。",
|
||||
"上德不德,是以有德;下德不失德,是以无德。",
|
||||
"三十辐,共一毂,当其无,有车之用。埏埴以为器,当其无,有器之用。凿户牖以为室,当其无,有室之用。故有之以为利,无之以为用。",
|
||||
"天网恢恢,疏而不失。——《道德经》第七十三章",
|
||||
"天下皆知美之为美,斯恶矣;皆知善之为善,斯不善已。——《道德经》第二章",
|
||||
"知人者智,自知者明;胜人者有力,自胜者强。",
|
||||
"俗人昭昭,我独昏昏。俗人察察,我独闷闷。",
|
||||
"不出户,知天下;不窥牖,见天道。",
|
||||
"天之道,损有余而补不足。人之道,则不然,损不足以奉有余。",
|
||||
"圣人自知不自见;自爱不自贵。——《道德经》第七十二章",
|
||||
"绝圣弃智,民利百倍;绝仁弃义,民复孝慈;绝巧弃利,盗贼无有。此三者以为文,不足。故令有所属:见素抱朴,少思寡欲,绝学无忧。",
|
||||
"是以圣人不行而知,不见而名,不为而成。",
|
||||
"希言自然。——《道德经》第二十三章",
|
||||
"人法地,地法天,天法道,道法自然。",
|
||||
"夫唯不争,故天下莫能与之争。",
|
||||
"天道无亲,常与善人。",
|
||||
"大道废,有仁义;智慧出,有大伪;六亲不和,有孝慈;国家昏乱,有正臣。——《道德经》第十八章",
|
||||
"道可道,非常道。名可名,非常名。",
|
||||
"大道废,有仁义;智慧出,有大伪;六亲不和,有孝慈;国家昏乱,有忠臣。",
|
||||
"天地不仁,以万物为刍狗;圣人不仁,以百姓为刍狗。——《道德经》第五章",
|
||||
"曲则全,枉则直,洼则盈,敝则新,少则多,多则惑。",
|
||||
"天地所以能长且久者,以其不自生,故能长生。——《道德经》第七章",
|
||||
"民不畏死,奈何以死惧之。——《道德经》第七十四章",
|
||||
"大成若缺,其用不弊;大盈若冲,其用不穷。大直若屈,大巧若拙,大辫若讷。",
|
||||
"绝圣弃智,民利百倍;绝仁弃义,民复孝慈;绝巧弃利,盗贼无有。——《道德经》第十九章",
|
||||
"民之难治,以其智多。故以智治国,国之贼。不以智治国,国之福。——《道德经》第六十五章"
|
||||
};
|
||||
|
||||
public static String roundAutoQuotes(){
|
||||
int index=new java.util.Random().nextInt(4);
|
||||
switch (index){
|
||||
case 1:
|
||||
return roundTangShi();
|
||||
case 2:
|
||||
return roundLaoZi();
|
||||
case 3:
|
||||
return roundKonZi();
|
||||
default:
|
||||
return roundFamousQuotes();
|
||||
}
|
||||
}
|
||||
|
||||
public static String roundFamousQuotes(){
|
||||
return roundFamousQuotes(FAMOUS_QUOTES);
|
||||
}
|
||||
|
||||
public static String roundLaoZi(){
|
||||
return roundFamousQuotes(LAOZI);
|
||||
}
|
||||
|
||||
public static String roundKonZi(){
|
||||
return roundFamousQuotes(KONGZI);
|
||||
}
|
||||
|
||||
public static String roundTangShi(){
|
||||
return roundFamousQuotes(POETRY_OF_THE_TANG_DYNASTY);
|
||||
}
|
||||
|
||||
public static String roundFamousQuotes(String[] arrays){
|
||||
int index=new java.util.Random().nextInt(arrays.length);
|
||||
return arrays[index];
|
||||
}
|
||||
}
|
@ -41,6 +41,7 @@ import java.util.List;
|
||||
|
||||
import clock.socoolby.com.clock.alter.AlterManager;
|
||||
import clock.socoolby.com.clock.dao.base.TimeFontStyle;
|
||||
import clock.socoolby.com.clock.fragment.SystemAppConfigFragment;
|
||||
import clock.socoolby.com.clock.fragment.handup.AbstractHandUpFragment;
|
||||
import clock.socoolby.com.clock.fragment.handup.AlterFragmentFactory;
|
||||
import clock.socoolby.com.clock.fragment.digit.DigitClockConfigFragment;
|
||||
@ -50,7 +51,7 @@ import clock.socoolby.com.clock.fragment.simulate.SimulateClockConfigFragment;
|
||||
import clock.socoolby.com.clock.fragment.simulate.SimulateClockFragment;
|
||||
import clock.socoolby.com.clock.fragment.ThemeUIDefaultFragment;
|
||||
import clock.socoolby.com.clock.fragment.ThemeUISampleFragment;
|
||||
import clock.socoolby.com.clock.protocol.WeatherResponse;
|
||||
import clock.socoolby.com.clock.net.protocol.weather.WeatherResponse;
|
||||
import clock.socoolby.com.clock.service.ProximityService;
|
||||
import clock.socoolby.com.clock.state.ClockModeEnum;
|
||||
import clock.socoolby.com.clock.state.ClockStateMachine;
|
||||
@ -150,14 +151,12 @@ public class MainActivity extends AppCompatActivity implements android.view.Ges
|
||||
}else
|
||||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
|
||||
|
||||
//创建手势检测器
|
||||
detector = new GestureDetector(this, this);
|
||||
detector.setOnDoubleTapListener(this);
|
||||
|
||||
scaleGestureDetector=new ScaleGestureDetector(this,this);
|
||||
|
||||
|
||||
ClockApplication.getInstance().setMainActivity(this);
|
||||
|
||||
init();
|
||||
@ -165,10 +164,6 @@ public class MainActivity extends AppCompatActivity implements android.view.Ges
|
||||
//ClockApplication.valueOf().getBusinessService().checkUpdate();
|
||||
}
|
||||
|
||||
public FrameLayout getThemeUIContainer() {
|
||||
return themeUIContainer;
|
||||
}
|
||||
|
||||
private boolean isPowerManagerDisable(){
|
||||
return wakeLock==null;
|
||||
}
|
||||
@ -212,7 +207,6 @@ public class MainActivity extends AppCompatActivity implements android.view.Ges
|
||||
proximityServiceIntent = new Intent(this, ProximityService.class);
|
||||
|
||||
fontManager=new FontManager(ClockApplication.getInstance().getEntityManager());
|
||||
//fontManager.setCurrentFontName(model.getFontName());
|
||||
|
||||
animatorManager=new AnimatorManager();
|
||||
|
||||
@ -231,8 +225,6 @@ public class MainActivity extends AppCompatActivity implements android.view.Ges
|
||||
|
||||
bindViewModel();
|
||||
|
||||
//digitViewModel.getTimeFontStyle().setValue(fontManager.getCurrentFontStyle());
|
||||
|
||||
themeUIManager=new ThemeUIManager(ClockApplication.getInstance().getEntityManager(),model);
|
||||
|
||||
testSetup();
|
||||
@ -243,6 +235,8 @@ public class MainActivity extends AppCompatActivity implements android.view.Ges
|
||||
|
||||
globalViewModel.getHourAlterTypeName().setValue(FishAnimator.NAME);
|
||||
|
||||
//model.setBootStart(true);
|
||||
|
||||
//globalViewModel.getHandUpTypeName().setValue(HandUpSelect123Fragment.NAME);
|
||||
|
||||
/*Observer<Boolean> timeChange= new Observer<Boolean>() {
|
||||
@ -437,6 +431,8 @@ public class MainActivity extends AppCompatActivity implements android.view.Ges
|
||||
@Override
|
||||
public boolean onTouchEvent(MotionEvent me)
|
||||
{
|
||||
if(globalViewModel.getAppConfig())
|
||||
return false;
|
||||
if(me.getPointerCount()>1)
|
||||
return scaleGestureDetector.onTouchEvent(me);
|
||||
return detector.onTouchEvent(me);
|
||||
@ -552,6 +548,11 @@ public class MainActivity extends AppCompatActivity implements android.view.Ges
|
||||
if(isScreenLock())
|
||||
return super.onKeyDown(keyCode, event);
|
||||
if (keyCode == KeyEvent.KEYCODE_BACK) {
|
||||
if(globalViewModel.getAppConfig()) {
|
||||
getSupportFragmentManager().popBackStack();
|
||||
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
|
||||
return true;
|
||||
}
|
||||
if(!isFullScreen()){
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
builder.setIcon(android.R.drawable.ic_dialog_info);
|
||||
@ -567,7 +568,6 @@ public class MainActivity extends AppCompatActivity implements android.view.Ges
|
||||
});
|
||||
builder.create().show();
|
||||
}
|
||||
//changeThemeUI();
|
||||
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
|
||||
return true;
|
||||
} else if (keyCode == KeyEvent.KEYCODE_MENU) {
|
||||
@ -577,9 +577,9 @@ public class MainActivity extends AppCompatActivity implements android.view.Ges
|
||||
}
|
||||
|
||||
public void setup(){
|
||||
Intent intent = new Intent(this, SettingActivity.class);
|
||||
startActivityForResult(intent, SETTING_REQUEST_CODE);
|
||||
//switchMode(MODE_SETTING_OTHER);
|
||||
//Intent intent = new Intent(this, SettingActivity.class);
|
||||
//startActivityForResult(intent, SETTING_REQUEST_CODE);
|
||||
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_config_container, new SystemAppConfigFragment(model)).addToBackStack(null).commit();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -700,7 +700,7 @@ public class MainActivity extends AppCompatActivity implements android.view.Ges
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean isShowAdvConfig=false;
|
||||
//boolean isShowAdvConfig=false;
|
||||
|
||||
@Override
|
||||
public boolean onDoubleTap(MotionEvent e) {
|
||||
@ -714,18 +714,10 @@ public class MainActivity extends AppCompatActivity implements android.view.Ges
|
||||
return ;
|
||||
switch (globalViewModel.getClockInterfaceTypeEnum().getValue()){
|
||||
case Digit:
|
||||
if(!isShowAdvConfig)
|
||||
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_config_container, new DigitClockConfigFragment(themeUIManager)).addToBackStack(null).commit();
|
||||
else
|
||||
getSupportFragmentManager().popBackStack();
|
||||
isShowAdvConfig=!isShowAdvConfig;
|
||||
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_config_container, new DigitClockConfigFragment(themeUIManager)).addToBackStack(null).commit();
|
||||
break;
|
||||
case Simulate:
|
||||
if(!isShowAdvConfig)
|
||||
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_config_container, new SimulateClockConfigFragment(themeUIManager)).addToBackStack(null).commit();
|
||||
else
|
||||
getSupportFragmentManager().popBackStack();
|
||||
isShowAdvConfig=!isShowAdvConfig;
|
||||
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_config_container, new SimulateClockConfigFragment(themeUIManager)).addToBackStack(null).commit();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -22,204 +22,6 @@ import clock.socoolby.com.clock.widget.wheelview.adapters.ArrayWheelAdapter;
|
||||
|
||||
public class SettingActivity extends AppCompatActivity implements View.OnClickListener {
|
||||
|
||||
public static final String[] FAMOUS_QUOTES=new String[]{
|
||||
"人生在勤,不索何获?——张衡",
|
||||
"尊重人不应该胜于尊重真理。——柏拉图",
|
||||
"血沃中原肥劲草,寒凝大地发春华。——鲁迅",
|
||||
"读书百遍,其义自见。——陈遇",
|
||||
"真理是时间的女儿。——达·芬奇",
|
||||
"宽恕而不忘却,就如同把斧头埋在土里而把斧柄留在外面一样。——美国.巴斯克里",
|
||||
"君子喻于义,小人喻于利。——孔丘",
|
||||
"差以毫厘,谬以千里。——《汉书》",
|
||||
"它山之石,可以攻玉。——《诗经·小雅》",
|
||||
"从善如登,从恶如崩。——《国语》",
|
||||
"生活就是战斗。——柯罗连科",
|
||||
"一个伟大的人有两颗心:一颗心流血,一颗心宽容。——纪伯伦",
|
||||
"吃一堑,长一智。——古谚语",
|
||||
"锲而舍之,朽木不折;锲而不舍,金石可镂。——荀况",
|
||||
"天下事有难易乎,为之,则难者亦易矣;不为,则易者亦难矣。——彭端叔",
|
||||
"坚持真理的人是伟大的。——雨果",
|
||||
"星星之火,可以燎原。——尚书",
|
||||
"地不耕种,再肥沃也长不出果实;人不学习,再聪明也目不识丁。——西塞罗",
|
||||
"国耻未雪,何由成名?——李白",
|
||||
"操千曲而后晓声,观千剑而后识器。——刘勰",
|
||||
"辱,莫大于不知耻。——王通",
|
||||
"不满足是向上的车轮。——鲁迅",
|
||||
"出师未捷身先死,长使英雄泪沾襟。——杜甫",
|
||||
"度尽劫波兄弟在,相逢一笑泯恩仇。——鲁迅",
|
||||
"先天下之忧而忧,后天下之乐而乐。——范仲淹",
|
||||
"天意怜幽草,人间重晚晴。——李商隐",
|
||||
"土扶可城墙,积德为厚地。——李白",
|
||||
"忍耐是痛苦的,但它的结果是甜蜜的。——法.卢梭",
|
||||
"臣心一片磁针石,不指南方不肯休。——文天祥",
|
||||
"学问是苦根上长出来的甜果。——李嘉图",
|
||||
"学而不思则罔,思而不学则殆。——孔子",
|
||||
"私心胜者,可以灭公。——林逋",
|
||||
"不积跬步,无以至千里;不积小流,无以成江海。——荀况",
|
||||
"不责人小过,不发人阴私,不念人旧恶——三者可以养德,也可以远害。——洪应明",
|
||||
"学无止境。——荀子",
|
||||
"学而不厌,诲人不倦。——孔子",
|
||||
"天时不如地利,地利不如人和。——《孟子》",
|
||||
"春蚕到死丝方尽,蜡炬成灰泪始干。——李商隐",
|
||||
"心事浩茫连广宇,于无声处听惊雷。——鲁迅",
|
||||
"仓廪实则知礼节,衣食足则知荣辱。——《管子》",
|
||||
"深以刻薄为戒,每事当从忠厚。——薜渲",
|
||||
"春风得意马蹄疾,一日看尽长安花。——孟郊",
|
||||
"静以修身,俭以养德。——诸葛亮",
|
||||
"白日莫闲过,青春不再来。——林宽",
|
||||
"提出一个问题,往往比解决一个问题更重要。——爱因斯坦",
|
||||
"宽宏精神是一切事物中最伟大的。——欧文",
|
||||
"世界上最宽阔的是海洋,比海洋更宽阔的是天空,比天空更宽阔的是人的胸怀。——法.雨果",
|
||||
"天下兴亡,匹夫有责。——顾炎武",
|
||||
"宽容意味着尊重别人的任何信念。——爱因斯坦",
|
||||
"踏破铁鞋无觅处,得来全不费功夫。——《水浒传》",
|
||||
"上下同欲者胜。——孙武",
|
||||
"沉舟侧畔千帆过,病树前头万木春。——刘禹锡",
|
||||
"唯宽可以容人,唯厚可以载物。——薜渲",
|
||||
"读书破万卷,下笔如有神。——杜甫",
|
||||
"海纳百川有容乃大,山高万仞无欲则刚。——林则徐",
|
||||
"贫而无谄,富而无骄。——子贡",
|
||||
"君子忧道不忧贫。——孔丘",
|
||||
"有时宽容引起的道德震动比惩罚更强烈。——原苏联.苏霍姆林斯基",
|
||||
"志当存高远。——诸葛亮",
|
||||
"察己则可以知人,察今则可以知古。——《吕氏春秋》",
|
||||
"不会宽容别人的人,是不配受别人宽容的,但谁能说自己是不需要宽容的呢?——屠格涅夫",
|
||||
"天行有常,不为尧存,不为桀亡。——《苟子》",
|
||||
"采得百花成蜜后,为谁辛苦为谁甜。——罗隐",
|
||||
"信言不美,美言不信。善者不辩,辩者不善。——老子",
|
||||
"不知则问,不能则学。——董仲舒",
|
||||
"希望是厄运的忠实的姐妹。——普希金",
|
||||
"必须有勇气正视无情的真理。——列宁",
|
||||
"桃李不言,下自成蹊。——史记",
|
||||
"知耻近乎勇。——孔丘",
|
||||
"新沐者必弹冠,新浴者必振衣。——屈原",
|
||||
"小荷才露尖尖角,早有蜻蜓立上头。——杨万里",
|
||||
"只有人的劳动才是神圣的。——高尔基",
|
||||
"夕阳无限好,只是近黄昏。——李商隐",
|
||||
"燕雀安知鸿鹄之志哉!——陈涉",
|
||||
"人心不是靠武力征服,而是靠爱和宽容大度征服。——斯宾诺",
|
||||
"业精于勤,荒于嬉。——韩愈",
|
||||
"没有宽宏大量的心肠,便算不上真正的英雄。——俄.普希金",
|
||||
"春色满园关不住,一枝红杏出墙来。——叶绍翁",
|
||||
"要知天下事,须读古人书。——冯梦龙",
|
||||
"尺有所短,寸有所长。——屈原",
|
||||
"学然后知不足。——礼记",
|
||||
"长风破浪会有时,直挂云帆济沧海。——李白"
|
||||
};
|
||||
|
||||
|
||||
public static final String[] POETRY_OF_THE_TANG_DYNASTY=new String[]{
|
||||
"珠箔因风起,飞蛾入最能。不教人夜作,方便杀明灯。--【春夜裁缝】蒋维翰",
|
||||
"空山不见人,但闻人语响。返景入深林,复照青苔上。--鹿柴 唐代:王维",
|
||||
"千山鸟飞绝,万径人踪灭。孤舟蓑笠翁,独钓寒江雪。--江雪 唐代:柳宗元",
|
||||
"白日依山尽,黄河入海流。欲穷千里目,更上一层楼。--登鹳雀楼 唐代:王之涣",
|
||||
"驿外断桥边,寂寞开无主。已是黄昏独自愁,更著风和雨。无意苦争春,一任群芳妒。零落成泥碾作尘,只有香如故。--卜算子·咏梅 宋代:陆游",
|
||||
"昨夜雨疏风骤,浓睡不消残酒。试问卷帘人,却道海棠依旧。知否,知否?应是绿肥红瘦.--如梦令·昨夜雨疏风骤 宋代:李清照"
|
||||
};
|
||||
|
||||
public static final String[] KONGZI=new String[]{
|
||||
"三人行,必有我师焉,择其善者而从之,择其不善者而改之。",
|
||||
"三军可夺帅也,匹夫不可夺志也!",
|
||||
"君子欲讷于言而敏于行。",
|
||||
"言未及之而言谓之躁,言及之而不言谓之隐,未见颜色而言谓之瞽。",
|
||||
"无欲速,无见小利。欲速,则不达;见小利,则大事不成。",
|
||||
"执德不弘,信道不笃,焉能为有,焉能为亡。",
|
||||
"过而不改,是谓过矣!",
|
||||
"好直不好学,其蔽也绞;好勇不好学,其蔽也乱;好刚不好学,其蔽也狂。",
|
||||
"人无远虑,必有近忧。",
|
||||
"君子食无求饱,居无求安,敏于事而慎于言,就有道而正焉,可谓好学也已。",
|
||||
"恭而无礼则劳,慎而无礼则葸,勇而无礼则乱,直而无礼则绞。",
|
||||
"己所不欲,匆施于人。",
|
||||
"居处恭,执事敬,与人忠。",
|
||||
"躬自厚而薄责于人,则远怨矣。",
|
||||
"与朋友交,言而有信。以文会友,以友辅仁。",
|
||||
"君子名之必可言也,言之必可行也,君子于其言,无所苟而已矣。",
|
||||
"君子义以为质,礼以行之,孙以出之,(www.lz13.cn)信以成之。君子哉!",
|
||||
"孔子曰:“能行五者于天下为仁矣。”请问之。曰:“恭宽信敏惠。恭则不侮,宽则得众,信则人任焉,敏则有功,惠则足以使人”。",
|
||||
"益者三友,损者三友。友直,友谅,友多闻,益矣。友便辟,友善柔,友便佞,损矣。",
|
||||
"可与言而不与之言,失人;不可与言而与之言,失言。知者不失人,亦不失言。",
|
||||
"过,则匆惮改。",
|
||||
"士不可不弘毅,任重而道远。仁以为己任,不亦重乎?死而后己,不亦远乎?",
|
||||
"君子敬而无失,与人恭而有礼,四海之内皆兄弟也,言忠信,行笃敬,虽蛮貊之邦,行矣。言不忠信,行不笃敬,虽州里,行乎哉?",
|
||||
"以文会友,以友辅仁。",
|
||||
"行己有耻,使于四方,不辱君命,可谓士矣。",
|
||||
"己欲立而立人,己欲达而达人。",
|
||||
"见贤思齐焉,见不贤而内自省也。"
|
||||
};
|
||||
|
||||
public static final String[] LAOZI=new String[]{
|
||||
"太上,不知有之;其次,亲而誉之;其次,畏之;其次,侮之。信不足焉,有不信焉。",
|
||||
"宠辱若惊,贵大患若身。",
|
||||
"江海所以能为百谷王者,以其善下之。——《道德经》第六十六章",
|
||||
"金玉满堂,莫之能守。富贵而骄,自遗其咎。功遂身退,天之道。——《道德经》第九章",
|
||||
"五色令人目盲;五音令人耳聋;五味令人口爽;驰骋畋猎,令人心发狂;难得之货,令人行妨。是以圣人为腹不为目,故去彼取此。",
|
||||
"人之所畏,不可不畏。",
|
||||
"上善若水,水善利万物而不争,处众人之所恶,故几于道。居善地,心善渊,与善仁,言善信,正善治,事善能,动善时。",
|
||||
"天下皆知美之为美,斯恶已,皆知善之为善,斯不善已……",
|
||||
"居善地,心善渊,与善仁,言善信,政善治,事善能,动善时。夫唯不争,故无尤。",
|
||||
"持而盈之,不如其已;揣而锐之,不可长保。金玉满堂,莫之能守;富贵而骄,自遗其咎。功遂身退,天之道也。",
|
||||
"上德不德,是以有德;下德不失德,是以无德。",
|
||||
"三十辐,共一毂,当其无,有车之用。埏埴以为器,当其无,有器之用。凿户牖以为室,当其无,有室之用。故有之以为利,无之以为用。",
|
||||
"天网恢恢,疏而不失。——《道德经》第七十三章",
|
||||
"天下皆知美之为美,斯恶矣;皆知善之为善,斯不善已。——《道德经》第二章",
|
||||
"知人者智,自知者明;胜人者有力,自胜者强。",
|
||||
"俗人昭昭,我独昏昏。俗人察察,我独闷闷。",
|
||||
"不出户,知天下;不窥牖,见天道。",
|
||||
"天之道,损有余而补不足。人之道,则不然,损不足以奉有余。",
|
||||
"圣人自知不自见;自爱不自贵。——《道德经》第七十二章",
|
||||
"绝圣弃智,民利百倍;绝仁弃义,民复孝慈;绝巧弃利,盗贼无有。此三者以为文,不足。故令有所属:见素抱朴,少思寡欲,绝学无忧。",
|
||||
"是以圣人不行而知,不见而名,不为而成。",
|
||||
"希言自然。——《道德经》第二十三章",
|
||||
"人法地,地法天,天法道,道法自然。",
|
||||
"夫唯不争,故天下莫能与之争。",
|
||||
"天道无亲,常与善人。",
|
||||
"大道废,有仁义;智慧出,有大伪;六亲不和,有孝慈;国家昏乱,有正臣。——《道德经》第十八章",
|
||||
"道可道,非常道。名可名,非常名。",
|
||||
"大道废,有仁义;智慧出,有大伪;六亲不和,有孝慈;国家昏乱,有忠臣。",
|
||||
"天地不仁,以万物为刍狗;圣人不仁,以百姓为刍狗。——《道德经》第五章",
|
||||
"曲则全,枉则直,洼则盈,敝则新,少则多,多则惑。",
|
||||
"天地所以能长且久者,以其不自生,故能长生。——《道德经》第七章",
|
||||
"民不畏死,奈何以死惧之。——《道德经》第七十四章",
|
||||
"大成若缺,其用不弊;大盈若冲,其用不穷。大直若屈,大巧若拙,大辫若讷。",
|
||||
"绝圣弃智,民利百倍;绝仁弃义,民复孝慈;绝巧弃利,盗贼无有。——《道德经》第十九章",
|
||||
"民之难治,以其智多。故以智治国,国之贼。不以智治国,国之福。——《道德经》第六十五章"
|
||||
};
|
||||
|
||||
public static String roundAutoQuotes(){
|
||||
int index=new java.util.Random().nextInt(4);
|
||||
switch (index){
|
||||
case 1:
|
||||
return roundTangShi();
|
||||
case 2:
|
||||
return roundLaoZi();
|
||||
case 3:
|
||||
return roundKonZi();
|
||||
default:
|
||||
return roundFamousQuotes();
|
||||
}
|
||||
}
|
||||
|
||||
public static String roundFamousQuotes(){
|
||||
return roundFamousQuotes(FAMOUS_QUOTES);
|
||||
}
|
||||
|
||||
public static String roundLaoZi(){
|
||||
return roundFamousQuotes(LAOZI);
|
||||
}
|
||||
|
||||
public static String roundKonZi(){
|
||||
return roundFamousQuotes(KONGZI);
|
||||
}
|
||||
|
||||
public static String roundTangShi(){
|
||||
return roundFamousQuotes(POETRY_OF_THE_TANG_DYNASTY);
|
||||
}
|
||||
|
||||
public static String roundFamousQuotes(String[] arrays){
|
||||
int index=new java.util.Random().nextInt(arrays.length);
|
||||
return arrays[index];
|
||||
}
|
||||
|
||||
|
||||
private WheelView weel_startTime;
|
||||
private WheelView weel_stopTime;
|
||||
@ -228,11 +30,11 @@ public class SettingActivity extends AppCompatActivity implements View.OnClickLi
|
||||
RadioButton rb_noreport;
|
||||
private EditText et_description;
|
||||
private EditText et_city;
|
||||
|
||||
String[] listTime = new String[48];
|
||||
|
||||
private SharePerferenceModel model;
|
||||
|
||||
String[] listTime = new String[48];
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -6,12 +6,6 @@ import com.openbravo.data.basic.BasicException;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.Reader;
|
||||
import java.sql.Clob;
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
|
||||
import clock.socoolby.com.clock.dao.base.ThemeUI;
|
||||
|
@ -20,6 +20,7 @@ import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
import clock.socoolby.com.clock.ClockApplication;
|
||||
import clock.socoolby.com.clock.FamousQuotesManager;
|
||||
import clock.socoolby.com.clock.MainActivity;
|
||||
import clock.socoolby.com.clock.R;
|
||||
import clock.socoolby.com.clock.SettingActivity;
|
||||
@ -466,7 +467,7 @@ public abstract class AbstractThemeUIFragment extends Fragment implements View.O
|
||||
private void setDiscriptForModel() {
|
||||
String dis = model.getDescription();
|
||||
if (dis == null || dis.isEmpty())
|
||||
dis = SettingActivity.roundFamousQuotes();
|
||||
dis = FamousQuotesManager.roundFamousQuotes();
|
||||
setDiscript(dis);
|
||||
}
|
||||
|
||||
@ -519,7 +520,7 @@ public abstract class AbstractThemeUIFragment extends Fragment implements View.O
|
||||
mainActivity.getClockStateMachine().countingCheck();
|
||||
break;
|
||||
case R.id.tv_descript:
|
||||
setDiscript(SettingActivity.roundAutoQuotes());
|
||||
setDiscript(FamousQuotesManager.roundAutoQuotes());
|
||||
break;
|
||||
case R.id.tv_background_color:
|
||||
if (colorPickerDialog == null)
|
||||
|
@ -0,0 +1,235 @@
|
||||
package clock.socoolby.com.clock.fragment;
|
||||
|
||||
import android.app.admin.DevicePolicyManager;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.EditText;
|
||||
import android.widget.RadioButton;
|
||||
import android.widget.RadioGroup;
|
||||
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.ViewModelProviders;
|
||||
|
||||
import clock.socoolby.com.clock.AboutActivity;
|
||||
import clock.socoolby.com.clock.ActivateAdmin;
|
||||
import clock.socoolby.com.clock.ClockApplication;
|
||||
import clock.socoolby.com.clock.Constants;
|
||||
import clock.socoolby.com.clock.R;
|
||||
import clock.socoolby.com.clock.model.DateModel;
|
||||
import clock.socoolby.com.clock.model.SharePerferenceModel;
|
||||
import clock.socoolby.com.clock.utils.FuncUnit;
|
||||
import clock.socoolby.com.clock.viewmodel.GlobalViewModel;
|
||||
import clock.socoolby.com.clock.viewmodel.ViewModelFactory;
|
||||
import clock.socoolby.com.clock.widget.wheelview.WheelView;
|
||||
import clock.socoolby.com.clock.widget.wheelview.adapters.ArrayWheelAdapter;
|
||||
|
||||
import static android.content.Context.DEVICE_POLICY_SERVICE;
|
||||
|
||||
public class SystemAppConfigFragment extends Fragment implements View.OnClickListener{
|
||||
public static final String TAG= SystemAppConfigFragment.class.getSimpleName();
|
||||
private GlobalViewModel globalViewModel;
|
||||
|
||||
private WheelView weel_startTime;
|
||||
private WheelView weel_stopTime;
|
||||
RadioButton rb_halfhour;
|
||||
RadioButton rb_hours;
|
||||
RadioButton rb_noreport;
|
||||
private EditText et_description;
|
||||
private EditText et_city;
|
||||
String[] listTime = new String[48];
|
||||
|
||||
RadioGroup rg_taking_clock;
|
||||
CheckBox cb_tick;
|
||||
CheckBox cb_trigger_screen;
|
||||
Button btn_uninstall;
|
||||
Button btn_about;
|
||||
Button btn_save;
|
||||
|
||||
private SharePerferenceModel model;
|
||||
|
||||
public SystemAppConfigFragment(SharePerferenceModel model) {
|
||||
this.model = model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
this.globalViewModel = ViewModelProviders.of(getActivity(), new ViewModelFactory(ClockApplication.getInstance().getModel())).get(GlobalViewModel.class);
|
||||
globalViewModel.setAppConfig(true);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
View themeRootView = inflater.inflate(R.layout.fragment_setting, container, false);
|
||||
|
||||
rg_taking_clock = themeRootView.findViewById(R.id.rg_talking_clock);
|
||||
rb_halfhour = themeRootView.findViewById(R.id.rb_halfhour);
|
||||
rb_hours = themeRootView.findViewById(R.id.rb_hours);
|
||||
rb_noreport = themeRootView.findViewById(R.id.rb_noreport);
|
||||
weel_startTime = themeRootView.findViewById(R.id.weel_start_time);
|
||||
weel_stopTime = themeRootView.findViewById(R.id.weel_stop_time);
|
||||
|
||||
et_city =themeRootView.findViewById(R.id.et_city);
|
||||
et_description = themeRootView.findViewById(R.id.et_description);
|
||||
|
||||
|
||||
cb_tick = themeRootView.findViewById(R.id.cb_tick);
|
||||
|
||||
cb_tick.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
|
||||
model.setTickSound(b);
|
||||
}
|
||||
});
|
||||
|
||||
cb_trigger_screen = themeRootView.findViewById(R.id.cb_trigger_screen);
|
||||
|
||||
cb_trigger_screen.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
model.setTriggerScreen(isChecked);
|
||||
}
|
||||
});
|
||||
|
||||
btn_uninstall = themeRootView.findViewById(R.id.btn_uninstall);
|
||||
btn_uninstall.setOnClickListener(this);
|
||||
btn_about = themeRootView.findViewById(R.id.btn_about);
|
||||
btn_about.setOnClickListener(this);
|
||||
|
||||
btn_save= themeRootView.findViewById(R.id.btn_save);
|
||||
btn_save.setOnClickListener(this);
|
||||
|
||||
for (int i = 0; i < 48; i++) {
|
||||
int hours = i / 2;
|
||||
int minutes = i % 2 * 30;
|
||||
String timeString = String.format("%02d:%02d", hours, (minutes + 1));
|
||||
listTime[i] = timeString;
|
||||
}
|
||||
|
||||
ArrayWheelAdapter<String> timeAdpater = new ArrayWheelAdapter<String>(getContext(), listTime);
|
||||
weel_startTime.setViewAdapter(timeAdpater);
|
||||
ArrayWheelAdapter<String> durationAdapter = new ArrayWheelAdapter<String>(getContext(), listTime);
|
||||
weel_stopTime.setViewAdapter(durationAdapter);
|
||||
|
||||
loadDataFromModel();
|
||||
|
||||
rg_taking_clock.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(RadioGroup radioGroup, int index) {
|
||||
int checkID = radioGroup.getCheckedRadioButtonId();
|
||||
switch (checkID) {
|
||||
case R.id.rb_halfhour:
|
||||
model.setTypeHourPower(Constants.TALKING_HALF_AN_HOUR);
|
||||
break;
|
||||
case R.id.rb_hours:
|
||||
model.setTypeHourPower(Constants.TALKING_HOURS);
|
||||
break;
|
||||
case R.id.rb_noreport:
|
||||
model.setTypeHourPower(Constants.TALKING_NO_REPORT);
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
return themeRootView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
globalViewModel.setAppConfig(false);
|
||||
}
|
||||
|
||||
private void loadDataFromModel() {
|
||||
int startTimeIndex = indexOfTimeString(String.format("%02d:%02d", model.getStartHourPowerTime().getHour(), model.getStartHourPowerTime().getMinute()));
|
||||
int stopTimeIndex = indexOfTimeString(String.format("%02d:%02d", model.getStopHourPowerTime().getHour(), model.getStopHourPowerTime().getMinute()));
|
||||
weel_startTime.setCurrentItem(startTimeIndex);
|
||||
weel_stopTime.setCurrentItem(stopTimeIndex);
|
||||
|
||||
cb_tick.setChecked(model.isTickSound());
|
||||
|
||||
cb_trigger_screen.setChecked(model.isTriggerScreen());
|
||||
|
||||
switch (model.getTypeHourPower()) {
|
||||
case Constants.TALKING_HALF_AN_HOUR:
|
||||
rb_halfhour.setChecked(true);
|
||||
break;
|
||||
case Constants.TALKING_HOURS:
|
||||
rb_hours.setChecked(true);
|
||||
break;
|
||||
case Constants.TALKING_NO_REPORT:
|
||||
rb_noreport.setChecked(true);
|
||||
break;
|
||||
}
|
||||
et_city.setText(model.getCity());
|
||||
et_description.setText(model.getDescription());
|
||||
}
|
||||
|
||||
private void saveToModel() {
|
||||
reportTimeConfirm();
|
||||
model.setCity(et_city.getText().toString());
|
||||
model.setDescription(et_description.getText().toString());
|
||||
globalViewModel.loadFromModel();
|
||||
}
|
||||
|
||||
private int indexOfTimeString(String timeString) {
|
||||
for (int i = listTime.length - 1; i >= 0; i--) {
|
||||
if (listTime[i].equals(timeString))
|
||||
return i;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
private void reportTimeConfirm() {
|
||||
String timeStart = listTime[weel_startTime.getCurrentItem()];
|
||||
String timeStop = listTime[weel_stopTime.getCurrentItem()];
|
||||
|
||||
DateModel startTimeModel = new DateModel();
|
||||
startTimeModel.setTimeString(timeStart);
|
||||
DateModel stopTimeModel = new DateModel();
|
||||
stopTimeModel.setTimeString(timeStop);
|
||||
model.setStartHourPowerTime(startTimeModel);
|
||||
model.setStopHourPowerTime(stopTimeModel);
|
||||
}
|
||||
|
||||
private void uninstallActivity() {
|
||||
DevicePolicyManager policyManager;
|
||||
ComponentName componentName;
|
||||
policyManager = (DevicePolicyManager) getActivity().getSystemService(DEVICE_POLICY_SERVICE);
|
||||
|
||||
componentName = new ComponentName(getActivity(), ActivateAdmin.class);
|
||||
policyManager.removeActiveAdmin(componentName);
|
||||
startActivity(new Intent("android.intent.action.DELETE", Uri.parse("package:" + FuncUnit.getBoxPackageName())));
|
||||
getActivity().finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
switch (v.getId()) {
|
||||
case R.id.btn_uninstall:
|
||||
uninstallActivity();
|
||||
break;
|
||||
case R.id.btn_about:
|
||||
Intent intent = new Intent(getActivity(), AboutActivity.class);
|
||||
startActivity(intent);
|
||||
break;
|
||||
case R.id.btn_save:
|
||||
saveToModel();
|
||||
getFragmentManager().popBackStack();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
@ -50,7 +50,6 @@ public class DigitClockConfigFragment extends Fragment {
|
||||
|
||||
ThemeUIManager themeUIManager;
|
||||
|
||||
|
||||
@BindView(R.id.tv_hourSystem12)
|
||||
RadioButton tvHourSystem12;
|
||||
@BindView(R.id.tv_hourSystem24)
|
||||
@ -131,6 +130,12 @@ public class DigitClockConfigFragment extends Fragment {
|
||||
VerticalRangeSeekBar tvTimeTextBaslineDown;
|
||||
@BindView(R.id.tv_textStyle_border_divider_color)
|
||||
Button tvTextStyleBorderDividerColor;
|
||||
@BindView(R.id.tv_time_text_subscript_scale)
|
||||
VerticalRangeSeekBar tvTimeTextSubscriptScale;
|
||||
@BindView(R.id.tv_time_text_padding)
|
||||
VerticalRangeSeekBar tvTimeTextPadding;
|
||||
@BindView(R.id.tv_textStyle_border_doubble)
|
||||
CheckBox tvTextStyleBorderDoubble;
|
||||
|
||||
public DigitClockConfigFragment(ThemeUIManager themeUIManager) {
|
||||
this.themeUIManager = themeUIManager;
|
||||
@ -142,6 +147,7 @@ public class DigitClockConfigFragment extends Fragment {
|
||||
globalViewModel = ViewModelProviders.of(getActivity(), new ViewModelFactory(ClockApplication.getInstance().getModel())).get(GlobalViewModel.class);
|
||||
digitViewModel = ViewModelProviders.of(getActivity(), new ViewModelFactory(ClockApplication.getInstance().getModel())).get(DigitViewModel.class);
|
||||
themeUIManager.saveTempThemeUI(ClockInterfaceTypeEnum.Digit.code);
|
||||
globalViewModel.setAppConfig(true);
|
||||
}
|
||||
|
||||
private Unbinder unbinder;
|
||||
@ -155,7 +161,19 @@ public class DigitClockConfigFragment extends Fragment {
|
||||
|
||||
unbinder = ButterKnife.bind(this, view);
|
||||
|
||||
tvTimeTextBaslineDown.setTickMarkTextArray(new CharSequence[]{"100", "位移", "100"});
|
||||
view.setOnLongClickListener(new View.OnLongClickListener() {
|
||||
@Override
|
||||
public boolean onLongClick(View v) {
|
||||
getFragmentManager().popBackStack();
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
tvTimeTextBaslineDown.setTickMarkTextArray(new CharSequence[]{"下", "位移", "上"});
|
||||
|
||||
tvTimeTextSubscriptScale.setTickMarkTextArray(new CharSequence[]{"1", "秒比", "100"});
|
||||
|
||||
tvTimeTextPadding.setTickMarkTextArray(new CharSequence[]{"0", "间隔", "20"});
|
||||
|
||||
loadForViewModel();
|
||||
|
||||
@ -290,6 +308,7 @@ public class DigitClockConfigFragment extends Fragment {
|
||||
|
||||
tvSecondSubscript.setOnCheckedChangeListener((group, checkedId) -> {
|
||||
digitViewModel.setSecondSubscript(tvSecondSubscript.isChecked());
|
||||
tvTimeTextSubscriptScale.setVisibility(tvSecondSubscript.isChecked() ? View.VISIBLE : View.GONE);
|
||||
});
|
||||
|
||||
tvTextStyleBorder.setOnCheckedChangeListener((group, checkedId) -> {
|
||||
@ -332,6 +351,10 @@ public class DigitClockConfigFragment extends Fragment {
|
||||
colorPickerDialog.show(digitViewModel.getCharBackgroundBorderColor().getValue());
|
||||
});
|
||||
|
||||
tvTextStyleBorderDoubble.setOnCheckedChangeListener((group, checkedId) -> {
|
||||
digitViewModel.setCharBackgroundBorderWithDoubble(tvTextStyleBorderDoubble.isChecked());
|
||||
});
|
||||
|
||||
tvTimeTextBaslineDown.setOnRangeChangedListener(new OnRangeChangedListener() {
|
||||
@Override
|
||||
public void onRangeChanged(RangeSeekBar view, float leftValue, float rightValue, boolean isFromUser) {
|
||||
@ -349,6 +372,40 @@ public class DigitClockConfigFragment extends Fragment {
|
||||
}
|
||||
});
|
||||
|
||||
tvTimeTextSubscriptScale.setOnRangeChangedListener(new OnRangeChangedListener() {
|
||||
@Override
|
||||
public void onRangeChanged(RangeSeekBar view, float leftValue, float rightValue, boolean isFromUser) {
|
||||
digitViewModel.setSubscriptFontScale(new Float(leftValue).intValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStartTrackingTouch(RangeSeekBar view, boolean isLeft) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStopTrackingTouch(RangeSeekBar view, boolean isLeft) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
tvTimeTextPadding.setOnRangeChangedListener(new OnRangeChangedListener() {
|
||||
@Override
|
||||
public void onRangeChanged(RangeSeekBar view, float leftValue, float rightValue, boolean isFromUser) {
|
||||
digitViewModel.setTimeTextPadding(new Float(leftValue).intValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStartTrackingTouch(RangeSeekBar view, boolean isLeft) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStopTrackingTouch(RangeSeekBar view, boolean isLeft) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
@ -412,6 +469,7 @@ public class DigitClockConfigFragment extends Fragment {
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
globalViewModel.setAppConfig(false);
|
||||
unbinder.unbind();
|
||||
}
|
||||
|
||||
@ -496,6 +554,8 @@ public class DigitClockConfigFragment extends Fragment {
|
||||
tvTextStyleBorderColor.setBackgroundColor(digitViewModel.getCharBackgroundBorderColor().getValue());
|
||||
tvTextStyleBorderDividerColor.setBackgroundColor(digitViewModel.getCharBackgroundBorderDividerColor().getValue());
|
||||
|
||||
tvTextStyleBorderDoubble.setChecked(digitViewModel.getCharBackgroundBorderWithDoubble().getValue());
|
||||
|
||||
float baseLineDown = 100f + digitViewModel.getBaseLineDown().getValue();
|
||||
if (baseLineDown > 200)
|
||||
baseLineDown = 200;
|
||||
@ -503,10 +563,17 @@ public class DigitClockConfigFragment extends Fragment {
|
||||
baseLineDown = 100;
|
||||
tvTimeTextBaslineDown.setProgress(baseLineDown);
|
||||
|
||||
digitViewModel.getCharBackgroundBorder().observe(this,(able)->{
|
||||
tvTimeTextSubscriptScale.setVisibility(digitViewModel.getDisplaySecond().getValue() ? View.VISIBLE : View.GONE);
|
||||
tvTimeTextSubscriptScale.setProgress(digitViewModel.getSubscriptFontScale().getValue());
|
||||
|
||||
digitViewModel.getCharBackgroundBorder().observe(this, (able) -> {
|
||||
tvTextStyleBorderColor.setClickable(able);
|
||||
tvTextStyleBorderDividerColor.setClickable(able);
|
||||
tvTextStyleBorderDoubble.setClickable(able);
|
||||
});
|
||||
|
||||
tvTimeTextPadding.setProgress(digitViewModel.getTimeTextPadding().getValue());
|
||||
|
||||
}
|
||||
|
||||
private void setTextColor(int color) {
|
||||
@ -550,9 +617,11 @@ public class DigitClockConfigFragment extends Fragment {
|
||||
tvTextStyleBorder.setTextColor(color);
|
||||
tvTextStyleBorderColor.setTextColor(color);
|
||||
tvTextStyleBorderDividerColor.setTextColor(color);
|
||||
tvTextStyleBorderDoubble.setTextColor(color);
|
||||
|
||||
tvTimeTextBaslineDown.setTickMarkTextColor(color);
|
||||
|
||||
tvTimeTextSubscriptScale.setTickMarkTextColor(color);
|
||||
tvTimeTextPadding.setTickMarkTextColor(color);
|
||||
}
|
||||
|
||||
static Random rand = new Random();
|
||||
|
@ -143,8 +143,13 @@ public class DigitClockFragment extends Fragment {
|
||||
digitViewModel.getCharBackgroundBorderDividerColor().observe(this,color->tv_time.setBackgroundBorderDividerColor(color));
|
||||
|
||||
digitViewModel.getCharBackgroundBorderDividerWidth().observe(this,width->tv_time.setBackgroundBorderDividerWidth(width));
|
||||
}
|
||||
|
||||
digitViewModel.getSubscriptFontScale().observe(this,scale->tv_time.setFontScale(scale));
|
||||
|
||||
digitViewModel.getTimeTextPadding().observe(this,padding->tv_time.setPaddingScale(padding));
|
||||
|
||||
digitViewModel.getCharBackgroundBorderWithDoubble().observe(this,doubble->tv_time.setCharBackgroundBorderWithDoubble(doubble));
|
||||
}
|
||||
|
||||
|
||||
protected void reflushFontStyle(TimeFontStyle fontStyle){
|
||||
|
@ -112,6 +112,7 @@ public class SimulateClockConfigFragment extends Fragment {
|
||||
globalViewModel = ViewModelProviders.of(getActivity(), new ViewModelFactory(ClockApplication.getInstance().getModel())).get(GlobalViewModel.class);
|
||||
simulateViewModel = ViewModelProviders.of(getActivity(), new ViewModelFactory(ClockApplication.getInstance().getModel())).get(SimulateViewModel.class);
|
||||
themeUIManager.saveTempThemeUI(ClockInterfaceTypeEnum.Simulate.code);
|
||||
globalViewModel.setAppConfig(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -125,6 +126,14 @@ public class SimulateClockConfigFragment extends Fragment {
|
||||
View view = inflater.inflate(R.layout.fragment_simulate_config, container, false);
|
||||
unbinder = ButterKnife.bind(this, view);
|
||||
|
||||
view.setOnLongClickListener(new View.OnLongClickListener() {
|
||||
@Override
|
||||
public boolean onLongClick(View v) {
|
||||
getFragmentManager().popBackStack();
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
bindViewModel();
|
||||
|
||||
tvSimulateTextShowGroup.setOnCheckedChangeListener((view1, checkId) -> {
|
||||
@ -318,6 +327,7 @@ public class SimulateClockConfigFragment extends Fragment {
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
globalViewModel.setAppConfig(false);
|
||||
unbinder.unbind();
|
||||
}
|
||||
|
||||
|
@ -111,7 +111,7 @@ public class SimulateClockFragment extends Fragment {
|
||||
AbstractClock clock;
|
||||
|
||||
private void setClockStyle(String clockStyle){
|
||||
//clockAnimator.setColor(globalViewModel.getForegroundColor().getValue());
|
||||
//clockAnimator.setParticleColor(globalViewModel.getForegroundColor().getValue());
|
||||
clock= ClockFactory.build(clockStyle);
|
||||
clockAnimator.setClock(clock);
|
||||
clockAnimator.setClockPointer(PointerFactory.build(simulateViewModel.getPointerTypeName().getValue()));
|
||||
|
@ -45,6 +45,15 @@ public class DigitPerferenceModel {
|
||||
protected final static String KEY_TIME_TEXT_BASELINE_DOWN= "key_time_text_baseline_down";
|
||||
protected Integer baseLineDown=0;
|
||||
|
||||
protected final static String KEY_TIME_TEXT_SUBSCRIPT_FONT_SCALE= "key_time_text_subscript_font_scale";
|
||||
protected Integer subscriptFontScale=40;
|
||||
|
||||
protected final static String KEY_TIME_TEXT_PADDING= "key_time_text_padding";
|
||||
protected Integer timeTextPadding=2;
|
||||
|
||||
|
||||
protected final static String KEY_IS_CHAR_BACKGROUND_BORDER_DUBBLE = "key_is_char_background_border_dubble";
|
||||
protected boolean charBackgroundBorderWithDoubble = false;
|
||||
|
||||
|
||||
public void fromJsonString(JSONObject jsonObject) throws JSONException {
|
||||
@ -61,6 +70,9 @@ public class DigitPerferenceModel {
|
||||
baseLineDown=jsonObject.optInt(KEY_TIME_TEXT_BASELINE_DOWN,0);
|
||||
charBackgroundBorderDividerColor=jsonObject.optInt(KEY_IS_CHAR_BACKGROUND_BORDER_DIVIDER_COLOR, Color.BLACK);
|
||||
charBackgroundBorderDividerStrokeWidth=jsonObject.optInt(KEY_IS_CHAR_BACKGROUND_BORDER_DIVIDER_STROKE_WIDTH, 10);
|
||||
subscriptFontScale=jsonObject.optInt(KEY_TIME_TEXT_SUBSCRIPT_FONT_SCALE, 40);
|
||||
timeTextPadding=jsonObject.optInt(KEY_TIME_TEXT_PADDING, 2);
|
||||
charBackgroundBorderWithDoubble=jsonObject.optBoolean(KEY_IS_CHAR_BACKGROUND_BORDER_DUBBLE, false);
|
||||
}
|
||||
|
||||
|
||||
@ -78,7 +90,9 @@ public class DigitPerferenceModel {
|
||||
jsonObject.put(KEY_TIME_TEXT_BASELINE_DOWN,baseLineDown);
|
||||
jsonObject.put(KEY_IS_CHAR_BACKGROUND_BORDER_DIVIDER_COLOR,charBackgroundBorderDividerColor);
|
||||
jsonObject.put(KEY_IS_CHAR_BACKGROUND_BORDER_DIVIDER_STROKE_WIDTH,charBackgroundBorderDividerStrokeWidth);
|
||||
|
||||
jsonObject.put(KEY_TIME_TEXT_SUBSCRIPT_FONT_SCALE,subscriptFontScale);
|
||||
jsonObject.put(KEY_TIME_TEXT_PADDING,timeTextPadding);
|
||||
jsonObject.put(KEY_IS_CHAR_BACKGROUND_BORDER_DUBBLE,charBackgroundBorderWithDoubble);
|
||||
}
|
||||
|
||||
public static String integerArrayToString(Integer[] fromArrays){
|
||||
@ -207,4 +221,28 @@ public class DigitPerferenceModel {
|
||||
public void setCharBackgroundBorderDividerStrokeWidth(Integer charBackgroundBorderDividerStrokeWidth) {
|
||||
this.charBackgroundBorderDividerStrokeWidth = charBackgroundBorderDividerStrokeWidth;
|
||||
}
|
||||
|
||||
public Integer getSubscriptFontScale() {
|
||||
return subscriptFontScale;
|
||||
}
|
||||
|
||||
public void setSubscriptFontScale(Integer subscriptFontScale) {
|
||||
this.subscriptFontScale = subscriptFontScale;
|
||||
}
|
||||
|
||||
public Integer getTimeTextPadding() {
|
||||
return timeTextPadding;
|
||||
}
|
||||
|
||||
public void setTimeTextPadding(Integer timeTextPadding) {
|
||||
this.timeTextPadding = timeTextPadding;
|
||||
}
|
||||
|
||||
public boolean isCharBackgroundBorderWithDoubble() {
|
||||
return charBackgroundBorderWithDoubble;
|
||||
}
|
||||
|
||||
public void setCharBackgroundBorderWithDoubble(boolean charBackgroundBorderWithDoubble) {
|
||||
this.charBackgroundBorderWithDoubble = charBackgroundBorderWithDoubble;
|
||||
}
|
||||
}
|
||||
|
@ -114,6 +114,9 @@ public class SharePerferenceModel implements Serializable {
|
||||
protected final static String KEY_THEME_UI_TYPE="key_theme_ui_type";
|
||||
protected int themeUIType=1;
|
||||
|
||||
protected final static String KEY_SYS_BOOT_START="key_sys_boot_start";
|
||||
protected boolean bootStart=false;
|
||||
|
||||
|
||||
private int dirtyDelaySecond=10000;
|
||||
|
||||
@ -252,6 +255,8 @@ public class SharePerferenceModel implements Serializable {
|
||||
clockInterfaceType =jsonObject.optInt(KEY_UI_CLOCK_INTERFACE_TYPE,0);
|
||||
autoFullscreen=jsonObject.optBoolean(KEY_UI_AUTO_FULLSCREEN,false);
|
||||
|
||||
bootStart=jsonObject.optBoolean(KEY_SYS_BOOT_START,false);
|
||||
|
||||
themeUILoad(jsonObject);
|
||||
|
||||
} catch (JSONException e) {
|
||||
@ -299,6 +304,8 @@ public class SharePerferenceModel implements Serializable {
|
||||
|
||||
jsonObject.put(KEY_UI_AUTO_FULLSCREEN,autoFullscreen);
|
||||
|
||||
jsonObject.put(KEY_SYS_BOOT_START,bootStart);
|
||||
|
||||
themeUISave(jsonObject);
|
||||
|
||||
} catch (JSONException e) {
|
||||
@ -744,4 +751,39 @@ public class SharePerferenceModel implements Serializable {
|
||||
dirtySave();
|
||||
}
|
||||
|
||||
public boolean isBootStart() {
|
||||
return bootStart;
|
||||
}
|
||||
|
||||
public void setBootStart(boolean bootStart) {
|
||||
this.bootStart = bootStart;
|
||||
dirtySave();
|
||||
}
|
||||
|
||||
public Integer getSubscriptFontScale() {
|
||||
return digitPerferenceModel.getSubscriptFontScale();
|
||||
}
|
||||
|
||||
public void setSubscriptFontScale(Integer subscriptFontScale) {
|
||||
digitPerferenceModel.setSubscriptFontScale(subscriptFontScale);
|
||||
dirtySave();
|
||||
}
|
||||
|
||||
public Integer getTimeTextPadding() {
|
||||
return digitPerferenceModel.getTimeTextPadding();
|
||||
}
|
||||
|
||||
public void setTimeTextPadding(Integer timeTextPadding) {
|
||||
digitPerferenceModel.setTimeTextPadding(timeTextPadding);
|
||||
dirtySave();
|
||||
}
|
||||
|
||||
public boolean isCharBackgroundBorderWithDoubble() {
|
||||
return digitPerferenceModel.isCharBackgroundBorderWithDoubble();
|
||||
}
|
||||
|
||||
public void setCharBackgroundBorderWithDoubble(boolean charBackgroundBorderWithDoubble) {
|
||||
digitPerferenceModel.setCharBackgroundBorderWithDoubble(charBackgroundBorderWithDoubble);
|
||||
dirtySave();
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
package clock.socoolby.com.clock.protocol;
|
||||
package clock.socoolby.com.clock.net;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
@ -6,6 +6,11 @@ import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import clock.socoolby.com.clock.ClockApplication;
|
||||
import clock.socoolby.com.clock.net.protocol.ProtocolConstants;
|
||||
import clock.socoolby.com.clock.net.protocol.update.UpdateRequest;
|
||||
import clock.socoolby.com.clock.net.protocol.update.UpdateResponse;
|
||||
import clock.socoolby.com.clock.net.protocol.weather.WeatherRequest;
|
||||
import clock.socoolby.com.clock.net.protocol.weather.WeatherResponse;
|
||||
import clock.socoolby.com.clock.utils.FuncUnit;
|
||||
import clock.socoolby.com.clock.service.NetworkService;
|
||||
|
||||
@ -27,7 +32,7 @@ public class BusinessService {
|
||||
WeatherResponse weatherResponse = new WeatherResponse(response);
|
||||
try {
|
||||
weatherResponse.parse(response);
|
||||
if (weatherResponse.mResultCode == 0) {
|
||||
if (weatherResponse.getResultCode() == 0) {
|
||||
ClockApplication.getInstance().getMainActivity().setWeather(weatherResponse);
|
||||
}
|
||||
} catch (JSONException e) {
|
@ -0,0 +1,12 @@
|
||||
package clock.socoolby.com.clock.net.protocol;
|
||||
|
||||
public class ProtocolConstants {
|
||||
|
||||
public static final String STR_RESULT_CODE = "code";
|
||||
public static final String STR_RESULT_DES = "msg";
|
||||
|
||||
public static final int RESULT_OK = 0;
|
||||
public static final int RESULT_FAILED = 1;
|
||||
public static final int RESULT_NETWORK_ERROR = -1;
|
||||
|
||||
}
|
@ -1,11 +1,11 @@
|
||||
package clock.socoolby.com.clock.protocol;
|
||||
package clock.socoolby.com.clock.net.protocol;
|
||||
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
public abstract class RequestBase {
|
||||
RequestBase() {
|
||||
public RequestBase() {
|
||||
}
|
||||
|
||||
public String getUrl() {
|
@ -1,11 +1,11 @@
|
||||
package clock.socoolby.com.clock.protocol;
|
||||
package clock.socoolby.com.clock.net.protocol;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
class ResponseBase {
|
||||
int mResultCode = ProtocolConstants.RESULT_FAILED;
|
||||
public class ResponseBase {
|
||||
|
||||
protected int mResultCode = ProtocolConstants.RESULT_FAILED;
|
||||
|
||||
public int getResultCode() {
|
||||
return mResultCode;
|
||||
@ -26,7 +26,7 @@ class ResponseBase {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected boolean parse(JSONObject object) throws JSONException {
|
||||
public boolean parse(JSONObject object) throws JSONException {
|
||||
return true;
|
||||
}
|
||||
}
|
@ -1,12 +1,13 @@
|
||||
package clock.socoolby.com.clock.protocol;
|
||||
package clock.socoolby.com.clock.net.protocol.update;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import clock.socoolby.com.clock.net.protocol.RequestBase;
|
||||
import clock.socoolby.com.clock.utils.FuncUnit;
|
||||
|
||||
|
||||
class UpdateRequest extends RequestBase {
|
||||
public class UpdateRequest extends RequestBase {
|
||||
@Override
|
||||
public String getUrl() {
|
||||
return "http://www.socoolby.com/clock/update";
|
@ -1,8 +1,11 @@
|
||||
package clock.socoolby.com.clock.protocol;
|
||||
package clock.socoolby.com.clock.net.protocol.update;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import clock.socoolby.com.clock.net.protocol.ProtocolConstants;
|
||||
import clock.socoolby.com.clock.net.protocol.ResponseBase;
|
||||
|
||||
/**
|
||||
* Alway zuo,never die.
|
||||
* Created by socoolby on 04/01/2017.
|
||||
@ -26,12 +29,12 @@ public class UpdateResponse extends ResponseBase {
|
||||
private String updateURL = null;
|
||||
private String description = null;
|
||||
|
||||
UpdateResponse(JSONObject response) {
|
||||
public UpdateResponse(JSONObject response) {
|
||||
super.parseResponse(response);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean parse(JSONObject object) throws JSONException {
|
||||
public boolean parse(JSONObject object) throws JSONException {
|
||||
if (object == null)
|
||||
return false;
|
||||
// object = new JSONObject("{\"message\":\"success\",\"code\":0,\"data\":{\"url\":\"http://www.baidu.com/\",\"description\":\"new version\"}}");
|
@ -1,4 +1,4 @@
|
||||
package clock.socoolby.com.clock.protocol;
|
||||
package clock.socoolby.com.clock.net.protocol.weather;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
@ -6,8 +6,10 @@ import org.json.JSONObject;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
|
||||
import clock.socoolby.com.clock.net.protocol.RequestBase;
|
||||
|
||||
class WeatherRequest extends RequestBase {
|
||||
|
||||
public class WeatherRequest extends RequestBase {
|
||||
private String mCity;
|
||||
|
||||
@Override
|
@ -1,4 +1,4 @@
|
||||
package clock.socoolby.com.clock.protocol;
|
||||
package clock.socoolby.com.clock.net.protocol.weather;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
@ -7,6 +7,8 @@ import org.json.JSONObject;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import clock.socoolby.com.clock.net.protocol.ResponseBase;
|
||||
|
||||
public class WeatherResponse extends ResponseBase {
|
||||
/*
|
||||
{
|
||||
@ -160,7 +162,7 @@ public class WeatherResponse extends ResponseBase {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean parse(JSONObject object) throws JSONException {
|
||||
public boolean parse(JSONObject object) throws JSONException {
|
||||
mErrorCode = object.getInt("error");
|
||||
if (mErrorCode == 0) {
|
||||
JSONArray results = object.getJSONArray("results");
|
@ -1,7 +1,6 @@
|
||||
package clock.socoolby.com.clock.pop;
|
||||
|
||||
import android.content.Context;
|
||||
import android.media.Image;
|
||||
import android.net.Uri;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
@ -13,7 +12,7 @@ import com.bumptech.glide.request.RequestOptions;
|
||||
import java.util.List;
|
||||
|
||||
import clock.socoolby.com.clock.R;
|
||||
import clock.socoolby.com.clock.protocol.WeatherResponse;
|
||||
import clock.socoolby.com.clock.net.protocol.weather.WeatherResponse;
|
||||
import razerdp.basepopup.BasePopupWindow;
|
||||
|
||||
public class WeatherPopup extends BasePopupWindow {
|
||||
|
@ -1,13 +0,0 @@
|
||||
package clock.socoolby.com.clock.protocol;
|
||||
|
||||
class ProtocolConstants {
|
||||
|
||||
|
||||
static final String STR_RESULT_CODE = "code";
|
||||
static final String STR_RESULT_DES = "msg";
|
||||
|
||||
static final int RESULT_OK = 0;
|
||||
static final int RESULT_FAILED = 1;
|
||||
public static final int RESULT_NETWORK_ERROR = -1;
|
||||
|
||||
}
|
@ -18,7 +18,7 @@ import org.json.JSONObject;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import clock.socoolby.com.clock.ClockApplication;
|
||||
import clock.socoolby.com.clock.Constants;
|
||||
import clock.socoolby.com.clock.protocol.RequestBase;
|
||||
import clock.socoolby.com.clock.net.protocol.RequestBase;
|
||||
|
||||
public final class NetworkService {
|
||||
private static NetworkService mInstance;
|
||||
|
@ -42,6 +42,13 @@ public class DigitViewModel extends ViewModel {
|
||||
|
||||
private MutableLiveData<Integer> charBackgroundBorderDividerWidth=new MutableLiveData<>();
|
||||
|
||||
private MutableLiveData<Integer> subscriptFontScale=new MutableLiveData<>();
|
||||
|
||||
private MutableLiveData<Integer> timeTextPadding=new MutableLiveData<>();
|
||||
|
||||
private MutableLiveData<Boolean> charBackgroundBorderWithDoubble=new MutableLiveData<>();
|
||||
|
||||
|
||||
SharePerferenceModel model;
|
||||
|
||||
public DigitViewModel(SharePerferenceModel model) {
|
||||
@ -64,6 +71,9 @@ public class DigitViewModel extends ViewModel {
|
||||
charBackgroundBorderColor.setValue(model.getCharBackgroundBorderColor());
|
||||
charBackgroundBorderDividerColor.setValue(model.getCharBackgroundBorderDividerColor());
|
||||
charBackgroundBorderDividerWidth.setValue(model.getCharBackgroundBorderDividerStrokeWidth());
|
||||
subscriptFontScale.setValue(model.getSubscriptFontScale());
|
||||
timeTextPadding.setValue(model.getTimeTextPadding());
|
||||
charBackgroundBorderWithDoubble.setValue(model.isCharBackgroundBorderWithDoubble());
|
||||
}
|
||||
|
||||
public MutableLiveData<Boolean> getDisplaySecond() {
|
||||
@ -203,4 +213,31 @@ public class DigitViewModel extends ViewModel {
|
||||
this.charBackgroundBorderDividerWidth.setValue(charBackgroundBorderDividerWidth);
|
||||
model.setCharBackgroundBorderDividerStrokeWidth(charBackgroundBorderDividerWidth);
|
||||
}
|
||||
|
||||
public MutableLiveData<Integer> getSubscriptFontScale() {
|
||||
return subscriptFontScale;
|
||||
}
|
||||
|
||||
public void setSubscriptFontScale(Integer subscriptFontScale) {
|
||||
this.subscriptFontScale.setValue(subscriptFontScale);
|
||||
model.setSubscriptFontScale(subscriptFontScale);
|
||||
}
|
||||
|
||||
public MutableLiveData<Integer> getTimeTextPadding() {
|
||||
return timeTextPadding;
|
||||
}
|
||||
|
||||
public void setTimeTextPadding(Integer timeTextPadding) {
|
||||
this.timeTextPadding.setValue(timeTextPadding);
|
||||
model.setTimeTextPadding(timeTextPadding);
|
||||
}
|
||||
|
||||
public MutableLiveData<Boolean> getCharBackgroundBorderWithDoubble() {
|
||||
return charBackgroundBorderWithDoubble;
|
||||
}
|
||||
|
||||
public void setCharBackgroundBorderWithDoubble(Boolean charBackgroundBorderWithDoubble) {
|
||||
this.charBackgroundBorderWithDoubble.setValue(charBackgroundBorderWithDoubble);
|
||||
model.setCharBackgroundBorderWithDoubble(charBackgroundBorderWithDoubble);
|
||||
}
|
||||
}
|
||||
|
@ -36,6 +36,8 @@ public class GlobalViewModel extends ViewModel {
|
||||
//system
|
||||
private Boolean tickSound=false;
|
||||
|
||||
private Boolean appConfig=false;
|
||||
|
||||
private MutableLiveData<String> mCity=new MutableLiveData<>();
|
||||
|
||||
private MutableLiveData<Integer> brightness=new MutableLiveData<>();
|
||||
@ -106,6 +108,8 @@ public class GlobalViewModel extends ViewModel {
|
||||
timeHourAnimatorStarting.setValue(false);
|
||||
|
||||
timeHourAnimatordialy.setValue(model.getTimeHourAlterDialy());
|
||||
|
||||
appConfig=false;
|
||||
}
|
||||
|
||||
public MutableLiveData<String> getCity() {
|
||||
@ -320,5 +324,11 @@ public class GlobalViewModel extends ViewModel {
|
||||
this.timeHourAnimatorStarting.setValue(timeHourAnimatorStarting);
|
||||
}
|
||||
|
||||
public Boolean getAppConfig() {
|
||||
return appConfig;
|
||||
}
|
||||
|
||||
public void setAppConfig(Boolean appConfig) {
|
||||
this.appConfig = appConfig;
|
||||
}
|
||||
}
|
||||
|
@ -155,7 +155,7 @@ public class CarrouselAnimator extends AbstractAnimator<CarrouselAnimator.Carrou
|
||||
Matrix matrix=new Matrix();
|
||||
matrix.setScale(pointCicle.scaleX,pointCicle.scaleY);
|
||||
canvas.setMatrix(matrix);
|
||||
//canvas.drawCircle(mCenterX+pointCicle.x,mCenterY+pointCicle.y,pointCicle.r,mPaint);
|
||||
//canvas.drawCircle(mCenterX+pointCicle.percent,mCenterY+pointCicle.y,pointCicle.r,mPaint);
|
||||
canvas.drawCircle(mCenterX+pointCicle.translationX,mCenterX+pointCicle.translationY,pointCicle.r,mPaint);
|
||||
}
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ public class DotsLineAnimator extends AbstractAnimator<DotsLineAnimator.Circle>
|
||||
int color;
|
||||
//创建对象
|
||||
//以一个圆为对象
|
||||
//设置随机的 x,y坐标,r半径,_mx,_my移动的距离
|
||||
//设置随机的 percent,y坐标,r半径,_mx,_my移动的距离
|
||||
//this.r是创建圆的半径,参数越大半径越大
|
||||
//this._mx,this._my是移动的距离,参数越大移动
|
||||
public Circle(float x,float y,float mx,float my,float r,int color) {
|
||||
|
@ -241,7 +241,7 @@ public class FireworkAnimator extends AbstractCacheDifferenceAnimator<FireworkAn
|
||||
//转换为笛卡尔坐标
|
||||
elementTemp.x = new Double(n * Math.cos(m) + elementTemp.speed * animatorValue + windSpeed * windDirection).floatValue();
|
||||
elementTemp.y = new Double(n * Math.sin(m) - elementTemp.speed * animatorValue + gravity * (1 - animatorValue)).floatValue();
|
||||
//Log.d("fireworkAnimator", "element.x:\t" + elementTemp.x + "\telement.y:\t" + elementTemp.y);
|
||||
//Log.d("fireworkAnimator", "element.percent:\t" + elementTemp.percent + "\telement.y:\t" + elementTemp.y);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@ -341,7 +341,7 @@ public class FireworkAnimator extends AbstractCacheDifferenceAnimator<FireworkAn
|
||||
startY=height;
|
||||
x=location.x + fraction * (startX-location.x);
|
||||
y=location.y+fraction * (startY-location.y);
|
||||
//canvas.drawLine(width/2,height,x,y,mPaint);
|
||||
//canvas.drawLine(width/2,height,percent,y,mPaint);
|
||||
canvas.drawCircle(x,y,MID_DEFAULT_ELEMENT_SIZE,mPaint);
|
||||
canvas.drawCircle(x+SMALL_DEFAULT_ELEMENT_SIZE/2,y,SMALL_DEFAULT_ELEMENT_SIZE,mPaint);
|
||||
}
|
||||
|
@ -5,17 +5,16 @@ package clock.socoolby.com.clock.widget.animatorview.animator;
|
||||
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.PointF;
|
||||
import android.graphics.RadialGradient;
|
||||
import android.graphics.Shader;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import clock.socoolby.com.clock.widget.animatorview.AbstractAnimator;
|
||||
import clock.socoolby.com.clock.widget.animatorview.AbstractCacheAbleAnimator;
|
||||
import clock.socoolby.com.clock.widget.animatorview.I_AnimatorEntry;
|
||||
|
||||
public class FluorescenceAnimator extends AbstractAnimator<FluorescenceAnimator.Particle> {
|
||||
public class FluorescenceAnimator extends AbstractCacheAbleAnimator<FluorescenceAnimator.Particle> {
|
||||
|
||||
public static final String NAME="Fluorescence";
|
||||
|
||||
@ -24,7 +23,7 @@ public class FluorescenceAnimator extends AbstractAnimator<FluorescenceAnimator.
|
||||
private int mParticleLife = 3000; //生命基数(毫秒)
|
||||
private int mParticleRandomLife = 8000; //随机范围(基数上范围)
|
||||
private int mParticleNum = 20; //粒子数量
|
||||
private int[] mParticleColors = {0xFF0d4289, 0xff034aa1,0x887b0808, 0xff176bd1, 0xff1f39ff,0x33d4ed00, 0x66ffffff, 0xff777800, 0xff0e2569};//粒子颜色集合
|
||||
//private int[] mParticleColors = {0xFF0d4289, 0xff034aa1,0x887b0808, 0xff176bd1, 0xff1f39ff,0x33d4ed00, 0x66ffffff, 0xff777800, 0xff0e2569};//粒子颜色集合
|
||||
|
||||
List<Particle> cache = new LinkedList<>();
|
||||
|
||||
@ -32,49 +31,44 @@ public class FluorescenceAnimator extends AbstractAnimator<FluorescenceAnimator.
|
||||
super(DYNAMIC_QUANTITY);
|
||||
}
|
||||
|
||||
public FluorescenceAnimator(int mParticleNum) {
|
||||
super(DYNAMIC_QUANTITY);
|
||||
this.mParticleNum=mParticleNum;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean run() {
|
||||
for(Particle particle : list){
|
||||
if(particle.getLife() <= 0){
|
||||
particle.move(width,height);
|
||||
if(particle.getLife()<=0)
|
||||
cache.add(particle);
|
||||
}
|
||||
}
|
||||
moveToTrashCache(cache);
|
||||
list.removeAll(cache);
|
||||
for(int i = 0 ; i < mParticleNum - list.size() ; i ++){
|
||||
list.add(randomParticle());
|
||||
list.add(createNewEntry());
|
||||
}
|
||||
cache.clear();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Particle newParticle;
|
||||
@Override
|
||||
public Particle createNewEntry() {
|
||||
return randomParticle();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initPaint(Paint mPaint) {
|
||||
mPaint = new Paint();
|
||||
mPaint.setStyle(Paint.Style.FILL);
|
||||
mPaint.setAntiAlias(true);
|
||||
}
|
||||
|
||||
private Particle randomParticle(){
|
||||
Particle particle = new Particle();
|
||||
// 随机起始位置
|
||||
PointF startP = new PointF(rand.nextInt(width), rand.nextInt(height));
|
||||
//随机结束位置
|
||||
PointF endP = new PointF(rand.nextInt(width), rand.nextInt(height));
|
||||
particle.setStartPointF(startP);
|
||||
particle.setEndPointF(endP);
|
||||
newParticle =revectForTrashCache();
|
||||
if(newParticle ==null)
|
||||
newParticle =new Particle();
|
||||
newParticle.setStartTime();
|
||||
newParticle.setStartPointF(rand.nextInt(width), rand.nextInt(height));
|
||||
newParticle.setEndPointF(rand.nextInt(width), rand.nextInt(height));
|
||||
// 随机生命
|
||||
particle.setLife(mParticleLife + rand.nextInt(mParticleRandomLife));
|
||||
newParticle.setLife(mParticleLife + rand.nextInt(mParticleRandomLife));
|
||||
// 随机大小
|
||||
particle.setRadius(mParticleRadius + rand.nextInt(mParticleRandomRadius));
|
||||
newParticle.setRadius(mParticleRadius + rand.nextInt(mParticleRandomRadius));
|
||||
// 随机颜色
|
||||
particle.setColor(mParticleColors[rand.nextInt(mParticleColors.length)]);
|
||||
return particle;
|
||||
randomColorIfAble();
|
||||
newParticle.setParticleColor(color);
|
||||
return newParticle;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -83,31 +77,29 @@ public class FluorescenceAnimator extends AbstractAnimator<FluorescenceAnimator.
|
||||
*/
|
||||
public static class Particle implements I_AnimatorEntry {
|
||||
|
||||
private PointF startPointF;//荧光开始坐标
|
||||
private PointF endPointF;//荧光结束点坐标
|
||||
private float startPointX,startPointY;//荧光开始坐标
|
||||
private float endPointX,endPointY;//荧光结束点坐标
|
||||
private float pointX,pointY;//当前坐标
|
||||
private float radius;// 荧光半径
|
||||
private long startTime;//开始时间
|
||||
private int life; //生命
|
||||
private int color;//颜色
|
||||
private int particleColor;//颜色
|
||||
|
||||
private float translate;
|
||||
private Shader shader;
|
||||
private Paint particlePaint=new Paint();
|
||||
|
||||
public Particle(){
|
||||
startTime = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public PointF getStartPointF() {
|
||||
return startPointF;
|
||||
public void setStartPointF(float startPointX,float startPointY) {
|
||||
this.startPointX=startPointX;
|
||||
this.startPointY=startPointY;
|
||||
}
|
||||
|
||||
public void setStartPointF(PointF startPointF) {
|
||||
this.startPointF = startPointF;
|
||||
}
|
||||
|
||||
public PointF getEndPointF() {
|
||||
return endPointF;
|
||||
}
|
||||
|
||||
public void setEndPointF(PointF endPointF) {
|
||||
this.endPointF = endPointF;
|
||||
public void setEndPointF(float endPointX,float endPointY) {
|
||||
this.endPointX=endPointX;
|
||||
this.endPointY=endPointY;
|
||||
}
|
||||
|
||||
public float getRadius() {
|
||||
@ -118,47 +110,19 @@ public class FluorescenceAnimator extends AbstractAnimator<FluorescenceAnimator.
|
||||
this.radius = radius;
|
||||
}
|
||||
|
||||
public long getStartTime() {
|
||||
return startTime;
|
||||
}
|
||||
|
||||
public void setLife(int life) {
|
||||
this.life = life;
|
||||
}
|
||||
|
||||
public int getColor() {
|
||||
return color;
|
||||
public int getParticleColor() {
|
||||
return particleColor;
|
||||
}
|
||||
|
||||
public void setColor(int color) {
|
||||
this.color = color;
|
||||
public void setParticleColor(int particleColor) {
|
||||
this.particleColor = particleColor;
|
||||
shader=null;
|
||||
}
|
||||
|
||||
//获取粒子透明度:先透明再实体再透明(二次函数)
|
||||
public float getTranslate(){
|
||||
// 根据生命计算透明度
|
||||
int life = getLife();
|
||||
if(life <= 0){
|
||||
return 0;
|
||||
}else{
|
||||
// y = 4x - 4x的平方
|
||||
float x = (life * 1.0f / this.life);
|
||||
return 4 * x *(1 - x);
|
||||
}
|
||||
}
|
||||
|
||||
// 获取当前位置
|
||||
public PointF getPoint(){
|
||||
int life = getLife();
|
||||
if(life <= 0){
|
||||
return null;
|
||||
}else{
|
||||
PointF pointF = new PointF();
|
||||
pointF.x = endPointF.x + (endPointF.x - startPointF.x) * (life * 1.0f / this.life);
|
||||
pointF.y = endPointF.y + (endPointF.y - startPointF.y) * (life * 1.0f / this.life);
|
||||
return pointF;
|
||||
}
|
||||
}
|
||||
|
||||
//获取剩余生命
|
||||
public int getLife(){
|
||||
@ -167,24 +131,38 @@ public class FluorescenceAnimator extends AbstractAnimator<FluorescenceAnimator.
|
||||
|
||||
@Override
|
||||
public void move(int maxWidth, int maxHight) {
|
||||
|
||||
int life = getLife();
|
||||
if(life <= 0)
|
||||
return;
|
||||
float x = (life * 1.0f / this.life);
|
||||
pointX = endPointX + (endPointX - startPointX) * x;
|
||||
pointY = endPointY + (endPointY - startPointY) * x;
|
||||
//获取粒子透明度:先透明再实体再透明(二次函数)
|
||||
translate=4 * x *(1 - x);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onDraw(Canvas canvas,Paint mPaint) {
|
||||
PointF point = this.getPoint();
|
||||
if(point == null){
|
||||
return;
|
||||
if(shader==null) {
|
||||
shader = new RadialGradient(0, 0, radius, particleColor, 0x00000000, Shader.TileMode.CLAMP);
|
||||
particlePaint.setShader(shader);
|
||||
}
|
||||
Shader shader = new RadialGradient(point.x, point.y, radius, color, 0x00000000, Shader.TileMode.CLAMP);
|
||||
mPaint.setShader(shader);
|
||||
mPaint.setAlpha((int)(getTranslate() * 255));
|
||||
canvas.drawCircle(point.x, point.y, getRadius(), mPaint);
|
||||
particlePaint.setAlpha((int)(translate * 255));
|
||||
canvas.save();
|
||||
canvas.translate(pointX, pointY);
|
||||
canvas.drawCircle(0, 0, radius, particlePaint);
|
||||
canvas.restore();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAnimatorEntryColor(int color) {
|
||||
this.color=color;
|
||||
this.particleColor =color;
|
||||
shader=null;
|
||||
}
|
||||
|
||||
public void setStartTime() {
|
||||
startTime = System.currentTimeMillis();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ public class RainAnimator extends AbstractAnimator<RainAnimator.Rain> {
|
||||
}
|
||||
|
||||
public void printPosition(){
|
||||
Log.d("rainPoint", "x : " + point.left + " y : " + point.top + " r : " + point.right + " b : " + point.bottom);
|
||||
Log.d("rainPoint", "percent : " + point.left + " y : " + point.top + " r : " + point.right + " b : " + point.bottom);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -139,7 +139,7 @@ public class SnowAnimator extends AbstractAnimator<SnowAnimator.SnowPoint> {
|
||||
}
|
||||
|
||||
public void printPosition() {
|
||||
Log.d("SknowPoint", "x : " + rect.left + " y : " + rect.top + " r : "
|
||||
Log.d("SknowPoint", "percent : " + rect.left + " y : " + rect.top + " r : "
|
||||
+ rect.right + " b : " + rect.bottom);
|
||||
}
|
||||
|
||||
|
@ -280,7 +280,7 @@ public class VorolayAnimator extends AbstractAnimator<VorolayAnimator.Vorolay> {
|
||||
}
|
||||
|
||||
// draw site
|
||||
// canvas.drawBorder((float)region.site.x, (float)region.site.y, 10, p);
|
||||
// canvas.drawBorder((float)region.site.percent, (float)region.site.y, 10, p);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -67,7 +67,7 @@ public class WaterAnimator extends AbstractAnimator<WaterAnimator.Water> {
|
||||
/*mBelowWavePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||
mBelowWavePaint.setAntiAlias(true);
|
||||
mBelowWavePaint.setStyle(Paint.Style.FILL);
|
||||
mBelowWavePaint.setColor(Color.BLUE);
|
||||
mBelowWavePaint.setParticleColor(Color.BLUE);
|
||||
mBelowWavePaint.setAlpha(60);*/
|
||||
//画布抗锯齿
|
||||
mDrawFilter = new PaintFlagsDrawFilter(0, Paint.ANTI_ALIAS_FLAG | Paint.FILTER_BITMAP_FLAG);
|
||||
@ -99,9 +99,9 @@ public class WaterAnimator extends AbstractAnimator<WaterAnimator.Water> {
|
||||
* k—偏距,反映在坐标系上则为图像的上移或下移。
|
||||
*/
|
||||
y = (float) (30 * Math.cos(ω * x + φ) + 30)+y2;
|
||||
// y2 = (float) (30 * Math.sin(ω * x + φ) + 30);
|
||||
// y2 = (float) (30 * Math.sin(ω * percent + φ) + 30);
|
||||
mAbovePath.lineTo(x, y);
|
||||
// mBelowWavePath.lineTo(x, y2);
|
||||
// mBelowWavePath.lineTo(percent, y2);
|
||||
if (x == width / 2) {
|
||||
mPaint.setColor(color);
|
||||
canvas.drawCircle(x, y-40, 20, mPaint);
|
||||
|
@ -93,7 +93,7 @@ public class Wave3DAnimator extends AbstractAnimator<Wave3DAnimator.Wave> {
|
||||
//this.engine.fillStyle = `hsla(${180 + hl * 180 | 0}, 70%, ${25 + (h * -1) * 25 | 0}%, ${0.5 + (h *-1) * 0.5})`;
|
||||
|
||||
// this.engine.fillRect(
|
||||
// this.midX + point.x * this.width * 0.3,
|
||||
// this.midX + point.percent * this.width * 0.3,
|
||||
// this.midY + point.y * this.width * 0.1 + hs,
|
||||
// 3 * s,
|
||||
// 3 * s
|
||||
|
@ -69,7 +69,7 @@ public abstract class AbstractClock implements I_AnimatorEntry {
|
||||
mTextPaint.setStrokeWidth(mDefaultScaleWidth / 2);
|
||||
mTextPaint.setTextSize(mParticularlyScaleWidth * 4);
|
||||
mTextPaint.setTextAlign(Paint.Align.CENTER);
|
||||
//mTextPaint.setColor(textColor);
|
||||
//mTextPaint.setParticleColor(textColor);
|
||||
}
|
||||
|
||||
|
||||
|
@ -14,7 +14,7 @@ public class HelixClock extends AbstractClock {
|
||||
/** canvas.save();
|
||||
canvas.translate(mCenterX, mCenterY);
|
||||
mDefaultPaint.setStrokeWidth(mDefaultScaleWidth);
|
||||
mDefaultPaint.setColor(mClockColor);
|
||||
mDefaultPaint.setParticleColor(mClockColor);
|
||||
|
||||
canvas.drawCircle(0, 0, mRadius, mDefaultPaint);
|
||||
|
||||
@ -22,14 +22,14 @@ public class HelixClock extends AbstractClock {
|
||||
if (i % 5 == 0) { // 特殊时刻
|
||||
|
||||
mDefaultPaint.setStrokeWidth(mParticularlyScaleWidth);
|
||||
mDefaultPaint.setColor(mColorParticularyScale);
|
||||
mDefaultPaint.setParticleColor(mColorParticularyScale);
|
||||
|
||||
canvas.drawLine(0, -mRadius, 0, -mRadius + mParticularlyScaleLength, mDefaultPaint);
|
||||
|
||||
} else { // 一般时刻
|
||||
|
||||
mDefaultPaint.setStrokeWidth(mDefaultScaleWidth);
|
||||
mDefaultPaint.setColor(mColorDefaultScale);
|
||||
mDefaultPaint.setParticleColor(mColorDefaultScale);
|
||||
|
||||
canvas.drawLine(0, -mRadius, 0, -mRadius + mDefaultScaleLength, mDefaultPaint);
|
||||
|
||||
|
@ -30,7 +30,7 @@ public class HexagonalClock extends AbstractClock {
|
||||
|
||||
//边框,好像不画好看
|
||||
//mDefaultPaint.setStrokeWidth(mDefaultScaleWidth);
|
||||
//mDefaultPaint.setColor(mClockColor);
|
||||
//mDefaultPaint.setParticleColor(mClockColor);
|
||||
//canvas.drawLine(lineStartX, startY, lineStartX+octagonalLineLenght,startY, mDefaultPaint);
|
||||
|
||||
mDefaultPaint.setStrokeWidth(mParticularlyScaleWidth);
|
||||
|
@ -99,7 +99,7 @@ public class RingSlideTimeRangeSelector extends View {
|
||||
*/
|
||||
select_Paint=new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||
select_Paint.setShader(new SweepGradient(0, 0, arrColorCircle, null));
|
||||
/*select_Paint.setColor(circle_color);*/
|
||||
/*select_Paint.setParticleColor(circle_color);*/
|
||||
select_Paint.setAntiAlias(true);
|
||||
select_Paint.setStyle(Paint.Style.STROKE);
|
||||
select_Paint.setStrokeWidth(ring_width);
|
||||
|
@ -45,6 +45,8 @@ public class DigitTextView extends androidx.appcompat.widget.AppCompatTextView {
|
||||
|
||||
private boolean charBackgroundBorder = false;
|
||||
|
||||
private boolean charBackgroundBorderWithDoubble=false;
|
||||
|
||||
private int charBackgroundBorderColor = Color.BLACK;
|
||||
|
||||
private int textWidth = 0;
|
||||
@ -52,10 +54,15 @@ public class DigitTextView extends androidx.appcompat.widget.AppCompatTextView {
|
||||
private int textFontHight;
|
||||
private int baseCharWidth;
|
||||
private int flagCharwidth;
|
||||
private int smallTextHight;
|
||||
private int smallCharWidth;
|
||||
private int subscriptTextHight;
|
||||
private int subscriptCharWidth;
|
||||
private int textLength;
|
||||
private int textSmallSpan;
|
||||
private int textSubscriptSpan;
|
||||
|
||||
private int fontScale=80;
|
||||
|
||||
private int fontBaseLineHeightChange;
|
||||
|
||||
private HashMap<Integer, AbstractCharAnimator> charAnimatorHashMap = new HashMap<>();
|
||||
|
||||
private CharAnimatorEnum currentCharAnimatorType = CharAnimatorEnum.Marquee3D_Up;
|
||||
@ -68,18 +75,14 @@ public class DigitTextView extends androidx.appcompat.widget.AppCompatTextView {
|
||||
|
||||
Paint mTextPaint;
|
||||
|
||||
float fontScale;
|
||||
|
||||
String charStr;
|
||||
|
||||
float centerY;
|
||||
|
||||
CharSequence textToDraw;
|
||||
|
||||
Paint.FontMetricsInt fm;
|
||||
|
||||
int padding = 2;
|
||||
|
||||
int paddingScale=20;
|
||||
|
||||
int charWidth;
|
||||
|
||||
Paint mDividerPaint, mBackgroundPaint;
|
||||
@ -108,7 +111,6 @@ public class DigitTextView extends androidx.appcompat.widget.AppCompatTextView {
|
||||
mDividerPaint.setColor(Color.WHITE);
|
||||
mDividerPaint.setStrokeWidth(10);
|
||||
|
||||
|
||||
mBackgroundPaint = new Paint();
|
||||
mBackgroundPaint.setAntiAlias(true);
|
||||
}
|
||||
@ -224,21 +226,19 @@ public class DigitTextView extends androidx.appcompat.widget.AppCompatTextView {
|
||||
}
|
||||
|
||||
private void layoutReflush(CharSequence textToDraw){
|
||||
fm = mTextPaint.getFontMetricsInt();
|
||||
|
||||
baseCharWidth = getCharWidth("8", mTextPaint);
|
||||
padding = baseCharWidth / 20;
|
||||
//baseCharWidth+=padding;
|
||||
padding = baseCharWidth / paddingScale;
|
||||
|
||||
flagCharwidth = getCharWidth(":", mTextPaint);
|
||||
textFontHight = (int) getFontHeight(mTextPaint);
|
||||
textBodyHight =(int)getFontBodyHeight(mTextPaint);
|
||||
|
||||
smallTextHight = textFontHight;
|
||||
smallCharWidth = baseCharWidth;
|
||||
subscriptTextHight = textFontHight;
|
||||
subscriptCharWidth = baseCharWidth;
|
||||
|
||||
textLength = textToDraw.length();
|
||||
textSmallSpan = 0;
|
||||
textSubscriptSpan = 0;
|
||||
|
||||
if (textLength > 4) {
|
||||
textWidth = (baseCharWidth + padding) * 4 + flagCharwidth;
|
||||
@ -246,14 +246,12 @@ public class DigitTextView extends androidx.appcompat.widget.AppCompatTextView {
|
||||
|
||||
if (textLength > 7) {
|
||||
if (secondSubscript) {
|
||||
fontScale = getResources().getDisplayMetrics().scaledDensity;
|
||||
smallCharPaint = getCustomTextPaint(mTextPaint, mTextPaint.getTextSize() / fontScale * 4 / 5);
|
||||
smallCharWidth = getCharWidth("8", smallCharPaint);
|
||||
fm = smallCharPaint.getFontMetricsInt();
|
||||
smallTextHight =(int) getFontHeight(smallCharPaint);
|
||||
subscriptCharWidth = getCharWidth("8", smallCharPaint);
|
||||
subscriptTextHight =(int) getFontHeight(smallCharPaint);
|
||||
fontBaseLineHeightChange=(int)getFontBaseLineHeightChange(mTextPaint,smallCharPaint);
|
||||
} else
|
||||
textSmallSpan = textSmallSpan + flagCharwidth;
|
||||
textSmallSpan = textSmallSpan + smallCharWidth * 2;
|
||||
textSubscriptSpan = textSubscriptSpan + flagCharwidth;
|
||||
textSubscriptSpan = textSubscriptSpan + subscriptCharWidth * 2;
|
||||
}
|
||||
|
||||
layoutReflushAble=false;
|
||||
@ -274,15 +272,18 @@ public class DigitTextView extends androidx.appcompat.widget.AppCompatTextView {
|
||||
|
||||
textToDraw = getText();
|
||||
|
||||
if (linearGradientReCreate)
|
||||
linearGradientReflush();
|
||||
|
||||
if(secondSubscript)
|
||||
smallCharPaint = getCustomScaleTextPaint(mTextPaint, fontScale);
|
||||
|
||||
if(layoutReflushCheck(textToDraw))
|
||||
layoutReflush(textToDraw);
|
||||
|
||||
startX = (getWidth() - textWidth - textSmallSpan) / 2;
|
||||
startX = (getWidth() - textWidth - textSubscriptSpan) / 2;
|
||||
startY = (getHeight() + textBodyHight) / 2+baseLineDown;
|
||||
|
||||
if (linearGradientReCreate)
|
||||
linearGradientReflush();
|
||||
|
||||
for (int i = 0; i < textLength; i++) {
|
||||
charStr = String.valueOf(textToDraw.charAt(i));
|
||||
if (i < 5) {
|
||||
@ -295,32 +296,38 @@ public class DigitTextView extends androidx.appcompat.widget.AppCompatTextView {
|
||||
}
|
||||
} else if (i == 5) {
|
||||
if (secondSubscript)
|
||||
startX += smallCharWidth / 2;
|
||||
startX += subscriptCharWidth / 2;
|
||||
else {
|
||||
canvas.drawText(charStr, startX, startY , mTextPaint);
|
||||
startX += flagCharwidth;
|
||||
}
|
||||
} else {
|
||||
if (secondSubscript) {
|
||||
centerY = (getHeight() + smallTextHight) / 2;
|
||||
centerY = centerY + (startY - centerY) / 2 + smallCharPaint.getFontMetrics().descent;
|
||||
smallCharPaint.setColor(getCurrentTextColor());
|
||||
if (charBackgroundBorder)
|
||||
drawBackground(canvas, startX, centerY - smallTextHight, smallCharWidth, smallTextHight, mBackgroundPaint);
|
||||
drawChar(canvas, charStr, startX, centerY, smallCharPaint);
|
||||
if(charBackgroundBorderWithDoubble) {
|
||||
if (i == 6)
|
||||
drawBackground(canvas, startX, startY+fontBaseLineHeightChange-subscriptTextHight+smallCharPaint.getFontMetrics().bottom, subscriptCharWidth*2, subscriptTextHight, mBackgroundPaint);
|
||||
}else
|
||||
drawBackground(canvas, startX, startY+fontBaseLineHeightChange-subscriptTextHight+smallCharPaint.getFontMetrics().bottom, subscriptCharWidth, subscriptTextHight, mBackgroundPaint);
|
||||
drawChar(canvas, charStr, startX, startY+fontBaseLineHeightChange, smallCharPaint);
|
||||
if (charBackgroundBorder)
|
||||
if(charBackgroundBorderWithDoubble) {
|
||||
if (i == 7)
|
||||
drawDivider(canvas, startX-subscriptCharWidth, startY+fontBaseLineHeightChange-subscriptTextHight+smallCharPaint.getFontMetrics().bottom, subscriptCharWidth*2, subscriptTextHight, mDividerPaint);
|
||||
}else
|
||||
drawDivider(canvas, startX, startY+fontBaseLineHeightChange-subscriptTextHight+smallCharPaint.getFontMetrics().bottom, subscriptCharWidth, subscriptTextHight, mDividerPaint);
|
||||
} else {
|
||||
drawCharWithAnaimatorCheck(canvas, i, charStr, startX, startY, mTextPaint);
|
||||
startX += padding;
|
||||
}
|
||||
startX += smallCharWidth;
|
||||
//Log.d(Tag,"view hight:"+getHeight()+"\t startY:"+startY+"\t text hight:"+textBodyHight+"small text hight:"+smallTextHight);
|
||||
startX += subscriptCharWidth;
|
||||
//Log.d(Tag,"view hight:"+getHeight()+"\t startY:"+startY+"\t text hight:"+textBodyHight+"small text hight:"+subscriptTextHight);
|
||||
}
|
||||
}
|
||||
preString = textToDraw;
|
||||
//Log.d(Tag,"total draw time:"+(System.currentTimeMillis()-before));
|
||||
}
|
||||
|
||||
|
||||
private void drawBackground(Canvas canvas, float startX, float startY, int width, int height, Paint mBackgroundPaint) {
|
||||
mBackgroundPaint.setColor(charBackgroundBorderColor);
|
||||
//canvas.drawRoundRect(new RectF(startX, startY, startX + width, startY + height), 10, 10, mBackgroundPaint);
|
||||
@ -345,7 +352,11 @@ public class DigitTextView extends androidx.appcompat.widget.AppCompatTextView {
|
||||
charWidth = getCharWidth(charStr, mTextPaint);
|
||||
//Log.d(Tag,"view width:"+getWidth()+"\t heitht:"+getHeight()+"\t startx:"+startX+"\t startY:"+startY+"\t baseCharWidth:"+baseCharWidth+"\t text hight:"+textBodyHight+"\t text font hight:"+textFontHight);
|
||||
if (charBackgroundBorder)
|
||||
drawBackground(canvas, startX, startY-textFontHight+mTextPaint.getFontMetrics().bottom, baseCharWidth, textFontHight, mBackgroundPaint);
|
||||
if(charBackgroundBorderWithDoubble) {
|
||||
if (i == 0 || i == 3 || i == 6)
|
||||
drawBackground(canvas, startX, startY - textFontHight + mTextPaint.getFontMetrics().bottom, baseCharWidth*2+padding, textFontHight, mBackgroundPaint);
|
||||
}else
|
||||
drawBackground(canvas, startX, startY-textFontHight+mTextPaint.getFontMetrics().bottom, baseCharWidth, textFontHight, mBackgroundPaint);
|
||||
if (currentCharAnimatorType != CharAnimatorEnum.NOSETUP) {
|
||||
charAnimator = charAnimatorHashMap.get(i);
|
||||
if (charAnimator != null && !charAnimator.isCharAnimatorRuning()) {
|
||||
@ -360,17 +371,23 @@ public class DigitTextView extends androidx.appcompat.widget.AppCompatTextView {
|
||||
//charAnimator.drawCharAnimator(canvas, startX + (baseCharWidth - charWidth) / 2, startY , mTextPaint);
|
||||
charAnimator.drawCharAnimator(canvas, startX, startY , mTextPaint);
|
||||
//Log.d(Tag,"charAnimator index i:"+i+"\tanimator percent:");
|
||||
invalidate();
|
||||
} else {
|
||||
drawChar(canvas, charStr, startX + (baseCharWidth - charWidth) / 2, startY, mTextPaint);
|
||||
if (charBackgroundBorder)
|
||||
drawDivider(canvas, startX, startY - textFontHight+mTextPaint.getFontMetrics().bottom, baseCharWidth, textFontHight, mDividerPaint);
|
||||
if(charBackgroundBorderWithDoubble) {
|
||||
if (i == 1 || i == 4 || i == 7)
|
||||
drawDivider(canvas, startX-baseCharWidth-padding, startY - textFontHight + mTextPaint.getFontMetrics().bottom, baseCharWidth*2+padding, textFontHight, mDividerPaint);
|
||||
}else
|
||||
drawDivider(canvas, startX, startY - textFontHight+mTextPaint.getFontMetrics().bottom , baseCharWidth, textFontHight, mDividerPaint);
|
||||
invalidate();
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
drawChar(canvas, charStr, startX + (baseCharWidth - charWidth) / 2, startY , mTextPaint);
|
||||
if (charBackgroundBorder)
|
||||
drawDivider(canvas, startX, startY - textFontHight+mTextPaint.getFontMetrics().bottom , baseCharWidth, textFontHight, mDividerPaint);
|
||||
}
|
||||
drawChar(canvas, charStr, startX + (baseCharWidth - charWidth) / 2, startY , mTextPaint);
|
||||
if (charBackgroundBorder)
|
||||
if(charBackgroundBorderWithDoubble) {
|
||||
if (i == 1 || i == 4 || i == 7)
|
||||
drawDivider(canvas, startX-baseCharWidth-padding, startY - textFontHight + mTextPaint.getFontMetrics().bottom, baseCharWidth*2+padding, textFontHight, mDividerPaint);
|
||||
}else
|
||||
drawDivider(canvas, startX, startY - textFontHight+mTextPaint.getFontMetrics().bottom , baseCharWidth, textFontHight, mDividerPaint);
|
||||
}
|
||||
|
||||
Paint reflectedPaint;
|
||||
@ -415,9 +432,9 @@ public class DigitTextView extends androidx.appcompat.widget.AppCompatTextView {
|
||||
return charAnimator;
|
||||
}
|
||||
|
||||
private static TextPaint getCustomTextPaint(Paint srcPaint, float fontSizeSp) {
|
||||
private static TextPaint getCustomScaleTextPaint(Paint srcPaint, float fontSizeScale) {
|
||||
TextPaint paint = new TextPaint(srcPaint);
|
||||
paint.setTextSize(fontSizeSp); //设定字体大小, sp转换为px
|
||||
paint.setTextSize(srcPaint.getTextSize()*fontSizeScale/100); //设定字体大小, sp转换为px
|
||||
return paint;
|
||||
}
|
||||
|
||||
@ -440,6 +457,12 @@ public class DigitTextView extends androidx.appcompat.widget.AppCompatTextView {
|
||||
return fm.bottom - fm.top;
|
||||
}
|
||||
|
||||
public static float getFontBaseLineHeightChange(Paint base,Paint point){
|
||||
Paint.FontMetrics fmBase = base.getFontMetrics();
|
||||
Paint.FontMetrics fm = point.getFontMetrics();
|
||||
return fmBase.ascent-fmBase.top-(fm.ascent-fm.top);
|
||||
}
|
||||
|
||||
public static float getFontBodyHeight(Paint paint) {
|
||||
Paint.FontMetrics fm = paint.getFontMetrics();
|
||||
return fm.descent - fm.ascent;
|
||||
@ -468,4 +491,30 @@ public class DigitTextView extends androidx.appcompat.widget.AppCompatTextView {
|
||||
public void setBackgroundBorderDividerWidth(int width){
|
||||
mDividerPaint.setStrokeWidth(width);
|
||||
}
|
||||
|
||||
|
||||
public int getFontScale() {
|
||||
return fontScale;
|
||||
}
|
||||
|
||||
public void setFontScale(int fontScale) {
|
||||
this.fontScale = fontScale;
|
||||
layoutReflushAble=true;
|
||||
}
|
||||
|
||||
|
||||
public void setPaddingScale(int padding) {
|
||||
this.paddingScale = 20-padding;
|
||||
if(paddingScale<=0)
|
||||
paddingScale=1;
|
||||
layoutReflushAble=true;
|
||||
}
|
||||
|
||||
public boolean isCharBackgroundBorderWithDoubble() {
|
||||
return charBackgroundBorderWithDoubble;
|
||||
}
|
||||
|
||||
public void setCharBackgroundBorderWithDoubble(boolean charBackgroundBorderWithDoubble) {
|
||||
this.charBackgroundBorderWithDoubble = charBackgroundBorderWithDoubble;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,10 @@
|
||||
package clock.socoolby.com.clock.widget.textview;
|
||||
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Paint;
|
||||
|
||||
public interface I_Border {
|
||||
void drawBackground(Canvas canvas, float startX, float startY, int width, int height, Paint mBackgroundPaint);
|
||||
|
||||
void drawDivider(Canvas canvas, float startX, float startY, int width, int height, Paint mDividerPaint);
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package clock.socoolby.com.clock.widget.textview.border;
|
||||
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Paint;
|
||||
|
||||
import clock.socoolby.com.clock.widget.textview.I_Border;
|
||||
|
||||
public abstract class AbstractBorder implements I_Border {
|
||||
|
||||
public void drawDivider(Canvas canvas, float startX, float startY, int width, int height, Paint mDividerPaint) {
|
||||
canvas.drawLine(startX+mDividerPaint.getStrokeWidth(), startY+height/2, startX+width-mDividerPaint.getStrokeWidth(), startY+height/2, mDividerPaint);
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package clock.socoolby.com.clock.widget.textview.border;
|
||||
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.RectF;
|
||||
|
||||
public class DefaultBorder extends AbstractBorder {
|
||||
|
||||
public void drawBackground(Canvas canvas, float startX, float startY, int width, int height, Paint mBackgroundPaint) {
|
||||
canvas.drawRoundRect(new RectF(startX, startY, startX + width, startY + height), 10, 10, mBackgroundPaint);
|
||||
}
|
||||
}
|
@ -98,9 +98,9 @@ public class TabDigit_old{
|
||||
} else if (attr == R.styleable.TabDigit_cornerSize) {
|
||||
cornerSize = ta.getDimensionPixelSize(attr, -1);
|
||||
} else if (attr == R.styleable.TabDigit_textColor) {
|
||||
textColor = ta.getColor(attr, 1);
|
||||
textColor = ta.getParticleColor(attr, 1);
|
||||
} else if (attr == R.styleable.TabDigit_backgroundColor) {
|
||||
backgroundColor = ta.getColor(attr, 1);
|
||||
backgroundColor = ta.getParticleColor(attr, 1);
|
||||
} else if (attr == R.styleable.TabDigit_reverseRotation) {
|
||||
reverseRotation = ta.getBoolean(attr, false);
|
||||
}
|
||||
@ -120,11 +120,11 @@ public class TabDigit_old{
|
||||
}
|
||||
|
||||
if (textColor < 1) {
|
||||
mNumberPaint.setColor(textColor);
|
||||
mNumberPaint.setParticleColor(textColor);
|
||||
}
|
||||
|
||||
if (backgroundColor < 1) {
|
||||
mBackgroundPaint.setColor(backgroundColor);
|
||||
mBackgroundPaint.setParticleColor(backgroundColor);
|
||||
}
|
||||
|
||||
mReverseRotation = reverseRotation;
|
||||
@ -137,17 +137,17 @@ public class TabDigit_old{
|
||||
mNumberPaint = new Paint();
|
||||
mNumberPaint.setAntiAlias(true);
|
||||
mNumberPaint.setStyle(Paint.Style.FILL_AND_STROKE);
|
||||
mNumberPaint.setColor(Color.WHITE);
|
||||
mNumberPaint.setParticleColor(Color.WHITE);
|
||||
|
||||
mDividerPaint = new Paint();
|
||||
mDividerPaint.setAntiAlias(true);
|
||||
mDividerPaint.setStyle(Paint.Style.FILL_AND_STROKE);
|
||||
mDividerPaint.setColor(Color.WHITE);
|
||||
mDividerPaint.setParticleColor(Color.WHITE);
|
||||
mDividerPaint.setStrokeWidth(1);
|
||||
|
||||
mBackgroundPaint = new Paint();
|
||||
mBackgroundPaint.setAntiAlias(true);
|
||||
mBackgroundPaint.setColor(Color.BLACK);
|
||||
mBackgroundPaint.setParticleColor(Color.BLACK);
|
||||
}
|
||||
|
||||
private void initTabs() {
|
||||
@ -244,7 +244,7 @@ public class TabDigit_old{
|
||||
return (int) mNumberPaint.getTextSize();
|
||||
}
|
||||
|
||||
public void setPadding(int padding) {
|
||||
public void setPaddingScale(int padding) {
|
||||
mPadding = padding;
|
||||
requestLayout();
|
||||
}
|
||||
@ -265,7 +265,7 @@ public class TabDigit_old{
|
||||
|
||||
|
||||
public void setDividerColor(int color) {
|
||||
mDividerPaint.setColor(color);
|
||||
mDividerPaint.setParticleColor(color);
|
||||
}
|
||||
|
||||
public int getPadding(){
|
||||
@ -273,11 +273,11 @@ public class TabDigit_old{
|
||||
}
|
||||
|
||||
public void setTextColor(int color) {
|
||||
mNumberPaint.setColor(color);
|
||||
mNumberPaint.setParticleColor(color);
|
||||
}
|
||||
|
||||
public int getTextColor() {
|
||||
return mNumberPaint.getColor();
|
||||
return mNumberPaint.getParticleColor();
|
||||
}
|
||||
|
||||
public void setCornerSize(int cornerSize) {
|
||||
@ -290,11 +290,11 @@ public class TabDigit_old{
|
||||
}
|
||||
|
||||
public void setBackgroundColor(int color) {
|
||||
mBackgroundPaint.setColor(color);
|
||||
mBackgroundPaint.setParticleColor(color);
|
||||
}
|
||||
|
||||
public int getBackgroundColor() {
|
||||
return mBackgroundPaint.getColor();
|
||||
return mBackgroundPaint.getParticleColor();
|
||||
}
|
||||
|
||||
public void start() {
|
||||
|
@ -143,6 +143,13 @@
|
||||
android:layout_weight="1"
|
||||
android:text="分割线" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/tv_textStyle_border_doubble"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="双字" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
@ -311,20 +318,59 @@
|
||||
android:text="主题4" />
|
||||
</LinearLayout>
|
||||
|
||||
<com.jaygoo.widget.VerticalRangeSeekBar
|
||||
android:id="@+id/tv_time_text_subscript_scale"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_above="@id/text_style_group4"
|
||||
android:layout_below="@id/text_style_group2"
|
||||
android:layout_toLeftOf="@id/tv_time_text_padding"
|
||||
android:layout_marginRight="20dp"
|
||||
app:rsb_mode="single"
|
||||
app:rsb_gravity="center"
|
||||
app:rsb_progress_radius="4dp"
|
||||
app:rsb_thumb_width="30dp"
|
||||
app:rsb_thumb_height="30dp"
|
||||
app:rsb_tick_mark_mode="other"
|
||||
app:rsb_tick_mark_gravity="center"
|
||||
app:rsb_min="1"
|
||||
app:rsb_max="100"
|
||||
app:rsb_min_interval="5"
|
||||
/>
|
||||
|
||||
<com.jaygoo.widget.VerticalRangeSeekBar
|
||||
android:id="@+id/tv_time_text_padding"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_above="@id/text_style_group4"
|
||||
android:layout_below="@id/text_style_group2"
|
||||
android:layout_toLeftOf="@id/tv_time_text_basline_down"
|
||||
android:layout_marginRight="20dp"
|
||||
app:rsb_mode="single"
|
||||
app:rsb_gravity="center"
|
||||
app:rsb_progress_radius="4dp"
|
||||
app:rsb_thumb_width="30dp"
|
||||
app:rsb_thumb_height="30dp"
|
||||
app:rsb_tick_mark_mode="other"
|
||||
app:rsb_tick_mark_gravity="center"
|
||||
app:rsb_min="0"
|
||||
app:rsb_max="20"
|
||||
app:rsb_min_interval="1"
|
||||
/>
|
||||
|
||||
<com.jaygoo.widget.VerticalRangeSeekBar
|
||||
android:id="@+id/tv_time_text_basline_down"
|
||||
android:layout_width="60dp"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_above="@id/text_style_group4"
|
||||
android:layout_below="@id/text_style_group2"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginRight="30dp"
|
||||
android:layout_marginRight="20dp"
|
||||
app:rsb_mode="single"
|
||||
app:rsb_gravity="center"
|
||||
app:rsb_progress_radius="4dp"
|
||||
app:rsb_thumb_width="40dp"
|
||||
app:rsb_thumb_height="40dp"
|
||||
app:rsb_thumb_width="30dp"
|
||||
app:rsb_thumb_height="30dp"
|
||||
app:rsb_tick_mark_mode="other"
|
||||
app:rsb_tick_mark_gravity="center"
|
||||
app:rsb_min="0"
|
||||
|
171
app/src/main/res/layout/fragment_setting.xml
Executable file
171
app/src/main/res/layout/fragment_setting.xml
Executable file
@ -0,0 +1,171 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/white"
|
||||
>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
tools:context="clock.socoolby.com.clock.MainActivity">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_talking_clock"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/teim_report"
|
||||
/>
|
||||
|
||||
<RadioGroup
|
||||
android:id="@+id/rg_talking_clock"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_below="@+id/tv_talking_clock">
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/rb_halfhour"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/half_an_hour" />
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/rb_hours"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/hours" />
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/rb_noreport"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/no_report" />
|
||||
</RadioGroup>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_except"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_below="@+id/rg_talking_clock"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:text="@string/except" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/rel_talking_time_duration"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/tv_except"
|
||||
android:layout_marginLeft="20dp">
|
||||
|
||||
<clock.socoolby.com.clock.widget.wheelview.WheelView
|
||||
android:id="@+id/weel_start_time"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<clock.socoolby.com.clock.widget.wheelview.WheelView
|
||||
android:id="@+id/weel_stop_time"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@+id/weel_start_time" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_tick_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/rel_talking_time_duration"
|
||||
android:layout_marginTop="@dimen/setting_margin_top"
|
||||
android:text="@string/tick" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cb_tick"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/tv_tick_title"
|
||||
android:text="@string/play_tick" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_trigger_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/cb_tick"
|
||||
android:layout_marginTop="@dimen/setting_margin_top"
|
||||
android:text="@string/screen_trigger" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cb_trigger_screen"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/tv_trigger_title"
|
||||
android:text="@string/trigger_screen_on_off" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_weather_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/cb_trigger_screen"
|
||||
android:layout_marginTop="@dimen/setting_margin_top"
|
||||
android:text="@string/weather_citiyname" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/et_city"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/tv_weather_title"
|
||||
android:inputType="text"
|
||||
android:text="@string/shenzhen" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_description_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/et_city"
|
||||
android:layout_marginTop="@dimen/setting_margin_top"
|
||||
android:text="@string/motto" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/et_description"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/tv_description_title"
|
||||
android:hint="@string/description"
|
||||
android:inputType="text"
|
||||
android:text="@string/always_zuo_never_die" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_save"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/et_description"
|
||||
android:layout_marginTop="20dp"
|
||||
android:text="@string/save" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_uninstall"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/btn_save"
|
||||
android:layout_marginTop="@dimen/setting_margin_top"
|
||||
android:text="@string/uninstall" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_about"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/btn_uninstall"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="@string/about" />
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</ScrollView>
|
@ -27,4 +27,5 @@
|
||||
<string name="color_depth">深度</string>
|
||||
<string name="dialog_folder_title">对话框标题</string>
|
||||
<string name="examples_text">示列文本</string>
|
||||
<string name="save">保存</string>
|
||||
</resources>
|
@ -30,6 +30,7 @@
|
||||
<string name="color_depth">color_depth</string>
|
||||
<string name="transparency">transparency</string>
|
||||
<string name="examples_text">examples_text</string>
|
||||
<string name="save">save</string>
|
||||
|
||||
<!-- TODO: Remove or change this placeholder text -->
|
||||
<string name="hello_blank_fragment">Hello blank fragment</string>
|
||||
|
Loading…
x
Reference in New Issue
Block a user