Skip to content

Commit

Permalink
updated with build tools 25, gradle 3.3, changed chat server to
Browse files Browse the repository at this point in the history
  • Loading branch information
Vamsee Lakamsani committed Feb 20, 2017
1 parent 61c9326 commit f17421c
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 18 deletions.
14 changes: 7 additions & 7 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
classpath 'com.android.tools.build:gradle:2.3.0-beta4'
}
}
apply plugin: 'com.android.application'
Expand All @@ -13,12 +13,12 @@ repositories {
}

android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId 'com.github.nkzawa.socketio.androidchat'
minSdkVersion 15
targetSdkVersion 21
minSdkVersion 17
targetSdkVersion 25
versionCode 1
versionName "1.0"
}
Expand All @@ -34,8 +34,8 @@ android {

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.+'
compile 'com.android.support:recyclerview-v7:21.0.+'
compile 'com.android.support:appcompat-v7:25.0.+'
compile 'com.android.support:recyclerview-v7:25.0.+'
compile ('io.socket:socket.io-client:0.8.1') {
exclude group: 'org.json', module: 'json'
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
package com.github.nkzawa.socketio.androidchat;

import android.app.Application;
import io.socket.client.IO;
import io.socket.client.Socket;

import java.net.URISyntaxException;

import io.socket.client.IO;
import io.socket.client.Socket;

public class ChatApplication extends Application {

private Socket mSocket;
{
try {
mSocket = IO.socket(Constants.CHAT_SERVER_URL);
} catch (URISyntaxException e) {
e.printStackTrace();
throw new RuntimeException(e);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.github.nkzawa.socketio.androidchat;

public class Constants {
public static final String CHAT_SERVER_URL = "http://chat.socket.io";
//public static final String CHAT_SERVER_URL = "http://chat.socket.io";
public static final String CHAT_SERVER_URL = "https://socketio-chat.now.sh";
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,29 @@
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.inputmethod.EditorInfo;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import io.socket.client.Socket;
import io.socket.emitter.Emitter;

import org.json.JSONException;
import org.json.JSONObject;

import io.socket.client.Socket;
import io.socket.emitter.Emitter;


/**
* A login screen that offers login via username.
*/
public class LoginActivity extends Activity {

private static final String TAG = "LoginActivity";

private EditText mUsernameView;

private String mUsername;
Expand Down Expand Up @@ -58,13 +63,15 @@ public void onClick(View view) {
});

mSocket.on("login", onLogin);
mSocket.on("error", onError);
}

@Override
protected void onDestroy() {
super.onDestroy();

mSocket.off("login", onLogin);
mSocket.off("error", onError);
}

/**
Expand Down Expand Up @@ -113,6 +120,16 @@ public void call(Object... args) {
finish();
}
};

private Emitter.Listener onError = new Emitter.Listener() {
@Override
public void call(Object... args) {
Object [] myArgs = args;
// don't understand enough about what is expected in args to print something more useful here.
// will do that as I know more.
Log.e(TAG,"Got an error");
}
};
}


Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.github.nkzawa.socketio.androidchat;

import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.app.AppCompatActivity;


public class MainActivity extends ActionBarActivity {
public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
classpath 'com.android.tools.build:gradle:2.3.0-beta4'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
4 changes: 3 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,6 @@
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# org.gradle.parallel=true

org.gradle.jvmargs=-Xmx1536M
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Wed Dec 23 22:20:48 JST 2015
#Sun Feb 19 12:41:28 PST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip

0 comments on commit f17421c

Please sign in to comment.