mirror of
https://gitee.com/51danju/workclock.git
synced 2025-06-06 10:54:05 +08:00
增加可以使用桌面壁纸,Log库替为timber,
This commit is contained in:
parent
dd5505a5ab
commit
c306a6772a
@ -115,6 +115,10 @@ dependencies {
|
||||
implementation 'com.github.samlss:ClockView:1.0'
|
||||
|
||||
implementation "com.ironsource.aura.oneadapter:oneadapter:1.2.0"
|
||||
|
||||
// Timber logging
|
||||
implementation 'com.jakewharton.timber:timber:4.7.1'
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -3,7 +3,6 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="clock.socoolby.com.clock">
|
||||
|
||||
<uses-permission android:name="android.permission.VIBRATE" />
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
@ -15,14 +14,16 @@
|
||||
android:installLocation="internalOnly"
|
||||
android:theme="@style/Theme.AppCompat.Light.NoActionBar.FullScreen">
|
||||
|
||||
<activity android:name=".MainActivity" android:screenOrientation="sensorLandscape">
|
||||
<activity android:name=".MainActivity"
|
||||
android:theme="@style/Activity.Translucent"
|
||||
android:screenOrientation="sensorLandscape">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.HOME" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity android:name=".SettingActivity" android:screenOrientation="sensorLandscape"/>
|
||||
<activity android:name=".AboutActivity" android:screenOrientation="sensorLandscape"/>
|
||||
<receiver android:name=".ActivateAdmin">
|
||||
<meta-data android:name="android.app.device_admin"
|
||||
@ -53,7 +54,21 @@
|
||||
android:path="/iLGKOXzrWf0i+iNudibv+zAM6mk=" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<service android:name=".screen.LockAccessibilityService"
|
||||
android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE"
|
||||
android:label="@string/app_name"
|
||||
android:description="@string/accessibility_desc"
|
||||
>
|
||||
<intent-filter>
|
||||
<action android:name="android.accessibilityservice.AccessibilityService" />
|
||||
</intent-filter>
|
||||
<meta-data
|
||||
android:name="android.accessibilityservice"
|
||||
android:resource="@xml/accessibility_service_config" />
|
||||
</service>
|
||||
</application>
|
||||
<uses-permission android:name="android.permission.VIBRATE" />
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK"/>
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||
<uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
|
||||
@ -64,5 +79,6 @@
|
||||
<uses-permission android:name="android.permission.REAL_GET_TASKS"
|
||||
tools:ignore="ProtectedPermissions" />
|
||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
|
||||
|
||||
<uses-permission android:name="android.permission.USES_POLICY_FORCE_LOCK" />
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||
</manifest>
|
@ -1,7 +1,16 @@
|
||||
package clock.socoolby.com.clock;
|
||||
|
||||
import android.app.admin.DeviceAdminReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
import timber.log.Timber;
|
||||
|
||||
public class ActivateAdmin extends DeviceAdminReceiver {
|
||||
|
||||
@Override
|
||||
public void onDisabled(Context context, Intent intent) {
|
||||
super.onDisabled(context, intent);
|
||||
Timber.d("Disabled lock device admin");
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package clock.socoolby.com.clock;
|
||||
|
||||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import com.blankj.utilcode.constant.PermissionConstants;
|
||||
import com.blankj.utilcode.util.PermissionUtils;
|
||||
@ -23,6 +22,7 @@ import clock.socoolby.com.clock.model.SharePerferenceModel;
|
||||
import e.odbo.DB;
|
||||
import e.odbo.data.dao.EntityManager;
|
||||
import e.odbo.data.sample.security.NoScuritySupportManager;
|
||||
import timber.log.Timber;
|
||||
|
||||
public class ClockApplication extends Application {
|
||||
|
||||
@ -41,6 +41,11 @@ public class ClockApplication extends Application {
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
sEndzoneBoxApp = this;
|
||||
if (BuildConfig.DEBUG) {
|
||||
Timber.plant(new Timber.DebugTree());
|
||||
} else {
|
||||
Timber.plant(new CrashReportingTree());
|
||||
}
|
||||
Utils.init(this);
|
||||
init();
|
||||
initEnityManager();
|
||||
@ -51,13 +56,13 @@ public class ClockApplication extends Application {
|
||||
WorkClockDatabase database=new WorkClockDatabase();
|
||||
try {
|
||||
localDB= SQLite.androidWithSQLDroid(this.getPackageName(),Constants.APP_NAME,null,null);
|
||||
Log.d("e","setup database start....");
|
||||
timber.log.Timber.d("setup database start....");
|
||||
localDB.setup(database);
|
||||
}catch (BasicException e){
|
||||
Log.e("e","setup database false",e);
|
||||
timber.log.Timber.e(e,"setup database false");
|
||||
}
|
||||
localDB.model(database);
|
||||
Log.d("e","start database end....");
|
||||
timber.log.Timber.d("start database end....");
|
||||
DBSession dbSession=(DBSession) localDB.getDbSession();
|
||||
entityManager=new EntityManager(dbSession,new TableDBSentenceBuilder(dbSession,new NoScuritySupportManager()));
|
||||
entityManager.addDaoToMap(new TimeFontStyleDao(dbSession));
|
||||
@ -75,12 +80,12 @@ public class ClockApplication extends Application {
|
||||
}).callback(new PermissionUtils.SimpleCallback() {
|
||||
@Override
|
||||
public void onGranted() {
|
||||
Log.d("app","supported permission....");
|
||||
Timber.d("supported permission....");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDenied() {
|
||||
Log.d("app","supported permission denied...");
|
||||
Timber.d("supported permission denied...");
|
||||
}
|
||||
}).request();
|
||||
model = new SharePerferenceModel();
|
||||
@ -114,4 +119,10 @@ public class ClockApplication extends Application {
|
||||
public EntityManager getEntityManager(){
|
||||
return entityManager;
|
||||
}
|
||||
|
||||
private static class CrashReportingTree extends Timber.Tree {
|
||||
@Override
|
||||
protected void log(int priority, String tag, String message, Throwable t) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,4 +14,6 @@ public class Constants {
|
||||
|
||||
public final static String APP_MEMO="小提示: ←动画 →字体 ↑↓亮度 双指_字体大小 双击_切屏 长按_参数设置";
|
||||
|
||||
public static final Integer ACCESSIBILITY_SERVICE_REQUEST_CODE=101;
|
||||
|
||||
}
|
@ -4,7 +4,6 @@ package clock.socoolby.com.clock;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.annotation.TargetApi;
|
||||
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.lifecycle.Observer;
|
||||
import androidx.lifecycle.ViewModelProviders;
|
||||
|
||||
@ -17,7 +16,6 @@ import android.os.Bundle;
|
||||
import android.provider.Settings;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import android.util.Log;
|
||||
import android.view.Display;
|
||||
import android.view.GestureDetector;
|
||||
import android.view.KeyEvent;
|
||||
@ -67,6 +65,7 @@ import clock.socoolby.com.clock.model.SharePerferenceModel;
|
||||
import clock.socoolby.com.clock.state.ClockInterfaceTypeEnum;
|
||||
import clock.socoolby.com.clock.state.ClockThemeUITypeEnum;
|
||||
import clock.socoolby.com.clock.todo.TodoSyncServiceManager;
|
||||
import clock.socoolby.com.clock.utils.DialogUtils;
|
||||
import clock.socoolby.com.clock.viewmodel.AlterViewModel;
|
||||
import clock.socoolby.com.clock.viewmodel.DigitViewModel;
|
||||
import clock.socoolby.com.clock.viewmodel.GlobalViewModel;
|
||||
@ -105,8 +104,6 @@ public class MainActivity extends AppCompatActivity implements android.view.Ges
|
||||
|
||||
private SharePerferenceModel model;
|
||||
|
||||
//private PowerManager.WakeLock localWakeLock = null;
|
||||
|
||||
public WeatherResponse weatherAdape;
|
||||
|
||||
private ClockStateMachine clockStateMachine;
|
||||
@ -136,8 +133,10 @@ public class MainActivity extends AppCompatActivity implements android.view.Ges
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
setContentView(R.layout.activity_main);
|
||||
|
||||
model = ((ClockApplication) getApplication()).getModel();
|
||||
|
||||
themeUIContainer = findViewById(R.id.main_background);
|
||||
tv_background_image = findViewById(R.id.tv_background_image);
|
||||
|
||||
@ -146,7 +145,6 @@ public class MainActivity extends AppCompatActivity implements android.view.Ges
|
||||
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);
|
||||
|
||||
@ -160,25 +158,27 @@ public class MainActivity extends AppCompatActivity implements android.view.Ges
|
||||
|
||||
spiritsManager.initContiner(findViewById(R.id.spirits_container),getSupportFragmentManager(),R.id.fragment_spine_container);
|
||||
|
||||
|
||||
testSetup();
|
||||
|
||||
//SqlScoutServer.create(this, getPackageName());
|
||||
}
|
||||
|
||||
private boolean isPowerManagerDisable() {
|
||||
return wakeLock == null;
|
||||
}
|
||||
|
||||
|
||||
private void setUpProximityService() {
|
||||
if (isPowerManagerDisable())
|
||||
if (isPowerManagerDisable()&&Build.VERSION.SDK_INT < Build.VERSION_CODES.P)
|
||||
return;
|
||||
try {
|
||||
if (isScreenLock()) {
|
||||
stopService(proximityServiceIntent);
|
||||
} else {
|
||||
if (model.isTriggerScreen()) {
|
||||
startService(proximityServiceIntent);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
startForegroundService(proximityServiceIntent);
|
||||
}else
|
||||
startService(proximityServiceIntent);
|
||||
} else {
|
||||
stopService(proximityServiceIntent);
|
||||
}
|
||||
@ -202,9 +202,8 @@ public class MainActivity extends AppCompatActivity implements android.view.Ges
|
||||
}
|
||||
|
||||
private void init() {
|
||||
model = ((ClockApplication) getApplication()).getModel();
|
||||
businessService= ((ClockApplication) getApplication()).getBusinessService();
|
||||
Log.d(TAG, "start model:" + model.toString());
|
||||
timber.log.Timber.d("start model:" + model.toString());
|
||||
|
||||
proximityServiceIntent = new Intent(this, ProximityService.class);
|
||||
|
||||
@ -222,14 +221,15 @@ public class MainActivity extends AppCompatActivity implements android.view.Ges
|
||||
alterManager = new AlterManager(model.getStartHourPowerTime(), model.getStopHourPowerTime(), globalViewModel, ClockApplication.getInstance().getEntityManager());
|
||||
|
||||
todoSyncServiceManager = new TodoSyncServiceManager(this.getApplicationContext());
|
||||
globalViewModel.setTodoSyncServiceManager(todoSyncServiceManager);
|
||||
|
||||
clockStateMachine = new ClockStateMachine(alterManager, globalViewModel, digitViewModel, simulateViewModel, themeUIViewModel, alterViewModel,todoSyncServiceManager);
|
||||
|
||||
setUpProximityService();
|
||||
|
||||
bindViewModel();
|
||||
globalViewModel.setClockStateMachine(clockStateMachine);
|
||||
|
||||
themeUIManager = new ThemeUIManager(ClockApplication.getInstance().getEntityManager(), model,fontManager);
|
||||
globalViewModel.setThemeUIManager(themeUIManager);
|
||||
|
||||
bindViewModel();
|
||||
|
||||
spiritsManager=new SpiritsManager(globalViewModel,digitViewModel,simulateViewModel,themeUIViewModel,alterViewModel);
|
||||
|
||||
@ -286,16 +286,28 @@ public class MainActivity extends AppCompatActivity implements android.view.Ges
|
||||
|
||||
private void bindViewModel() {
|
||||
|
||||
globalViewModel.getUseSystemWallpaper().observe(this, new Observer<Boolean>() {
|
||||
@Override
|
||||
public void onChanged(Boolean aBoolean) {
|
||||
if(aBoolean){
|
||||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER);
|
||||
}else{
|
||||
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER);
|
||||
}
|
||||
globalViewModel.checkSystemWallpaperSet();
|
||||
}
|
||||
});
|
||||
|
||||
globalViewModel.getClockInterfaceTypeEnum().observe(this, new Observer<ClockInterfaceTypeEnum>() {
|
||||
@Override
|
||||
public void onChanged(ClockInterfaceTypeEnum clockInterfaceTypeEnum) {
|
||||
Log.d(TAG,"comming in clockInterfaceTypeEnum change observe type:"+clockInterfaceTypeEnum.name());
|
||||
timber.log.Timber.d("comming in clockInterfaceTypeEnum change observe type:"+clockInterfaceTypeEnum.name());
|
||||
switch (clockInterfaceTypeEnum) {
|
||||
case Digit:
|
||||
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, new DigitClockFragment(clockStateMachine)).commit();
|
||||
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, new DigitClockFragment()).commit();
|
||||
break;
|
||||
case Simulate:
|
||||
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, new SimulateClockFragment(clockStateMachine)).commit();
|
||||
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, new SimulateClockFragment()).commit();
|
||||
break;
|
||||
}
|
||||
clockStateMachine.setCurrentInterfaceType(clockInterfaceTypeEnum);
|
||||
@ -315,7 +327,7 @@ public class MainActivity extends AppCompatActivity implements android.view.Ges
|
||||
EventManger.addAlterListener(this,event->{
|
||||
if(event.getValue()) {
|
||||
closeAllConfigFragment();
|
||||
AbstractAlterFragment alterFragment = new AlterTodoDefaultFragment(clockStateMachine,todoSyncServiceManager.getTodayTodoEntities());
|
||||
AbstractAlterFragment alterFragment = new AlterTodoDefaultFragment();
|
||||
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, alterFragment).addToBackStack(null).commit();
|
||||
}else
|
||||
getSupportFragmentManager().popBackStack();
|
||||
@ -435,7 +447,7 @@ public class MainActivity extends AppCompatActivity implements android.view.Ges
|
||||
});
|
||||
|
||||
EventManger.addHourAnimatorListener(this,event->{
|
||||
Log.d(TAG, "on hour animator changed: " + event.getValue());
|
||||
timber.log.Timber.d("on hour animator changed: " + event.getValue());
|
||||
if (event.getValue())
|
||||
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, HourAnimatorFactory.builder(globalViewModel.getHourAlterTypeName().getValue(), globalViewModel.getTime_hour().getValue())).addToBackStack(null).commit();
|
||||
else
|
||||
@ -443,18 +455,18 @@ public class MainActivity extends AppCompatActivity implements android.view.Ges
|
||||
});
|
||||
|
||||
EventManger.addLongSleepWakeUpListener(this,event -> {
|
||||
Log.d(TAG, "on long sleep wake up: " + event.getValue());
|
||||
timber.log.Timber.d("on long sleep wake up: " + event.getValue());
|
||||
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, HourAnimatorFactory.builder(FishAnimator.NAME, event.getValue())).addToBackStack(null).commit();
|
||||
});
|
||||
|
||||
EventManger.addNewDayListener(this,event -> {
|
||||
Log.d(TAG, "new day comming: " + event.getValue().getDateString());
|
||||
timber.log.Timber.d("new day comming: " + event.getValue().getDateString());
|
||||
businessService.getWeather(model.getCity(), new RequestListener<WeatherResponse>() {
|
||||
@Override
|
||||
public void onResponse(WeatherResponse weather) {
|
||||
if (weather == null)
|
||||
return;
|
||||
Log.d(TAG, "set Weather ...");
|
||||
timber.log.Timber.d("set Weather ...");
|
||||
weatherAdape = weather;
|
||||
if (weather.getTodayWeather() != null)
|
||||
themeUIViewModel.getWeatherDescription().setValue(weather.getTodayWeather().weather + "/" + weather.getTodayWeather().temperature);
|
||||
@ -463,7 +475,7 @@ public class MainActivity extends AppCompatActivity implements android.view.Ges
|
||||
|
||||
@Override
|
||||
public void onRequestFailed(int error, String errorMessage) {
|
||||
Log.d(TAG, "get Weather false:"+errorMessage);
|
||||
timber.log.Timber.d("get Weather false:"+errorMessage);
|
||||
}
|
||||
});
|
||||
});
|
||||
@ -477,6 +489,13 @@ public class MainActivity extends AppCompatActivity implements android.view.Ges
|
||||
todoSyncServiceManager.stop();
|
||||
}
|
||||
});
|
||||
|
||||
globalViewModel.getTriggerScreen().observe(this, new Observer<Boolean>() {
|
||||
@Override
|
||||
public void onChanged(Boolean aBoolean) {
|
||||
setUpProximityService();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -538,7 +557,7 @@ public class MainActivity extends AppCompatActivity implements android.view.Ges
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
//Log.d(TAG,"onPause..");
|
||||
//timber.log.Timber.d("onPause..");
|
||||
if (!isPowerManagerDisable())
|
||||
wakeLock.release();
|
||||
if (backGroundAnimator != null)
|
||||
@ -570,7 +589,7 @@ public class MainActivity extends AppCompatActivity implements android.view.Ges
|
||||
// 如果裁剪并压缩了,以取压缩路径为准,因为是先裁剪后压缩的
|
||||
|
||||
globalViewModel.setBackgroundImageUri(Uri.parse(selectList.get(0).getPath()));
|
||||
globalViewModel.getBackgroundImageVisable().setValue(true);
|
||||
globalViewModel.setBackgroundImageVisable(true);
|
||||
break;
|
||||
case PictureConfig.TYPE_VIDEO:
|
||||
selectList = PictureSelector.obtainMultipleResult(data);
|
||||
@ -622,19 +641,11 @@ public class MainActivity extends AppCompatActivity implements android.view.Ges
|
||||
return true;
|
||||
}
|
||||
if (!isFullScreen()) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
builder.setIcon(android.R.drawable.ic_dialog_info);
|
||||
builder.setTitle("温馨提示");
|
||||
builder.setMessage("确定要退出吗");
|
||||
builder.setCancelable(true);
|
||||
|
||||
builder.setPositiveButton("确定", (dialog, which) -> {
|
||||
MainActivity.this.finish();
|
||||
DialogUtils.show(this,"温馨提示","确定要退出吗",ok->{
|
||||
if(ok){
|
||||
MainActivity.this.finish();
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton("取消", (dialog, which) -> {
|
||||
dialog.dismiss();
|
||||
});
|
||||
builder.create().show();
|
||||
}
|
||||
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
|
||||
return true;
|
||||
@ -645,7 +656,7 @@ public class MainActivity extends AppCompatActivity implements android.view.Ges
|
||||
}
|
||||
|
||||
public void setup() {
|
||||
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_config_container, new SystemAppConfigFragment(model)).addToBackStack(null).commit();
|
||||
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_config_container, new SystemAppConfigFragment()).addToBackStack(null).commit();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -701,10 +712,10 @@ public class MainActivity extends AppCompatActivity implements android.view.Ges
|
||||
return;
|
||||
switch (globalViewModel.getClockInterfaceTypeEnum().getValue()) {
|
||||
case Digit:
|
||||
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_config_container, new DigitClockConfigFragment(themeUIManager)).addToBackStack(null).commit();
|
||||
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_config_container, new DigitClockConfigFragment()).addToBackStack(null).commit();
|
||||
break;
|
||||
case Simulate:
|
||||
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_config_container, new SimulateClockConfigFragment(themeUIManager)).addToBackStack(null).commit();
|
||||
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_config_container, new SimulateClockConfigFragment()).addToBackStack(null).commit();
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -750,7 +761,7 @@ public class MainActivity extends AppCompatActivity implements android.view.Ges
|
||||
if(isScreenLockWithPassword())
|
||||
return true;
|
||||
|
||||
Log.d(TAG, "onFling");
|
||||
timber.log.Timber.d("onFling");
|
||||
|
||||
int brightness = globalViewModel.getBrightness().getValue();
|
||||
|
||||
@ -758,7 +769,7 @@ public class MainActivity extends AppCompatActivity implements android.view.Ges
|
||||
calcFilingFlag();
|
||||
|
||||
if (e2.getY() - e1.getY() < -flingHeight) { // 从上至下
|
||||
Log.d(TAG, "change brightness +10");
|
||||
timber.log.Timber.d("change brightness +10");
|
||||
brightness = brightness + 10;
|
||||
if (brightness >= 255) {
|
||||
Toast.makeText(this, "最大亮度了", Toast.LENGTH_SHORT).show();
|
||||
@ -767,7 +778,7 @@ public class MainActivity extends AppCompatActivity implements android.view.Ges
|
||||
globalViewModel.getBrightness().setValue(brightness);
|
||||
return true;
|
||||
} else if (e2.getY() - e1.getY() > flingHeight) { // 从下至上
|
||||
Log.d(TAG, "change brightness -10");
|
||||
timber.log.Timber.d("change brightness -10");
|
||||
brightness = brightness - 10;
|
||||
if (brightness <= 0) {
|
||||
Toast.makeText(this, "最小亮度了", Toast.LENGTH_SHORT).show();
|
||||
@ -776,7 +787,7 @@ public class MainActivity extends AppCompatActivity implements android.view.Ges
|
||||
globalViewModel.getBrightness().setValue(brightness);
|
||||
return true;
|
||||
} else if (e2.getX() - e1.getX() > flingWidth) { // 从左向右滑动(左进右出)
|
||||
Log.d(TAG, "left->right");
|
||||
timber.log.Timber.d("left->right");
|
||||
if (globalViewModel.getClockInterfaceTypeEnum().getValue() == ClockInterfaceTypeEnum.Simulate) {
|
||||
simulateViewModel.setClockTypeName(ClockFactory.nextSimulateClockName(simulateViewModel.getClockTypeName().getValue()));
|
||||
return true;
|
||||
@ -818,7 +829,7 @@ public class MainActivity extends AppCompatActivity implements android.view.Ges
|
||||
public boolean onScaleBegin(ScaleGestureDetector detector) {
|
||||
if(isScreenLockWithPassword())
|
||||
return false;
|
||||
Log.d(TAG, "onScaleBegin ");
|
||||
timber.log.Timber.d("onScaleBegin ");
|
||||
scaleSpan = detector.getCurrentSpan();
|
||||
currentFontSize=digitViewModel.getTimeFontStyleSize().getValue();
|
||||
//maxFontSize = fontManager.getMaxFontSize(model.isDisplaySecond());
|
||||
@ -833,7 +844,7 @@ public class MainActivity extends AppCompatActivity implements android.view.Ges
|
||||
|
||||
currentFontSize = currentFontSize + step;
|
||||
|
||||
Log.d(TAG, "onScaleEnd span:" + span + "\t step:" + step + "\tcurrent text size" + currentFontSize);
|
||||
timber.log.Timber.d("onScaleEnd span:" + span + "\t step:" + step + "\tcurrent text size" + currentFontSize);
|
||||
|
||||
digitViewModel.setTimeFontStyleSize(currentFontSize);
|
||||
|
||||
@ -901,7 +912,7 @@ public class MainActivity extends AppCompatActivity implements android.view.Ges
|
||||
display.getSize(outSize);
|
||||
flingWidth=outSize.x/3;
|
||||
flingHeight =outSize.y/3;
|
||||
//Log.d(TAG,"calc filing flag flingWidth:"+flingWidth+"\tflingHeight"+flingHeight);
|
||||
//timber.log.Timber.d("calc filing flag flingWidth:"+flingWidth+"\tflingHeight"+flingHeight);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -34,6 +34,7 @@ public class SettingActivity extends AppCompatActivity implements View.OnClickLi
|
||||
|
||||
private SharePerferenceModel model;
|
||||
|
||||
CheckBox triggerSystemWallpaper;
|
||||
|
||||
|
||||
@Override
|
||||
@ -69,6 +70,16 @@ public class SettingActivity extends AppCompatActivity implements View.OnClickLi
|
||||
}
|
||||
});
|
||||
|
||||
/*triggerSystemWallpaper = (CheckBox) findViewById(R.id.cb_trigger_system_wallpaper);
|
||||
cb_trigger_screen.setChecked(model.isTriggerScreen());
|
||||
cb_trigger_screen.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
model.setTriggerScreen(isChecked);
|
||||
}
|
||||
});*/
|
||||
|
||||
|
||||
Button btn_uninstall = (Button) findViewById(R.id.btn_uninstall);
|
||||
btn_uninstall.setOnClickListener(this);
|
||||
Button btn_about = (Button) findViewById(R.id.btn_about);
|
||||
|
@ -130,7 +130,7 @@ public class SpiritsManager implements DragFrameLayout.OnDragDropListener {
|
||||
demo.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Log.d(TAG,"demo Button clicked");
|
||||
timber.log.Timber.d("demo Button clicked");
|
||||
}
|
||||
});
|
||||
layout.addDragChildView(demo,10,20);*/
|
||||
@ -143,16 +143,16 @@ public class SpiritsManager implements DragFrameLayout.OnDragDropListener {
|
||||
|
||||
@Override
|
||||
public void onDragStart(View view) {
|
||||
Log.d(TAG,"onDragStart view:"+view.getId());
|
||||
timber.log.Timber.d("onDragStart view:"+view.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ontDraging(View view) {
|
||||
Log.d(TAG,"onDraging view:"+view.getId());
|
||||
timber.log.Timber.d("onDraging view:"+view.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDragEnd(View view,int left,int top) {
|
||||
Log.d(TAG,"onDragEnd view is demo:"+(view==demo)+"\t left padding:"+left+"\t top padding:"+top);
|
||||
timber.log.Timber.d("onDragEnd view is demo:"+(view==demo)+"\t left padding:"+left+"\t top padding:"+top);
|
||||
}
|
||||
}
|
||||
|
@ -145,7 +145,7 @@ public class ThemeUIManager{
|
||||
}
|
||||
|
||||
public void saveTempThemeUI(int type){
|
||||
Log.d(TAG,"save temp ThemeUI type:"+type);
|
||||
timber.log.Timber.d("save temp ThemeUI type:"+type);
|
||||
if(type==ClockInterfaceTypeEnum.Digit.code)
|
||||
this.tempThemeStr=makeSaveDigitThemeString(model.getDigitPerferenceModel());
|
||||
else
|
||||
@ -153,7 +153,7 @@ public class ThemeUIManager{
|
||||
}
|
||||
|
||||
public void recoverTempThemeUI(int type)throws BasicException{
|
||||
Log.d(TAG,"recover temp ThemeUI type"+type);
|
||||
timber.log.Timber.d("recover temp ThemeUI type"+type);
|
||||
if(tempThemeStr==null)
|
||||
return;
|
||||
if(type==ClockInterfaceTypeEnum.Digit.code) {
|
||||
|
@ -61,7 +61,7 @@ public class EventManger {
|
||||
public static void removeClockEventListener(EventListenerHandle handle){
|
||||
if(liveEventBus==null)
|
||||
init();
|
||||
Log.d(TAG, "removeClockEventListener: "+handle.getEventType());
|
||||
timber.log.Timber.d("removeClockEventListener: "+handle.getEventType());
|
||||
liveEventBus.with(handle.getEventType(),handle.getValueClass()).removeObserver(handle.getHandle());
|
||||
}
|
||||
|
||||
|
@ -26,8 +26,7 @@ public abstract class AbstractAlterFragment extends Fragment {
|
||||
|
||||
int view_id;
|
||||
|
||||
public AbstractAlterFragment(ClockStateMachine clockStateMachine, int view_id) {
|
||||
this.clockStateMachine=clockStateMachine;
|
||||
public AbstractAlterFragment( int view_id) {
|
||||
this.view_id=view_id;
|
||||
}
|
||||
|
||||
@ -36,6 +35,7 @@ public abstract class AbstractAlterFragment extends Fragment {
|
||||
super.onCreate(savedInstanceState);
|
||||
globalViewModel= ViewModelProviders.of(getActivity(), new ViewModelFactory(ClockApplication.getInstance().getModel())).get(GlobalViewModel.class);
|
||||
alterViewModel=ViewModelProviders.of(getActivity(), new ViewModelFactory(ClockApplication.getInstance().getModel())).get(AlterViewModel.class);
|
||||
clockStateMachine=globalViewModel.getClockStateMachine();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,5 +1,6 @@
|
||||
package clock.socoolby.com.clock.fragment.alter;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.RelativeLayout;
|
||||
@ -44,10 +45,14 @@ public class AlterTodoDefaultFragment extends AbstractAlterFragment {
|
||||
TodoEntity currentTodoEntity;
|
||||
private OneAdapter todoAdapter;
|
||||
|
||||
public AlterTodoDefaultFragment() {
|
||||
super(R.layout.fragment_alter_todo);
|
||||
}
|
||||
|
||||
public AlterTodoDefaultFragment(ClockStateMachine clockStateMachine, List<TodoEntity> todayTodoList) {
|
||||
super(clockStateMachine, R.layout.fragment_alter_todo);
|
||||
this.todayTodoList=todayTodoList;
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
todayTodoList=globalViewModel.getTodoSyncServiceManager().getTodayTodoEntities();
|
||||
currentTodoEntity=clockStateMachine.getCurrentTodoEntity();
|
||||
}
|
||||
|
||||
|
@ -140,8 +140,8 @@ public class DigitClockConfigFragment extends Fragment {
|
||||
@BindView(R.id.tv_time_text_basline_x)
|
||||
VerticalRangeSeekBar tvTimeTextBaslineX;
|
||||
|
||||
public DigitClockConfigFragment(ThemeUIManager themeUIManager) {
|
||||
this.themeUIManager = themeUIManager;
|
||||
public DigitClockConfigFragment(){
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -150,6 +150,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);
|
||||
themeUIViewModel=ViewModelProviders.of(getActivity(), new ViewModelFactory(ClockApplication.getInstance().getModel())).get(ThemeUIViewModel.class);
|
||||
themeUIManager=globalViewModel.getThemeUIManager();
|
||||
themeUIManager.saveTempThemeUI(ClockInterfaceTypeEnum.Digit.code);
|
||||
globalViewModel.setAppConfig(true);
|
||||
}
|
||||
|
@ -34,8 +34,8 @@ public class DigitClockFragment extends Fragment {
|
||||
public static final String TAG=DigitClockFragment.class.getName();
|
||||
public ClockStateMachine clockStateMachine;
|
||||
|
||||
public DigitClockFragment(ClockStateMachine clockStateMachine) {
|
||||
this.clockStateMachine=clockStateMachine;
|
||||
public DigitClockFragment(){
|
||||
|
||||
}
|
||||
|
||||
DigitViewModel digitViewModel;
|
||||
@ -50,6 +50,7 @@ public class DigitClockFragment extends Fragment {
|
||||
super.onCreate(savedInstanceState);
|
||||
digitViewModel= ViewModelProviders.of(getActivity(), new ViewModelFactory(ClockApplication.getInstance().getModel())).get(DigitViewModel.class);
|
||||
globalViewModel=ViewModelProviders.of(getActivity(), new ViewModelFactory(ClockApplication.getInstance().getModel())).get(GlobalViewModel.class);
|
||||
clockStateMachine=globalViewModel.getClockStateMachine();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -26,8 +26,7 @@ public abstract class AbstractHandUpFragment extends Fragment {
|
||||
int view_id;
|
||||
|
||||
|
||||
public AbstractHandUpFragment(ClockStateMachine clockStateMachine, int view_id) {
|
||||
this.clockStateMachine=clockStateMachine;
|
||||
public AbstractHandUpFragment(int view_id) {
|
||||
this.view_id=view_id;
|
||||
}
|
||||
|
||||
@ -36,6 +35,7 @@ public abstract class AbstractHandUpFragment extends Fragment {
|
||||
super.onCreate(savedInstanceState);
|
||||
globalViewModel= ViewModelProviders.of(getActivity(), new ViewModelFactory(ClockApplication.getInstance().getModel())).get(GlobalViewModel.class);
|
||||
alterViewModel=ViewModelProviders.of(getActivity(), new ViewModelFactory(ClockApplication.getInstance().getModel())).get(AlterViewModel.class);
|
||||
clockStateMachine=globalViewModel.getClockStateMachine();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -5,8 +5,8 @@ import clock.socoolby.com.clock.state.ClockStateMachine;
|
||||
public abstract class AbstractHandUpSelectFragment extends AbstractHandUpFragment {
|
||||
|
||||
|
||||
public AbstractHandUpSelectFragment(ClockStateMachine clockStateMachine, int view_id) {
|
||||
super(clockStateMachine, view_id);
|
||||
public AbstractHandUpSelectFragment( int view_id) {
|
||||
super( view_id);
|
||||
}
|
||||
|
||||
protected void selected(){
|
||||
|
@ -26,8 +26,8 @@ public class HandUpDefaultFragment extends AbstractHandUpFragment {
|
||||
private int handUPDialy=0;
|
||||
|
||||
|
||||
public HandUpDefaultFragment(ClockStateMachine clockStateMachine) {
|
||||
super(clockStateMachine,R.layout.fragment_handup);
|
||||
public HandUpDefaultFragment() {
|
||||
super(R.layout.fragment_handup);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -7,9 +7,9 @@ public final class HandUpFragmentFactory {
|
||||
public static AbstractHandUpFragment build(String name, ClockStateMachine clockStateMachine){
|
||||
switch (name){
|
||||
case HandUpSelect123Fragment.NAME:
|
||||
return new HandUpSelect123Fragment(clockStateMachine);
|
||||
return new HandUpSelect123Fragment();
|
||||
|
||||
}
|
||||
return new HandUpDefaultFragment(clockStateMachine);
|
||||
return new HandUpDefaultFragment();
|
||||
}
|
||||
}
|
||||
|
@ -30,8 +30,8 @@ public class HandUpSelect123Fragment extends AbstractHandUpSelectFragment implem
|
||||
|
||||
EventListenerHandle heartBeatListenerHandle;
|
||||
|
||||
public HandUpSelect123Fragment(ClockStateMachine clockStateMachine) {
|
||||
super(clockStateMachine, R.layout.fragment_handup_select_123);
|
||||
public HandUpSelect123Fragment() {
|
||||
super( R.layout.fragment_handup_select_123);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -42,7 +42,6 @@ public class HandUpSelect123Fragment extends AbstractHandUpSelectFragment implem
|
||||
selectButton2.setOnClickListener(this);
|
||||
selectButton3=rootView.findViewById(R.id.tv_select_button3);
|
||||
selectButton3.setOnClickListener(this);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -66,7 +65,7 @@ public class HandUpSelect123Fragment extends AbstractHandUpSelectFragment implem
|
||||
heartBeatListenerHandle=EventManger.addHeartbeatListener(new ClockEventListener<Boolean>() {
|
||||
@Override
|
||||
public void onEvent(ClockEvent<Boolean> event) {
|
||||
Log.d(TAG, "onEvent: "+event.getEventType()+"\troundLoop:"+roundLoop);
|
||||
timber.log.Timber.d("onEvent: "+event.getEventType()+"\troundLoop:"+roundLoop);
|
||||
if(roundLoop==0) {
|
||||
setButtonColor(rundomButton);
|
||||
EventManger.removeClockEventListener(heartBeatListenerHandle);
|
||||
|
@ -25,6 +25,11 @@ public class HourVideoFragment extends AbstractVideoFragment {
|
||||
|
||||
protected GlobalViewModel globalViewModel;
|
||||
|
||||
public HourVideoFragment(){
|
||||
super();
|
||||
this.hour=0;
|
||||
}
|
||||
|
||||
public HourVideoFragment(int hour) {
|
||||
super();
|
||||
this.hour=hour;
|
||||
|
@ -106,8 +106,8 @@ public class SimulateClockConfigFragment extends Fragment {
|
||||
|
||||
private ColorPickerPop colorPickerDialog;
|
||||
|
||||
public SimulateClockConfigFragment(ThemeUIManager themeUIManager) {
|
||||
this.themeUIManager = themeUIManager;
|
||||
public SimulateClockConfigFragment(){
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -116,6 +116,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);
|
||||
themeUIViewModel=ViewModelProviders.of(getActivity(), new ViewModelFactory(ClockApplication.getInstance().getModel())).get(ThemeUIViewModel.class);
|
||||
themeUIManager=globalViewModel.getThemeUIManager();
|
||||
themeUIManager.saveTempThemeUI(ClockInterfaceTypeEnum.Simulate.code);
|
||||
globalViewModel.setAppConfig(true);
|
||||
}
|
||||
|
@ -40,8 +40,7 @@ public class SimulateClockFragment extends Fragment {
|
||||
|
||||
ClockStateMachine clockStateMachine;
|
||||
|
||||
public SimulateClockFragment(ClockStateMachine clockStateMachine) {
|
||||
this.clockStateMachine=clockStateMachine;
|
||||
public SimulateClockFragment(){
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -50,6 +49,7 @@ public class SimulateClockFragment extends Fragment {
|
||||
clockAnimator = new ClockAnimator();
|
||||
simulateViewModel= ViewModelProviders.of(getActivity(), new ViewModelFactory(ClockApplication.getInstance().getModel())).get(SimulateViewModel.class);
|
||||
globalViewModel=ViewModelProviders.of(getActivity(), new ViewModelFactory(ClockApplication.getInstance().getModel())).get(GlobalViewModel.class);
|
||||
clockStateMachine=globalViewModel.getClockStateMachine();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -50,7 +50,7 @@ public class LibgdxSpineFragment extends AndroidFragmentApplication implements I
|
||||
public void preDestory(){
|
||||
|
||||
if (openDEBUGLog)
|
||||
Log.d(TAG, "preDestory");
|
||||
timber.log.Timber.d("preDestory");
|
||||
|
||||
if (!m_hasBuilt)
|
||||
return;
|
||||
@ -73,7 +73,7 @@ public class LibgdxSpineFragment extends AndroidFragmentApplication implements I
|
||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
|
||||
if (openDEBUGLog)
|
||||
Log.d(TAG, "onCreateView");
|
||||
timber.log.Timber.d("onCreateView");
|
||||
|
||||
m_viewRooter = (ViewGroup) inflater.inflate(R.layout.fragment_spine, container,false);
|
||||
return m_viewRooter;
|
||||
@ -83,7 +83,7 @@ public class LibgdxSpineFragment extends AndroidFragmentApplication implements I
|
||||
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
|
||||
|
||||
if (openDEBUGLog)
|
||||
Log.d(TAG, "onViewCreated");
|
||||
timber.log.Timber.d("onViewCreated");
|
||||
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
buildGDX();
|
||||
@ -91,7 +91,7 @@ public class LibgdxSpineFragment extends AndroidFragmentApplication implements I
|
||||
|
||||
public void buildGDX(){
|
||||
if (openDEBUGLog)
|
||||
Log.d(TAG, "buildGDX");
|
||||
timber.log.Timber.d("buildGDX");
|
||||
|
||||
spineEffectView = SpineFactory.build(spineType);
|
||||
m_viewRooter.addView(CreateGLAlpha(spineEffectView));
|
||||
@ -108,7 +108,7 @@ public class LibgdxSpineFragment extends AndroidFragmentApplication implements I
|
||||
public void onStart() {
|
||||
|
||||
if (openDEBUGLog)
|
||||
Log.d(TAG, "onStart");
|
||||
timber.log.Timber.d("onStart");
|
||||
|
||||
m_isStoping = false;
|
||||
super.onStart();
|
||||
@ -121,7 +121,7 @@ public class LibgdxSpineFragment extends AndroidFragmentApplication implements I
|
||||
public void onStop() {
|
||||
|
||||
if (openDEBUGLog)
|
||||
Log.d(TAG, "onStop");
|
||||
timber.log.Timber.d("onStop");
|
||||
|
||||
m_isStoping = true;
|
||||
spineEffectView.setCanDraw(false);
|
||||
@ -132,7 +132,7 @@ public class LibgdxSpineFragment extends AndroidFragmentApplication implements I
|
||||
public void onResume() {
|
||||
|
||||
if (openDEBUGLog)
|
||||
Log.d(TAG, "onResume");
|
||||
timber.log.Timber.d("onResume");
|
||||
|
||||
super.onResume();
|
||||
|
||||
@ -148,7 +148,7 @@ public class LibgdxSpineFragment extends AndroidFragmentApplication implements I
|
||||
public void onPause() {
|
||||
|
||||
if (openDEBUGLog)
|
||||
Log.d(TAG, "onPause");
|
||||
timber.log.Timber.d("onPause");
|
||||
|
||||
if (spineEffectView != null) {
|
||||
spineEffectView.forceOver();
|
||||
@ -165,7 +165,7 @@ public class LibgdxSpineFragment extends AndroidFragmentApplication implements I
|
||||
@Override
|
||||
public void onConfigurationChanged(Configuration config) {
|
||||
if (openDEBUGLog)
|
||||
Log.d(TAG, "onConfigurationChanged");
|
||||
timber.log.Timber.d("onConfigurationChanged");
|
||||
super.onConfigurationChanged(config);
|
||||
m_viewRooter.removeAllViews();
|
||||
buildGDX();
|
||||
@ -175,7 +175,7 @@ public class LibgdxSpineFragment extends AndroidFragmentApplication implements I
|
||||
private View CreateGLAlpha(ApplicationListener application) {
|
||||
|
||||
if (openDEBUGLog)
|
||||
Log.d(TAG, "CreateGLAlpha");
|
||||
timber.log.Timber.d("CreateGLAlpha");
|
||||
|
||||
// GLSurfaceView透明相关
|
||||
AndroidApplicationConfiguration cfg = new AndroidApplicationConfiguration();
|
||||
@ -219,7 +219,7 @@ public class LibgdxSpineFragment extends AndroidFragmentApplication implements I
|
||||
public boolean keyDown(int i) {
|
||||
|
||||
if (openDEBUGLog)
|
||||
Log.d(TAG, "keyDown");
|
||||
timber.log.Timber.d("keyDown");
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -238,19 +238,19 @@ public class LibgdxSpineFragment extends AndroidFragmentApplication implements I
|
||||
|
||||
@Override
|
||||
public boolean touchDown(int screenX, int screenY, int pointer, int button) {
|
||||
Log.d(TAG, "touchDown screenX:"+screenX+"\t screenY:"+screenY+"\tpointer:"+pointer+"\tbutton:"+button);
|
||||
timber.log.Timber.d("touchDown screenX:"+screenX+"\t screenY:"+screenY+"\tpointer:"+pointer+"\tbutton:"+button);
|
||||
|
||||
if(spineEffectView.isContainsPoint(screenX,screenY)) {
|
||||
setInterruptTouch(true);
|
||||
touchSpine = spineEffectView;
|
||||
Log.d(TAG,"find spine in touch down");
|
||||
timber.log.Timber.d("find spine in touch down");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean touchUp(int screenX, int screenY, int pointer, int button) {
|
||||
Log.d(TAG, "touchUp screenX:"+screenX+"\t screenY:"+screenY+"\tpointer:"+pointer+"\tbutton:"+button);
|
||||
timber.log.Timber.d("touchUp screenX:"+screenX+"\t screenY:"+screenY+"\tpointer:"+pointer+"\tbutton:"+button);
|
||||
if(touchSpine!=null) {
|
||||
touchSpine.setAction(ActionEnum.IDLE);
|
||||
setInterruptTouch(false);
|
||||
@ -261,24 +261,24 @@ public class LibgdxSpineFragment extends AndroidFragmentApplication implements I
|
||||
|
||||
@Override
|
||||
public boolean touchDragged(int screenX, int screenY, int pointer) {
|
||||
Log.d(TAG, "touchDragged x:"+screenX+"\t y:"+screenY+"\ti2:"+pointer);
|
||||
timber.log.Timber.d("touchDragged x:"+screenX+"\t y:"+screenY+"\ti2:"+pointer);
|
||||
if(touchSpine!=null) {
|
||||
touchSpine.setPosition(screenX,screenY);
|
||||
touchSpine.setAction(ActionEnum.RUN);
|
||||
//Log.d(TAG, "touchDragged spine");
|
||||
//timber.log.Timber.d("touchDragged spine");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mouseMoved(int x, int y) {
|
||||
Log.d(TAG, "mouseMoved x:"+x+"\t y:"+y);
|
||||
timber.log.Timber.d("mouseMoved x:"+x+"\t y:"+y);
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean scrolled(int amount) {
|
||||
Log.d(TAG, "mouseMoved amount:"+amount);
|
||||
timber.log.Timber.d("mouseMoved amount:"+amount);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -2,12 +2,16 @@ package clock.socoolby.com.clock.fragment.system;
|
||||
|
||||
import android.app.admin.DevicePolicyManager;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.provider.Settings;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.accessibility.AccessibilityManager;
|
||||
import android.widget.Button;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
@ -26,11 +30,16 @@ 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.MainActivity;
|
||||
import clock.socoolby.com.clock.R;
|
||||
import clock.socoolby.com.clock.fragment.houranimator.HourAnimatorFactory;
|
||||
import clock.socoolby.com.clock.fragment.houranimator.HourVideoFragment;
|
||||
import clock.socoolby.com.clock.model.DateModel;
|
||||
import clock.socoolby.com.clock.model.SharePerferenceModel;
|
||||
import clock.socoolby.com.clock.net.auth.AuthCallback;
|
||||
import clock.socoolby.com.clock.todo.TodoSyncServiceManager;
|
||||
import clock.socoolby.com.clock.todo.microsoft.MicrosoftTodoSyncServiceImpl;
|
||||
import clock.socoolby.com.clock.utils.DialogUtils;
|
||||
import clock.socoolby.com.clock.utils.FuncUnit;
|
||||
import clock.socoolby.com.clock.viewmodel.AlterViewModel;
|
||||
import clock.socoolby.com.clock.viewmodel.GlobalViewModel;
|
||||
@ -80,10 +89,12 @@ public class SystemAppConfigFragment extends Fragment implements View.OnClickLi
|
||||
|
||||
CheckBox cb_todo_sync_able;
|
||||
|
||||
CheckBox cb_trigger_system_wallpaper;
|
||||
|
||||
private SharePerferenceModel model;
|
||||
|
||||
public SystemAppConfigFragment(SharePerferenceModel model) {
|
||||
this.model = model;
|
||||
public SystemAppConfigFragment() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -92,6 +103,7 @@ public class SystemAppConfigFragment extends Fragment implements View.OnClickLi
|
||||
this.globalViewModel = ViewModelProviders.of(getActivity(), new ViewModelFactory(ClockApplication.getInstance().getModel())).get(GlobalViewModel.class);
|
||||
alterViewModel=ViewModelProviders.of(getActivity(), new ViewModelFactory(ClockApplication.getInstance().getModel())).get(AlterViewModel.class);
|
||||
globalViewModel.setAppConfig(true);
|
||||
model=ClockApplication.getInstance().getModel();
|
||||
}
|
||||
|
||||
|
||||
@ -116,7 +128,6 @@ public class SystemAppConfigFragment extends Fragment implements View.OnClickLi
|
||||
rg_clock_hour_video=themeRootView.findViewById(R.id.rg_clock_hour_video);
|
||||
btn_clock_hour_video=themeRootView.findViewById(R.id.btn_clock_hour_video);
|
||||
|
||||
|
||||
cb_boot_start=themeRootView.findViewById(R.id.cb_boot_start);
|
||||
|
||||
cb_tick = themeRootView.findViewById(R.id.cb_tick);
|
||||
@ -131,6 +142,8 @@ public class SystemAppConfigFragment extends Fragment implements View.OnClickLi
|
||||
cb_fullscreen_spirit=themeRootView.findViewById(R.id.cb_fullscreen_spirit);
|
||||
cb_todo_sync_able=themeRootView.findViewById(R.id.cb_todo_alter_able);
|
||||
|
||||
cb_trigger_system_wallpaper=themeRootView.findViewById(R.id.cb_trigger_system_wallpaper);
|
||||
|
||||
loadDataFromModel();
|
||||
|
||||
btn_about.setOnClickListener(this);
|
||||
@ -140,6 +153,20 @@ public class SystemAppConfigFragment extends Fragment implements View.OnClickLi
|
||||
cb_trigger_screen.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
if(isChecked) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
AccessibilityManager manager = (AccessibilityManager) getContext().getSystemService(Context.ACCESSIBILITY_SERVICE);
|
||||
if (!manager.isEnabled()) {
|
||||
DialogUtils.show(getContext(),"提醒","当前功能须要开启补助功能,是不前往。", ok->{
|
||||
if(ok){
|
||||
getActivity().startActivityForResult(new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS), Constants.ACCESSIBILITY_SERVICE_REQUEST_CODE);
|
||||
}
|
||||
});
|
||||
cb_trigger_screen.setChecked(false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
model.setTriggerScreen(isChecked);
|
||||
}
|
||||
});
|
||||
@ -218,10 +245,37 @@ public class SystemAppConfigFragment extends Fragment implements View.OnClickLi
|
||||
}
|
||||
});
|
||||
|
||||
cb_trigger_system_wallpaper.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
model.setUseSystemWallpaper(isChecked);
|
||||
}
|
||||
});
|
||||
|
||||
cb_todo_sync_able.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
globalViewModel.setTodoSyncAble(isChecked);
|
||||
if(isChecked){
|
||||
TodoSyncServiceManager todoSyncServiceManager=globalViewModel.getTodoSyncServiceManager();
|
||||
todoSyncServiceManager.start();
|
||||
todoSyncServiceManager.singIn(MicrosoftTodoSyncServiceImpl.NAME, getActivity(), new AuthCallback() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
globalViewModel.setTodoSyncAble(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Exception exception) {
|
||||
cb_todo_sync_able.setChecked(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancel() {
|
||||
cb_todo_sync_able.setChecked(false);
|
||||
}
|
||||
});
|
||||
}else
|
||||
globalViewModel.setTodoSyncAble(false);
|
||||
}
|
||||
});
|
||||
|
||||
@ -289,6 +343,8 @@ public class SystemAppConfigFragment extends Fragment implements View.OnClickLi
|
||||
cb_fullscreen_spirit.setChecked(model.isFullscreenSpiritAble());
|
||||
|
||||
cb_todo_sync_able.setChecked(model.isTodoSyncAble());
|
||||
|
||||
cb_trigger_system_wallpaper.setChecked(model.isUseSystemWallpaper());
|
||||
}
|
||||
|
||||
private void saveToModel() {
|
||||
|
@ -33,6 +33,7 @@ import clock.socoolby.com.clock.pop.WeatherPopup;
|
||||
import clock.socoolby.com.clock.state.ClockInterfaceTypeEnum;
|
||||
import clock.socoolby.com.clock.state.ClockThemeUITypeEnum;
|
||||
import clock.socoolby.com.clock.state.ClockTimeTypeEnum;
|
||||
import clock.socoolby.com.clock.utils.DialogUtils;
|
||||
import clock.socoolby.com.clock.viewmodel.AlterViewModel;
|
||||
import clock.socoolby.com.clock.viewmodel.DigitViewModel;
|
||||
import clock.socoolby.com.clock.viewmodel.GlobalViewModel;
|
||||
@ -40,6 +41,7 @@ import clock.socoolby.com.clock.viewmodel.SimulateViewModel;
|
||||
import clock.socoolby.com.clock.viewmodel.ThemeUIViewModel;
|
||||
import clock.socoolby.com.clock.viewmodel.ViewModelFactory;
|
||||
import clock.socoolby.com.clock.widget.textview.AutoScrollTextView;
|
||||
import timber.log.Timber;
|
||||
|
||||
public abstract class AbstractThemeUIFragment extends Fragment implements View.OnClickListener {
|
||||
|
||||
@ -118,7 +120,18 @@ public abstract class AbstractThemeUIFragment extends Fragment implements View.O
|
||||
tv_background_image_hand.setOnLongClickListener(new View.OnLongClickListener() {
|
||||
@Override
|
||||
public boolean onLongClick(View v) {
|
||||
mainActivity.configBackGroundImage();
|
||||
if(model.isUseSystemWallpaper()){
|
||||
DialogUtils.show(getActivity(), getString(R.string.system_wallpaper), getString(R.string.logut_system_wallpaper_mode), new DialogUtils.OkCancelSelectedLinstener() {
|
||||
@Override
|
||||
public void onReturn(boolean ok) {
|
||||
if(ok) {
|
||||
globalViewModel.setUseSystemWallpaper(false);
|
||||
mainActivity.configBackGroundImage();
|
||||
}
|
||||
}
|
||||
});
|
||||
}else
|
||||
mainActivity.configBackGroundImage();
|
||||
return true;
|
||||
}
|
||||
});
|
||||
@ -283,7 +296,7 @@ public abstract class AbstractThemeUIFragment extends Fragment implements View.O
|
||||
timer.cancel();
|
||||
}
|
||||
running=true;
|
||||
Log.d("themeUiManager","autoFullScreen task created ...");
|
||||
Timber.d("autoFullScreen task created ...");
|
||||
timer.schedule(new TimerTask() {
|
||||
public void run() {
|
||||
themeUIViewModel.setClockUITypeEnum(ClockThemeUITypeEnum.FULLSCREEN);
|
||||
@ -433,7 +446,7 @@ public abstract class AbstractThemeUIFragment extends Fragment implements View.O
|
||||
hour=saveHandUpTime/60;
|
||||
minute=saveHandUpTime-hour*60;
|
||||
}
|
||||
Log.d(TAG, "switch HandUpTime:" + saveHandUpTime+"\thour:"+hour+"\tminute:"+minute);
|
||||
timber.log.Timber.d("switch HandUpTime:" + saveHandUpTime+"\thour:"+hour+"\tminute:"+minute);
|
||||
handUpTimePopup1.init(hour,minute,globalViewModel.getHandUpTypeName().getValue(),alterViewModel.getHandUpMusic().getValue(),alterViewModel.getHandUpMusicName().getValue());
|
||||
handUpTimePopup1.showNow(getFragmentManager(),null);
|
||||
}
|
||||
@ -570,26 +583,52 @@ public abstract class AbstractThemeUIFragment extends Fragment implements View.O
|
||||
setDiscript(FamousQuotesManager.roundAutoQuotes());
|
||||
break;
|
||||
case R.id.tv_background_color:
|
||||
if (colorPickerDialog == null)
|
||||
colorPickerDialog = new ColorPickerPop(mainActivity);
|
||||
if(model.isUseSystemWallpaper()){
|
||||
DialogUtils.show(getActivity(), getString(R.string.system_wallpaper), getString(R.string.logut_system_wallpaper_mode), new DialogUtils.OkCancelSelectedLinstener() {
|
||||
@Override
|
||||
public void onReturn(boolean ok) {
|
||||
if(ok) {
|
||||
globalViewModel.setUseSystemWallpaper(false);
|
||||
}
|
||||
}
|
||||
});
|
||||
}else {
|
||||
if (colorPickerDialog == null)
|
||||
colorPickerDialog = new ColorPickerPop(mainActivity);
|
||||
|
||||
colorPickerDialog.setOnColorChangeListenter(new ColorPickerPop.OnColorListener() {
|
||||
@Override
|
||||
public void onEnsure(int color) {
|
||||
globalViewModel.setBackgroundColor(color);
|
||||
}
|
||||
colorPickerDialog.setOnColorChangeListenter(new ColorPickerPop.OnColorListener() {
|
||||
@Override
|
||||
public void onEnsure(int color) {
|
||||
globalViewModel.setBackgroundColor(color);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBack() {
|
||||
}
|
||||
});
|
||||
colorPickerDialog.show(model.getBackgroundColor());
|
||||
@Override
|
||||
public void onBack() {
|
||||
}
|
||||
});
|
||||
colorPickerDialog.show(model.getBackgroundColor());
|
||||
}
|
||||
break;
|
||||
case R.id.tv_background_image_hand:
|
||||
if (globalViewModel.getBackgroundImageUri().getValue() == null)
|
||||
mainActivity.configBackGroundImage();
|
||||
else
|
||||
globalViewModel.setBackgroundImageVisable(!globalViewModel.getBackgroundImageVisable().getValue());
|
||||
if(model.isUseSystemWallpaper()){
|
||||
DialogUtils.show(getActivity(), getString(R.string.system_wallpaper), getString(R.string.logut_system_wallpaper_mode), new DialogUtils.OkCancelSelectedLinstener() {
|
||||
@Override
|
||||
public void onReturn(boolean ok) {
|
||||
if(ok) {
|
||||
globalViewModel.setUseSystemWallpaper(false);
|
||||
if (globalViewModel.getBackgroundImageUri().getValue() == null)
|
||||
mainActivity.configBackGroundImage();
|
||||
else
|
||||
globalViewModel.setBackgroundImageVisable(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
}else {
|
||||
if (globalViewModel.getBackgroundImageUri().getValue() == null)
|
||||
mainActivity.configBackGroundImage();
|
||||
else
|
||||
globalViewModel.setBackgroundImageVisable(!globalViewModel.getBackgroundImageVisable().getValue());
|
||||
}
|
||||
break;
|
||||
case R.id.tv_foreground_color:
|
||||
globalViewModel.setForegroundColor(model.getForegroundColor1());
|
||||
@ -638,7 +677,7 @@ public abstract class AbstractThemeUIFragment extends Fragment implements View.O
|
||||
|
||||
|
||||
private void switchMode(ClockThemeUITypeEnum mode) {
|
||||
Log.d(TAG, "switch mode to:" + mode);
|
||||
timber.log.Timber.d("switch mode to:" + mode);
|
||||
switch (mode) {
|
||||
case FULLSCREEN:
|
||||
tv_date.setVisibility(View.GONE);
|
||||
|
@ -13,8 +13,6 @@ import clock.socoolby.com.clock.Constants;
|
||||
|
||||
public class SharePerferenceModel extends AbstractPerferenceModel {
|
||||
|
||||
private boolean dirty=false;
|
||||
|
||||
public static final int DEFAULT_COLOR=Color.rgb(255, 255, 255);
|
||||
|
||||
protected boolean firstStart = true;
|
||||
@ -34,7 +32,7 @@ public class SharePerferenceModel extends AbstractPerferenceModel {
|
||||
|
||||
protected boolean tickSound = false;
|
||||
protected final static String KEY_IS_TICK_SOUND = "key_is_tick_sound";
|
||||
protected boolean triggerScreen = true;
|
||||
protected boolean triggerScreen = false;
|
||||
protected final static String KEY_IS_TRIGGER_SCREEN = "key_is_trigger_screen";
|
||||
|
||||
protected boolean hourSystem12 = false;
|
||||
@ -96,6 +94,10 @@ public class SharePerferenceModel extends AbstractPerferenceModel {
|
||||
protected boolean backgroundImageVisable=false;
|
||||
|
||||
|
||||
protected final static String KEY_USE_SYSTEM_WALLPAPER="key_use_system_wallpaper";
|
||||
protected boolean useSystemWallpaper=false;
|
||||
|
||||
|
||||
protected final static String KEY_FOREGROUND_COLOR="key_foreground_color";
|
||||
protected Integer foregroundColor=DEFAULT_COLOR;
|
||||
|
||||
@ -246,7 +248,7 @@ public class SharePerferenceModel extends AbstractPerferenceModel {
|
||||
screenLockPassword=jsonObject.optInt(KEY_SCREEN_LOCK_PASSWORD,0);
|
||||
|
||||
tickSound = jsonObject.getBoolean(KEY_IS_TICK_SOUND);
|
||||
triggerScreen =jsonObject.optBoolean(KEY_IS_TRIGGER_SCREEN,true);
|
||||
triggerScreen =jsonObject.optBoolean(KEY_IS_TRIGGER_SCREEN,false);
|
||||
mCity = jsonObject.optString(KEY_CITY,"jinhua");
|
||||
mDescription = jsonObject.optString(KEY_DESCRPTION, "");
|
||||
startHourPowerTime = new DateModel();
|
||||
@ -291,6 +293,8 @@ public class SharePerferenceModel extends AbstractPerferenceModel {
|
||||
|
||||
todoSyncAble=jsonObject.optBoolean(KEY_SYS_TODO_SYNC_ABLE,false);
|
||||
|
||||
useSystemWallpaper=jsonObject.optBoolean(KEY_USE_SYSTEM_WALLPAPER,false);
|
||||
|
||||
themeUILoad(jsonObject);
|
||||
}
|
||||
|
||||
@ -344,6 +348,8 @@ public class SharePerferenceModel extends AbstractPerferenceModel {
|
||||
|
||||
jsonObject.put(KEY_SYS_TODO_SYNC_ABLE,todoSyncAble);
|
||||
|
||||
jsonObject.put(KEY_USE_SYSTEM_WALLPAPER,useSystemWallpaper);
|
||||
|
||||
themeUISave(jsonObject);
|
||||
}
|
||||
|
||||
@ -491,6 +497,15 @@ public class SharePerferenceModel extends AbstractPerferenceModel {
|
||||
dirtySave();
|
||||
}
|
||||
|
||||
public boolean isUseSystemWallpaper() {
|
||||
return useSystemWallpaper;
|
||||
}
|
||||
|
||||
public void setUseSystemWallpaper(boolean useSystemWallpaper) {
|
||||
this.useSystemWallpaper = useSystemWallpaper;
|
||||
dirtySave();
|
||||
}
|
||||
|
||||
public boolean isBackgroundAnimatorRandomColor() {
|
||||
return backgroundAnimatorRandomColor;
|
||||
}
|
||||
|
@ -74,19 +74,19 @@ public final class NetworkManager {
|
||||
if (url == null || url.length() == 0 || requestObject == null) {
|
||||
return false;
|
||||
}
|
||||
Log.d(TAG, String.format("request URL:%s \nrequest Params:%s", request.getUrl(), requestObject.toString()));
|
||||
timber.log.Timber.d(String.format("request URL:%s \nrequest Params:%s", request.getUrl(), requestObject.toString()));
|
||||
JsonObjectRequest jsonRequest = new JsonObjectRequest(url, requestObject,
|
||||
new Response.Listener<JSONObject>() {
|
||||
@Override
|
||||
public void onResponse(JSONObject response) {
|
||||
Log.d(TAG, "http response JsonString:" + response.toString());
|
||||
timber.log.Timber.d("http response JsonString:" + response.toString());
|
||||
listener.onResponse(response);
|
||||
}
|
||||
},
|
||||
new Response.ErrorListener() {
|
||||
@Override
|
||||
public void onErrorResponse(VolleyError error) {
|
||||
Log.d(TAG, "http request fail");
|
||||
timber.log.Timber.d("http request fail");
|
||||
listener.onRequestFailed(Constants.FAIL_CODE, error.toString());
|
||||
}
|
||||
}) {
|
||||
|
@ -9,6 +9,7 @@ import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
@ -168,6 +169,7 @@ public class CalendarPopup extends FullScreenDialogFragment implements CalendarV
|
||||
public void onEvent(ClockEvent<String> event) {
|
||||
initSyncTodoData();
|
||||
todo_sync.setClickable(true);
|
||||
Toast.makeText(getContext(), "同步完成。。。", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
|
||||
@ -217,7 +219,7 @@ public class CalendarPopup extends FullScreenDialogFragment implements CalendarV
|
||||
|
||||
todoAdapter.clear();
|
||||
List<TodoEntity> dayEntityList=todoSyncServiceManager.getTodoEntities(calendar.getYear(),calendar.getMonth()-1,calendar.getDay());
|
||||
Log.d(TAG,"onCalendarSelect on month:"+calendar.getMonth()+"\t list size:"+dayEntityList.size());
|
||||
timber.log.Timber.d("onCalendarSelect on month:"+calendar.getMonth()+"\t list size:"+dayEntityList.size());
|
||||
if(dayEntityList.size()>0)
|
||||
todoAdapter.setItems(dayEntityList);
|
||||
}
|
||||
@ -236,13 +238,13 @@ public class CalendarPopup extends FullScreenDialogFragment implements CalendarV
|
||||
protected void initSyncTodoData(){
|
||||
Map<String, Calendar> map = new HashMap<>();
|
||||
Calendar todoCalendar;
|
||||
Log.d(TAG,"total todos :"+todoSyncServiceManager.getTodoEntities().size());
|
||||
timber.log.Timber.d("total todos :"+todoSyncServiceManager.getTodoEntities().size());
|
||||
for(TodoEntity todoEntity:todoSyncServiceManager.getTodoEntities()){
|
||||
//Log.d(TAG,"todo name:"+todoEntity.getSubject()+"create time:"+todoEntity.getCreateddatetime());
|
||||
//timber.log.Timber.d("todo name:"+todoEntity.getSubject()+"create time:"+todoEntity.getCreateddatetime());
|
||||
if(todoEntity.getCreateddatetime()!=null){
|
||||
todoCalendar=getSchemeCalendar(todoEntity.getCreateddatetime(),0xFF40db25,todoEntity.getSubject());
|
||||
map.put(todoCalendar.toString(),todoCalendar);
|
||||
//Log.d(TAG,"todo to show:"+todoCalendar.toString());
|
||||
//timber.log.Timber.d("todo to show:"+todoCalendar.toString());
|
||||
}
|
||||
}
|
||||
mCalendarView.setSchemeDate(map);
|
||||
|
@ -135,7 +135,7 @@ public class TimeSetupPopup extends FullScreenDialogFragment implements MusicPic
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
Log.d(TAG,"onResume hour:"+hour+"\tminute:"+minute);
|
||||
timber.log.Timber.d("onResume hour:"+hour+"\tminute:"+minute);
|
||||
mHourSeekbar.fillInside();
|
||||
mHourSeekbar.setCurProcess(hour);
|
||||
mMinuteSeekbar.setCurProcess(minute);
|
||||
|
@ -0,0 +1,38 @@
|
||||
package clock.socoolby.com.clock.screen;
|
||||
|
||||
import android.accessibilityservice.AccessibilityService;
|
||||
import android.os.Build;
|
||||
import android.view.accessibility.AccessibilityEvent;
|
||||
|
||||
import timber.log.Timber;
|
||||
|
||||
public class LockAccessibilityService extends AccessibilityService {
|
||||
public static final String LOCK_COMMAND="Lock Screen";
|
||||
|
||||
@Override
|
||||
public void onAccessibilityEvent(AccessibilityEvent event) {
|
||||
Timber.v("onAccessibilityEvent(): "+event.getText().toString());
|
||||
if(null!=event) {
|
||||
if (event.getEventType() == AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED && !event.getText().isEmpty()&&event.getText().get(0).toString().equalsIgnoreCase(LOCK_COMMAND)) {
|
||||
Timber.d("Received Lock Command");
|
||||
lockDevice();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void lockDevice() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||
Timber.d("Locking device using AccessibilityService");
|
||||
performGlobalAction(GLOBAL_ACTION_LOCK_SCREEN);
|
||||
} else {
|
||||
// This should never be reached, but we'll log it just in case.
|
||||
Timber.e("Locking device using AccessibilityService is only available for Android versions >= Pie");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onInterrupt() {
|
||||
Timber.v("onInterrupt()");
|
||||
}
|
||||
}
|
@ -1,40 +1,57 @@
|
||||
package clock.socoolby.com.clock.utils;
|
||||
package clock.socoolby.com.clock.screen;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.ActivityManager;
|
||||
import android.app.Application;
|
||||
import android.app.KeyguardManager;
|
||||
import android.app.admin.DevicePolicyManager;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Build;
|
||||
import android.os.PowerManager;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.view.accessibility.AccessibilityEvent;
|
||||
import android.view.accessibility.AccessibilityManager;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import clock.socoolby.com.clock.ActivateAdmin;
|
||||
import clock.socoolby.com.clock.ClockApplication;
|
||||
import timber.log.Timber;
|
||||
|
||||
public class ScreenManager {
|
||||
public static boolean isScreenOn() {
|
||||
PowerManager pm = (PowerManager) ClockApplication.getContext().getSystemService(AppCompatActivity.POWER_SERVICE);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH) {
|
||||
return pm.isInteractive();
|
||||
}
|
||||
return pm.isScreenOn();
|
||||
}
|
||||
|
||||
|
||||
public static void systemLock(Context context) {
|
||||
DevicePolicyManager policyManager;
|
||||
ComponentName componentName;
|
||||
policyManager = (DevicePolicyManager) context.getSystemService(AppCompatActivity.DEVICE_POLICY_SERVICE);
|
||||
|
||||
componentName = new ComponentName(context, ActivateAdmin.class);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||
AccessibilityManager manager = (AccessibilityManager) context.getSystemService(Context.ACCESSIBILITY_SERVICE);
|
||||
if (manager.isEnabled()) {
|
||||
AccessibilityEvent event = AccessibilityEvent.obtain(AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED);
|
||||
event.setPackageName(context.getPackageName());
|
||||
event.setClassName(ScreenManager.class.getName());
|
||||
event.setEnabled(true);
|
||||
event.getText().add(LockAccessibilityService.LOCK_COMMAND);
|
||||
Timber.v("Accessibility enabled. Firing AccessibilityEvent: $event");
|
||||
manager.sendAccessibilityEvent(event);
|
||||
} else {
|
||||
Timber.v("Accessibility disabled. Can't fire AccessibilityEvent");
|
||||
}
|
||||
return;
|
||||
}
|
||||
DevicePolicyManager policyManager = (DevicePolicyManager) context.getSystemService(AppCompatActivity.DEVICE_POLICY_SERVICE);
|
||||
ComponentName componentName= new ComponentName(context, ActivateAdmin.class);
|
||||
|
||||
if (!policyManager.isAdminActive(componentName)) {
|
||||
Intent intent = new Intent(DevicePolicyManager.ACTION_ADD_DEVICE_ADMIN);
|
||||
intent.putExtra(DevicePolicyManager.EXTRA_DEVICE_ADMIN, componentName);
|
||||
//描述(additional explanation)
|
||||
intent.putExtra(DevicePolicyManager.EXTRA_ADD_EXPLANATION, "------ 用于锁定屏幕 ------");
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK );
|
||||
context.startActivity(intent);
|
||||
}
|
||||
if (policyManager.isAdminActive(componentName)) {
|
||||
@ -45,7 +62,7 @@ public class ScreenManager {
|
||||
|
||||
public static void systemUnLock() {
|
||||
PowerManager pm = (PowerManager) ClockApplication.getContext().getSystemService(AppCompatActivity.POWER_SERVICE);
|
||||
PowerManager.WakeLock mWakelock = pm.newWakeLock(PowerManager.ACQUIRE_CAUSES_WAKEUP | PowerManager.FULL_WAKE_LOCK, "workclock:SimpleTimer");
|
||||
PowerManager.WakeLock mWakelock = pm.newWakeLock(PowerManager.ACQUIRE_CAUSES_WAKEUP | PowerManager.SCREEN_BRIGHT_WAKE_LOCK, "workclock:SimpleTimer");
|
||||
mWakelock.acquire();
|
||||
mWakelock.release();
|
||||
KeyguardManager keyguardManager = (KeyguardManager) ClockApplication.getContext().getSystemService(AppCompatActivity.KEYGUARD_SERVICE);
|
||||
@ -64,4 +81,5 @@ public class ScreenManager {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
@ -1,5 +1,8 @@
|
||||
package clock.socoolby.com.clock.service;
|
||||
|
||||
import android.app.Notification;
|
||||
import android.app.NotificationChannel;
|
||||
import android.app.NotificationManager;
|
||||
import android.app.Service;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
@ -7,13 +10,15 @@ import android.hardware.Sensor;
|
||||
import android.hardware.SensorEvent;
|
||||
import android.hardware.SensorEventListener;
|
||||
import android.hardware.SensorManager;
|
||||
import android.os.Build;
|
||||
import android.os.IBinder;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.RequiresApi;
|
||||
|
||||
import clock.socoolby.com.clock.ClockApplication;
|
||||
import clock.socoolby.com.clock.MainActivity;
|
||||
import clock.socoolby.com.clock.utils.FuncUnit;
|
||||
import clock.socoolby.com.clock.utils.ScreenManager;
|
||||
import clock.socoolby.com.clock.screen.ScreenManager;
|
||||
|
||||
/**
|
||||
* Alway zuo,never die.
|
||||
@ -23,23 +28,27 @@ import clock.socoolby.com.clock.utils.ScreenManager;
|
||||
public class ProximityService extends Service {
|
||||
private final static String TAG = ProximityService.class.getSimpleName();
|
||||
|
||||
public static final String CHANNEL_ID="workclock_channel";
|
||||
|
||||
protected boolean isRunning=false;
|
||||
|
||||
private SensorManager mSensorManager;
|
||||
private SensorEventListener mSensorListener = new SensorEventListener() {
|
||||
@Override
|
||||
public void onSensorChanged(SensorEvent sensorEvent) {
|
||||
float[] its = sensorEvent.values;
|
||||
Log.d(TAG, String.format("its %f %f %f len:,%d", its[0], its[1], its[2], its.length));
|
||||
//timber.log.Timber.d(String.format("its %f %f %f len:,%d", its[0], its[1], its[2], its.length));
|
||||
if (sensorEvent.sensor.getType() == Sensor.TYPE_PROXIMITY) {
|
||||
if (FuncUnit.isForeground(ClockApplication.getContext(), MainActivity.class.getName())) {
|
||||
if (its[0] <= 3) {
|
||||
Log.d(TAG,"Hand stay");
|
||||
timber.log.Timber.d("Hand stay");
|
||||
if (ScreenManager.isScreenOn()) {
|
||||
ScreenManager.systemLock(ClockApplication.getInstance().getApplicationContext());
|
||||
} else {
|
||||
ScreenManager.systemUnLock();
|
||||
}
|
||||
} else {
|
||||
Log.d(TAG,"Hand leave...");
|
||||
timber.log.Timber.d("Hand leave...");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -57,7 +66,6 @@ public class ProximityService extends Service {
|
||||
mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
|
||||
Sensor mSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_PROXIMITY);
|
||||
mSensorManager.registerListener(mSensorListener, mSensor, SensorManager.SENSOR_DELAY_FASTEST);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -67,7 +75,12 @@ public class ProximityService extends Service {
|
||||
|
||||
@Override
|
||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||
|
||||
if(isRunning)
|
||||
return super.onStartCommand(intent, flags, startId);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
initChanel();
|
||||
}
|
||||
isRunning=true;
|
||||
return super.onStartCommand(intent, flags, startId);
|
||||
}
|
||||
|
||||
@ -76,4 +89,16 @@ public class ProximityService extends Service {
|
||||
mSensorManager.unregisterListener(mSensorListener);
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.O)
|
||||
private void initChanel(){
|
||||
NotificationChannel channel = new NotificationChannel(CHANNEL_ID,"FallDetect",
|
||||
NotificationManager.IMPORTANCE_HIGH);
|
||||
|
||||
NotificationManager manager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
manager.createNotificationChannel(channel);
|
||||
|
||||
Notification notification = new Notification.Builder(getApplicationContext(),CHANNEL_ID).build();
|
||||
startForeground(3210, notification);
|
||||
}
|
||||
}
|
||||
|
@ -81,13 +81,13 @@ public class ClockStateMachine implements Handler.Callback{
|
||||
|
||||
|
||||
public void start(){
|
||||
//Log.d(TAG,"create timer and timerTask.................................");
|
||||
//timber.log.Timber.d("create timer and timerTask.................................");
|
||||
timer = new Timer();
|
||||
handler = new Handler(this);
|
||||
timerTask = new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
//Log.d(TAG, "timerTask move...");
|
||||
//timber.log.Timber.d("timerTask move...");
|
||||
handler.sendEmptyMessage(UPDATE_TIME);
|
||||
}
|
||||
};
|
||||
@ -255,7 +255,7 @@ public class ClockStateMachine implements Handler.Callback{
|
||||
beforeHour=globalViewModel.getTime_hour().getValue();
|
||||
if(beforeHour!=date.getHour()) {
|
||||
globalViewModel.setTime_hour(date.getHour());
|
||||
Log.d(TAG,"in state machine hour changed:"+beforeHour+"->"+date.getHour());
|
||||
timber.log.Timber.d("in state machine hour changed:"+beforeHour+"->"+date.getHour());
|
||||
if(isHourAnimatorAble()&&date.getMinute()==0) {
|
||||
if (HourAnimatorFactory.isHourAnimator(globalViewModel.getHourAlterTypeName().getValue()))
|
||||
EventManger.post(ClockEvent.buildHourAnimator(true));
|
||||
@ -280,7 +280,7 @@ public class ClockStateMachine implements Handler.Callback{
|
||||
DateModel currentDate=null;
|
||||
private void updateDay(DateModel date){
|
||||
if(currentDate==null||currentDate.getDay()!=date.getDay()) {
|
||||
Log.d(TAG,"updateDay."+date);
|
||||
timber.log.Timber.d("updateDay."+date);
|
||||
currentDate=date;
|
||||
String dayString = date.getToday();
|
||||
String dateString = date.getDateString();
|
||||
@ -319,7 +319,7 @@ public class ClockStateMachine implements Handler.Callback{
|
||||
int today = date.getWeek();
|
||||
|
||||
if (model.getTypeHourPower() != Constants.TALKING_NO_REPORT) {
|
||||
//Log.d(TAG, String.format("reportTime Year:%d Month:%d Day:%d Hour:%d Minute:%d Today:%d", year, month, day, hour, minute, today));
|
||||
//timber.log.Timber.d(String.format("reportTime Year:%d Month:%d Day:%d Hour:%d Minute:%d Today:%d", year, month, day, hour, minute, today));
|
||||
if (!alterManager.isReport(hour, minute))
|
||||
return;
|
||||
if ((minute == 30 || minute == 0) && model.getTypeHourPower() == Constants.TALKING_HALF_AN_HOUR && second == 0) {
|
||||
|
@ -84,7 +84,6 @@ public class TodoSyncServiceManager {
|
||||
authCallback.onCancel();
|
||||
return;
|
||||
}
|
||||
|
||||
I_TodoSyncService syncService=syncServicesMap.get(serviceName);
|
||||
if(!syncService.isSignIn())
|
||||
syncService.signIn(activity,authCallback);
|
||||
@ -123,7 +122,7 @@ public class TodoSyncServiceManager {
|
||||
|
||||
@Override
|
||||
public void onRequestFailed(int error, String errorMessage) {
|
||||
Log.d(TAG, errorMessage);
|
||||
timber.log.Timber.d(errorMessage);
|
||||
}
|
||||
};
|
||||
todoSyncService.list(requestListener);
|
||||
@ -250,7 +249,7 @@ public class TodoSyncServiceManager {
|
||||
private boolean isSameDay(Date base,Date toCheckday){
|
||||
if(toCheckday==null)
|
||||
return false;
|
||||
//Log.d(TAG,"isSameDay from:"+ TypeUtils.dayFormat(base)+"\t to:"+TypeUtils.dayFormat(toCheckday));
|
||||
//timber.log.Timber.d("isSameDay from:"+ TypeUtils.dayFormat(base)+"\t to:"+TypeUtils.dayFormat(toCheckday));
|
||||
return TimeUtils.isSameDay(base,toCheckday);
|
||||
}
|
||||
|
||||
|
@ -66,13 +66,13 @@ public class MicrosoftTodoSyncServiceImpl implements I_TodoSyncService {
|
||||
}
|
||||
|
||||
public void start(Context applicationContext, NetworkManager networkManager){
|
||||
Log.d(TAG,"on start start...");
|
||||
timber.log.Timber.d("on start start...");
|
||||
/* Configure your sample app and save state for this activity */
|
||||
serviceStarting =true;
|
||||
sampleApp = new PublicClientApplication(
|
||||
applicationContext,
|
||||
R.raw.auth_config);
|
||||
Log.d(TAG,"create sampleApp...");
|
||||
timber.log.Timber.d("create sampleApp...");
|
||||
this.networkManager=networkManager;
|
||||
|
||||
/* Attempt to get a user and acquireTokenSilent
|
||||
@ -83,15 +83,15 @@ public class MicrosoftTodoSyncServiceImpl implements I_TodoSyncService {
|
||||
public void onAccountsLoaded(final List<IAccount> accounts) {
|
||||
if (!accounts.isEmpty()) {
|
||||
/* This sample doesn't support multi-account scenarios, use the first account */
|
||||
Log.d(TAG,"on accounts load");
|
||||
timber.log.Timber.d("on accounts load");
|
||||
sampleApp.acquireTokenSilentAsync(SCOPES, accounts.get(0), getAuthTokenCallback());
|
||||
} else {
|
||||
/* No accounts or >1 account */
|
||||
serviceStarting =false;
|
||||
}
|
||||
serviceStarting =false;
|
||||
}
|
||||
});
|
||||
Log.d(TAG,"call getAccounts end");
|
||||
timber.log.Timber.d("call getAccounts end");
|
||||
}
|
||||
|
||||
public void signIn(Activity activity,AuthCallback authCallback){
|
||||
@ -134,7 +134,7 @@ public class MicrosoftTodoSyncServiceImpl implements I_TodoSyncService {
|
||||
}
|
||||
|
||||
public boolean isSignIn(){
|
||||
Log.d(TAG,"call is sing in...serviceStarting:"+ serviceStarting);
|
||||
timber.log.Timber.d("call is sing in...serviceStarting:"+ serviceStarting);
|
||||
return authResult != null&&authResult.getAccessToken() != null;
|
||||
}
|
||||
|
||||
@ -144,7 +144,7 @@ public class MicrosoftTodoSyncServiceImpl implements I_TodoSyncService {
|
||||
protected void callGraphAPI(HttpMethod methodType, String graphUrl, RequestListener listener) {
|
||||
/* Make sure we have a token to send to graph */
|
||||
if (authResult.getAccessToken() == null) {
|
||||
Log.d(TAG, "call graph api please sign in first ..url: " +graphUrl);
|
||||
timber.log.Timber.d("call graph api please sign in first ..url: " +graphUrl);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -153,20 +153,20 @@ public class MicrosoftTodoSyncServiceImpl implements I_TodoSyncService {
|
||||
try {
|
||||
parameters.put("key", "value");
|
||||
} catch (Exception e) {
|
||||
Log.d(TAG, "Failed to put parameters: " + e.toString());
|
||||
timber.log.Timber.d("Failed to put parameters: " + e.toString());
|
||||
}
|
||||
JsonObjectRequest request = new JsonObjectRequest(methodType.value, graphUrl,
|
||||
parameters,new Response.Listener<JSONObject>() {
|
||||
@Override
|
||||
public void onResponse(JSONObject response) {
|
||||
/* Successfully called graph, process data and send to UI */
|
||||
Log.d(TAG, "Response: " + response.toString());
|
||||
timber.log.Timber.d("Response: " + response.toString());
|
||||
listener.onResponse(response);
|
||||
}
|
||||
}, new Response.ErrorListener() {
|
||||
@Override
|
||||
public void onErrorResponse(VolleyError error) {
|
||||
Log.d(TAG, "Error: " + error.toString());
|
||||
timber.log.Timber.d("Error: " + error.toString());
|
||||
listener.onRequestFailed(0,error.toString());
|
||||
}
|
||||
}) {
|
||||
@ -182,8 +182,8 @@ public class MicrosoftTodoSyncServiceImpl implements I_TodoSyncService {
|
||||
}
|
||||
|
||||
protected void callGraphAPI(JsonObjectRequest request) {
|
||||
Log.d(TAG, "Starting volley request to graph");
|
||||
Log.d(TAG, "Adding HTTP GET to Queue, Request: " + request.toString());
|
||||
timber.log.Timber.d("Starting volley request to graph");
|
||||
timber.log.Timber.d("Adding HTTP GET to Queue, Request: " + request.toString());
|
||||
networkManager.sendRequest(3000,request);
|
||||
}
|
||||
|
||||
@ -198,7 +198,7 @@ public class MicrosoftTodoSyncServiceImpl implements I_TodoSyncService {
|
||||
@Override
|
||||
public void onSuccess(IAuthenticationResult authenticationResult) {
|
||||
/* Successfully got a token, call graph now */
|
||||
Log.d(TAG, "Successfully authenticated");
|
||||
timber.log.Timber.d("Successfully authenticated");
|
||||
/* Store the authResult */
|
||||
authResult = authenticationResult;
|
||||
serviceStarting =false;
|
||||
@ -207,7 +207,7 @@ public class MicrosoftTodoSyncServiceImpl implements I_TodoSyncService {
|
||||
@Override
|
||||
public void onError(MsalException exception) {
|
||||
/* Failed to acquireToken */
|
||||
Log.d(TAG, "Authentication failed: " + exception.toString());
|
||||
timber.log.Timber.d("Authentication failed: " + exception.toString());
|
||||
|
||||
if (exception instanceof MsalClientException) {
|
||||
/* Exception inside MSAL, more info inside MsalError.java */
|
||||
@ -222,7 +222,7 @@ public class MicrosoftTodoSyncServiceImpl implements I_TodoSyncService {
|
||||
@Override
|
||||
public void onCancel() {
|
||||
/* User cancelled the authentication */
|
||||
Log.d(TAG, "User cancelled login.");
|
||||
timber.log.Timber.d("User cancelled login.");
|
||||
serviceStarting =false;
|
||||
}
|
||||
};
|
||||
@ -238,7 +238,7 @@ public class MicrosoftTodoSyncServiceImpl implements I_TodoSyncService {
|
||||
@Override
|
||||
public void onSuccess(IAuthenticationResult authenticationResult) {
|
||||
/* Successfully got a token, call graph now */
|
||||
Log.d(TAG, "Successfully authenticated");
|
||||
timber.log.Timber.d("Successfully authenticated");
|
||||
|
||||
/* Store the authResult */
|
||||
authResult = authenticationResult;
|
||||
@ -249,7 +249,7 @@ public class MicrosoftTodoSyncServiceImpl implements I_TodoSyncService {
|
||||
@Override
|
||||
public void onError(MsalException exception) {
|
||||
/* Failed to acquireToken */
|
||||
Log.d(TAG, "Authentication failed: " + exception.toString());
|
||||
timber.log.Timber.d("Authentication failed: " + exception.toString());
|
||||
|
||||
if (exception instanceof MsalClientException) {
|
||||
/* Exception inside MSAL, more info inside MsalError.java */
|
||||
@ -265,7 +265,7 @@ public class MicrosoftTodoSyncServiceImpl implements I_TodoSyncService {
|
||||
@Override
|
||||
public void onCancel() {
|
||||
/* User cancelled the authentication */
|
||||
Log.d(TAG, "User cancelled login.");
|
||||
timber.log.Timber.d("User cancelled login.");
|
||||
authCallback.onCancel();
|
||||
}
|
||||
};
|
||||
|
@ -74,7 +74,7 @@ public class TypeUtils {
|
||||
modifiedStrVal = strVal;
|
||||
}
|
||||
|
||||
//Log.d(TAG,"string to deserialize date:"+modifiedStrVal);
|
||||
//timber.log.Timber.d("string to deserialize date:"+modifiedStrVal);
|
||||
|
||||
// Parse the well-formatted date string.
|
||||
final String datePattern;
|
||||
|
@ -5,7 +5,6 @@ import android.content.res.AssetFileDescriptor;
|
||||
import android.media.AudioManager;
|
||||
import android.media.MediaPlayer;
|
||||
import android.net.Uri;
|
||||
import android.util.Log;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
@ -14,6 +13,7 @@ import java.util.Map;
|
||||
|
||||
import clock.socoolby.com.clock.ClockApplication;
|
||||
import clock.socoolby.com.clock.R;
|
||||
import clock.socoolby.com.clock.screen.ScreenManager;
|
||||
|
||||
public class Player {
|
||||
private final static String TAG = Player.class.getSimpleName();
|
||||
@ -105,10 +105,10 @@ public class Player {
|
||||
}
|
||||
|
||||
public void reportTime(Context activity, int year, int month, int day, int hour, int minute, int today) {
|
||||
Log.d(TAG,"go in report time playAble:"+playAble+"\tisReportime:"+isReporttime);
|
||||
timber.log.Timber.d("go in report time playAble:"+playAble+"\tisReportime:"+isReporttime);
|
||||
if (!playAble||isReporttime)
|
||||
return;
|
||||
Log.d(TAG, String.format("reportTime Year:%d Month:%d Day:%d Hour:%d Minute:%d Today:%d", year, month, day, hour, minute, today));
|
||||
timber.log.Timber.d(String.format("reportTime Year:%d Month:%d Day:%d Hour:%d Minute:%d Today:%d", year, month, day, hour, minute, today));
|
||||
LinkedList<Integer> playList = new LinkedList<Integer>();
|
||||
playList.add(R.raw.todayis);
|
||||
|
||||
@ -169,7 +169,7 @@ public class Player {
|
||||
}
|
||||
|
||||
public void playTick(Context activity,int tick_type_id) {
|
||||
Log.d(TAG,"go in Play tick playable:"+playAble+"\tisReportime:"+isReporttime);
|
||||
timber.log.Timber.d("go in Play tick playable:"+playAble+"\tisReportime:"+isReporttime);
|
||||
if (!playAble||isReporttime)
|
||||
return;
|
||||
if (!ScreenManager.isScreenOn() || ScreenManager.isApplicationBroughtToBackground(ClockApplication.getContext()))
|
||||
@ -181,7 +181,7 @@ public class Player {
|
||||
private Map<Integer,AssetFileDescriptor> soundFileCache=new HashMap<>();
|
||||
|
||||
public void playHandUp(Context activity){
|
||||
Log.d(TAG,"go in Play hand up playable:"+playAble+"\tisReportime:"+isReporttime);
|
||||
timber.log.Timber.d("go in Play hand up playable:"+playAble+"\tisReportime:"+isReporttime);
|
||||
if (!playAble||isReporttime)
|
||||
return;
|
||||
if (!ScreenManager.isScreenOn() || ScreenManager.isApplicationBroughtToBackground(ClockApplication.getContext()))
|
||||
@ -275,7 +275,7 @@ public class Player {
|
||||
}
|
||||
|
||||
public void setPlayAble(boolean playAble) {
|
||||
Log.d(TAG,"set Play able:"+playAble);
|
||||
timber.log.Timber.d("set Play able:"+playAble);
|
||||
this.playAble = playAble;
|
||||
if(!playAble&&mediaPlayer!=null){
|
||||
resert();
|
||||
|
@ -2,13 +2,18 @@ package clock.socoolby.com.clock.viewmodel;
|
||||
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
import androidx.lifecycle.ViewModel;
|
||||
|
||||
import android.graphics.Color;
|
||||
import android.net.Uri;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import clock.socoolby.com.clock.ThemeUIManager;
|
||||
import clock.socoolby.com.clock.model.SharePerferenceModel;
|
||||
import clock.socoolby.com.clock.state.ClockModeEnum;
|
||||
import clock.socoolby.com.clock.state.ClockInterfaceTypeEnum;
|
||||
import clock.socoolby.com.clock.state.ClockStateMachine;
|
||||
import clock.socoolby.com.clock.todo.TodoSyncServiceManager;
|
||||
|
||||
public class GlobalViewModel extends ViewModel {
|
||||
|
||||
@ -33,6 +38,8 @@ public class GlobalViewModel extends ViewModel {
|
||||
|
||||
private MutableLiveData<Boolean> autoFullScreen=new MutableLiveData<>();
|
||||
|
||||
private MutableLiveData<Boolean> useSystemWallpaper=new MutableLiveData<>();
|
||||
|
||||
//system
|
||||
private Boolean tickSound=false;
|
||||
|
||||
@ -42,7 +49,7 @@ public class GlobalViewModel extends ViewModel {
|
||||
|
||||
private MutableLiveData<Integer> brightness=new MutableLiveData<>();
|
||||
|
||||
//public MutableLiveData<Boolean> heartbeat=new MutableLiveData();
|
||||
public MutableLiveData<Boolean> triggerScreen=new MutableLiveData();
|
||||
|
||||
public MutableLiveData<Boolean> todoSyncAble=new MutableLiveData();
|
||||
|
||||
@ -72,6 +79,12 @@ public class GlobalViewModel extends ViewModel {
|
||||
|
||||
SharePerferenceModel model;
|
||||
|
||||
ThemeUIManager themeUIManager;
|
||||
|
||||
ClockStateMachine clockStateMachine;
|
||||
|
||||
TodoSyncServiceManager todoSyncServiceManager;
|
||||
|
||||
public GlobalViewModel(SharePerferenceModel model) {
|
||||
this.model = model;
|
||||
init();
|
||||
@ -81,10 +94,8 @@ public class GlobalViewModel extends ViewModel {
|
||||
private void init(){
|
||||
srceenLock.setValue(false);
|
||||
brightness.setValue(100);
|
||||
//heartbeat.setValue(true);
|
||||
appConfig.setValue(false);
|
||||
clockModeEnum.setValue(ClockModeEnum.NORMAL);
|
||||
//timeHourAnimatorStarting.setValue(false);
|
||||
}
|
||||
|
||||
public void loadFromModel(){
|
||||
@ -113,6 +124,9 @@ public class GlobalViewModel extends ViewModel {
|
||||
time_hour.setValue(new Date().getHours());
|
||||
timeHourAnimatordialy.setValue(model.getTimeHourAlterDialy());
|
||||
|
||||
useSystemWallpaper.setValue(model.isUseSystemWallpaper());
|
||||
|
||||
triggerScreen.setValue(model.isTriggerScreen());
|
||||
}
|
||||
|
||||
public MutableLiveData<String> getCity() {
|
||||
@ -155,6 +169,15 @@ public class GlobalViewModel extends ViewModel {
|
||||
return clockInterfaceTypeEnum;
|
||||
}
|
||||
|
||||
public MutableLiveData<Boolean> getTriggerScreen() {
|
||||
return triggerScreen;
|
||||
}
|
||||
|
||||
public void setTriggerScreen(Boolean triggerScreen) {
|
||||
this.triggerScreen.setValue(triggerScreen);
|
||||
model.setTriggerScreen(triggerScreen);
|
||||
}
|
||||
|
||||
public MutableLiveData<ClockModeEnum> getClockModeEnum() {
|
||||
return clockModeEnum;
|
||||
}
|
||||
@ -192,6 +215,25 @@ public class GlobalViewModel extends ViewModel {
|
||||
return handUpAble;
|
||||
}
|
||||
|
||||
public MutableLiveData<Boolean> getUseSystemWallpaper() {
|
||||
return useSystemWallpaper;
|
||||
}
|
||||
|
||||
public void setUseSystemWallpaper(Boolean useSystemWallpaper) {
|
||||
this.useSystemWallpaper.setValue(useSystemWallpaper);
|
||||
model.setUseSystemWallpaper(useSystemWallpaper);
|
||||
}
|
||||
|
||||
public void checkSystemWallpaperSet(){
|
||||
if(useSystemWallpaper.getValue()) {
|
||||
backgroundColor.setValue(Color.TRANSPARENT);
|
||||
backgroundImageVisable.setValue(false);
|
||||
}else{
|
||||
backgroundColor.setValue(model.getBackgroundColor());
|
||||
backgroundImageVisable.setValue(model.isBackgroundImageVisable());
|
||||
}
|
||||
}
|
||||
|
||||
public void setHandUpTime(Integer handUpTime) {
|
||||
this.handUpTime.setValue(handUpTime);
|
||||
//model.setHandUpTime(handUpTime);
|
||||
@ -304,13 +346,6 @@ public class GlobalViewModel extends ViewModel {
|
||||
model.setHandUpTypeName(handUpTypeName);
|
||||
}
|
||||
|
||||
/*public MutableLiveData<Boolean> getHeartbeat() {
|
||||
return heartbeat;
|
||||
}
|
||||
|
||||
public void setHeartbeat(Boolean heartbeat) {
|
||||
this.heartbeat.setValue(heartbeat);
|
||||
}*/
|
||||
|
||||
public MutableLiveData<String> getHourAlterTypeName() {
|
||||
return hourAlterTypeName;
|
||||
@ -370,4 +405,29 @@ public class GlobalViewModel extends ViewModel {
|
||||
public MutableLiveData<Boolean> getTodoSyncAble(){
|
||||
return todoSyncAble;
|
||||
}
|
||||
|
||||
|
||||
public ThemeUIManager getThemeUIManager() {
|
||||
return themeUIManager;
|
||||
}
|
||||
|
||||
public void setThemeUIManager(ThemeUIManager themeUIManager) {
|
||||
this.themeUIManager = themeUIManager;
|
||||
}
|
||||
|
||||
public ClockStateMachine getClockStateMachine() {
|
||||
return clockStateMachine;
|
||||
}
|
||||
|
||||
public void setClockStateMachine(ClockStateMachine clockStateMachine) {
|
||||
this.clockStateMachine = clockStateMachine;
|
||||
}
|
||||
|
||||
public TodoSyncServiceManager getTodoSyncServiceManager() {
|
||||
return todoSyncServiceManager;
|
||||
}
|
||||
|
||||
public void setTodoSyncServiceManager(TodoSyncServiceManager todoSyncServiceManager) {
|
||||
this.todoSyncServiceManager = todoSyncServiceManager;
|
||||
}
|
||||
}
|
||||
|
@ -154,7 +154,7 @@ public class FireworkAnimator extends AbstractCacheDifferenceAnimator<FireworkAn
|
||||
Element temp=null;
|
||||
color=Util.roundColor();
|
||||
// 给每个火花设定一个随机的方向 0-360
|
||||
//Log.d(TAG, "Firework start mode = " + mode + " count = " + count);
|
||||
//timber.log.Timber.d("Firework start mode = " + mode + " count = " + count);
|
||||
switch (mode) {
|
||||
case MAX:
|
||||
for (int i = 0; i < count; i++) {
|
||||
|
@ -178,11 +178,11 @@ public class SnakeAnimator extends AbstractAnimator<SnakeAnimator.Snake> {
|
||||
case GameType.TOP:
|
||||
case GameType.BOTTOM:
|
||||
if(distanceY==0&&Math.abs(distanceX)<4) {
|
||||
Log.d(TAG,"close to food for Y,dist :"+distanceX);
|
||||
timber.log.Timber.d("close to food for Y,dist :"+distanceX);
|
||||
return;
|
||||
}
|
||||
if(distanceX==0&&Math.abs(distanceY)==1){
|
||||
Log.d(TAG,"food is "+(distanceY>0?"left":"right"));
|
||||
timber.log.Timber.d("food is "+(distanceY>0?"left":"right"));
|
||||
setSnakeDirection(distanceY>0?GameType.LEFT:GameType.RIGHT);
|
||||
return;
|
||||
}
|
||||
@ -190,11 +190,11 @@ public class SnakeAnimator extends AbstractAnimator<SnakeAnimator.Snake> {
|
||||
case GameType.LEFT:
|
||||
case GameType.RIGHT:
|
||||
if(distanceX==0&&Math.abs(distanceY)<4) {
|
||||
Log.d(TAG,"close to food for X,dist :"+distanceY);
|
||||
timber.log.Timber.d("close to food for X,dist :"+distanceY);
|
||||
return;
|
||||
}
|
||||
if(distanceY==0&&Math.abs(distanceX)==1){
|
||||
Log.d(TAG,"food is "+(distanceX>0?"up":"down"));
|
||||
timber.log.Timber.d("food is "+(distanceX>0?"up":"down"));
|
||||
setSnakeDirection(distanceX>0?GameType.TOP:GameType.BOTTOM);
|
||||
return;
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ public class Wave3DAnimator extends AbstractAnimator<Wave3DAnimator.Wave> {
|
||||
datas.add(pointCicle);
|
||||
}
|
||||
}
|
||||
Log.d(Tag,"initWave datas count:"+datas.size());
|
||||
timber.log.Timber.d("initWave datas count:"+datas.size());
|
||||
}
|
||||
|
||||
|
||||
|
@ -179,7 +179,7 @@ public class EZLedAnimator extends AbstractAnimator<EZLedAnimator.EZLed> {
|
||||
* @param text content
|
||||
*/
|
||||
public void setText(CharSequence text) {
|
||||
Log.d(Tag,"setText:"+text);
|
||||
timber.log.Timber.d("setText:"+text);
|
||||
this.contentType = CONTENT_TYPE_TEXT;
|
||||
this.ledText = text;
|
||||
measureTextBound(text.toString());
|
||||
@ -232,7 +232,7 @@ public class EZLedAnimator extends AbstractAnimator<EZLedAnimator.EZLed> {
|
||||
startX=maxWidth;
|
||||
Float len=maxWidth*stepPercent;
|
||||
startX=startX-len.intValue();
|
||||
Log.d(Tag,"move right to left startX:"+startX);
|
||||
timber.log.Timber.d("move right to left startX:"+startX);
|
||||
if(startX<-mDrawableWidth)
|
||||
startX=maxWidth;
|
||||
}
|
||||
@ -248,7 +248,7 @@ public class EZLedAnimator extends AbstractAnimator<EZLedAnimator.EZLed> {
|
||||
}
|
||||
mustRefush=false;
|
||||
}
|
||||
Log.d(Tag,"onDraw bitmap is :"+bitmap);
|
||||
timber.log.Timber.d("onDraw bitmap is :"+bitmap);
|
||||
float y=height* hightPercent -mDrawableHeight/2;
|
||||
if (bitmap != null) {
|
||||
if(bitmap.getWidth() > TEXTURE_MAX){
|
||||
@ -283,7 +283,7 @@ public class EZLedAnimator extends AbstractAnimator<EZLedAnimator.EZLed> {
|
||||
*/
|
||||
|
||||
private Bitmap renderText(CharSequence text, Paint paint) {
|
||||
Log.d(Tag,"renderText:"+text);
|
||||
timber.log.Timber.d("renderText:"+text);
|
||||
Bitmap cacheMap = Bitmap.createBitmap(mDrawableWidth, mDrawableHeight, Bitmap.Config.ARGB_8888);
|
||||
Canvas canvas = new Canvas(cacheMap);
|
||||
int yPos = (int) ((canvas.getHeight() / 2) - ((paint.descent() + paint.ascent()) / 2));
|
||||
@ -296,7 +296,7 @@ public class EZLedAnimator extends AbstractAnimator<EZLedAnimator.EZLed> {
|
||||
}
|
||||
|
||||
private Bitmap generateDrawable(Bitmap bitmap) {
|
||||
Log.d(Tag,"generateDrawable:"+bitmap);
|
||||
timber.log.Timber.d("generateDrawable:"+bitmap);
|
||||
if (bitmap != null) {
|
||||
release();
|
||||
measureBitmap(bitmap);
|
||||
@ -311,7 +311,7 @@ public class EZLedAnimator extends AbstractAnimator<EZLedAnimator.EZLed> {
|
||||
* @return led bitmap
|
||||
*/
|
||||
private Bitmap generateLedBitmap(Bitmap src) {
|
||||
Log.d(Tag,"generateLedBitmap:"+src);
|
||||
timber.log.Timber.d("generateLedBitmap:"+src);
|
||||
Bitmap bitmap = Bitmap.createBitmap(src.getWidth(), src.getHeight(), Bitmap.Config.ARGB_8888);
|
||||
Canvas canvas = new Canvas(bitmap);
|
||||
for (Point point : circlePoint) {
|
||||
@ -351,7 +351,7 @@ public class EZLedAnimator extends AbstractAnimator<EZLedAnimator.EZLed> {
|
||||
* Calculate the led point position
|
||||
*/
|
||||
private void measurePoint(int width, int height) {
|
||||
Log.d(Tag,"measurePoint width:"+width+"height:"+height);
|
||||
timber.log.Timber.d("measurePoint width:"+width+"height:"+height);
|
||||
int halfBound = ledRadius + ledSpace / 2;
|
||||
int x = halfBound;
|
||||
int y = halfBound;
|
||||
|
@ -117,7 +117,7 @@ public class PathEffectTextAnimator extends AbstractAnimator<PathEffectTextAnima
|
||||
public void onDraw(Canvas canvas, Paint mPaint) {
|
||||
if (mPaths == null)
|
||||
return;
|
||||
//Log.d(TAG,"paths size:"+mPaths.size()+"\tdatas size:"+mDatas.size());
|
||||
//timber.log.Timber.d("paths size:"+mPaths.size()+"\tdatas size:"+mDatas.size());
|
||||
//synchronized (mSvgLock) {
|
||||
for (int i = 0; i < mPaths.size(); i++)
|
||||
canvas.drawPath(mPaths.get(i), mPathPaint);
|
||||
|
@ -52,7 +52,7 @@ public class DragFrameLayout extends FrameLayout {
|
||||
@Override
|
||||
public void onViewPositionChanged(View changedView, int left, int top, int dx, int dy) {
|
||||
super.onViewPositionChanged(changedView, left, top, dx, dy);
|
||||
Log.d(TAG,"onViewPositionChanged left:"+left+"\ttop:"+top+"\tdx:"+dx+"\tdy:"+dy);
|
||||
timber.log.Timber.d("onViewPositionChanged left:"+left+"\ttop:"+top+"\tdx:"+dx+"\tdy:"+dy);
|
||||
this.left=left;
|
||||
this.top=top;
|
||||
if (onDragDropListener != null) {
|
||||
@ -79,7 +79,7 @@ public class DragFrameLayout extends FrameLayout {
|
||||
@Override
|
||||
public void onViewReleased(View releasedChild, float xvel, float yvel) {
|
||||
super.onViewReleased(releasedChild, xvel, yvel);
|
||||
Log.d(TAG," onViewReleased xvel:"+xvel+"yvel:"+yvel);
|
||||
timber.log.Timber.d(" onViewReleased xvel:"+xvel+"yvel:"+yvel);
|
||||
if (onDragDropListener != null) {
|
||||
onDragDropListener.onDragEnd(releasedChild,left,top);
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ public abstract class AbstractLibgdxSpineEffectView implements ApplicationListe
|
||||
public void forceOver() {
|
||||
|
||||
if (openDEBUGLog)
|
||||
Log.d(TAG, "forceOver");
|
||||
timber.log.Timber.d("forceOver");
|
||||
|
||||
forceOver = true;
|
||||
|
||||
@ -77,7 +77,7 @@ public abstract class AbstractLibgdxSpineEffectView implements ApplicationListe
|
||||
public void closeforceOver() {
|
||||
|
||||
if (openDEBUGLog)
|
||||
Log.d(TAG, "closeforceOver");
|
||||
timber.log.Timber.d("closeforceOver");
|
||||
|
||||
forceOver = false;
|
||||
|
||||
@ -130,7 +130,7 @@ public abstract class AbstractLibgdxSpineEffectView implements ApplicationListe
|
||||
public void create() {
|
||||
|
||||
if (openDEBUGLog)
|
||||
Log.d(TAG, "create");
|
||||
timber.log.Timber.d("create");
|
||||
|
||||
mBatch = new SpriteBatch();
|
||||
|
||||
@ -189,7 +189,7 @@ public abstract class AbstractLibgdxSpineEffectView implements ApplicationListe
|
||||
public void setCanDraw(boolean candraw) {
|
||||
|
||||
if (openDEBUGLog)
|
||||
Log.d(TAG, "setCanDraw:"+candraw);
|
||||
timber.log.Timber.d("setCanDraw:"+candraw);
|
||||
|
||||
m_candraw = candraw;
|
||||
|
||||
@ -254,7 +254,7 @@ public abstract class AbstractLibgdxSpineEffectView implements ApplicationListe
|
||||
public void dispose() {
|
||||
|
||||
if (openDEBUGLog)
|
||||
Log.d(TAG, "dispose");
|
||||
timber.log.Timber.d("dispose");
|
||||
|
||||
mBatch.dispose();
|
||||
|
||||
|
@ -327,11 +327,11 @@ public class DigitTextView extends androidx.appcompat.widget.AppCompatTextView {
|
||||
startX += padding;
|
||||
}
|
||||
startX += subscriptCharWidth;
|
||||
//Log.d(Tag,"view hight:"+getHeight()+"\t startY:"+startY+"\t text hight:"+textBodyHight+"small text hight:"+subscriptTextHight);
|
||||
//timber.log.Timber.d("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));
|
||||
//timber.log.Timber.d("total draw time:"+(System.currentTimeMillis()-before));
|
||||
}
|
||||
|
||||
private void drawBackground(Canvas canvas, float startX, float startY, int width, int height, Paint mBackgroundPaint) {
|
||||
@ -353,7 +353,7 @@ public class DigitTextView extends androidx.appcompat.widget.AppCompatTextView {
|
||||
|
||||
private void drawCharWithAnaimatorCheck(Canvas canvas, int i, String charStr, float startX, float startY, Paint mTextPaint) {
|
||||
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);
|
||||
//timber.log.Timber.d("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)
|
||||
if(charBackgroundBorderWithDoubble) {
|
||||
if (i == 0 || i == 3 || i == 6)
|
||||
@ -372,7 +372,7 @@ public class DigitTextView extends androidx.appcompat.widget.AppCompatTextView {
|
||||
}
|
||||
if (charAnimator != null) {
|
||||
charAnimator.drawCharAnimator(canvas, startX, startY , mTextPaint);
|
||||
//Log.d(Tag,"charAnimator index i:"+i+"\tanimator percent:");
|
||||
//timber.log.Timber.d("charAnimator index i:"+i+"\tanimator percent:");
|
||||
if (charBackgroundBorder)
|
||||
if(charBackgroundBorderWithDoubble) {
|
||||
if (i == 1 || i == 4 || i == 7)
|
||||
|
@ -351,14 +351,14 @@ public class AndroidFragmentApplication extends Fragment implements AndroidAppli
|
||||
@Override
|
||||
public void debug(String tag, String message) {
|
||||
if (logLevel >= LOG_DEBUG) {
|
||||
Log.d(tag, message);
|
||||
timber.log.Timber.d(message);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void debug(String tag, String message, Throwable exception) {
|
||||
if (logLevel >= LOG_DEBUG) {
|
||||
Log.d(tag, message, exception);
|
||||
timber.log.Timber.d(message, exception);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,7 @@ public class AndroidInputThreePlus extends AndroidInput implements OnGenericMoti
|
||||
|
||||
@Override
|
||||
public boolean onGenericMotion (View view, MotionEvent event) {
|
||||
Log.d(TAG,"onGenericMotion"+view.toString());
|
||||
timber.log.Timber.d("onGenericMotion"+view.toString());
|
||||
if (mouseHandler.onGenericMotion(event, this)) return true;
|
||||
for (int i = 0, n = genericMotionListeners.size(); i < n; i++)
|
||||
if (genericMotionListeners.get(i).onGenericMotion(view, event)) return true;
|
||||
@ -67,7 +67,7 @@ public class AndroidInputThreePlus extends AndroidInput implements OnGenericMoti
|
||||
@Override
|
||||
public boolean onTouch (View view, MotionEvent event) {
|
||||
super.onTouch(view,event);
|
||||
//Log.d(TAG,"onTouch interrupt:"+interruptTouch+"\t event:"+event.toString());
|
||||
//timber.log.Timber.d("onTouch interrupt:"+interruptTouch+"\t event:"+event.toString());
|
||||
return interruptTouch;
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,6 @@
|
||||
android:id="@+id/main_background"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#000"
|
||||
tools:context="clock.socoolby.com.clock.MainActivity">
|
||||
|
||||
<ImageView
|
||||
|
@ -107,11 +107,26 @@
|
||||
android:text="@string/trigger_screen_on_off" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_weather_title"
|
||||
android:id="@+id/tv_trigger_system_wallpaper_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/system_wallpaper" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cb_trigger_system_wallpaper"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/tv_trigger_system_wallpaper_title"
|
||||
android:text="@string/system_wallpaper_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_system_wallpaper"
|
||||
android:layout_marginTop="@dimen/setting_margin_top"
|
||||
android:text="@string/weather_citiyname" />
|
||||
|
||||
<EditText
|
||||
|
@ -222,11 +222,26 @@
|
||||
android:text="@string/fullscreen_spirit_on_off" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_trigger_title"
|
||||
android:id="@+id/tv_trigger_system_wallpaper_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/cb_fullscreen_spirit"
|
||||
android:layout_marginTop="@dimen/setting_margin_top"
|
||||
android:text="@string/system_wallpaper" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cb_trigger_system_wallpaper"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/tv_trigger_system_wallpaper_title"
|
||||
android:text="@string/system_wallpaper_on_off" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_trigger_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/cb_trigger_system_wallpaper"
|
||||
android:layout_marginTop="@dimen/setting_margin_top"
|
||||
android:text="@string/screen_trigger" />
|
||||
|
||||
<CheckBox
|
||||
|
@ -36,4 +36,8 @@
|
||||
<string name="fullscreen_spirit_on_off">开启小宠物</string>
|
||||
<string name="todo_alter_title">Todo同步</string>
|
||||
<string name="todo_alter_able">开启微软Todo同步</string>
|
||||
<string name="accessibility_desc">本服务用于锁定屏幕,只有开启才有效</string>
|
||||
<string name="system_wallpaper">壁纸设置</string>
|
||||
<string name="system_wallpaper_on_off">使用系统壁纸</string>
|
||||
<string name="logut_system_wallpaper_mode">正在使用系统壁纸,是否要关闭来进行下一步?</string>
|
||||
</resources>
|
@ -6,6 +6,7 @@
|
||||
<color name="select_main_bg_color">#4E4988</color>
|
||||
<color name="duration">#666</color>
|
||||
<color name="time">#303F9F</color>
|
||||
<color name="translate">#00FFFFFF</color>
|
||||
|
||||
<!--CircleSeekbar -->
|
||||
<color name="def_wheel_color">#4E4988</color>
|
||||
@ -14,4 +15,5 @@
|
||||
|
||||
<!--drop pop menu -->
|
||||
<color name="drop_pop_menu_bg_color">#a0000000</color>
|
||||
|
||||
</resources>
|
||||
|
@ -32,14 +32,17 @@
|
||||
<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>
|
||||
<string name="exit">exit</string>
|
||||
<string name="handup_title">HandpU</string>
|
||||
<string name="handup_title">Hand Up</string>
|
||||
<string name="handup_overtime_counting">OverTime Counting</string>
|
||||
<string name="tv_handup_deily">deily(second):</string>
|
||||
<string name="fullscreen_title">fullscreen</string>
|
||||
<string name="fullscreen_spirit_on_off">spirit able</string>
|
||||
<string name="todo_alter_title">Todo同步</string>
|
||||
<string name="todo_alter_able">开启微软Todo同步</string>
|
||||
<string name="accessibility_desc">本服务用于锁定屏幕,只有开启才有效</string>
|
||||
<string name="system_wallpaper">Wallpaper</string>
|
||||
<string name="system_wallpaper_on_off">Use System Wallpaper</string>
|
||||
<string name="logut_system_wallpaper_mode">Current in System Wallpaper Mode,do you logout?</string>
|
||||
|
||||
</resources>
|
||||
|
@ -1,13 +1,5 @@
|
||||
<resources>
|
||||
|
||||
<!-- Base application theme. -->
|
||||
<!--<styleCode name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">-->
|
||||
<!--<!– Customize your theme here. –>-->
|
||||
<!--<item name="colorPrimary">@color/colorPrimary</item>-->
|
||||
<!--<item name="colorPrimaryDark">@color/colorPrimaryDark</item>-->
|
||||
<!--<item name="colorAccent">@color/colorAccent</item>-->
|
||||
<!--</styleCode>-->
|
||||
|
||||
<declare-styleable name="Cricle_slide">
|
||||
//设置最大进度
|
||||
<attr name="max_progress" format="integer"></attr>
|
||||
@ -32,4 +24,8 @@
|
||||
<item name="android:windowContentOverlay">@null</item>//是否有遮盖
|
||||
</style>
|
||||
|
||||
<style name="Activity.Translucent" parent="Theme.AppCompat.Light.NoActionBar.FullScreen">
|
||||
<item name="android:windowBackground">@color/translate</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
|
7
app/src/main/res/xml/accessibility_service_config.xml
Normal file
7
app/src/main/res/xml/accessibility_service_config.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<accessibility-service
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:accessibilityEventTypes="typeNotificationStateChanged"
|
||||
android:packageNames="clock.socoolby.com.clock"
|
||||
android:accessibilityFeedbackType="feedbackGeneric"
|
||||
android:notificationTimeout="100"
|
||||
android:canRetrieveWindowContent="false" />
|
Loading…
x
Reference in New Issue
Block a user