diff --git a/app/build.gradle b/app/build.gradle index c2b27468c..fdf476805 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -61,7 +61,7 @@ dependencies { }) implementation 'androidx.appcompat:appcompat:1.6.1' implementation 'androidx.constraintlayout:constraintlayout:2.1.4' - implementation 'androidx.fragment:fragment-ktx:1.7.0-beta01' + implementation 'androidx.fragment:fragment-ktx:1.8.0-alpha02' implementation 'androidx.legacy:legacy-support-v4:1.0.0' implementation 'androidx.multidex:multidex:2.0.1' implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.28' @@ -89,13 +89,13 @@ dependencies { androidTestImplementation 'androidx.test:runner:1.5.2' implementation 'me.aflak.libraries:bluetooth:1.3.9' implementation 'com.caverock:androidsvg-aar:1.4' - implementation "androidx.core:core-ktx:1.12.0" + implementation "androidx.core:core-ktx:1.13.0" implementation 'com.android.support:multidex:1.0.3' implementation 'me.toptas.fancyshowcase:fancyshowcaseview:1.3.3' implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation 'org.connectbot:sshlib:2.2.9' - def lifecycle_version = "2.8.0-alpha03" + def lifecycle_version = "2.8.0-beta01" implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version" implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version" implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycle_version" diff --git a/app/src/main/kotlin/io/treehouses/remote/InitialActivity.kt b/app/src/main/kotlin/io/treehouses/remote/InitialActivity.kt index 305b1fa1d..24ab522dd 100644 --- a/app/src/main/kotlin/io/treehouses/remote/InitialActivity.kt +++ b/app/src/main/kotlin/io/treehouses/remote/InitialActivity.kt @@ -3,35 +3,30 @@ package io.treehouses.remote import android.content.Context import android.content.Intent import android.content.pm.PackageManager -import android.content.res.Configuration -import android.os.Build import android.os.Bundle -import android.util.DisplayMetrics import android.view.Menu import android.view.MenuItem import android.view.View import android.view.inputmethod.InputMethodManager import android.widget.Toast -import androidx.annotation.RequiresApi import androidx.appcompat.app.ActionBarDrawerToggle import androidx.appcompat.widget.Toolbar import androidx.core.view.GravityCompat import androidx.drawerlayout.widget.DrawerLayout import androidx.preference.PreferenceManager +import io.treehouses.remote.callback.BackPressReceiver +import io.treehouses.remote.databinding.ActivityInitial2Binding import io.treehouses.remote.fragments.CommunityFragment -import io.treehouses.remote.fragments.dialogfragments.FeedbackDialogFragment import io.treehouses.remote.fragments.DiscoverFragment import io.treehouses.remote.fragments.SettingsFragment -import io.treehouses.remote.callback.BackPressReceiver -import io.treehouses.remote.databinding.ActivityInitial2Binding import io.treehouses.remote.fragments.ShowBluetoothFileFragment +import io.treehouses.remote.fragments.dialogfragments.FeedbackDialogFragment import io.treehouses.remote.ui.home.HomeFragment import io.treehouses.remote.utils.DialogUtils import io.treehouses.remote.utils.GPSService class InitialActivity : BaseInitialActivity() { - @RequiresApi(Build.VERSION_CODES.JELLY_BEAN_MR1) override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) bind = ActivityInitial2Binding.inflate(layoutInflater) @@ -120,8 +115,8 @@ class InitialActivity : BaseInitialActivity() { bind.navView.setNavigationItemSelectedListener(this) } - @RequiresApi(Build.VERSION_CODES.JELLY_BEAN) override fun onBackPressed() { + super.onBackPressed() if (bind.drawerLayout.isDrawerOpen(GravityCompat.START)) bind.drawerLayout.closeDrawer(GravityCompat.START) else { val f = supportFragmentManager.findFragmentById(R.id.fragment_container) diff --git a/app/src/main/kotlin/io/treehouses/remote/IntroActivity.kt b/app/src/main/kotlin/io/treehouses/remote/IntroActivity.kt index 6923c10e6..03f76f7bb 100644 --- a/app/src/main/kotlin/io/treehouses/remote/IntroActivity.kt +++ b/app/src/main/kotlin/io/treehouses/remote/IntroActivity.kt @@ -54,7 +54,7 @@ class IntroActivity : AppCompatActivity() { } class IntroSlideWelcome(val listener: IntroPagerListener) : Fragment() { private lateinit var welcomeBind: IntroScreenWelcomeBinding - override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { + override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View { welcomeBind = IntroScreenWelcomeBinding.inflate(inflater, container, false) return welcomeBind.root } @@ -67,7 +67,7 @@ class IntroActivity : AppCompatActivity() { class IntroSlideDownload(val listener: IntroPagerListener) : Fragment() { private lateinit var downloadBind: IntroScreenDownloadBinding - override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { + override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View { downloadBind = IntroScreenDownloadBinding.inflate(inflater, container, false) return downloadBind.root } @@ -84,7 +84,7 @@ class IntroActivity : AppCompatActivity() { class IntroSlideBluetooth(val listener: IntroPagerListener) : Fragment() { private lateinit var bluetoothBind: IntroScreenBluetoothBinding - override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { + override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View { bluetoothBind = IntroScreenBluetoothBinding.inflate(inflater, container, false) return bluetoothBind.root } diff --git a/app/src/main/kotlin/io/treehouses/remote/MainApplication.kt b/app/src/main/kotlin/io/treehouses/remote/MainApplication.kt index 4456f1360..ad8ed48e4 100644 --- a/app/src/main/kotlin/io/treehouses/remote/MainApplication.kt +++ b/app/src/main/kotlin/io/treehouses/remote/MainApplication.kt @@ -7,21 +7,15 @@ import android.content.ComponentName import android.content.Context import android.content.Intent import android.content.ServiceConnection -import android.content.res.Configuration import android.os.Build import android.os.IBinder -import android.util.DisplayMetrics -import android.view.WindowManager -import androidx.annotation.RequiresApi import androidx.core.app.NotificationCompat import androidx.preference.PreferenceManager -import androidx.preference.SeekBarPreference import com.parse.Parse import io.treehouses.remote.network.BluetoothChatService import io.treehouses.remote.utils.SaveUtils import io.treehouses.remote.utils.logD import io.treehouses.remote.utils.logE -import java.util.* class MainApplication : Application() { var logSent = false diff --git a/app/src/main/kotlin/io/treehouses/remote/PreferenceConstants.kt b/app/src/main/kotlin/io/treehouses/remote/PreferenceConstants.kt index b01179a82..18ee98bd7 100644 --- a/app/src/main/kotlin/io/treehouses/remote/PreferenceConstants.kt +++ b/app/src/main/kotlin/io/treehouses/remote/PreferenceConstants.kt @@ -16,8 +16,6 @@ */ package io.treehouses.remote -import android.os.Build - /** * @author Kenny Root */ diff --git a/app/src/main/kotlin/io/treehouses/remote/SplashScreenActivity.kt b/app/src/main/kotlin/io/treehouses/remote/SplashScreenActivity.kt index 7370aad4e..6c4fede46 100644 --- a/app/src/main/kotlin/io/treehouses/remote/SplashScreenActivity.kt +++ b/app/src/main/kotlin/io/treehouses/remote/SplashScreenActivity.kt @@ -3,17 +3,14 @@ package io.treehouses.remote import android.content.Context import android.content.Intent import android.content.res.Configuration -import android.os.Build import android.os.Bundle import android.os.Handler import android.util.DisplayMetrics -import android.util.TypedValue import android.view.WindowManager import android.view.animation.Animation import android.view.animation.AnimationUtils import android.widget.ImageView import android.widget.TextView -import androidx.annotation.RequiresApi import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatDelegate import androidx.preference.PreferenceManager @@ -54,9 +51,7 @@ class SplashScreenActivity : AppCompatActivity() { wm.defaultDisplay.getMetrics(metrics) metrics.scaledDensity = configuration.fontScale * metrics.density - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { - baseContext.applicationContext.createConfigurationContext(it) - } + baseContext.applicationContext.createConfigurationContext(it) baseContext.resources.displayMetrics.setTo(metrics) } diff --git a/app/src/main/kotlin/io/treehouses/remote/Tutorials.kt b/app/src/main/kotlin/io/treehouses/remote/Tutorials.kt index 828af62d3..6929c21be 100644 --- a/app/src/main/kotlin/io/treehouses/remote/Tutorials.kt +++ b/app/src/main/kotlin/io/treehouses/remote/Tutorials.kt @@ -180,7 +180,7 @@ object Tutorials { show(a, b, c, d, e, f) } - public fun fancyShowCaseViewBuilderSkippable(activity: FragmentActivity, view: View, title: String, focusShape: FocusShape = FocusShape.CIRCLE): FancyShowCaseView.Builder { + fun fancyShowCaseViewBuilderSkippable(activity: FragmentActivity, view: View, title: String, focusShape: FocusShape = FocusShape.CIRCLE): FancyShowCaseView.Builder { return fancyShowCaseViewBuilder(activity, view, title, focusShape) .customView(R.layout.tutorial, object : OnViewInflateListener { override fun onViewInflated(view: View) { @@ -192,7 +192,7 @@ object Tutorials { }) } - public fun fancyShowCaseViewBuilder(activity: FragmentActivity, view: View, title: String, focusShape: FocusShape = FocusShape.CIRCLE): FancyShowCaseView.Builder { + fun fancyShowCaseViewBuilder(activity: FragmentActivity, view: View, title: String, focusShape: FocusShape = FocusShape.CIRCLE): FancyShowCaseView.Builder { return FancyShowCaseView.Builder(activity) .focusOn(view) .title(title) diff --git a/app/src/main/kotlin/io/treehouses/remote/adapter/RPIListAdapter.kt b/app/src/main/kotlin/io/treehouses/remote/adapter/RPIListAdapter.kt index a1fff6687..4902f42f0 100644 --- a/app/src/main/kotlin/io/treehouses/remote/adapter/RPIListAdapter.kt +++ b/app/src/main/kotlin/io/treehouses/remote/adapter/RPIListAdapter.kt @@ -13,7 +13,7 @@ import io.treehouses.remote.callback.DeviceDeleteListener import io.treehouses.remote.pojo.DeviceInfo class RPIListAdapter(private val mContext: Context, private val data: List) : ArrayAdapter(mContext, 0, data) { - public var deviceListener: DeviceDeleteListener? = null + var deviceListener: DeviceDeleteListener? = null override fun getView(position: Int, convertView: View?, parent: ViewGroup): View { // Get the data item for this position var newView = convertView diff --git a/app/src/main/kotlin/io/treehouses/remote/adapter/SystemListAdapter.kt b/app/src/main/kotlin/io/treehouses/remote/adapter/SystemListAdapter.kt index dd0a3d44c..e7228df66 100644 --- a/app/src/main/kotlin/io/treehouses/remote/adapter/SystemListAdapter.kt +++ b/app/src/main/kotlin/io/treehouses/remote/adapter/SystemListAdapter.kt @@ -8,16 +8,13 @@ import android.view.ViewGroup import android.widget.BaseExpandableListAdapter import android.widget.TextView import androidx.annotation.RequiresApi -import androidx.fragment.app.FragmentActivity import io.treehouses.remote.R -import io.treehouses.remote.Tutorials import io.treehouses.remote.callback.HomeInteractListener import io.treehouses.remote.pojo.NetworkListItem -import io.treehouses.remote.utils.logD class SystemListAdapter(val context: Context, list: List) : BaseExpandableListAdapter() { private val list: List - private val inflater: LayoutInflater + private val inflater: LayoutInflater = LayoutInflater.from(context) private var listener: HomeInteractListener? = null private val views: MutableList private val groupHeader: MutableList @@ -60,12 +57,15 @@ class SystemListAdapter(val context: Context, list: List) : Bas return false } - override fun getGroupView(i: Int, b: Boolean, convertView: View?, parent: ViewGroup): View { - val newView: View? - newView = inflater.inflate(R.layout.list_group, parent, false) - val listHeader = newView.findViewById(R.id.lblListHeader) - listHeader.text = getGroup(i).toString() - groupHeader.add(newView) + override fun getGroupView(i: Int, b: Boolean, convertView: View?, parent: ViewGroup): View? { + val newView: View? = inflater.inflate(R.layout.list_group, parent, false) + val listHeader = newView?.findViewById(R.id.lblListHeader) + if (listHeader != null) { + listHeader.text = getGroup(i).toString() + } + if (newView != null) { + groupHeader.add(newView) + } return newView } @@ -104,7 +104,6 @@ class SystemListAdapter(val context: Context, list: List) : Bas } init { - inflater = LayoutInflater.from(context) this.list = list views = mutableListOf() groupHeader = mutableListOf() diff --git a/app/src/main/kotlin/io/treehouses/remote/adapter/ViewHolderSSH2FA.kt b/app/src/main/kotlin/io/treehouses/remote/adapter/ViewHolderSSH2FA.kt index bdf878923..7d2538f97 100644 --- a/app/src/main/kotlin/io/treehouses/remote/adapter/ViewHolderSSH2FA.kt +++ b/app/src/main/kotlin/io/treehouses/remote/adapter/ViewHolderSSH2FA.kt @@ -130,7 +130,7 @@ class ViewHolderSSH2FA internal constructor(v: View, private val c: Context, lis private fun openAuthenticator(key:String){ val uri:String = "otpauth://totp/" + "pi@treehouses" + "?secret=" + key + "&issuer=treehouses" - val intent:Intent = Intent(Intent.ACTION_VIEW, Uri.parse(uri)) + val intent = Intent(Intent.ACTION_VIEW, Uri.parse(uri)) if (Utils.checkAppIsInstalled(c, v, intent, arrayOf("No Authenticator Client Installed on your Device", "Install", "https://play.google.com/store/apps/details?id=com.google.android.apps.authenticator2"))) return diff --git a/app/src/main/kotlin/io/treehouses/remote/adapter/ViewHolderVnc.kt b/app/src/main/kotlin/io/treehouses/remote/adapter/ViewHolderVnc.kt index 46525185f..1f8b03ae5 100644 --- a/app/src/main/kotlin/io/treehouses/remote/adapter/ViewHolderVnc.kt +++ b/app/src/main/kotlin/io/treehouses/remote/adapter/ViewHolderVnc.kt @@ -38,7 +38,7 @@ class ViewHolderVnc internal constructor(v: View, context: Context, listener: Ho init { listener.sendMessage(context.getString(R.string.TREEHOUSES_VNC)) val btnStartConfig = v.findViewById