First commit
@@ -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());
|
||||
}
|
||||
}
|
||||
36
app/src/main/AndroidManifest.xml
Normal file
@@ -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>
|
||||
BIN
app/src/main/ic_launcher-web.png
Normal file
|
After Width: | Height: | Size: 22 KiB |
BIN
app/src/main/ic_launcher_round-web.png
Normal file
|
After Width: | Height: | Size: 22 KiB |
157
app/src/main/java/eu/droogers/smsmatrix/EventListener.java
Normal file
@@ -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) {
|
||||
|
||||
}
|
||||
}
|
||||
66
app/src/main/java/eu/droogers/smsmatrix/MainActivity.java
Normal file
@@ -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);
|
||||
}
|
||||
}
|
||||
216
app/src/main/java/eu/droogers/smsmatrix/Matrix.java
Normal file
@@ -0,0 +1,216 @@
|
||||
package eu.droogers.smsmatrix;
|
||||
|
||||
import android.content.Context;
|
||||
import android.net.Uri;
|
||||
import android.telephony.SmsManager;
|
||||
import android.util.Log;
|
||||
|
||||
import com.google.gson.JsonElement;
|
||||
|
||||
import org.matrix.androidsdk.HomeServerConnectionConfig;
|
||||
import org.matrix.androidsdk.MXDataHandler;
|
||||
import org.matrix.androidsdk.MXSession;
|
||||
import org.matrix.androidsdk.data.Room;
|
||||
import org.matrix.androidsdk.data.store.IMXStore;
|
||||
import org.matrix.androidsdk.data.store.IMXStoreListener;
|
||||
import org.matrix.androidsdk.data.store.MXFileStore;
|
||||
import org.matrix.androidsdk.data.store.MXMemoryStore;
|
||||
import org.matrix.androidsdk.listeners.IMXEventListener;
|
||||
import org.matrix.androidsdk.rest.callback.SimpleApiCallback;
|
||||
import org.matrix.androidsdk.rest.client.LoginRestClient;
|
||||
import org.matrix.androidsdk.rest.model.Event;
|
||||
import org.matrix.androidsdk.rest.model.Message;
|
||||
import org.matrix.androidsdk.rest.model.login.Credentials;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import static android.content.ContentValues.TAG;
|
||||
|
||||
/**
|
||||
* Created by gerben on 6-10-17.
|
||||
*/
|
||||
|
||||
public class Matrix {
|
||||
HomeServerConnectionConfig hsConfig;
|
||||
Context context;
|
||||
MXSession session;
|
||||
int transaction;
|
||||
private String tag = "Matrix";
|
||||
private List<NotSendMesage> notSendMesages = new ArrayList<>();
|
||||
MXDataHandler dh;
|
||||
private IMXEventListener evLis;
|
||||
IMXStore store;
|
||||
String deviceName;
|
||||
|
||||
private String realUserid;
|
||||
|
||||
public Matrix (final Context context, String url, String botUsername, String botPassword, String username, String device) {
|
||||
this.context = context;
|
||||
hsConfig = new HomeServerConnectionConfig(Uri.parse(url));
|
||||
|
||||
realUserid = username;
|
||||
deviceName = device;
|
||||
|
||||
login(botUsername, botPassword);
|
||||
}
|
||||
|
||||
private void login(String username, String password) {
|
||||
new LoginRestClient(hsConfig).loginWithUser(username, password, deviceName, new SimpleApiCallback<Credentials>() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(Credentials credentials) {
|
||||
super.onSuccess(credentials);
|
||||
onLogin(credentials);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void onLogin(Credentials credentials) {
|
||||
hsConfig.setCredentials(credentials);
|
||||
startEventStream();
|
||||
}
|
||||
|
||||
public void startEventStream() {
|
||||
evLis = new EventListener(this);
|
||||
|
||||
|
||||
if (false) {
|
||||
store = new MXFileStore(hsConfig, context);
|
||||
} else {
|
||||
store = new MXMemoryStore(hsConfig.getCredentials(), context);
|
||||
}
|
||||
|
||||
dh = new MXDataHandler(store, hsConfig.getCredentials());
|
||||
|
||||
// NetworkConnectivityReceiver nwMan = new NetworkConnectivityReceiver();
|
||||
|
||||
session = new MXSession(hsConfig, dh, context);
|
||||
session.setSyncDelay(12000);
|
||||
session.setSyncTimeout(30*60*1000);
|
||||
Log.e(TAG, "onLogin:" + session.getSyncTimeout());
|
||||
|
||||
|
||||
|
||||
if (store.isReady()) {
|
||||
session.getDataHandler().checkPermanentStorageData();
|
||||
session.startEventStream(store.getEventStreamToken());
|
||||
session.getDataHandler().addListener(evLis);
|
||||
} else {
|
||||
store.addMXStoreListener(new IMXStoreListener() {
|
||||
@Override
|
||||
public void postProcess(String s) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStoreReady(String s) {
|
||||
session.getDataHandler().checkPermanentStorageData();
|
||||
session.startEventStream(store.getEventStreamToken());
|
||||
session.getDataHandler().addListener(evLis);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStoreCorrupted(String s, String s1) {
|
||||
Log.e(TAG, "onStoreCorrupted: " + s );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStoreOOM(String s, String s1) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReadReceiptsLoaded(String s) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public void sendMessage(final String phoneNumber, final String body) {
|
||||
if (session != null && session.isAlive()) {
|
||||
Room room = getRoomByPhonenumber(phoneNumber);
|
||||
if (room == null) {
|
||||
Log.e(TAG, "sendMessage: not found" );
|
||||
session.createRoomDirectMessage(realUserid, new SimpleApiCallback<String>() {
|
||||
@Override
|
||||
public void onSuccess(String info) {
|
||||
super.onSuccess(info);
|
||||
session.getRoomsApiClient().updateTopic(info, phoneNumber, new SimpleApiCallback<Void>());
|
||||
SendMesageToRoom(store.getRoom(info), body);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
SendMesageToRoom(room, body);
|
||||
}
|
||||
} else {
|
||||
Log.e(tag, "Error with sending message");
|
||||
notSendMesages.add(new NotSendMesage(phoneNumber, body));
|
||||
}
|
||||
}
|
||||
|
||||
public void SendMesageToRoom(Room room, String body) {
|
||||
Message msg = new Message();
|
||||
msg.body = body;
|
||||
msg.msgtype = "m.mesage";
|
||||
session.getRoomsApiClient().sendMessage(String.valueOf(transaction), room.getRoomId(), msg, new SimpleApiCallback<Event>());
|
||||
transaction++;
|
||||
}
|
||||
|
||||
public void getUnreadEvents() {
|
||||
List<String> types = new ArrayList<>();
|
||||
types.add("m.room.message");
|
||||
|
||||
Collection<Room> rooms = store.getRooms();
|
||||
for (Room room : rooms) {
|
||||
List<Event> roomsDirect = store.unreadEvents(room.getRoomId(), types);
|
||||
for (Event event : roomsDirect) {
|
||||
sendEvent(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void sendEvent(Event event) {
|
||||
if (event.sender.equals(realUserid)) {
|
||||
Room room = store.getRoom(event.roomId);
|
||||
JsonElement json = event.getContent();
|
||||
String body = json.getAsJsonObject().get("body").getAsString();
|
||||
SmsManager smsManager = SmsManager.getDefault();
|
||||
smsManager.sendTextMessage(room.getTopic(), null, body, null, null);
|
||||
room.markAllAsRead(new SimpleApiCallback<Void>());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void onEventStreamLoaded() {
|
||||
sendMessageList(notSendMesages);
|
||||
notSendMesages.clear();
|
||||
}
|
||||
|
||||
public void sendMessageList(List<NotSendMesage> messages) {
|
||||
for (NotSendMesage ms : messages) {
|
||||
sendMessage(ms.getPhone(), ms.getBody());
|
||||
}
|
||||
}
|
||||
|
||||
public Room getRoomByPhonenumber (String number) {
|
||||
Collection<Room> rooms = store.getRooms();
|
||||
Log.e(TAG, "getRoomByPhonenumber: " + number );
|
||||
Log.e(TAG, "getRoomByPhonenumber: " + rooms.size() );
|
||||
for (Room room : rooms) {
|
||||
Log.e(TAG, "getRoomByPhonenumber: " + room.getTopic() );
|
||||
if (room.getTopic() != null && room.getTopic().equals(number)) {
|
||||
return room;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void destroy() {
|
||||
session.stopEventStream();
|
||||
dh.removeListener(evLis);
|
||||
store.close();
|
||||
}
|
||||
}
|
||||
66
app/src/main/java/eu/droogers/smsmatrix/MatrixService.java
Normal file
@@ -0,0 +1,66 @@
|
||||
package eu.droogers.smsmatrix;
|
||||
|
||||
import android.app.Service;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.IBinder;
|
||||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
|
||||
/**
|
||||
* Created by gerben on 7-10-17.
|
||||
*/
|
||||
|
||||
public class MatrixService extends Service {
|
||||
private Matrix mx;
|
||||
private final String TAG = "MatrixService";
|
||||
private String botUsername;
|
||||
private String botPassword;
|
||||
private String username;
|
||||
private String device;
|
||||
private String hsUrl;
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||
SharedPreferences sp = getSharedPreferences("settings", Context.MODE_PRIVATE);
|
||||
botUsername = sp.getString("botUsername", "");
|
||||
botPassword = sp.getString("botPassword", "");
|
||||
username = sp.getString("username", "");
|
||||
device = sp.getString("device", "");
|
||||
hsUrl = sp.getString("hsUrl", "");
|
||||
|
||||
if (mx == null && !botUsername.isEmpty() && !botPassword.isEmpty() && !username.isEmpty() && !device.isEmpty() && !hsUrl.isEmpty()) {
|
||||
mx = new Matrix(getApplication(), hsUrl, botUsername, botPassword, username, device);
|
||||
Log.e(TAG, "onStartCommand222: " + hsUrl );
|
||||
Toast.makeText(this, "service starting:", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
Log.e(TAG, "onStartCommand: Service");
|
||||
|
||||
String phone = intent.getStringExtra("SendSms_phone");
|
||||
String body = intent.getStringExtra("SendSms_body");
|
||||
if (phone != null) {
|
||||
mx.sendMessage(phone, body);
|
||||
}
|
||||
return START_NOT_STICKY;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
mx.destroy();
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBinder onBind(Intent intent) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
23
app/src/main/java/eu/droogers/smsmatrix/NotSendMesage.java
Normal file
@@ -0,0 +1,23 @@
|
||||
package eu.droogers.smsmatrix;
|
||||
|
||||
/**
|
||||
* Created by gerben on 9-10-17.
|
||||
*/
|
||||
|
||||
class NotSendMesage {
|
||||
private String phone;
|
||||
private String body;
|
||||
|
||||
public NotSendMesage(String phone, String body) {
|
||||
this.phone = phone;
|
||||
this.body = body;
|
||||
}
|
||||
|
||||
public String getPhone() {
|
||||
return phone;
|
||||
}
|
||||
|
||||
public String getBody() {
|
||||
return body;
|
||||
}
|
||||
}
|
||||
49
app/src/main/java/eu/droogers/smsmatrix/SmsListener.java
Normal file
@@ -0,0 +1,49 @@
|
||||
package eu.droogers.smsmatrix;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.telephony.SmsMessage;
|
||||
import android.util.Log;
|
||||
|
||||
/**
|
||||
* Created by gerben on 6-10-17.
|
||||
*/
|
||||
|
||||
public class SmsListener extends BroadcastReceiver {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
if(intent.getAction().equals("android.provider.Telephony.SMS_RECEIVED")){
|
||||
Bundle bundle = intent.getExtras(); //---get the SMS message passed in---
|
||||
SmsMessage[] msgs = null;
|
||||
String msg_from;
|
||||
if (bundle != null){
|
||||
//---retrieve the SMS message received---
|
||||
try{
|
||||
Object[] pdus = (Object[]) bundle.get("pdus");
|
||||
msgs = new SmsMessage[pdus.length];
|
||||
for(int i=0; i<msgs.length; i++){
|
||||
msgs[i] = SmsMessage.createFromPdu((byte[])pdus[i]);
|
||||
msg_from = msgs[i].getOriginatingAddress();
|
||||
String msgBody = msgs[i].getMessageBody();
|
||||
System.out.println(msg_from + ": " + msgBody);
|
||||
|
||||
// Matrix mx = new Matrix(context, "https://matrix.org");
|
||||
sendMatrix(context, msgBody, msg_from);
|
||||
}
|
||||
}catch(Exception e){
|
||||
Log.d("Exception caught",e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void sendMatrix(Context context, String body, String phone) {
|
||||
Intent intent = new Intent(context, MatrixService.class);
|
||||
intent.putExtra("SendSms_phone", phone);
|
||||
intent.putExtra("SendSms_body", body);
|
||||
context.startService(intent);
|
||||
// MainActivity.mx.sendMessage( + ": " + );
|
||||
}
|
||||
}
|
||||
111
app/src/main/res/layout/activity_main.xml
Normal file
@@ -0,0 +1,111 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ScrollView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
tools:context="eu.droogers.smsmatrix.MainActivity"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
tools:layout_editor_absoluteY="0dp"
|
||||
tools:layout_editor_absoluteX="0dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView_botUsername"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="Bot Username"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/editText_botUsername"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:ems="10"
|
||||
android:hint="botSms"
|
||||
android:inputType="textPersonName"
|
||||
tools:layout_editor_absoluteX="-106dp"
|
||||
tools:layout_editor_absoluteY="-16dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView_botPassword"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="Bot Password"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/editText_botpassword"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:ems="10"
|
||||
android:hint="Secret123"
|
||||
android:inputType="textPassword" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView_hsUrl"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="Homeserver url" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/editText_hsUrl"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:ems="10"
|
||||
android:hint="https://matrix.org"
|
||||
android:inputType="textPersonName" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView_username"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="Your username"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/editText_username"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:ems="10"
|
||||
android:hint="\@user:matrix.org"
|
||||
android:inputType="textPersonName" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView_devicename"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="Devicename"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/editText_device"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:ems="10"
|
||||
android:hint="Sms_mobiel"
|
||||
android:inputType="textPersonName" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/button_save"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="Save" />
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
BIN
app/src/main/res/mipmap-hdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 2.3 KiB |
BIN
app/src/main/res/mipmap-hdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 2.3 KiB |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 3.4 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 3.4 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 5.3 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 5.3 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 7.8 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 7.8 KiB |
6
app/src/main/res/values/colors.xml
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="colorPrimary">#3F51B5</color>
|
||||
<color name="colorPrimaryDark">#303F9F</color>
|
||||
<color name="colorAccent">#FF4081</color>
|
||||
</resources>
|
||||
3
app/src/main/res/values/strings.xml
Normal file
@@ -0,0 +1,3 @@
|
||||
<resources>
|
||||
<string name="app_name">SmsMatrix</string>
|
||||
</resources>
|
||||
17
app/src/main/res/values/styles.xml
Normal file
@@ -0,0 +1,17 @@
|
||||
<resources>
|
||||
|
||||
<!-- Base application theme. -->
|
||||
<style name="AppTheme" parent="android:Theme.Material.Light.DarkActionBar">
|
||||
<!-- Customize your theme here. -->
|
||||
</style>
|
||||
|
||||
<style name="Base.TextAppearance.AppCompat.Subhead"></style>
|
||||
|
||||
<style name="Base.TextAppearance.AppCompat"></style>
|
||||
|
||||
<style name="Base.TextAppearance"></style>
|
||||
|
||||
<style name="Base"></style>
|
||||
|
||||
|
||||
</resources>
|
||||
17
app/src/test/java/eu/droogers/smsmatrix/ExampleUnitTest.java
Normal file
@@ -0,0 +1,17 @@
|
||||
package eu.droogers.smsmatrix;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
public class ExampleUnitTest {
|
||||
@Test
|
||||
public void addition_isCorrect() throws Exception {
|
||||
assertEquals(4, 2 + 2);
|
||||
}
|
||||
}
|
||||