Fix lint issues

This commit is contained in:
Christian Basler 2018-02-20 16:40:03 +01:00
parent 21abdbd720
commit 9eefbad7d6
33 changed files with 191 additions and 189 deletions

View File

@ -62,7 +62,8 @@ dependencies {
implementation "com.android.support:appcompat-v7:$supportVersion" implementation "com.android.support:appcompat-v7:$supportVersion"
implementation "com.android.support:preference-v7:$supportVersion" implementation "com.android.support:preference-v7:$supportVersion"
implementation "com.android.support:cardview-v7:$supportVersion" implementation "com.android.support:cardview-v7:$supportVersion"
implementation "com.android.support:support-v4:$supportVersion" implementation "com.android.support:support-v13:$supportVersion"
implementation "com.android.support:preference-v14:$supportVersion"
implementation "com.android.support:design:$supportVersion" implementation "com.android.support:design:$supportVersion"
implementation "com.android.support:multidex:1.0.2" implementation "com.android.support:multidex:1.0.2"

View File

@ -1,32 +1,32 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="ch.dissem.apps.abit" xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android" package="ch.dissem.apps.abit">
xmlns:tools="http://schemas.android.com/tools">
<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.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" />
<uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS"/> <uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS" />
<uses-permission android:name="android.permission.READ_CONTACTS"/> <uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_CONTACTS"/> <uses-permission android:name="android.permission.WRITE_CONTACTS" />
<application <application
android:name="android.support.multidex.MultiDexApplication"
android:allowBackup="false" android:allowBackup="false"
android:icon="@mipmap/ic_launcher" android:icon="@mipmap/ic_launcher"
android:label="@string/app_name" android:label="@string/app_name"
android:theme="@style/AppTheme" android:supportsRtl="true"
android:name="android.support.multidex.MultiDexApplication"> android:theme="@style/AppTheme">
<activity <activity
android:name=".MainActivity" android:name=".MainActivity"
android:label="@string/app_name"> android:label="@string/app_name">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN"/> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER"/> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity <activity
@ -36,7 +36,7 @@
tools:ignore="UnusedAttribute"> tools:ignore="UnusedAttribute">
<meta-data <meta-data
android:name="android.support.PARENT_ACTIVITY" android:name="android.support.PARENT_ACTIVITY"
android:value=".MainActivity"/> android:value=".MainActivity" />
</activity> </activity>
<activity <activity
android:name=".AddressDetailActivity" android:name=".AddressDetailActivity"
@ -45,42 +45,42 @@
tools:ignore="UnusedAttribute"> tools:ignore="UnusedAttribute">
<meta-data <meta-data
android:name="android.support.PARENT_ACTIVITY" android:name="android.support.PARENT_ACTIVITY"
android:value=".MainActivity"/> android:value=".MainActivity" />
</activity> </activity>
<activity <activity
android:name=".dialog.FullNodeDialogActivity" android:name=".dialog.FullNodeDialogActivity"
android:label="@string/full_node" android:label="@string/full_node"
android:theme="@style/Theme.AppCompat.Light.Dialog"/> android:theme="@style/Theme.AppCompat.Light.Dialog" />
<activity <activity
android:name=".ComposeMessageActivity" android:name=".ComposeMessageActivity"
android:label="@string/compose_message" android:label="@string/compose_message"
android:parentActivityName=".MainActivity"> android:parentActivityName=".MainActivity">
<meta-data <meta-data
android:name="android.support.PARENT_ACTIVITY" android:name="android.support.PARENT_ACTIVITY"
android:value=".MainActivity"/> android:value=".MainActivity" />
<intent-filter> <intent-filter>
<action android:name="android.intent.action.SENDTO"/> <action android:name="android.intent.action.SENDTO" />
<data android:scheme="bitmessage"/> <data android:scheme="bitmessage" />
<data android:scheme="bitmsg"/> <data android:scheme="bitmsg" />
<data android:scheme="bm"/> <data android:scheme="bm" />
<category android:name="android.intent.category.DEFAULT"/> <category android:name="android.intent.category.DEFAULT" />
</intent-filter> </intent-filter>
<intent-filter> <intent-filter>
<action android:name="android.intent.action.SEND"/> <action android:name="android.intent.action.SEND" />
<data android:mimeType="text/plain"/> <data android:mimeType="text/plain" />
<category android:name="android.intent.category.DEFAULT"/> <category android:name="android.intent.category.DEFAULT" />
</intent-filter> </intent-filter>
<intent-filter> <intent-filter>
<action android:name="android.intent.action.SEND_MULTIPLE"/> <action android:name="android.intent.action.SEND_MULTIPLE" />
<data android:mimeType="text/plain"/> <data android:mimeType="text/plain" />
<category android:name="android.intent.category.DEFAULT"/> <category android:name="android.intent.category.DEFAULT" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity <activity
@ -88,14 +88,14 @@
android:label="@string/title_activity_open_bitmessage_link" android:label="@string/title_activity_open_bitmessage_link"
android:theme="@style/Theme.AppCompat.Light.Dialog"> android:theme="@style/Theme.AppCompat.Light.Dialog">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.VIEW"/> <action android:name="android.intent.action.VIEW" />
<data android:scheme="bitmessage"/> <data android:scheme="bitmessage" />
<data android:scheme="bitmsg"/> <data android:scheme="bitmsg" />
<data android:scheme="bm"/> <data android:scheme="bm" />
<category android:name="android.intent.category.DEFAULT"/> <category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE"/> <category android:name="android.intent.category.BROWSABLE" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity <activity
@ -104,34 +104,34 @@
android:parentActivityName=".MainActivity"> android:parentActivityName=".MainActivity">
<meta-data <meta-data
android:name="android.support.PARENT_ACTIVITY" android:name="android.support.PARENT_ACTIVITY"
android:value=".MainActivity"/> android:value=".MainActivity" />
<intent-filter> <intent-filter>
<action android:name="android.intent.action.VIEW"/> <action android:name="android.intent.action.VIEW" />
<data <data
android:host="*" android:host="*"
android:mimeType="*/*" android:mimeType="*/*"
android:pathPattern=".*\\.dat" android:pathPattern=".*\\.dat"
android:scheme="file"/> android:scheme="file" />
<category android:name="android.intent.category.DEFAULT"/> <category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE"/> <category android:name="android.intent.category.BROWSABLE" />
</intent-filter> </intent-filter>
</activity> </activity>
<service <service
android:name=".service.BitmessageService" android:name=".service.BitmessageService"
android:exported="false"/> android:exported="false" />
<service <service
android:name=".service.ProofOfWorkService" android:name=".service.ProofOfWorkService"
android:exported="false"/> android:exported="false" />
<!-- Synchronization --> <!-- Synchronization -->
<provider <provider
android:name=".synchronization.StubProvider" android:name=".synchronization.StubProvider"
android:authorities="ch.dissem.apps.abit.provider" android:authorities="ch.dissem.apps.abit.provider"
android:exported="false" android:exported="false"
android:syncable="true"/> android:syncable="true" />
<!-- Exports --> <!-- Exports -->
<provider <provider
@ -149,44 +149,54 @@
android:exported="true" android:exported="true"
tools:ignore="ExportedService"> tools:ignore="ExportedService">
<intent-filter> <intent-filter>
<action android:name="android.accounts.AccountAuthenticator"/> <action android:name="android.accounts.AccountAuthenticator" />
</intent-filter> </intent-filter>
<meta-data <meta-data
android:name="android.accounts.AccountAuthenticator" android:name="android.accounts.AccountAuthenticator"
android:resource="@xml/authenticator"/> android:resource="@xml/authenticator" />
</service> </service>
<service <service
android:name=".synchronization.SyncService" android:name=".synchronization.SyncService"
android:exported="true" android:exported="true"
tools:ignore="ExportedService"> tools:ignore="ExportedService">
<intent-filter> <intent-filter>
<action android:name="android.content.SyncAdapter"/> <action android:name="android.content.SyncAdapter" />
</intent-filter> </intent-filter>
<meta-data <meta-data
android:name="android.content.SyncAdapter" android:name="android.content.SyncAdapter"
android:resource="@xml/syncadapter"/> android:resource="@xml/syncadapter" />
</service> </service>
<service <service
android:name=".service.BitmessageIntentService" android:name=".service.BitmessageIntentService"
android:exported="false"/> android:exported="false" />
<!-- Receive Wi-Fi connection state changes --> <!-- Receive Wi-Fi connection state changes -->
<receiver android:name=".listener.WifiReceiver" android:enabled="@bool/is_pre_api_21"> <receiver
android:name=".listener.WifiReceiver"
android:enabled="@bool/is_pre_api_21">
<intent-filter> <intent-filter>
<action android:name="android.net.conn.CONNECTIVITY_CHANGE"/> <!-- This is bad for battery life, but needed on older devices to check
if WiFi is available. Let's be honest, the whole app is bad for
battery life. -->
<action
android:name="android.net.conn.CONNECTIVITY_CHANGE"
tools:ignore="BatteryLife" />
</intent-filter> </intent-filter>
</receiver> </receiver>
<receiver android:name=".service.StartServiceReceiver" android:enabled="@bool/is_post_api_21"> <receiver
android:name=".service.StartServiceReceiver"
android:enabled="@bool/is_post_api_21">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" /> <action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter> </intent-filter>
</receiver> </receiver>
<service <service
android:name=".service.StartupNodeOnWifiService" android:name=".service.StartupNodeOnWifiService"
android:permission="android.permission.BIND_JOB_SERVICE" android:exported="true"
android:exported="true"/> android:permission="android.permission.BIND_JOB_SERVICE" />
<activity <activity
android:name=".StatusActivity" android:name=".StatusActivity"
@ -194,7 +204,7 @@
android:parentActivityName=".MainActivity"> android:parentActivityName=".MainActivity">
<meta-data <meta-data
android:name="android.support.PARENT_ACTIVITY" android:name="android.support.PARENT_ACTIVITY"
android:value=".MainActivity"/> android:value=".MainActivity" />
</activity> </activity>
</application> </application>

View File

@ -204,7 +204,7 @@ class AddressDetailFragment : Fragment() {
* The fragment argument representing the item ID that this fragment * The fragment argument representing the item ID that this fragment
* represents. * represents.
*/ */
val ARG_ITEM = "item" const val ARG_ITEM = "item"
val EXPORT_POSTFIX = ".keys.dat" const val EXPORT_POSTFIX = ".keys.dat"
} }
} }

