Archived
Notifications are now automatically expanded, release number 1.2.5
This commit is contained in:
Generated
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectType">
|
<component name="ProjectType">
|
||||||
|
|||||||
+2
-2
@@ -16,8 +16,8 @@ android {
|
|||||||
applicationId "com.denizd.substitutionplan"
|
applicationId "com.denizd.substitutionplan"
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 28
|
targetSdkVersion 28
|
||||||
versionCode 9
|
versionCode 10
|
||||||
versionName "1.2.4"
|
versionName "1.2.5"
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
buildTypes {
|
buildTypes {
|
||||||
|
|||||||
Binary file not shown.
@@ -634,6 +634,13 @@ public class FragmentSettings extends Fragment {
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case "@NOTIFICATION": {
|
||||||
|
edit.putString("time", "");
|
||||||
|
edit.apply();
|
||||||
|
Toast.makeText(getActivity(), "Dummy notification sent",
|
||||||
|
Toast.LENGTH_LONG).show();
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
Toast.makeText(getActivity(), getString(R.string.nothinghappened),
|
Toast.makeText(getActivity(), getString(R.string.nothinghappened),
|
||||||
Toast.LENGTH_LONG).show();
|
Toast.LENGTH_LONG).show();
|
||||||
|
|||||||
@@ -171,18 +171,14 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
AlertDialog.Builder alertDialog;
|
AlertDialog.Builder alertDialog;
|
||||||
View dialogView = LayoutInflater.from(context).inflate(R.layout.secret_dialog, null);
|
View dialogView = LayoutInflater.from(context).inflate(R.layout.secret_dialog, null);
|
||||||
TextView secretText = dialogView.findViewById(R.id.secrettext);
|
|
||||||
if (prefs.getInt("themeInt", 0) == 1) {
|
if (prefs.getInt("themeInt", 0) == 1) {
|
||||||
secretText.setTextColor(getResources().getColor(R.color.hintdark));
|
|
||||||
alertDialog = new AlertDialog.Builder(context, R.style.AlertDialogCustomDark);
|
alertDialog = new AlertDialog.Builder(context, R.style.AlertDialogCustomDark);
|
||||||
} else {
|
} else {
|
||||||
secretText.setTextColor(getResources().getColor(R.color.hint));
|
|
||||||
alertDialog = new AlertDialog.Builder(context, R.style.AlertDialogCustomLight);
|
alertDialog = new AlertDialog.Builder(context, R.style.AlertDialogCustomLight);
|
||||||
}
|
}
|
||||||
alertDialog.setTitle(R.string.chinaTitle);
|
alertDialog.setTitle(R.string.chinaTitle);
|
||||||
TextView dialogText = dialogView.findViewById(R.id.dialogtext);
|
TextView dialogText = dialogView.findViewById(R.id.dialogtext);
|
||||||
dialogText.setText(R.string.chinaDialog);
|
dialogText.setText(R.string.chinaDialog);
|
||||||
secretText.setText(R.string.orbuy);
|
|
||||||
// Button searchbtn = dialogView.findViewById(R.id.searchbtn);
|
// Button searchbtn = dialogView.findViewById(R.id.searchbtn);
|
||||||
// searchbtn.setOnClickListener(new View.OnClickListener() {
|
// searchbtn.setOnClickListener(new View.OnClickListener() {
|
||||||
// @Override
|
// @Override
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ import android.graphics.Color;
|
|||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
|
import android.widget.RemoteViews;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.madapps.prefrences.EasyPrefrences;
|
import com.madapps.prefrences.EasyPrefrences;
|
||||||
|
|
||||||
@@ -261,13 +263,19 @@ public class ScheduledJobService extends JobService {
|
|||||||
openApp.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
openApp.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||||
PendingIntent openAppPending = PendingIntent.getActivity(mContext, 0, openApp, 0);
|
PendingIntent openAppPending = PendingIntent.getActivity(mContext, 0, openApp, 0);
|
||||||
|
|
||||||
|
RemoteViews notificationLayout = new RemoteViews(getPackageName(), R.layout.notification);
|
||||||
|
notificationLayout.setTextViewText(R.id.notification_title, getString(R.string.subst));
|
||||||
|
notificationLayout.setTextViewText(R.id.notification_textview, notifText);
|
||||||
|
|
||||||
if (!notifText.isEmpty()) {
|
if (!notifText.isEmpty()) {
|
||||||
Notification notification = null;
|
Notification notification = null;
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
notification = new NotificationCompat.Builder(mContext)
|
notification = new NotificationCompat.Builder(mContext)
|
||||||
.setContentTitle(getString(R.string.subst))
|
// .setContentTitle(getString(R.string.subst))
|
||||||
.setStyle(new NotificationCompat.BigTextStyle()
|
// .setStyle(new NotificationCompat.BigTextStyle()
|
||||||
.bigText(notifText))
|
// .bigText(notifText))
|
||||||
|
.setStyle(new NotificationCompat.DecoratedCustomViewStyle())
|
||||||
|
.setCustomContentView(notificationLayout)
|
||||||
.setSmallIcon(R.drawable.ic_avh)
|
.setSmallIcon(R.drawable.ic_avh)
|
||||||
.setChannelId(channelId)
|
.setChannelId(channelId)
|
||||||
.setContentIntent(openAppPending)
|
.setContentIntent(openAppPending)
|
||||||
@@ -275,9 +283,11 @@ public class ScheduledJobService extends JobService {
|
|||||||
.build();
|
.build();
|
||||||
} else {
|
} else {
|
||||||
notification = new NotificationCompat.Builder(mContext)
|
notification = new NotificationCompat.Builder(mContext)
|
||||||
.setContentTitle(getString(R.string.subst))
|
// .setContentTitle(getString(R.string.subst))
|
||||||
.setStyle(new NotificationCompat.BigTextStyle()
|
// .setStyle(new NotificationCompat.BigTextStyle()
|
||||||
.bigText(notifText))
|
// .bigText(notifText))
|
||||||
|
.setStyle(new NotificationCompat.DecoratedCustomViewStyle())
|
||||||
|
.setCustomContentView(notificationLayout)
|
||||||
.setSmallIcon(R.drawable.ic_avh)
|
.setSmallIcon(R.drawable.ic_avh)
|
||||||
.setContentIntent(openAppPending)
|
.setContentIntent(openAppPending)
|
||||||
.setAutoCancel(true)
|
.setAutoCancel(true)
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent" android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:id="@+id/notification_title"
|
||||||
|
style="@style/TextAppearance.Compat.Notification.Title"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_below="@+id/notification_title"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:id="@+id/notification_textview"
|
||||||
|
style="@style/TextAppearance.Compat.Notification"/>
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
@@ -21,18 +21,19 @@
|
|||||||
android:paddingStart="24dp"
|
android:paddingStart="24dp"
|
||||||
android:paddingEnd="24dp"
|
android:paddingEnd="24dp"
|
||||||
android:paddingBottom="4dp"
|
android:paddingBottom="4dp"
|
||||||
android:paddingTop="8dp"/>
|
android:paddingTop="8dp"
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/secrettext"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:textColor="?attr/colorText"
|
|
||||||
android:paddingStart="24dp"
|
|
||||||
android:paddingEnd="24dp"
|
|
||||||
android:textSize="3dp"
|
|
||||||
android:layout_marginBottom="24dp"/>
|
android:layout_marginBottom="24dp"/>
|
||||||
|
|
||||||
|
<!--<TextView-->
|
||||||
|
<!--android:id="@+id/secrettext"-->
|
||||||
|
<!--android:layout_width="wrap_content"-->
|
||||||
|
<!--android:layout_height="wrap_content"-->
|
||||||
|
<!--android:textColor="?attr/colorText"-->
|
||||||
|
<!--android:paddingStart="24dp"-->
|
||||||
|
<!--android:paddingEnd="24dp"-->
|
||||||
|
<!--android:textSize="3dp"-->
|
||||||
|
<!--android:layout_marginBottom="24dp"/>-->
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</androidx.core.widget.NestedScrollView>
|
</androidx.core.widget.NestedScrollView>
|
||||||
|
|||||||
Reference in New Issue
Block a user