Skip to content

Commit

Permalink
Merge pull request #121 from remotv/develop
Browse files Browse the repository at this point in the history
Release 0.19.0
  • Loading branch information
SkyeOfBreeze authored Jan 5, 2021
2 parents 3c51123 + 104aadb commit 59b8159
Show file tree
Hide file tree
Showing 99 changed files with 3,824 additions and 371 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,7 @@ jobs:
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Install NDK
run: echo "y" | sudo /usr/local/lib/android/sdk/tools/bin/sdkmanager --install "ndk;20.0.5594570" --sdk_root=${ANDROID_SDK_ROOT}
- name: Build with Gradle
run: chmod a+x ./gradlew && ./gradlew build
2 changes: 2 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ jobs:
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Install NDK
run: echo "y" | sudo /usr/local/lib/android/sdk/tools/bin/sdkmanager --install "ndk;20.0.5594570" --sdk_root=${ANDROID_SDK_ROOT}
- name: Unzip Release Key
run: echo "${{ secrets.SIGNING_KEY }}" | base64 -d > deploy.jks
- name: Build with Gradle
Expand Down
13 changes: 10 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Android Instrumented Tests
on:
push:
tags:
- 'v*.*.*'
- 'test*.*.*'

jobs:
test:
Expand All @@ -16,7 +16,14 @@ jobs:
steps:
- name: checkout
uses: actions/checkout@v2

- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Setup Android SDK
uses: android-actions/setup-android@v2
- name: Install NDK
run: echo "y" | sudo /usr/local/lib/android/sdk/tools/bin/sdkmanager --install "ndk;20.0.5594570" --sdk_root=${ANDROID_SDK_ROOT}
- name: run tests
uses: reactivecircus/android-emulator-runner@v2
with:
Expand All @@ -26,4 +33,4 @@ jobs:
profile: Nexus 6
script: ./gradlew connectedCheck
env:
TEST_KEY: ${{ secrets.TEST_KEY }}
TEST_KEY: ${{ secrets[format('APIKEY_{0}', matrix.api-level)] }}
15 changes: 11 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'