View File

@ -92,7 +92,7 @@ class Identicon(input: BitmessageAddress) : Drawable() {
override fun getOpacity() = PixelFormat.TRANSPARENT override fun getOpacity() = PixelFormat.TRANSPARENT
companion object { companion object {
private val SIZE = 9 private const val SIZE = 9
private val CENTER_COLUMN = 5 private const val CENTER_COLUMN = 5
} }
} }

View File

@ -72,6 +72,6 @@ class ImportIdentitiesFragment : Fragment() {
} }
companion object { companion object {
val WIF_DATA = "wif_data" const val WIF_DATA = "wif_data"
} }
} }

View File

@ -19,7 +19,7 @@ package ch.dissem.apps.abit
/** /**
* @author Christian Basler * @author Christian Basler
*/ */
interface ListHolder<L> { interface ListHolder<in L> {
fun updateList(label: L) fun updateList(label: L)
fun setActivateOnItemClick(activateOnItemClick: Boolean) fun setActivateOnItemClick(activateOnItemClick: Boolean)

View File

@ -507,7 +507,8 @@ class MainActivity : AppCompatActivity(), ListSelectionListener<Serializable> {
fun setDetailView(fragment: Fragment) { fun setDetailView(fragment: Fragment) {
if (hasDetailPane) { if (hasDetailPane) {
supportFragmentManager.beginTransaction() supportFragmentManager
.beginTransaction()
.replace(R.id.message_detail_container, fragment) .replace(R.id.message_detail_container, fragment)
.commit() .commit()
} }

View File

@ -298,7 +298,7 @@ class MessageDetailFragment : Fragment() {
* The fragment argument representing the item ID that this fragment * The fragment argument representing the item ID that this fragment
* represents. * represents.
*/ */
val ARG_ITEM = "item" const val ARG_ITEM = "item"
fun isInTrash(item: Plaintext?) = item?.labels?.any { it.type == Label.Type.TRASH } == true fun isInTrash(item: Plaintext?) = item?.labels?.any { it.type == Label.Type.TRASH } == true
} }

View File

@ -55,6 +55,6 @@ class ErrorNotification(ctx: Context) : AbstractNotification(ctx) {
override val notificationId = ERROR_NOTIFICATION_ID override val notificationId = ERROR_NOTIFICATION_ID
companion object { companion object {
val ERROR_NOTIFICATION_ID = 4 const val ERROR_NOTIFICATION_ID = 4
} }
} }

View File

@ -128,7 +128,7 @@ class NewMessageNotification(ctx: Context) : AbstractNotification(ctx) {
override val notificationId = NEW_MESSAGE_NOTIFICATION_ID override val notificationId = NEW_MESSAGE_NOTIFICATION_ID
companion object { companion object {
private val NEW_MESSAGE_NOTIFICATION_ID = 1 private const val NEW_MESSAGE_NOTIFICATION_ID = 1
private val SPAN_EMPHASIS = StyleSpan(Typeface.BOLD) private val SPAN_EMPHASIS = StyleSpan(Typeface.BOLD)
} }
} }

View File

@ -54,7 +54,7 @@ class AndroidInventory(private val sql: SqlHelper) : Inventory {
private fun getCache(stream: Long): MutableMap<InventoryVector, Long> { private fun getCache(stream: Long): MutableMap<InventoryVector, Long> {
fun addToCache(stream: Long): MutableMap<InventoryVector, Long> { fun addToCache(stream: Long): MutableMap<InventoryVector, Long> {
val result: MutableMap<InventoryVector, Long> = ConcurrentHashMap() val result: MutableMap<InventoryVector, Long> = ConcurrentHashMap()
cache.put(stream, result) cache[stream] = result
val projection = arrayOf(COLUMN_HASH, COLUMN_EXPIRES) val projection = arrayOf(COLUMN_HASH, COLUMN_EXPIRES)
@ -149,7 +149,7 @@ class AndroidInventory(private val sql: SqlHelper) : Inventory {
sql.writableDatabase.insertOrThrow(TABLE_NAME, null, values) sql.writableDatabase.insertOrThrow(TABLE_NAME, null, values)
getCache(objectMessage.stream).put(iv, objectMessage.expiresTime) getCache(objectMessage.stream)[iv] = objectMessage.expiresTime
} catch (e: SQLiteConstraintException) { } catch (e: SQLiteConstraintException) {
LOG.trace(e.message, e) LOG.trace(e.message, e)
} }

View File

@ -125,13 +125,13 @@ class AndroidProofOfWorkRepository(private val sql: SqlHelper) : ProofOfWorkRepo
companion object { companion object {
private val LOG = LoggerFactory.getLogger(AndroidProofOfWorkRepository::class.java) private val LOG = LoggerFactory.getLogger(AndroidProofOfWorkRepository::class.java)
private val TABLE_NAME = "POW" private const val TABLE_NAME = "POW"
private val COLUMN_INITIAL_HASH = "initial_hash" private const val COLUMN_INITIAL_HASH = "initial_hash"
private val COLUMN_DATA = "data" private const val COLUMN_DATA = "data"
private val COLUMN_VERSION = "version" private const val COLUMN_VERSION = "version"
private val COLUMN_NONCE_TRIALS_PER_BYTE = "nonce_trials_per_byte" private const val COLUMN_NONCE_TRIALS_PER_BYTE = "nonce_trials_per_byte"
private val COLUMN_EXTRA_BYTES = "extra_bytes" private const val COLUMN_EXTRA_BYTES = "extra_bytes"
private val COLUMN_EXPIRATION_TIME = "expiration_time" private const val COLUMN_EXPIRATION_TIME = "expiration_time"
private val COLUMN_MESSAGE_ID = "message_id" private const val COLUMN_MESSAGE_ID = "message_id"
} }
} }

View File

@ -90,7 +90,7 @@ class SqlHelper(private val ctx: Context) : SQLiteOpenHelper(ctx, DATABASE_NAME,
companion object { companion object {
// If you change the database schema, you must increment the database version. // If you change the database schema, you must increment the database version.
private val DATABASE_VERSION = 7 private const val DATABASE_VERSION = 7
val DATABASE_NAME = "jabit.db" const val DATABASE_NAME = "jabit.db"
} }
} }

View File

@ -25,11 +25,9 @@ import android.net.ConnectivityManager
import android.os.Handler import android.os.Handler
import ch.dissem.apps.abit.notification.NetworkNotification import ch.dissem.apps.abit.notification.NetworkNotification
import ch.dissem.apps.abit.notification.NetworkNotification.Companion.NETWORK_NOTIFICATION_ID import ch.dissem.apps.abit.notification.NetworkNotification.Companion.NETWORK_NOTIFICATION_ID
import ch.dissem.apps.abit.util.NetworkUtils
import ch.dissem.apps.abit.util.Preferences import ch.dissem.apps.abit.util.Preferences
import ch.dissem.bitmessage.BitmessageContext import ch.dissem.bitmessage.BitmessageContext
import ch.dissem.bitmessage.utils.Property import ch.dissem.bitmessage.utils.Property
import org.jetbrains.anko.connectivityManager
/** /**
* Define a Service that returns an IBinder for the * Define a Service that returns an IBinder for the

View File

@ -19,7 +19,6 @@ package ch.dissem.apps.abit.service
import android.app.Service import android.app.Service
import android.content.Intent import android.content.Intent
import android.os.Binder import android.os.Binder
import android.os.IBinder
import android.support.v4.content.ContextCompat import android.support.v4.content.ContextCompat
import ch.dissem.apps.abit.notification.ProofOfWorkNotification import ch.dissem.apps.abit.notification.ProofOfWorkNotification
import ch.dissem.apps.abit.notification.ProofOfWorkNotification.Companion.ONGOING_NOTIFICATION_ID import ch.dissem.apps.abit.notification.ProofOfWorkNotification.Companion.ONGOING_NOTIFICATION_ID

View File

@ -2,7 +2,6 @@ package ch.dissem.apps.abit.service
import android.app.job.JobParameters import android.app.job.JobParameters
import android.app.job.JobService import android.app.job.JobService
import android.content.Intent
import android.os.Build import android.os.Build
import android.support.annotation.RequiresApi import android.support.annotation.RequiresApi
import ch.dissem.apps.abit.util.NetworkUtils import ch.dissem.apps.abit.util.NetworkUtils

View File

@ -18,7 +18,6 @@ package ch.dissem.apps.abit.synchronization
import android.app.Service import android.app.Service
import android.content.Intent import android.content.Intent
import android.os.IBinder
/** /**
* Define a Service that returns an IBinder for the * Define a Service that returns an IBinder for the

View File

@ -44,7 +44,7 @@ import java.io.ByteArrayOutputStream
object Drawables { object Drawables {
private val LOG = LoggerFactory.getLogger(Drawables::class.java) private val LOG = LoggerFactory.getLogger(Drawables::class.java)
private val QR_CODE_SIZE = 350 private const val QR_CODE_SIZE = 350
fun addIcon(ctx: Context, menu: Menu, menuItem: Int, icon: IIcon): MenuItem { fun addIcon(ctx: Context, menu: Menu, menuItem: Int, icon: IIcon): MenuItem {
val item = menu.findItem(menuItem) val item = menu.findItem(menuItem)

View File

@ -25,7 +25,7 @@ class Observable<T>(value: T) {
* To prevent memory leaks, the observer must be removed if it isn't used anymore. * To prevent memory leaks, the observer must be removed if it isn't used anymore.
*/ */
fun addObserver(key: Any, observer: (T) -> Unit) { fun addObserver(key: Any, observer: (T) -> Unit) {
observers.put(key, observer) observers[key] = observer
} }
/** /**

View File

@ -44,7 +44,7 @@ public final class PRNGFixes {
private static final int VERSION_CODE_JELLY_BEAN = 16; private static final int VERSION_CODE_JELLY_BEAN = 16;
private static final int VERSION_CODE_JELLY_BEAN_MR2 = 18; private static final int VERSION_CODE_JELLY_BEAN_MR2 = 18;
private static final byte[] BUILD_FINGERPRINT_AND_DEVICE_SERIAL = private static final byte[] BUILD_FINGERPRINT_AND_DEVICE_SERIAL =
getBuildFingerprintAndDeviceSerial(); getBuildFingerprintAndDeviceSerial();
/** /**
* Hidden constructor to prevent instantiation. * Hidden constructor to prevent instantiation.
@ -70,7 +70,7 @@ public final class PRNGFixes {
*/ */
private static void applyOpenSSLFix() throws SecurityException { private static void applyOpenSSLFix() throws SecurityException {
if ((Build.VERSION.SDK_INT < VERSION_CODE_JELLY_BEAN) if ((Build.VERSION.SDK_INT < VERSION_CODE_JELLY_BEAN)
|| (Build.VERSION.SDK_INT > VERSION_CODE_JELLY_BEAN_MR2)) { || (Build.VERSION.SDK_INT > VERSION_CODE_JELLY_BEAN_MR2)) {
// No need to apply the fix // No need to apply the fix
return; return;
} }
@ -78,18 +78,18 @@ public final class PRNGFixes {
try { try {
// Mix in the device- and invocation-specific seed. // Mix in the device- and invocation-specific seed.
Class.forName("org.apache.harmony.xnet.provider.jsse.NativeCrypto") Class.forName("org.apache.harmony.xnet.provider.jsse.NativeCrypto")
.getMethod("RAND_seed", byte[].class) .getMethod("RAND_seed", byte[].class)
.invoke(null, (Object) generateSeed()); .invoke(null, (Object) generateSeed());
// Mix output of Linux PRNG into OpenSSL's PRNG // Mix output of Linux PRNG into OpenSSL's PRNG
int bytesRead = (Integer) Class.forName( int bytesRead = (Integer) Class.forName(
"org.apache.harmony.xnet.provider.jsse.NativeCrypto") "org.apache.harmony.xnet.provider.jsse.NativeCrypto")
.getMethod("RAND_load_file", String.class, long.class) .getMethod("RAND_load_file", String.class, long.class)
.invoke(null, "/dev/urandom", 1024); .invoke(null, "/dev/urandom", 1024);
if (bytesRead != 1024) { if (bytesRead != 1024) {
throw new IOException( throw new IOException(
"Unexpected number of bytes read from Linux PRNG: " "Unexpected number of bytes read from Linux PRNG: "
+ bytesRead); + bytesRead);
} }
} catch (Exception e) { } catch (Exception e) {
throw new SecurityException("Failed to seed OpenSSL PRNG", e); throw new SecurityException("Failed to seed OpenSSL PRNG", e);
@ -104,7 +104,7 @@ public final class PRNGFixes {
* @throws SecurityException if the fix is needed but could not be applied. * @throws SecurityException if the fix is needed but could not be applied.
*/ */
private static void installLinuxPRNGSecureRandom() private static void installLinuxPRNGSecureRandom()
throws SecurityException { throws SecurityException {
if (Build.VERSION.SDK_INT > VERSION_CODE_JELLY_BEAN_MR2) { if (Build.VERSION.SDK_INT > VERSION_CODE_JELLY_BEAN_MR2) {
// No need to apply the fix // No need to apply the fix
return; return;
@ -113,11 +113,11 @@ public final class PRNGFixes {
// Install a Linux PRNG-based SecureRandom implementation as the // Install a Linux PRNG-based SecureRandom implementation as the
// default, if not yet installed. // default, if not yet installed.
Provider[] secureRandomProviders = Provider[] secureRandomProviders =
Security.getProviders("SecureRandom.SHA1PRNG"); Security.getProviders("SecureRandom.SHA1PRNG");
if ((secureRandomProviders == null) if ((secureRandomProviders == null)
|| (secureRandomProviders.length < 1) || (secureRandomProviders.length < 1)
|| (!LinuxPRNGSecureRandomProvider.class.equals( || (!LinuxPRNGSecureRandomProvider.class.equals(
secureRandomProviders[0].getClass()))) { secureRandomProviders[0].getClass()))) {
Security.insertProviderAt(new LinuxPRNGSecureRandomProvider(), 1); Security.insertProviderAt(new LinuxPRNGSecureRandomProvider(), 1);
} }
@ -126,10 +126,10 @@ public final class PRNGFixes {
// by the Linux PRNG-based SecureRandom implementation. // by the Linux PRNG-based SecureRandom implementation.
SecureRandom rng1 = new SecureRandom(); SecureRandom rng1 = new SecureRandom();
if (!LinuxPRNGSecureRandomProvider.class.equals( if (!LinuxPRNGSecureRandomProvider.class.equals(
rng1.getProvider().getClass())) { rng1.getProvider().getClass())) {
throw new SecurityException( throw new SecurityException(
"new SecureRandom() backed by wrong Provider: " "new SecureRandom() backed by wrong Provider: "
+ rng1.getProvider().getClass()); + rng1.getProvider().getClass());
} }
SecureRandom rng2; SecureRandom rng2;
@ -139,10 +139,10 @@ public final class PRNGFixes {
throw new SecurityException("SHA1PRNG not available", e); throw new SecurityException("SHA1PRNG not available", e);
} }
if (!LinuxPRNGSecureRandomProvider.class.equals( if (!LinuxPRNGSecureRandomProvider.class.equals(
rng2.getProvider().getClass())) { rng2.getProvider().getClass())) {
throw new SecurityException( throw new SecurityException(
"SecureRandom.getInstance(\"SHA1PRNG\") backed by wrong" "SecureRandom.getInstance(\"SHA1PRNG\") backed by wrong"
+ " Provider: " + rng2.getProvider().getClass()); + " Provider: " + rng2.getProvider().getClass());
} }
} }
@ -152,11 +152,11 @@ public final class PRNGFixes {
*/ */
private static class LinuxPRNGSecureRandomProvider extends Provider { private static class LinuxPRNGSecureRandomProvider extends Provider {
public LinuxPRNGSecureRandomProvider() { LinuxPRNGSecureRandomProvider() {
super("LinuxPRNG", super("LinuxPRNG",
1.0, 1.0,
"A Linux-specific random number provider that uses" "A Linux-specific random number provider that uses"
+ " /dev/urandom"); + " /dev/urandom");
// Although /dev/urandom is not a SHA-1 PRNG, some apps // Although /dev/urandom is not a SHA-1 PRNG, some apps
// explicitly request a SHA1PRNG SecureRandom and we thus need to // explicitly request a SHA1PRNG SecureRandom and we thus need to
// prevent them from getting the default implementation whose output // prevent them from getting the default implementation whose output
@ -225,7 +225,7 @@ public final class PRNGFixes {
// On a small fraction of devices /dev/urandom is not writable. // On a small fraction of devices /dev/urandom is not writable.
// Log and ignore. // Log and ignore.
Log.w(PRNGFixes.class.getSimpleName(), Log.w(PRNGFixes.class.getSimpleName(),
"Failed to mix seed into " + URANDOM_FILE); "Failed to mix seed into " + URANDOM_FILE);
} finally { } finally {
mSeeded = true; mSeeded = true;
} }
@ -249,7 +249,7 @@ public final class PRNGFixes {
} }
} catch (IOException e) { } catch (IOException e) {
throw new SecurityException( throw new SecurityException(
"Failed to read from " + URANDOM_FILE, e); "Failed to read from " + URANDOM_FILE, e);
} }
} }
@ -269,10 +269,10 @@ public final class PRNGFixes {
// output being pulled into this process prematurely. // output being pulled into this process prematurely.
try { try {
sUrandomIn = new DataInputStream( sUrandomIn = new DataInputStream(
new FileInputStream(URANDOM_FILE)); new FileInputStream(URANDOM_FILE));
} catch (IOException e) { } catch (IOException e) {
throw new SecurityException("Failed to open " throw new SecurityException("Failed to open "
+ URANDOM_FILE + " for reading", e); + URANDOM_FILE + " for reading", e);
} }
} }
return sUrandomIn; return sUrandomIn;
@ -297,7 +297,7 @@ public final class PRNGFixes {
try { try {
ByteArrayOutputStream seedBuffer = new ByteArrayOutputStream(); ByteArrayOutputStream seedBuffer = new ByteArrayOutputStream();
DataOutputStream seedBufferOut = DataOutputStream seedBufferOut =
new DataOutputStream(seedBuffer); new DataOutputStream(seedBuffer);
seedBufferOut.writeLong(System.currentTimeMillis()); seedBufferOut.writeLong(System.currentTimeMillis());
seedBufferOut.writeLong(System.nanoTime()); seedBufferOut.writeLong(System.nanoTime());
seedBufferOut.writeInt(Process.myPid()); seedBufferOut.writeInt(Process.myPid());
@ -341,4 +341,4 @@ public final class PRNGFixes {
throw new RuntimeException("UTF-8 encoding not supported"); throw new RuntimeException("UTF-8 encoding not supported");
} }
} }
} }

View File

@ -37,11 +37,11 @@
android:layout_alignTop="@+id/avatar" android:layout_alignTop="@+id/avatar"
android:layout_toEndOf="@+id/avatar" android:layout_toEndOf="@+id/avatar"
android:ellipsize="end" android:ellipsize="end"
android:lines="1"
android:paddingBottom="0dp" android:paddingBottom="0dp"
android:paddingLeft="8dp" android:paddingLeft="8dp"
android:paddingRight="8dp" android:paddingRight="8dp"
android:paddingTop="0dp" android:paddingTop="0dp"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceMedium" android:textAppearance="?android:attr/textAppearanceMedium"
android:textStyle="bold" android:textStyle="bold"
tools:text="Name" /> tools:text="Name" />
@ -53,9 +53,9 @@
android:layout_alignBottom="@+id/avatar" android:layout_alignBottom="@+id/avatar"
android:layout_toEndOf="@+id/avatar" android:layout_toEndOf="@+id/avatar"
android:ellipsize="marquee" android:ellipsize="marquee"
android:lines="1"
android:paddingLeft="8dp" android:paddingLeft="8dp"
android:paddingRight="8dp" android:paddingRight="8dp"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall" android:textAppearance="?android:attr/textAppearanceSmall"
tools:text="BM-2cW0000000000000000000000000000000" /> tools:text="BM-2cW0000000000000000000000000000000" />

View File

@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?><!--
<!--
~ Copyright 2016 Christian Basler ~ Copyright 2016 Christian Basler
~ ~
~ Licensed under the Apache License, Version 2.0 (the "License"); ~ Licensed under the Apache License, Version 2.0 (the "License");
@ -15,8 +14,7 @@
~ limitations under the License. ~ limitations under the License.
--> -->
<android.support.constraint.ConstraintLayout <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -34,13 +32,13 @@
app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
tools:layout_constraintLeft_creator="1" tools:layout_constraintLeft_creator="1"
tools:layout_constraintTop_creator="1"/> tools:layout_constraintTop_creator="1" />
<android.support.design.widget.TextInputLayout <android.support.design.widget.TextInputLayout
android:id="@+id/label_wrapper" android:id="@+id/label_wrapper"
android:layout_marginTop="24dp"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="24dp"
app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@id/description"> app:layout_constraintTop_toBottomOf="@id/description">
@ -48,7 +46,7 @@
android:id="@+id/label" android:id="@+id/label"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:hint="@string/label"/> android:hint="@string/label" />
</android.support.design.widget.TextInputLayout> </android.support.design.widget.TextInputLayout>
@ -64,7 +62,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:hint="@string/passphrase" android:hint="@string/passphrase"
android:inputType="textMultiLine"/> android:inputType="textMultiLine" />
</android.support.design.widget.TextInputLayout> </android.support.design.widget.TextInputLayout>
@ -82,7 +80,8 @@
android:ems="10" android:ems="10"
android:hint="@string/number_of_identities" android:hint="@string/number_of_identities"
android:inputType="number" android:inputType="number"
android:text="1"/> android:text="1"
tools:ignore="HardcodedText" />
</android.support.design.widget.TextInputLayout> </android.support.design.widget.TextInputLayout>
@ -92,7 +91,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/shorter" android:text="@string/shorter"
app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@id/number_of_identities_wrapper"/> app:layout_constraintTop_toBottomOf="@id/number_of_identities_wrapper" />
<Button <Button
android:id="@+id/ok" android:id="@+id/ok"
@ -103,7 +102,7 @@
android:text="@string/ok" android:text="@string/ok"
android:textColor="@color/colorAccent" android:textColor="@color/colorAccent"
app:layout_constraintRight_toRightOf="parent" app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/shorter"/> app:layout_constraintTop_toBottomOf="@id/shorter" />
<Button <Button
android:id="@+id/dismiss" android:id="@+id/dismiss"
@ -113,6 +112,6 @@
android:text="@string/cancel" android:text="@string/cancel"
android:textColor="@color/colorAccent" android:textColor="@color/colorAccent"
app:layout_constraintBottom_toBottomOf="@id/ok" app:layout_constraintBottom_toBottomOf="@id/ok"
app:layout_constraintRight_toLeftOf="@id/ok"/> app:layout_constraintRight_toLeftOf="@id/ok" />
</android.support.constraint.ConstraintLayout> </android.support.constraint.ConstraintLayout>

View File

@ -26,6 +26,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@drawable/bg_item_normal_state" android:background="@drawable/bg_item_normal_state"
android:clickable="true" android:clickable="true"
android:focusable="true"
android:foreground="?attr/selectableItemBackground" android:foreground="?attr/selectableItemBackground"
tools:ignore="UselessParent"> tools:ignore="UselessParent">

View File

@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?><!--
<!--
~ Copyright 2016 Christian Basler ~ Copyright 2016 Christian Basler
~ ~
~ Licensed under the Apache License, Version 2.0 (the "License"); ~ Licensed under the Apache License, Version 2.0 (the "License");
@ -16,9 +15,9 @@
--> -->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="64dp"> android:layout_height="64dp">
<CheckBox <CheckBox
android:id="@+id/checkbox" android:id="@+id/checkbox"
@ -31,21 +30,22 @@
android:paddingEnd="8dp" android:paddingEnd="8dp"
android:paddingStart="16dp" android:paddingStart="16dp"
android:paddingTop="8dp" android:paddingTop="8dp"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceMedium" android:textAppearance="?android:attr/textAppearanceMedium"
tools:text="Name"/> tools:text="Name" />
<TextView <TextView
android:id="@+id/address" android:id="@+id/address"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:layout_alignParentStart="true"
android:ellipsize="marquee" android:ellipsize="marquee"
android:lines="1"
android:paddingBottom="8dp" android:paddingBottom="8dp"
android:paddingEnd="8dp" android:paddingEnd="8dp"
android:paddingStart="48dp" android:paddingStart="48dp"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall" android:textAppearance="?android:attr/textAppearanceSmall"
tools:text="BM-2cW0000000000000000000000000000000"/> tools:text="BM-2cW0000000000000000000000000000000" />
</RelativeLayout> </RelativeLayout>

View File

@ -5,7 +5,7 @@
<item name="android:activatedBackgroundIndicator">@drawable/bg_item_activated</item> <item name="android:activatedBackgroundIndicator">@drawable/bg_item_activated</item>
<item name="android:textColor">@color/colorPrimaryText</item> <item name="android:textColor">@color/colorPrimaryText</item>
<item name="android:textColorSecondary">@color/colorSecondaryText</item> <item name="android:textColorSecondary">@color/colorSecondaryText</item>
<item name="preferenceTheme">@style/PreferenceThemeOverlay</item> <item name="preferenceTheme">@style/PreferenceThemeOverlay.v14.Material</item>
</style> </style>
<style name="CustomShowcaseTheme" parent="ShowcaseView"> <style name="CustomShowcaseTheme" parent="ShowcaseView">

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android"> <paths>
<files-path name="exports" path="exports/"/> <files-path name="exports" path="exports/"/>
</paths> </paths>

View File

@ -1,64 +1,58 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"> <android.support.v7.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<SwitchPreferenceCompat <android.support.v7.preference.SwitchPreferenceCompat
android:defaultValue="true" android:defaultValue="true"
android:key="wifi_only" android:key="wifi_only"
android:summary="@string/wifi_only_summary" android:summary="@string/wifi_only_summary"
android:title="@string/wifi_only"/> android:title="@string/wifi_only" />
<SwitchPreferenceCompat <android.support.v7.preference.SwitchPreferenceCompat
android:defaultValue="true" android:defaultValue="true"
android:key="request_acknowledgements" android:key="request_acknowledgements"
android:summary="@string/request_acknowledgements_summary" android:summary="@string/request_acknowledgements_summary"
android:title="@string/request_acknowledgements"/> android:title="@string/request_acknowledgements" />
<EditTextPreference <android.support.v7.preference.EditTextPreference
android:inputType="textUri" android:inputType="textUri"
android:key="trusted_node" android:key="trusted_node"
android:summary="@string/trusted_node_summary" android:summary="@string/trusted_node_summary"
android:title="@string/trusted_node"/> android:title="@string/trusted_node" />
<EditTextPreference <android.support.v7.preference.EditTextPreference
android:defaultValue="120" android:defaultValue="120"
android:inputType="number" android:inputType="number"
android:key="sync_timeout" android:key="sync_timeout"
android:summary="@string/sync_timeout_summary" android:summary="@string/sync_timeout_summary"
android:title="@string/sync_timeout"/> android:title="@string/sync_timeout" />
<SwitchPreferenceCompat <android.support.v7.preference.SwitchPreferenceCompat
android:defaultValue="false" android:defaultValue="false"
android:dependency="trusted_node" android:dependency="trusted_node"
android:key="server_pow" android:key="server_pow"
android:summary="@string/server_pow_summary" android:summary="@string/server_pow_summary"
android:title="@string/server_pow" android:title="@string/server_pow" />
/> <android.support.v7.preference.Preference
<Preference
android:key="about" android:key="about"
android:summary="@string/about_summary" android:summary="@string/about_summary"
android:title="@string/about" android:title="@string/about" />
/> <android.support.v7.preference.Preference
<Preference
android:key="help_out" android:key="help_out"
android:summary="@string/help_out_summary" android:summary="@string/help_out_summary"
android:title="@string/help_out"> android:title="@string/help_out">
<intent <intent
android:action="android.intent.action.VIEW" android:action="android.intent.action.VIEW"
android:data="@string/help_out_link"/> android:data="@string/help_out_link" />
</Preference> </android.support.v7.preference.Preference>
<Preference <android.support.v7.preference.Preference
android:key="cleanup" android:key="cleanup"
android:title="@string/cleanup"
android:summary="@string/cleanup_summary" android:summary="@string/cleanup_summary"
/> android:title="@string/cleanup" />
<Preference <android.support.v7.preference.Preference
android:key="export" android:key="export"
android:title="@string/export_data"
android:summary="@string/export_data_summary" android:summary="@string/export_data_summary"
/> android:title="@string/export_data" />
<Preference <android.support.v7.preference.Preference
android:key="import" android:key="import"
android:title="@string/import_data"
android:summary="@string/import_data_summary" android:summary="@string/import_data_summary"
/> android:title="@string/import_data" />
<Preference <android.support.v7.preference.Preference
android:key="status" android:key="status"
android:summary="@string/status_summary" android:summary="@string/status_summary"
android:title="@string/status" android:title="@string/status" />
/> </android.support.v7.preference.PreferenceScreen>
</PreferenceScreen>

View File

@ -17,7 +17,7 @@
package ch.dissem.bitmessage.repository package ch.dissem.bitmessage.repository
import android.os.Build import android.os.Build
import ch.dissem.apps.abit.BuildConfig import android.os.Build.VERSION_CODES.LOLLIPOP
import ch.dissem.apps.abit.repository.AndroidAddressRepository import ch.dissem.apps.abit.repository.AndroidAddressRepository
import ch.dissem.apps.abit.repository.SqlHelper import ch.dissem.apps.abit.repository.SqlHelper
import ch.dissem.bitmessage.entity.BitmessageAddress import ch.dissem.bitmessage.entity.BitmessageAddress
@ -32,7 +32,7 @@ import org.robolectric.RuntimeEnvironment
import org.robolectric.annotation.Config import org.robolectric.annotation.Config
@RunWith(RobolectricTestRunner::class) @RunWith(RobolectricTestRunner::class)
@Config(sdk = intArrayOf(Build.VERSION_CODES.LOLLIPOP), packageName = "ch.dissem.apps.abit") @Config(sdk = [LOLLIPOP], packageName = "ch.dissem.apps.abit")
class AndroidAddressRepositoryTest : TestBase() { class AndroidAddressRepositoryTest : TestBase() {
private val contactA = "BM-2cW7cD5cDQJDNkE7ibmyTxfvGAmnPqa9Vt" private val contactA = "BM-2cW7cD5cDQJDNkE7ibmyTxfvGAmnPqa9Vt"
private val contactB = "BM-2cTtkBnb4BUYDndTKun6D9PjtueP2h1bQj" private val contactB = "BM-2cTtkBnb4BUYDndTKun6D9PjtueP2h1bQj"

View File

@ -17,7 +17,7 @@
package ch.dissem.bitmessage.repository package ch.dissem.bitmessage.repository
import android.os.Build import android.os.Build
import ch.dissem.apps.abit.BuildConfig import android.os.Build.VERSION_CODES.LOLLIPOP
import ch.dissem.apps.abit.repository.AndroidInventory import ch.dissem.apps.abit.repository.AndroidInventory
import ch.dissem.apps.abit.repository.SqlHelper import ch.dissem.apps.abit.repository.SqlHelper
import ch.dissem.bitmessage.entity.BitmessageAddress import ch.dissem.bitmessage.entity.BitmessageAddress
@ -40,7 +40,7 @@ import org.robolectric.annotation.Config
import java.util.* import java.util.*
@RunWith(RobolectricTestRunner::class) @RunWith(RobolectricTestRunner::class)
@Config(sdk = intArrayOf(Build.VERSION_CODES.LOLLIPOP), packageName = "ch.dissem.apps.abit") @Config(sdk = [LOLLIPOP], packageName = "ch.dissem.apps.abit")
class AndroidInventoryTest : TestBase() { class AndroidInventoryTest : TestBase() {
private lateinit var inventory: Inventory private lateinit var inventory: Inventory
@ -135,11 +135,12 @@ class AndroidInventoryTest : TestBase() {
} }
private fun getObjectMessage(stream: Long, TTL: Long, payload: ObjectPayload) = ObjectMessage( private fun getObjectMessage(stream: Long, TTL: Long, payload: ObjectPayload) = ObjectMessage(
nonce = ByteArray(8), nonce = ByteArray(8),
expiresTime = now + TTL, expiresTime = now + TTL,
stream = stream, stream = stream,
payload = payload payload = payload
) )
private val getPubkey: GetPubkey = GetPubkey(BitmessageAddress("BM-2cW7cD5cDQJDNkE7ibmyTxfvGAmnPqa9Vt")) private val getPubkey: GetPubkey =
GetPubkey(BitmessageAddress("BM-2cW7cD5cDQJDNkE7ibmyTxfvGAmnPqa9Vt"))
} }

View File

@ -17,6 +17,7 @@
package ch.dissem.bitmessage.repository package ch.dissem.bitmessage.repository
import android.os.Build import android.os.Build
import android.os.Build.VERSION_CODES.LOLLIPOP
import ch.dissem.apps.abit.repository.AndroidLabelRepository import ch.dissem.apps.abit.repository.AndroidLabelRepository
import ch.dissem.apps.abit.repository.SqlHelper import ch.dissem.apps.abit.repository.SqlHelper
import ch.dissem.bitmessage.entity.valueobject.Label import ch.dissem.bitmessage.entity.valueobject.Label
@ -30,7 +31,7 @@ import org.robolectric.RuntimeEnvironment
import org.robolectric.annotation.Config import org.robolectric.annotation.Config
@RunWith(RobolectricTestRunner::class) @RunWith(RobolectricTestRunner::class)
@Config(sdk = intArrayOf(Build.VERSION_CODES.LOLLIPOP), packageName = "ch.dissem.apps.abit") @Config(sdk = [LOLLIPOP], packageName = "ch.dissem.apps.abit")
class AndroidLabelRepositoryTest : TestBase() { class AndroidLabelRepositoryTest : TestBase() {
private lateinit var repo: LabelRepository private lateinit var repo: LabelRepository

View File

@ -16,7 +16,7 @@
package ch.dissem.bitmessage.repository package ch.dissem.bitmessage.repository
import android.os.Build import android.os.Build.VERSION_CODES.LOLLIPOP
import ch.dissem.apps.abit.repository.AndroidAddressRepository import ch.dissem.apps.abit.repository.AndroidAddressRepository
import ch.dissem.apps.abit.repository.AndroidLabelRepository import ch.dissem.apps.abit.repository.AndroidLabelRepository
import ch.dissem.apps.abit.repository.AndroidMessageRepository import ch.dissem.apps.abit.repository.AndroidMessageRepository
@ -31,7 +31,6 @@ import ch.dissem.bitmessage.entity.valueobject.ExtendedEncoding
import ch.dissem.bitmessage.entity.valueobject.Label import ch.dissem.bitmessage.entity.valueobject.Label
import ch.dissem.bitmessage.entity.valueobject.PrivateKey import ch.dissem.bitmessage.entity.valueobject.PrivateKey
import ch.dissem.bitmessage.entity.valueobject.extended.Message import ch.dissem.bitmessage.entity.valueobject.extended.Message
import ch.dissem.bitmessage.ports.LabelRepository
import ch.dissem.bitmessage.ports.MessageRepository import ch.dissem.bitmessage.ports.MessageRepository
import ch.dissem.bitmessage.utils.UnixTime import ch.dissem.bitmessage.utils.UnixTime
import org.hamcrest.BaseMatcher import org.hamcrest.BaseMatcher
@ -48,7 +47,7 @@ import org.robolectric.annotation.Config
import java.util.* import java.util.*
@RunWith(RobolectricTestRunner::class) @RunWith(RobolectricTestRunner::class)
@Config(sdk = intArrayOf(Build.VERSION_CODES.LOLLIPOP), packageName = "ch.dissem.apps.abit") @Config(sdk = [LOLLIPOP], packageName = "ch.dissem.apps.abit")
class AndroidMessageRepositoryTest : TestBase() { class AndroidMessageRepositoryTest : TestBase() {
private lateinit var contactA: BitmessageAddress private lateinit var contactA: BitmessageAddress
private lateinit var contactB: BitmessageAddress private lateinit var contactB: BitmessageAddress

View File

@ -17,7 +17,7 @@
package ch.dissem.bitmessage.repository package ch.dissem.bitmessage.repository
import android.os.Build import android.os.Build
import ch.dissem.apps.abit.BuildConfig import android.os.Build.VERSION_CODES.LOLLIPOP
import ch.dissem.apps.abit.repository.AndroidNodeRegistry import ch.dissem.apps.abit.repository.AndroidNodeRegistry
import ch.dissem.apps.abit.repository.SqlHelper import ch.dissem.apps.abit.repository.SqlHelper
import ch.dissem.bitmessage.entity.valueobject.NetworkAddress import ch.dissem.bitmessage.entity.valueobject.NetworkAddress
@ -39,7 +39,7 @@ import java.util.*
* as the initial nodes' IP addresses are determined by DNS lookup. * as the initial nodes' IP addresses are determined by DNS lookup.
*/ */
@RunWith(RobolectricTestRunner::class) @RunWith(RobolectricTestRunner::class)
@Config(sdk = intArrayOf(Build.VERSION_CODES.LOLLIPOP), packageName = "ch.dissem.apps.abit") @Config(sdk = [LOLLIPOP], packageName = "ch.dissem.apps.abit")
class AndroidNodeRegistryTest : TestBase() { class AndroidNodeRegistryTest : TestBase() {
private lateinit var registry: NodeRegistry private lateinit var registry: NodeRegistry

View File

@ -46,7 +46,7 @@ import kotlin.properties.Delegates
* @author Christian Basler * @author Christian Basler
*/ */
@RunWith(RobolectricTestRunner::class) @RunWith(RobolectricTestRunner::class)
@Config(sdk = intArrayOf(LOLLIPOP), packageName = "ch.dissem.apps.abit") @Config(sdk = [LOLLIPOP], packageName = "ch.dissem.apps.abit")
class AndroidProofOfWorkRepositoryTest : TestBase() { class AndroidProofOfWorkRepositoryTest : TestBase() {
private lateinit var repo: ProofOfWorkRepository private lateinit var repo: ProofOfWorkRepository
private lateinit var addressRepo: AddressRepository private lateinit var addressRepo: AddressRepository