From 4971b9bf90baa551eb1b6eb9f084414ee0678de9 Mon Sep 17 00:00:00 2001 From: esalessandrxx Date: Sat, 20 Jan 2024 10:12:23 -0500 Subject: [PATCH] bug floating window --- app/build.gradle.kts | 4 +- app/src/main/AndroidManifest.xml | 13 +- .../arr/simple/adapter/BalancesAdapter.java | 43 +- .../java/com/arr/simple/model/Balances.java | 9 +- .../services/TrafficFloatingWindow.java | 118 +++- .../simple/ui/balances/BalanceFragment.java | 83 +-- .../arr/simple/ui/servicios/SmsFragment.java | 22 +- .../simple/ui/settings/AboutPreference.java | 3 +- app/src/main/res/drawable/bg_circle_close.xml | 7 + .../main/res/drawable/ic_signal_mobile.xml | 11 + app/src/main/res/drawable/ic_signal_none.xml | 11 + app/src/main/res/drawable/ic_signal_wifi.xml | 11 + app/src/main/res/layout/fragment_balance.xml | 644 +++++++++--------- .../res/layout/layout_floating_window.xml | 37 +- .../res/layout/layout_view_delete_service.xml | 18 + .../layout_view_items_bonos_balance.xml | 31 + app/src/main/res/values/strings.xml | 4 +- app/src/main/res/xml/preferences_about.xml | 4 +- build.gradle.kts | 4 +- gradle/wrapper/gradle-wrapper.properties | 2 +- simple-services/build.gradle.kts | 3 +- .../java/com/arr/services/UssdResponse.java | 98 ++- 22 files changed, 698 insertions(+), 482 deletions(-) create mode 100644 app/src/main/res/drawable/bg_circle_close.xml create mode 100644 app/src/main/res/drawable/ic_signal_mobile.xml create mode 100644 app/src/main/res/drawable/ic_signal_none.xml create mode 100644 app/src/main/res/drawable/ic_signal_wifi.xml create mode 100644 app/src/main/res/layout/layout_view_delete_service.xml create mode 100644 app/src/main/res/layout/layout_view_items_bonos_balance.xml diff --git a/app/build.gradle.kts b/app/build.gradle.kts index bf2dc03..eae659c 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -12,8 +12,8 @@ android { applicationId = "com.arr.simple" minSdk = 23 targetSdk = 34 - versionCode = 47 - versionName = "4.0.7-beta" + versionCode = 50 + versionName = "5.0-beta" vectorDrawables { useSupportLibrary = true diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 25aaab6..8dcccb0 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -20,8 +20,14 @@ + + + @@ -33,7 +39,6 @@ - - + android:name=".services.TrafficFloatingWindow" + android:foregroundServiceType="connectedDevice" /> + diff --git a/app/src/main/java/com/arr/simple/adapter/BalancesAdapter.java b/app/src/main/java/com/arr/simple/adapter/BalancesAdapter.java index a17a71a..b219a70 100644 --- a/app/src/main/java/com/arr/simple/adapter/BalancesAdapter.java +++ b/app/src/main/java/com/arr/simple/adapter/BalancesAdapter.java @@ -2,15 +2,14 @@ import android.content.Context; import android.view.LayoutInflater; -import android.view.View; import android.view.ViewGroup; -import androidx.annotation.NonNull; -import androidx.viewpager.widget.PagerAdapter; +import androidx.recyclerview.widget.RecyclerView; +import androidx.recyclerview.widget.RecyclerView.ViewHolder; +import com.arr.simple.databinding.LayoutViewItemsBonosBalanceBinding; import com.arr.simple.model.Balances; import java.util.List; -import com.arr.simple.R; -public class BalancesAdapter extends PagerAdapter { +public class BalancesAdapter extends RecyclerView.Adapter { private Context mContext; private List list; @@ -21,25 +20,37 @@ public BalancesAdapter(Context context, List list) { } @Override - public int getCount() { + public int getItemCount() { return list.size(); } @Override - public boolean isViewFromObject(@NonNull View view, @NonNull Object arg1) { - return view == arg1; + public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { + if (holder instanceof Bonos) { + Balances model = list.get(position); + Bonos view = (Bonos) holder; + + view.binding.icon.setImageResource(model.getIcon()); + view.binding.typeBono.setText(model.getTitle()); + view.binding.expire.setText(model.getVence()); + } } - @NonNull @Override - public Object instantiateItem(@NonNull ViewGroup container, int position) { - LayoutInflater inflater = LayoutInflater.from(mContext); - View view = inflater.inflate(R.layout.slider_item_bonos, container, false); - return view; + public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { + LayoutViewItemsBonosBalanceBinding view = + LayoutViewItemsBonosBalanceBinding.inflate( + LayoutInflater.from(parent.getContext()), parent, false); + return new Bonos(view); } - @Override - public void notifyDataSetChanged() { - super.notifyDataSetChanged(); + class Bonos extends RecyclerView.ViewHolder { + + private LayoutViewItemsBonosBalanceBinding binding; + + public Bonos(LayoutViewItemsBonosBalanceBinding binding) { + super(binding.getRoot()); + this.binding = binding; + } } } diff --git a/app/src/main/java/com/arr/simple/model/Balances.java b/app/src/main/java/com/arr/simple/model/Balances.java index ca5a3c0..3fad66e 100644 --- a/app/src/main/java/com/arr/simple/model/Balances.java +++ b/app/src/main/java/com/arr/simple/model/Balances.java @@ -2,12 +2,11 @@ public class Balances { - private String title, balance, vencimiento; + private String title, vencimiento; private int icon; - public Balances(String title, String balance, String vencimiento, int icon) { + public Balances(String title, String vencimiento, int icon) { this.title = title; - this.balance = balance; this.vencimiento = vencimiento; this.icon = icon; } @@ -16,10 +15,6 @@ public String getTitle() { return title; } - public String getBalance() { - return balance; - } - public String getVence() { return vencimiento; } diff --git a/app/src/main/java/com/arr/simple/services/TrafficFloatingWindow.java b/app/src/main/java/com/arr/simple/services/TrafficFloatingWindow.java index 52bd30b..cdee610 100644 --- a/app/src/main/java/com/arr/simple/services/TrafficFloatingWindow.java +++ b/app/src/main/java/com/arr/simple/services/TrafficFloatingWindow.java @@ -8,6 +8,8 @@ import android.content.Intent; import android.content.IntentFilter; import android.content.SharedPreferences; +import android.content.pm.ServiceInfo; +import android.graphics.Color; import android.graphics.PixelFormat; import android.graphics.drawable.GradientDrawable; import android.net.ConnectivityManager; @@ -19,17 +21,20 @@ import android.os.IBinder; import android.os.Looper; import android.provider.Settings; +import android.util.Log; import android.view.Gravity; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; import android.view.WindowManager; +import android.widget.LinearLayout; import androidx.core.app.NotificationCompat; import androidx.preference.PreferenceManager; import com.arr.simple.R; import com.arr.simple.databinding.LayoutFloatingWindowBinding; +import com.arr.simple.databinding.LayoutViewDeleteServiceBinding; public class TrafficFloatingWindow extends Service { @@ -39,7 +44,10 @@ public class TrafficFloatingWindow extends Service { private static final String CHANNEL = "traffic"; private LayoutFloatingWindowBinding binding; private BroadcastReceiver broadcastNetwork; - + + private LayoutViewDeleteServiceBinding delete; + private WindowManager.LayoutParams lParamsDelete; + @Override public IBinder onBind(Intent intent) { return null; @@ -68,9 +76,8 @@ public void run() { handler.postDelayed(runnable, 1000); } - - - public String calculateSpeed(long timeTaken, long downBytes, long upBytes) { + + public String calculateSpeed(long timeTaken, long downBytes, long upBytes) { long downSpeed = 0; long upSpeed = 0; @@ -114,10 +121,10 @@ public void onCreate() { lastRxBytes = TrafficStats.getTotalRxBytes(); lastTxBytes = TrafficStats.getTotalTxBytes(); lastTime = System.currentTimeMillis(); - windowManager = (WindowManager) getSystemService(WINDOW_SERVICE); binding = LayoutFloatingWindowBinding.inflate(LayoutInflater.from(this)); + delete = LayoutViewDeleteServiceBinding.inflate(LayoutInflater.from(this)); SharedPreferences spColor = PreferenceManager.getDefaultSharedPreferences(this); String selectColor = spColor.getString("floating_color", "colorPrimary"); @@ -126,7 +133,7 @@ public void onCreate() { .getColor( getResources() .getIdentifier(selectColor, "color", getPackageName())); - GradientDrawable drawable = (GradientDrawable) binding.floating.getBackground(); + GradientDrawable drawable = (GradientDrawable) binding.back.getBackground(); drawable.setColor(color); // @@ -137,6 +144,13 @@ public void onCreate() { WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED, PixelFormat.TRANSLUCENT); + + lParamsDelete = + new WindowManager.LayoutParams( + WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY, + WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE + | WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED, + PixelFormat.TRANSLUCENT); } else { layoutParams = new WindowManager.LayoutParams( @@ -144,6 +158,13 @@ public void onCreate() { WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED, PixelFormat.TRANSLUCENT); + + lParamsDelete = + new WindowManager.LayoutParams( + WindowManager.LayoutParams.TYPE_PHONE, + WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE + | WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED, + PixelFormat.TRANSLUCENT); } layoutParams.gravity = Gravity.TOP | Gravity.LEFT; layoutParams.x = 0; @@ -153,9 +174,18 @@ public void onCreate() { layoutParams.width = WindowManager.LayoutParams.WRAP_CONTENT; layoutParams.height = WindowManager.LayoutParams.WRAP_CONTENT; - + lParamsDelete.gravity = Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL; + lParamsDelete.width = WindowManager.LayoutParams.WRAP_CONTENT; + lParamsDelete.height = WindowManager.LayoutParams.WRAP_CONTENT; + // touch floating - binding.floating.setOnTouchListener( + binding.textSpeed.setOnLongClickListener( + view -> { + stopSelf(); + return true; + }); + + binding.back.setOnTouchListener( new View.OnTouchListener() { int x = 0; int y = 0; @@ -183,7 +213,8 @@ public boolean onTouch(View view, MotionEvent event) { }); // view windowManager.addView(binding.getRoot(), layoutParams); - + // windowManager.addView(delete.getRoot(), lParamsDelete); + ConnectivityManager connectivityManager = (ConnectivityManager) this.getSystemService(CONNECTIVITY_SERVICE); if (connectivityManager != null) { @@ -192,15 +223,15 @@ public boolean onTouch(View view, MotionEvent event) { connectivityManager.getActiveNetwork()); if (network != null) { if (network.hasTransport(NetworkCapabilities.TRANSPORT_CELLULAR)) { - binding.connection.setImageResource(R.drawable.ic_data_lte_20px); + binding.connection.setImageResource(R.drawable.ic_signal_mobile); } else if (network.hasTransport(NetworkCapabilities.TRANSPORT_WIFI)) { - binding.connection.setImageResource(R.drawable.ic_nauta_fill_24px); + binding.connection.setImageResource(R.drawable.ic_signal_wifi); } else { - binding.connection.setImageResource(R.drawable.ic_calendar_20px); + binding.connection.setImageResource(R.drawable.ic_signal_none); } } } - + // crear notofocacion if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { NotificationChannel channel = @@ -217,8 +248,12 @@ public boolean onTouch(View view, MotionEvent event) { getString(R.string.app_name) + " se está ejecutando en segundo plano") .setSmallIcon(R.drawable.ic_logo_simple); - int NOTIFICATION_ID = 1; - startForeground(NOTIFICATION_ID, builder.build()); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { + startForeground( + 1, builder.build(), ServiceInfo.FOREGROUND_SERVICE_TYPE_CONNECTED_DEVICE); + } else { + startForeground(1, builder.build()); + } handler.post(runnable); } @@ -229,27 +264,44 @@ public void onDestroy() { windowManager.removeView(binding.getRoot()); } } - private boolean connected(){ - ConnectivityManager manager = (ConnectivityManager) this.getSystemService(Context.CONNECTIVITY_SERVICE); - NetworkInfo info = manager.getActiveNetworkInfo(); - if(info != null && info.isConnected()){ - return true; - }else{ - return false; - } - } - - private void startFloating(){ - if(permissions()){ - + + private boolean connected() { + ConnectivityManager manager = + (ConnectivityManager) this.getSystemService(Context.CONNECTIVITY_SERVICE); + NetworkInfo info = manager.getActiveNetworkInfo(); + if (info != null && info.isConnected()) { + return true; + } else { + return false; } } - - private boolean permissions(){ - if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M){ - return Settings.canDrawOverlays(this); - + + private void startFloating() { + if (permissions()) {} + } + + private boolean permissions() { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { + return Settings.canDrawOverlays(this); } return true; } + + private boolean estaEncimaDelCesto(int x, int y) { + // Calcula la posición del cesto en la pantalla (ajusta según tus necesidades) + int[] cestoLocation = new int[2]; + delete.getRoot().getLocationOnScreen(cestoLocation); + int cestoX = cestoLocation[0]; + int cestoY = cestoLocation[1]; + + // Comprueba si las coordenadas están dentro del área del cesto + if (x >= cestoX + && x <= cestoX + delete.getRoot().getWidth() + && y >= cestoY + && y <= cestoY + delete.getRoot().getHeight()) { + return true; + } + + return false; + } } diff --git a/app/src/main/java/com/arr/simple/ui/balances/BalanceFragment.java b/app/src/main/java/com/arr/simple/ui/balances/BalanceFragment.java index bfe738c..bc30947 100644 --- a/app/src/main/java/com/arr/simple/ui/balances/BalanceFragment.java +++ b/app/src/main/java/com/arr/simple/ui/balances/BalanceFragment.java @@ -56,7 +56,8 @@ public View onCreateView(LayoutInflater inflater, ViewGroup parent, Bundle arg2) response2 = new UssdResponse(utils); // mostrar contenido - // viewContectBalances(); + viewContectBalances(); + binding.updateTime.setText(sp.getString("update", "sin actualizar")); // sincronizar balances @@ -67,6 +68,10 @@ public View onCreateView(LayoutInflater inflater, ViewGroup parent, Bundle arg2) showToast("Actualizando balances, espere..."); }); + return binding.getRoot(); + } + + private void viewContectBalances() { // balances datos response2.balancesDatos( binding.textTarifa, @@ -91,81 +96,23 @@ public View onCreateView(LayoutInflater inflater, ViewGroup parent, Bundle arg2) binding.venceMinSms); // bonos en promoción - response2.balanceBonos(binding.bonoIlimitado, binding.bonoSaldoo, binding.bonoDatos); - - return binding.getRoot(); - } - - private void viewContectBalances() { - // bonos - if ((response.ilimitado() != null && !response.ilimitado().isBlank()) - || (response.bonosDatos() != null && !response.bonosDatos().isBlank()) - || (response.bonosSaldo() != null && !response.bonosSaldo().isBlank())) { - binding.cardBonos.setVisibility(View.VISIBLE); - } - - if (!response.ilimitado().isEmpty()) { - binding.ilimitados.setVisibility(View.VISIBLE); - binding.ilimitados.setText(response.ilimitado()); - } - if (!response.bonosDatos().isEmpty()) { - binding.bonosDatos.setVisibility(View.VISIBLE); - binding.bonosDatos.setText(response.bonosDatos()); - } - if (!response.bonosSaldo().isEmpty() && response.bonosSaldo() != null) { - binding.bonoSaldo.setVisibility(View.VISIBLE); - binding.bonoSaldo.setText(response.bonosSaldo()); - } - - // balances datos - binding.textTarifa.setText(response.tarifa()); - binding.textDatos.setText(response.allData()); - - Log.w("ALLLL ", response.allData()); - - binding.textDatosLte.setText(response.dataLte()); - binding.textDatosCu.setText(response.nacionales()); - binding.textVenceDatos.setText(response.venceAllData().replace(" dias", " días")); - - // update progress bar - if (response.venceAllData() != null) { - Matcher matcher = - Pattern.compile("\\d+").matcher(response.venceAllData().replace(" dias", "")); - while (matcher.find()) { - String strDays = matcher.group(); - if (strDays != null) { - int days = Integer.parseInt(strDays); - progress(days); - } - } - } else { - progress(0); - } - - // bolsa diaria - binding.textDiaria.setText(response.diaria()); - binding.textVenceDiaria.setText(response.venceDiaria()); - - // bolsa de mensajeria - binding.textMensajeria.setText(response.mensajeria()); - binding.textVenceMensajeria.setText(response.venceMensajeria()); - - // saldo movil - binding.saldo.setText(response.saldoMovil()); - binding.textVenceSaldo.setText("Expira: " + response.venceSaldo()); - binding.min.setText(response.minutos()); - binding.sms.setText(response.mensajes()); - binding.venceMinSms.setText(response.venceMensajes().replace(" dias", " días")); + response2.balanceBonos( + binding.cardBonosPromo, + binding.bonoIlimitado, + binding.bonoSaldoo, + binding.bonoDatos, + binding.bonoDatosLte, + binding.bonoVoz, + binding.bonoSms); } // execute code ussd private void executeUssdRequest(Handler handler, int index) { if (index >= ussdCodes.length) { if (isVisible()) { - + viewContectBalances(); binding.swipeRefresh.setRefreshing(false); showToast("Balances actualizados"); - viewContectBalances(); updateTime(); } return; diff --git a/app/src/main/java/com/arr/simple/ui/servicios/SmsFragment.java b/app/src/main/java/com/arr/simple/ui/servicios/SmsFragment.java index 3bf339e..b3a4d55 100644 --- a/app/src/main/java/com/arr/simple/ui/servicios/SmsFragment.java +++ b/app/src/main/java/com/arr/simple/ui/servicios/SmsFragment.java @@ -75,19 +75,19 @@ public int getSpanSize(int position) { // lista list.add(new Header("Gratis")); - list.add(new Grid("Oferta", "Ofertas móviles",0)); - list.add(new Grid("Tarifa", "Tarifas móviles",0)); - list.add(new Grid("4G", "Activar servicio 4G",0)); + list.add(new Grid("Oferta", "Ofertas móviles", 0)); + list.add(new Grid("Tarifa", "Tarifas móviles", 0)); + list.add(new Grid("4G", "Activar servicio 4G", 0)); list.add(new Grid("Red", "Redes que soporta su móvil", 0)); list.add(new Header("De pago")); - list.add(new Grid("DHL", "Rastree su paquete",0)); - list.add(new Grid("Clima", "Estado del tiempo",0)); - list.add(new Grid("Vuelos", "Información de vuelos",0)); - list.add(new Grid("Embajadas", "Embajadas en Cuba",0)); - list.add(new Grid("Cambio", "Tasa de cambio oficial",0)); - list.add(new Grid("Apagón", "Apagón en La Habana",0)); - list.add(new Grid("Cubadebate", "Titulares de noticias",0)); - list.add(new Grid("Grannma", "Titulares de noticias",0)); + list.add(new Grid("DHL", "Rastree su paquete", 0)); + list.add(new Grid("Clima", "Estado del tiempo", 0)); + list.add(new Grid("Vuelos", "Información de vuelos", 0)); + list.add(new Grid("Embajadas", "Embajadas en Cuba", 0)); + list.add(new Grid("Cambio", "Tasa de cambio oficial", 0)); + list.add(new Grid("Apagón", "Apagón en La Habana", 0)); + list.add(new Grid("Cubadebate", "Titulares de noticias", 0)); + list.add(new Grid("Grannma", "Titulares de noticias", 0)); } private void onClick(int position) { diff --git a/app/src/main/java/com/arr/simple/ui/settings/AboutPreference.java b/app/src/main/java/com/arr/simple/ui/settings/AboutPreference.java index ad8873d..5f9dce7 100644 --- a/app/src/main/java/com/arr/simple/ui/settings/AboutPreference.java +++ b/app/src/main/java/com/arr/simple/ui/settings/AboutPreference.java @@ -76,8 +76,7 @@ public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { startActivity( new Intent( Intent.ACTION_VIEW, - Uri.parse( - "https://applifycu.github.io/website/politicas.html"))); + Uri.parse("https://site-8n0.pages.dev/politicas"))); return true; }); diff --git a/app/src/main/res/drawable/bg_circle_close.xml b/app/src/main/res/drawable/bg_circle_close.xml new file mode 100644 index 0000000..6ea0f77 --- /dev/null +++ b/app/src/main/res/drawable/bg_circle_close.xml @@ -0,0 +1,7 @@ + + + + + + diff --git a/app/src/main/res/drawable/ic_signal_mobile.xml b/app/src/main/res/drawable/ic_signal_mobile.xml new file mode 100644 index 0000000..feb78de --- /dev/null +++ b/app/src/main/res/drawable/ic_signal_mobile.xml @@ -0,0 +1,11 @@ + + + + diff --git a/app/src/main/res/drawable/ic_signal_none.xml b/app/src/main/res/drawable/ic_signal_none.xml new file mode 100644 index 0000000..4dce756 --- /dev/null +++ b/app/src/main/res/drawable/ic_signal_none.xml @@ -0,0 +1,11 @@ + + + + diff --git a/app/src/main/res/drawable/ic_signal_wifi.xml b/app/src/main/res/drawable/ic_signal_wifi.xml new file mode 100644 index 0000000..b7c4192 --- /dev/null +++ b/app/src/main/res/drawable/ic_signal_wifi.xml @@ -0,0 +1,11 @@ + + + + diff --git a/app/src/main/res/layout/fragment_balance.xml b/app/src/main/res/layout/fragment_balance.xml index f326c6c..c5a6089 100644 --- a/app/src/main/res/layout/fragment_balance.xml +++ b/app/src/main/res/layout/fragment_balance.xml @@ -9,403 +9,427 @@ + android:orientation="vertical" + android:paddingBottom="80dp"> - + - + android:layout_marginBottom="5dp" + android:layout_marginRight="16dp" + android:layout_marginLeft="16dp" + style="@style/MaterialCardView" + android:layout_marginTop="10dp"> - + - + + + + + - + - + + + + + + + + + + + + + + + - - + android:layout_marginTop="5dp"> - + android:layout_marginBottom="5dp" + android:layout_alignParentLeft="true" + android:layout_marginLeft="16dp" + android:layout_marginRight="5dp" + style="@style/MaterialCardView" + android:layout_weight="1.0"> - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - + android:orientation="horizontal"> - - - + + + + + + + + + + + + - - - - - - + android:layout_width="match_parent" + android:layout_marginBottom="5dp" + android:layout_marginRight="16dp" + android:layout_marginLeft="5dp" + style="@style/MaterialCardView" + android:layout_marginTop="5dp" + android:layout_alignParentRight="true" + android:layout_weight="1.0"> - + + + + + + + + + + + + + android:visibility="visible" + android:layout_marginBottom="5dp" + android:layout_marginRight="16dp" + android:layout_marginLeft="16dp" + style="@style/MaterialCardView" + android:layout_marginTop="10dp" + android:id="@+id/card_bonos_promo"> + android:orientation="vertical"> + + + android:id="@+id/bono_ilimitado" + android:text="0 MB" /> + android:id="@+id/bono_datos" + android:text="0 MB" /> + android:id="@+id/bono_voz" + android:text="00:00:00" /> + android:id="@+id/bono_sms" + android:text="0 SMS" /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - + diff --git a/app/src/main/res/layout/layout_floating_window.xml b/app/src/main/res/layout/layout_floating_window.xml index 925c995..6a71d2d 100644 --- a/app/src/main/res/layout/layout_floating_window.xml +++ b/app/src/main/res/layout/layout_floating_window.xml @@ -3,25 +3,34 @@ xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_height="wrap_content" - android:layout_width="match_parent" - android:background="@drawable/background_floating" + android:layout_width="wrap_content" android:gravity="center_vertical" - android:padding="5dp" + android:padding="10dp" android:orientation="horizontal" android:id="@+id/floating"> - - - + android:padding="3dp" + android:clickable="true" + android:background="@drawable/background_floating" + android:id="@+id/back"> + + + + + diff --git a/app/src/main/res/layout/layout_view_delete_service.xml b/app/src/main/res/layout/layout_view_delete_service.xml new file mode 100644 index 0000000..531de9d --- /dev/null +++ b/app/src/main/res/layout/layout_view_delete_service.xml @@ -0,0 +1,18 @@ + + + + + + diff --git a/app/src/main/res/layout/layout_view_items_bonos_balance.xml b/app/src/main/res/layout/layout_view_items_bonos_balance.xml new file mode 100644 index 0000000..aa2ff29 --- /dev/null +++ b/app/src/main/res/layout/layout_view_items_bonos_balance.xml @@ -0,0 +1,31 @@ + + + + + + + + + + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 13238ba..2cba11f 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -71,9 +71,9 @@ Notificación Al continuar usted acepta las - Políticas de Privacidad + Políticas de Privacidad y - Términos de Uso + Términos de Uso de Applify. diff --git a/app/src/main/res/xml/preferences_about.xml b/app/src/main/res/xml/preferences_about.xml index 7f85929..6222950 100644 --- a/app/src/main/res/xml/preferences_about.xml +++ b/app/src/main/res/xml/preferences_about.xml @@ -10,8 +10,8 @@ + app:title="Políticas de Privacidad" + app:summary="Lea nuestras políticas de privacidad" /> (?:\\d+(?:\\.\\d+)?)(?:\\s)*[GMK]B)?(?:\\s+\\+\\s+)?(?(?:\\d+(?:\\.\\d+)?)(?:\\s)*[GMK]B)?\\s+vence\\s+(?\\d{2}-\\d{2}-\\d{2}))"; - Pattern pattern = Pattern.compile(cadena); + String regex = "Datos:\\s+(?(\\d+(\\.\\d+)?)(\\s)*(G|M|K)?B)"; + Pattern pattern = Pattern.compile(regex); Matcher matcher = pattern.matcher(response); if (matcher.find()) { String result = matcher.group("datos"); - String result2 = matcher.group("vence"); if (result != null) { return result; } } return null; } + + public String getBonosLTE() { + String response = utils.response("bonos"); + String regex = "\\+\\s+(?(\\d+(\\.\\d+)?)(\\s)*(G|M|K)?B)"; + Pattern pattern = Pattern.compile(regex); + Matcher matcher = pattern.matcher(response); + if (matcher.find()) { + String result = matcher.group("lte"); + if (result != null) { + return result; + } + } + return null; + } + + public String getBonosVOZ() { + String response = utils.response("bonos"); + String regex = "Voz:\\s(?(\\d+:\\d{2}:\\d{2}))"; + Pattern pattern = Pattern.compile(regex); + Matcher matcher = pattern.matcher(response); + if (matcher.find()) { + String result = matcher.group("voz"); + if (result != null) { + return result; + } + } + return null; + } + + public String getBonosSMS() { + String response = utils.response("bonos"); + String regex = "SMS:\\s+(?(\\d+))"; + Pattern pattern = Pattern.compile(regex); + Matcher matcher = pattern.matcher(response); + if (matcher.find()) { + String result = matcher.group("sms"); + if (result != null) { + System.out.println("SMS " + result); + return result; + } + } + return null; + } }