-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
2,489 additions
and
2,107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
sdkdemo/src/main/java/com/tencent/iot/explorer/link/demo/video/VideoPreviewBaseActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
package com.tencent.iot.explorer.link.demo.video | ||
|
||
import android.os.Bundle | ||
import android.text.TextUtils | ||
import com.alibaba.fastjson.JSON | ||
import com.tencent.iot.explorer.link.demo.App | ||
import com.tencent.iot.explorer.link.demo.VideoBaseActivity | ||
import com.tencent.iot.explorer.link.demo.common.util.StatusBarUtil | ||
import com.tencent.iot.explorer.link.demo.video.playback.cloudPlayback.event.EventPresenter | ||
import com.tencent.iot.explorer.link.demo.video.playback.cloudPlayback.event.EventView | ||
import com.tencent.iot.explorer.link.demo.video.preview.DevUrl2Preview | ||
import com.tencent.iot.video.link.callback.VideoCallback | ||
import com.tencent.iot.video.link.consts.VideoConst | ||
import com.tencent.iot.video.link.service.VideoBaseService | ||
import org.json.JSONObject | ||
import java.util.Date | ||
|
||
abstract class VideoPreviewBaseActivity : VideoBaseActivity(), EventView, VideoCallback { | ||
|
||
protected lateinit var presenter: EventPresenter | ||
protected var xp2pInfo: String = "" | ||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
checkStyle() | ||
} | ||
|
||
private fun checkStyle() { | ||
StatusBarUtil.setRootViewFitsSystemWindows(this, false) | ||
StatusBarUtil.setTranslucentStatus(this) | ||
if (!StatusBarUtil.setStatusBarDarkTheme(this, true)) { | ||
StatusBarUtil.setStatusBarColor(this, 0x55000000) | ||
} | ||
} | ||
|
||
override fun performInitView() { | ||
presenter = EventPresenter(this@VideoPreviewBaseActivity) | ||
val bundle = intent.getBundleExtra(VideoConst.VIDEO_CONFIG) | ||
bundle?.let { | ||
val videoConfig = bundle.getString(VideoConst.VIDEO_CONFIG) | ||
if (TextUtils.isEmpty(videoConfig)) return@let | ||
|
||
val devInfo = JSON.parseObject(videoConfig, DevUrl2Preview::class.java) | ||
devInfo?.let { | ||
presenter.setDeviceName(it.devName) | ||
presenter.setChannel(it.channel) | ||
} | ||
} | ||
|
||
App.data.accessInfo?.let { | ||
presenter.setAccessId(it.accessId) | ||
presenter.setAccessToken(it.accessToken) | ||
presenter.setProductId(it.productId) | ||
presenter.getEventsData(Date()) | ||
} | ||
} | ||
|
||
protected fun getDeviceP2PInfo() { | ||
App.data.accessInfo?.let { | ||
VideoBaseService(it.accessId, it.accessToken).getDeviceXp2pInfo( | ||
it.productId, | ||
presenter.getDeviceName(), | ||
this | ||
) | ||
} | ||
} | ||
|
||
abstract fun updateXp2pInfo(xp2pInfo: String) | ||
|
||
override fun success(response: String?, reqCode: Int) { | ||
response?.let { | ||
val responseObject = JSONObject(it).getJSONObject("Response") | ||
xp2pInfo = responseObject.getString("P2PInfo") | ||
} | ||
updateXp2pInfo(xp2pInfo) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.