diff --git a/RememBirthday-UI/src/main/java/com/kunzisoft/remembirthday/activity/BuddyActivity.java b/RememBirthday-UI/src/main/java/com/kunzisoft/remembirthday/activity/BuddyActivity.java index d026e11..80cefe8 100644 --- a/RememBirthday-UI/src/main/java/com/kunzisoft/remembirthday/activity/BuddyActivity.java +++ b/RememBirthday-UI/src/main/java/com/kunzisoft/remembirthday/activity/BuddyActivity.java @@ -4,7 +4,6 @@ import android.app.Activity; import android.content.DialogInterface; import android.content.Intent; -import android.net.Uri; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.design.widget.FloatingActionButton; @@ -17,7 +16,7 @@ import com.kunzisoft.remembirthday.R; import com.kunzisoft.remembirthday.element.DateUnknownYear; -import com.kunzisoft.remembirthday.utility.Constants; +import com.kunzisoft.remembirthday.utility.IntentCall; import com.kunzisoft.remembirthday.utility.Utility; import permissions.dispatcher.NeedsPermission; @@ -56,15 +55,14 @@ public void onClick(View view) { } }); + // Show the notification fragment for the first time if (Utility.isFirstTime(this)) { StartupDialogFragment startupDialogFragment = new StartupDialogFragment(); startupDialogFragment.setOnPositiveButtonClickListener(new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { - Intent intent = new Intent(Intent.ACTION_VIEW); - intent.setData(Uri.parse(Constants.URL_PARTICIPATION)); - startActivity(intent); + IntentCall.openContributionPage(BuddyActivity.this); } }); startupDialogFragment.show(getSupportFragmentManager(), TAG_STARTUP_FRAGMENT); diff --git a/RememBirthday-UI/src/main/java/com/kunzisoft/remembirthday/activity/DetailsBuddyFragment.java b/RememBirthday-UI/src/main/java/com/kunzisoft/remembirthday/activity/DetailsBuddyFragment.java index 1c3ebfb..2da15a9 100644 --- a/RememBirthday-UI/src/main/java/com/kunzisoft/remembirthday/activity/DetailsBuddyFragment.java +++ b/RememBirthday-UI/src/main/java/com/kunzisoft/remembirthday/activity/DetailsBuddyFragment.java @@ -36,6 +36,7 @@ import com.kunzisoft.remembirthday.factory.MenuActionAutoMessage; import com.kunzisoft.remembirthday.factory.MenuActionCalendar; import com.kunzisoft.remembirthday.factory.MenuActionCall; +import com.kunzisoft.remembirthday.factory.MenuActionGift; import com.kunzisoft.remembirthday.factory.MenuActionMessage; import com.kunzisoft.remembirthday.factory.MenuActionReminder; import com.kunzisoft.remembirthday.factory.MenuContact; @@ -259,6 +260,7 @@ public void doActionMenu(MenuAction menuAction) { if (!BuildConfig.FULL_VERSION) new ProFeatureDialogFragment().show(getFragmentManager(), "PRO_FEATURE_TAG"); } else { + menuAnimationCircle.hide(); switch (menuAction.getItemId()) { case MenuActionCalendar.ITEM_ID : IntentCall.openCalendarAt(getActivity(), contact.getNextBirthday()); @@ -281,12 +283,16 @@ public void doActionMenu(MenuAction menuAction) { } break; case MenuActionReminder.ITEM_ID : - menuAnimationCircle.hide(); remindersAdapter.addDefaultItem(); + // TODO reminder for pro + break; + case MenuActionGift.ITEM_ID : + + // TODO Gift for pro break; case MenuActionAutoMessage.ITEM_ID : - menuAnimationCircle.hide(); autoMessagesAdapter.addDefaultItem(); + // TODO Auto-message for pro break; } } diff --git a/RememBirthday-UI/src/main/java/com/kunzisoft/remembirthday/activity/ProFeatureDialogFragment.java b/RememBirthday-UI/src/main/java/com/kunzisoft/remembirthday/activity/ProFeatureDialogFragment.java index 04655f4..be86076 100644 --- a/RememBirthday-UI/src/main/java/com/kunzisoft/remembirthday/activity/ProFeatureDialogFragment.java +++ b/RememBirthday-UI/src/main/java/com/kunzisoft/remembirthday/activity/ProFeatureDialogFragment.java @@ -7,6 +7,7 @@ import android.support.v7.app.AlertDialog; import com.kunzisoft.remembirthday.R; +import com.kunzisoft.remembirthday.utility.IntentCall; /** * Created by joker on 13/07/17. @@ -21,7 +22,9 @@ public Dialog onCreateDialog(Bundle savedInstanceState) { builder.setMessage(R.string.dialog_pro_feature_title) .setPositiveButton(R.string.dialog_pro_feature_download, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { - // TODO GO TO PRO + // TODO Download PRO + // IntentCall.openStoreProApplication(ProFeatureDialogFragment.this.getContext()); + IntentCall.openContributionPage(ProFeatureDialogFragment.this.getContext()); } }) .setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() { diff --git a/RememBirthday-UI/src/main/java/com/kunzisoft/remembirthday/factory/MenuActionGift.java b/RememBirthday-UI/src/main/java/com/kunzisoft/remembirthday/factory/MenuActionGift.java new file mode 100644 index 0000000..4c17461 --- /dev/null +++ b/RememBirthday-UI/src/main/java/com/kunzisoft/remembirthday/factory/MenuActionGift.java @@ -0,0 +1,27 @@ +package com.kunzisoft.remembirthday.factory; + +import com.kunzisoft.remembirthday.R; + +/** + * Created by joker on 13/07/17. + */ + +public class MenuActionGift extends MenuAction{ + + public static final int ITEM_ID = 2561957; + + public MenuActionGift(STATE state) { + super(R.string.gift_title, + R.drawable.ic_gift_white_24dp, + state); + } + + public MenuActionGift() { + this(STATE.ACTIVE); + } + + @Override + public int getItemId() { + return ITEM_ID; + } +} diff --git a/RememBirthday-UI/src/main/java/com/kunzisoft/remembirthday/factory/MenuFactoryFree.java b/RememBirthday-UI/src/main/java/com/kunzisoft/remembirthday/factory/MenuFactoryFree.java index b6ce029..e7d31ef 100644 --- a/RememBirthday-UI/src/main/java/com/kunzisoft/remembirthday/factory/MenuFactoryFree.java +++ b/RememBirthday-UI/src/main/java/com/kunzisoft/remembirthday/factory/MenuFactoryFree.java @@ -8,9 +8,10 @@ public class MenuFactoryFree extends MenuFactoryBase { public MenuFactoryFree(boolean asPhoneNumber) { super(asPhoneNumber); listMenuAction.add(new MenuActionReminder(MenuAction.STATE.INACTIVE_FOR_PRO)); + listMenuAction.add(new MenuActionGift(MenuAction.STATE.INACTIVE_FOR_PRO)); if(asPhoneNumber) { listMenuAction.add(new MenuActionAutoMessage(MenuAction.STATE.INACTIVE_FOR_PRO)); - listMenuAction.add(new MenuActionAutoVoice(MenuAction.STATE.INACTIVE_FOR_PRO)); + //listMenuAction.add(new MenuActionAutoVoice(MenuAction.STATE.INACTIVE_FOR_PRO)); } } } diff --git a/RememBirthday-UI/src/main/java/com/kunzisoft/remembirthday/factory/MenuFactoryPro.java b/RememBirthday-UI/src/main/java/com/kunzisoft/remembirthday/factory/MenuFactoryPro.java index 421ebb6..f8585e8 100644 --- a/RememBirthday-UI/src/main/java/com/kunzisoft/remembirthday/factory/MenuFactoryPro.java +++ b/RememBirthday-UI/src/main/java/com/kunzisoft/remembirthday/factory/MenuFactoryPro.java @@ -14,8 +14,11 @@ public MenuFactoryPro(Context context, boolean asPhoneNumber) { super(asPhoneNumber); if(PreferencesManager.isDaemonsActive(context)) { listMenuAction.add(new MenuActionReminder()); - listMenuAction.add(new MenuActionAutoMessage()); - listMenuAction.add(new MenuActionAutoVoice()); + listMenuAction.add(new MenuActionGift()); + if(asPhoneNumber) { + listMenuAction.add(new MenuActionAutoMessage()); + //listMenuAction.add(new MenuActionAutoVoice()); + } } } } diff --git a/RememBirthday-UI/src/main/java/com/kunzisoft/remembirthday/utility/Constants.java b/RememBirthday-UI/src/main/java/com/kunzisoft/remembirthday/utility/Constants.java index 55b425f..86dc8e4 100644 --- a/RememBirthday-UI/src/main/java/com/kunzisoft/remembirthday/utility/Constants.java +++ b/RememBirthday-UI/src/main/java/com/kunzisoft/remembirthday/utility/Constants.java @@ -15,6 +15,7 @@ public class Constants { public static final String EMAIL = "contact@kunzisoft.com"; public static final String URL_WEB_SITE = "http://kunzisoft.com/"; public static final String URL_PARTICIPATION = URL_WEB_SITE+"#contribute"; + public static final String PRO_PACKAGE_NAME = "com.kunzisoft.remembirthday.pro"; /** * Get the current package version. diff --git a/RememBirthday-UI/src/main/java/com/kunzisoft/remembirthday/utility/IntentCall.java b/RememBirthday-UI/src/main/java/com/kunzisoft/remembirthday/utility/IntentCall.java index 8d50a0c..62f8f37 100644 --- a/RememBirthday-UI/src/main/java/com/kunzisoft/remembirthday/utility/IntentCall.java +++ b/RememBirthday-UI/src/main/java/com/kunzisoft/remembirthday/utility/IntentCall.java @@ -9,14 +9,17 @@ import android.support.annotation.Nullable; import android.util.Log; +import com.kunzisoft.remembirthday.BuildConfig; + import java.util.Calendar; /** - * Created by joker on 15/07/17. + * Utility class who manage the calls of external apps */ - public class IntentCall { + private IntentCall() {} + /** * Open calendar application at specific time * @param context Context to call @@ -73,4 +76,29 @@ public static void openSMSApp(Context context, String phoneNumber) { openSMSApp(context, phoneNumber, null); } + /** + * Open the specific page to make a contribution + * @param context Context to call + */ + public static void openContributionPage(Context context) { + Intent intent = new Intent(Intent.ACTION_VIEW); + intent.setData(Uri.parse(Constants.URL_PARTICIPATION)); + context.startActivity(intent); + } + + /** + * Open the store for pro version + * @param context Context to call + */ + public static void openStoreProApplication(Context context) { + try { + context.startActivity(new Intent(Intent.ACTION_VIEW, + Uri.parse("market://details?id=" + Constants.PRO_PACKAGE_NAME))); + } catch (android.content.ActivityNotFoundException e) { + context.startActivity(new Intent(Intent.ACTION_VIEW, + Uri.parse("http://play.google.com/store/apps/details?id=" + + Constants.PRO_PACKAGE_NAME))); + } + } + } diff --git a/RememBirthday-UI/src/main/res/drawable/ic_gift_white_24dp.xml b/RememBirthday-UI/src/main/res/drawable/ic_gift_white_24dp.xml new file mode 100644 index 0000000..dde9b54 --- /dev/null +++ b/RememBirthday-UI/src/main/res/drawable/ic_gift_white_24dp.xml @@ -0,0 +1,16 @@ + + + + + + \ No newline at end of file diff --git a/RememBirthday-UI/src/main/res/values/strings.xml b/RememBirthday-UI/src/main/res/values/strings.xml index 529a2db..852ccdd 100644 --- a/RememBirthday-UI/src/main/res/values/strings.xml +++ b/RememBirthday-UI/src/main/res/values/strings.xml @@ -18,6 +18,7 @@ Message Auto-Message Call + Gift Manager Auto-Vocal Day(s) before @@ -44,8 +45,8 @@ Delete Birthday Are you sure you want to delete the anniversary date and related events ? - This feature is available on the pro version. - Download + This feature is available on the pro version currently in development. + Contribute Thanks to download ! Cancel