Commit e7d962d30b6ccdb5b3a5991709a97c7908001997

Authored by Penley
1 parent 387577ba

sovle main page flash of recommend,code clean

@@ -119,11 +119,6 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen @@ -119,11 +119,6 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen
119 int itemHeight = 420; 119 int itemHeight = 420;
120 int itemSpace = 30; 120 int itemSpace = 30;
121 121
122 - private Handler handler = new Handler();  
123 - private long lastKeyDownTime;  
124 - private String videoAds;  
125 - private boolean needStartScreenSaver = true;  
126 -  
127 public interface OnItemClickListener { 122 public interface OnItemClickListener {
128 void onItemClick(View view, int data); 123 void onItemClick(View view, int data);
129 } 124 }
@@ -202,9 +197,6 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen @@ -202,9 +197,6 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen
202 clazzRv.setAdapter(adapterClazz); 197 clazzRv.setAdapter(adapterClazz);
203 198
204 presenter.load(this); 199 presenter.load(this);
205 -// Intent intent = new Intent();  
206 -// intent.setAction(AskService.ASK_SERVICE_ACTION);  
207 -// this.getBaseContext().startService(intent);  
208 } 200 }
209 201
210 202
@@ -294,7 +286,6 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen @@ -294,7 +286,6 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen
294 } 286 }
295 287
296 public void setVideoAds(String path) { 288 public void setVideoAds(String path) {
297 - videoAds = path;  
298 } 289 }
299 290
300 @Override 291 @Override
@@ -319,8 +310,8 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen @@ -319,8 +310,8 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen
319 310
320 @Override 311 @Override
321 public void jumpToSearch() { 312 public void jumpToSearch() {
322 - Intent intentSearch = new Intent(context, com.qnbar.smc.MainActivity.class);  
323 -// Intent intentSearch = new Intent(context, SearchNewActivity.class); 313 +// Intent intentSearch = new Intent(context, com.qnbar.smc.MainActivity.class);
  314 + Intent intentSearch = new Intent(context, SearchNewActivity.class);
324 context.startActivity(intentSearch); 315 context.startActivity(intentSearch);
325 } 316 }
326 317
@@ -350,7 +341,6 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen @@ -350,7 +341,6 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen
350 presenter.loadRecommend(context); 341 presenter.loadRecommend(context);
351 } 342 }
352 } 343 }
353 - needStartScreenSaver = true;  
354 if (HAS_SYSTEM_FEATURE_BLUETOOTH_LE) { 344 if (HAS_SYSTEM_FEATURE_BLUETOOTH_LE) {
355 IntentFilter intentFilter = new IntentFilter(); 345 IntentFilter intentFilter = new IntentFilter();
356 intentFilter.addAction(BLEBroadcastReceiver.ACTION_BLE_ERROR); 346 intentFilter.addAction(BLEBroadcastReceiver.ACTION_BLE_ERROR);
@@ -407,13 +397,11 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen @@ -407,13 +397,11 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen
407 startActivity(i); 397 startActivity(i);
408 return true; 398 return true;
409 } 399 }
410 - lastKeyDownTime = System.currentTimeMillis();  
411 return super.onKeyDown(keyCode, event); 400 return super.onKeyDown(keyCode, event);
412 } 401 }
413 402
414 @Override 403 @Override
415 protected void onPause() { 404 protected void onPause() {
416 - needStartScreenSaver = false;  
417 super.onPause(); 405 super.onPause();
418 if (HAS_SYSTEM_FEATURE_BLUETOOTH_LE) { 406 if (HAS_SYSTEM_FEATURE_BLUETOOTH_LE) {
419 unregisterReceiver(bleBroadcastReceiver); 407 unregisterReceiver(bleBroadcastReceiver);
@@ -635,13 +623,11 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen @@ -635,13 +623,11 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen
635 623
636 BLEOpenRecord bleOpenRecord = new BLEOpenRecord(); 624 BLEOpenRecord bleOpenRecord = new BLEOpenRecord();
637 bleOpenRecord.setLockmac(onClickDeviceMac); 625 bleOpenRecord.setLockmac(onClickDeviceMac);
638 -// bleOpenRecord.setUserid(MainActivity.account);  
639 bleOpenRecord.setTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.US).format(new Date())); 626 bleOpenRecord.setTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.US).format(new Date()));
640 Intent intent = new Intent(); 627 Intent intent = new Intent();
641 intent.setAction(GREENBluetoothLeService.ACTION_OPEN_SUCCESS); 628 intent.setAction(GREENBluetoothLeService.ACTION_OPEN_SUCCESS);
642 intent.putExtra("openrecord", bleOpenRecord); 629 intent.putExtra("openrecord", bleOpenRecord);
643 sendBroadcast(intent); 630 sendBroadcast(intent);
644 -// IS_OPENNING_DOOR = false;  
645 } 631 }
646 632
647 @Override 633 @Override
@@ -680,8 +666,6 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen @@ -680,8 +666,6 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen
680 private int connectMeshAddress; 666 private int connectMeshAddress;
681 private Handler mHandler = new Handler(); 667 private Handler mHandler = new Handler();
682 668
683 - private Handler mDelayHandler = new Handler();  
684 -  
685 private BroadcastReceiver mReceiver = new BroadcastReceiver() { 669 private BroadcastReceiver mReceiver = new BroadcastReceiver() {
686 @Override 670 @Override
687 public void onReceive(Context context, Intent intent) { 671 public void onReceive(Context context, Intent intent) {
@@ -753,13 +737,6 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen @@ -753,13 +737,6 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen
753 case LightAdapter.STATUS_LOGIN: 737 case LightAdapter.STATUS_LOGIN:
754 connectMeshAddress = mApplication.getConnectDevice().meshAddress; 738 connectMeshAddress = mApplication.getConnectDevice().meshAddress;
755 show("main login success"); 739 show("main login success");
756 - mHandler.postDelayed(new Runnable() {  
757 - @Override  
758 - public void run() {  
759 - TelinkLightService.Instance().sendCommandNoResponse((byte) 0xE4, 0xFFFF, new byte[]{});  
760 -// getDeviceGroup();  
761 - }  
762 - }, 3 * 1000);  
763 break; 740 break;
764 case LightAdapter.STATUS_CONNECTING: 741 case LightAdapter.STATUS_CONNECTING:
765 show("login"); 742 show("login");
@@ -822,12 +799,6 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen @@ -822,12 +799,6 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen
822 light.status = notificationInfo.connectStatus; 799 light.status = notificationInfo.connectStatus;
823 light.updateIcon(); 800 light.updateIcon();
824 } 801 }
825 - mHandler.post(new Runnable() {  
826 - @Override  
827 - public void run() {  
828 - adapter.notifyDataSetChanged();  
829 - }  
830 - });  
831 } 802 }
832 803
833 /** 804 /**
@@ -315,4 +315,9 @@ public class SettingActivity extends BaseActivity implements ISettingView { @@ -315,4 +315,9 @@ public class SettingActivity extends BaseActivity implements ISettingView {
315 } 315 }
316 return super.onKeyDown(keyCode, event); 316 return super.onKeyDown(keyCode, event);
317 } 317 }
  318 +
  319 + public void setLights(View view) {
  320 + Intent intent = new Intent(this, com.qnbar.smc.MainActivity.class);
  321 + startActivity(intent);
  322 + }
318 } 323 }
@@ -268,7 +268,6 @@ public class MainPresenter extends BasePresenter @@ -268,7 +268,6 @@ public class MainPresenter extends BasePresenter
268 268
269 @Override 269 @Override
270 public void onSuccess(String path) { 270 public void onSuccess(String path) {
271 - mainView.setVideoAds(path);  
272 } 271 }
273 272
274 @Override 273 @Override
@@ -74,23 +74,24 @@ public class CinemaControlService extends Service { @@ -74,23 +74,24 @@ public class CinemaControlService extends Service {
74 return currentState; 74 return currentState;
75 } 75 }
76 76
  77 + //TODO 当状态改变时上报服务器状态,开始播放时,启动轮询上报当前状态及时间
77 @Override 78 @Override
78 public void setCurrentStatus(int state) throws RemoteException { 79 public void setCurrentStatus(int state) throws RemoteException {
79 Log.d("aidl", "setCurrentStatus: " + state); 80 Log.d("aidl", "setCurrentStatus: " + state);
80 if (state != currentState) { 81 if (state != currentState) {
81 currentState = state; 82 currentState = state;
82 - Log.d("aidl", "state change," + duration + "," + currentPosition); 83 + Log.d("aidl", "state change," + currentPath + "," + duration + "," + currentPosition);
83 Log.d("aidl", "state change cinemaSMC not null"); 84 Log.d("aidl", "state change cinemaSMC not null");
84 switch (state) { 85 switch (state) {
85 - case 0: 86 + case 0://空闲
86 // open(); 87 // open();
87 fadeIn(); 88 fadeIn();
88 break; 89 break;
89 - case 1: 90 + case 1://播放
90 fadeOut(); 91 fadeOut();
91 // close(); 92 // close();
92 break; 93 break;
93 - case 2: 94 + case 2://暂停
94 // open(); 95 // open();
95 fadeIn(); 96 fadeIn();
96 break; 97 break;
@@ -176,6 +176,23 @@ @@ -176,6 +176,23 @@
176 android:textColor="@color/black" 176 android:textColor="@color/black"
177 android:text="@string/update_1905_source"/> 177 android:text="@string/update_1905_source"/>
178 </TableRow> 178 </TableRow>
  179 +
  180 + <TableRow android:layout_width="match_parent"
  181 + android:layout_marginLeft="40dp"
  182 + android:layout_height="wrap_content">
  183 +
  184 + <Button style="@style/GeneralTextViewTheme"
  185 + android:onClick="setLights"
  186 + android:visibility="visible"
  187 + android:textColor="@color/black"
  188 + android:text="@string/set_sm_light"/>
  189 +
  190 + <Button style="@style/GeneralTextViewTheme"
  191 + android:onClick="update1905Movies"
  192 + android:visibility="invisible"
  193 + android:textColor="@color/black"
  194 + android:text="@string/update_1905_source"/>
  195 + </TableRow>
179 <TableRow android:layout_width="match_parent" 196 <TableRow android:layout_width="match_parent"
180 android:layout_marginLeft="40dp" 197 android:layout_marginLeft="40dp"
181 android:visibility="gone" 198 android:visibility="gone"
@@ -103,5 +103,6 @@ @@ -103,5 +103,6 @@
103 <string name="unauthorized_promote">该设备没有获取授权,点确定可以退出,如需相应的授权请联系青柠影咖相关工作人员(www.qnbar.com).</string> 103 <string name="unauthorized_promote">该设备没有获取授权,点确定可以退出,如需相应的授权请联系青柠影咖相关工作人员(www.qnbar.com).</string>
104 <string name="no_auth">此机器未被注册,请联系青柠客服!</string> 104 <string name="no_auth">此机器未被注册,请联系青柠客服!</string>
105 <string name="pre_ads_times">映前广告次数</string> 105 <string name="pre_ads_times">映前广告次数</string>
  106 + <string name="set_sm_light">设置智能灯光</string>
106 107
107 </resources> 108 </resources>
Please register or login to post a comment