Skip to content
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
Binary file added Rooster/.idea/caches/build_file_checksums.ser
Binary file not shown.
116 changes: 116 additions & 0 deletions Rooster/.idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Rooster/.idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

45 changes: 45 additions & 0 deletions Rooster/.idea/jarRepositories.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Rooster/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Rooster/.idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions Rooster/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 13 additions & 12 deletions Rooster/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
compileSdkVersion 29
buildToolsVersion '29.0.3'

defaultConfig {
applicationId "com.blikoon.rooster"
minSdkVersion 16
targetSdkVersion 23
minSdkVersion 21
targetSdkVersion 29
versionCode 1
versionName "1.0"
}
Expand All @@ -20,8 +20,7 @@ android {
}

ext {
smackVersion = '4.2.4'
supportLibVersion = '27.1.0'
smackVersion = '4.3.4'
}

//Ge rid of problem described here : https://stackoverflow.com/questions/31049735/can-not-run-application-below-lollipop
Expand All @@ -30,14 +29,16 @@ configurations {
}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
implementation "com.android.support:appcompat-v7:$supportLibVersion"
implementation "com.android.support:design:$supportLibVersion"
implementation "com.android.support:recyclerview-v7:$supportLibVersion"
implementation fileTree(include: ['*.jar'], dir: 'libs')
testImplementation 'junit:junit:4.13'

implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.google.android.material:material:1.1.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'com.github.timigod:android-chat-ui:v0.1.3'

implementation "org.igniterealtime.smack:smack-tcp:$smackVersion"
implementation "org.igniterealtime.smack:smack-experimental:$smackVersion"
implementation "org.igniterealtime.smack:smack-android:$smackVersion"
implementation "org.igniterealtime.smack:smack-android:${smackVersion}"

}
32 changes: 16 additions & 16 deletions Rooster/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="com.blikoon.rooster"
xmlns:android="http://schemas.android.com/apk/res/android">
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.blikoon.rooster"
>

<uses-permission android:name="android.permission.INTERNET"/>
<!-- To auto-complete the email text field in the login form with the user's emails -->
<uses-permission android:name="android.permission.GET_ACCOUNTS"/>
<uses-permission android:name="android.permission.READ_PROFILE"/>
<uses-permission android:name="android.permission.READ_CONTACTS"/>
<uses-permission android:name="android.permission.INTERNET" />

<application
android:allowBackup="true"
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
android:theme="@style/AppTheme"
tools:replace="android:allowBackup"
>
<activity
android:name=".LoginActivity"
android:label="@string/app_name">
android:label="@string/app_name"
>
<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>
</activity>
<activity android:name=".ContactListActivity">
</activity>
<activity android:name=".ChatActivity">
</activity>
<activity android:name=".ContactListActivity" />
<activity android:name=".ChatActivity" />

<service android:name=".RoosterConnectionService">

</service>
Expand Down
37 changes: 11 additions & 26 deletions Rooster/app/src/main/java/com/blikoon/rooster/ChatActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.widget.Toast;

import androidx.appcompat.app.AppCompatActivity;

import co.intentservice.chatui.ChatView;
import co.intentservice.chatui.models.ChatMessage;


public class ChatActivity extends AppCompatActivity {
private static final String TAG ="ChatActivity";
private static final String TAG = "ChatActivity";

private String contactJid;
private ChatView mChatView;
Expand All @@ -25,11 +25,11 @@ public class ChatActivity extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_chat);
mChatView =(ChatView) findViewById(R.id.rooster_chat_view);
mChatView = (ChatView) findViewById(R.id.rooster_chat_view);

mChatView.setOnSentMessageListener(new ChatView.OnSentMessageListener(){
mChatView.setOnSentMessageListener(new ChatView.OnSentMessageListener() {
@Override
public boolean sendMessage(ChatMessage chatMessage){
public boolean sendMessage(ChatMessage chatMessage) {
// perform actual message sending
if (RoosterConnectionService.getState().equals(RoosterConnection.ConnectionState.CONNECTED)) {
Log.d(TAG, "The client is connected to the server,Sending Message");
Expand All @@ -53,18 +53,6 @@ public boolean sendMessage(ChatMessage chatMessage){
});














Intent intent = getIntent();
contactJid = intent.getStringExtra("EXTRA_CONTACT_JID");
setTitle(contactJid);
Expand All @@ -83,20 +71,17 @@ protected void onResume() {
@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
switch (action)
{
switch (action) {
case RoosterConnectionService.NEW_MESSAGE:
String from = intent.getStringExtra(RoosterConnectionService.BUNDLE_FROM_JID);
String body = intent.getStringExtra(RoosterConnectionService.BUNDLE_MESSAGE_BODY);

if ( from.equals(contactJid))
{
ChatMessage chatMessage = new ChatMessage(body,System.currentTimeMillis(), ChatMessage.Type.RECEIVED);
if (from.equals(contactJid)) {
ChatMessage chatMessage = new ChatMessage(body, System.currentTimeMillis(), ChatMessage.Type.RECEIVED);
mChatView.addMessage(chatMessage);

}else
{
Log.d(TAG,"Got a message from jid :"+from);
} else {
Log.d(TAG, "Got a message from jid :" + from);
}

return;
Expand All @@ -106,7 +91,7 @@ public void onReceive(Context context, Intent intent) {
};

IntentFilter filter = new IntentFilter(RoosterConnectionService.NEW_MESSAGE);
registerReceiver(mBroadcastReceiver,filter);
registerReceiver(mBroadcastReceiver, filter);


}
Expand Down
Loading