-
Notifications
You must be signed in to change notification settings - Fork 17
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
39 changed files
with
3,605 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
.gradle | ||
/local.properties | ||
/.idea/workspace.xml | ||
/.idea/libraries | ||
.DS_Store | ||
/build | ||
/captures |
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 @@ | ||
/build |
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,33 @@ | ||
apply plugin: 'com.android.application' | ||
|
||
|
||
android { | ||
compileSdkVersion 21 | ||
buildToolsVersion "23.0.1" | ||
|
||
defaultConfig { | ||
applicationId "at.pansy.iptv" | ||
minSdkVersion 21 | ||
targetSdkVersion 21 | ||
versionCode 1 | ||
versionName "1.0" | ||
} | ||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
compile 'com.google.android.exoplayer:exoplayer:r1.5.0' | ||
} | ||
|
||
dependencies { | ||
compile fileTree(dir: 'libs', include: ['*.jar']) | ||
compile 'com.android.support:recyclerview-v7:21.0.3' | ||
compile 'com.android.support:leanback-v17:21.0.3' | ||
compile 'com.android.support:appcompat-v7:21.0.3' | ||
compile 'com.github.bumptech.glide:glide:3.4.+' | ||
} |
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,17 @@ | ||
# Add project specific ProGuard rules here. | ||
# By default, the flags in this file are appended to flags specified | ||
# in /home/notz/programs/android-sdk/tools/proguard/proguard-android.txt | ||
# You can edit the include path and order by changing the proguardFiles | ||
# directive in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# Add any project specific keep options here: | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} |
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,65 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="at.pansy.iptv" > | ||
|
||
<uses-permission android:name="android.permission.INTERNET" /> | ||
<uses-permission android:name="com.android.providers.tv.permission.READ_EPG_DATA" /> | ||
<uses-permission android:name="com.android.providers.tv.permission.WRITE_EPG_DATA" /> | ||
|
||
<uses-permission android:name="android.permission.READ_SYNC_STATS"/> | ||
<uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS"/> | ||
<uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS"/> | ||
|
||
<uses-feature | ||
android:name="android.hardware.touchscreen" | ||
android:required="false" /> | ||
<uses-feature | ||
android:name="android.software.leanback" | ||
android:required="true" /> | ||
<uses-feature | ||
android:name="android.software.live_tv" | ||
android:required="true" /> | ||
|
||
<application | ||
android:allowBackup="true" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:supportsRtl="true" | ||
android:theme="@style/Theme.Leanback" | ||
android:restrictedAccountType="at.pansy.iptv.account"> | ||
|
||
<activity android:name="at.pansy.iptv.activity.TvInputSetupActivity"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
</intent-filter> | ||
</activity> | ||
|
||
<service android:name=".service.TvInputService" | ||
android:permission="android.permission.BIND_TV_INPUT" | ||
android:label="@string/tv_input_label"> | ||
<intent-filter> | ||
<action android:name="android.media.tv.TvInputService" /> | ||
</intent-filter> | ||
<meta-data android:name="android.media.tv.input" | ||
android:resource="@xml/tvinputservice" /> | ||
</service> | ||
|
||
<service android:name=".service.SyncService" | ||
android:exported="true"> | ||
<intent-filter> | ||
<action android:name="android.content.SyncAdapter" /> | ||
</intent-filter> | ||
<meta-data android:name="android.content.SyncAdapter" | ||
android:resource="@xml/syncadapter" /> | ||
</service> | ||
|
||
<service android:name=".service.AccountService"> | ||
<intent-filter> | ||
<action android:name="android.accounts.AccountAuthenticator" /> | ||
</intent-filter> | ||
<meta-data android:name="android.accounts.AccountAuthenticator" | ||
android:resource="@xml/authenticator" /> | ||
</service> | ||
|
||
</application> | ||
</manifest> |
18 changes: 18 additions & 0 deletions
18
app/src/main/java/at/pansy/iptv/activity/TvInputSetupActivity.java
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,18 @@ | ||
package at.pansy.iptv.activity; | ||
|
||
import android.app.Activity; | ||
import android.os.Bundle; | ||
|
||
import at.pansy.iptv.R; | ||
|
||
/** | ||
* Created by notz. | ||
*/ | ||
public class TvInputSetupActivity extends Activity { | ||
@Override | ||
public void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
|
||
setContentView(R.layout.setup_activity); | ||
} | ||
} |
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,177 @@ | ||
/* | ||
* Copyright 2015 Google Inc. All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package at.pansy.iptv.domain; | ||
|
||
import android.content.ContentValues; | ||
import android.database.Cursor; | ||
import android.media.tv.TvContract; | ||
import android.text.TextUtils; | ||
|
||
import java.util.Objects; | ||
|
||
/** | ||
* A convenience class to create and insert program information into the database. | ||
*/ | ||
public final class Channel implements Comparable<Channel> { | ||
private static final long INVALID_LONG_VALUE = -1; | ||
|
||
private long channelId; | ||
private String displayName; | ||
private String displayNumber; | ||
private String internalProviderData; | ||
|
||
private Channel() { | ||
channelId = INVALID_LONG_VALUE; | ||
} | ||
|
||
public long getChannelId() { | ||
return channelId; | ||
} | ||
|
||
public String getDisplayName() { | ||
return displayName; | ||
} | ||
|
||
public String getDisplayNumber() { | ||
return displayNumber; | ||
} | ||
|
||
public String getInternalProviderData() { | ||
return internalProviderData; | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(channelId, displayName, displayNumber, internalProviderData); | ||
} | ||
|
||
@Override | ||
public boolean equals(Object other) { | ||
if (!(other instanceof Channel)) { | ||
return false; | ||
} | ||
Channel channel = (Channel) other; | ||
return channelId == channel.channelId | ||
&& Objects.equals(displayName, channel.displayName) | ||
&& Objects.equals(displayNumber, channel.displayNumber) | ||
&& Objects.equals(internalProviderData, channel.internalProviderData); | ||
} | ||
|
||
@Override | ||
public int compareTo(Channel other) { | ||
return Long.compare(channelId, other.channelId); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "Channel{" | ||
+ "channelId=" + channelId | ||
+ ", displayName=" + displayName | ||
+ ", displayNumber=" + displayNumber | ||
+ ", internalProviderData=" + internalProviderData | ||
+ "}"; | ||
} | ||
|
||
public void copyFrom(Channel other) { | ||
if (this == other) { | ||
return; | ||
} | ||
|
||
channelId = other.channelId; | ||
displayName = other.displayName; | ||
displayNumber = other.displayNumber; | ||
internalProviderData = other.internalProviderData; | ||
} | ||
|
||
public ContentValues toContentValues() { | ||
ContentValues values = new ContentValues(); | ||
if (!TextUtils.isEmpty(displayName)) { | ||
values.put(TvContract.Channels.COLUMN_DISPLAY_NAME, displayName); | ||
} else { | ||
values.putNull(TvContract.Channels.COLUMN_DISPLAY_NAME); | ||
} | ||
if (!TextUtils.isEmpty(displayNumber)) { | ||
values.put(TvContract.Channels.COLUMN_DISPLAY_NUMBER, displayNumber); | ||
} else { | ||
values.putNull(TvContract.Channels.COLUMN_DISPLAY_NUMBER); | ||
} | ||
if (!TextUtils.isEmpty(internalProviderData)) { | ||
values.put(TvContract.Channels.COLUMN_INTERNAL_PROVIDER_DATA, internalProviderData); | ||
} else { | ||
values.putNull(TvContract.Channels.COLUMN_INTERNAL_PROVIDER_DATA); | ||
} | ||
return values; | ||
} | ||
|
||
public static Channel fromCursor(Cursor cursor) { | ||
Builder builder = new Builder(); | ||
int index = cursor.getColumnIndex(TvContract.Channels._ID); | ||
if (index >= 0 && !cursor.isNull(index)) { | ||
builder.setChannelId(cursor.getLong(index)); | ||
} | ||
index = cursor.getColumnIndex(TvContract.Channels.COLUMN_DISPLAY_NAME); | ||
if (index >= 0 && !cursor.isNull(index)) { | ||
builder.setDisplayName(cursor.getString(index)); | ||
} | ||
index = cursor.getColumnIndex(TvContract.Channels.COLUMN_DISPLAY_NUMBER); | ||
if (index >= 0 && !cursor.isNull(index)) { | ||
builder.setDisplayNumber(cursor.getString(index)); | ||
} | ||
index = cursor.getColumnIndex(TvContract.Channels.COLUMN_INTERNAL_PROVIDER_DATA); | ||
if (index >= 0 && !cursor.isNull(index)) { | ||
builder.setInternalProviderData(cursor.getString(index)); | ||
} | ||
return builder.build(); | ||
} | ||
|
||
public static final class Builder { | ||
private final Channel channel; | ||
|
||
public Builder() { | ||
channel = new Channel(); | ||
} | ||
|
||
public Builder(Channel other) { | ||
channel = new Channel(); | ||
channel.copyFrom(other); | ||
} | ||
|
||
public Builder setChannelId(long channelId) { | ||
channel.channelId = channelId; | ||
return this; | ||
} | ||
|
||
public Builder setDisplayName(String displayName) { | ||
channel.displayName = displayName; | ||
return this; | ||
} | ||
|
||
public Builder setDisplayNumber(String displayNumber) { | ||
channel.displayNumber = displayNumber; | ||
return this; | ||
} | ||
|
||
public Builder setInternalProviderData(String data) { | ||
channel.internalProviderData = data; | ||
return this; | ||
} | ||
|
||
public Channel build() { | ||
return channel; | ||
} | ||
} | ||
} |
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,29 @@ | ||
package at.pansy.iptv.domain; | ||
|
||
import android.media.tv.TvContentRating; | ||
|
||
/** | ||
* Created by notz. | ||
*/ | ||
public class PlaybackInfo { | ||
|
||
public static final int VIDEO_TYPE_HTTP_PROGRESSIVE = 0; | ||
public static final int VIDEO_TYPE_HLS = 1; | ||
public static final int VIDEO_TYPE_MPEG_DASH = 2; | ||
public static final int VIDEO_TYPE_OTHER = 3; | ||
|
||
public final long startTimeMs; | ||
public final long endTimeMs; | ||
public final String videoUrl; | ||
public final int videoType; | ||
public final TvContentRating[] contentRatings; | ||
|
||
public PlaybackInfo(long startTimeMs, long endTimeMs, String videoUrl, int videoType, | ||
TvContentRating[] contentRatings) { | ||
this.startTimeMs = startTimeMs; | ||
this.endTimeMs = endTimeMs; | ||
this.contentRatings = contentRatings; | ||
this.videoUrl = videoUrl; | ||
this.videoType = videoType; | ||
} | ||
} |
Oops, something went wrong.