diff --git a/guillaume/sendSMS/.gitignore b/guillaume/sendSMS/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..c6cbe562a42726ab875d51cb513723b234787300 --- /dev/null +++ b/guillaume/sendSMS/.gitignore @@ -0,0 +1,8 @@ +*.iml +.gradle +/local.properties +/.idea/workspace.xml +/.idea/libraries +.DS_Store +/build +/captures diff --git a/guillaume/sendSMS/app/.gitignore b/guillaume/sendSMS/app/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..796b96d1c402326528b4ba3c12ee9d92d0e212e9 --- /dev/null +++ b/guillaume/sendSMS/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/guillaume/sendSMS/app/build.gradle b/guillaume/sendSMS/app/build.gradle new file mode 100644 index 0000000000000000000000000000000000000000..f6ffd0d7acc99e3deea07cd8b3d8e0ac3d4c6d86 --- /dev/null +++ b/guillaume/sendSMS/app/build.gradle @@ -0,0 +1,27 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 23 + buildToolsVersion "23.0.3" + + defaultConfig { + applicationId "com.example.wilhelm.sendsms" + minSdkVersion 15 + targetSdkVersion 23 + versionCode 1 + versionName "1.0" + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } +} + +dependencies { + compile fileTree(dir: 'libs', include: ['*.jar']) + testCompile 'junit:junit:4.12' + compile 'com.android.support:appcompat-v7:23.4.0' + compile 'com.android.support:support-v4:23.4.0' +} diff --git a/guillaume/sendSMS/app/proguard-rules.pro b/guillaume/sendSMS/app/proguard-rules.pro new file mode 100644 index 0000000000000000000000000000000000000000..69c6ea19dd6d83d5e80a1486af39ca4b7bd37b9b --- /dev/null +++ b/guillaume/sendSMS/app/proguard-rules.pro @@ -0,0 +1,17 @@ +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in /home/wilhelm/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 *; +#} diff --git a/guillaume/sendSMS/app/src/androidTest/java/com/example/wilhelm/sendsms/ApplicationTest.java b/guillaume/sendSMS/app/src/androidTest/java/com/example/wilhelm/sendsms/ApplicationTest.java new file mode 100644 index 0000000000000000000000000000000000000000..fc13a66ce74f31fc0eb27099a47e0929c3567874 --- /dev/null +++ b/guillaume/sendSMS/app/src/androidTest/java/com/example/wilhelm/sendsms/ApplicationTest.java @@ -0,0 +1,13 @@ +package com.example.wilhelm.sendsms; + +import android.app.Application; +import android.test.ApplicationTestCase; + +/** + * <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a> + */ +public class ApplicationTest extends ApplicationTestCase<Application> { + public ApplicationTest() { + super(Application.class); + } +} \ No newline at end of file diff --git a/guillaume/sendSMS/app/src/main/AndroidManifest.xml b/guillaume/sendSMS/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000000000000000000000000000000000000..db82b55348e7dfba011e8b2793db669b33f97b84 --- /dev/null +++ b/guillaume/sendSMS/app/src/main/AndroidManifest.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="utf-8"?> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="com.example.wilhelm.sendsms"> + <uses-permission android:name="android.permission.WRITE_SMS" /> + <uses-permission android:name="android.permission.READ_SMS" /> + <uses-permission android:name="android.permission.SEND_SMS" /> + <uses-permission android:name="android.permission.RECEIVE_SMS" /> + <uses-permission android:name="android.permission.INTERNET" /> + + <application + android:allowBackup="true" + android:icon="@mipmap/ic_launcher" + android:label="@string/app_name" + android:supportsRtl="true" + android:theme="@style/AppTheme"> + <activity + android:name=".MainActivity" + android:label="@string/app_name" + android:theme="@style/AppTheme"> + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + </activity> + <receiver android:name=".SmsBroadcastReceiver" android:exported="true" > + <intent-filter android:priority="999" > + <action android:name="android.provider.Telephony.SMS_RECEIVED" /> + </intent-filter> + </receiver> + </application> + + +</manifest> \ No newline at end of file diff --git a/guillaume/sendSMS/app/src/main/java/com/example/wilhelm/sendsms/Client.java b/guillaume/sendSMS/app/src/main/java/com/example/wilhelm/sendsms/Client.java new file mode 100644 index 0000000000000000000000000000000000000000..2a6c427c8b1769a96214f443c16f12cbb829a82b --- /dev/null +++ b/guillaume/sendSMS/app/src/main/java/com/example/wilhelm/sendsms/Client.java @@ -0,0 +1,77 @@ +package com.example.wilhelm.sendsms; + +import java.io.IOException; +import java.net.InetSocketAddress; +import java.nio.ByteBuffer; +import java.nio.CharBuffer; +import java.nio.channels.DatagramChannel; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.util.Hashtable; + +public class Client { + public static void main(String[] args) throws IOException { + DatagramChannel d = DatagramChannel.open(); + d.socket().setBroadcast(true); + d.socket().bind(new InetSocketAddress(0)); + d.connect(new InetSocketAddress("10.8.0.1", 1456)); + DatagramChannel d1 = DatagramChannel.open(); + //while(true) + sendMessage("src",d); + ByteBuffer dst = ByteBuffer.allocate(4096); + Hashtable<String, String> digests = new Hashtable<String, String>(); + while(true) { + /* get name of the file */ + d.receive(dst); + dst.flip(); + CharBuffer c = Charset.defaultCharset().decode(dst); + String s = ""; + while(c.hasRemaining()) { + s += c.get(); + } + System.out.println("digest : "+s); + dst.clear(); + /* get file digest */ + d.receive(dst); + dst.flip(); + CharBuffer c1 = Charset.defaultCharset().decode(dst); + String s1 = ""; + while(c1.hasRemaining()) { + s1 += c1.get(); + } + System.out.println(s1); + dst.clear(); + if(digests.put(s, s1) != s1) { //if we get a new digest for this file + //ask for file + sendMessage(s,d); + d.receive(dst); + dst.flip(); + CharBuffer c2 = Charset.defaultCharset().decode(dst); + String s2 = ""; + while(c2.hasRemaining()) { + s2 += c2.get(); + } + System.out.println(s2); + dst.clear(); + } + //sendMessage(s,d1); + dst.clear(); + } + /*d.receive(dst); + dst.flip(); + + System.out.println(s); + //udpServer();*/ + } + public static void sendMessage(String s, DatagramChannel d) throws IOException { + ByteBuffer b = StandardCharsets.UTF_8.encode(s); + d.write(b); + /*ByteBuffer b = ByteBuffer.allocate(1024); + for(char c: s.toCharArray()){ + b.putChar(c); + System.out.println(c); + } + b.flip(); + d.write(b);*/ + } +} diff --git a/guillaume/sendSMS/app/src/main/java/com/example/wilhelm/sendsms/MainActivity.java b/guillaume/sendSMS/app/src/main/java/com/example/wilhelm/sendsms/MainActivity.java new file mode 100644 index 0000000000000000000000000000000000000000..f592b6b6554ae72eae4c964792af3953f4fc4228 --- /dev/null +++ b/guillaume/sendSMS/app/src/main/java/com/example/wilhelm/sendsms/MainActivity.java @@ -0,0 +1,90 @@ +package com.example.wilhelm.sendsms; + +import android.app.Activity; +import android.content.ContentResolver; +import android.database.Cursor; +import android.net.Uri; +import android.os.Bundle; +import android.telephony.SmsManager; +import android.util.Log; +import android.view.View; +import android.widget.AdapterView; +import android.widget.AdapterView.OnItemClickListener; +import android.widget.ArrayAdapter; +import android.widget.ListView; +import android.widget.Toast; + +import java.io.IOException; +import java.net.InetSocketAddress; +import java.nio.ByteBuffer; +import java.nio.channels.DatagramChannel; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; + +public class MainActivity extends Activity implements OnItemClickListener { + + private static MainActivity inst; + ArrayList<String> smsMessagesList = new ArrayList<String>(); + ListView smsListView; + ArrayAdapter arrayAdapter; + + public static MainActivity instance() { + return inst; + } + + @Override + public void onStart() { + super.onStart(); + inst = this; + } + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_sms); + smsListView = (ListView) findViewById(R.id.SMSList); + arrayAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, smsMessagesList); + smsListView.setAdapter(arrayAdapter); + smsListView.setOnItemClickListener(this); + UDP_Server Server = new UDP_Server(); + Server.runUdpServer(); + + refreshSmsInbox(); + } + + public void refreshSmsInbox() { + ContentResolver contentResolver = getContentResolver(); + Cursor smsInboxCursor = contentResolver.query(Uri.parse("content://sms/inbox"), null, null, null, null); + int indexBody = smsInboxCursor.getColumnIndex("body"); + int indexAddress = smsInboxCursor.getColumnIndex("address"); + if (indexBody < 0 || !smsInboxCursor.moveToFirst()) return; + arrayAdapter.clear(); + do { + String str = "SMS From: " + smsInboxCursor.getString(indexAddress) + + "\n" + smsInboxCursor.getString(indexBody) + "\n"; + arrayAdapter.add(str); + } while (smsInboxCursor.moveToNext()); + } + + public void updateList(final String smsMessage) { + arrayAdapter.insert(smsMessage, 0); + arrayAdapter.notifyDataSetChanged(); + } + + public void onItemClick(AdapterView<?> parent, View view, int pos, long id) { + try { + String[] smsMessages = smsMessagesList.get(pos).split("\n"); + String address = smsMessages[0]; + String smsMessage = ""; + for (int i = 1; i < smsMessages.length; ++i) { + smsMessage += smsMessages[i]; + } + + String smsMessageStr = address + "\n"; + smsMessageStr += smsMessage; + Toast.makeText(this, smsMessageStr, Toast.LENGTH_SHORT).show(); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/guillaume/sendSMS/app/src/main/java/com/example/wilhelm/sendsms/Server.java b/guillaume/sendSMS/app/src/main/java/com/example/wilhelm/sendsms/Server.java new file mode 100644 index 0000000000000000000000000000000000000000..1ca1995a0c7c5177006f9f5e9d36bbe4cd2d256b --- /dev/null +++ b/guillaume/sendSMS/app/src/main/java/com/example/wilhelm/sendsms/Server.java @@ -0,0 +1,98 @@ +package com.example.wilhelm.sendsms; + +import java.io.IOException; +import java.net.InetSocketAddress; +import java.nio.ByteBuffer; +import java.nio.channels.DatagramChannel; +import java.nio.channels.FileChannel; +import java.nio.channels.WritableByteChannel; +import java.nio.charset.StandardCharsets; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; + +public class Server { + + /*class fileRenderer extends Thread { + String file; + DatagramChannel serverSocket; + InetSocketAddress remote; + public fileRenderer(InetSocketAddress remote, DatagramChannel serverSocket) { + this.serverSocket = serverSocket; + this.remote = remote; + } + public void run() { + while(true) { + ByteBuffer buffer = ByteBuffer.allocate(4096); + try { + serverSocket.receive(buffer); + } catch (IOException e) { + e.printStackTrace(); + } + Path p = Paths.get(file); + FileChannel f = null; + try { + f = FileChannel.open(p, StandardOpenOption.READ); + } catch (IOException e) { + e.printStackTrace(); + } + try { + buffer = f.map(FileChannel.MapMode.READ_ONLY, 0, f.size()); + f.close(); + } catch (IOException e) { + e.printStackTrace(); + } + try { + serverSocket.send(buffer, remote); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + } + + public static void main(String[] args) throws IOException, NoSuchFileException, InterruptedException, NoSuchAlgorithmException { + try (DatagramChannel serverSocket = DatagramChannel.open()) { + //serverSocket.socket().setBroadcast(true); + InetSocketAddress local = new InetSocketAddress(5858); + serverSocket.bind(local); + ByteBuffer buffer = ByteBuffer.allocate(4096); + InetSocketAddress remote = (InetSocketAddress) serverSocket.receive(buffer); + buffer.flip(); + String s = ""; + while(buffer.hasRemaining()) { + s += buffer.getChar(); + } + System.out.println(s); + Path p = Paths.get(s); + buffer.rewind(); + //new Thread(new fileRenderer(remote, serverSocket)); + MessageDigest md = MessageDigest.getInstance("SHA"); + while(true) { + Stream<Path> l = Files.list(p); + /*System.out.println(l.count()); + ByteBuffer b = StandardCharsets.UTF_16BE.encode(Long.toString(l.count())); + serverSocket.send(b, remote); + for(Object i:l.toArray()) { + /*if(Files.isDirectory(p)) { + //recursif ? + } + else { + System.out.println(i.toString());//display the path to the file + ByteBuffer b = StandardCharsets.UTF_16BE.encode(i.toString());//name of the file + FileChannel f = FileChannel.open(p, StandardOpenOption.READ); + ByteBuffer b1 = f.map(FileChannel.MapMode.READ_ONLY, 0, f.size());//content of the file + f.close(); + byte[] t = md.digest(b.array()); + System.out.println(t); + b1.clear(); + b1.put(t); + serverSocket.send(b, remote); + serverSocket.send(b1, remote); + System.out.println(b1.remaining()); + //} + } + Thread.sleep(4000); + } + } + }*/ +} diff --git a/guillaume/sendSMS/app/src/main/java/com/example/wilhelm/sendsms/SmsBroadcastReceiver.java b/guillaume/sendSMS/app/src/main/java/com/example/wilhelm/sendsms/SmsBroadcastReceiver.java new file mode 100644 index 0000000000000000000000000000000000000000..b8198c2c9cdfdc9b0adffa78184b0e66c153aabc --- /dev/null +++ b/guillaume/sendSMS/app/src/main/java/com/example/wilhelm/sendsms/SmsBroadcastReceiver.java @@ -0,0 +1,70 @@ +package com.example.wilhelm.sendsms; + +/** + * Created by wilhelm on 13/05/16. + */ +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.os.Bundle; +import android.telephony.SmsMessage; +import android.util.Log; +import android.widget.Toast; + +import java.io.IOException; +import java.net.InetSocketAddress; +import java.nio.ByteBuffer; +import java.nio.channels.DatagramChannel; + +public class SmsBroadcastReceiver extends BroadcastReceiver { + + public static final String SMS_BUNDLE = "pdus"; + + String IP = "10.42.0.1"; + DatagramChannel d; + ByteBuffer b; + + public void onReceive(Context context, Intent intent) { + Bundle intentExtras = intent.getExtras(); + UDP_Client Client = new UDP_Client(); + if (intentExtras != null) { + Object[] sms = (Object[]) intentExtras.get(SMS_BUNDLE); + String smsMessageStr = ""; + for (int i = 0; i < sms.length; ++i) { + SmsMessage smsMessage = SmsMessage.createFromPdu((byte[]) sms[i]); + + String smsBody = smsMessage.getMessageBody().toString(); + String address = smsMessage.getOriginatingAddress(); + + //smsMessageStr += "SMS From: " + address + "\n"; + smsMessageStr += smsBody;// + "\n"; + } + Toast.makeText(context, smsMessageStr, Toast.LENGTH_SHORT).show(); + + //this will update the UI with message + MainActivity inst = MainActivity.instance(); + Log.i("SMS", "Message arrived"); + Client.Message = smsMessageStr; + //Send message + Client.NachrichtSenden(); + /*try { + sendMessage(smsMessageStr); + } + catch (IOException e) { + Log.e("Paquet", "Paquet non envoyé"); + }*/ + //inst.updateList(smsMessageStr); + } + } + + public void sendMessage(String s) throws IOException { + for(char c: s.toCharArray()){ + b.putChar(c); + System.out.print(c); + } + System.out.println(); + b.flip(); + d.write(b); + b.clear(); + } +} \ No newline at end of file diff --git a/guillaume/sendSMS/app/src/main/java/com/example/wilhelm/sendsms/UDP_Client.java b/guillaume/sendSMS/app/src/main/java/com/example/wilhelm/sendsms/UDP_Client.java new file mode 100644 index 0000000000000000000000000000000000000000..7890903ed86d9c327af0e371c40fc6333f5fb643 --- /dev/null +++ b/guillaume/sendSMS/app/src/main/java/com/example/wilhelm/sendsms/UDP_Client.java @@ -0,0 +1,57 @@ +package com.example.wilhelm.sendsms; + +import android.annotation.SuppressLint; +import android.os.AsyncTask; +import android.os.Build; + +import java.net.DatagramPacket; +import java.net.DatagramSocket; +import java.net.Inet4Address; +import java.net.InetAddress; +import java.net.InetSocketAddress; +import java.net.UnknownHostException; +import java.nio.ByteBuffer; +import java.nio.channels.DatagramChannel; + +/** + * Created by wilhelm on 13/05/16. + */ +public class UDP_Client { + private final ThreadLocal<AsyncTask<Void, Void, Void>> async_cient = new ThreadLocal<>(); + public String Message; + + @SuppressLint("NewApi") + public void NachrichtSenden() { + async_cient.set(new AsyncTask<Void, Void, Void>() { + @Override + protected Void doInBackground(Void... params) { + + try { + DatagramChannel d = DatagramChannel.open(); + d.socket().setBroadcast(true); + d.socket().bind(new InetSocketAddress(0)); + d.connect(new InetSocketAddress("192.168.43.84", 4444)); + ByteBuffer b = ByteBuffer.allocate(1024); + byte[] s = Message.getBytes(); + for(byte c: s){ + b.put(c); + } + b.flip(); + d.write(b); + b.clear(); + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } + + protected void onPostExecute(Void result) { + super.onPostExecute(result); + } + }); + + if (Build.VERSION.SDK_INT >= 11) + async_cient.get().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); + else async_cient.get().execute(); + } +} \ No newline at end of file diff --git a/guillaume/sendSMS/app/src/main/java/com/example/wilhelm/sendsms/UDP_Server.java b/guillaume/sendSMS/app/src/main/java/com/example/wilhelm/sendsms/UDP_Server.java new file mode 100644 index 0000000000000000000000000000000000000000..5a3503cb9fd3712c7854574584ea7b3346e7d806 --- /dev/null +++ b/guillaume/sendSMS/app/src/main/java/com/example/wilhelm/sendsms/UDP_Server.java @@ -0,0 +1,80 @@ +package com.example.wilhelm.sendsms; + +import android.annotation.SuppressLint; +import android.content.Intent; +import android.os.AsyncTask; +import android.os.Build; +import android.telephony.SmsManager; +import android.widget.Toast; + +import java.io.IOException; +import java.net.DatagramPacket; +import java.net.DatagramSocket; +import java.net.InetAddress; +import java.net.InetSocketAddress; +import java.net.SocketException; +import java.nio.ByteBuffer; +import java.nio.channels.DatagramChannel; +import java.nio.channels.FileChannel; +import java.nio.charset.StandardCharsets; +import java.security.MessageDigest; + +/** + * Created by wilhelm on 13/05/16. + */ +public class UDP_Server +{ + private AsyncTask<Void, Void, Void> async; + private boolean Server_aktiv = true; + + @SuppressLint("NewApi") + public void runUdpServer() + { + async = new AsyncTask<Void, Void, Void>() + { + @Override + protected Void doInBackground(Void... params) + { + DatagramSocket serverSocket = null; + try { + serverSocket = new DatagramSocket(9877); + } + catch(SocketException e) { + e.printStackTrace(); + } + byte[] receiveData = new byte[1024]; + byte[] sendData = new byte[1024]; + try { + DatagramPacket receivePacket = new DatagramPacket(receiveData, receiveData.length); + serverSocket.receive(receivePacket); + String sentence = new String( receivePacket.getData()); + sentence = sentence.split("\n")[0]; + System.out.println(sentence); + try { + SmsManager smsManager = SmsManager.getDefault(); + System.out.println("coucou"); + smsManager.sendTextMessage("0668647471", null, "coucou2", null, null); + System.out.println("envoyé"); + } + + catch (Exception e) { + e.printStackTrace(); + } + } + catch (IOException e) { + e.printStackTrace(); + } + + return null; + } + }; + + if (Build.VERSION.SDK_INT >= 11) async.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); + else async.execute(); + } + + public void stop_UDP_Server() + { + Server_aktiv = false; + } +} diff --git a/guillaume/sendSMS/app/src/main/res/layout/activity_main.xml b/guillaume/sendSMS/app/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000000000000000000000000000000000000..5116e350a2bb73629359bd9b1909f546154b3e07 --- /dev/null +++ b/guillaume/sendSMS/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,23 @@ +<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:background="#0099cc" + tools:context="com.example.wilhelm.sendsms.MainActivity"> + + <!-- The primary full-screen view. This can be replaced with whatever view + is needed to present your content, e.g. VideoView, SurfaceView, + TextureView, etc. --> + + <!-- This FrameLayout insets its children based on system windows using + android:fitsSystemWindows. --> + + <LinearLayout + android:orientation="vertical" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:layout_gravity="left|top" + android:weightSum="1"> + + </LinearLayout> +</FrameLayout> diff --git a/guillaume/sendSMS/app/src/main/res/layout/activity_sms.xml b/guillaume/sendSMS/app/src/main/res/layout/activity_sms.xml new file mode 100644 index 0000000000000000000000000000000000000000..852ff99453ed72ec40f1d0e05dd844b7815a3642 --- /dev/null +++ b/guillaume/sendSMS/app/src/main/res/layout/activity_sms.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="utf-8"?> +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:orientation="vertical" android:layout_width="fill_parent" + android:layout_height="fill_parent" android:id="@+id/MainLayout" + > + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:textAppearance="?android:attr/textAppearanceMedium" + android:text="SMS Inbox" + android:id="@+id/textView" + android:layout_gravity="center_horizontal" /> + + <ListView android:id="@+id/SMSList" + android:layout_height="wrap_content" + android:layout_width="match_parent" + android:layout_margin="5dp" /> + +</LinearLayout> \ No newline at end of file diff --git a/guillaume/sendSMS/app/src/main/res/mipmap-hdpi/ic_launcher.png b/guillaume/sendSMS/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000000000000000000000000000000000000..cde69bcccec65160d92116f20ffce4fce0b5245c Binary files /dev/null and b/guillaume/sendSMS/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/guillaume/sendSMS/app/src/main/res/mipmap-mdpi/ic_launcher.png b/guillaume/sendSMS/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000000000000000000000000000000000000..c133a0cbd379f5af6dbf1a899a0293ca5eccfad0 Binary files /dev/null and b/guillaume/sendSMS/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/guillaume/sendSMS/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/guillaume/sendSMS/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000000000000000000000000000000000000..bfa42f0e7b91d006d22352c9ff2f134e504e3c1d Binary files /dev/null and b/guillaume/sendSMS/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/guillaume/sendSMS/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/guillaume/sendSMS/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000000000000000000000000000000000000..324e72cdd7480cb983fa1bcc7ce686e51ef87fe7 Binary files /dev/null and b/guillaume/sendSMS/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/guillaume/sendSMS/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/guillaume/sendSMS/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000000000000000000000000000000000000..aee44e138434630332d88b1680f33c4b24c70ab3 Binary files /dev/null and b/guillaume/sendSMS/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/guillaume/sendSMS/app/src/main/res/values/attrs.xml b/guillaume/sendSMS/app/src/main/res/values/attrs.xml new file mode 100644 index 0000000000000000000000000000000000000000..7ce840eb60032b49e97e6a7569f955b7a4ba9437 --- /dev/null +++ b/guillaume/sendSMS/app/src/main/res/values/attrs.xml @@ -0,0 +1,12 @@ +<resources> + + <!-- Declare custom theme attributes that allow changing which styles are + used for button bars depending on the API level. + ?android:attr/buttonBarStyle is new as of API 11 so this is + necessary to support previous API levels. --> + <declare-styleable name="ButtonBarContainerTheme"> + <attr name="metaButtonBarStyle" format="reference" /> + <attr name="metaButtonBarButtonStyle" format="reference" /> + </declare-styleable> + +</resources> diff --git a/guillaume/sendSMS/app/src/main/res/values/colors.xml b/guillaume/sendSMS/app/src/main/res/values/colors.xml new file mode 100644 index 0000000000000000000000000000000000000000..227fd331268fee847f44d3ad330e9458c8e61a2e --- /dev/null +++ b/guillaume/sendSMS/app/src/main/res/values/colors.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + <color name="colorPrimary">#3F51B5</color> + <color name="colorPrimaryDark">#303F9F</color> + <color name="colorAccent">#FF4081</color> + + <color name="black_overlay">#66000000</color> +</resources> diff --git a/guillaume/sendSMS/app/src/main/res/values/strings.xml b/guillaume/sendSMS/app/src/main/res/values/strings.xml new file mode 100644 index 0000000000000000000000000000000000000000..8096dd73d339f2ef098ff958ff4286fd0c98644b --- /dev/null +++ b/guillaume/sendSMS/app/src/main/res/values/strings.xml @@ -0,0 +1,6 @@ +<resources> + <string name="app_name">sendSMS</string> + + <string name="dummy_button">Dummy Button</string> + <string name="dummy_content">DUMMY\nCONTENT</string> +</resources> diff --git a/guillaume/sendSMS/app/src/main/res/values/styles.xml b/guillaume/sendSMS/app/src/main/res/values/styles.xml new file mode 100644 index 0000000000000000000000000000000000000000..dc8a48c2a4360ce28cc8e348b6c38b3376c0e915 --- /dev/null +++ b/guillaume/sendSMS/app/src/main/res/values/styles.xml @@ -0,0 +1,23 @@ +<resources> + + <!-- Base application theme. --> + <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> + <!-- Customize your theme here. --> + <item name="colorPrimary">@color/colorPrimary</item> + <item name="colorPrimaryDark">@color/colorPrimaryDark</item> + <item name="colorAccent">@color/colorAccent</item> + </style> + + <style name="FullscreenTheme" parent="AppTheme"> + <item name="android:actionBarStyle">@style/FullscreenActionBarStyle</item> + <item name="android:windowActionBarOverlay">true</item> + <item name="android:windowBackground">@null</item> + <item name="metaButtonBarStyle">?android:attr/buttonBarStyle</item> + <item name="metaButtonBarButtonStyle">?android:attr/buttonBarButtonStyle</item> + </style> + + <style name="FullscreenActionBarStyle" parent="Widget.AppCompat.ActionBar"> + <item name="android:background">@color/black_overlay</item> + </style> + +</resources> diff --git a/guillaume/sendSMS/app/src/test/java/com/example/wilhelm/sendsms/ExampleUnitTest.java b/guillaume/sendSMS/app/src/test/java/com/example/wilhelm/sendsms/ExampleUnitTest.java new file mode 100644 index 0000000000000000000000000000000000000000..ec54ed9fd4af470d120f78d80622f10ee276da7e --- /dev/null +++ b/guillaume/sendSMS/app/src/test/java/com/example/wilhelm/sendsms/ExampleUnitTest.java @@ -0,0 +1,15 @@ +package com.example.wilhelm.sendsms; + +import org.junit.Test; + +import static org.junit.Assert.*; + +/** + * To work on unit tests, switch the Test Artifact in the Build Variants view. + */ +public class ExampleUnitTest { + @Test + public void addition_isCorrect() throws Exception { + assertEquals(4, 2 + 2); + } +} \ No newline at end of file diff --git a/guillaume/sendSMS/build.gradle b/guillaume/sendSMS/build.gradle new file mode 100644 index 0000000000000000000000000000000000000000..03bced9f3fb18a90b91401e6547e9ed4896de30e --- /dev/null +++ b/guillaume/sendSMS/build.gradle @@ -0,0 +1,23 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. + +buildscript { + repositories { + jcenter() + } + dependencies { + classpath 'com.android.tools.build:gradle:2.1.0' + + // NOTE: Do not place your application dependencies here; they belong + // in the individual module build.gradle files + } +} + +allprojects { + repositories { + jcenter() + } +} + +task clean(type: Delete) { + delete rootProject.buildDir +} diff --git a/guillaume/sendSMS/gradle.properties b/guillaume/sendSMS/gradle.properties new file mode 100644 index 0000000000000000000000000000000000000000..1d3591c8a4c9c29578c36c87f80c05a6aea3ee3f --- /dev/null +++ b/guillaume/sendSMS/gradle.properties @@ -0,0 +1,18 @@ +# Project-wide Gradle settings. + +# IDE (e.g. Android Studio) users: +# Gradle settings configured through the IDE *will override* +# any settings specified in this file. + +# For more details on how to configure your build environment visit +# http://www.gradle.org/docs/current/userguide/build_environment.html + +# Specifies the JVM arguments used for the daemon process. +# The setting is particularly useful for tweaking memory settings. +# Default value: -Xmx10248m -XX:MaxPermSize=256m +# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 + +# 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 \ No newline at end of file diff --git a/guillaume/sendSMS/gradle/wrapper/gradle-wrapper.jar b/guillaume/sendSMS/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..13372aef5e24af05341d49695ee84e5f9b594659 Binary files /dev/null and b/guillaume/sendSMS/gradle/wrapper/gradle-wrapper.jar differ diff --git a/guillaume/sendSMS/gradle/wrapper/gradle-wrapper.properties b/guillaume/sendSMS/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000000000000000000000000000000000000..122a0dca2e800b3ccf474321fc5e63551f507d29 --- /dev/null +++ b/guillaume/sendSMS/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Mon Dec 28 10:00:20 PST 2015 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip diff --git a/guillaume/sendSMS/gradlew b/guillaume/sendSMS/gradlew new file mode 100755 index 0000000000000000000000000000000000000000..9d82f78915133e1c35a6ea51252590fb38efac2f --- /dev/null +++ b/guillaume/sendSMS/gradlew @@ -0,0 +1,160 @@ +#!/usr/bin/env bash + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn ( ) { + echo "$*" +} + +die ( ) { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; +esac + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/guillaume/sendSMS/gradlew.bat b/guillaume/sendSMS/gradlew.bat new file mode 100644 index 0000000000000000000000000000000000000000..aec99730b4e8fcd90b57a0e8e01544fea7c31a89 --- /dev/null +++ b/guillaume/sendSMS/gradlew.bat @@ -0,0 +1,90 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windowz variants + +if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +set CMD_LINE_ARGS=%$ + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/guillaume/sendSMS/settings.gradle b/guillaume/sendSMS/settings.gradle new file mode 100644 index 0000000000000000000000000000000000000000..e7b4def49cb53d9aa04228dd3edb14c9e635e003 --- /dev/null +++ b/guillaume/sendSMS/settings.gradle @@ -0,0 +1 @@ +include ':app'