├── gradle.properties ├── .DS_Store ├── ic_launcher-web.png ├── res ├── drawable-hdpi │ ├── ic_drawer.png │ ├── ic_launcher.png │ └── drawer_shadow.9.png ├── drawable-mdpi │ ├── ic_drawer.png │ ├── icon_12676.png │ ├── icon_15111.png │ ├── icon_15307.png │ ├── icon_17114.png │ ├── icon_17183.png │ ├── icon_3330.png │ ├── ic_launcher.png │ └── drawer_shadow.9.png ├── drawable-xhdpi │ ├── ic_drawer.png │ ├── icon_3330.png │ ├── ic_launcher.png │ ├── icon_12676.png │ ├── icon_15111.png │ ├── icon_15307.png │ ├── icon_17114.png │ ├── icon_17183.png │ └── drawer_shadow.9.png ├── drawable-xxhdpi │ ├── ic_drawer.png │ ├── ic_launcher.png │ └── drawer_shadow.9.png ├── values │ ├── styles.xml │ └── dimens.xml ├── layout │ ├── activity_main.xml │ ├── fragment_navigation_drawer.xml │ ├── app_item.xml │ ├── channel_item.xml │ ├── fragment_apps.xml │ ├── fragment_webapp.xml │ ├── fragment_fiveway.xml │ ├── fragment_system.xml │ ├── fragment_tv.xml │ └── fragment_media_player.xml ├── menu │ └── main.xml └── values-w820dp │ └── dimens.xml ├── lint.xml ├── project.properties ├── .gitignore ├── proguard-project.txt ├── src └── com │ └── connectsdk │ └── sampler │ ├── MainApplication.java │ ├── widget │ ├── AppAdapter.java │ └── ChannelAdapter.java │ ├── SectionsPagerAdapter.java │ ├── util │ └── TestResponseObject.java │ ├── fragments │ ├── BaseFragment.java │ ├── TVFragment.java │ ├── SystemFragment.java │ ├── AppsFragment.java │ ├── WebAppFragment.java │ ├── KeyControlFragment.java │ └── MediaPlayerFragment.java │ └── MainActivity.java ├── AndroidManifest.xml ├── README.md └── LICENSE /gradle.properties: -------------------------------------------------------------------------------- 1 | android.enableJetifier=true 2 | android.useAndroidX=true -------------------------------------------------------------------------------- /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ConnectSDK/Connect-SDK-Android-API-Sampler/HEAD/.DS_Store -------------------------------------------------------------------------------- /ic_launcher-web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ConnectSDK/Connect-SDK-Android-API-Sampler/HEAD/ic_launcher-web.png -------------------------------------------------------------------------------- /res/drawable-hdpi/ic_drawer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ConnectSDK/Connect-SDK-Android-API-Sampler/HEAD/res/drawable-hdpi/ic_drawer.png -------------------------------------------------------------------------------- /res/drawable-mdpi/ic_drawer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ConnectSDK/Connect-SDK-Android-API-Sampler/HEAD/res/drawable-mdpi/ic_drawer.png -------------------------------------------------------------------------------- /res/drawable-mdpi/icon_12676.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ConnectSDK/Connect-SDK-Android-API-Sampler/HEAD/res/drawable-mdpi/icon_12676.png -------------------------------------------------------------------------------- /res/drawable-mdpi/icon_15111.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ConnectSDK/Connect-SDK-Android-API-Sampler/HEAD/res/drawable-mdpi/icon_15111.png -------------------------------------------------------------------------------- /res/drawable-mdpi/icon_15307.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ConnectSDK/Connect-SDK-Android-API-Sampler/HEAD/res/drawable-mdpi/icon_15307.png -------------------------------------------------------------------------------- /res/drawable-mdpi/icon_17114.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ConnectSDK/Connect-SDK-Android-API-Sampler/HEAD/res/drawable-mdpi/icon_17114.png -------------------------------------------------------------------------------- /res/drawable-mdpi/icon_17183.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ConnectSDK/Connect-SDK-Android-API-Sampler/HEAD/res/drawable-mdpi/icon_17183.png -------------------------------------------------------------------------------- /res/drawable-mdpi/icon_3330.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ConnectSDK/Connect-SDK-Android-API-Sampler/HEAD/res/drawable-mdpi/icon_3330.png -------------------------------------------------------------------------------- /res/drawable-xhdpi/ic_drawer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ConnectSDK/Connect-SDK-Android-API-Sampler/HEAD/res/drawable-xhdpi/ic_drawer.png -------------------------------------------------------------------------------- /res/drawable-xhdpi/icon_3330.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ConnectSDK/Connect-SDK-Android-API-Sampler/HEAD/res/drawable-xhdpi/icon_3330.png -------------------------------------------------------------------------------- /res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ConnectSDK/Connect-SDK-Android-API-Sampler/HEAD/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ConnectSDK/Connect-SDK-Android-API-Sampler/HEAD/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ConnectSDK/Connect-SDK-Android-API-Sampler/HEAD/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /res/drawable-xhdpi/icon_12676.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ConnectSDK/Connect-SDK-Android-API-Sampler/HEAD/res/drawable-xhdpi/icon_12676.png -------------------------------------------------------------------------------- /res/drawable-xhdpi/icon_15111.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ConnectSDK/Connect-SDK-Android-API-Sampler/HEAD/res/drawable-xhdpi/icon_15111.png -------------------------------------------------------------------------------- /res/drawable-xhdpi/icon_15307.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ConnectSDK/Connect-SDK-Android-API-Sampler/HEAD/res/drawable-xhdpi/icon_15307.png -------------------------------------------------------------------------------- /res/drawable-xhdpi/icon_17114.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ConnectSDK/Connect-SDK-Android-API-Sampler/HEAD/res/drawable-xhdpi/icon_17114.png -------------------------------------------------------------------------------- /res/drawable-xhdpi/icon_17183.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ConnectSDK/Connect-SDK-Android-API-Sampler/HEAD/res/drawable-xhdpi/icon_17183.png -------------------------------------------------------------------------------- /res/drawable-xxhdpi/ic_drawer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ConnectSDK/Connect-SDK-Android-API-Sampler/HEAD/res/drawable-xxhdpi/ic_drawer.png -------------------------------------------------------------------------------- /res/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ConnectSDK/Connect-SDK-Android-API-Sampler/HEAD/res/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /res/drawable-hdpi/drawer_shadow.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ConnectSDK/Connect-SDK-Android-API-Sampler/HEAD/res/drawable-hdpi/drawer_shadow.9.png -------------------------------------------------------------------------------- /res/drawable-mdpi/drawer_shadow.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ConnectSDK/Connect-SDK-Android-API-Sampler/HEAD/res/drawable-mdpi/drawer_shadow.9.png -------------------------------------------------------------------------------- /res/drawable-xhdpi/drawer_shadow.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ConnectSDK/Connect-SDK-Android-API-Sampler/HEAD/res/drawable-xhdpi/drawer_shadow.9.png -------------------------------------------------------------------------------- /res/drawable-xxhdpi/drawer_shadow.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ConnectSDK/Connect-SDK-Android-API-Sampler/HEAD/res/drawable-xxhdpi/drawer_shadow.9.png -------------------------------------------------------------------------------- /res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /lint.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | -------------------------------------------------------------------------------- /res/menu/main.xml: -------------------------------------------------------------------------------- 1 | 5 | 8 | 9 | -------------------------------------------------------------------------------- /res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /res/layout/fragment_navigation_drawer.xml: -------------------------------------------------------------------------------- 1 | 10 | -------------------------------------------------------------------------------- /res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 6 | 8 | 240dp 9 | 10 | -------------------------------------------------------------------------------- /project.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must be checked in Version Control Systems. 5 | # 6 | # To customize properties used by the Ant build system edit 7 | # "ant.properties", and override values to adapt the script to your 8 | # project structure. 9 | # 10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): 11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt 12 | 13 | # Project target. 14 | target=android-22 15 | android.library.reference.1=../Connect-SDK-Android/core 16 | android.library.reference.2=../Connect-SDK-Android/modules/google_cast 17 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # built application files 2 | *.apk 3 | *.ap_ 4 | 5 | # files for the dex VM 6 | *.dex 7 | 8 | # Java class files 9 | *.class 10 | 11 | # generated files 12 | bin/ 13 | gen/ 14 | 15 | # Ignore gradle files 16 | .gradle/ 17 | build/ 18 | 19 | # Local configuration file (sdk path, etc) 20 | local.properties 21 | 22 | # Proguard folder generated by Eclipse 23 | proguard/ 24 | 25 | *.pydevproject 26 | .project 27 | .metadata 28 | bin/** 29 | tmp/** 30 | tmp/**/* 31 | *.tmp 32 | *.bak 33 | *.swp 34 | *~.nib 35 | local.properties 36 | .classpath 37 | .settings/ 38 | .loadpath 39 | 40 | # External tool builders 41 | .externalToolBuilders/ 42 | 43 | # Locally stored "Eclipse launch configurations" 44 | *.launch 45 | 46 | # CDT-specific 47 | .cproject 48 | 49 | # PDT-specific 50 | .buildpath -------------------------------------------------------------------------------- /proguard-project.txt: -------------------------------------------------------------------------------- 1 | # To enable ProGuard in your project, edit project.properties 2 | # to define the proguard.config property as described in that file. 3 | # 4 | # Add project specific ProGuard rules here. 5 | # By default, the flags in this file are appended to flags specified 6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt 7 | # You can edit the include path and order by changing the ProGuard 8 | # include property in project.properties. 9 | # 10 | # For more details, see 11 | # http://developer.android.com/guide/developing/tools/proguard.html 12 | 13 | # Add any project specific keep options here: 14 | 15 | # If your project uses WebView with JS, uncomment the following 16 | # and specify the fully qualified class name to the JavaScript interface 17 | # class: 18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 19 | # public *; 20 | #} 21 | -------------------------------------------------------------------------------- /src/com/connectsdk/sampler/MainApplication.java: -------------------------------------------------------------------------------- 1 | // 2 | // Connect SDK Sample App by LG Electronics 3 | // 4 | // To the extent possible under law, the person who associated CC0 with 5 | // this sample app has waived all copyright and related or neighboring rights 6 | // to the sample app. 7 | // 8 | // You should have received a copy of the CC0 legalcode along with this 9 | // work. If not, see http://creativecommons.org/publicdomain/zero/1.0/. 10 | // 11 | 12 | package com.connectsdk.sampler; 13 | 14 | import android.app.Application; 15 | 16 | import com.connectsdk.discovery.DiscoveryManager; 17 | import com.connectsdk.service.DIALService; 18 | 19 | public class MainApplication extends Application { 20 | @Override 21 | public void onCreate() { 22 | DIALService.registerApp("Levak"); 23 | DiscoveryManager.init(getApplicationContext()); 24 | 25 | super.onCreate(); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /res/layout/app_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 12 | 18 | 24 | 25 | 26 | 35 | 36 | -------------------------------------------------------------------------------- /res/layout/channel_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 12 | 18 | 24 | 25 | 26 | 35 | 36 | -------------------------------------------------------------------------------- /AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 21 | 22 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | #Connect SDK Sampler App for Android 2 | 3 | Connect SDK is an open source framework that connects your mobile apps with multiple TV platforms. Because most TV platforms support a variety of protocols, Connect SDK integrates and abstracts the discovery and connectivity between all supported protocols. 4 | 5 | For more information, visit our [website](http://www.connectsdk.com/). 6 | 7 | * [General information about Connect SDK](http://www.connectsdk.com/discover/) 8 | * [Platform documentation & FAQs](http://www.connectsdk.com/docs/android/) 9 | * [API documentation](http://www.connectsdk.com/apis/android/) 10 | 11 | ##Dependencies 12 | - [Android v7 appcompat library](http://developer.android.com/tools/support-library/features.html#v7-appcompat) 13 | - Android SDK v22 (the Sampler app targets v22, but works on v10 and greater) 14 | - [Connect-SDK-Android-Core](https://github.com/ConnectSDK/Connect-SDK-Android-Core) 15 | - [Connect-SDK-Android-Google-Cast](https://github.com/ConnectSDK/Connect-SDK-Android-Google-Cast) for full version of Connect-SDK 16 | 17 | ##Setup with Android Studio 18 | 1. Download the Sampler project 19 | ``` 20 | git clone https://github.com/ConnectSDK/Connect-SDK-Android-API-Sampler.git 21 | ``` 22 | 2. Import the Sampler project into Android Studio 23 | 24 | ##Using dev branch 25 | If you use dev branch you should [setup](https://github.com/ConnectSDK/Connect-SDK-Android#including-connect-sdk-in-your-app-with-android-studio-from-sources) Connect-SDK-Android from sources and you should use Connect-SDK-Android dev branch as well 26 | 27 | ##Contact 28 | * Twitter [@ConnectSDK](https://www.twitter.com/ConnectSDK) 29 | * Ask a question on Stack Overflow with the [Connect-SDK tag](https://stackoverflow.com/tags/connect-sdk) (or [TV tag](https://stackoverflow.com/tags/tv)) 30 | * General Inquiries info@connectsdk.com 31 | * Developer Support support@connectsdk.com 32 | * Partnerships partners@connectsdk.com 33 | 34 | ##License 35 | 36 | Connect SDK Sample App by LG Electronics 37 | 38 | To the extent possible under law, the person who associated CC0 with 39 | this sample app has waived all copyright and related or neighboring rights 40 | to the sample app. 41 | 42 | You should have received a copy of the CC0 legalcode along with this 43 | work. If not, see http://creativecommons.org/publicdomain/zero/1.0/. -------------------------------------------------------------------------------- /src/com/connectsdk/sampler/widget/AppAdapter.java: -------------------------------------------------------------------------------- 1 | // 2 | // Connect SDK Sample App by LG Electronics 3 | // 4 | // To the extent possible under law, the person who associated CC0 with 5 | // this sample app has waived all copyright and related or neighboring rights 6 | // to the sample app. 7 | // 8 | // You should have received a copy of the CC0 legalcode along with this 9 | // work. If not, see http://creativecommons.org/publicdomain/zero/1.0/. 10 | // 11 | 12 | package com.connectsdk.sampler.widget; 13 | 14 | import java.util.Comparator; 15 | 16 | import android.content.Context; 17 | import android.graphics.Color; 18 | import android.view.View; 19 | import android.view.ViewGroup; 20 | import android.widget.ArrayAdapter; 21 | import android.widget.ImageView; 22 | import android.widget.TextView; 23 | 24 | import com.connectsdk.core.AppInfo; 25 | import com.connectsdk.sampler.R; 26 | 27 | public class AppAdapter extends ArrayAdapter { 28 | Context context; 29 | int resourceId; 30 | String runningAppId; 31 | 32 | public AppAdapter(Context context, int resource) { 33 | super(context, resource); 34 | this.context = context; 35 | this.resourceId = resource; 36 | } 37 | 38 | @Override 39 | public View getView(int position, View convertView, ViewGroup parent) { 40 | View view = convertView; 41 | 42 | if (convertView == null) { 43 | view = View.inflate(getContext(), resourceId, null); 44 | } 45 | 46 | AppInfo app = this.getItem(position); 47 | 48 | TextView textView = (TextView) view.findViewById(R.id.itemTitle); 49 | TextView subTextView = (TextView) view.findViewById(R.id.itemSubTitle); 50 | ImageView imageView = (ImageView) view.findViewById(R.id.itemCheck); 51 | textView.setText(app.getName()); 52 | subTextView.setText(app.getId()); 53 | if (runningAppId != null && runningAppId.equals(app.getId())) { 54 | System.out.println("runningAppId: " + runningAppId + ", id: " + app.getId()); 55 | textView.setTextColor(Color.RED); 56 | imageView.setVisibility(View.VISIBLE); 57 | } else { 58 | textView.setTextColor(Color.BLACK); 59 | imageView.setVisibility(View.INVISIBLE); 60 | } 61 | 62 | return view; 63 | } 64 | 65 | public void setRunningAppId(String appId) { 66 | runningAppId = appId; 67 | } 68 | 69 | public void sort() { 70 | this.sort(new Comparator() { 71 | @Override 72 | public int compare(AppInfo lhs, AppInfo rhs) { 73 | return lhs.getName().compareTo(rhs.getName()); 74 | } 75 | }); 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /res/layout/fragment_apps.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 20 | 21 | 28 | 29 |