Commit efd7551c authored by Jonas L.'s avatar Jonas L.

Migrate to AndroidX

parent 70ef7996
......@@ -4,14 +4,14 @@ apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
android {
compileSdkVersion 27
compileSdkVersion 28
defaultConfig {
applicationId "de.determapp.android"
minSdkVersion 16
targetSdkVersion 27
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
javaCompileOptions {
annotationProcessorOptions {
......@@ -40,21 +40,21 @@ android {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support:recyclerview-v7:27.1.1'
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha2'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'io.resourcepool:ssdp-client:2.1.0'
implementation "android.arch.lifecycle:extensions:$lifecycle_version"
implementation "android.arch.lifecycle:common-java8:$lifecycle_version"
implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0'
implementation 'androidx.lifecycle:lifecycle-common-java8:2.0.0'
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation "android.arch.persistence.room:runtime:$room_version"
kapt "android.arch.persistence.room:compiler:$room_version"
androidTestImplementation 'androidx.test:runner:1.1.0-alpha4'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha4'
implementation 'androidx.room:room-runtime:2.0.0'
kapt 'androidx.room:room-compiler:2.0.0'
implementation "me.henrytao:recycler-pager-adapter:2.1.0"
implementation 'com.squareup.picasso:picasso:2.71828'
implementation "android.arch.work:work-runtime-ktx:$work_version"
......
package de.determapp.android
import android.support.test.InstrumentationRegistry
import android.support.test.runner.AndroidJUnit4
import androidx.test.InstrumentationRegistry
import androidx.test.runner.AndroidJUnit4
import org.junit.Test
import org.junit.runner.RunWith
......
package de.determapp.android.content;
import android.content.Context;
import android.support.v4.content.ContextCompat;
import androidx.core.content.ContextCompat;
import android.util.Log;
import java.io.File;
......
package de.determapp.android.content.cleanup
import android.arch.lifecycle.MutableLiveData
import androidx.lifecycle.MutableLiveData
import android.content.Context
import de.determapp.android.content.ContentStorage
import de.determapp.android.content.ProjectLocks
......@@ -69,4 +69,4 @@ object DeleteDownloadedProject {
})
}
}
}
\ No newline at end of file
}
package de.determapp.android.content.database;
import android.arch.persistence.room.Database;
import android.arch.persistence.room.RoomDatabase;
import androidx.room.Database;
import androidx.room.RoomDatabase;
@Database(entities = {DownloadedLocalNetworkProject.class, PackageSourceProject.class, PackageSource.class}, version = 1)
public abstract class AppDatabase extends RoomDatabase {
......
package de.determapp.android.content.database;
import android.arch.persistence.room.Room;
import androidx.room.Room;
import android.content.Context;
public abstract class AppDatabaseInstance {
......
package de.determapp.android.content.database;
import android.arch.persistence.room.ColumnInfo;
import android.arch.persistence.room.Entity;
import android.arch.persistence.room.PrimaryKey;
import android.support.annotation.NonNull;
import androidx.room.ColumnInfo;
import androidx.room.Entity;
import androidx.room.PrimaryKey;
import androidx.annotation.NonNull;
@Entity(tableName = "downloaded_local_network_project")
public class DownloadedLocalNetworkProject {
......
package de.determapp.android.content.database;
import android.arch.lifecycle.LiveData;
import android.arch.persistence.room.Dao;
import android.arch.persistence.room.Insert;
import android.arch.persistence.room.Query;
import androidx.lifecycle.LiveData;
import androidx.room.Dao;
import androidx.room.Insert;
import androidx.room.Query;
import java.util.List;
......
package de.determapp.android.content.database;
import android.arch.persistence.room.ColumnInfo;
import android.arch.persistence.room.Entity;
import android.arch.persistence.room.PrimaryKey;
import android.support.annotation.NonNull;
import androidx.room.ColumnInfo;
import androidx.room.Entity;
import androidx.room.PrimaryKey;
import androidx.annotation.NonNull;
@Entity(tableName = "package_source")
public class PackageSource {
......
package de.determapp.android.content.database;
import android.arch.lifecycle.LiveData;
import android.arch.persistence.room.Dao;
import android.arch.persistence.room.Insert;
import android.arch.persistence.room.Query;
import androidx.lifecycle.LiveData;
import androidx.room.Dao;
import androidx.room.Insert;
import androidx.room.Query;
import java.util.List;
......
package de.determapp.android.content.database;
import android.arch.persistence.room.ColumnInfo;
import android.arch.persistence.room.Entity;
import android.arch.persistence.room.PrimaryKey;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import androidx.room.ColumnInfo;
import androidx.room.Entity;
import androidx.room.PrimaryKey;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@Entity(tableName = "package_source_project")
public class PackageSourceProject {
......
package de.determapp.android.content.database;
import android.arch.lifecycle.LiveData;
import android.arch.persistence.room.Dao;
import android.arch.persistence.room.Insert;
import android.arch.persistence.room.Query;
import androidx.lifecycle.LiveData;
import androidx.room.Dao;
import androidx.room.Insert;
import androidx.room.Query;
import java.util.List;
......
package de.determapp.android.content.download
import android.content.Context
import android.support.v4.os.CancellationSignal
import androidx.core.os.CancellationSignal
import android.util.JsonReader
import de.determapp.android.content.ContentJsonParser
import de.determapp.android.content.ContentStorage
......
package de.determapp.android.content.download
import android.arch.lifecycle.MutableLiveData
import androidx.lifecycle.MutableLiveData
import android.content.Context
import android.support.v4.os.CancellationSignal
import androidx.core.os.CancellationSignal
import de.determapp.android.Http
import de.determapp.android.content.ContentStorage
import de.determapp.android.content.projectdata.Image
......
package de.determapp.android.localnetwork;
import android.arch.lifecycle.LiveData;
import android.arch.lifecycle.Observer;
import android.arch.lifecycle.Transformations;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.Observer;
import androidx.lifecycle.Transformations;
import android.os.Handler;
import android.os.Looper;
import android.util.Log;
......
package de.determapp.android.localnetwork;
import android.arch.lifecycle.LiveData;
import androidx.lifecycle.LiveData;
import android.os.Handler;
import android.os.Looper;
import android.os.SystemClock;
......
......@@ -2,16 +2,16 @@ package de.determapp.android.service
import android.app.IntentService
import android.app.Service
import android.arch.lifecycle.LiveData
import android.arch.lifecycle.MutableLiveData
import android.arch.lifecycle.Observer
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Observer
import android.content.Context
import android.content.Intent
import android.net.wifi.WifiManager
import android.os.Parcelable
import android.os.PowerManager
import android.support.v4.app.NotificationCompat
import android.support.v4.app.NotificationManagerCompat
import androidx.core.app.NotificationCompat
import androidx.core.app.NotificationManagerCompat
import android.util.Log
import de.determapp.android.BuildConfig
import de.determapp.android.R
......@@ -177,4 +177,4 @@ class DownloadLocalNetworkPackageService: IntentService("DownloadLocalNetworkPac
stopForeground(true)
}
}
\ No newline at end of file
}
......@@ -3,8 +3,8 @@ package de.determapp.android.service.work
import android.app.NotificationManager
import android.content.Context
import android.os.SystemClock
import android.support.v4.app.NotificationCompat
import android.support.v4.os.CancellationSignal
import androidx.core.app.NotificationCompat
import androidx.core.os.CancellationSignal
import android.util.Log
import androidx.work.*
import de.determapp.android.BuildConfig
......@@ -197,4 +197,4 @@ class DownloadPackageSourceContentWork: Worker() {
cancellationSignal?.cancel()
}
}
\ No newline at end of file
}
package de.determapp.android.service.work
import android.app.NotificationManager
import android.arch.core.util.Function
import android.arch.lifecycle.LiveData
import android.arch.lifecycle.Observer
import android.arch.lifecycle.Transformations
import androidx.arch.core.util.Function
import androidx.lifecycle.LiveData
import androidx.lifecycle.Observer
import androidx.lifecycle.Transformations
import android.content.Context
import android.os.SystemClock
import android.support.v4.app.NotificationCompat
import android.support.v4.os.CancellationSignal
import androidx.core.app.NotificationCompat
import androidx.core.os.CancellationSignal
import android.util.Log
import androidx.work.*
import de.determapp.android.BuildConfig
......@@ -323,4 +323,4 @@ class UpdateContentWorker: Worker() {
this.cancel?.cancel()
}
}
\ No newline at end of file
}
package de.determapp.android.ui
import android.app.Dialog
import android.arch.lifecycle.Observer
import android.arch.lifecycle.ViewModelProviders
import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProviders
import android.content.DialogInterface
import android.os.Bundle
import android.preference.PreferenceManager
import android.support.v4.app.DialogFragment
import android.support.v7.app.AlertDialog
import android.support.v7.app.AppCompatActivity
import androidx.fragment.app.DialogFragment
import androidx.appcompat.app.AlertDialog
import androidx.appcompat.app.AppCompatActivity
import android.text.method.LinkMovementMethod
import android.widget.Button
import android.widget.TextView
......@@ -106,4 +106,4 @@ class DefaultContentSourceDialogFragment: DialogFragment() {
}
})
}
}
\ No newline at end of file
}
package de.determapp.android.ui
import android.os.Bundle
import android.support.design.widget.NavigationView
import android.support.v4.app.Fragment
import android.support.v4.view.GravityCompat
import android.support.v7.app.ActionBarDrawerToggle
import android.support.v7.app.AppCompatActivity
import com.google.android.material.navigation.NavigationView
import androidx.fragment.app.Fragment
import androidx.core.view.GravityCompat
import androidx.appcompat.app.ActionBarDrawerToggle
import androidx.appcompat.app.AppCompatActivity
import android.view.MenuItem
import de.determapp.android.R
import de.determapp.android.ui.about.AboutFragment
......@@ -14,8 +14,6 @@ import de.determapp.android.ui.packagesource.PackageSourcesFragment
import de.determapp.android.ui.receive.ReceiveContentFragment
import de.determapp.android.ui.storage.ManageStorageFragment
import de.determapp.android.ui.update.UpdateContentFragment
import kotlinx.android.synthetic.main.activity_main.*
import kotlinx.android.synthetic.main.app_bar_main.*
class MainActivity: AppCompatActivity(), NavigationView.OnNavigationItemSelectedListener {
override fun onCreate(savedInstanceState: Bundle?) {
......@@ -75,4 +73,4 @@ class MainActivity: AppCompatActivity(), NavigationView.OnNavigationItemSelected
.replace(R.id.container, fragment)
.commit()
}
}
\ No newline at end of file
}
......@@ -4,7 +4,7 @@ import android.content.ActivityNotFoundException
import android.content.Intent
import android.net.Uri
import android.os.Bundle
import android.support.v4.app.Fragment
import androidx.fragment.app.Fragment
import android.text.method.LinkMovementMethod
import android.view.LayoutInflater
import android.view.View
......
package de.determapp.android.ui.contentlist;
import android.arch.lifecycle.LiveData;
import android.arch.lifecycle.MediatorLiveData;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MediatorLiveData;
import android.content.Context;
import java.util.ArrayList;
......
package de.determapp.android.ui.contentlist
import android.support.v7.widget.RecyclerView
import androidx.recyclerview.widget.RecyclerView
import android.view.LayoutInflater
import android.view.ViewGroup
import de.determapp.android.databinding.ContentListItemBinding
......@@ -55,4 +55,4 @@ class ContentListAdapter: RecyclerView.Adapter<ViewHolder>() {
}
}
class ViewHolder(val binding: ContentListItemBinding): RecyclerView.ViewHolder(binding.root)
\ No newline at end of file
class ViewHolder(val binding: ContentListItemBinding): RecyclerView.ViewHolder(binding.root)
package de.determapp.android.ui.contentlist
import android.arch.lifecycle.Observer
import android.arch.lifecycle.ViewModelProviders
import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProviders
import android.os.Bundle
import android.support.design.widget.Snackbar
import android.support.v4.app.Fragment
import android.support.v7.widget.StaggeredGridLayoutManager
import com.google.android.material.snackbar.Snackbar
import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.StaggeredGridLayoutManager
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
......@@ -75,4 +75,4 @@ class ContentListFragment: Fragment(), Handlers {
ProjectSpec(item.projectId, item.source)
)
}
}
\ No newline at end of file
}
package de.determapp.android.ui.contentlist
import android.app.Application
import android.arch.lifecycle.AndroidViewModel
import android.arch.lifecycle.MutableLiveData
import androidx.lifecycle.AndroidViewModel
import androidx.lifecycle.MutableLiveData
import de.determapp.android.content.packagesource.UpdatePackageSourcesResult
import de.determapp.android.content.packagesource.updatePackageSourcesSync
import de.determapp.android.util.Async
......@@ -38,4 +38,4 @@ class ContentListModel(application: Application): AndroidViewModel(application)
})
})
}
}
\ No newline at end of file
}
......@@ -2,15 +2,15 @@ package de.determapp.android.ui.packagesource
import android.app.Application
import android.app.Dialog
import android.arch.lifecycle.AndroidViewModel
import android.arch.lifecycle.MutableLiveData
import android.arch.lifecycle.Observer
import android.arch.lifecycle.ViewModelProviders
import androidx.lifecycle.AndroidViewModel
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProviders
import android.os.Bundle
import android.support.design.widget.Snackbar
import android.support.v4.app.DialogFragment
import android.support.v4.app.FragmentManager
import android.support.v7.app.AlertDialog
import com.google.android.material.snackbar.Snackbar
import androidx.fragment.app.DialogFragment
import androidx.fragment.app.FragmentManager
import androidx.appcompat.app.AlertDialog
import android.text.InputType
import android.util.Log
import android.view.ViewGroup
......@@ -157,4 +157,4 @@ class AddPackageSourceDialogFragmentModel(application: Application): AndroidView
enum class AddPackageSourceStatus {
Idle, Running, Failed, Success
}
\ No newline at end of file
}
package de.determapp.android.ui.packagesource
import android.support.v7.widget.RecyclerView
import androidx.recyclerview.widget.RecyclerView
import android.view.LayoutInflater
import android.view.ViewGroup
import de.determapp.android.content.database.PackageSource
......@@ -52,4 +52,4 @@ class PackageSourcesAdapter: RecyclerView.Adapter<ViewHolder>() {
}
}
class ViewHolder(val binding: FragmentPackageSourcesListItemBinding): RecyclerView.ViewHolder(binding.root)
\ No newline at end of file
class ViewHolder(val binding: FragmentPackageSourcesListItemBinding): RecyclerView.ViewHolder(binding.root)
package de.determapp.android.ui.packagesource
import android.arch.lifecycle.Observer
import androidx.lifecycle.Observer
import android.os.Bundle
import android.support.design.widget.Snackbar
import android.support.v4.app.Fragment
import android.support.v7.widget.LinearLayoutManager
import android.support.v7.widget.RecyclerView
import android.support.v7.widget.helper.ItemTouchHelper
import com.google.android.material.snackbar.Snackbar
import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import androidx.recyclerview.widget.ItemTouchHelper
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
......
package de.determapp.android.ui.receive
import android.support.v7.widget.RecyclerView
import androidx.recyclerview.widget.RecyclerView
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
......@@ -97,4 +97,4 @@ class IntroductionViewHolder(view: View): ViewHolder(view)
class HostHeaderViewHolder(view: View, val binding: ReceiveContentItemHostheaderBinding): ViewHolder(view)
class PackageViewHolder(view: View, val binding: ReceiveContentItemPackageBinding): ViewHolder(view)
\ No newline at end of file
class PackageViewHolder(view: View, val binding: ReceiveContentItemPackageBinding): ViewHolder(view)
package de.determapp.android.ui.receive
import android.arch.lifecycle.Observer
import androidx.lifecycle.Observer
import android.os.Bundle
import android.support.v4.app.Fragment
import android.support.v7.widget.LinearLayoutManager
import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.LinearLayoutManager
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
......
package de.determapp.android.ui.receive;
import android.arch.lifecycle.LiveData;
import android.arch.lifecycle.MediatorLiveData;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MediatorLiveData;
import android.content.Context;
import android.text.TextUtils;
......
package de.determapp.android.ui.storage
import android.support.v7.widget.RecyclerView
import androidx.recyclerview.widget.RecyclerView
import android.view.LayoutInflater
import android.view.ViewGroup
import de.determapp.android.databinding.ManageStorageItemBinding
......@@ -62,4 +62,4 @@ class ViewHolder(val binding: ManageStorageItemBinding): RecyclerView.ViewHolder
interface ManageStorageHandlers {
fun onRequestDeleteElement(item: ProjectStorageItem)
}
\ No newline at end of file
}
package de.determapp.android.ui.storage
import android.app.Application
import android.arch.lifecycle.AndroidViewModel
import android.arch.lifecycle.LiveData
import android.arch.lifecycle.Observer
import android.arch.lifecycle.ViewModelProviders
import androidx.lifecycle.AndroidViewModel
import androidx.lifecycle.LiveData
import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProviders
import android.os.Bundle
import android.support.v4.app.Fragment
import android.support.v7.widget.LinearLayoutManager
import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.LinearLayoutManager
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
......@@ -64,4 +64,4 @@ class ManageStorageModel(application: Application): AndroidViewModel(application
return content!!
}
}
\ No newline at end of file
}
package de.determapp.android.ui.storage
import android.arch.lifecycle.LiveData
import android.arch.lifecycle.MediatorLiveData
import android.arch.lifecycle.MutableLiveData
import android.arch.lifecycle.Observer
import androidx.lifecycle.LiveData
import androidx.lifecycle.MediatorLiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Observer
import android.content.Context
import android.util.Log
import de.determapp.android.BuildConfig
......@@ -188,4 +188,4 @@ object StorageItemList {
}
private class FoundDirectory(val directory: File, val sizeInBytes: Long, val spec: ProjectSpec)
}
\ No newline at end of file
}
package de.determapp.android.ui.update
import android.arch.lifecycle.Observer
import androidx.lifecycle.Observer
import android.os.Bundle
import android.support.v4.app.Fragment
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
......@@ -44,4 +44,4 @@ class UpdateContentFragment : Fragment(), UpdateContentHandlers {
interface UpdateContentHandlers {
fun cancelManuallyUpdate()
fun forceUpdateManually()
}
\ No newline at end of file
}
package de.determapp.android.ui.viewer
import android.arch.lifecycle.Observer
import android.arch.lifecycle.ViewModelProviders
import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProviders
import android.content.Context
import android.content.Intent
import android.os.Bundle
import android.support.v4.view.GravityCompat
import android.support.v4.view.ViewPager
import android.support.v4.widget.DrawerLayout
import android.support.v7.app.ActionBarDrawerToggle
import android.support.v7.app.AppCompatActivity
import androidx.core.view.GravityCompat
import androidx.viewpager.widget.ViewPager
import androidx.drawerlayout.widget.DrawerLayout
import androidx.appcompat.app.ActionBarDrawerToggle
import androidx.appcompat.app.AppCompatActivity
import android.text.TextUtils
import android.view.Menu
import android.widget.TextView
import de.determapp.android.R
import de.determapp.android.ui.viewer.info.ViewerContentInfoDialogFragment
import de.determapp.android.ui.viewer.loading.ViewerModel
import kotlinx.android.synthetic.main.activity_viewer.*
import kotlinx.android.synthetic.main.app_bar_viewer.*
import kotlinx.android.synthetic.main.content_viewer.*
import kotlinx.android.synthetic.main.content_viewer_error.*
import kotlinx.android.synthetic.main.content_viewer_pager.*
class ViewerActivity : AppCompatActivity(), StackAdapterHandler, ViewPager.OnPageChangeListener {
......
......@@ -2,14 +2,14 @@ package de.determapp.android.ui.viewer.info
import android.app.Application
import android.app.Dialog
import android.arch.lifecycle.AndroidViewModel
import android.arch.lifecycle.MutableLiveData
import android.arch.lifecycle.Observer
import android.arch.lifecycle.ViewModelProviders
import androidx.lifecycle.AndroidViewModel
import androidx.lifecycle.MutableLiveData