Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplex #178

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
262 changes: 139 additions & 123 deletions app/app.iml

Large diffs are not rendered by default.

26 changes: 8 additions & 18 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@ repositories {
}

android {
compileSdkVersion 28
buildToolsVersion '28.0.2'
compileSdkVersion 29
buildToolsVersion '28.0.3'
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
defaultConfig {
applicationId "io.github.benoitduffez.cupsprint"
minSdkVersion 19
targetSdkVersion 28
targetSdkVersion 29
versionCode buildVersionCode()
versionName version
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand Down Expand Up @@ -75,22 +75,23 @@ android {

dependencies {
implementation 'javax.jmdns:jmdns:3.4.1'
implementation 'androidx.appcompat:appcompat:1.0.0'
playstoreImplementation('com.crashlytics.sdk.android:crashlytics:2.6.5@aar') {
implementation 'androidx.appcompat:appcompat:1.1.0'
playstoreImplementation('com.crashlytics.sdk.android:crashlytics:2.10.1@aar') {
transitive = true
}
androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0-alpha4', {
exclude group: 'com.android.support', module: 'support-annotations'
})
testImplementation 'junit:junit:4.12'
androidTestImplementation 'junit:junit:4.12'
testImplementation 'junit:junit:4.13'
androidTestImplementation 'junit:junit:4.13'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.jakewharton.timber:timber:4.7.1'
// Koin DI
implementation "org.koin:koin-core:${versions.koin}"
implementation "org.koin:koin-core-ext:${versions.koin}"
implementation "org.koin:koin-android:${versions.koin}"
apply plugin: 'kotlin-android-extensions'
implementation 'androidx.preference:preference:1.1.1'
}

apply plugin: 'jacoco'
Expand All @@ -99,17 +100,6 @@ task jacocoTestReport(type: JacocoReport, dependsOn: ['testDebugUnitTest', 'crea
xml.enabled = true
html.enabled = true
}

def fileFilter = ['**/R.class', '**/R$*.class', '**/BuildConfig.*', '**/Manifest*.*', '**/*Test*.*', 'android/**/*.*']
def debugTree = fileTree(dir: "${buildDir}/intermediates/classes/debug", excludes: fileFilter)
def mainSrc = "${project.projectDir}/src/main/java"

sourceDirectories = files([mainSrc])
classDirectories = files([debugTree])
executionData = fileTree(dir: "$buildDir", includes: [
"jacoco/testDebugUnitTest.exec",
"outputs/code-coverage/connected/*coverage.ec"
])
}

play {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ received a copy of the GNU Lesser General Public License along with this
program; if not, see <http://www.gnu.org/licenses/>.
*/

import java.util.LinkedHashMap
import java.util.*

class EnumItemMap(internal var tag: String, internal var tagName: String, internal var description: String)
: LinkedHashMap<Int, EnumItem>()
2 changes: 1 addition & 1 deletion app/src/main/java/ch/ethz/vppserver/ippclient/EnumMap.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ received a copy of the GNU Lesser General Public License along with this
program; if not, see <http://www.gnu.org/licenses/>.
*/

import java.util.LinkedHashMap
import java.util.*

class EnumMap : LinkedHashMap<String, EnumItemMap>()
3 changes: 1 addition & 2 deletions app/src/main/java/ch/ethz/vppserver/ippclient/IppLists.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ program; if not, see <http://www.gnu.org/licenses/>.
*/

import ch.ethz.vppserver.schema.ippclient.Tag
import java.util.ArrayList
import java.util.LinkedHashMap
import java.util.*

object IppLists {
val tagList: MutableList<Tag>
Expand Down
13 changes: 5 additions & 8 deletions app/src/main/java/ch/ethz/vppserver/ippclient/IppResponse.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import ch.ethz.vppserver.schema.ippclient.AttributeValue
import java.io.IOException
import java.nio.ByteBuffer
import java.nio.channels.SocketChannel
import java.util.ArrayList
import java.util.*

/**
* Copyright (C) 2008 ITS of ETH Zurich, Switzerland, Sarah Windler Burri
Expand Down Expand Up @@ -156,7 +156,7 @@ class IppResponse {
continue@loop
}
0x13 -> {
setNoValueAttribute(tag)
setNoValueAttribute()
continue@loop
}
0x21 -> {
Expand Down Expand Up @@ -304,7 +304,7 @@ class IppResponse {

/**
*
* @param channel
* @param buffer
* @return
* @throws IOException
*/
Expand All @@ -319,16 +319,14 @@ class IppResponse {

val result = IppResult()
result.buf = buffer.array()
var ippHeaderResponse = false

// be careful: HTTP and IPP could be transmitted in different set of
// buffers.
// see RFC2910, http://www.ietf.org/rfc/rfc2910, page 19
// read IPP header
if (!ippHeaderResponse && buffer.hasRemaining()) {
if (buffer.hasRemaining()) {
_buf = buffer
result.ippStatusResponse = ippHeader
ippHeaderResponse = true
}

_buf = buffer
Expand Down Expand Up @@ -588,9 +586,8 @@ class IppResponse {

/**
*
* @param tag
*/
private fun setNoValueAttribute(tag: Int) {
private fun setNoValueAttribute() {
val length = _buf!!.short
if (length.toInt() != 0 && _buf!!.remaining() >= length) {
setAttributeName(length)
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/ch/ethz/vppserver/ippclient/IppUtil.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import java.nio.CharBuffer
import java.nio.charset.CharacterCodingException
import java.nio.charset.Charset
import java.nio.charset.CodingErrorAction
import java.util.ArrayList
import java.util.*
import kotlin.experimental.and

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ package ch.ethz.vppserver.schema.ippclient
* This file has been modified. It is not the original.
* XML parsing annotations, etc. have been removed Jon Freeman - 2013 */

import java.util.ArrayList
import java.util.*

class Attribute {
var attributeValue: ArrayList<AttributeValue> = ArrayList()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ package ch.ethz.vppserver.schema.ippclient
* This file has been modified. It is not the original.
* XML parsing annotations, etc. have been removed Jon Freeman - 2013 */

import java.util.ArrayList
import java.util.*

class AttributeGroup {
var attribute: ArrayList<Attribute> = ArrayList()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ package ch.ethz.vppserver.schema.ippclient
* This file has been modified. It is not the original.
* XML parsing annotations, etc. have been removed Jon Freeman - 2013 */

import java.util.ArrayList
import java.util.*

class SetOfEnum {
val enum: List<Enum> = ArrayList()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ package ch.ethz.vppserver.schema.ippclient
* This file has been modified. It is not the original.
* XML parsing annotations, etc. have been removed Jon Freeman - 2013 */

import java.util.ArrayList
import java.util.*

class SetOfKeyword {
val keyword: List<Keyword> = ArrayList()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,7 @@ import java.io.IOException
import java.io.UnsupportedEncodingException
import java.net.HttpURLConnection
import java.net.URL
import java.security.KeyManagementException
import java.security.KeyStore
import java.security.KeyStoreException
import java.security.NoSuchAlgorithmException
import java.security.UnrecoverableKeyException
import java.security.*
import java.security.cert.CertificateException
import java.security.cert.X509Certificate
import javax.net.ssl.HttpsURLConnection
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import android.app.Activity
import android.content.Context
import android.content.SharedPreferences
import android.os.Bundle
import android.view.View
import android.view.ViewGroup
import io.github.benoitduffez.cupsprint.R
import kotlinx.android.synthetic.main.basic_auth.*
Expand All @@ -22,7 +21,7 @@ class BasicAuthActivity : Activity() {
val prefs = getSharedPreferences(CREDENTIALS_FILE, Context.MODE_PRIVATE)

val numCredentials = prefs.getInt(KEY_BASIC_AUTH_NUMBER, 0)
val foundId = findSavedCredentialsId(printersUrl, prefs)
val foundId = findSavedCredentialsId(printersUrl?:"", prefs)
val targetId: Int
if (foundId >= 0) {
targetId = foundId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import androidx.appcompat.app.AppCompatActivity
import io.github.benoitduffez.cupsprint.R
import kotlinx.android.synthetic.main.activity_manage_manual_printers.*
import kotlinx.android.synthetic.main.manage_printers_list_item.view.*
import java.util.ArrayList
import java.util.*

class ManageManualPrintersActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ import java.net.InetAddress
import java.net.MulticastSocket
import java.net.SocketTimeoutException
import java.nio.ByteBuffer
import java.util.ArrayList
import java.util.HashMap

import java.util.*
import javax.jmdns.ServiceInfo
import javax.jmdns.impl.DNSIncoming
import javax.jmdns.impl.DNSRecord
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package io.github.benoitduffez.cupsprint.detect

import timber.log.Timber
import java.util.ArrayList
import java.util.*

internal class Merger {
fun merge(httpRecs: List<PrinterRec>, httpsRecs: MutableList<PrinterRec>) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package io.github.benoitduffez.cupsprint.detect

import java.util.ArrayList
import java.util.Collections
import java.util.*

class PrinterResult internal constructor() {
var printers: List<PrinterRec>? = null
Expand Down
Loading