Commit 1223625d authored by Tassilo Busche's avatar Tassilo Busche

new Tickaroo SDK

parent 91480572
apply plugin: "com.android.application"
apply plugin: "kotlin-android"
apply plugin: "kotlin-android-extensions"
apply plugin: 'com.getkeepsafe.dexcount'
android {
compileSdkVersion rootProject.ext.compileSdkVersion
......@@ -11,10 +8,7 @@ android {
applicationId "com.tickaroo.sdksample"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionName '2.8.1'
multiDexEnabled true
versionName '3.3.0'
}
signingConfigs {
......@@ -25,15 +19,19 @@ android {
buildTypes {
release {
debuggable false
minifyEnabled false
minifyEnabled true
shrinkResources true
useProguard true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
debug {
minifyEnabled true
applicationIdSuffix ".debug"
shrinkResources true
useProguard true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
applicationIdSuffix ".debug"
debuggable true
}
}
......@@ -47,7 +45,7 @@ android {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation("com.tickaroo:sdk:3.0.4")
implementation("com.tickaroo:sdk:3.3.0")
implementation("com.tickaroo:sdk-read:3.3.0")
implementation("com.tickaroo:sdk-videoclips:3.3.0")
}
......@@ -6,11 +6,11 @@
<uses-permission android:name="android.permission.INTERNET" />
<application
android:name=".SampleApplication"
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:label="@string/app_name"
android:theme="@style/Theme.Design.Light.NoActionBar"
android:theme="@style/Theme.AppCompat.Light.DarkActionBar"
android:supportsRtl="true">
<activity android:name="com.tickaroo.sdkandroiddemo.SampleActivity">
......
package com.tickaroo.sdkandroiddemo;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.Toast;
import com.tickaroo.apimodel.ITickerRef;
import com.tickaroo.apimodel.ITickerWriteVideoClipRef;
import com.tickaroo.apimodel.android.TickerRef;
import com.tickaroo.apimodel.android.TickerWriteVideoClipRef;
import com.tickaroo.common.config.track.TikUserTrackingInfo;
import com.tickaroo.sdk.ScoreboardImageMode;
import com.tickaroo.sdk.TickarooSDK;
import com.tickaroo.sdk.TickarooSDKRefCallback;
import com.tickaroo.sdk.TickarooSDKSportstypes;
import com.tickaroo.sdk.read.TickarooSDKReadModule;
import com.tickaroo.sdk.videoclips.TickarooSDKVideoclipsModule;
import java.util.ArrayList;
public class SampleActivity extends Activity {
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sample);
}
@Override
public void onContentChanged() {
super.onContentChanged();
if (TickarooSDK.isInitialized()) {
findViewById(R.id.pre_init).setVisibility(View.GONE);
findViewById(R.id.post_init).setVisibility(View.VISIBLE);
}
findViewById(R.id.init_owner).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (!TickarooSDK.isInitialized()) {
TickarooSDKSportstypes[] sportstypes = { TickarooSDKSportstypes.SOCCER };
new TickarooSDK.Builder()
.addModule(new TickarooSDKReadModule())
.addModule(new TickarooSDKVideoclipsModule(sportstypes))
.setApiAppName("Tickaroo SDK Sample")
.setApiClientId("57a4a6dde4b09371f9e75743")
.setDelegate(new SampleDelegate())
.setLoginManager(new SampleLoginManager())
.setAdProvider(new SampleAdProvider())
.setScoreboardImageMode(ScoreboardImageMode.ScoreboardImageModeOwner)
.build(SampleActivity.this);
}
findViewById(R.id.pre_init).setVisibility(View.GONE);
findViewById(R.id.post_init).setVisibility(View.VISIBLE);
}
});
findViewById(R.id.init_empty).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (!TickarooSDK.isInitialized()) {
TickarooSDKSportstypes[] sportstypes = { TickarooSDKSportstypes.SOCCER };
new TickarooSDK.Builder()
.addModule(new TickarooSDKReadModule())
.addModule(new TickarooSDKVideoclipsModule(sportstypes))
.setApiAppName("Tickaroo SDK Sample")
.setApiClientId("57a4a6dde4b09371f9e75743")
.setDelegate(new SampleDelegate())
.setLoginManager(new SampleLoginManager())
.setAdProvider(new SampleAdProvider())
.setScoreboardImageMode(ScoreboardImageMode.ScoreboardImageModeNone)
.build(SampleActivity.this);
}
findViewById(R.id.pre_init).setVisibility(View.GONE);
findViewById(R.id.post_init).setVisibility(View.VISIBLE);
}
});
findViewById(R.id.sample_news).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ITickerRef tickerRef = new TickerRef();
tickerRef.setTickerId("58e3b1ebf7596cf6cfae69c1");
ArrayList<TikUserTrackingInfo> userTrackingInfos = new ArrayList<>();
userTrackingInfos.add(new TikUserTrackingInfo("userTrackInfo1", "value " + tickerRef.getTickerId()));
TickarooSDK.requestIntentForRef(SampleActivity.this, tickerRef, userTrackingInfos, new TickarooSDKRefCallback() {
@Override
public void callback(@Nullable Intent intent) {
if (intent != null) {
startActivity(intent);
} else {
Toast.makeText(SampleActivity.this, "Something went wrong.", Toast.LENGTH_SHORT).show();
}
}
});
}
});
findViewById(R.id.sample_news_without_scoreboard).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ITickerRef tickerRef = new TickerRef();
tickerRef.setTickerId("58e3b1ebf7596cf6cfae69c1");
tickerRef.setShowScoreboard(false);
ArrayList<TikUserTrackingInfo> userTrackingInfos = new ArrayList<>();
userTrackingInfos.add(new TikUserTrackingInfo("userTrackInfo1", "value " + tickerRef.getTickerId()));
TickarooSDK.requestIntentForRef(SampleActivity.this, tickerRef, userTrackingInfos, new TickarooSDKRefCallback() {
@Override
public void callback(@Nullable Intent intent) {
if (intent != null) {
startActivity(intent);
} else {
Toast.makeText(SampleActivity.this, "Something went wrong.", Toast.LENGTH_SHORT).show();
}
}
});
}
});
findViewById(R.id.sample_soccer).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ITickerRef tickerRef = new TickerRef();
tickerRef.setTickerId("5c1358cd221cc0cda54d91b9");
ArrayList<TikUserTrackingInfo> userTrackingInfos = new ArrayList<>();
userTrackingInfos.add(new TikUserTrackingInfo("userTrackInfo1", "value " + tickerRef.getTickerId()));
TickarooSDK.requestIntentForRef(SampleActivity.this, tickerRef, userTrackingInfos, new TickarooSDKRefCallback() {
@Override
public void callback(@Nullable Intent intent) {
if (intent != null) {
startActivity(intent);
} else {
Toast.makeText(SampleActivity.this, "Something went wrong.", Toast.LENGTH_SHORT).show();
}
}
});
}
});
findViewById(R.id.videoclips).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ITickerWriteVideoClipRef videoRef = new TickerWriteVideoClipRef();
videoRef.setLocalId("00jpnpn53l4ttugsf8kg4f");
TickarooSDK.requestIntentForRef(SampleActivity.this, videoRef, new TickarooSDKRefCallback() {
@Override
public void callback(@Nullable Intent intent) {
if (intent != null) {
startActivity(intent);
} else {
Toast.makeText(SampleActivity.this, "Something went wrong.", Toast.LENGTH_SHORT).show();
}
}
});
}
});
}
}
\ No newline at end of file
package com.tickaroo.sdkandroiddemo
import android.app.Activity
import android.os.Bundle
import android.view.View.GONE
import android.view.View.VISIBLE
import android.widget.Toast
import com.tickaroo.apimodel.android.TickerRef
import com.tickaroo.common.config.track.TikUserTrackingInfo
import com.tickaroo.sdk.RefreshBehaviour.RefreshAuto
import com.tickaroo.sdk.ScoreboardImageMode.ScoreboardImageModeNone
import com.tickaroo.sdk.ScoreboardImageMode.ScoreboardImageModeOwner
import com.tickaroo.sdk.TickarooEmbedManager
import kotlinx.android.synthetic.main.activity_sample.*
import java.util.ArrayList
/**
* Created by tassi on 27.03.17.
*/
class SampleActivity : Activity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_sample)
init_owner.setOnClickListener {
try {
TickarooEmbedManager(this, "Tickaroo Sample", resources.getString(R.string.client_id),
RefreshAuto, ScoreboardImageModeOwner, SampleDelegate(), tikAdProvider = SampleAdProvider(), apiHost = "www.tickaroo.com")
pre_init.visibility = GONE
post_init.visibility = VISIBLE
} catch (e: IllegalStateException) {
exceptionHandler(e)
}
}
init_empty.setOnClickListener {
try {
TickarooEmbedManager(this, "Tickaroo Sample", resources.getString(R.string.client_id),
RefreshAuto, ScoreboardImageModeNone, SampleDelegate(), tikAdProvider = SampleAdProvider(), apiHost = "www.tickaroo.com")
pre_init.visibility = GONE
post_init.visibility = VISIBLE
} catch (e: IllegalStateException) {
exceptionHandler(e)
}
}
sample_news.setOnClickListener {
try {
val tickerRef = TickerRef()
tickerRef.tickerId = "5afd1e1209bfcbd85c1da6b6"
val userTrackInfos = arrayListOf<TikUserTrackingInfo>()
userTrackInfos.add(TikUserTrackingInfo("userTrackInfo1", "value ${tickerRef.tickerId}"))
startActivity(TickarooEmbedManager.tickerIntentForRef(this, tickerRef, userTrackInfos = userTrackInfos))
} catch (e: IllegalStateException) {
exceptionHandler(e)
}
}
sample_news_without_scoreboard.setOnClickListener {
try {
val tickerRef = TickerRef()
tickerRef.tickerId = "5afd1e1209bfcbd85c1da6b6"
tickerRef.showScoreboard = false
tickerRef.eventLocalId
val userTrackInfos = arrayListOf<TikUserTrackingInfo>()
userTrackInfos.add(TikUserTrackingInfo("userTrackInfo", "value ${tickerRef.tickerId}"))
startActivity(TickarooEmbedManager.tickerIntentForRef(this, tickerRef, title = "News without scoreboard", userTrackInfos = userTrackInfos))
} catch (e: IllegalStateException) {
exceptionHandler(e)
}
}
sample_soccer.setOnClickListener {
try {
val tickerRef = TickerRef()
tickerRef.tickerId = "5afd22ab09bfcbd85c1da6e4"
val userTrackInfos = arrayListOf<TikUserTrackingInfo>()
userTrackInfos.add(TikUserTrackingInfo("userTrackInfo1", "value ${tickerRef.tickerId}"))
startActivity(TickarooEmbedManager.tickerIntentForRef(this, tickerRef, userTrackInfos = userTrackInfos))
} catch (e: IllegalStateException) {
exceptionHandler(e)
}
}
sample2.setOnClickListener {
try {
val tickerRef = TickerRef()
tickerRef.tickerId = "58e3b1ebf7596cf6cfae69c1"
val userTrackInfos = arrayListOf<TikUserTrackingInfo>()
userTrackInfos.add(TikUserTrackingInfo("userTrackInfo1", "value ${tickerRef.tickerId}"))
startActivity(TickarooEmbedManager.tickerIntentForRef(this, tickerRef, userTrackInfos = userTrackInfos))
} catch (e: IllegalStateException) {
exceptionHandler(e)
}
}
illegal_ref.setOnClickListener {
try {
startActivity(TickarooEmbedManager.tickerIntentForId(this, "foobar"))
} catch (e: IllegalStateException) {
exceptionHandler(e)
}
}
init_again.setOnClickListener {
try {
TickarooEmbedManager(this, "Tickaroo Sample", resources.getString(R.string.client_id),
RefreshAuto, ScoreboardImageModeOwner, SampleDelegate(), tikAdProvider = SampleAdProvider(), apiHost = "www.tickaroo.com")
} catch (e: IllegalStateException) {
exceptionHandler(e)
}
}
}
fun exceptionHandler(e: Exception) {
Toast.makeText(applicationContext, "${e::class.java.canonicalName}: ${e.localizedMessage}", Toast.LENGTH_SHORT).show()
}
override fun onBackPressed() {
super.onBackPressed()
System.exit(0)
}
}
\ No newline at end of file
package com.tickaroo.sdkandroiddemo;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import android.widget.Toast;
import com.tickaroo.apimodel.IAdRow;
import com.tickaroo.sdk.TickarooSDKAdProvider;
import org.jetbrains.annotations.NotNull;
public class SampleAdProvider implements TickarooSDKAdProvider {
@NotNull
@Override
public View provideAdRow(@NotNull ViewGroup parent, @NotNull IAdRow row, final int position) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.ad_row_sample, parent, false);
((TextView) view.findViewById(R.id.tickaroo_ad_row_example_text1)).setText("AdRow – position " + position);
((TextView) view.findViewById(R.id.tickaroo_ad_row_example_text2)).setText(row.getPlacementId());
parent.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(v.getContext(), "Position " + position + " clicked", Toast.LENGTH_LONG).show();
}
});
return view;
}
}
package com.tickaroo.sdkandroiddemo
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Toast
import com.tickaroo.apimodel.IAdRow
import com.tickaroo.common.config.ad.TikAdProvider
import kotlinx.android.synthetic.main.ad_row_sample.view.tickaroo_ad_row_example_text1
import kotlinx.android.synthetic.main.ad_row_sample.view.tickaroo_ad_row_example_text2
class SampleAdProvider : TikAdProvider {
override fun provideAdRow(parent: ViewGroup, row: IAdRow, position: Int): View {
val view = LayoutInflater.from(parent.context).inflate(R.layout.ad_row_sample, parent, false)
view.tickaroo_ad_row_example_text1.text = "AdRow position - ${position}"
view.tickaroo_ad_row_example_text2.text = "${row.placementId}"
parent.setOnClickListener {
Toast.makeText(parent.context, "Clicked", Toast.LENGTH_LONG).show()
}
return view
}
}
\ No newline at end of file
package com.tickaroo.sdkandroiddemo
import android.app.Application
/**
* Created by tassi on 27.03.17.
*/
class SampleApplication : Application(){
}
\ No newline at end of file
package com.tickaroo.sdkandroiddemo;
import android.util.Log;
import com.tickaroo.apimodel.analytics.IEvent;
import com.tickaroo.sdk.LoadingType;
import com.tickaroo.sdk.TickarooSDKDelegate;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.Map;
public class SampleDelegate extends TickarooSDKDelegate {
private String TAG = "SDK SAMPLE";
@Override
public void trackView(@NotNull String view, @NotNull LoadingType type, @Nullable Map<String, Object> userInfos) {
Log.d(TAG, "View Tracked: " + view + ", " + type + ", " + userInfos);
}
@Override
public void trackEvent(@NotNull String category, @NotNull String action) {
Log.d(TAG, "Event Tracked: " + category + ", " + action);
}
@Override
public void didTrackEvent(@NotNull IEvent event) {
Log.d(TAG, "Did track Event: " + event);
}
}
package com.tickaroo.sdkandroiddemo
import android.content.Context
import android.util.Log
import com.tickaroo.apimodel.IAbstractRef
import com.tickaroo.apimodel.analytics.IEvent
import com.tickaroo.sdk.LoadingType
import com.tickaroo.sdk.TickarooEmbedManagerDelegate
/**
* Created by tassi on 27.03.17.
*/
class SampleDelegate : TickarooEmbedManagerDelegate(){
val TAG = "SDK SAMPLE"
override fun trackView(view: String, type: LoadingType,
userInfos: MutableMap<String, Any>?) {
Log.d(TAG, "View Tracked: $view, $type, $userInfos")
}
override fun trackEvent(category: String, action: String) {
Log.d(TAG, "Event Tracked: $category, $action")
}
override fun didTrackEvent(event: IEvent) {
Log.d(TAG, "Did track Event: $event")
}
override fun navigateToRef(ref: IAbstractRef, context: Context?): Boolean {
Log.d(TAG, "navigated to ref ${ref._type}")
return false
}
}
\ No newline at end of file
package com.tickaroo.sdkandroiddemo;
import com.tickaroo.sdk.TickarooSDKLoginManager;
import org.jetbrains.annotations.NotNull;
public class SampleLoginManager implements TickarooSDKLoginManager {
@Override
public void requestLogin(@NotNull TickarooSDKLoginCallback callback) {
callback.loginCallback("xxxx", "000000000000000000000000", "xxxx");
}
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
......@@ -25,15 +25,6 @@
android:orientation="vertical"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:id="@+id/test_ticker_container"
>
</LinearLayout>
<TextView
android:id="@+id/init_owner"
android:layout_width="match_parent"
......@@ -50,18 +41,17 @@
android:text="Initialize without scoreboard image"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingEnd="20dp"
android:paddingStart="20dp"
android:paddingTop="20dp"
android:text="Livecast without prior initialization throws exception"
android:textSize="10sp"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/post_init"
android:orientation="vertical"
android:visibility="gone"
tools:visibility="visible"
>
<TextView
android:id="@+id/sample_news"
android:layout_width="match_parent"
......@@ -87,38 +77,13 @@
/>
<TextView
android:id="@+id/sample2"
android:id="@+id/videoclips"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="20dp"
android:text="Other livecast"
android:text="Videoclips Mode"
/>
<TextView
android:id="@+id/illegal_ref"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="20dp"
android:text="Invalid Ref"
/>
<LinearLayout
android:id="@+id/post_init"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:visibility="gone"
tools:visibility="visible"
>
<TextView
android:id="@+id/init_again"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="20dp"
android:text="Reinitialization(throws exception)"
/>
</LinearLayout>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Fonts -->
<string name="font_family_medium" translatable="false">sans-serif-light</string>
<string name="font_family_light" translatable="false">sans-serif-light</string>
<string name="font_family_black" translatable="false">sans-serif-light</string>
<string name="font_family_regular" translatable="false">sans-serif-light</string>
<string name="font_file_comic" translatable="false">Mono Test Font.ttf</string>
</resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#FF00DD</color>
<color name="colorPrimaryDark">#DDDD00</color>
<color name="colorAccent">#00DDFF</color>
<color name="colorPrimary">@color/tickaroo_primary_color</color>
<color name="colorPrimaryDark">@color/tickaroo_primary_color_dark</color>
<color name="colorAccent">@color/tickaroo_accent_color</color>
<color name="ic_launcher_background">#07B789</color>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- colors -->
<color name="tickaroo_window_background">#f3f4f9</color>
<color name="tickaroo_primary_color">#234567</color>
<color name="tickaroo_primary_color_dark">#456789</color>
<color name="tickaroo_accent_color">#765432</color>
<color name="tickaroo_accent_color_dark">#98765432</color>
<!-- toolbar -->
<color name="tickaroo_gradient_start">#000000</color>
<color name="tickaroo_gradient_end">#FFFFFF</color>
<!-- scoreboard -->
<dimen name="tickaroo_scoreboard_margin_left">12dp</dimen>
<dimen name="tickaroo_scoreboard_toolbar_height">30dp</dimen>
<color name="tickaroo_scoreboard_background">#D3D3D3</color>
<!-- rows -->
<color name="tickaroo_card_background">#FFFFFF</color>
<dimen name="tickaroo_row_margin_left">14dp</dimen>
<dimen name="tickaroo_round_corners_radius">0dp</dimen>
<dimen name="tickaroo_round_corners_background_radius">0dp</dimen>
<color name="tickaroo_event_highlight_color">#123456</color>
<!-- milestone -->