Skip to content
This repository has been archived by the owner on Jun 10, 2024. It is now read-only.

Commit

Permalink
new release 4.0.7
Browse files Browse the repository at this point in the history
  • Loading branch information
esalessandrxx committed Dec 1, 2023
1 parent 1d1a337 commit c5f463a
Show file tree
Hide file tree
Showing 36 changed files with 1,529 additions and 475 deletions.
22 changes: 6 additions & 16 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@ plugins {
android {
namespace = "com.arr.simple"
compileSdk = 34
buildToolsVersion = "34.0.0"

defaultConfig {
applicationId = "com.arr.simple"
minSdk = 23
targetSdk = 33
versionCode = 45
versionName = "4.0.5"
targetSdk = 34
versionCode = 47
versionName = "4.0.7-beta"

vectorDrawables {
useSupportLibrary = true
Expand All @@ -25,21 +24,12 @@ android {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
/*
signingConfigs {
release {
storeFile(file("signing-key.jks"))
storePassword("")
keyAlias ("")
keyPassword ("")
}
}
*/

buildTypes {
release {
isMinifyEnabled = false
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
/*signingConfig(signingConfigs("release"))*/

}
}

Expand Down Expand Up @@ -77,7 +67,7 @@ dependencies {
implementation("com.github.suitetecsa:suitetecsa-sdk-kotlin:0.1.9")
implementation("com.airbnb.android:lottie:6.1.0")
implementation("com.github.applifycu:bugsend:1.0.4-alpha3")
implementation("com.github.applifycu:nautaclear:1.0.0")
implementation("com.github.applifycu:nautaclear:1.0.0-alpha2")
implementation("de.hdodenhof:circleimageview:3.1.0")

/* local projects */
Expand Down
6 changes: 5 additions & 1 deletion app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,8 @@

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
#-renamesourcefileattribute SourceFile

-keep class com.github.applifycu.** {
*;
}
39 changes: 23 additions & 16 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<uses-feature
Expand All @@ -14,11 +14,11 @@
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.READ_PHONE_NUMBERS" />
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="32"
tools:ignore="ScopedStorage" />
<uses-permission
android:name="android.permission.READ_EXTERNAL_STORAGE"
android:name="android.permission.READ_EXTERNAL_STORAGE"
android:maxSdkVersion="32" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
Expand All @@ -35,8 +35,7 @@
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.SEND_SMS" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />

<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
<application
android:name=".App"
android:allowBackup="true"
Expand Down Expand Up @@ -68,14 +67,7 @@
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
<receiver
android:name=".broadcast.StatusNetwork"
android:exported="true"
android:enabled="true">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>

<receiver
android:name="com.arr.simple.broadcast.NotificationBalances"
android:exported="true">
Expand All @@ -86,10 +78,25 @@
android:scheme="package" />
</intent-filter>
</receiver>

<receiver
android:name=".broadcast.NotificationNewYear"
android:exported="true">
<intent-filter>
<action android:name="com.arr.simple.NOTIFICATION" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
<service
android:name="com.arr.simple.services.TrafficFloatingWindow" />

android:name=".services.TrafficFloatingWindow" />
<service
android:name=".services.FloatingWindow" />
<receiver
android:name=".service.network"
android:exported="false">
<intent-filter>
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
</intent-filter>
</receiver>
<activity
android:name=".activity.WelcomeActivity"
android:screenOrientation="portrait"
Expand Down
92 changes: 52 additions & 40 deletions app/src/main/java/com/arr/simple/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

import android.Manifest;
import android.annotation.SuppressLint;
import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
Expand Down Expand Up @@ -29,6 +32,7 @@
import androidx.preference.PreferenceManager;

import com.arr.bugsend.BugSend;
import com.arr.simple.broadcast.NotificationNewYear;
import com.arr.simple.databinding.ActivityMainBinding;
import com.arr.simple.databinding.NavRailHeaderBinding;
import com.arr.simple.log.CrashActivity;
Expand Down Expand Up @@ -60,6 +64,9 @@ protected void onCreate(Bundle savedInstanceState) {
setContentView(binding.getRoot());
setSupportActionBar(binding.appBarMain.toolbar);

// mostrar una notificación por año nuevo
initNotificationNewYear();

// TODO: Quitar el foco de los TextInputEditText al entrar a una Activity o Fragment
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);

Expand All @@ -82,30 +89,37 @@ protected void onCreate(Bundle savedInstanceState) {
drawer = binding.drawerLayout;
NavigationRailView railView = binding.navRail;
NavigationView navigationView = binding.navView;

// cambiar los iconos del navigationRail en Halloween
Calendar calendar = Calendar.getInstance();
int month = calendar.get(Calendar.MONTH);
int dayOfMonth = calendar.get(Calendar.DAY_OF_MONTH);
if(month == Calendar.OCTOBER && dayOfMonth >= 30 && dayOfMonth <= 31){
Menu menu = railView.getMenu();
MenuItem i1 = menu.findItem(R.id.nav_rail_home);
MenuItem i2 = menu.findItem(R.id.nav_rail_servicios);
MenuItem i3 = menu.findItem(R.id.nav_rail_correo);
MenuItem i4 = menu.findItem(R.id.nav_rail_telepuntos);
MenuItem i5 = menu.findItem(R.id.nav_rail_settings);
MenuItem i6 = menu.findItem(R.id.nav_rail_about);

Menu menu = railView.getMenu();
MenuItem i1 = menu.findItem(R.id.nav_rail_home);
MenuItem i2 = menu.findItem(R.id.nav_rail_servicios);
MenuItem i3 = menu.findItem(R.id.nav_rail_correo);
MenuItem i4 = menu.findItem(R.id.nav_rail_telepuntos);
MenuItem i5 = menu.findItem(R.id.nav_rail_settings);

if (month == Calendar.OCTOBER && dayOfMonth >= 30 && dayOfMonth <= 31) {
i1.setIcon(R.drawable.halloween_home);
i2.setIcon(R.drawable.skull_24);
i3.setIcon(R.drawable.halloween_pumpkin);
i4.setIcon(R.drawable.halloween_ghost);
i5.setIcon(R.drawable.halloween_spider);
i6.setIcon(R.drawable.halloween_about);
}

//OnItemSelected railView
railView.setOnItemSelectedListener(

// * del 25 al 31 se agregan iconos de navidad
if (month == Calendar.DECEMBER && dayOfMonth >= 25 && dayOfMonth <= 31) {
i1.setIcon(R.drawable.navidad_home);
i2.setIcon(R.drawable.navidad_services);
i3.setIcon(R.drawable.navidad_correo);
i4.setIcon(R.drawable.navidad_telepuntos);
i5.setIcon(R.drawable.navidad_settings);
}

// OnItemSelected railView
railView.setOnItemSelectedListener(
menuItem -> {
int id = menuItem.getItemId();
if (id == R.id.nav_rail_servicios) {
Expand All @@ -115,16 +129,13 @@ protected void onCreate(Bundle savedInstanceState) {
navController.navigate(id, null);
}
if (id == R.id.nav_rail_telepuntos) {
openGoogleMap();
// startActivity(new Intent(this, Test.class));
openGoogleMap();
// startActivity(new Intent(this, Test.class));
}
if (id == R.id.nav_rail_settings) {
navController.navigate(id, null);
}
if (id == R.id.nav_rail_about) {
navController.navigate(id, null);
}


return false;
});

Expand Down Expand Up @@ -157,11 +168,11 @@ protected void onCreate(Bundle savedInstanceState) {
// TODO: menu should be considered as top level destinations.
mAppBarConfiguration =
new AppBarConfiguration.Builder(
R.id.nav_home,
R.id.nav_balance,
R.id.nav_compras,
R.id.nav_llamadas,
R.id.nav_nauta)
R.id.nav_home,
R.id.nav_balance,
R.id.nav_compras,
R.id.nav_llamadas,
R.id.nav_nauta)
.setOpenableLayout(drawer)
.build();

Expand All @@ -186,7 +197,8 @@ protected void onCreate(Bundle savedInstanceState) {
|| id == R.id.nav_info_nauta
|| id == R.id.nav_conectado
|| id == R.id.nav_rail_about
|| id == R.id.nav_mails) {
|| id == R.id.nav_mails
|| id == R.id.nav_help) {
binding.appBarMain.contentToolbar.setVisibility(View.GONE);
getWindow().setNavigationBarColor(SurfaceColors.SURFACE_0.getColor(this));
binding.appBarMain.bottomNavigation.setVisibility(View.GONE);
Expand Down Expand Up @@ -294,20 +306,20 @@ protected void onResume() {
Intent intent = new Intent(this, TrafficFloatingWindow.class);
startService(intent);
}


if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
/*
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
>>>>>>> 46ba879976366f0f3ccee8c77ffebe88a9b18b6f
boolean isNotifi = spFloating.getBoolean("balance_notif", true);
if (isNotifi) {
Intent broadcast = new Intent(this, NotificationBalances.class);
sendBroadcast(broadcast);
}
*/
}
}

private void initNotificationNewYear() {
AlarmManager alarm = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
Intent intent = new Intent(this, NotificationNewYear.class);
intent.setAction("com.arr.simple.NOTIFICATION");
PendingIntent pIntent =
PendingIntent.getBroadcast(this, 0, intent, PendingIntent.FLAG_IMMUTABLE);
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.MONTH, Calendar.JANUARY);
calendar.set(Calendar.DAY_OF_MONTH, 1);
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
alarm.setExact(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), pIntent);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
package com.arr.simple.broadcast;

import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.content.BroadcastReceiver;
import android.content.Intent;
import android.content.Context;
import android.os.Build;
import androidx.core.app.NotificationManagerCompat;
import com.arr.simple.R;
import androidx.core.app.NotificationCompat;
import java.util.Calendar;

public class NotificationNewYear extends BroadcastReceiver {

private String CHANNEL_ID = "SIMple";
private String CHANNEL_NAME = "New Year";
private String CHANNEL_DESCRIPTION = "Notificación por nuevo año";

@Override
public void onReceive(Context context, Intent intent) {
Calendar calendar = Calendar.getInstance();
int currentDay = calendar.get(Calendar.DAY_OF_MONTH);
int currentMonth = calendar.get(Calendar.MONTH);
if (currentDay == 1 && currentMonth == Calendar.JANUARY) {

if (intent.getAction().equals("com.arr.simple.NOTIFICATION")) {

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
NotificationChannel channel =
new NotificationChannel(
CHANNEL_ID,
CHANNEL_NAME,
NotificationManager.IMPORTANCE_DEFAULT);
channel.setDescription(CHANNEL_DESCRIPTION);
channel.enableVibration(true);
channel.setShowBadge(true);
channel.setSound(null, null);
NotificationManager notiManager =
context.getSystemService(NotificationManager.class);
notiManager.createNotificationChannel(channel);
}

NotificationCompat.Builder builder =
new NotificationCompat.Builder(context, CHANNEL_ID)
.setSmallIcon(R.drawable.ic_logo_simple)
.setContentTitle("¡Feliz año nuevo!")
.setStyle(
new NotificationCompat.BigTextStyle()
.bigText(
context.getString(R.string.happy_new_year)))
.setContentText(context.getString(R.string.happy_new_year))
.setShowWhen(false)
.setSound(null)
.setPriority(NotificationCompat.PRIORITY_DEFAULT);

NotificationManagerCompat notificationManager =
NotificationManagerCompat.from(context);
notificationManager.notify(23, builder.build());
}
}
}
}
Loading

0 comments on commit c5f463a

Please sign in to comment.