diff --git a/app/.gitignore b/app/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/app/build.gradle b/app/build.gradle new file mode 100644 index 0000000..6a4ba42 --- /dev/null +++ b/app/build.gradle @@ -0,0 +1,42 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 29 + buildToolsVersion "29.0.2" + + defaultConfig { + applicationId "espero.jiofibatterynotifier" + minSdkVersion 17 + targetSdkVersion 29 + versionCode 4 + versionName "1.3" + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + minifyEnabled true + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + +} + +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar']) + + implementation 'androidx.appcompat:appcompat:1.1.0' + implementation 'androidx.constraintlayout:constraintlayout:1.1.3' + implementation 'com.google.code.gson:gson:2.8.6' + implementation 'com.android.volley:volley:1.1.1' + implementation 'androidx.browser:browser:1.2.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/proguard-rules.pro b/app/proguard-rules.pro new file mode 100644 index 0000000..f1b4245 --- /dev/null +++ b/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# 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 diff --git a/app/release/output-metadata.json b/app/release/output-metadata.json new file mode 100644 index 0000000..3896383 --- /dev/null +++ b/app/release/output-metadata.json @@ -0,0 +1,20 @@ +{ + "version": 1, + "artifactType": { + "type": "APK", + "kind": "Directory" + }, + "applicationId": "espero.jiofibatterynotifier", + "variantName": "release", + "elements": [ + { + "type": "SINGLE", + "filters": [], + "properties": [], + "versionCode": 4, + "versionName": "1.3", + "enabled": true, + "outputFile": "app-release.apk" + } + ] +} \ No newline at end of file diff --git a/app/src/androidTest/java/espero/jiofibatterynotifier/ExampleInstrumentedTest.java b/app/src/androidTest/java/espero/jiofibatterynotifier/ExampleInstrumentedTest.java new file mode 100644 index 0000000..8b17f28 --- /dev/null +++ b/app/src/androidTest/java/espero/jiofibatterynotifier/ExampleInstrumentedTest.java @@ -0,0 +1,27 @@ +package espero.jiofibatterynotifier; + +import android.content.Context; + +import androidx.test.platform.app.InstrumentationRegistry; +import androidx.test.ext.junit.runners.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.*; + +/** + * Instrumented test, which will execute on an Android device. + * + * @see Testing documentation + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); + + assertEquals("espero.jiofibatterynotifier", appContext.getPackageName()); + } +} diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..d44802e --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/ic_launcher-playstore.png b/app/src/main/ic_launcher-playstore.png new file mode 100644 index 0000000..fbd5fc2 Binary files /dev/null and b/app/src/main/ic_launcher-playstore.png differ diff --git a/app/src/main/java/espero/jiofibatterynotifier/Activites/MainActivity.java b/app/src/main/java/espero/jiofibatterynotifier/Activites/MainActivity.java new file mode 100644 index 0000000..f31ef91 --- /dev/null +++ b/app/src/main/java/espero/jiofibatterynotifier/Activites/MainActivity.java @@ -0,0 +1,404 @@ +package espero.jiofibatterynotifier.Activites; + +import androidx.annotation.RequiresApi; +import androidx.appcompat.app.AppCompatActivity; +import androidx.browser.customtabs.CustomTabsIntent; +import androidx.core.content.ContextCompat; + +import android.app.ActivityManager; +import android.app.AlertDialog; +import android.content.Context; +import android.content.DialogInterface; +import android.content.Intent; +import android.content.IntentFilter; +import android.content.SharedPreferences; +import android.graphics.drawable.AnimationDrawable; +import android.media.MediaPlayer; +import android.media.Ringtone; +import android.media.RingtoneManager; +import android.net.Uri; +import android.net.wifi.WifiInfo; +import android.net.wifi.WifiManager; +import android.os.Build; +import android.os.Bundle; +import android.os.Handler; +import android.os.Message; +import android.os.PowerManager; +import android.os.Vibrator; +import android.provider.Settings; +import android.util.Log; +import android.view.View; +import android.widget.AdapterView; +import android.widget.ArrayAdapter; +import android.widget.Button; +import android.widget.Spinner; +import android.widget.TextView; +import android.widget.Toast; + +import com.android.volley.Request; +import com.android.volley.RequestQueue; +import com.android.volley.Response; +import com.android.volley.VolleyError; +import com.android.volley.toolbox.StringRequest; +import com.android.volley.toolbox.Volley; + +import espero.jiofibatterynotifier.Classes.SharedPrefMain; +import espero.jiofibatterynotifier.Classes.StartUpBootReceiver; +import espero.jiofibatterynotifier.R; +import espero.jiofibatterynotifier.Services.JioFiService; + +public class MainActivity extends AppCompatActivity { + + private TextView mainText; + private Spinner level, interval, alerts, sound, vibrate; + private Button button; + private SharedPrefMain sharedPrefMain; + private String TAG = "mainActivity"; + private Thread thread; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + + Bundle extras = getIntent().getExtras(); + + sharedPrefMain = new SharedPrefMain(this); + if (extras != null) { + mp = MediaPlayer.create(this, R.raw.low); + mp.setLooping(false); + mp.setVolume(0.5f, 0.5f); + boolean dialog = extras.getBoolean("dialog"); + String msg = extras.getString("msg"); + + if (dialog) { + showAlert(msg); + } + } + mainText = findViewById(R.id.main_text); + button = findViewById(R.id.button); + level = findViewById(R.id.level_spinner); + interval = findViewById(R.id.interval_spinner); + alerts = findViewById(R.id.alerts_spinner); + sound = findViewById(R.id.sound_spinner); + vibrate = findViewById(R.id.vibrate_spinner); + + + + if (sharedPrefMain.getBoolean("firstTime")) { + sharedPrefMain.setBoolean("firstTime", false); + sharedPrefMain.setString("interval", "5 Sec"); + sharedPrefMain.setString("low", "30 %"); + sharedPrefMain.setString("msg", "Stopped"); + sharedPrefMain.setInt("low_msg", 100); + sharedPrefMain.setInt("high_msg", 0); + sharedPrefMain.setBoolean("start", false); + } + createLayout(); + + try { + mainText.setBackgroundResource(R.drawable.rectangle_animation); + AnimationDrawable frameAnimation2 = (AnimationDrawable) mainText.getBackground(); + frameAnimation2.start(); + } catch (Exception e) { + e.printStackTrace(); + } + + interval.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { + @Override + public void onItemSelected(AdapterView parent, View view, int position, long id) { + String item = parent.getAdapter().getItem(position).toString(); + Log.d(TAG, item); + sharedPrefMain.setString("interval", item); +// Toast.makeText(MainActivity.this, "Updated", Toast.LENGTH_SHORT).show(); + } + + @Override + public void onNothingSelected(AdapterView parent) { + + } + }); + + level.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { + @Override + public void onItemSelected(AdapterView parent, View view, int position, long id) { + String item = parent.getAdapter().getItem(position).toString(); + Log.d(TAG, item); + sharedPrefMain.setString("low", item); +// Toast.makeText(MainActivity.this, "Updated", Toast.LENGTH_SHORT).show(); + } + + @Override + public void onNothingSelected(AdapterView parent) { + + } + }); + + alerts.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { + @Override + public void onItemSelected(AdapterView parent, View view, int position, long id) { + if (position == 0) { + sharedPrefMain.setBoolean("alerts", true); + } else { + sharedPrefMain.setBoolean("alerts", false); + } + } + + @Override + public void onNothingSelected(AdapterView parent) { + + } + }); + + sound.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { + @Override + public void onItemSelected(AdapterView parent, View view, int position, long id) { + if (position == 0) { + sharedPrefMain.setBoolean("sound", true); + } else { + sharedPrefMain.setBoolean("sound", false); + } + } + + @Override + public void onNothingSelected(AdapterView parent) { + + } + }); + vibrate.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { + @Override + public void onItemSelected(AdapterView parent, View view, int position, long id) { + if (position == 0) { + sharedPrefMain.setBoolean("vibrate", true); + } else { + sharedPrefMain.setBoolean("vibrate", false); + } + } + + @Override + public void onNothingSelected(AdapterView parent) { + + } + }); + + + button.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + if (button.getText().equals("Stop")) { + button.setText("Start"); + stopService(); + } else { + button.setText("Stop"); + startService(); + } + } + }); + + + Runnable runnable = new Runnable() { + @Override + public void run() { + + while (true) { + if (myHandler != null) + myHandler.sendEmptyMessage(0); + + try { + Thread.sleep(1500); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + } + }; + + thread = new Thread(runnable); + thread.start(); + + try { + IntentFilter intentFilter = new IntentFilter(); + intentFilter.addAction(Intent.ACTION_BOOT_COMPLETED); + StartUpBootReceiver broadcastReceiver = new StartUpBootReceiver(); + registerReceiver(broadcastReceiver, intentFilter); + } catch (Exception e) { + e.printStackTrace(); + } + + } + + + private void showAlert(String msg) { + alert(); + String title = "JioFi Battery Low"; + if (msg.contains("100")) { + title = "JioFi Battery Full"; + } + new AlertDialog.Builder(this) + .setTitle(title) + .setMessage(msg) + .setPositiveButton("Ok", null) + .setCancelable(false) + .setOnDismissListener(new DialogInterface.OnDismissListener() { + @Override + public void onDismiss(DialogInterface dialog) { + finish(); + } + }) + .setIcon(android.R.drawable.ic_dialog_alert).create().show(); + } + + private MediaPlayer mp; + + private void alert() { + if (sharedPrefMain.getBoolean("vibrate")) { + Vibrator vibrator; + vibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); + vibrator.vibrate(500); + } + if (sharedPrefMain.getBoolean("sound")) { + try { + if (mp != null) { + mp.start(); + } + } catch (Exception e) { + Log.d(TAG, "Error:" + e.getMessage()); + } + } + } + + private final Handler myHandler = new Handler() { + public void handleMessage(Message msg) { + if (mainText != null) { + mainText.setText(sharedPrefMain.getString("msg")); + } + } + }; + + private void createLayout() { + if (isMyServiceRunning(JioFiService.class)) { + button.setText("Stop"); + } else { + + sharedPrefMain.setString("msg", "Stopped"); + button.setText("Start"); + if (sharedPrefMain.getBoolean("start")) { + startService(); + button.setText("Stop"); + } + } + interval.setSelection(((ArrayAdapter) interval.getAdapter()).getPosition(sharedPrefMain.getString("interval"))); + level.setSelection(((ArrayAdapter) level.getAdapter()).getPosition(sharedPrefMain.getString("low"))); + if (sharedPrefMain.getBoolean("alerts")) { + alerts.setSelection(0); + } else { + alerts.setSelection(1); + } + if (sharedPrefMain.getBoolean("sound")) { + sound.setSelection(0); + } else { + sound.setSelection(1); + } + if (sharedPrefMain.getBoolean("vibrate")) { + vibrate.setSelection(0); + } else { + vibrate.setSelection(1); + } + } + + private void startService() { + requestWhitelist(); + sharedPrefMain.setBoolean("start", true); + Intent intent = new Intent(MainActivity.this, JioFiService.class); + intent.setAction(JioFiService.ACTION_START_FOREGROUND_SERVICE); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + startForegroundService(intent); + } else { + startService(intent); + } + } + + private void stopService() { + sharedPrefMain.setBoolean("start", false); + sharedPrefMain.setString("msg", "Stopped"); + Intent intent = new Intent(MainActivity.this, JioFiService.class); + intent.setAction(JioFiService.ACTION_STOP_FOREGROUND_SERVICE); + startService(intent); + } + + private boolean isMyServiceRunning(Class serviceClass) { + ActivityManager manager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE); + for (ActivityManager.RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) { + if (serviceClass.getName().equals(service.service.getClassName())) { + return true; + } + } + return false; + } + + + public void openJioFiPanel(View view) { + Log.d(TAG, "Clicked"); + String gateway = sharedPrefMain.getString("gateway"); + if (gateway.isEmpty()) { + gateway = "http://192.168.225.1"; + } else { + gateway = "http://" + gateway; + } + + CustomTabsIntent.Builder intentBuilder = new CustomTabsIntent.Builder(); + intentBuilder.setToolbarColor(ContextCompat.getColor(this, R.color.colorPrimary)); + intentBuilder.setSecondaryToolbarColor(ContextCompat.getColor(this, R.color.colorPrimaryDark)); + + try { + CustomTabsIntent customTabsIntent = intentBuilder.build(); + customTabsIntent.intent.setPackage("com.android.chrome"); + customTabsIntent.launchUrl(this, Uri.parse(gateway)); + } catch (Exception e) { + try { + CustomTabsIntent customTabsIntent = intentBuilder.build(); + customTabsIntent.launchUrl(this, Uri.parse(gateway)); + } catch (Exception e1) { + Log.d(TAG, "Error:" + e1.getMessage()); + } + } + + } + + public void openPlayStore(View view) { + startActivityForResult(new Intent(Intent.ACTION_VIEW, + Uri.parse("https://www.buymeacoffee.com/parveshmonu")), 1); + } + + private void requestWhitelist() { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { + Intent intent = new Intent(); + String packageName = getPackageName(); + PowerManager pm = (PowerManager) getSystemService(POWER_SERVICE); + if (!pm.isIgnoringBatteryOptimizations(packageName)) { + intent.setAction(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS); + intent.setData(Uri.parse("package:" + packageName)); + startActivity(intent); + } + } + } + + @Override + protected void onStop() { + + try { + if (mp != null) { + mp.stop(); + mp = null; + } + if (thread != null) { + thread.interrupt(); + thread = null; + } + } catch (Exception e) { + + } + + super.onStop(); + } +} diff --git a/app/src/main/java/espero/jiofibatterynotifier/Classes/SharedPrefMain.java b/app/src/main/java/espero/jiofibatterynotifier/Classes/SharedPrefMain.java new file mode 100755 index 0000000..266bbcf --- /dev/null +++ b/app/src/main/java/espero/jiofibatterynotifier/Classes/SharedPrefMain.java @@ -0,0 +1,102 @@ +package espero.jiofibatterynotifier.Classes; + +import android.content.Context; +import android.content.SharedPreferences; +import android.util.Log; + +import com.google.gson.Gson; + + +/** + * Created by parvesh_dhull on 9/2/17. + */ + +public class SharedPrefMain { + + private static String engwingoSharedPrefMain = "esperoJioFiSharedPref"; + private static String uid ; + Context context; + SharedPreferences sharedpreferences; + SharedPreferences.Editor editor; + Gson gson; + + + public SharedPrefMain(Context context) { + + + try { + this.context = context; + sharedpreferences = context.getSharedPreferences(engwingoSharedPrefMain, Context.MODE_PRIVATE); + editor = sharedpreferences.edit(); + gson = new Gson(); + uid = sharedpreferences.getString("uid", ""); + } catch (Exception e) { + e.printStackTrace(); + } + + } + public void setBoolean(String name,Boolean value){ + try { + editor.putBoolean("myBooleanNew"+ name, value); + editor.commit(); + } catch (Exception e) { + e.printStackTrace(); + } + } + public boolean getBoolean(String name){ + try { + return sharedpreferences.getBoolean("myBooleanNew"+ name , true); + } catch (Exception e) { + e.printStackTrace(); + return true; + } + } + public void setString(String name,String value){ + try { + editor.putString("myStringNew"+ name, value); + editor.commit(); + } catch (Exception e) { + e.printStackTrace(); + } + } + public String getString(String name) { + try { + return sharedpreferences.getString("myStringNew"+ name , ""); + } catch (Exception e) { + e.printStackTrace(); + return ""; + } + } + public void setInt(String name,int value){ + try { + editor.putInt("myIntNew"+ name, value); + editor.commit(); + } catch (Exception e) { + e.printStackTrace(); + } + } + public int getInt(String name) { + try { + return sharedpreferences.getInt("myIntNew"+ name , 0); + } catch (Exception e) { + e.printStackTrace(); + return 0; + } + } + public void setLong(String name,Long value){ + try { + editor.putLong("myLongNew"+ name, value); + editor.commit(); + } catch (Exception e) { + e.printStackTrace(); + } + } + public long getLong(String name) { + try { + return sharedpreferences.getLong("myLongNew"+ name , 0L); + } catch (Exception e) { + e.printStackTrace(); + return 0L; + } + } +} diff --git a/app/src/main/java/espero/jiofibatterynotifier/Classes/StartUpBootReceiver.java b/app/src/main/java/espero/jiofibatterynotifier/Classes/StartUpBootReceiver.java new file mode 100644 index 0000000..82aa0e5 --- /dev/null +++ b/app/src/main/java/espero/jiofibatterynotifier/Classes/StartUpBootReceiver.java @@ -0,0 +1,40 @@ +package espero.jiofibatterynotifier.Classes; + +import android.app.ActivityManager; +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.os.Build; +import espero.jiofibatterynotifier.Services.JioFiService; + +public class StartUpBootReceiver extends BroadcastReceiver { + private SharedPrefMain sharedPrefMain; + + @Override + public void onReceive(Context context, Intent intent) { + + sharedPrefMain = new SharedPrefMain(context); + if (Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction())) { + if(!isMyServiceRunning(JioFiService.class, context) && sharedPrefMain.getBoolean("start")){ + Intent intent2 = new Intent(context, JioFiService.class); + intent2.setAction(JioFiService.ACTION_START_FOREGROUND_SERVICE); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + context.startForegroundService(intent2); + } else { + context.startService(intent2); + } + } + } + } + + private boolean isMyServiceRunning(Class serviceClass, Context context) { + ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); + for (ActivityManager.RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) { + if (serviceClass.getName().equals(service.service.getClassName())) { + return true; + } + } + return false; + } + +} \ No newline at end of file diff --git a/app/src/main/java/espero/jiofibatterynotifier/Services/JioFiService.java b/app/src/main/java/espero/jiofibatterynotifier/Services/JioFiService.java new file mode 100644 index 0000000..b8406a9 --- /dev/null +++ b/app/src/main/java/espero/jiofibatterynotifier/Services/JioFiService.java @@ -0,0 +1,432 @@ +package espero.jiofibatterynotifier.Services; + +import android.app.Notification; +import android.app.NotificationChannel; +import android.app.NotificationManager; +import android.app.PendingIntent; +import android.app.Service; +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.content.IntentFilter; +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; +import android.media.RingtoneManager; +import android.net.Uri; +import android.net.wifi.WifiInfo; +import android.net.wifi.WifiManager; +import android.os.Build; +import android.os.IBinder; +import android.util.Log; +import android.widget.Toast; + +import androidx.core.app.NotificationCompat; + +import com.android.volley.Request; +import com.android.volley.RequestQueue; +import com.android.volley.toolbox.StringRequest; +import com.android.volley.toolbox.Volley; + +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import espero.jiofibatterynotifier.Activites.MainActivity; +import espero.jiofibatterynotifier.Classes.SharedPrefMain; +import espero.jiofibatterynotifier.R; + +public class JioFiService extends Service { + + private static final String TAG_FOREGROUND_SERVICE = "mainActivity"; + + public static final String ACTION_START_FOREGROUND_SERVICE = "ACTION_START_FOREGROUND_SERVICE"; + + public static final String ACTION_STOP_FOREGROUND_SERVICE = "ACTION_STOP_FOREGROUND_SERVICE"; + + + public JioFiService() { + } + + private Thread thread; + private SharedPrefMain sharedPrefMain; + private RequestQueue queue; + private String pattern_string = "(id=\"batterylevel\" value=\")(\\d*)(%\")"; + private Pattern pattern; + + @Override + public void onDestroy() { + try { + if(thread != null && thread.isAlive()){ + thread.interrupt(); + thread = null; + } + if(queue != null){ + queue.cancelAll(TAG_FOREGROUND_SERVICE); + queue.stop(); + queue = null; + } + } catch (Exception e) { + e.printStackTrace(); + } + super.onDestroy(); + } + + @Override + public IBinder onBind(Intent intent) { + // TODO: Return the communication channel to the service. + throw new UnsupportedOperationException("Not yet implemented"); + } + + @Override + public void onCreate() { + super.onCreate(); + sharedPrefMain = new SharedPrefMain(this); + Log.d(TAG_FOREGROUND_SERVICE, "My foreground service onCreate()."); + IntentFilter intentFilter = new IntentFilter(); + intentFilter.addAction(WifiManager.SUPPLICANT_CONNECTION_CHANGE_ACTION); + WifiReceiver broadcastReceiver = new WifiReceiver(); + registerReceiver(broadcastReceiver, intentFilter); + queue = Volley.newRequestQueue(this); + pattern = Pattern.compile(pattern_string); + thread = new Thread(runnable); + thread.start(); + } + + @Override + public int onStartCommand(Intent intent, int flags, int startId) { + if (intent != null) { + String action = intent.getAction(); + if (action != null) + switch (action) { + case ACTION_START_FOREGROUND_SERVICE: + startForegroundService(); + if (checkWifiOnAndConnected()) { + wifiChanged(true); + } + Toast.makeText(getApplicationContext(), "JioFi Battery Notifier Started.", Toast.LENGTH_LONG).show(); + break; + case ACTION_STOP_FOREGROUND_SERVICE: + stopForegroundService(); + Toast.makeText(getApplicationContext(), "JioFi Battery Notifier Stopped.", Toast.LENGTH_LONG).show(); + break; + } + } + return super.onStartCommand(intent, flags, startId); + } + + String channelId = "JioFi Battery Notifier"; + /* Used to build and start foreground service. */ + private void startForegroundService() { + + NotificationManager notificationManager = + (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); + + // Since android Oreo notification channel is needed. + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + NotificationChannel channel = new NotificationChannel(channelId, + "JioFI Battery Notifier", + NotificationManager.IMPORTANCE_HIGH); + if (notificationManager != null) { + notificationManager.createNotificationChannel(channel); + } + Notification notification = getNotification("JioFi Battery Notifier Running", R.drawable.icon, false); + notificationManager.notify(236, notification); + startForeground(236, notification); + } else { + Notification notification = getNotification("JioFi Battery Notifier Running", R.drawable.icon, false); + startForeground(236, notification); + } + } + + + private void stopForegroundService() { + Log.d(TAG_FOREGROUND_SERVICE, "Stop foreground service."); + stopForeground(true); + stopSelf(); + } + + private boolean checkWifiOnAndConnected() { + WifiManager wifiMgr = (WifiManager) this.getSystemService(Context.WIFI_SERVICE); + + if (wifiMgr.isWifiEnabled()) { // Wi-Fi adapter is ON + + WifiInfo wifiInfo = wifiMgr.getConnectionInfo(); + + if (wifiInfo.getNetworkId() == -1) { + return false; // Not connected to an access point + } + return true; // Connected to an access point + } else { + return false; // Wi-Fi adapter is OFF + } + } + + Runnable runnable = new Runnable() { + @Override + public void run() { + while (thread != null) { + if (thread.isInterrupted()) { + thread = null; + break; + } else { + + int interval = getInterval(); + + if(queue != null){ + sendRequest(); + } + + try { + Thread.sleep(interval); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + } + } + }; + + + private void sendRequest(){ + String url = "http://" + sharedPrefMain.getString("gateway"); + + StringRequest stringRequest = new StringRequest(Request.Method.GET, url, + response -> { + Matcher m = pattern.matcher(response); + String percentage = "50"; + boolean charging = true; + if (m.find( )) { + percentage = m.group(2); + } + if(response.toLowerCase().contains("discharging")){ + charging = false; + } + updateBatteryData(percentage, charging); + }, error -> { + updateNotification("JioFi Not Connected", R.drawable.icon, false); +// Log.d(TAG_FOREGROUND_SERVICE, "URL" + url); +// Log.d(TAG_FOREGROUND_SERVICE, "Error Service:" + error.getMessage()); + }); + + stringRequest.setTag(TAG_FOREGROUND_SERVICE); + + queue.add(stringRequest); + } + + int icons[] = {R.drawable.b0,R.drawable.b1,R.drawable.b2,R.drawable.b3,R.drawable.b4,R.drawable.b5,R.drawable.b6,R.drawable.b7,R.drawable.b8,R.drawable.b9,R.drawable.b10,R.drawable.b11,R.drawable.b12,R.drawable.b13,R.drawable.b14,R.drawable.b15,R.drawable.b16,R.drawable.b17,R.drawable.b18,R.drawable.b19,R.drawable.b20,R.drawable.b21,R.drawable.b22,R.drawable.b23,R.drawable.b24,R.drawable.b25,R.drawable.b26,R.drawable.b27,R.drawable.b28,R.drawable.b29,R.drawable.b30,R.drawable.b31,R.drawable.b32,R.drawable.b33,R.drawable.b34,R.drawable.b35,R.drawable.b36,R.drawable.b37,R.drawable.b38,R.drawable.b39,R.drawable.b40,R.drawable.b41,R.drawable.b42,R.drawable.b43,R.drawable.b44,R.drawable.b45,R.drawable.b46,R.drawable.b47,R.drawable.b48,R.drawable.b49,R.drawable.b50,R.drawable.b51,R.drawable.b52,R.drawable.b53,R.drawable.b54,R.drawable.b55,R.drawable.b56,R.drawable.b57,R.drawable.b58,R.drawable.b59,R.drawable.b60,R.drawable.b61,R.drawable.b62,R.drawable.b63,R.drawable.b64,R.drawable.b65,R.drawable.b66,R.drawable.b67,R.drawable.b68,R.drawable.b69,R.drawable.b70,R.drawable.b71,R.drawable.b72,R.drawable.b73,R.drawable.b74,R.drawable.b75,R.drawable.b76,R.drawable.b77,R.drawable.b78,R.drawable.b79,R.drawable.b80,R.drawable.b81,R.drawable.b82,R.drawable.b83,R.drawable.b84,R.drawable.b85,R.drawable.b86,R.drawable.b87,R.drawable.b88,R.drawable.b89,R.drawable.b90,R.drawable.b91,R.drawable.b92,R.drawable.b93,R.drawable.b94,R.drawable.b95,R.drawable.b96,R.drawable.b97,R.drawable.b98,R.drawable.b99,R.drawable.b100}; + private void updateBatteryData(String percentage, boolean charging){ + + int level = getLevel(); + int percentage_int = 0; + + try { + percentage_int = Integer.parseInt(percentage); + } catch (NumberFormatException e) { + e.printStackTrace(); + } + + if(percentage_int < 0){ + percentage_int = 0; + }else if(percentage_int > 100){ + percentage_int = 100; + } + boolean playSound = false; + int icon = icons[percentage_int]; + + String msg = ""; + if(charging){ + msg = "Charging - " + percentage + "%"; + }else{ + msg = "Discharging - " + percentage + "%"; + } + if(charging){ + sharedPrefMain.setInt("low_msg", 100); + int high_msg = sharedPrefMain.getInt("high_msg"); + if(percentage_int == 100 && percentage_int >= high_msg){ + playSound = true; + sharedPrefMain.setInt("high_msg", 200); + } + }else{ + sharedPrefMain.setInt("high_msg", 0); + int low_msg = sharedPrefMain.getInt("low_msg"); + if(percentage_int <= level && percentage_int <= low_msg){ + playSound = true; + sharedPrefMain.setInt("low_msg", percentage_int/2); + } + } + updateNotification(msg, icon, playSound); + + } + private int getLevel(){ + int level = 0; + switch (sharedPrefMain.getString("low")){ + case "10 %": + level = 10; + break; + case "20 %": + level = 20; + break; + case "30 %": + level = 30; + break; + case "40 %": + level = 40; + break; + case "50 %": + level = 50; + break; + case "60 %": + level = 60; + break; + default: + level = 30; + break; + } + return level; + } + private int getInterval(){ + int interval = 0; + switch (sharedPrefMain.getString("interval")){ + case "5 Sec": + interval = 5 * 1000; + break; + case "10 Sec": + interval = 10 * 1000; + break; + case "30 Sec": + interval = 30 * 1000; + break; + case "60 Sec": + interval = 60 * 1000; + break; + case "2 Min": + interval = 120 * 1000; + break; + case "3 Min": + interval = 180 * 1000; + break; + case "5 Min": + interval = 300 * 1000; + break; + case "10 Min": + interval = 600 * 1000; + break; + default: + interval = 60 * 1000; + break; + } + return interval; + } + private Notification getNotification(String msg, int small_icon, boolean playSound){ + sharedPrefMain.setString("msg", msg); + Intent intent = new Intent(this, MainActivity.class); + PendingIntent pendingIntent = PendingIntent.getActivity(this, 0 /* Request code */, intent, 0); + + String channelId = getString(R.string.app_name); + Bitmap largeIconBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.icon2); + NotificationCompat.Builder notificationBuilder = + new NotificationCompat.Builder(this, channelId) + .setSmallIcon(small_icon) + .setLargeIcon(largeIconBitmap) + .setContentTitle(msg) + .setColor(getResources().getColor(R.color.colorPrimary)) + .setContentIntent(pendingIntent).setOnlyAlertOnce(true); + if(sharedPrefMain.getBoolean("alerts") && playSound && ((System.currentTimeMillis() - sharedPrefMain.getLong("notif")) > (1000 * 60 * 5))){ + sharedPrefMain.setLong("notif", System.currentTimeMillis()); + showAlert(msg); + } + + + return notificationBuilder.build(); + } + private void updateNotification(String msg, int icon, boolean playSOund){ + if(!checkWifiOnAndConnected()){ + msg = "JioFi Not Connected"; + icon = R.drawable.icon; + playSOund = false; + } + Notification notification = getNotification(msg, icon, playSOund); + NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + NotificationChannel channel = new NotificationChannel(channelId, + "JioFI Battery Notifier", + NotificationManager.IMPORTANCE_HIGH); + if (mNotificationManager != null) { + mNotificationManager.createNotificationChannel(channel); + } + + } + mNotificationManager.notify(236, notification); + } + + private void showAlert(String msg){ + Intent intent = new Intent(this, MainActivity.class); + intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + intent.putExtra("dialog", true); + intent.putExtra("msg", msg); + startActivity(intent); + } + private String gateway; + + private void updateGateway() { + WifiManager wifiManager = (WifiManager) this.getSystemService(Context.WIFI_SERVICE); + int count = 0; + while (true) { + count ++; + if(count > 30){ + break; + } + int gateway_int = wifiManager.getDhcpInfo().gateway; + if (gateway_int == 0) { + try { + Thread.sleep(1000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } else { + gateway = String.format("%d.%d.%d.%d", (gateway_int & 0xff), (gateway_int >> 8 & 0xff), (gateway_int >> 16 & 0xff), (gateway_int >> 24 & 0xff)); + Log.d(TAG_FOREGROUND_SERVICE, "Gateway" + gateway); + sharedPrefMain.setString("gateway", gateway); + break; + } + } + } + + private void wifiChanged(Boolean connected) { + if (connected) { + updateNotification("Loading...", R.drawable.icon, false); + updateGateway(); + +// if(thread == null) { +// thread = new Thread(runnable); +// thread.start(); +// } + } + if(queue != null){ + sendRequest(); + } +// else { +// if (thread != null && thread.isAlive()) { +// updateNotification("JioFi Not Connected", R.drawable.icon, false); +// thread.interrupt(); +// thread = null; +// } +// } + } + + public class WifiReceiver extends BroadcastReceiver { + @Override + public void onReceive(Context context, Intent intent) { + + final String action = intent.getAction(); + if (action.equals(WifiManager.SUPPLICANT_CONNECTION_CHANGE_ACTION)) { + if (intent.getBooleanExtra(WifiManager.EXTRA_SUPPLICANT_CONNECTED, false)) { + wifiChanged(true); + } else { + wifiChanged(false); + } + } + + } + } +} \ No newline at end of file diff --git a/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 0000000..7aa2a95 --- /dev/null +++ b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/b0.png b/app/src/main/res/drawable/b0.png new file mode 100755 index 0000000..70b7bba Binary files /dev/null and b/app/src/main/res/drawable/b0.png differ diff --git a/app/src/main/res/drawable/b1.png b/app/src/main/res/drawable/b1.png new file mode 100755 index 0000000..345b705 Binary files /dev/null and b/app/src/main/res/drawable/b1.png differ diff --git a/app/src/main/res/drawable/b10.png b/app/src/main/res/drawable/b10.png new file mode 100755 index 0000000..899752d Binary files /dev/null and b/app/src/main/res/drawable/b10.png differ diff --git a/app/src/main/res/drawable/b100.png b/app/src/main/res/drawable/b100.png new file mode 100755 index 0000000..5d8b21e Binary files /dev/null and b/app/src/main/res/drawable/b100.png differ diff --git a/app/src/main/res/drawable/b11.png b/app/src/main/res/drawable/b11.png new file mode 100755 index 0000000..5de2d24 Binary files /dev/null and b/app/src/main/res/drawable/b11.png differ diff --git a/app/src/main/res/drawable/b12.png b/app/src/main/res/drawable/b12.png new file mode 100755 index 0000000..c114f06 Binary files /dev/null and b/app/src/main/res/drawable/b12.png differ diff --git a/app/src/main/res/drawable/b13.png b/app/src/main/res/drawable/b13.png new file mode 100755 index 0000000..9483ee8 Binary files /dev/null and b/app/src/main/res/drawable/b13.png differ diff --git a/app/src/main/res/drawable/b14.png b/app/src/main/res/drawable/b14.png new file mode 100755 index 0000000..0a34b7e Binary files /dev/null and b/app/src/main/res/drawable/b14.png differ diff --git a/app/src/main/res/drawable/b15.png b/app/src/main/res/drawable/b15.png new file mode 100755 index 0000000..f0b4c10 Binary files /dev/null and b/app/src/main/res/drawable/b15.png differ diff --git a/app/src/main/res/drawable/b16.png b/app/src/main/res/drawable/b16.png new file mode 100755 index 0000000..da57e9f Binary files /dev/null and b/app/src/main/res/drawable/b16.png differ diff --git a/app/src/main/res/drawable/b17.png b/app/src/main/res/drawable/b17.png new file mode 100755 index 0000000..99ed62a Binary files /dev/null and b/app/src/main/res/drawable/b17.png differ diff --git a/app/src/main/res/drawable/b18.png b/app/src/main/res/drawable/b18.png new file mode 100755 index 0000000..9de8f31 Binary files /dev/null and b/app/src/main/res/drawable/b18.png differ diff --git a/app/src/main/res/drawable/b19.png b/app/src/main/res/drawable/b19.png new file mode 100755 index 0000000..a5c93fe Binary files /dev/null and b/app/src/main/res/drawable/b19.png differ diff --git a/app/src/main/res/drawable/b2.png b/app/src/main/res/drawable/b2.png new file mode 100755 index 0000000..2f4dc9b Binary files /dev/null and b/app/src/main/res/drawable/b2.png differ diff --git a/app/src/main/res/drawable/b20.png b/app/src/main/res/drawable/b20.png new file mode 100755 index 0000000..de00f99 Binary files /dev/null and b/app/src/main/res/drawable/b20.png differ diff --git a/app/src/main/res/drawable/b21.png b/app/src/main/res/drawable/b21.png new file mode 100755 index 0000000..55c1143 Binary files /dev/null and b/app/src/main/res/drawable/b21.png differ diff --git a/app/src/main/res/drawable/b22.png b/app/src/main/res/drawable/b22.png new file mode 100755 index 0000000..959e2f4 Binary files /dev/null and b/app/src/main/res/drawable/b22.png differ diff --git a/app/src/main/res/drawable/b23.png b/app/src/main/res/drawable/b23.png new file mode 100755 index 0000000..49ff7d7 Binary files /dev/null and b/app/src/main/res/drawable/b23.png differ diff --git a/app/src/main/res/drawable/b24.png b/app/src/main/res/drawable/b24.png new file mode 100755 index 0000000..e32f9f0 Binary files /dev/null and b/app/src/main/res/drawable/b24.png differ diff --git a/app/src/main/res/drawable/b25.png b/app/src/main/res/drawable/b25.png new file mode 100755 index 0000000..71a9b47 Binary files /dev/null and b/app/src/main/res/drawable/b25.png differ diff --git a/app/src/main/res/drawable/b26.png b/app/src/main/res/drawable/b26.png new file mode 100755 index 0000000..41d2c47 Binary files /dev/null and b/app/src/main/res/drawable/b26.png differ diff --git a/app/src/main/res/drawable/b27.png b/app/src/main/res/drawable/b27.png new file mode 100755 index 0000000..6de4030 Binary files /dev/null and b/app/src/main/res/drawable/b27.png differ diff --git a/app/src/main/res/drawable/b28.png b/app/src/main/res/drawable/b28.png new file mode 100755 index 0000000..c19b8a6 Binary files /dev/null and b/app/src/main/res/drawable/b28.png differ diff --git a/app/src/main/res/drawable/b29.png b/app/src/main/res/drawable/b29.png new file mode 100755 index 0000000..ae7091d Binary files /dev/null and b/app/src/main/res/drawable/b29.png differ diff --git a/app/src/main/res/drawable/b3.png b/app/src/main/res/drawable/b3.png new file mode 100755 index 0000000..4fbf3b0 Binary files /dev/null and b/app/src/main/res/drawable/b3.png differ diff --git a/app/src/main/res/drawable/b30.png b/app/src/main/res/drawable/b30.png new file mode 100755 index 0000000..ed08d7c Binary files /dev/null and b/app/src/main/res/drawable/b30.png differ diff --git a/app/src/main/res/drawable/b31.png b/app/src/main/res/drawable/b31.png new file mode 100755 index 0000000..be3a7bd Binary files /dev/null and b/app/src/main/res/drawable/b31.png differ diff --git a/app/src/main/res/drawable/b32.png b/app/src/main/res/drawable/b32.png new file mode 100755 index 0000000..fcf9950 Binary files /dev/null and b/app/src/main/res/drawable/b32.png differ diff --git a/app/src/main/res/drawable/b33.png b/app/src/main/res/drawable/b33.png new file mode 100755 index 0000000..a08f813 Binary files /dev/null and b/app/src/main/res/drawable/b33.png differ diff --git a/app/src/main/res/drawable/b34.png b/app/src/main/res/drawable/b34.png new file mode 100755 index 0000000..fcc23be Binary files /dev/null and b/app/src/main/res/drawable/b34.png differ diff --git a/app/src/main/res/drawable/b35.png b/app/src/main/res/drawable/b35.png new file mode 100755 index 0000000..5b1cb6d Binary files /dev/null and b/app/src/main/res/drawable/b35.png differ diff --git a/app/src/main/res/drawable/b36.png b/app/src/main/res/drawable/b36.png new file mode 100755 index 0000000..5743712 Binary files /dev/null and b/app/src/main/res/drawable/b36.png differ diff --git a/app/src/main/res/drawable/b37.png b/app/src/main/res/drawable/b37.png new file mode 100755 index 0000000..5e66dc3 Binary files /dev/null and b/app/src/main/res/drawable/b37.png differ diff --git a/app/src/main/res/drawable/b38.png b/app/src/main/res/drawable/b38.png new file mode 100755 index 0000000..4eab6dc Binary files /dev/null and b/app/src/main/res/drawable/b38.png differ diff --git a/app/src/main/res/drawable/b39.png b/app/src/main/res/drawable/b39.png new file mode 100755 index 0000000..33b1a4d Binary files /dev/null and b/app/src/main/res/drawable/b39.png differ diff --git a/app/src/main/res/drawable/b4.png b/app/src/main/res/drawable/b4.png new file mode 100755 index 0000000..4ce71a4 Binary files /dev/null and b/app/src/main/res/drawable/b4.png differ diff --git a/app/src/main/res/drawable/b40.png b/app/src/main/res/drawable/b40.png new file mode 100755 index 0000000..31472b3 Binary files /dev/null and b/app/src/main/res/drawable/b40.png differ diff --git a/app/src/main/res/drawable/b41.png b/app/src/main/res/drawable/b41.png new file mode 100755 index 0000000..80efc89 Binary files /dev/null and b/app/src/main/res/drawable/b41.png differ diff --git a/app/src/main/res/drawable/b42.png b/app/src/main/res/drawable/b42.png new file mode 100755 index 0000000..9849649 Binary files /dev/null and b/app/src/main/res/drawable/b42.png differ diff --git a/app/src/main/res/drawable/b43.png b/app/src/main/res/drawable/b43.png new file mode 100755 index 0000000..94f70e8 Binary files /dev/null and b/app/src/main/res/drawable/b43.png differ diff --git a/app/src/main/res/drawable/b44.png b/app/src/main/res/drawable/b44.png new file mode 100755 index 0000000..e71bce3 Binary files /dev/null and b/app/src/main/res/drawable/b44.png differ diff --git a/app/src/main/res/drawable/b45.png b/app/src/main/res/drawable/b45.png new file mode 100755 index 0000000..53f9af5 Binary files /dev/null and b/app/src/main/res/drawable/b45.png differ diff --git a/app/src/main/res/drawable/b46.png b/app/src/main/res/drawable/b46.png new file mode 100755 index 0000000..0c965ea Binary files /dev/null and b/app/src/main/res/drawable/b46.png differ diff --git a/app/src/main/res/drawable/b47.png b/app/src/main/res/drawable/b47.png new file mode 100755 index 0000000..9ae4ec2 Binary files /dev/null and b/app/src/main/res/drawable/b47.png differ diff --git a/app/src/main/res/drawable/b48.png b/app/src/main/res/drawable/b48.png new file mode 100755 index 0000000..6a5848b Binary files /dev/null and b/app/src/main/res/drawable/b48.png differ diff --git a/app/src/main/res/drawable/b49.png b/app/src/main/res/drawable/b49.png new file mode 100755 index 0000000..0d86083 Binary files /dev/null and b/app/src/main/res/drawable/b49.png differ diff --git a/app/src/main/res/drawable/b5.png b/app/src/main/res/drawable/b5.png new file mode 100755 index 0000000..60ffbaa Binary files /dev/null and b/app/src/main/res/drawable/b5.png differ diff --git a/app/src/main/res/drawable/b50.png b/app/src/main/res/drawable/b50.png new file mode 100755 index 0000000..0d569f2 Binary files /dev/null and b/app/src/main/res/drawable/b50.png differ diff --git a/app/src/main/res/drawable/b51.png b/app/src/main/res/drawable/b51.png new file mode 100755 index 0000000..07219ee Binary files /dev/null and b/app/src/main/res/drawable/b51.png differ diff --git a/app/src/main/res/drawable/b52.png b/app/src/main/res/drawable/b52.png new file mode 100755 index 0000000..d37479f Binary files /dev/null and b/app/src/main/res/drawable/b52.png differ diff --git a/app/src/main/res/drawable/b53.png b/app/src/main/res/drawable/b53.png new file mode 100755 index 0000000..61cdeec Binary files /dev/null and b/app/src/main/res/drawable/b53.png differ diff --git a/app/src/main/res/drawable/b54.png b/app/src/main/res/drawable/b54.png new file mode 100755 index 0000000..9314ade Binary files /dev/null and b/app/src/main/res/drawable/b54.png differ diff --git a/app/src/main/res/drawable/b55.png b/app/src/main/res/drawable/b55.png new file mode 100755 index 0000000..bb0c815 Binary files /dev/null and b/app/src/main/res/drawable/b55.png differ diff --git a/app/src/main/res/drawable/b56.png b/app/src/main/res/drawable/b56.png new file mode 100755 index 0000000..93c1f33 Binary files /dev/null and b/app/src/main/res/drawable/b56.png differ diff --git a/app/src/main/res/drawable/b57.png b/app/src/main/res/drawable/b57.png new file mode 100755 index 0000000..45b25bb Binary files /dev/null and b/app/src/main/res/drawable/b57.png differ diff --git a/app/src/main/res/drawable/b58.png b/app/src/main/res/drawable/b58.png new file mode 100755 index 0000000..62cafec Binary files /dev/null and b/app/src/main/res/drawable/b58.png differ diff --git a/app/src/main/res/drawable/b59.png b/app/src/main/res/drawable/b59.png new file mode 100755 index 0000000..2dfce64 Binary files /dev/null and b/app/src/main/res/drawable/b59.png differ diff --git a/app/src/main/res/drawable/b6.png b/app/src/main/res/drawable/b6.png new file mode 100755 index 0000000..c673a1a Binary files /dev/null and b/app/src/main/res/drawable/b6.png differ diff --git a/app/src/main/res/drawable/b60.png b/app/src/main/res/drawable/b60.png new file mode 100755 index 0000000..a99805e Binary files /dev/null and b/app/src/main/res/drawable/b60.png differ diff --git a/app/src/main/res/drawable/b61.png b/app/src/main/res/drawable/b61.png new file mode 100755 index 0000000..d69c487 Binary files /dev/null and b/app/src/main/res/drawable/b61.png differ diff --git a/app/src/main/res/drawable/b62.png b/app/src/main/res/drawable/b62.png new file mode 100755 index 0000000..a2a83ac Binary files /dev/null and b/app/src/main/res/drawable/b62.png differ diff --git a/app/src/main/res/drawable/b63.png b/app/src/main/res/drawable/b63.png new file mode 100755 index 0000000..917c3a9 Binary files /dev/null and b/app/src/main/res/drawable/b63.png differ diff --git a/app/src/main/res/drawable/b64.png b/app/src/main/res/drawable/b64.png new file mode 100755 index 0000000..6b269be Binary files /dev/null and b/app/src/main/res/drawable/b64.png differ diff --git a/app/src/main/res/drawable/b65.png b/app/src/main/res/drawable/b65.png new file mode 100755 index 0000000..96f1104 Binary files /dev/null and b/app/src/main/res/drawable/b65.png differ diff --git a/app/src/main/res/drawable/b66.png b/app/src/main/res/drawable/b66.png new file mode 100755 index 0000000..25229fc Binary files /dev/null and b/app/src/main/res/drawable/b66.png differ diff --git a/app/src/main/res/drawable/b67.png b/app/src/main/res/drawable/b67.png new file mode 100755 index 0000000..c8ccf38 Binary files /dev/null and b/app/src/main/res/drawable/b67.png differ diff --git a/app/src/main/res/drawable/b68.png b/app/src/main/res/drawable/b68.png new file mode 100755 index 0000000..a327804 Binary files /dev/null and b/app/src/main/res/drawable/b68.png differ diff --git a/app/src/main/res/drawable/b69.png b/app/src/main/res/drawable/b69.png new file mode 100755 index 0000000..e95df81 Binary files /dev/null and b/app/src/main/res/drawable/b69.png differ diff --git a/app/src/main/res/drawable/b7.png b/app/src/main/res/drawable/b7.png new file mode 100755 index 0000000..991d46d Binary files /dev/null and b/app/src/main/res/drawable/b7.png differ diff --git a/app/src/main/res/drawable/b70.png b/app/src/main/res/drawable/b70.png new file mode 100755 index 0000000..f71d0b4 Binary files /dev/null and b/app/src/main/res/drawable/b70.png differ diff --git a/app/src/main/res/drawable/b71.png b/app/src/main/res/drawable/b71.png new file mode 100755 index 0000000..fb888e4 Binary files /dev/null and b/app/src/main/res/drawable/b71.png differ diff --git a/app/src/main/res/drawable/b72.png b/app/src/main/res/drawable/b72.png new file mode 100755 index 0000000..4252508 Binary files /dev/null and b/app/src/main/res/drawable/b72.png differ diff --git a/app/src/main/res/drawable/b73.png b/app/src/main/res/drawable/b73.png new file mode 100755 index 0000000..e5501e5 Binary files /dev/null and b/app/src/main/res/drawable/b73.png differ diff --git a/app/src/main/res/drawable/b74.png b/app/src/main/res/drawable/b74.png new file mode 100755 index 0000000..455c28f Binary files /dev/null and b/app/src/main/res/drawable/b74.png differ diff --git a/app/src/main/res/drawable/b75.png b/app/src/main/res/drawable/b75.png new file mode 100755 index 0000000..bfe7a3b Binary files /dev/null and b/app/src/main/res/drawable/b75.png differ diff --git a/app/src/main/res/drawable/b76.png b/app/src/main/res/drawable/b76.png new file mode 100755 index 0000000..04b4f42 Binary files /dev/null and b/app/src/main/res/drawable/b76.png differ diff --git a/app/src/main/res/drawable/b77.png b/app/src/main/res/drawable/b77.png new file mode 100755 index 0000000..e2fc2ca Binary files /dev/null and b/app/src/main/res/drawable/b77.png differ diff --git a/app/src/main/res/drawable/b78.png b/app/src/main/res/drawable/b78.png new file mode 100755 index 0000000..01a8263 Binary files /dev/null and b/app/src/main/res/drawable/b78.png differ diff --git a/app/src/main/res/drawable/b79.png b/app/src/main/res/drawable/b79.png new file mode 100755 index 0000000..04adacf Binary files /dev/null and b/app/src/main/res/drawable/b79.png differ diff --git a/app/src/main/res/drawable/b8.png b/app/src/main/res/drawable/b8.png new file mode 100755 index 0000000..5b6fdeb Binary files /dev/null and b/app/src/main/res/drawable/b8.png differ diff --git a/app/src/main/res/drawable/b80.png b/app/src/main/res/drawable/b80.png new file mode 100755 index 0000000..15035e5 Binary files /dev/null and b/app/src/main/res/drawable/b80.png differ diff --git a/app/src/main/res/drawable/b81.png b/app/src/main/res/drawable/b81.png new file mode 100755 index 0000000..4ff58d8 Binary files /dev/null and b/app/src/main/res/drawable/b81.png differ diff --git a/app/src/main/res/drawable/b82.png b/app/src/main/res/drawable/b82.png new file mode 100755 index 0000000..299c342 Binary files /dev/null and b/app/src/main/res/drawable/b82.png differ diff --git a/app/src/main/res/drawable/b83.png b/app/src/main/res/drawable/b83.png new file mode 100755 index 0000000..07b20fa Binary files /dev/null and b/app/src/main/res/drawable/b83.png differ diff --git a/app/src/main/res/drawable/b84.png b/app/src/main/res/drawable/b84.png new file mode 100755 index 0000000..92cd0e9 Binary files /dev/null and b/app/src/main/res/drawable/b84.png differ diff --git a/app/src/main/res/drawable/b85.png b/app/src/main/res/drawable/b85.png new file mode 100755 index 0000000..6992d85 Binary files /dev/null and b/app/src/main/res/drawable/b85.png differ diff --git a/app/src/main/res/drawable/b86.png b/app/src/main/res/drawable/b86.png new file mode 100755 index 0000000..7793f4d Binary files /dev/null and b/app/src/main/res/drawable/b86.png differ diff --git a/app/src/main/res/drawable/b87.png b/app/src/main/res/drawable/b87.png new file mode 100755 index 0000000..37dbff2 Binary files /dev/null and b/app/src/main/res/drawable/b87.png differ diff --git a/app/src/main/res/drawable/b88.png b/app/src/main/res/drawable/b88.png new file mode 100755 index 0000000..158b9f1 Binary files /dev/null and b/app/src/main/res/drawable/b88.png differ diff --git a/app/src/main/res/drawable/b89.png b/app/src/main/res/drawable/b89.png new file mode 100755 index 0000000..698d1ed Binary files /dev/null and b/app/src/main/res/drawable/b89.png differ diff --git a/app/src/main/res/drawable/b9.png b/app/src/main/res/drawable/b9.png new file mode 100755 index 0000000..1919bae Binary files /dev/null and b/app/src/main/res/drawable/b9.png differ diff --git a/app/src/main/res/drawable/b90.png b/app/src/main/res/drawable/b90.png new file mode 100755 index 0000000..0db321e Binary files /dev/null and b/app/src/main/res/drawable/b90.png differ diff --git a/app/src/main/res/drawable/b91.png b/app/src/main/res/drawable/b91.png new file mode 100755 index 0000000..e94ab98 Binary files /dev/null and b/app/src/main/res/drawable/b91.png differ diff --git a/app/src/main/res/drawable/b92.png b/app/src/main/res/drawable/b92.png new file mode 100755 index 0000000..66eceb9 Binary files /dev/null and b/app/src/main/res/drawable/b92.png differ diff --git a/app/src/main/res/drawable/b93.png b/app/src/main/res/drawable/b93.png new file mode 100755 index 0000000..97777e6 Binary files /dev/null and b/app/src/main/res/drawable/b93.png differ diff --git a/app/src/main/res/drawable/b94.png b/app/src/main/res/drawable/b94.png new file mode 100755 index 0000000..03ea698 Binary files /dev/null and b/app/src/main/res/drawable/b94.png differ diff --git a/app/src/main/res/drawable/b95.png b/app/src/main/res/drawable/b95.png new file mode 100755 index 0000000..1e194bb Binary files /dev/null and b/app/src/main/res/drawable/b95.png differ diff --git a/app/src/main/res/drawable/b96.png b/app/src/main/res/drawable/b96.png new file mode 100755 index 0000000..1bb4169 Binary files /dev/null and b/app/src/main/res/drawable/b96.png differ diff --git a/app/src/main/res/drawable/b97.png b/app/src/main/res/drawable/b97.png new file mode 100755 index 0000000..20bde89 Binary files /dev/null and b/app/src/main/res/drawable/b97.png differ diff --git a/app/src/main/res/drawable/b98.png b/app/src/main/res/drawable/b98.png new file mode 100755 index 0000000..67ecdc7 Binary files /dev/null and b/app/src/main/res/drawable/b98.png differ diff --git a/app/src/main/res/drawable/b99.png b/app/src/main/res/drawable/b99.png new file mode 100755 index 0000000..399e05a Binary files /dev/null and b/app/src/main/res/drawable/b99.png differ diff --git a/app/src/main/res/drawable/button_boundary.xml b/app/src/main/res/drawable/button_boundary.xml new file mode 100755 index 0000000..07ed283 --- /dev/null +++ b/app/src/main/res/drawable/button_boundary.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/dotted1.xml b/app/src/main/res/drawable/dotted1.xml new file mode 100644 index 0000000..1ab5a70 --- /dev/null +++ b/app/src/main/res/drawable/dotted1.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/dotted2.xml b/app/src/main/res/drawable/dotted2.xml new file mode 100644 index 0000000..50b1b27 --- /dev/null +++ b/app/src/main/res/drawable/dotted2.xml @@ -0,0 +1,8 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..07d5da9 --- /dev/null +++ b/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/icon.png b/app/src/main/res/drawable/icon.png new file mode 100644 index 0000000..9f45b89 Binary files /dev/null and b/app/src/main/res/drawable/icon.png differ diff --git a/app/src/main/res/drawable/icon2.png b/app/src/main/res/drawable/icon2.png new file mode 100755 index 0000000..4618e75 Binary files /dev/null and b/app/src/main/res/drawable/icon2.png differ diff --git a/app/src/main/res/drawable/rectangle_animation.xml b/app/src/main/res/drawable/rectangle_animation.xml new file mode 100644 index 0000000..b5177f3 --- /dev/null +++ b/app/src/main/res/drawable/rectangle_animation.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/font/janda_manatee_bubble.ttf b/app/src/main/res/font/janda_manatee_bubble.ttf new file mode 100644 index 0000000..fd60341 Binary files /dev/null and b/app/src/main/res/font/janda_manatee_bubble.ttf differ diff --git a/app/src/main/res/font/janda_manatee_solid.ttf b/app/src/main/res/font/janda_manatee_solid.ttf new file mode 100644 index 0000000..b4ae06a Binary files /dev/null and b/app/src/main/res/font/janda_manatee_solid.ttf differ diff --git a/app/src/main/res/font/lemon_juice.otf b/app/src/main/res/font/lemon_juice.otf new file mode 100644 index 0000000..112608b Binary files /dev/null and b/app/src/main/res/font/lemon_juice.otf differ diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..68f54eb --- /dev/null +++ b/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,228 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +