diff --git a/README.md b/README.md index 7fcaa14..85d3b63 100644 --- a/README.md +++ b/README.md @@ -4,12 +4,47 @@ This is recreate from [Old SMS Gateway](https://github.com/anjlab/android-sms-gateway) now using Firebase to turn my android as sms sender + +# HOW IT WORKS + +Sending SMS + +1. You send data to sms.ibnux.net (or your server) +2. Server will send push notification +3. App receive push notification, and route it to sms +4. App receive sent notification, and post it to your server +5. App receive delivered notification, and post it to your server + +RECEIVE SMS +1. App receive SMS +2. App send it to your server # HOW TO USE? Download APK from [release](https://github.com/ibnux/Android-SMS-Gateway/releases) page then open https://sms.ibnux.net/ to learn how to send sms +you can find backend folder for server side in this source + +to compile yourself, you need your own Firebase + +# FEATURES + +- SENDING SMS +- RECEIVE SMS to SERVER +- SENT NOTIFICATION to SERVER +- DELIVERED NOTIFICATION to SERVER + +## Traktir @ibnux + +[](https://karyakarsa.com/ibnux) + +[](https://trakteer.id/ibnux) + +## DONATE @ibnux + +[paypal.me/ibnux](https://paypal.me/ibnux) + # LICENSE ## Apache License 2.0 diff --git a/app/build.gradle b/app/build.gradle index 624b70b..20769f9 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,8 +10,8 @@ android { applicationId "com.ibnux.smsgateway" minSdkVersion 16 targetSdkVersion 29 - versionCode 2 - versionName "1.2" + versionCode 3 + versionName "2.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } buildTypes { @@ -32,10 +32,8 @@ android { dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation 'androidx.appcompat:appcompat:1.1.0' - implementation 'androidx.constraintlayout:constraintlayout:1.1.3' implementation 'com.google.firebase:firebase-messaging:19.0.1' implementation 'com.karumi:dexter:6.1.0' - implementation 'androidx.legacy:legacy-support-v4:1.0.0' testImplementation 'junit:junit:4.12' androidTestImplementation 'androidx.test.ext:junit:1.1.1' androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' diff --git a/app/src/main/java/com/ibnux/smsgateway/MainActivity.java b/app/src/main/java/com/ibnux/smsgateway/MainActivity.java index 719b315..531955c 100644 --- a/app/src/main/java/com/ibnux/smsgateway/MainActivity.java +++ b/app/src/main/java/com/ibnux/smsgateway/MainActivity.java @@ -9,10 +9,8 @@ import android.os.Bundle; import android.os.Handler; import android.text.InputType; -import android.view.Menu; -import android.view.MenuInflater; -import android.view.MenuItem; -import android.view.View; +import android.view.*; +import android.view.inputmethod.EditorInfo; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; @@ -43,6 +41,7 @@ public class MainActivity extends AppCompatActivity { RecyclerView recyclerview; LogAdapter adapter; SwipeRefreshLayout swipe; + EditText editTextSearch; @Override protected void onCreate(Bundle savedInstanceState) { @@ -50,6 +49,7 @@ protected void onCreate(Bundle savedInstanceState) { setContentView(R.layout.activity_main); recyclerview = findViewById(R.id.recyclerview); + editTextSearch = findViewById(R.id.editTextSearch); swipe = findViewById(R.id.swipe); info = findViewById(R.id.text); info.setText("Click Me to Show Configuration"); @@ -99,6 +99,26 @@ public void run() { }); } }); + + + editTextSearch.setOnEditorActionListener(new TextView.OnEditorActionListener() { + @Override + public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { + boolean handled = false; + if (actionId == EditorInfo.IME_ACTION_SEARCH) { + recyclerview.post(new Runnable() { + @Override + public void run() { + adapter.search(editTextSearch.getText().toString()); + editTextSearch.clearFocus(); + } + }); + handled = true; + } + return handled; + } + }); + } public void updateInfo(){ diff --git a/app/src/main/java/com/ibnux/smsgateway/data/PaginationListener.java b/app/src/main/java/com/ibnux/smsgateway/data/PaginationListener.java index b7d4c2f..f22b4b8 100644 --- a/app/src/main/java/com/ibnux/smsgateway/data/PaginationListener.java +++ b/app/src/main/java/com/ibnux/smsgateway/data/PaginationListener.java @@ -11,7 +11,7 @@ public abstract class PaginationListener extends RecyclerView.OnScrollListener { /** * Set scrolling threshold here (for now i'm assuming 10 item in one page) */ - private static final int PAGE_SIZE = 5; + private static final int PAGE_SIZE = 50; /** * Supporting only LinearLayoutManager for now. */ diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index c5e1a9d..339a2ae 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -1,6 +1,5 @@ + android:textIsSelectable="true"/> - - - + android:layout_height="wrap_content" + android:inputType="textPersonName" + android:ems="10" + android:id="@+id/editTextSearch" + android:hint="@android:string/search_go" + android:autofillHints="" + android:textSize="12sp" + android:imeOptions="actionSearch" + android:selectAllOnFocus="true"/> @color/colorPrimary @color/colorPrimaryDark - @color/colorAccent + @color/colorPrimary diff --git a/backend/index.php b/backend/index.php index 2f2701b..b7060ff 100644 --- a/backend/index.php +++ b/backend/index.php @@ -37,13 +37,14 @@ die(); } -$hasil = sendPush($token,$secret,$time,$to, $text); +$result = sendPush($token,$secret,$time,$to, $text); if(isset($_GET['debug']) && count($_REQUEST)>1) - file_put_contents("log.txt",$hasil."\n\n",FILE_APPEND); -echo $hasil; + file_put_contents("log.txt",$result."\n\n",FILE_APPEND); +echo $result; function sendPush($token,$secret,$time,$to, $message) { + global $firebasekey; $url = 'https://fcm.googleapis.com/fcm/send'; $fields = array ( @@ -74,4 +75,4 @@ function sendPush($token,$secret,$time,$to, $message) { curl_close ( $ch ); return $result; -} \ No newline at end of file +}