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 119 int itemHeight = 420;
120 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 122 public interface OnItemClickListener {
128 123 void onItemClick(View view, int data);
129 124 }
... ... @@ -202,9 +197,6 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen
202 197 clazzRv.setAdapter(adapterClazz);
203 198
204 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 286 }
295 287
296 288 public void setVideoAds(String path) {
297   - videoAds = path;
298 289 }
299 290
300 291 @Override
... ... @@ -319,8 +310,8 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen
319 310
320 311 @Override
321 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 315 context.startActivity(intentSearch);
325 316 }
326 317
... ... @@ -350,7 +341,6 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen
350 341 presenter.loadRecommend(context);
351 342 }
352 343 }
353   - needStartScreenSaver = true;
354 344 if (HAS_SYSTEM_FEATURE_BLUETOOTH_LE) {
355 345 IntentFilter intentFilter = new IntentFilter();
356 346 intentFilter.addAction(BLEBroadcastReceiver.ACTION_BLE_ERROR);
... ... @@ -407,13 +397,11 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen
407 397 startActivity(i);
408 398 return true;
409 399 }
410   - lastKeyDownTime = System.currentTimeMillis();
411 400 return super.onKeyDown(keyCode, event);
412 401 }
413 402
414 403 @Override
415 404 protected void onPause() {
416   - needStartScreenSaver = false;
417 405 super.onPause();
418 406 if (HAS_SYSTEM_FEATURE_BLUETOOTH_LE) {
419 407 unregisterReceiver(bleBroadcastReceiver);
... ... @@ -635,13 +623,11 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen
635 623
636 624 BLEOpenRecord bleOpenRecord = new BLEOpenRecord();
637 625 bleOpenRecord.setLockmac(onClickDeviceMac);
638   -// bleOpenRecord.setUserid(MainActivity.account);
639 626 bleOpenRecord.setTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.US).format(new Date()));
640 627 Intent intent = new Intent();
641 628 intent.setAction(GREENBluetoothLeService.ACTION_OPEN_SUCCESS);
642 629 intent.putExtra("openrecord", bleOpenRecord);
643 630 sendBroadcast(intent);
644   -// IS_OPENNING_DOOR = false;
645 631 }
646 632
647 633 @Override
... ... @@ -680,8 +666,6 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen
680 666 private int connectMeshAddress;
681 667 private Handler mHandler = new Handler();
682 668
683   - private Handler mDelayHandler = new Handler();
684   -
685 669 private BroadcastReceiver mReceiver = new BroadcastReceiver() {
686 670 @Override
687 671 public void onReceive(Context context, Intent intent) {
... ... @@ -753,13 +737,6 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen
753 737 case LightAdapter.STATUS_LOGIN:
754 738 connectMeshAddress = mApplication.getConnectDevice().meshAddress;
755 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 740 break;
764 741 case LightAdapter.STATUS_CONNECTING:
765 742 show("login");
... ... @@ -822,12 +799,6 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen
822 799 light.status = notificationInfo.connectStatus;
823 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 315 }
316 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 268
269 269 @Override
270 270 public void onSuccess(String path) {
271   - mainView.setVideoAds(path);
272 271 }
273 272
274 273 @Override
... ...
... ... @@ -74,23 +74,24 @@ public class CinemaControlService extends Service {
74 74 return currentState;
75 75 }
76 76
  77 + //TODO 当状态改变时上报服务器状态,开始播放时,启动轮询上报当前状态及时间
77 78 @Override
78 79 public void setCurrentStatus(int state) throws RemoteException {
79 80 Log.d("aidl", "setCurrentStatus: " + state);
80 81 if (state != currentState) {
81 82 currentState = state;
82   - Log.d("aidl", "state change," + duration + "," + currentPosition);
  83 + Log.d("aidl", "state change," + currentPath + "," + duration + "," + currentPosition);
83 84 Log.d("aidl", "state change cinemaSMC not null");
84 85 switch (state) {
85   - case 0:
  86 + case 0://空闲
86 87 // open();
87 88 fadeIn();
88 89 break;
89   - case 1:
  90 + case 1://播放
90 91 fadeOut();
91 92 // close();
92 93 break;
93   - case 2:
  94 + case 2://暂停
94 95 // open();
95 96 fadeIn();
96 97 break;
... ...
... ... @@ -176,6 +176,23 @@
176 176 android:textColor="@color/black"
177 177 android:text="@string/update_1905_source"/>
178 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 196 <TableRow android:layout_width="match_parent"
180 197 android:layout_marginLeft="40dp"
181 198 android:visibility="gone"
... ...
... ... @@ -103,5 +103,6 @@
103 103 <string name="unauthorized_promote">该设备没有获取授权,点确定可以退出,如需相应的授权请联系青柠影咖相关工作人员(www.qnbar.com).</string>
104 104 <string name="no_auth">此机器未被注册,请联系青柠客服!</string>
105 105 <string name="pre_ads_times">映前广告次数</string>
  106 + <string name="set_sm_light">设置智能灯光</string>
106 107
107 108 </resources>
... ...
Please register or login to post a comment