🤯 Update dependencies, switch to AndroidX
This commit is contained in:
		| @@ -20,11 +20,12 @@ import android.content.Intent | ||||
| import android.graphics.Canvas | ||||
| import android.graphics.Paint | ||||
| import android.os.Bundle | ||||
| import android.support.annotation.DrawableRes | ||||
| import android.support.v4.app.Fragment | ||||
| import android.support.v7.app.AppCompatActivity | ||||
| import android.support.v7.widget.Toolbar | ||||
| import android.view.View | ||||
| import androidx.annotation.DrawableRes | ||||
| import androidx.appcompat.app.AppCompatActivity | ||||
| import androidx.appcompat.widget.Toolbar | ||||
| import androidx.fragment.app.Fragment | ||||
| import androidx.fragment.app.transaction | ||||
| import ch.dissem.apps.abit.drawer.ProfileImageListener | ||||
| import ch.dissem.apps.abit.drawer.ProfileSelectionListener | ||||
| import ch.dissem.apps.abit.listener.ListSelectionListener | ||||
| @@ -32,7 +33,10 @@ import ch.dissem.apps.abit.repository.AndroidLabelRepository.Companion.LABEL_ARC | ||||
| import ch.dissem.apps.abit.repository.AndroidMessageRepository | ||||
| import ch.dissem.apps.abit.service.Singleton | ||||
| import ch.dissem.apps.abit.service.Singleton.currentLabel | ||||
| import ch.dissem.apps.abit.util.* | ||||
| import ch.dissem.apps.abit.util.getColor | ||||
| import ch.dissem.apps.abit.util.getIcon | ||||
| import ch.dissem.apps.abit.util.network | ||||
| import ch.dissem.apps.abit.util.preferences | ||||
| import ch.dissem.bitmessage.BitmessageContext | ||||
| import ch.dissem.bitmessage.entity.BitmessageAddress | ||||
| import ch.dissem.bitmessage.entity.Conversation | ||||
| @@ -51,6 +55,7 @@ import com.mikepenz.materialdrawer.model.interfaces.IProfile | ||||
| import com.mikepenz.materialdrawer.model.interfaces.Nameable | ||||
| import io.github.kobakei.materialfabspeeddial.FabSpeedDial | ||||
| import io.github.kobakei.materialfabspeeddial.FabSpeedDialMenu | ||||
| import io.reactivex.disposables.Disposable | ||||
| import kotlinx.android.synthetic.main.activity_main.* | ||||
| import org.jetbrains.anko.doAsync | ||||
| import org.jetbrains.anko.uiThread | ||||
| @@ -92,6 +97,8 @@ class MainActivity : AppCompatActivity(), ListSelectionListener<Serializable> { | ||||
|     var hasDetailPane: Boolean = false | ||||
|         private set | ||||
|  | ||||
|     private var subscription: Disposable? = null | ||||
|  | ||||
|     private lateinit var bmc: BitmessageContext | ||||
|     private lateinit var messageRepo: AndroidMessageRepository | ||||
|     private lateinit var accountHeader: AccountHeader | ||||
| @@ -294,11 +301,11 @@ class MainActivity : AppCompatActivity(), ListSelectionListener<Serializable> { | ||||
|  | ||||
|             uiThread { | ||||
|                 if (intent.hasExtra(EXTRA_SHOW_LABEL)) { | ||||
|                     currentLabel.value = intent.getSerializableExtra(EXTRA_SHOW_LABEL) as Label | ||||
|                     currentLabel.onNext(intent.getSerializableExtra(EXTRA_SHOW_LABEL) as Label) | ||||
|                 } else if (currentLabel.value == null) { | ||||
|                     currentLabel.value = labels[0] | ||||
|  | ||||
|                     currentLabel.onNext(labels[0]) | ||||
|                 } | ||||
|  | ||||
|                 for (label in labels) { | ||||
|                     addLabelEntry(label) | ||||
|                 } | ||||
| @@ -322,7 +329,7 @@ class MainActivity : AppCompatActivity(), ListSelectionListener<Serializable> { | ||||
|             val itemList = supportFragmentManager.findFragmentById(R.id.item_list) | ||||
|             val tag = item.tag | ||||
|             if (tag is Label) { | ||||
|                 currentLabel.value = tag | ||||
|                 currentLabel.onNext(tag) | ||||
|                 if (tag.type == Label.Type.INBOX || tag == LABEL_ARCHIVE) { | ||||
|                     if (itemList !is ConversationListFragment) { | ||||
|                         changeList(ConversationListFragment()) | ||||
| @@ -344,11 +351,10 @@ class MainActivity : AppCompatActivity(), ListSelectionListener<Serializable> { | ||||
|                         return false | ||||
|                     } | ||||
|                     R.string.settings -> { | ||||
|                         supportFragmentManager | ||||
|                             .beginTransaction() | ||||
|                             .replace(R.id.item_list, SettingsFragment()) | ||||
|                             .addToBackStack(null) | ||||
|                             .commit() | ||||
|                         supportFragmentManager?.transaction { | ||||
|                             replace(R.id.item_list, SettingsFragment()) | ||||
|                             addToBackStack(null) | ||||
|                         } | ||||
|                         return false | ||||
|                     } | ||||
|                     R.string.full_node -> return true | ||||
| @@ -363,9 +369,9 @@ class MainActivity : AppCompatActivity(), ListSelectionListener<Serializable> { | ||||
|         network.enableNode(false) | ||||
|         updateUnread() | ||||
|         Singleton.getMessageListener(this).resetNotification() | ||||
|         currentLabel.addObserver(this) { label -> | ||||
|             if (label != null && label.id is Long) { | ||||
|                 drawer.setSelection(label.id as Long) | ||||
|         subscription = currentLabel.subscribe { label -> | ||||
|             if (label.id is Long) { | ||||
|                 drawer.setSelection(label.id as Long, false) | ||||
|             } | ||||
|         } | ||||
|         active = true | ||||
| @@ -373,7 +379,7 @@ class MainActivity : AppCompatActivity(), ListSelectionListener<Serializable> { | ||||
|     } | ||||
|  | ||||
|     override fun onPause() { | ||||
|         currentLabel.removeObserver(this) | ||||
|         subscription?.dispose() | ||||
|         super.onPause() | ||||
|         active = false | ||||
|     } | ||||
| @@ -537,9 +543,8 @@ class MainActivity : AppCompatActivity(), ListSelectionListener<Serializable> { | ||||
|  | ||||
|     fun initFab(@DrawableRes drawableRes: Int, menu: FabSpeedDialMenu): FabSpeedDial { | ||||
|         val fab = floatingActionButton ?: throw IllegalStateException("Fab must not be null") | ||||
|         fab.hide() | ||||
|         fab.removeAllOnMenuItemClickListeners() | ||||
|         fab.show() | ||||
|         fab.closeMenu() | ||||
|         val mainFab = fab.mainFab | ||||
|         mainFab.setImageResource(drawableRes) | ||||
|         fab.setMenu(menu) | ||||
| @@ -551,6 +556,8 @@ class MainActivity : AppCompatActivity(), ListSelectionListener<Serializable> { | ||||
|                 mainFab.setImageResource(drawableRes) | ||||
|             } | ||||
|         } | ||||
|         fab.show() | ||||
|         fab.closeMenu() | ||||
|         return fab | ||||
|     } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user