Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 3bf00e3
Showing
37 changed files
with
1,159 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
apply plugin: 'com.android.application' | ||
|
||
android { | ||
compileSdkVersion 26 | ||
buildToolsVersion "26.0.1" | ||
defaultConfig { | ||
applicationId "eu.droogers.smsmatrix" | ||
minSdkVersion 23 | ||
targetSdkVersion 26 | ||
versionCode 1 | ||
versionName "1.0" | ||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" | ||
} | ||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
|
||
repositories { | ||
flatDir { | ||
dir 'libs' | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
compile fileTree(dir: 'libs', include: ['*.jar']) | ||
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { | ||
exclude group: 'com.android.support', module: 'support-annotations' | ||
}) | ||
compile 'com.android.support.constraint:constraint-layout:1.0.2' | ||
testCompile 'junit:junit:4.12' | ||
|
||
compile(name: 'matrix-sdk', ext: 'aar') | ||
compile(name: 'olm-sdk', ext: 'aar') | ||
|
||
compile 'com.squareup.retrofit:retrofit:1.6.1' | ||
compile 'com.google.code.gson:gson:2.3' | ||
compile 'com.squareup.okhttp:okhttp-urlconnection:2.2.0' | ||
compile 'com.squareup.okhttp:okhttp:2.2.0' | ||
} |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Add project specific ProGuard rules here. | ||
# By default, the flags in this file are appended to flags specified | ||
# in /home/gerben/Android/Sdk/tools/proguard/proguard-android.txt | ||
# You can edit the include path and order by changing the proguardFiles | ||
# directive in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# Add any project specific keep options here: | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} | ||
|
||
# Uncomment this to preserve the line number information for | ||
# debugging stack traces. | ||
#-keepattributes SourceFile,LineNumberTable | ||
|
||
# If you keep the line number information, uncomment this to | ||
# hide the original source file name. | ||
#-renamesourcefileattribute SourceFile |
26 changes: 26 additions & 0 deletions
26
app/src/androidTest/java/eu/droogers/smsmatrix/ExampleInstrumentedTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package eu.droogers.smsmatrix; | ||
|
||
import android.content.Context; | ||
import android.support.test.InstrumentationRegistry; | ||
import android.support.test.runner.AndroidJUnit4; | ||
|
||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
|
||
import static org.junit.Assert.*; | ||
|
||
/** | ||
* Instrumentation test, which will execute on an Android device. | ||
* | ||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a> | ||
*/ | ||
@RunWith(AndroidJUnit4.class) | ||
public class ExampleInstrumentedTest { | ||
@Test | ||
public void useAppContext() throws Exception { | ||
// Context of the app under test. | ||
Context appContext = InstrumentationRegistry.getTargetContext(); | ||
|
||
assertEquals("eu.droogers.smsmatrix", appContext.getPackageName()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
package="eu.droogers.smsmatrix"> | ||
|
||
<uses-permission android:name="android.permission.SEND_SMS" /> | ||
<uses-permission android:name="android.permission.RECEIVE_SMS" /> | ||
<uses-permission android:name="android.permission.READ_PHONE_STATE" /> | ||
|
||
<application | ||
tools:replace="allowBackup,label" | ||
android:allowBackup="true" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:roundIcon="@mipmap/ic_launcher_round" | ||
android:supportsRtl="true" | ||
android:theme="@style/AppTheme"> | ||
<activity android:name=".MainActivity"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
|
||
<receiver android:name="eu.droogers.smsmatrix.SmsListener"> | ||
<intent-filter> | ||
<action android:name="android.provider.Telephony.SMS_RECEIVED" /> | ||
</intent-filter> | ||
</receiver> | ||
|
||
<service android:name="eu.droogers.smsmatrix.MatrixService" /> | ||
|
||
</application> | ||
|
||
</manifest> |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
157 changes: 157 additions & 0 deletions
157
app/src/main/java/eu/droogers/smsmatrix/EventListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,157 @@ | ||
package eu.droogers.smsmatrix; | ||
|
||
import android.util.Log; | ||
|
||
import org.matrix.androidsdk.data.MyUser; | ||
import org.matrix.androidsdk.data.RoomState; | ||
import org.matrix.androidsdk.listeners.IMXEventListener; | ||
import org.matrix.androidsdk.rest.model.Event; | ||
import org.matrix.androidsdk.rest.model.User; | ||
import org.matrix.androidsdk.rest.model.bingrules.BingRule; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* Created by gerben on 8-10-17. | ||
*/ | ||
|
||
public class EventListener implements IMXEventListener { | ||
private static final String TAG = "EventListener"; | ||
private boolean loaded = false; | ||
private Matrix mx; | ||
|
||
public EventListener (Matrix mx) { | ||
this.mx = mx; | ||
} | ||
|
||
@Override | ||
public void onStoreReady() { | ||
|
||
} | ||
|
||
@Override | ||
public void onPresenceUpdate(Event event, User user) { | ||
|
||
} | ||
|
||
@Override | ||
public void onAccountInfoUpdate(MyUser myUser) { | ||
|
||
} | ||
|
||
@Override | ||
public void onIgnoredUsersListUpdate() { | ||
|
||
} | ||
|
||
@Override | ||
public void onDirectMessageChatRoomsListUpdate() { | ||
|
||
} | ||
|
||
@Override | ||
public void onLiveEvent(Event event, RoomState roomState) { | ||
if (loaded == true) { | ||
// mx.getUnreadEvents(); | ||
mx.sendEvent(event); | ||
} | ||
Log.e(TAG, "onLiveEvent: " + event + " " + event.getSender() + " : " + event.getContent()); | ||
} | ||
|
||
@Override | ||
public void onLiveEventsChunkProcessed(String s, String s1) { | ||
|
||
} | ||
|
||
@Override | ||
public void onBingEvent(Event event, RoomState roomState, BingRule bingRule) { | ||
|
||
} | ||
|
||
@Override | ||
public void onEventEncrypted(Event event) { | ||
|
||
} | ||
|
||
@Override | ||
public void onEventDecrypted(Event event) { | ||
|
||
} | ||
|
||
@Override | ||
public void onEventSent(Event event, String s) { | ||
|
||
} | ||
|
||
@Override | ||
public void onFailedSendingEvent(Event event) { | ||
|
||
} | ||
|
||
@Override | ||
public void onBingRulesUpdate() { | ||
|
||
} | ||
|
||
@Override | ||
public void onInitialSyncComplete(String s) { | ||
loaded = true; | ||
mx.onEventStreamLoaded(); | ||
mx.getUnreadEvents(); | ||
} | ||
|
||
@Override | ||
public void onCryptoSyncComplete() { | ||
|
||
} | ||
|
||
@Override | ||
public void onNewRoom(String s) { | ||
|
||
} | ||
|
||
@Override | ||
public void onJoinRoom(String s) { | ||
|
||
} | ||
|
||
@Override | ||
public void onRoomFlush(String s) { | ||
|
||
} | ||
|
||
@Override | ||
public void onRoomInitialSyncComplete(String s) { | ||
|
||
} | ||
|
||
@Override | ||
public void onRoomInternalUpdate(String s) { | ||
|
||
} | ||
|
||
@Override | ||
public void onLeaveRoom(String s) { | ||
|
||
} | ||
|
||
@Override | ||
public void onReceiptEvent(String s, List<String> list) { | ||
|
||
} | ||
|
||
@Override | ||
public void onRoomTagEvent(String s) { | ||
|
||
} | ||
|
||
@Override | ||
public void onReadMarkerEvent(String s) { | ||
|
||
} | ||
|
||
@Override | ||
public void onToDeviceEvent(Event event) { | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
package eu.droogers.smsmatrix; | ||
|
||
import android.app.Activity; | ||
import android.content.Context; | ||
import android.content.Intent; | ||
import android.content.SharedPreferences; | ||
import android.os.Bundle; | ||
import android.util.Log; | ||
import android.view.View; | ||
import android.widget.Button; | ||
import android.widget.EditText; | ||
|
||
import static android.content.ContentValues.TAG; | ||
|
||
public class MainActivity extends Activity { | ||
static Matrix mx; | ||
private SharedPreferences sp; | ||
private EditText botUsername; | ||
private EditText botPassword; | ||
private EditText username; | ||
private EditText device; | ||
private EditText hsUrl; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_main); | ||
|
||
sp = getSharedPreferences("settings", Context.MODE_PRIVATE); | ||
botUsername = (EditText) findViewById(R.id.editText_botUsername); | ||
botPassword = (EditText) findViewById(R.id.editText_botpassword); | ||
username = (EditText) findViewById(R.id.editText_username); | ||
device = (EditText) findViewById(R.id.editText_device); | ||
hsUrl = (EditText) findViewById(R.id.editText_hsUrl); | ||
|
||
botUsername.setText(sp.getString("botUsername", "")); | ||
botPassword.setText(sp.getString("botPassword", "")); | ||
username.setText(sp.getString("username", "")); | ||
device.setText(sp.getString("device", "")); | ||
hsUrl.setText(sp.getString("hsUrl", "")); | ||
|
||
|
||
Button saveButton = (Button) findViewById(R.id.button_save); | ||
saveButton.setOnClickListener(new View.OnClickListener() { | ||
@Override | ||
public void onClick(View v) { | ||
SharedPreferences.Editor editor = sp.edit(); | ||
editor.putString("botUsername", botUsername.getText().toString()); | ||
editor.putString("botPassword", botPassword.getText().toString()); | ||
editor.putString("username", username.getText().toString()); | ||
editor.putString("device", device.getText().toString()); | ||
editor.putString("hsUrl", hsUrl.getText().toString()); | ||
editor.apply(); | ||
|
||
Log.e(TAG, "onClick: " + botUsername.getText().toString() ); | ||
startService(); | ||
} | ||
}); | ||
startService(); | ||
} | ||
|
||
private void startService() { | ||
Intent intent = new Intent(this, MatrixService.class); | ||
startService(intent); | ||
} | ||
} |
Oops, something went wrong.