mirror of
https://gitee.com/51danju/workclock.git
synced 2025-06-07 03:14:05 +08:00
增加 界面样式切换,锁功能修复
This commit is contained in:
parent
45a2ab6701
commit
8ec30529c2
@ -6,6 +6,8 @@ public class Constants {
|
||||
public final static int TALKING_HOURS=2;
|
||||
public final static int TALKING_NO_REPORT=3;
|
||||
public final static String SHARE_PERFERENCE_FILE="share_perference.conf";
|
||||
public final static String SHARE_PERFERENCE_FILE1="share_perference1.conf";
|
||||
public final static String SHARE_PERFERENCE_FILE2="share_perference2.conf";
|
||||
public final static int SUCCESS_CODE=0;
|
||||
public final static int FAIL_CODE=-1;
|
||||
public final static int TYPE_TRIGGER_AUTO_OFF=4;
|
||||
|
@ -4,7 +4,9 @@ package clock.socoolby.com.clock;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.os.Build;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
@ -15,9 +17,11 @@ import android.support.v4.app.ActivityCompat;
|
||||
import android.util.Log;
|
||||
import android.view.GestureDetector;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.ScaleGestureDetector;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.FrameLayout;
|
||||
@ -337,7 +341,80 @@ public class MainActivity extends Activity implements Handler.Callback, View.OnC
|
||||
setContentView(R.layout.activity_main);
|
||||
mainBackground=findViewById(R.id.main_background);
|
||||
tv_background_image=findViewById(R.id.tv_background_image);
|
||||
tv_background_image_hand=findViewById(R.id.tv_background_image_hand);
|
||||
|
||||
animatorView=findViewById(R.id.tv_background_animatorview);
|
||||
|
||||
clockView=findViewById(R.id.tv_foreground_animatorview);
|
||||
|
||||
tv_time = findViewById(R.id.tv_time);
|
||||
//tv_time.setOnClickListener(this);
|
||||
|
||||
handler = new Handler(this);
|
||||
|
||||
if(PermissionUtils.isGranted("android.permission.WAKE_LOCK","android.permission.DEVICE_POWER")) {
|
||||
PowerManager powerManager = (PowerManager) this.getSystemService(POWER_SERVICE);
|
||||
wakeLock = powerManager.newWakeLock(PowerManager.ACQUIRE_CAUSES_WAKEUP | PowerManager.FULL_WAKE_LOCK |powerManager.ON_AFTER_RELEASE, "Clock");
|
||||
localWakeLock = powerManager.newWakeLock(32, "MyPower");
|
||||
}else
|
||||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
|
||||
|
||||
//创建手势检测器
|
||||
detector = new GestureDetector(this, this);
|
||||
detector.setOnDoubleTapListener(this);
|
||||
|
||||
scaleGestureDetector=new ScaleGestureDetector(this,this);
|
||||
|
||||
init();
|
||||
|
||||
switchThemeType(currentThemeTypeId);
|
||||
|
||||
initUI();
|
||||
|
||||
ClockApplication.getInstance().setMainActivity(this);
|
||||
|
||||
//Log.d(TAG,"create timer and timerTask.................................");
|
||||
timer = new Timer();
|
||||
timerTask = new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
//Log.d(TAG, "timerTask move...");
|
||||
if (!ScreenManager.isScreenOn())
|
||||
return;
|
||||
handler.sendEmptyMessage(UPDATE_TIME);
|
||||
}
|
||||
};
|
||||
timer.schedule(timerTask, 1000, 1000);
|
||||
//ClockApplication.getInstance().getBusinessService().checkUpdate();
|
||||
}
|
||||
|
||||
private int currentThemeTypeId=R.layout.theme_sample;
|
||||
private float themeBaseLine=0;
|
||||
private View themeRoot=null;
|
||||
private void switchThemeType(int themeType){
|
||||
currentThemeTypeId=themeType;
|
||||
switch (themeType){
|
||||
case R.layout.theme_sample:
|
||||
themeBaseLine=-110;
|
||||
break;
|
||||
default:
|
||||
themeBaseLine=0;
|
||||
}
|
||||
initTheme(this,themeType);
|
||||
currentDate=null;
|
||||
setWeather(weatherAdape);
|
||||
resetThemeUI();
|
||||
}
|
||||
|
||||
private void initTheme(Context context, int themeType){
|
||||
if(themeRoot!=null) {
|
||||
themeRoot.setVisibility(View.GONE);
|
||||
mainBackground.removeView(themeRoot);
|
||||
}
|
||||
themeRoot = LayoutInflater.from(context).inflate(themeType,null,false);
|
||||
mainBackground.addView(themeRoot);
|
||||
|
||||
tv_background_image_hand=themeRoot.findViewById(R.id.tv_background_image_hand);
|
||||
tv_background_image_hand.setOnClickListener(this);
|
||||
tv_background_image_hand.setOnLongClickListener(new View.OnLongClickListener() {
|
||||
@Override
|
||||
@ -347,18 +424,20 @@ public class MainActivity extends Activity implements Handler.Callback, View.OnC
|
||||
}
|
||||
});
|
||||
|
||||
animatorView=findViewById(R.id.tv_background_animatorview);
|
||||
|
||||
clockView=findViewById(R.id.tv_foreground_animatorview);
|
||||
|
||||
tv_time = findViewById(R.id.tv_time);
|
||||
//tv_time.setOnClickListener(this);
|
||||
|
||||
tv_date = findViewById(R.id.tv_date);
|
||||
tv_date = themeRoot.findViewById(R.id.tv_date);
|
||||
tv_date.setOnClickListener(this);
|
||||
tv_date.setOnLongClickListener(new View.OnLongClickListener() {
|
||||
@Override
|
||||
public boolean onLongClick(View v) {
|
||||
if(currentThemeTypeId==R.layout.theme_default)
|
||||
switchThemeType(R.layout.theme_sample);
|
||||
else
|
||||
switchThemeType(R.layout.theme_default);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
tv_day = findViewById(R.id.tv_day);
|
||||
tv_day = themeRoot.findViewById(R.id.tv_day);
|
||||
tv_day.setOnClickListener(this);
|
||||
tv_day.setOnLongClickListener(new View.OnLongClickListener() {
|
||||
@Override
|
||||
@ -372,7 +451,7 @@ public class MainActivity extends Activity implements Handler.Callback, View.OnC
|
||||
}
|
||||
});
|
||||
|
||||
tv_weather = findViewById(R.id.tv_weather);
|
||||
tv_weather = themeRoot.findViewById(R.id.tv_weather);
|
||||
tv_weather.setOnClickListener(this);
|
||||
tv_descript = findViewById(R.id.tv_descript);
|
||||
tv_descript.setOnClickListener(this);
|
||||
@ -384,7 +463,7 @@ public class MainActivity extends Activity implements Handler.Callback, View.OnC
|
||||
}
|
||||
});
|
||||
|
||||
tv_break=findViewById(R.id.tv_break);
|
||||
tv_break=themeRoot.findViewById(R.id.tv_break);
|
||||
tv_break.setOnClickListener(this);
|
||||
tv_break.setOnLongClickListener(new View.OnLongClickListener() {
|
||||
@Override
|
||||
@ -399,7 +478,7 @@ public class MainActivity extends Activity implements Handler.Callback, View.OnC
|
||||
}
|
||||
});
|
||||
|
||||
tv_handup=findViewById(R.id.tv_hand);
|
||||
tv_handup=themeRoot.findViewById(R.id.tv_hand);
|
||||
tv_handup.setOnClickListener(this);
|
||||
tv_handup.setOnLongClickListener(new View.OnLongClickListener() {
|
||||
@Override
|
||||
@ -410,7 +489,7 @@ public class MainActivity extends Activity implements Handler.Callback, View.OnC
|
||||
return true;
|
||||
}
|
||||
});
|
||||
tv_hand_time=findViewById(R.id.tv_hand_time);
|
||||
tv_hand_time=themeRoot.findViewById(R.id.tv_hand_time);
|
||||
tv_hand_time.setOnClickListener(this);
|
||||
tv_hand_time.setOnLongClickListener(new View.OnLongClickListener() {
|
||||
@Override
|
||||
@ -421,12 +500,12 @@ public class MainActivity extends Activity implements Handler.Callback, View.OnC
|
||||
}
|
||||
});
|
||||
|
||||
tv_hours_system=findViewById(R.id.tv_hours_system);
|
||||
tv_hours_system=themeRoot.findViewById(R.id.tv_hours_system);
|
||||
|
||||
tv_background_color=findViewById(R.id.tv_background_color);
|
||||
tv_background_color=themeRoot.findViewById(R.id.tv_background_color);
|
||||
tv_background_color.setOnClickListener(this);
|
||||
|
||||
tv_foreground_color=findViewById(R.id.tv_foreground_color);
|
||||
tv_foreground_color=themeRoot.findViewById(R.id.tv_foreground_color);
|
||||
tv_foreground_color.setOnClickListener(this);
|
||||
tv_foreground_color.setOnLongClickListener(new View.OnLongClickListener() {
|
||||
@Override
|
||||
@ -455,7 +534,7 @@ public class MainActivity extends Activity implements Handler.Callback, View.OnC
|
||||
}
|
||||
});
|
||||
|
||||
tv_foreground_color1=findViewById(R.id.tv_foreground_color1);
|
||||
tv_foreground_color1=themeRoot.findViewById(R.id.tv_foreground_color1);
|
||||
tv_foreground_color1.setOnClickListener(this);
|
||||
tv_foreground_color1.setOnLongClickListener(new View.OnLongClickListener() {
|
||||
@Override
|
||||
@ -484,59 +563,28 @@ public class MainActivity extends Activity implements Handler.Callback, View.OnC
|
||||
}
|
||||
});
|
||||
|
||||
tv_handup_image=findViewById(R.id.tv_handup_image);
|
||||
tv_handup_image=themeRoot.findViewById(R.id.tv_handup_image);
|
||||
tv_handup_image.setOnClickListener(this);
|
||||
|
||||
|
||||
handler = new Handler(this);
|
||||
tv_setting = findViewById(R.id.tv_setting);
|
||||
tv_setting = themeRoot.findViewById(R.id.tv_setting);
|
||||
tv_setting.setOnClickListener(this);
|
||||
|
||||
//RelativeLayout rel_main = (RelativeLayout) findViewById(R.id.rel_main);
|
||||
//rel_main.setOnClickListener(this);
|
||||
|
||||
tv_screen_lock =findViewById(R.id.tv_screen_lock);
|
||||
tv_screen_lock =themeRoot.findViewById(R.id.tv_screen_lock);
|
||||
tv_screen_lock.setOnClickListener(this);
|
||||
tv_screen_lock.setOnLongClickListener(new View.OnLongClickListener() {
|
||||
@Override
|
||||
public boolean onLongClick(View v) {
|
||||
screenLock(true);
|
||||
switchMode(MODE_FULLSCREEN);
|
||||
return true;
|
||||
if(mMode!=MODE_FULLSCREEN) {
|
||||
screenLock(true);
|
||||
switchMode(MODE_FULLSCREEN);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
if(PermissionUtils.isGranted("android.permission.WAKE_LOCK","android.permission.DEVICE_POWER")) {
|
||||
PowerManager powerManager = (PowerManager) this.getSystemService(POWER_SERVICE);
|
||||
wakeLock = powerManager.newWakeLock(PowerManager.ACQUIRE_CAUSES_WAKEUP | PowerManager.FULL_WAKE_LOCK |powerManager.ON_AFTER_RELEASE, "Clock");
|
||||
localWakeLock = powerManager.newWakeLock(32, "MyPower");
|
||||
}else
|
||||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
|
||||
|
||||
//创建手势检测器
|
||||
detector = new GestureDetector(this, this);
|
||||
detector.setOnDoubleTapListener(this);
|
||||
|
||||
scaleGestureDetector=new ScaleGestureDetector(this,this);
|
||||
|
||||
init();
|
||||
ClockApplication.getInstance().setMainActivity(this);
|
||||
|
||||
//Log.d(TAG,"create timer and timerTask.................................");
|
||||
timer = new Timer();
|
||||
timerTask = new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
//Log.d(TAG, "timerTask move...");
|
||||
if (!ScreenManager.isScreenOn())
|
||||
return;
|
||||
handler.sendEmptyMessage(UPDATE_TIME);
|
||||
}
|
||||
};
|
||||
timer.schedule(timerTask, 1000, 1000);
|
||||
//ClockApplication.getInstance().getBusinessService().checkUpdate();
|
||||
}
|
||||
|
||||
|
||||
@ -582,17 +630,29 @@ public class MainActivity extends Activity implements Handler.Callback, View.OnC
|
||||
model.read();
|
||||
initTimeFontStyle();
|
||||
Log.d(TAG, "init model:" + model.toString());
|
||||
setDiscriptForModel();
|
||||
|
||||
proximityServiceIntent = new Intent(this, ProximityService.class);
|
||||
setUpProximityService();
|
||||
|
||||
brightness=getSystemBrightness();
|
||||
handUpAbla=model.isHandUpAble();
|
||||
resetColorFromModel();
|
||||
setFont(model.getFontIndex()==null?0:model.getFontIndex());
|
||||
}
|
||||
|
||||
private void initUI(){
|
||||
upHandStatic();
|
||||
resetHandUpTime();
|
||||
updateHourSystem();
|
||||
resetColorFromModel();
|
||||
}
|
||||
|
||||
private void resetThemeUI(){
|
||||
setDiscriptForModel();
|
||||
setFont(model.getFontIndex()==null?0:model.getFontIndex());
|
||||
Integer backUp=foregroundColor;
|
||||
if(foregroundColor!=null) {
|
||||
foregroundColor=null;
|
||||
setForegroundColor(backUp);
|
||||
}
|
||||
}
|
||||
|
||||
private void resetColorFromModel(){
|
||||
@ -712,7 +772,7 @@ public class MainActivity extends Activity implements Handler.Callback, View.OnC
|
||||
tv_time.setTextColor(color);
|
||||
tv_date.setTextColor(color);
|
||||
tv_day.setTextColor(color);
|
||||
tv_weather .setTextColor(color);
|
||||
tv_weather.setTextColor(color);
|
||||
tv_descript.setTextColor(color);
|
||||
tv_handup_image.setTextColor(color);
|
||||
|
||||
@ -921,7 +981,6 @@ public class MainActivity extends Activity implements Handler.Callback, View.OnC
|
||||
tv_break.setVisibility(View.GONE);
|
||||
}else{
|
||||
if(clockView.isRunning()) {
|
||||
//clockView.setAnimator(null);
|
||||
clockView.stop();
|
||||
}
|
||||
clockView.setVisibility(View.GONE);
|
||||
@ -1442,7 +1501,7 @@ public class MainActivity extends Activity implements Handler.Callback, View.OnC
|
||||
if(isFullScreen){
|
||||
tv_time.setBaseLineDown(0);
|
||||
}else{
|
||||
tv_time.setBaseLineDown(tv_day.getHeight()/2);
|
||||
tv_time.setBaseLineDown(themeBaseLine+tv_day.getHeight()/2);
|
||||
}
|
||||
tv_time.setText(timeString);
|
||||
}
|
||||
@ -1457,6 +1516,9 @@ public class MainActivity extends Activity implements Handler.Callback, View.OnC
|
||||
case COUNTING:
|
||||
DateModel temp=new DateModel(countingDateTimeBase);
|
||||
timeString=temp.getTimeString(false);
|
||||
if (!model.isTickSound()&&mMode!=MODE_HANDUP) {
|
||||
Player.getInstance().playTick(this,R.raw.tick2);
|
||||
}
|
||||
break;
|
||||
case COUNTING_DOWN:
|
||||
timeString=DateModel.getTimeFull(handUpTime);
|
||||
@ -1530,8 +1592,8 @@ public class MainActivity extends Activity implements Handler.Callback, View.OnC
|
||||
}
|
||||
|
||||
private void reportTime(DateModel date) {
|
||||
if (model.isTickSound()) {
|
||||
Player.getInstance().playTick(this);
|
||||
if (model.isTickSound()&&mMode!=MODE_HANDUP) {
|
||||
Player.getInstance().playTick(this,R.raw.tick2);
|
||||
}
|
||||
int year = date.getYear();
|
||||
int month = date.getMonth();
|
||||
@ -1723,12 +1785,12 @@ public class MainActivity extends Activity implements Handler.Callback, View.OnC
|
||||
int currentFontSize=new Float(tv_time.getTextSize()/fontScale).intValue();
|
||||
currentFontSize=currentFontSize+step;
|
||||
Log.d(TAG,"onScaleEnd span:"+span+"\t step:"+step+"\tcurrent text size"+currentFontSize+"\t max text size:"+maxFontSize+"\tmin :"+baseFontSize);
|
||||
if(currentFontSize>maxFontSize*1.3){
|
||||
currentFontSize=maxFontSize;
|
||||
}
|
||||
if(currentFontSize<baseFontSize){
|
||||
currentFontSize=baseFontSize;
|
||||
}
|
||||
//if(currentFontSize>maxFontSize*1.3){
|
||||
// currentFontSize=maxFontSize;
|
||||
//}
|
||||
//if(currentFontSize<baseFontSize){
|
||||
// currentFontSize=baseFontSize;
|
||||
//}
|
||||
setFontSize(currentFontSize);
|
||||
}
|
||||
|
||||
|
@ -13,59 +13,59 @@ import clock.socoolby.com.clock.R;
|
||||
import clock.socoolby.com.clock.utils.FileUtils;
|
||||
|
||||
public class SharePerferenceModel implements Serializable {
|
||||
private int typeHourPower = Constants.TALKING_HALF_AN_HOUR;
|
||||
private final static String KEY_TYPE_HOUR_POWER = "key_type_hour_power";
|
||||
protected int typeHourPower = Constants.TALKING_HALF_AN_HOUR;
|
||||
protected final static String KEY_TYPE_HOUR_POWER = "key_type_hour_power";
|
||||
|
||||
private DateModel startHourPowerTime = null;
|
||||
private final static String KEY_START_POWER = "key_start_power";
|
||||
private DateModel stopHourPowerTime = null;
|
||||
private final static String KEY_STOP_POWER = "key_stop_power";
|
||||
protected DateModel startHourPowerTime = null;
|
||||
protected final static String KEY_START_POWER = "key_start_power";
|
||||
protected DateModel stopHourPowerTime = null;
|
||||
protected final static String KEY_STOP_POWER = "key_stop_power";
|
||||
|
||||
private boolean isDisplaySecond = true;
|
||||
private final static String KEY_IS_DISPLAY_SECOND = "key_is_display_second";
|
||||
private boolean isTickSound = false;
|
||||
private final static String KEY_IS_TICK_SOUND = "key_is_tick_sound";
|
||||
private boolean isTriggerScreen = true;
|
||||
private final static String KEY_IS_TRIGGER_SCREEN = "key_is_trigger_screen";
|
||||
protected boolean isDisplaySecond = true;
|
||||
protected final static String KEY_IS_DISPLAY_SECOND = "key_is_display_second";
|
||||
protected boolean isTickSound = false;
|
||||
protected final static String KEY_IS_TICK_SOUND = "key_is_tick_sound";
|
||||
protected boolean isTriggerScreen = true;
|
||||
protected final static String KEY_IS_TRIGGER_SCREEN = "key_is_trigger_screen";
|
||||
|
||||
private boolean hourSystem12 = false;
|
||||
private final static String KEY_IS_HOUR_SYSTEM_12 = "key_is_hour_system_12";
|
||||
protected boolean hourSystem12 = false;
|
||||
protected final static String KEY_IS_HOUR_SYSTEM_12 = "key_is_hour_system_12";
|
||||
|
||||
|
||||
private final static String KEY_CITY = "key_city";
|
||||
private String mCity;
|
||||
protected final static String KEY_CITY = "key_city";
|
||||
protected String mCity;
|
||||
|
||||
private final static String KEY_DESCRPTION = "key_description";
|
||||
private String mDescription;
|
||||
protected final static String KEY_DESCRPTION = "key_description";
|
||||
protected String mDescription;
|
||||
|
||||
private final static String KEY_FONT_INDEX = "key_font_index";
|
||||
private Integer fontIndex;
|
||||
protected final static String KEY_FONT_INDEX = "key_font_index";
|
||||
protected Integer fontIndex;
|
||||
|
||||
private final static String KEY_DISPLAYVIEW_TIME = "key_displayview_time";
|
||||
private final static String KEY_DISPLAYVIEW_DATE = "key_dsplayview_date";
|
||||
private final static String KEY_DISPLAYVIEW_DAY = "key_displayview_day";
|
||||
private final static String KEY_DISPLAYVIEW_WEATHER = "key_displayview_weather";
|
||||
private final static String KEY_DISPLAYVIEW_DESCRIPTION = "key_displayview_description";
|
||||
protected final static String KEY_DISPLAYVIEW_TIME = "key_displayview_time";
|
||||
protected final static String KEY_DISPLAYVIEW_DATE = "key_dsplayview_date";
|
||||
protected final static String KEY_DISPLAYVIEW_DAY = "key_displayview_day";
|
||||
protected final static String KEY_DISPLAYVIEW_WEATHER = "key_displayview_weather";
|
||||
protected final static String KEY_DISPLAYVIEW_DESCRIPTION = "key_displayview_description";
|
||||
private JSONObject timeLocation = new JSONObject();
|
||||
private JSONObject dateLocation = new JSONObject();
|
||||
private JSONObject dayLocation = new JSONObject();
|
||||
private JSONObject weatherLocation = new JSONObject();
|
||||
private JSONObject descriptionLocation = new JSONObject();
|
||||
|
||||
private final static String KEY_HANDUP_TIME="key_handup_time";
|
||||
private Integer handUpTime=-1;
|
||||
protected final static String KEY_HANDUP_TIME="key_handup_time";
|
||||
protected Integer handUpTime=-1;
|
||||
|
||||
private final static String KEY_IS_HANDUP_ABLE="key_is_handup_able";
|
||||
private boolean handUpAble = false;
|
||||
protected final static String KEY_IS_HANDUP_ABLE="key_is_handup_able";
|
||||
protected boolean handUpAble = false;
|
||||
|
||||
private final static String KEY_BACKGROUND_COLOR="key_background_color";
|
||||
private Integer backgroundColor=Color.rgb(0, 0, 0);
|
||||
protected final static String KEY_BACKGROUND_COLOR="key_background_color";
|
||||
protected Integer backgroundColor=Color.rgb(0, 0, 0);
|
||||
|
||||
private final static String KEY_FOREGROUND_COLOR="key_foreground_color";
|
||||
private Integer foregroundColor=Color.rgb(255, 255, 255);
|
||||
protected final static String KEY_FOREGROUND_COLOR="key_foreground_color";
|
||||
protected Integer foregroundColor=Color.rgb(255, 255, 255);
|
||||
|
||||
private final static String KEY_FOREGROUND_COLOR1="key_foreground_color1";
|
||||
private Integer foregroundColor1=Color.rgb(199,21,133);
|
||||
protected final static String KEY_FOREGROUND_COLOR1="key_foreground_color1";
|
||||
protected Integer foregroundColor1=Color.rgb(199,21,133);
|
||||
|
||||
public int getTypeHourPower() {
|
||||
return typeHourPower;
|
||||
@ -172,7 +172,7 @@ public class SharePerferenceModel implements Serializable {
|
||||
return descriptionLocation;
|
||||
}
|
||||
|
||||
private void fromJsonString(String jsonString) {
|
||||
protected void fromJsonString(String jsonString) {
|
||||
try {
|
||||
JSONObject jsonObject = new JSONObject(jsonString);
|
||||
typeHourPower = jsonObject.getInt(KEY_TYPE_HOUR_POWER);
|
||||
@ -202,7 +202,7 @@ public class SharePerferenceModel implements Serializable {
|
||||
}
|
||||
}
|
||||
|
||||
private String toJsonString() {
|
||||
protected String toJsonString() {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
try {
|
||||
jsonObject.put(KEY_TYPE_HOUR_POWER, typeHourPower);
|
||||
@ -234,13 +234,23 @@ public class SharePerferenceModel implements Serializable {
|
||||
}
|
||||
|
||||
public void save() {
|
||||
Log.d("model","saveData :"+toString());
|
||||
FileUtils.writeObject(Constants.SHARE_PERFERENCE_FILE, toJsonString());
|
||||
save(Constants.SHARE_PERFERENCE_FILE,this);
|
||||
|
||||
}
|
||||
|
||||
public void read() {
|
||||
fromJsonString((String) FileUtils.readObject(Constants.SHARE_PERFERENCE_FILE));
|
||||
Log.d("model","readData :"+toString());
|
||||
read(Constants.SHARE_PERFERENCE_FILE,this);
|
||||
}
|
||||
|
||||
|
||||
public static void save(String perferenceFile,SharePerferenceModel model) {
|
||||
Log.d("model","saveData :"+model.toString());
|
||||
FileUtils.writeObject(perferenceFile, model.toJsonString());
|
||||
}
|
||||
|
||||
public static void read(String perferenceFile,SharePerferenceModel model ) {
|
||||
model.fromJsonString((String) FileUtils.readObject(perferenceFile));
|
||||
Log.d("model","readData :"+model.toString());
|
||||
}
|
||||
|
||||
|
||||
|
@ -0,0 +1,22 @@
|
||||
package clock.socoolby.com.clock.model;
|
||||
|
||||
public class UIThemePerferenceModel extends SharePerferenceModel{
|
||||
|
||||
protected final static String KEY_FOREGROUND_TIME_COLORS_ARRAY="key_foreground_time_colors_array";
|
||||
protected int[] timeColorsArray;
|
||||
|
||||
protected final static String KEY_FOREGROUND_TIME_FONT_SIZE="key_foreground_time_font_size";
|
||||
protected int timeFontSize;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
protected void fromJsonString(String jsonString) {
|
||||
super.fromJsonString(jsonString);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String toJsonString() {
|
||||
return super.toJsonString();
|
||||
}
|
||||
}
|
@ -31,7 +31,6 @@ public class CalendarPopup extends BasePopupWindow implements CalendarView.OnCal
|
||||
private int mYear;
|
||||
CalendarLayout mCalendarLayout;
|
||||
|
||||
|
||||
@Override
|
||||
public View onCreateContentView() {
|
||||
View content=createPopupById(R.layout.pop_calendar);
|
||||
|
@ -9,6 +9,7 @@ import android.util.Log;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.Map;
|
||||
|
||||
import clock.socoolby.com.clock.ClockApplication;
|
||||
import clock.socoolby.com.clock.R;
|
||||
@ -72,11 +73,15 @@ public class Player {
|
||||
Integer resourceID = playList.get(0);
|
||||
playList.remove(0);
|
||||
|
||||
AssetFileDescriptor file = activity.getResources().openRawResourceFd(resourceID);
|
||||
soundFile=soundFileCache.get(resourceID);
|
||||
if (soundFile == null) {
|
||||
soundFile = activity.getResources().openRawResourceFd(resourceID);
|
||||
soundFileCache.put(resourceID, soundFile);
|
||||
}
|
||||
|
||||
try {
|
||||
mediaPlayer.reset();
|
||||
mediaPlayer.setDataSource(file.getFileDescriptor(), file.getStartOffset(), file.getLength());
|
||||
file.close();
|
||||
mediaPlayer.setDataSource(soundFile.getFileDescriptor(), soundFile.getStartOffset(), soundFile.getLength());
|
||||
mediaPlayer.setVolume(BEEP_VOLUME, BEEP_VOLUME);
|
||||
mediaPlayer.prepare();
|
||||
mediaPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
|
||||
@ -157,34 +162,38 @@ public class Player {
|
||||
play(activity);
|
||||
}
|
||||
|
||||
private AssetFileDescriptor tickFile = null;
|
||||
|
||||
public void playTick(Context activity) {
|
||||
public void playTick(Context activity,int tick_type_id) {
|
||||
if (!ScreenManager.isScreenOn() || ScreenManager.isApplicationBroughtToBackground(ClockApplication.getContext()))
|
||||
return;
|
||||
if (!isReporttime) {
|
||||
playSoundWithRawId(activity,R.raw.tick);
|
||||
playSoundWithRawId(activity,tick_type_id);
|
||||
}
|
||||
}
|
||||
|
||||
private AssetFileDescriptor handUpFile = null;
|
||||
private AssetFileDescriptor soundFile = null;
|
||||
private Map<Integer,AssetFileDescriptor> soundFileCache=new HashMap<>();
|
||||
|
||||
public void playHandUp(Context activity){
|
||||
if (!ScreenManager.isScreenOn() || ScreenManager.isApplicationBroughtToBackground(ClockApplication.getContext()))
|
||||
return;
|
||||
playSoundWithRawId(activity,R.raw.handup_didi);
|
||||
if (!isReporttime) {
|
||||
playSoundWithRawId(activity, R.raw.handup_didi);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void playSoundWithRawId(Context activity,int soundId){
|
||||
|
||||
if (mediaPlayer == null)
|
||||
mediaPlayer = buildMediaPlayer();
|
||||
|
||||
if (handUpFile == null)
|
||||
handUpFile = activity.getResources().openRawResourceFd(soundId);
|
||||
soundFile =soundFileCache.get(soundId);
|
||||
if (soundFile == null) {
|
||||
soundFile = activity.getResources().openRawResourceFd(soundId);
|
||||
soundFileCache.put(soundId, soundFile);
|
||||
}
|
||||
try {
|
||||
mediaPlayer.reset();
|
||||
mediaPlayer.setDataSource(handUpFile.getFileDescriptor(), handUpFile.getStartOffset(), handUpFile.getLength());
|
||||
mediaPlayer.setDataSource(soundFile.getFileDescriptor(), soundFile.getStartOffset(), soundFile.getLength());
|
||||
mediaPlayer.setVolume(BEEP_VOLUME, BEEP_VOLUME);
|
||||
mediaPlayer.prepare();
|
||||
mediaPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
|
||||
|
@ -56,12 +56,12 @@ public class AutoScrollTextView extends android.support.v7.widget.AppCompatTextV
|
||||
textLength = paint.measureText(text);
|
||||
viewWidth = getWidth();
|
||||
|
||||
Log.e(TAG,"--->"+textLength+"--->"+viewWidth+"-->"+getTextSize());
|
||||
//Log.e(TAG,"--->"+textLength+"--->"+viewWidth+"-->"+getTextSize());
|
||||
if(viewWidth == 0)
|
||||
{
|
||||
viewWidth = 600;//获取屏幕的宽度
|
||||
}
|
||||
Log.e(TAG,"屏幕的宽度-->"+ 600);
|
||||
//Log.e(TAG,"屏幕的宽度-->"+ 600);
|
||||
step = textLength;//文字真实的长度
|
||||
temp_view_plus_text_length = viewWidth/2 + textLength;
|
||||
temp_view_plus_two_text_length = viewWidth + textLength * 2;//文字移动的距离应该是控件的长度+左边一个文字的长度+右边一个文字的长度
|
||||
|
@ -207,7 +207,7 @@ public class DigitTextView extends android.support.v7.widget.AppCompatTextView {
|
||||
}
|
||||
if (charAnimator != null) {
|
||||
charAnimator.drawCharAnimator(canvas, startX + (baseCharWidth - charWidth) / 2, startY + baseLineDown, mTextPaint);
|
||||
Log.d(Tag,"charAnimator index i:"+i+"\tanimator percent:");
|
||||
//Log.d(Tag,"charAnimator index i:"+i+"\tanimator percent:");
|
||||
invalidate();
|
||||
}else
|
||||
drawChar(canvas, c, startX + (baseCharWidth - charWidth) / 2, startY + baseLineDown, mTextPaint);
|
||||
|
@ -32,210 +32,6 @@
|
||||
android:textColor="#fff"
|
||||
/>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/rel_main"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#00FFFFFF"
|
||||
>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_handup_image"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:gravity="center"
|
||||
android:text='"hand up"'
|
||||
android:textColor="#fff"
|
||||
android:background="#00FFFFFF"
|
||||
android:textSize="80sp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_weather"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:clickable="true"
|
||||
android:text=" "
|
||||
android:textColor="#fff"
|
||||
android:background="#00FFFFFF"
|
||||
android:textSize="22sp"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_date"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:background="#00FFFFFF"
|
||||
android:textColor="#fff"
|
||||
android:textSize="32sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_hand_time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/tv_weather"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_marginTop="12dp"
|
||||
android:background="#00FFFFFF"
|
||||
android:layout_marginLeft="13dp"
|
||||
android:textColor="#fff"
|
||||
android:textSize="20sp"
|
||||
/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/tv_hand"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#00FFFFFF"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_below="@+id/tv_weather"
|
||||
android:layout_marginLeft="100dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:src="@drawable/ic_alarm_clock" />
|
||||
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/tv_break"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#00FFFFFF"
|
||||
android:layout_toRightOf="@+id/tv_hand"
|
||||
android:layout_below="@+id/tv_weather"
|
||||
android:layout_marginLeft="25dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:src="@drawable/ic_handup"
|
||||
/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/tv_background_color"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#00FFFFFF"
|
||||
android:layout_toRightOf="@+id/tv_break"
|
||||
android:layout_below="@+id/tv_weather"
|
||||
android:layout_marginLeft="40dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:src="@drawable/ic_background_color"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/tv_foreground_color"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#00FFFFFF"
|
||||
android:layout_toRightOf="@+id/tv_background_color"
|
||||
android:layout_below="@+id/tv_weather"
|
||||
android:layout_marginLeft="25dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:src="@drawable/ic_foreground_color"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/tv_foreground_color1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#00FFFFFF"
|
||||
android:layout_toRightOf="@+id/tv_foreground_color"
|
||||
android:layout_below="@+id/tv_weather"
|
||||
android:layout_marginLeft="25dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:src="@drawable/ic_foreground_color"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/tv_background_image_hand"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#00FFFFFF"
|
||||
android:layout_toRightOf="@+id/tv_foreground_color1"
|
||||
android:layout_below="@+id/tv_weather"
|
||||
android:layout_marginLeft="25dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:src="@drawable/ic_image"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_day"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_below="@+id/tv_date"
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:background="#00FFFFFF"
|
||||
android:textColor="#fff"
|
||||
android:textSize="26sp" />
|
||||
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/tv_hours_system"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#00FFFFFF"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginLeft="40dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:src="@drawable/ic_am"
|
||||
/>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/tv_screen_lock"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#00FFFFFF"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_below="@+id/tv_date"
|
||||
android:layout_marginLeft="40dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_weight="1"
|
||||
android:src="@drawable/ic_screen_unlock" />
|
||||
|
||||
<clock.socoolby.com.clock.widget.textview.AutoScrollTextView
|
||||
android:id="@+id/tv_descript"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="40dp"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:gravity="center"
|
||||
android:textColor="#fff"
|
||||
android:background="#00FFFFFF"
|
||||
android:layout_weight="8"
|
||||
android:textSize="26sp" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/tv_setting"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:background="#00FFFFFF"
|
||||
android:padding="5dp"
|
||||
android:layout_marginLeft="40dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:src="@drawable/ic_settings_black_24dp"
|
||||
android:visibility="gone" />
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
<clock.socoolby.com.clock.widget.animatorview.AnimatorView
|
||||
android:id="@+id/tv_foreground_animatorview"
|
||||
android:layout_width="match_parent"
|
||||
|
205
app/src/main/res/layout/theme_default.xml
Normal file
205
app/src/main/res/layout/theme_default.xml
Normal file
@ -0,0 +1,205 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/rel_main"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#00FFFFFF"
|
||||
>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_handup_image"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:gravity="center"
|
||||
android:text='"hand up"'
|
||||
android:textColor="#fff"
|
||||
android:background="#00FFFFFF"
|
||||
android:textSize="80sp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_weather"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:clickable="true"
|
||||
android:text=" "
|
||||
android:textColor="#fff"
|
||||
android:background="#00FFFFFF"
|
||||
android:textSize="22sp"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_date"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:background="#00FFFFFF"
|
||||
android:textColor="#fff"
|
||||
android:textSize="32sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_hand_time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/tv_weather"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_marginTop="12dp"
|
||||
android:background="#00FFFFFF"
|
||||
android:layout_marginLeft="13dp"
|
||||
android:textColor="#fff"
|
||||
android:textSize="20sp"
|
||||
/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/tv_hand"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#00FFFFFF"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_below="@+id/tv_weather"
|
||||
android:layout_marginLeft="100dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:src="@drawable/ic_alarm_clock" />
|
||||
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/tv_break"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#00FFFFFF"
|
||||
android:layout_toRightOf="@+id/tv_hand"
|
||||
android:layout_below="@+id/tv_weather"
|
||||
android:layout_marginLeft="25dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:src="@drawable/ic_handup"
|
||||
/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/tv_background_color"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#00FFFFFF"
|
||||
android:layout_toRightOf="@+id/tv_break"
|
||||
android:layout_below="@+id/tv_weather"
|
||||
android:layout_marginLeft="40dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:src="@drawable/ic_background_color"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/tv_foreground_color"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#00FFFFFF"
|
||||
android:layout_toRightOf="@+id/tv_background_color"
|
||||
android:layout_below="@+id/tv_weather"
|
||||
android:layout_marginLeft="25dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:src="@drawable/ic_foreground_color"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/tv_foreground_color1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#00FFFFFF"
|
||||
android:layout_toRightOf="@+id/tv_foreground_color"
|
||||
android:layout_below="@+id/tv_weather"
|
||||
android:layout_marginLeft="25dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:src="@drawable/ic_foreground_color"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/tv_background_image_hand"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#00FFFFFF"
|
||||
android:layout_toRightOf="@+id/tv_foreground_color1"
|
||||
android:layout_below="@+id/tv_weather"
|
||||
android:layout_marginLeft="25dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:src="@drawable/ic_image"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_day"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_below="@+id/tv_date"
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:background="#00FFFFFF"
|
||||
android:textColor="#fff"
|
||||
android:textSize="26sp" />
|
||||
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/tv_hours_system"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#00FFFFFF"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginLeft="40dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:src="@drawable/ic_am"
|
||||
/>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/tv_screen_lock"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#00FFFFFF"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_below="@+id/tv_date"
|
||||
android:layout_marginLeft="40dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_weight="1"
|
||||
android:src="@drawable/ic_screen_unlock" />
|
||||
|
||||
<clock.socoolby.com.clock.widget.textview.AutoScrollTextView
|
||||
android:id="@+id/tv_descript"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="40dp"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:gravity="center"
|
||||
android:textColor="#fff"
|
||||
android:background="#00FFFFFF"
|
||||
android:layout_weight="8"
|
||||
android:textSize="26sp" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/tv_setting"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:background="#00FFFFFF"
|
||||
android:padding="5dp"
|
||||
android:layout_marginLeft="40dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:src="@drawable/ic_settings_black_24dp"
|
||||
android:visibility="gone" />
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
206
app/src/main/res/layout/theme_sample.xml
Normal file
206
app/src/main/res/layout/theme_sample.xml
Normal file
@ -0,0 +1,206 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/rel_main"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#00FFFFFF"
|
||||
>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_handup_image"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:gravity="center"
|
||||
android:text='"hand up"'
|
||||
android:textColor="#fff"
|
||||
android:background="#00FFFFFF"
|
||||
android:textSize="80sp"
|
||||
android:visibility="gone" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_hand_time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_marginTop="12dp"
|
||||
android:background="#00FFFFFF"
|
||||
android:layout_marginLeft="13dp"
|
||||
android:textColor="#fff"
|
||||
android:textSize="20sp"
|
||||
/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/tv_hand"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#00FFFFFF"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_marginLeft="100dp"
|
||||
android:layout_marginTop="30dp"
|
||||
android:src="@drawable/ic_alarm_clock" />
|
||||
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/tv_break"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#00FFFFFF"
|
||||
android:layout_toRightOf="@+id/tv_hand"
|
||||
android:layout_marginLeft="25dp"
|
||||
android:layout_marginTop="30dp"
|
||||
android:src="@drawable/ic_handup"
|
||||
/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/tv_background_color"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#00FFFFFF"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_marginRight="40dp"
|
||||
android:layout_marginTop="40dp"
|
||||
android:src="@drawable/ic_background_color"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/tv_foreground_color"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#00FFFFFF"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_below="@+id/tv_background_color"
|
||||
android:layout_marginRight="40dp"
|
||||
android:layout_marginTop="30dp"
|
||||
android:src="@drawable/ic_foreground_color"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/tv_foreground_color1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#00FFFFFF"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_below="@+id/tv_foreground_color"
|
||||
android:layout_marginRight="40dp"
|
||||
android:layout_marginTop="30dp"
|
||||
android:src="@drawable/ic_foreground_color"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/tv_background_image_hand"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#00FFFFFF"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_below="@+id/tv_foreground_color1"
|
||||
android:layout_marginRight="40dp"
|
||||
android:layout_marginTop="30dp"
|
||||
android:src="@drawable/ic_image"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/tv_hours_system"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#00FFFFFF"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginLeft="40dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:src="@drawable/ic_am"
|
||||
/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/tv_screen_bottom"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/tv_screen_lock"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#00FFFFFF"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_below="@+id/tv_date"
|
||||
android:layout_marginLeft="40dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_weight="1"
|
||||
android:src="@drawable/ic_screen_unlock" />
|
||||
|
||||
<clock.socoolby.com.clock.widget.textview.AutoScrollTextView
|
||||
android:id="@+id/tv_descript"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="40dp"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:gravity="center"
|
||||
android:textColor="#fff"
|
||||
android:background="#00FFFFFF"
|
||||
android:layout_weight="8"
|
||||
android:textSize="26sp" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/tv_setting"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:background="#00FFFFFF"
|
||||
android:padding="5dp"
|
||||
android:layout_marginLeft="40dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:src="@drawable/ic_settings_black_24dp"
|
||||
android:visibility="gone" />
|
||||
</LinearLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_above="@+id/tv_screen_bottom"
|
||||
android:layout_marginBottom="10dp"
|
||||
>
|
||||
<TextView
|
||||
android:id="@+id/tv_weather"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:clickable="true"
|
||||
android:text=" "
|
||||
android:textColor="#fff"
|
||||
android:background="#00FFFFFF"
|
||||
android:textSize="20sp"
|
||||
/>
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_day"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:background="#00FFFFFF"
|
||||
android:textColor="#fff"
|
||||
android:textSize="20sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_date"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_marginRight="10dp"
|
||||
android:background="#00FFFFFF"
|
||||
android:textColor="#fff"
|
||||
android:textSize="20sp" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</RelativeLayout>
|
BIN
app/src/main/res/raw/tick1.mp3
Normal file
BIN
app/src/main/res/raw/tick1.mp3
Normal file
Binary file not shown.
BIN
app/src/main/res/raw/tick2.mp3
Normal file
BIN
app/src/main/res/raw/tick2.mp3
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user