Prompt user to install SIA if not installed and they try enabling the setting

This commit is contained in:
Moez Bhatti
2015-12-10 01:39:47 -05:00
parent a15449a46f
commit ef3c6c62c3
3 changed files with 32 additions and 0 deletions
@@ -665,6 +665,10 @@ public class NotificationManager {
*/
public static void initQuickCompose(Context context, boolean override, boolean overrideCancel) {
if (sPrefs == null) {
init(context);
}
if (sPrefs.getBoolean(SettingsFragment.QUICKCOMPOSE, false) || override) {
Intent composeIntent = new Intent(context, QKComposeActivity.class);
PendingIntent composePI = PendingIntent.getActivity(context, 9, composeIntent, PendingIntent.FLAG_UPDATE_CURRENT);
@@ -12,6 +12,8 @@ import android.content.res.Resources;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.preference.CheckBoxPreference;
import android.preference.EditTextPreference;
import android.preference.ListPreference;
import android.preference.Preference;
@@ -36,6 +38,7 @@ import com.moez.QKSMS.common.ListviewHelper;
import com.moez.QKSMS.common.LiveViewManager;
import com.moez.QKSMS.common.utils.DateFormatter;
import com.moez.QKSMS.common.utils.KeyboardUtils;
import com.moez.QKSMS.common.utils.PackageUtils;
import com.moez.QKSMS.interfaces.LiveView;
import com.moez.QKSMS.receiver.NightModeAutoReceiver;
import com.moez.QKSMS.transaction.EndlessJabber;
@@ -531,6 +534,29 @@ public class SettingsFragment extends PreferenceFragment implements Preference.O
case BLOCKED_FUTURE:
BlockedNumberDialog.showDialog(mContext);
break;
case SHOULD_I_ANSWER:
final String packageName = "org.mistergroup.muzutozvednout";
if (!PackageUtils.isAppInstalled(mContext, packageName)) {
new QKDialog()
.setContext(mContext)
.setTitle(R.string.dialog_should_i_answer_title)
.setMessage(R.string.dialog_should_i_answer_message)
.setNegativeButton(R.string.cancel, null)
.setPositiveButton(R.string.okay, v -> {
try {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + packageName)));
} catch (android.content.ActivityNotFoundException anfe) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + packageName)));
}
})
.show();
new Handler().postDelayed(() -> {
mPrefs.edit().putBoolean(SHOULD_I_ANSWER, false).commit();
((CheckBoxPreference) preference).setChecked(false);
}, 500);
}
break;
case NOTIFICATION_LED_COLOR:
mLedColorPickerDialog.show(getActivity().getFragmentManager(), "colorpicker");
break;
+2
View File
@@ -577,6 +577,8 @@
<string name="dialog_conversation_details_last_message_date">Last message date</string>
<string name="dialog_conversation_details_message_count">Message count</string>
<string name="dialog_conversation_details_recipients">Recipients (%s)</string>
<string name="dialog_should_i_answer_title">Should I Answer? not installed</string>
<string name="dialog_should_i_answer_message">Would you like to download the app from Google Play now?</string>
<!-- Title for audio file picker -->
<string name="select_audio">Choose audio</string>