Skip to content

Commit

Permalink
Upgrade SDK version and fix build error
Browse files Browse the repository at this point in the history
  • Loading branch information
jonghenhan committed May 24, 2022
1 parent db4e662 commit d7e8e89
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 24 deletions.
6 changes: 4 additions & 2 deletions AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
android:theme="@style/AppTheme"
android:usesCleartextTraffic="true" >

<activity
android:name="com.connectsdk.sampler.MainActivity"
android:windowSoftInputMode="stateHidden"
android:label="@string/app_name"
android:screenOrientation="portrait" >
android:screenOrientation="portrait"
android:exported="true" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand Down
18 changes: 11 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.1'
classpath 'com.android.tools.build:gradle:7.0.2'
}
}

Expand All @@ -20,12 +20,12 @@ allprojects {
apply plugin: 'com.android.application'

android {
compileSdkVersion 22
compileSdkVersion 31

defaultConfig {
applicationId "com.connectsdk.sampler"
minSdkVersion 10
targetSdkVersion 22
minSdkVersion 24
targetSdkVersion 31
}

sourceSets {
Expand All @@ -49,10 +49,14 @@ android {
}
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}

dependencies {
implementation 'com.github.ConnectSDK:Connect-SDK-Android-Lite:master-SNAPSHOT'
implementation 'com.android.support:support-v4:22.2.1'
implementation 'com.android.support:appcompat-v7:22.+'
implementation 'com.github.ConnectSDK:Connect-SDK-Android:master-SNAPSHOT'
implementation 'androidx.appcompat:appcompat:1.4.0'
implementation "androidx.viewpager2:viewpager2:1.0.0"
}
2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
android.enableJetifier=true
android.useAndroidX=true
3 changes: 2 additions & 1 deletion res/layout/activity_main.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<android.support.v4.view.ViewPager xmlns:android="http://schemas.android.com/apk/res/android"
<?xml version="1.0" encoding="utf-8"?>
<androidx.viewpager.widget.ViewPager xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/pager"
android:layout_width="match_parent"
Expand Down
Empty file added settings.gradle
Empty file.
19 changes: 10 additions & 9 deletions src/com/connectsdk/sampler/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@
import android.content.DialogInterface;
import android.os.Bundle;
import android.os.Handler;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.view.ViewPager;
import android.support.v7.app.ActionBar;
import android.support.v7.app.ActionBarActivity;
import android.text.InputType;
import android.util.Log;
import android.view.Menu;
Expand All @@ -30,6 +26,11 @@
import android.widget.EditText;
import android.widget.Toast;

import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.FragmentTransaction;
import androidx.viewpager.widget.ViewPager;

import com.connectsdk.device.ConnectableDevice;
import com.connectsdk.device.ConnectableDeviceListener;
import com.connectsdk.device.DevicePicker;
Expand All @@ -45,7 +46,7 @@
import java.util.ArrayList;
import java.util.List;

public class MainActivity extends ActionBarActivity implements ActionBar.TabListener {
public class MainActivity extends AppCompatActivity implements ActionBar.TabListener {

ConnectableDevice mTV;
AlertDialog dialog;
Expand Down Expand Up @@ -355,15 +356,15 @@ public boolean onOptionsItemSelected(MenuItem item) {
return super.onOptionsItemSelected(item);
}

@Override public void onTabUnselected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) { }
@Override public void onTabReselected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) { }

@Override
public void onTabSelected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) {
mViewPager.setCurrentItem(tab.getPosition());
getSupportActionBar().setTitle(mSectionsPagerAdapter.getTitle(tab.getPosition()));
setTitle(mSectionsPagerAdapter.getTitle(tab.getPosition()));
BaseFragment frag = mSectionsPagerAdapter.getFragment(tab.getPosition());
if (frag != null)
frag.setTv(mTV);
}

@Override public void onTabUnselected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) { }
@Override public void onTabReselected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) { }
}
7 changes: 4 additions & 3 deletions src/com/connectsdk/sampler/SectionsPagerAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@

import android.content.Context;
import android.content.res.TypedArray;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;

import com.connectsdk.sampler.fragments.AppsFragment;
import com.connectsdk.sampler.fragments.BaseFragment;
Expand Down
2 changes: 1 addition & 1 deletion src/com/connectsdk/sampler/fragments/BaseFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

import android.content.Context;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import androidx.fragment.app.Fragment;
import android.view.KeyEvent;
import android.widget.Button;

Expand Down
2 changes: 1 addition & 1 deletion src/com/connectsdk/sampler/fragments/WebAppFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public void enableButtons() {
}

if (getTv().getServiceByName(WEBOSID) != null)
webAppId = "WebAppTester";
webAppId = "SampleWebApp";
else if (getTv().getServiceByName(CASTID) != null)
webAppId = "DDCEDE96";
else if (getTv().getServiceByName(MULTISCREENID) != null)
Expand Down

0 comments on commit d7e8e89

Please sign in to comment.