Notifications are now automatically expanded, release number 1.2.5

This commit is contained in:
Deniz Düzgören
2019-05-03 19:03:19 +02:00
parent 00c893380e
commit d5b5803ba2
8 changed files with 55 additions and 23 deletions
@@ -634,6 +634,13 @@ public class FragmentSettings extends Fragment {
break;
}
case "@NOTIFICATION": {
edit.putString("time", "");
edit.apply();
Toast.makeText(getActivity(), "Dummy notification sent",
Toast.LENGTH_LONG).show();
break;
}
default:
Toast.makeText(getActivity(), getString(R.string.nothinghappened),
Toast.LENGTH_LONG).show();
@@ -171,18 +171,14 @@ public class MainActivity extends AppCompatActivity {
AlertDialog.Builder alertDialog;
View dialogView = LayoutInflater.from(context).inflate(R.layout.secret_dialog, null);
TextView secretText = dialogView.findViewById(R.id.secrettext);
if (prefs.getInt("themeInt", 0) == 1) {
secretText.setTextColor(getResources().getColor(R.color.hintdark));
alertDialog = new AlertDialog.Builder(context, R.style.AlertDialogCustomDark);
} else {
secretText.setTextColor(getResources().getColor(R.color.hint));
alertDialog = new AlertDialog.Builder(context, R.style.AlertDialogCustomLight);
}
alertDialog.setTitle(R.string.chinaTitle);
TextView dialogText = dialogView.findViewById(R.id.dialogtext);
dialogText.setText(R.string.chinaDialog);
secretText.setText(R.string.orbuy);
// Button searchbtn = dialogView.findViewById(R.id.searchbtn);
// searchbtn.setOnClickListener(new View.OnClickListener() {
// @Override
@@ -13,6 +13,8 @@ import android.graphics.Color;
import android.os.AsyncTask;
import android.os.Build;
import android.preference.PreferenceManager;
import android.widget.RemoteViews;
import android.widget.TextView;
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);
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()) {
Notification notification = null;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
notification = new NotificationCompat.Builder(mContext)
.setContentTitle(getString(R.string.subst))
.setStyle(new NotificationCompat.BigTextStyle()
.bigText(notifText))
// .setContentTitle(getString(R.string.subst))
// .setStyle(new NotificationCompat.BigTextStyle()
// .bigText(notifText))
.setStyle(new NotificationCompat.DecoratedCustomViewStyle())
.setCustomContentView(notificationLayout)
.setSmallIcon(R.drawable.ic_avh)
.setChannelId(channelId)
.setContentIntent(openAppPending)
@@ -275,9 +283,11 @@ public class ScheduledJobService extends JobService {
.build();
} else {
notification = new NotificationCompat.Builder(mContext)
.setContentTitle(getString(R.string.subst))
.setStyle(new NotificationCompat.BigTextStyle()
.bigText(notifText))
// .setContentTitle(getString(R.string.subst))
// .setStyle(new NotificationCompat.BigTextStyle()
// .bigText(notifText))
.setStyle(new NotificationCompat.DecoratedCustomViewStyle())
.setCustomContentView(notificationLayout)
.setSmallIcon(R.drawable.ic_avh)
.setContentIntent(openAppPending)
.setAutoCancel(true)