Bug fixes
- fixed check if connection is allowed (metered/unmetered network) - label is actually selected when opening the overview - minor code improvements - dependency version bumps
This commit is contained in:
parent
f6ebd62c8d
commit
d88d3c900e
@ -51,9 +51,10 @@ android {
|
|||||||
|
|
||||||
//ext.jabitVersion = '2.0.4'
|
//ext.jabitVersion = '2.0.4'
|
||||||
ext.jabitVersion = 'feature-refactoring-SNAPSHOT'
|
ext.jabitVersion = 'feature-refactoring-SNAPSHOT'
|
||||||
ext.supportVersion = '27.0.1'
|
ext.supportVersion = '27.0.2'
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
|
||||||
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
|
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
|
||||||
implementation "org.jetbrains.anko:anko:$anko_version"
|
implementation "org.jetbrains.anko:anko:$anko_version"
|
||||||
@ -74,22 +75,22 @@ dependencies {
|
|||||||
|
|
||||||
implementation 'org.slf4j:slf4j-android:1.7.25'
|
implementation 'org.slf4j:slf4j-android:1.7.25'
|
||||||
|
|
||||||
implementation 'com.mikepenz:materialize:1.1.0@aar'
|
implementation 'com.mikepenz:materialize:1.1.2@aar'
|
||||||
implementation('com.mikepenz:materialdrawer:5.9.5@aar') {
|
implementation('com.mikepenz:materialdrawer:6.0.2@aar') {
|
||||||
transitive = true
|
transitive = true
|
||||||
}
|
}
|
||||||
implementation('com.mikepenz:aboutlibraries:5.9.7@aar') {
|
implementation('com.mikepenz:aboutlibraries:6.0.1@aar') {
|
||||||
transitive = true
|
transitive = true
|
||||||
}
|
}
|
||||||
implementation "com.mikepenz:iconics-core:2.9.3@aar"
|
implementation "com.mikepenz:iconics-core:3.0.0@aar"
|
||||||
implementation "com.mikepenz:iconics-views:2.9.3@aar"
|
implementation "com.mikepenz:iconics-views:3.0.0@aar"
|
||||||
implementation 'com.mikepenz:google-material-typeface:3.0.1.1.original@aar'
|
implementation 'com.mikepenz:google-material-typeface:3.0.1.2.original@aar'
|
||||||
implementation 'com.mikepenz:community-material-typeface:1.9.32.2@aar'
|
implementation 'com.mikepenz:community-material-typeface:2.0.46.1@aar'
|
||||||
|
|
||||||
implementation 'com.journeyapps:zxing-android-embedded:3.5.0@aar'
|
implementation 'com.journeyapps:zxing-android-embedded:3.5.0@aar'
|
||||||
implementation 'com.google.zxing:core:3.3.1'
|
implementation 'com.google.zxing:core:3.3.1'
|
||||||
|
|
||||||
implementation 'com.github.kobakei:MaterialFabSpeedDial:1.1.7'
|
implementation 'com.github.kobakei:MaterialFabSpeedDial:1.1.8'
|
||||||
implementation 'com.github.amlcurran.showcaseview:library:5.4.3'
|
implementation 'com.github.amlcurran.showcaseview:library:5.4.3'
|
||||||
implementation('com.github.h6ah4i:android-advancedrecyclerview:0.11.0@aar') {
|
implementation('com.github.h6ah4i:android-advancedrecyclerview:0.11.0@aar') {
|
||||||
transitive = true
|
transitive = true
|
||||||
@ -98,12 +99,12 @@ dependencies {
|
|||||||
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
|
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
|
||||||
|
|
||||||
testImplementation 'junit:junit:4.12'
|
testImplementation 'junit:junit:4.12'
|
||||||
testImplementation 'org.mockito:mockito-core:2.11.0'
|
testImplementation 'org.mockito:mockito-core:2.13.0'
|
||||||
testImplementation 'org.hamcrest:hamcrest-library:1.3'
|
testImplementation 'org.hamcrest:hamcrest-library:1.3'
|
||||||
testImplementation 'com.nhaarman:mockito-kotlin-kt1.1:1.5.0'
|
testImplementation 'com.nhaarman:mockito-kotlin-kt1.1:1.5.0'
|
||||||
testImplementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
|
testImplementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
|
||||||
testImplementation 'org.robolectric:robolectric:3.5'
|
testImplementation 'org.robolectric:robolectric:3.6.1'
|
||||||
testImplementation "org.robolectric:shadows-multidex:3.5"
|
testImplementation "org.robolectric:shadows-multidex:3.6.1"
|
||||||
|
|
||||||
androidTestImplementation "com.android.support:multidex:1.0.2"
|
androidTestImplementation "com.android.support:multidex:1.0.2"
|
||||||
}
|
}
|
||||||
|
@ -4,9 +4,9 @@
|
|||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools">
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
|
|
||||||
<uses-permission android:name="android.permission.INTERNET"/>
|
<uses-permission android:name="android.permission.INTERNET"/>
|
||||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
||||||
|
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
|
||||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||||
<uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS"/>
|
<uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS"/>
|
||||||
<uses-permission android:name="android.permission.READ_SYNC_SETTINGS"/>
|
<uses-permission android:name="android.permission.READ_SYNC_SETTINGS"/>
|
||||||
|
@ -177,12 +177,10 @@ class MainActivity : AppCompatActivity(), ListSelectionListener<Serializable> {
|
|||||||
|
|
||||||
private fun <F> changeList(listFragment: F) where F : Fragment, F : ListHolder<*> {
|
private fun <F> changeList(listFragment: F) where F : Fragment, F : ListHolder<*> {
|
||||||
if (active) {
|
if (active) {
|
||||||
val transaction = supportFragmentManager
|
val transaction = supportFragmentManager.beginTransaction()
|
||||||
.beginTransaction()
|
|
||||||
transaction.replace(R.id.item_list, listFragment)
|
transaction.replace(R.id.item_list, listFragment)
|
||||||
val detailFragment = supportFragmentManager.findFragmentById(R.id.message_detail_container)
|
supportFragmentManager.findFragmentById(R.id.message_detail_container)?.let {
|
||||||
if (detailFragment != null) {
|
transaction.remove(it)
|
||||||
transaction.remove(detailFragment)
|
|
||||||
}
|
}
|
||||||
transaction.addToBackStack(null).commit()
|
transaction.addToBackStack(null).commit()
|
||||||
|
|
||||||
@ -289,10 +287,8 @@ class MainActivity : AppCompatActivity(), ListSelectionListener<Serializable> {
|
|||||||
for (label in labels) {
|
for (label in labels) {
|
||||||
addLabelEntry(label)
|
addLabelEntry(label)
|
||||||
}
|
}
|
||||||
val selectedDrawerItem = drawer.getDrawerItem(selectedLabel)
|
drawer.setSelection(selectedLabel?.id as Long)
|
||||||
if (selectedDrawerItem != null) {
|
updateUnread()
|
||||||
drawer.setSelection(selectedDrawerItem)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -402,6 +398,7 @@ class MainActivity : AppCompatActivity(), ListSelectionListener<Serializable> {
|
|||||||
|
|
||||||
private fun addLabelEntry(label: Label) {
|
private fun addLabelEntry(label: Label) {
|
||||||
val item = PrimaryDrawerItem()
|
val item = PrimaryDrawerItem()
|
||||||
|
.withIdentifier(label.id as Long)
|
||||||
.withName(label.toString())
|
.withName(label.toString())
|
||||||
.withTag(label)
|
.withTag(label)
|
||||||
.withIcon(Labels.getIcon(label))
|
.withIcon(Labels.getIcon(label))
|
||||||
@ -513,10 +510,9 @@ class MainActivity : AppCompatActivity(), ListSelectionListener<Serializable> {
|
|||||||
private var instance: WeakReference<MainActivity>? = null
|
private var instance: WeakReference<MainActivity>? = null
|
||||||
|
|
||||||
fun updateNodeSwitch() {
|
fun updateNodeSwitch() {
|
||||||
val i = getInstance()
|
getInstance()?.apply {
|
||||||
i?.apply {
|
|
||||||
runOnUiThread {
|
runOnUiThread {
|
||||||
nodeSwitch.withChecked(Preferences.isFullNodeActive(i))
|
nodeSwitch.withChecked(Preferences.isFullNodeActive(this))
|
||||||
drawer.updateStickyFooterItem(nodeSwitch)
|
drawer.updateStickyFooterItem(nodeSwitch)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -120,11 +120,11 @@ class AndroidAddressRepository(private val sql: SqlHelper) : AddressRepository {
|
|||||||
|
|
||||||
private fun getAddress(c: Cursor): BitmessageAddress {
|
private fun getAddress(c: Cursor): BitmessageAddress {
|
||||||
|
|
||||||
val privateKeyBytes = c.getBlob(c.getColumnIndex(COLUMN_PRIVATE_KEY))
|
fun getIdentity(c: Cursor) = c.getBlob(c.getColumnIndex(COLUMN_PRIVATE_KEY))?.let {
|
||||||
val address = privateKeyBytes?.let {
|
BitmessageAddress(PrivateKey.read(ByteArrayInputStream(it)))
|
||||||
BitmessageAddress(PrivateKey.read(ByteArrayInputStream(privateKeyBytes)))
|
}
|
||||||
} ?:
|
|
||||||
BitmessageAddress(c.getString(c.getColumnIndex(COLUMN_ADDRESS))).also { address ->
|
fun getContact(c: Cursor) = BitmessageAddress(c.getString(c.getColumnIndex(COLUMN_ADDRESS))).also { address ->
|
||||||
c.getBlob(c.getColumnIndex(COLUMN_PUBLIC_KEY))?.let { publicKeyBytes ->
|
c.getBlob(c.getColumnIndex(COLUMN_PUBLIC_KEY))?.let { publicKeyBytes ->
|
||||||
Factory.readPubkey(
|
Factory.readPubkey(
|
||||||
version = address.version, stream = address.stream,
|
version = address.version, stream = address.stream,
|
||||||
@ -140,11 +140,11 @@ class AndroidAddressRepository(private val sql: SqlHelper) : AddressRepository {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
address.alias = c.getString(c.getColumnIndex(COLUMN_ALIAS))
|
return (getIdentity(c) ?: getContact(c)).apply {
|
||||||
address.isChan = c.getInt(c.getColumnIndex(COLUMN_CHAN)) == 1
|
alias = c.getString(c.getColumnIndex(COLUMN_ALIAS))
|
||||||
address.isSubscribed = c.getInt(c.getColumnIndex(COLUMN_SUBSCRIBED)) == 1
|
isChan = c.getInt(c.getColumnIndex(COLUMN_CHAN)) == 1
|
||||||
|
isSubscribed = c.getInt(c.getColumnIndex(COLUMN_SUBSCRIBED)) == 1
|
||||||
return address
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun save(address: BitmessageAddress) = if (exists(address)) {
|
override fun save(address: BitmessageAddress) = if (exists(address)) {
|
||||||
|
@ -88,7 +88,7 @@ object Preferences {
|
|||||||
return preferences.getString(name, null)
|
return preferences.getString(name, null)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun isConnectionAllowed(ctx: Context) = !isWifiOnly(ctx) || ctx.connectivityManager.isActiveNetworkMetered
|
fun isConnectionAllowed(ctx: Context) = !isWifiOnly(ctx) || !ctx.connectivityManager.isActiveNetworkMetered
|
||||||
|
|
||||||
fun isWifiOnly(ctx: Context): Boolean {
|
fun isWifiOnly(ctx: Context): Boolean {
|
||||||
val preferences = PreferenceManager.getDefaultSharedPreferences(ctx)
|
val preferences = PreferenceManager.getDefaultSharedPreferences(ctx)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
buildscript {
|
buildscript {
|
||||||
ext.kotlin_version = '1.1.61'
|
ext.kotlin_version = '1.2.10'
|
||||||
ext.anko_version = '0.10.2'
|
ext.anko_version = '0.10.4'
|
||||||
repositories {
|
repositories {
|
||||||
jcenter()
|
jcenter()
|
||||||
google()
|
google()
|
||||||
|
Loading…
Reference in New Issue
Block a user