def getProps(String propName) {
def propsFile = rootProject.file('local.properties')
if (propsFile.exists()) {
Expand Down Expand Up @@ -36,8 +34,8 @@ android {
applicationId "tv.remo.android.controller"
minSdkVersion 16
targetSdkVersion 28
versionCode 17
versionName "0.18.1"
versionCode 18
versionName "0.19.0"
multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Expand All @@ -59,6 +57,11 @@ android {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
releaseDemo {
signingConfig signingConfigs.debug
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
release {
if(System.getenv("KEY_ALIAS_RELEASE")){
signingConfig signingConfigs.release
Expand All @@ -68,6 +71,10 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

buildFeatures {
viewBinding true
}
}

dependencies {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package tv.remo.android.controller

import android.content.Context
import android.content.Intent
import android.os.Build
import android.os.Bundle
import android.os.Handler
import android.os.Looper
Expand Down Expand Up @@ -45,7 +44,6 @@ class DemoBotAndroidTest {
val handler = Handler(Looper.getMainLooper())
RemoSettingsUtil.with(appContext){
it.apiKey.savePref(BuildConfig.robot_test_key)
it.channelId.savePref("API${Build.VERSION.SDK_INT}")
it.cameraEnabled.savePref(true)
it.microphoneEnabled.savePref(false)
it.cameraResolution.savePref("640x480")
Expand Down
9 changes: 7 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppThemeWithActionBar" tools:ignore="GoogleAppIndexingWarning">
<activity android:name=".activities.MainActivity" android:theme="@style/AppThemeNoActionBar">
<activity android:name=".activities.MainActivity" android:theme="@style/AppThemeNoActionBar" android:exported="false" />
<activity android:name=".activities.ExternalControlActivity">
<intent-filter>
<action android:name="tv.remo.android.controller.action.REQUEST_REMO_STREAM_START" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity android:name=".activities.SettingsActivity"/>
<activity android:name=".activities.SplashScreen" android:label="@string/app_display_name"
Expand Down Expand Up @@ -39,4 +44,4 @@
</activity>
</application>

</manifest>
</manifest>
56 changes: 43 additions & 13 deletions app/src/main/java/tv/remo/android/controller/RemoApplication.kt
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
package tv.remo.android.controller

import android.content.Context
import android.content.Intent
import android.util.Log
import androidx.multidex.MultiDexApplication
import org.btelman.android.shellutil.Executor
import org.btelman.controlsdk.services.ControlSDKService
import org.btelman.logutil.kotlin.LogLevel
import org.btelman.logutil.kotlin.LogUtil
import org.btelman.logutil.kotlin.LogUtilInstance
import tv.remo.android.controller.sdk.RemoSettingsUtil
import kotlin.system.exitProcess

/**
* Created by Brendon on 7/28/2019.
*/
class RemoApplication : MultiDexApplication() {
private val log = LogUtil("RemoApplication", logID)

override fun onCreate() {
super.onCreate()
LogUtilInstance(ControlSDKService.CONTROL_SERVICE, LogLevel.VERBOSE).also {
Log.d("RemoApplication", "Setup ControlSDK logger")
LogUtil.addCustomLogUtilInstance(ControlSDKService::class.java.name, it)
}
setupLogging(this)

val log = LogUtil("RemoApplication", logID)

log.d{
"Remo.TV ${BuildConfig.VERSION_NAME} onCreate..."
Expand All @@ -29,12 +31,7 @@ class RemoApplication : MultiDexApplication() {

companion object{
var Instance : RemoApplication? = null
val logID = "Remo.TV".also {name->
LogUtilInstance(ControlSDKService.CONTROL_SERVICE, LogLevel.VERBOSE).also {
Log.d("RemoApplication", "Setup Remo.TV logger")
LogUtil.addCustomLogUtilInstance(name, it)
}
}
val logID = "Remo.TV"

fun getLogger(tag : String) : LogUtil{
return LogUtil(tag, logID)
Expand All @@ -47,5 +44,38 @@ class RemoApplication : MultiDexApplication() {
}
return getLogger(log)
}

var logLevel : LogLevel = LogLevel.ERROR
private set

private fun setupLogging(context: Context) {
RemoSettingsUtil.with(context){
val logLevelStr = it.logLevel.getPref()
logLevel = LogLevel.valueOf(logLevelStr)
}
LogUtilInstance(ControlSDKService.CONTROL_SERVICE, logLevel).also {
Log.d("RemoApplication", "Setup ControlSDK logger...")
LogUtil.addCustomLogUtilInstance(ControlSDKService.loggerID, it)
}
LogUtilInstance(ControlSDKService.CONTROL_SERVICE, logLevel).also {
Log.d("RemoApplication", "Setup Remo.TV logger...")
LogUtil.addCustomLogUtilInstance(logID, it)
}
LogUtilInstance(Executor::class.java.simpleName, logLevel).also {
Log.d("RemoApplication", "Setup ShellUtil logger...")
LogUtil.addCustomLogUtilInstance(Executor::class.java.simpleName, it)
Executor.logInstance = it
}
}

fun restart(context: Context) {
context.apply {
val intent = packageManager.getLaunchIntentForPackage(packageName)
intent!!.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
startActivity(intent)
exitProcess(0)
}
}
}
}
}
24 changes: 21 additions & 3 deletions app/src/main/java/tv/remo/android/controller/ServiceInterface.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import org.btelman.controlsdk.services.ControlSDKServiceConnection
import tv.remo.android.controller.sdk.RemoSettingsUtil
import tv.remo.android.controller.sdk.components.StatusBroadcasterComponent
import tv.remo.android.controller.sdk.utils.ComponentBuilderUtil
import java.lang.IllegalStateException

/**
* Interface for Activity to communicate with service
Expand All @@ -17,7 +16,22 @@ open class ServiceInterface(
val onServiceBind : (Operation)->Unit,
val onServiceStateChange : (Operation)->Unit
){
/**
* Listeners or controllers that are able to persist beyond the activity lifecycle
* IListener or IController
*/
protected val persistentListenerControllerList = ArrayList<ComponentHolder<*>>()

/**
* Listeners or controllers that should be removed when the activity unbinds
* IListener or IController
*/
protected val listenerControllerList = ArrayList<ComponentHolder<*>>()

/**
* Generic ControlSDK ComponentHolders
* IComponent
*/
protected val arrayList = ArrayList<ComponentHolder<*>>()
protected var controlSDKServiceApi =
ControlSDKServiceConnection.getNewInstance(context)
Expand All @@ -44,9 +58,9 @@ open class ServiceInterface(
RemoSettingsUtil.with(context){ settings ->
arrayList.add(ComponentBuilderUtil.createSocketComponent(settings))
arrayList.addAll(ComponentBuilderUtil.createTTSComponents(settings))
arrayList.addAll(ComponentBuilderUtil.createStreamingComponents(settings))
arrayList.addAll(ComponentBuilderUtil.createStreamingComponents(context, settings))
arrayList.addAll(ComponentBuilderUtil.createHardwareComponents(settings))
listenerControllerList.add(ComponentHolder(StatusBroadcasterComponent::class.java, null))
persistentListenerControllerList.add(ComponentHolder(StatusBroadcasterComponent::class.java, null, async = false))
}
}

Expand Down Expand Up @@ -79,11 +93,15 @@ open class ServiceInterface(
listenerControllerList.forEach {
controlSDKServiceApi.addListenerOrController(it)
}
persistentListenerControllerList.forEach {
controlSDKServiceApi.addListenerOrController(it)
}
}
else if(connected == Operation.NOT_OK){
listenerControllerList.forEach {
controlSDKServiceApi.removeListenerOrController(it)
}
//persistent list gets to stay when service is not bound
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import kotlinx.android.synthetic.main.fragment_web_server_settings_page.*
import tv.remo.android.controller.databinding.FragmentWebServerSettingsPageBinding
import tv.remo.android.controller.sdk.components.RemoWebServer


Expand All @@ -19,17 +19,23 @@ class WebServerSettingsPage : Fragment() {

lateinit var server : RemoWebServer

private var _binding: FragmentWebServerSettingsPageBinding? = null
// This property is only valid between onCreateView and onDestroyView.
private val binding get() = _binding!!


override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
): View {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_web_server_settings_page, container, false)
_binding = FragmentWebServerSettingsPageBinding.inflate(inflater, container, false)
return binding.root
}

private val onSettingsUpdated : ()->Unit = {
view?.post {
responseTextView.visibility = View.VISIBLE
binding.responseTextView.visibility = View.VISIBLE
}
}

Expand All @@ -43,7 +49,7 @@ class WebServerSettingsPage : Fragment() {
} catch (e: Exception) {
null
}
ipAddrValue.text = if(ip != null && ip != "0.0.0.0"){
binding.ipAddrValue.text = if(ip != null && ip != "0.0.0.0"){
"$ip:8080/config"
}
else{
Expand All @@ -53,6 +59,11 @@ class WebServerSettingsPage : Fragment() {
server.open()
}

override fun onDestroyView() {
super.onDestroyView()
_binding = null
}

override fun onDestroy() {
super.onDestroy()
try {
Expand Down
Loading

0 comments on commit 59b8159

Please sign in to comment.