Commit 43179bdd891896f679ef37ac342e2c0531196e53
1 parent
baaf8a93
fix search ,light and server status,scan ,admin player movie
Showing
10 changed files
with
181 additions
and
75 deletions
| ... | ... | @@ -9,6 +9,7 @@ import android.util.Log; |
| 9 | 9 | import com.gimi.common.cinema.model.LocalMovieMessage; |
| 10 | 10 | import com.gimi.common.cinema.model.QueryType; |
| 11 | 11 | import com.gimi.common.cinema.model.SourceType; |
| 12 | +import com.gimi.common.cinema.utils.LogUtils; | |
| 12 | 13 | import com.xgimi.gimicinema.activity.CinemaConfig; |
| 13 | 14 | |
| 14 | 15 | import java.io.File; |
| ... | ... | @@ -170,6 +171,32 @@ public class NewDBManager { |
| 170 | 171 | return result; |
| 171 | 172 | } |
| 172 | 173 | |
| 174 | + /** | |
| 175 | + * 利用事务批量添加本地数据,存在的数据不再更新,不存在的直接插入 | |
| 176 | + * | |
| 177 | + * @param localMovieMessageList lst | |
| 178 | + * @return boolean | |
| 179 | + */ | |
| 180 | + public boolean addByTransaction(List<LocalMovieMessage> localMovieMessageList) { | |
| 181 | + boolean result = false; | |
| 182 | + LogUtils.i("scan-time Transaction", System.currentTimeMillis() + ""); | |
| 183 | + db.beginTransaction(); //开始事务 | |
| 184 | + try { | |
| 185 | + for (int i = 0; i < localMovieMessageList.size(); i++) { | |
| 186 | + ContentValues values = constructCv(localMovieMessageList.get(i)); | |
| 187 | + db.insertWithOnConflict(NewDBHelper.TABLE_NAME, null, values, SQLiteDatabase.CONFLICT_REPLACE); | |
| 188 | + } | |
| 189 | + db.setTransactionSuccessful(); | |
| 190 | + result = true; | |
| 191 | + } catch (Exception e) { | |
| 192 | + e.printStackTrace(); | |
| 193 | + } finally { | |
| 194 | + db.endTransaction(); //结束事务 | |
| 195 | + } | |
| 196 | + LogUtils.i("scan-time Transaction", System.currentTimeMillis() + ":" + result); | |
| 197 | + return result; | |
| 198 | + } | |
| 199 | + | |
| 173 | 200 | public void deleteFileNotExists() { |
| 174 | 201 | List<LocalMovieMessage> result = query(); |
| 175 | 202 | for (LocalMovieMessage lmm : result) |
| ... | ... | @@ -604,7 +631,7 @@ public class NewDBManager { |
| 604 | 631 | } |
| 605 | 632 | keyBuffer.append("'");*/ |
| 606 | 633 | // Cursor c = db.rawQuery("SELECT * FROM movie_message where pinyin LIKE '%" + key + "%' order by length(pinyin) asc limit 0,20", null); |
| 607 | - String sql = "SELECT * FROM movie_message where pinyin LIKE " + "'%" + key + "%'" + " order by length(name) asc limit 20"; | |
| 634 | + String sql = "SELECT * FROM movie_message where pinyin LIKE " + "'%" + key + "%'" + " order by length(name) asc limit 99"; | |
| 608 | 635 | Cursor c = db.rawQuery(sql, null); |
| 609 | 636 | readCursor2List(persons, c); |
| 610 | 637 | c.close(); | ... | ... |
| ... | ... | @@ -66,7 +66,7 @@ public class DbUpdateUtils { |
| 66 | 66 | //区分结束还是卡死 |
| 67 | 67 | callback.onMessage("已扫描:" + allLocalMovies.size()); |
| 68 | 68 | if (allLocalMovies.size() != 0) { |
| 69 | - dbManager.add(allLocalMovies); | |
| 69 | + dbManager.addByTransaction(allLocalMovies); | |
| 70 | 70 | callback.onSuccess(allLocalMovies.size()); |
| 71 | 71 | } else { |
| 72 | 72 | caught.setCode(0); | ... | ... |
| ... | ... | @@ -6,10 +6,12 @@ import android.content.ComponentName; |
| 6 | 6 | import android.content.Context; |
| 7 | 7 | import android.content.Intent; |
| 8 | 8 | import android.content.IntentFilter; |
| 9 | +import android.content.ServiceConnection; | |
| 9 | 10 | import android.content.SharedPreferences; |
| 10 | 11 | import android.content.pm.PackageManager; |
| 11 | 12 | import android.os.Handler; |
| 12 | 13 | import android.os.IBinder; |
| 14 | +import android.os.RemoteException; | |
| 13 | 15 | import android.text.TextUtils; |
| 14 | 16 | import android.util.Log; |
| 15 | 17 | import android.widget.Toast; |
| ... | ... | @@ -52,6 +54,7 @@ import com.telink.bluetooth.light.Parameters; |
| 52 | 54 | import com.telink.bluetooth.light.model.Mesh; |
| 53 | 55 | import com.telink.util.Event; |
| 54 | 56 | import com.telink.util.EventListener; |
| 57 | +import com.xgimi.gimicinema.ICinemaControl; | |
| 55 | 58 | import com.xgimi.gimicinema.R; |
| 56 | 59 | import com.xgimi.gimicinema.activity.AdsPreVideoPlayerActivity; |
| 57 | 60 | import com.xgimi.gimicinema.activity.QrCodeShowActivity; |
| ... | ... | @@ -59,6 +62,7 @@ import com.xgimi.gimicinema.activity.SimpleAdsPlayer2; |
| 59 | 62 | import com.xgimi.gimicinema.application.FangTangApplication; |
| 60 | 63 | import com.xgimi.gimicinema.entity.Status; |
| 61 | 64 | import com.xgimi.gimicinema.poll.PollingUtils; |
| 65 | +import com.xgimi.gimicinema.service.CinemaControlService; | |
| 62 | 66 | import com.xgimi.gimicinema.service.CountService; |
| 63 | 67 | import org.greenrobot.eventbus.EventBus; |
| 64 | 68 | import org.greenrobot.eventbus.Subscribe; |
| ... | ... | @@ -85,6 +89,18 @@ public class SmartControlService extends BaseService implements EventListener<St |
| 85 | 89 | private boolean initGetOderInfo; |
| 86 | 90 | private RoomStatusInfo lastCompleteRoomStatusInfo; |
| 87 | 91 | private int openDoorServerTime = 0; |
| 92 | + private ICinemaControl iPlayer = null; | |
| 93 | + private ServiceConnection conn = new ServiceConnection() { | |
| 94 | + public void onServiceConnected(ComponentName className, IBinder service) { | |
| 95 | + LogUtils.i("bind cinema control service success"); | |
| 96 | + iPlayer = ICinemaControl.Stub.asInterface(service); | |
| 97 | + } | |
| 98 | + | |
| 99 | + public void onServiceDisconnected(ComponentName className) { | |
| 100 | + LogUtils.i("cinema control service error"); | |
| 101 | + iPlayer = null; | |
| 102 | + } | |
| 103 | + }; | |
| 88 | 104 | |
| 89 | 105 | private void initLock() { |
| 90 | 106 | // 检查当前手机是否支持ble 蓝牙,如果不支持退出程序 |
| ... | ... | @@ -101,6 +117,7 @@ public class SmartControlService extends BaseService implements EventListener<St |
| 101 | 117 | public void onCreate() { |
| 102 | 118 | super.onCreate(); |
| 103 | 119 | Log.d(TAG, "onCreate"); |
| 120 | + bindService(new Intent(SmartControlService.this, CinemaControlService.class), conn, Context.BIND_AUTO_CREATE); | |
| 104 | 121 | } |
| 105 | 122 | |
| 106 | 123 | @Override |
| ... | ... | @@ -321,6 +338,14 @@ public class SmartControlService extends BaseService implements EventListener<St |
| 321 | 338 | // if (info == null || info.getData() == null) { |
| 322 | 339 | // break; |
| 323 | 340 | // } |
| 341 | + if (iPlayer != null) { | |
| 342 | + try { | |
| 343 | + // end user control | |
| 344 | + iPlayer.setUserControl(false); | |
| 345 | + } catch (RemoteException e) { | |
| 346 | + e.printStackTrace(); | |
| 347 | + } | |
| 348 | + } | |
| 324 | 349 | Log.i("room-info", "COUNT_DOWN_ZERO stop polling finish some activity,jump to qr code activity"); |
| 325 | 350 | try { |
| 326 | 351 | PollingUtils.stopPollingService(this, CountService.class, CountService.STATUS_ACTION); |
| ... | ... | @@ -367,9 +392,13 @@ public class SmartControlService extends BaseService implements EventListener<St |
| 367 | 392 | Toast.makeText(this, msg, Toast.LENGTH_SHORT).show(); |
| 368 | 393 | } |
| 369 | 394 | LogUtils.i("room-info", messageEvent.getMessage()); |
| 370 | - Utils.saveString(this, "oder-play-completed", new Gson().toJson(roomStatusInfo)); | |
| 371 | - roomStatusInfo = null; | |
| 372 | -// playEndAds(); | |
| 395 | + String value = new Gson().toJson(roomStatusInfo); | |
| 396 | + if (!TextUtils.isEmpty(value)) { | |
| 397 | + LogUtils.i("room-info", "room status info is:" + value); | |
| 398 | + Utils.saveString(this, "oder-play-completed", value); | |
| 399 | + } else { | |
| 400 | + LogUtils.i("room-info", "room status info is null"); | |
| 401 | + } | |
| 373 | 402 | break; |
| 374 | 403 | default: |
| 375 | 404 | Log.d("room-info", messageEvent.getMessage()); |
| ... | ... | @@ -712,6 +741,7 @@ public class SmartControlService extends BaseService implements EventListener<St |
| 712 | 741 | .putExtra("room_sn", roomInfo.getData().getRoom_sn()) |
| 713 | 742 | .putExtra("order_sn", roomStatusInfo.getData().getOrder_sn()); |
| 714 | 743 | intentAds.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |
| 744 | + roomStatusInfo = null; | |
| 715 | 745 | startActivity(intentAds); |
| 716 | 746 | } |
| 717 | 747 | } | ... | ... |
| ... | ... | @@ -113,7 +113,7 @@ public class SocketService1 extends BaseService { |
| 113 | 113 | AtomicBoolean sendRegister = new AtomicBoolean(false); |
| 114 | 114 | AtomicInteger heartBeatErrorCount = new AtomicInteger(0); |
| 115 | 115 | |
| 116 | - public ICinemaControl iPlayer = null; | |
| 116 | + private ICinemaControl iPlayer = null; | |
| 117 | 117 | private ServiceConnection conn = new ServiceConnection() { |
| 118 | 118 | public void onServiceConnected(ComponentName className, IBinder service) { |
| 119 | 119 | LogUtils.i("bind cinema control service success"); |
| ... | ... | @@ -122,6 +122,7 @@ public class SocketService1 extends BaseService { |
| 122 | 122 | |
| 123 | 123 | public void onServiceDisconnected(ComponentName className) { |
| 124 | 124 | LogUtils.i("cinema control service error"); |
| 125 | + iPlayer = null; | |
| 125 | 126 | } |
| 126 | 127 | }; |
| 127 | 128 | |
| ... | ... | @@ -646,15 +647,36 @@ public class SocketService1 extends BaseService { |
| 646 | 647 | e.printStackTrace(); |
| 647 | 648 | } |
| 648 | 649 | |
| 649 | - if (op == 1 && status == 2) { | |
| 650 | + if (op == 1 && status == Status.PlayerStatus.PLAYER_PAUSE) { | |
| 650 | 651 | Log.d("setEqu", "开始播放"); |
| 651 | - ShellUtils.execCommand("input keyevent 23", false); | |
| 652 | - } else if (op == 2 && status == 1) { | |
| 652 | + mHandler.removeCallbacks(resumeRunnable); | |
| 653 | + pressCenterKey(); | |
| 654 | + } else if (op == 2 && status == Status.PlayerStatus.PLAYER_PLAY) { | |
| 653 | 655 | Log.d("setEqu", "暂停播放"); |
| 654 | - ShellUtils.execCommand("input keyevent 23", false); | |
| 656 | + mHandler.postDelayed(resumeRunnable, 3 * 60 * 1000); | |
| 657 | + pressCenterKey(); | |
| 655 | 658 | } |
| 656 | 659 | } |
| 657 | 660 | |
| 661 | + private void pressCenterKey() { | |
| 662 | + ShellUtils.execCommand("input keyevent 23", false); | |
| 663 | + } | |
| 664 | + | |
| 665 | + private Runnable resumeRunnable = new Runnable() { | |
| 666 | + @Override | |
| 667 | + public void run() { | |
| 668 | + if (iPlayer != null) { | |
| 669 | + try { | |
| 670 | + if (iPlayer.getCurrentStatus() == Status.PlayerStatus.PLAYER_PAUSE) { | |
| 671 | + pressCenterKey(); | |
| 672 | + } | |
| 673 | + } catch (RemoteException e) { | |
| 674 | + e.printStackTrace(); | |
| 675 | + } | |
| 676 | + } | |
| 677 | + } | |
| 678 | + }; | |
| 679 | + | |
| 658 | 680 | private void setEquipmentStatus(EquipmentControl equc) { |
| 659 | 681 | setLight(equc.getLightCtl()); |
| 660 | 682 | playCtl(equc.getPlayCtl()); |
| ... | ... | @@ -690,12 +712,13 @@ public class SocketService1 extends BaseService { |
| 690 | 712 | } |
| 691 | 713 | |
| 692 | 714 | public int getLightStatus() { |
| 693 | - int lightStatus = 3; | |
| 715 | + int lightStatus = 2; | |
| 694 | 716 | try { |
| 695 | 717 | DeviceInfo connectDevice = ((FangTangApplication) getApplication()). |
| 696 | 718 | getConnectDevice(); |
| 697 | 719 | if (connectDevice == null) { |
| 698 | 720 | LogUtils.i(TAG, "connectDevice is null"); |
| 721 | + lightStatus = 3; | |
| 699 | 722 | return lightStatus; |
| 700 | 723 | } |
| 701 | 724 | ConnectionStatus stu = Lights.getInstance(). | ... | ... |
| ... | ... | @@ -4,7 +4,6 @@ import android.content.BroadcastReceiver; |
| 4 | 4 | import android.content.Context; |
| 5 | 5 | import android.content.Intent; |
| 6 | 6 | import android.content.IntentFilter; |
| 7 | -import android.media.AudioManager; | |
| 8 | 7 | import android.media.MediaPlayer; |
| 9 | 8 | import android.net.Uri; |
| 10 | 9 | import android.os.Bundle; |
| ... | ... | @@ -27,8 +26,8 @@ public class AdsPreVideoPlayerActivity extends BaseActivity { |
| 27 | 26 | private String playUrl; |
| 28 | 27 | private String videoPath; |
| 29 | 28 | |
| 30 | - private AudioManager audioManager; | |
| 31 | - private int streamVolume; | |
| 29 | +// private AudioManager audioManager; | |
| 30 | +// private int streamVolume; | |
| 32 | 31 | |
| 33 | 32 | private int playCount = 1; |
| 34 | 33 | private int duration; |
| ... | ... | @@ -40,11 +39,11 @@ public class AdsPreVideoPlayerActivity extends BaseActivity { |
| 40 | 39 | protected void onCreate(Bundle savedInstanceState) { |
| 41 | 40 | super.onCreate(savedInstanceState); |
| 42 | 41 | setContentView(R.layout.a_pre_ads_player); |
| 43 | - audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE); | |
| 44 | - streamVolume = audioManager.getStreamVolume(AudioManager.STREAM_SYSTEM); | |
| 45 | - if (audioManager != null) { | |
| 46 | - audioManager.setStreamVolume(AudioManager.STREAM_SYSTEM, 20, 0); | |
| 47 | - } | |
| 42 | +// audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE); | |
| 43 | +// streamVolume = audioManager.getStreamVolume(AudioManager.STREAM_SYSTEM); | |
| 44 | +// if (audioManager != null) { | |
| 45 | +// audioManager.setStreamVolume(AudioManager.STREAM_SYSTEM, 20, 0); | |
| 46 | +// } | |
| 48 | 47 | playCount = Utils.getSp(this).getInt("play_count", 1); |
| 49 | 48 | videoView = (VideoView) findViewById(R.id.videoView); |
| 50 | 49 | timeCount = (TextView) findViewById(R.id.promoteTv); |
| ... | ... | @@ -115,10 +114,10 @@ public class AdsPreVideoPlayerActivity extends BaseActivity { |
| 115 | 114 | protected void onStop() { |
| 116 | 115 | super.onStop(); |
| 117 | 116 | Constant.isAdsOn = false; |
| 118 | - if (audioManager != null) { | |
| 119 | - audioManager.setStreamVolume(AudioManager.STREAM_SYSTEM, streamVolume, 0); | |
| 120 | - audioManager = null; | |
| 121 | - } | |
| 117 | +// if (audioManager != null) { | |
| 118 | +// audioManager.setStreamVolume(AudioManager.STREAM_SYSTEM, streamVolume, 0); | |
| 119 | +// audioManager = null; | |
| 120 | +// } | |
| 122 | 121 | playUrl = null; |
| 123 | 122 | videoView = null; |
| 124 | 123 | System.gc(); | ... | ... |
| ... | ... | @@ -13,4 +13,32 @@ public class Status { |
| 13 | 13 | public enum LightStatus { |
| 14 | 14 | LIGHT_IDLE, LIGHT_CONNECTED |
| 15 | 15 | } |
| 16 | + | |
| 17 | + public class PlayerStatus { | |
| 18 | + public static final int PLAYER_IDLE = 0; | |
| 19 | + public static final int PLAYER_PLAY = 1; | |
| 20 | + public static final int PLAYER_PAUSE = 2; | |
| 21 | + } | |
| 22 | + | |
| 23 | + public enum PlayerStatusEnum { | |
| 24 | + PLAYER_IDLE(0), PLAYER_PLAY(1), PLAYER_PAUSE(2); | |
| 25 | + | |
| 26 | + private int index; | |
| 27 | + | |
| 28 | + PlayerStatusEnum(int idx) { | |
| 29 | + this.index = idx; | |
| 30 | + } | |
| 31 | + | |
| 32 | + public int getIndex() { | |
| 33 | + return index; | |
| 34 | + } | |
| 35 | + } | |
| 36 | + | |
| 37 | + public static void main(String[] args) { | |
| 38 | +// PlayerStatusEnum playerStatusEnum = PlayerStatusEnum.PLAYER_IDLE; | |
| 39 | +// switch (playerStatusEnum){ | |
| 40 | +// case 0: | |
| 41 | +// break; | |
| 42 | +// } | |
| 43 | + } | |
| 16 | 44 | } | ... | ... |
| ... | ... | @@ -76,8 +76,7 @@ public class DBUpdateModelImpl implements IDBUpdateModel { |
| 76 | 76 | @Override |
| 77 | 77 | public void doSomeThing() { |
| 78 | 78 | try { |
| 79 | - dbManager.add(all); | |
| 80 | - dbManager.deleteFileNotExists(); | |
| 79 | + dbManager.addByTransaction(all); | |
| 81 | 80 | } catch (Exception e) { |
| 82 | 81 | handler.post(new Runnable() { |
| 83 | 82 | @Override |
| ... | ... | @@ -94,6 +93,12 @@ public class DBUpdateModelImpl implements IDBUpdateModel { |
| 94 | 93 | l.insertSuccess(all.size()); |
| 95 | 94 | } |
| 96 | 95 | }); |
| 96 | + | |
| 97 | + try { | |
| 98 | + dbManager.deleteFileNotExists(); | |
| 99 | + } catch (Exception e) { | |
| 100 | + e.printStackTrace(); | |
| 101 | + } | |
| 97 | 102 | } |
| 98 | 103 | }); |
| 99 | 104 | } | ... | ... |
| ... | ... | @@ -35,6 +35,7 @@ import com.telink.bluetooth.light.ConnectionStatus; |
| 35 | 35 | import com.telink.bluetooth.light.DeviceInfo; |
| 36 | 36 | import com.xgimi.gimicinema.ICinemaControl; |
| 37 | 37 | import com.xgimi.gimicinema.application.FangTangApplication; |
| 38 | +import com.xgimi.gimicinema.entity.Status; | |
| 38 | 39 | import org.greenrobot.eventbus.EventBus; |
| 39 | 40 | |
| 40 | 41 | import java.util.ArrayList; |
| ... | ... | @@ -48,8 +49,9 @@ public class CinemaControlService extends Service { |
| 48 | 49 | private int currentState = 0; |
| 49 | 50 | private String currentPath = null; |
| 50 | 51 | // private static final int SAVE_BEAT = 500; |
| 51 | - private static final int SAVE_BEAT = 5;//default 50 | |
| 52 | + private static final int SAVE_BEAT = 50;//default 50 | |
| 52 | 53 | private int saveBeat = SAVE_BEAT; |
| 54 | + private boolean userControl = false; | |
| 53 | 55 | |
| 54 | 56 | private final ICinemaControl.Stub cinemaControl = new ICinemaControl.Stub() { |
| 55 | 57 | |
| ... | ... | @@ -73,10 +75,10 @@ public class CinemaControlService extends Service { |
| 73 | 75 | public void setCurrentMoviePosition(long duration) throws RemoteException { |
| 74 | 76 | // Log.d("aidl", "setCurrentMoviePosition: " + duration); |
| 75 | 77 | currentPosition = duration; |
| 76 | - if (saveBeat-- == 0) { | |
| 78 | + if (!userControl && saveBeat-- == 0) { | |
| 77 | 79 | //TODO 保存当前进度,需要时从保存位置开始播放,取消播放器播放记录功能 |
| 78 | 80 | // 播放一段时间确保状态为关闭 |
| 79 | -// saveBeat = SAVE_BEAT; | |
| 81 | + saveBeat = SAVE_BEAT; | |
| 80 | 82 | try { |
| 81 | 83 | if (!fadeOuting && Lights.getInstance().getByMeshAddress( |
| 82 | 84 | ((FangTangApplication) getApplication()).getConnectDevice().meshAddress).status |
| ... | ... | @@ -114,24 +116,19 @@ public class CinemaControlService extends Service { |
| 114 | 116 | // } |
| 115 | 117 | // MessageEvent msgEvent = new MessageEvent(); |
| 116 | 118 | switch (state) { |
| 117 | - case 0://空闲 | |
| 119 | + case Status.PlayerStatus.PLAYER_IDLE://空闲 | |
| 118 | 120 | fadeIn(); |
| 119 | 121 | showQrCodeRightNow(); |
| 120 | -// msgEvent.setEventId(0x19910); | |
| 121 | -// msgEvent.setMessage("open_switch"); | |
| 122 | -// EventBus.getDefault().post(msgEvent); | |
| 123 | 122 | break; |
| 124 | - case 1://播放 | |
| 125 | - fadeOut(); | |
| 126 | -// msgEvent.setEventId(0x19910); | |
| 127 | -// msgEvent.setMessage("close_switch"); | |
| 128 | -// EventBus.getDefault().post(msgEvent); | |
| 123 | + case Status.PlayerStatus.PLAYER_PLAY://播放 | |
| 124 | + if (!userControl) { | |
| 125 | + fadeOut(); | |
| 126 | + } | |
| 129 | 127 | break; |
| 130 | - case 2://暂停 | |
| 131 | -// fadeIn(); | |
| 132 | -// msgEvent.setEventId(0x19910); | |
| 133 | -// msgEvent.setMessage("open_switch"); | |
| 134 | -// EventBus.getDefault().post(msgEvent); | |
| 128 | + case Status.PlayerStatus.PLAYER_PAUSE://暂停 | |
| 129 | + if (!userControl) { | |
| 130 | + fadeIn(); | |
| 131 | + } | |
| 135 | 132 | break; |
| 136 | 133 | } |
| 137 | 134 | } |
| ... | ... | @@ -140,15 +137,10 @@ public class CinemaControlService extends Service { |
| 140 | 137 | @Override |
| 141 | 138 | public void addPlayPath(String path) throws RemoteException { |
| 142 | 139 | movies.add(path);//strict contract |
| 143 | -// MessageEvent msgEvent = new MessageEvent(); | |
| 144 | -// msgEvent.setEventId(0x19910); | |
| 145 | -// msgEvent.setMessage("open_switch"); | |
| 146 | -// EventBus.getDefault().post(msgEvent); | |
| 147 | 140 | } |
| 148 | 141 | |
| 149 | 142 | @Override |
| 150 | 143 | public void setCurrentPlayPath(String path) throws RemoteException { |
| 151 | -// Log.d("aidl", "setCurrentPlayPath: " + path); | |
| 152 | 144 | CinemaControlService.this.currentPath = path; |
| 153 | 145 | FangTangApplication application = (FangTangApplication) getApplication(); |
| 154 | 146 | application.setCurrentPlayUrl(path); |
| ... | ... | @@ -174,12 +166,19 @@ public class CinemaControlService extends Service { |
| 174 | 166 | } |
| 175 | 167 | |
| 176 | 168 | public void openLight() throws RemoteException { |
| 169 | + userControl = true; | |
| 177 | 170 | fadeIn(); |
| 178 | 171 | } |
| 179 | 172 | |
| 180 | 173 | public void closeLight() throws RemoteException { |
| 174 | + userControl = true; | |
| 181 | 175 | fadeOut(); |
| 182 | 176 | } |
| 177 | + | |
| 178 | + @Override | |
| 179 | + public void setUserControl(boolean userOperate) throws RemoteException { | |
| 180 | + userControl = userOperate; | |
| 181 | + } | |
| 183 | 182 | }; |
| 184 | 183 | |
| 185 | 184 | public CinemaControlService() { |
| ... | ... | @@ -198,11 +197,11 @@ public class CinemaControlService extends Service { |
| 198 | 197 | public void run() { |
| 199 | 198 | setLightValue(value); |
| 200 | 199 | if (value-- == maxValue) { |
| 201 | - handler.postDelayed(this, 4 * 1000); | |
| 200 | + handler.postDelayed(this, 2 * 1000); | |
| 202 | 201 | } else { |
| 203 | 202 | if (value == 0) { |
| 204 | 203 | //how to remove |
| 205 | - handler.postDelayed(doClose, 3 * 1000); | |
| 204 | + handler.postDelayed(doClose, 2 * 1000); | |
| 206 | 205 | } else { |
| 207 | 206 | handler.postDelayed(this, 80); |
| 208 | 207 | } |
| ... | ... | @@ -286,12 +285,7 @@ public class CinemaControlService extends Service { |
| 286 | 285 | setLightValue(maxValue); |
| 287 | 286 | return; |
| 288 | 287 | } |
| 289 | -// int status = mApplication.getConnectDevice().status; | |
| 290 | -// Log.d("status_charge", "fadeIn: " + status); | |
| 291 | 288 | value = LIGHT_MIN_VALUE; |
| 292 | -// if (byMeshAddress.brightness > value) { | |
| 293 | -// value = byMeshAddress.brightness; | |
| 294 | -// } | |
| 295 | 289 | handler.post(openRunnable); |
| 296 | 290 | } |
| 297 | 291 | |
| ... | ... | @@ -317,9 +311,6 @@ public class CinemaControlService extends Service { |
| 317 | 311 | return; |
| 318 | 312 | } |
| 319 | 313 | maxValue = Utils.getInt(context, "brightness", 50); |
| 320 | - | |
| 321 | -// int status = connectDevice.status; | |
| 322 | -// Log.d("status_charge", "fadeOut: " + status); | |
| 323 | 314 | value = maxValue; |
| 324 | 315 | handler.post(closeRunnable); |
| 325 | 316 | } |
| ... | ... | @@ -337,7 +328,6 @@ public class CinemaControlService extends Service { |
| 337 | 328 | } else { |
| 338 | 329 | Log.d("aidl", "set value failure:" + (TelinkLightService.Instance() != null)); |
| 339 | 330 | } |
| 340 | - | |
| 341 | 331 | // opcode = (byte) 0xE2; |
| 342 | 332 | // params = new byte[]{0x05, (byte) value}; |
| 343 | 333 | // TelinkLightService.Instance().sendCommandNoResponse(opcode, addr, params, true); |
| ... | ... | @@ -345,6 +335,7 @@ public class CinemaControlService extends Service { |
| 345 | 335 | |
| 346 | 336 | private void showQrCodeRightNow() { |
| 347 | 337 | if (duration - currentPosition < 1000 * 60) { |
| 338 | + userControl = false; | |
| 348 | 339 | MessageEvent messageEvent = new MessageEvent(); |
| 349 | 340 | messageEvent.setEventId(SmartControlService.ORDER_PLAY_COMPLETE); |
| 350 | 341 | messageEvent.setMessage("电影播放完成,记录完成订单信息"); | ... | ... |
| 1 | 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | -<LinearLayout | |
| 3 | - xmlns:android="http://schemas.android.com/apk/res/android" | |
| 4 | - xmlns:tools="http://schemas.android.com/tools" | |
| 5 | - android:layout_width="match_parent" | |
| 6 | - android:layout_height="match_parent" | |
| 7 | - android:orientation="vertical" | |
| 8 | - android:gravity="center" | |
| 9 | - android:background="@color/white" | |
| 10 | - tools:context="com.xgimi.gimicinema.activity.QrCodeShowActivity"> | |
| 2 | +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
| 3 | + xmlns:tools="http://schemas.android.com/tools" | |
| 4 | + android:layout_width="match_parent" | |
| 5 | + android:layout_height="match_parent" | |
| 6 | + android:background="@color/white" | |
| 7 | + android:gravity="center" | |
| 8 | + android:orientation="vertical" | |
| 9 | + tools:context="com.xgimi.gimicinema.activity.QrCodeShowActivity"> | |
| 11 | 10 | |
| 12 | - <ImageView android:layout_width="400dp" | |
| 13 | - android:id="@+id/qrCodeIv" | |
| 14 | - android:layout_height="400dp"/> | |
| 11 | + <ImageView | |
| 12 | + android:id="@+id/qrCodeIv" | |
| 13 | + android:layout_width="300dp" | |
| 14 | + android:layout_height="300dp" /> | |
| 15 | 15 | |
| 16 | - <TextView android:layout_width="wrap_content" | |
| 17 | - android:layout_height="wrap_content" | |
| 18 | - android:textSize="30sp" | |
| 19 | - android:textColor="@color/black" | |
| 20 | - android:text="打扫完成后请扫二维码确认"/> | |
| 16 | + <TextView | |
| 17 | + android:layout_width="wrap_content" | |
| 18 | + android:layout_height="wrap_content" | |
| 19 | + android:text="打扫完成后请扫二维码确认" | |
| 20 | + android:textColor="@color/black" | |
| 21 | + android:textSize="30sp" /> | |
| 21 | 22 | |
| 22 | 23 | |
| 23 | 24 | </LinearLayout> | ... | ... |
Please
register
or
login
to post a comment