diff --git a/build.gradle b/build.gradle index 46128eab..325bf552 100644 --- a/build.gradle +++ b/build.gradle @@ -3,15 +3,15 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:1.3.0' + classpath 'com.android.tools.build:gradle:1.5.0' } } apply plugin: 'com.android.application' android { - compileSdkVersion 22 - buildToolsVersion '22.0.1' + compileSdkVersion 23 + buildToolsVersion '23.0.2' dexOptions { javaMaxHeapSize "4g" } @@ -38,6 +38,7 @@ android { pickFirst "META-INF/BCKEY.SF" pickFirst "META-INF/BCKEY.DSA" pickFirst "META-INF/INDEX.LIST" + pickFirst "META-INF/io.netty.versions.properties" } lintOptions { abortOnError false @@ -55,18 +56,21 @@ dependencies { repositories { mavenCentral() } - compile 'com.android.support:support-v4:22.2.1' - compile 'com.android.support:appcompat-v7:22.2.1' - compile 'com.android.support:design:22.2.1' + compile 'com.android.support:support-v4:23.1.1' + compile 'com.android.support:appcompat-v7:23.1.1' + compile 'com.android.support:design:23.1.1' compile 'org.apache.sshd:sshd-core:0.8.0' - compile 'com.madgag.spongycastle:pkix:1.52.0.0' - compile 'org.bouncycastle:bcprov-jdk16:1.46' -// compile 'io.netty:netty-handler:4.0.30.Final' // We use a custom-built netty in libs directory due to ssl related bug - compile fileTree(include: '*.jar', dir: 'libs') + compile 'com.madgag.spongycastle:pkix:1.54.0.0' + //compile 'org.bouncycastle:bcpkix-jdk15on:1.54' + //compile 'org.bouncycastle:bcprov-jdk15on:1.54' + + compile 'io.netty:netty-handler:4.0.33.Final' // Update to 4.1 when released, for compat with Android 5.0 androidTestCompile 'org.mockito:mockito-core:1.10.19' // Because mockito has some problems with dex environment androidTestCompile 'com.google.dexmaker:dexmaker:1.1' androidTestCompile 'com.google.dexmaker:dexmaker-mockito:1.1' + + //compile fileTree(include: '*.jar', dir: 'libs') } diff --git a/libs/netty-handler.jar b/libs/netty-handler.jar deleted file mode 100644 index 7e283cfe..00000000 Binary files a/libs/netty-handler.jar and /dev/null differ diff --git a/src/org/kde/kdeconnect/Backends/LanBackend/LanLink.java b/src/org/kde/kdeconnect/Backends/LanBackend/LanLink.java index c226f068..a14320e5 100644 --- a/src/org/kde/kdeconnect/Backends/LanBackend/LanLink.java +++ b/src/org/kde/kdeconnect/Backends/LanBackend/LanLink.java @@ -21,11 +21,8 @@ package org.kde.kdeconnect.Backends.LanBackend; import android.content.Context; -import android.content.SharedPreferences; import android.util.Log; -import org.apache.mina.core.future.WriteFuture; -import org.apache.mina.core.session.IoSession; import org.json.JSONObject; import org.kde.kdeconnect.Backends.BaseLink; import org.kde.kdeconnect.Backends.BaseLinkProvider; @@ -43,17 +40,13 @@ import java.net.InetSocketAddress; import java.net.ServerSocket; import java.net.Socket; import java.nio.channels.NotYetConnectedException; -import java.security.PrivateKey; import java.security.PublicKey; -import java.util.ArrayList; import javax.net.ssl.SSLContext; import javax.net.ssl.SSLServerSocketFactory; import io.netty.channel.Channel; import io.netty.channel.ChannelFuture; -import io.netty.channel.ChannelFutureListener; -import io.netty.util.AttributeKey; public class LanLink extends BaseLink { diff --git a/src/org/kde/kdeconnect/Backends/LanBackend/LanLinkProvider.java b/src/org/kde/kdeconnect/Backends/LanBackend/LanLinkProvider.java index feb2b4c0..44bb7791 100644 --- a/src/org/kde/kdeconnect/Backends/LanBackend/LanLinkProvider.java +++ b/src/org/kde/kdeconnect/Backends/LanBackend/LanLinkProvider.java @@ -27,18 +27,6 @@ import android.support.v4.util.LongSparseArray; import android.util.Base64; import android.util.Log; -import org.apache.mina.core.future.ConnectFuture; -import org.apache.mina.core.future.IoFuture; -import org.apache.mina.core.future.IoFutureListener; -import org.apache.mina.core.service.IoHandler; -import org.apache.mina.core.service.IoHandlerAdapter; -import org.apache.mina.core.session.IoSession; -import org.apache.mina.filter.codec.ProtocolCodecFilter; -import org.apache.mina.filter.codec.textline.LineDelimiter; -import org.apache.mina.filter.codec.textline.TextLineCodecFactory; -import org.apache.mina.transport.socket.nio.NioDatagramAcceptor; -import org.apache.mina.transport.socket.nio.NioSocketAcceptor; -import org.apache.mina.transport.socket.nio.NioSocketConnector; import org.kde.kdeconnect.Backends.BaseLink; import org.kde.kdeconnect.Backends.BaseLinkProvider; import org.kde.kdeconnect.BackgroundService; diff --git a/src/org/kde/kdeconnect/Plugins/SftpPlugin/SftpImpl.java b/src/org/kde/kdeconnect/Plugins/SftpPlugin/SftpImpl.java index 740ad487..6b47ff95 100644 --- a/src/org/kde/kdeconnect/Plugins/SftpPlugin/SftpImpl.java +++ b/src/org/kde/kdeconnect/Plugins/SftpPlugin/SftpImpl.java @@ -23,7 +23,6 @@ package org.kde.kdeconnect.Plugins.SftpPlugin; import android.content.Context; import android.util.Log; -import org.apache.http.conn.util.InetAddressUtils; import org.apache.sshd.SshServer; import org.apache.sshd.common.NamedFactory; import org.apache.sshd.common.Session; @@ -42,6 +41,7 @@ import org.apache.sshd.server.sftp.SftpSubsystem; import org.kde.kdeconnect.Device; import java.io.File; +import java.net.Inet4Address; import java.net.InetAddress; import java.net.NetworkInterface; import java.net.SocketException; @@ -161,7 +161,7 @@ class SimpleSftpServer { InetAddress inetAddress = enumIpAddr.nextElement(); if (!inetAddress.isLoopbackAddress()) { String address = inetAddress.getHostAddress(); - if (InetAddressUtils.isIPv4Address(address)) { //Prefer IPv4 over IPv6, because sshfs doesn't seem to like IPv6 + if(inetAddress instanceof Inet4Address) { //Prefer IPv4 over IPv6, because sshfs doesn't seem to like IPv6 return address; } else { ip6 = address; diff --git a/src/org/kde/kdeconnect/UserInterface/MaterialActivity.java b/src/org/kde/kdeconnect/UserInterface/MaterialActivity.java index a6308a0f..cd18170c 100644 --- a/src/org/kde/kdeconnect/UserInterface/MaterialActivity.java +++ b/src/org/kde/kdeconnect/UserInterface/MaterialActivity.java @@ -41,6 +41,7 @@ public class MaterialActivity extends AppCompatActivity { private NavigationView mNavigationView; private DrawerLayout mDrawerLayout; private ActionBarDrawerToggle mDrawerToggle; + private View mDrawerHeader; private String mCurrentDevice; @@ -54,6 +55,7 @@ public class MaterialActivity extends AppCompatActivity { setContentView(R.layout.activity_main); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mNavigationView = (NavigationView) findViewById(R.id.navigation_drawer); + mDrawerHeader = mNavigationView.getHeaderView(0); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); @@ -74,7 +76,7 @@ public class MaterialActivity extends AppCompatActivity { mDrawerToggle.syncState(); String deviceName = DeviceHelper.getDeviceName(this); - TextView nameView = (TextView) mDrawerLayout.findViewById(R.id.device_name); + TextView nameView = (TextView) mDrawerHeader.findViewById(R.id.device_name); nameView.setText(deviceName); View.OnClickListener renameListener = new View.OnClickListener() { @@ -83,8 +85,8 @@ public class MaterialActivity extends AppCompatActivity { renameDevice(); } }; - mDrawerLayout.findViewById(R.id.kdeconnect_label).setOnClickListener(renameListener); - mDrawerLayout.findViewById(R.id.device_name).setOnClickListener(renameListener); + mDrawerHeader.findViewById(R.id.kdeconnect_label).setOnClickListener(renameListener); + mDrawerHeader.findViewById(R.id.device_name).setOnClickListener(renameListener); mNavigationView.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() { @Override @@ -261,7 +263,7 @@ public class MaterialActivity extends AppCompatActivity { } public void renameDevice() { - final TextView nameView = (TextView) mDrawerLayout.findViewById(R.id.device_name); + final TextView nameView = (TextView) mNavigationView.findViewById(R.id.device_name); final EditText deviceNameEdit = new EditText(MaterialActivity.this); String deviceName = DeviceHelper.getDeviceName(MaterialActivity.this); deviceNameEdit.setText(deviceName);