Remove advertisements

This commit is contained in:
Trevor Slocum 2019-09-11 16:19:53 -07:00
parent d40fe9aa90
commit 19a74d8218
24 changed files with 186 additions and 431 deletions

View File

@ -1,5 +1,6 @@
1.5.6:
- Sessions may now be imported from previous exports (CSV files)
- Advertisements have been removed
1.5.5:
- Fixed add session dialog sometimes overwriting existing session when adding a new session

View File

@ -8,8 +8,8 @@ android {
minSdkVersion 16
targetSdkVersion 28
versionCode 155
versionName "1.5.5"
versionCode 156
versionName "1.5.6"
applicationId "sh.ftp.rocketninelabs.meditationassistant"
manifestPlaceholders = [
@ -97,7 +97,6 @@ dependencies {
fullImplementation 'com.google.android.gms:play-services-appinvite:16.1.1'
freeImplementation 'com.google.android.gms:play-services-fitness:16.0.1'
fullImplementation 'com.google.android.gms:play-services-fitness:16.0.1'
freeImplementation 'com.google.android.gms:play-services-ads:17.2.0'
//noinspection GradleDynamicVersion
implementation 'ch.acra:acra-http:5.3.0'
implementation 'com.github.amlcurran.showcaseview:library:5.4.3'

View File

@ -4,10 +4,6 @@
package="sh.ftp.rocketninelabs.meditationassistant">
<application>
<meta-data
android:name="com.google.android.backup.api_key"
android:value="AEdPqrEAAAAIqq_HCa56eFzfQpNSwYUIIytAyO6bh4fFUFUcYA" />
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
@ -16,6 +12,13 @@
android:name="com.google.android.gms.analytics.globalConfigResource"
android:resource="@xml/analytics" />
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-6158454562572132~3051388356" />
<meta-data
android:name="com.google.android.backup.api_key"
android:value="AEdPqrEAAAAIqq_HCa56eFzfQpNSwYUIIytAyO6bh4fFUFUcYA" />
<receiver
android:name="com.google.android.gms.analytics.AnalyticsReceiver"
android:enabled="true"
@ -24,14 +27,6 @@
<action android:name="com.google.android.gms.analytics.ANALYTICS_DISPATCH" />
</intent-filter>
</receiver>
<service
android:name="com.google.android.gms.analytics.AnalyticsService"
android:enabled="true"
android:exported="false" />
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-6158454562572132~3051388356" />
<!-- Register Wear data layer service
<service android:name=".WearListenerService">
@ -41,10 +36,10 @@
</service> -->
<!-- Activities -->
<activity
android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:theme="@android:style/Theme.Translucent" />
<service
android:name="com.google.android.gms.analytics.AnalyticsService"
android:enabled="true"
android:exported="false" />
</application>

View File

@ -1,94 +0,0 @@
package sh.ftp.rocketninelabs.meditationassistant;
import android.app.Activity;
import android.util.Log;
import android.widget.FrameLayout;
import android.widget.RelativeLayout;
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdSize;
import com.google.android.gms.ads.AdView;
public class UtilityAdsMA {
public MeditationAssistant ma = null;
private AdView adMain = null;
private AdView adProgress = null;
private AdView adMediNET = null;
private AdView adComplete = null;
private MeditationAssistant getMeditationAssistant() {
return ma;
}
public AdView getAdView(Activity activity) {
if (activity.getClass().getSimpleName().equals("MainActivity")) {
return adMain;
}
return null;
}
public void loadAd(Activity activity) {
RelativeLayout adLayout = null;
if (activity.getClass().getSimpleName().equals("MainActivity")) {
adLayout = (RelativeLayout) activity.findViewById(R.id.adMain);
} else if (activity.getClass().getSimpleName().equals("ProgressActivity")) {
adLayout = (RelativeLayout) activity.findViewById(R.id.adProgress);
} else if (activity.getClass().getSimpleName().equals("MediNETActivity")) {
adLayout = (RelativeLayout) activity.findViewById(R.id.adMediNET);
} else if (activity.getClass().getSimpleName().equals("CompleteActivity")) {
adLayout = (RelativeLayout) activity.findViewById(R.id.adComplete);
}
if (adLayout != null) {
Log.d("MeditationAssistant", "Fetching ad");
AdView av = new AdView(activity);
av.setAdSize(AdSize.SMART_BANNER);
av.setAdUnitId("a15110a172d3cff");
AdRequest adRequest = new AdRequest.Builder()
.addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
.build();
av.setLayoutParams(new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.WRAP_CONTENT));
if (adLayout.getChildCount() > 0) {
adLayout.removeAllViews();
}
adLayout.addView(av);
av.loadAd(adRequest);
if (activity.getClass().getSimpleName().equals("MainActivity")) {
adMain = av;
} else if (activity.getClass().getSimpleName().equals("ProgressActivity")) {
adProgress = av;
} else if (activity.getClass().getSimpleName().equals("MediNETActivity")) {
adMediNET = av;
} else if (activity.getClass().getSimpleName().equals("CompleteActivity")) {
adComplete = av;
}
}
}
public void pauseAd(Activity activity) {
AdView av = getAdView(activity);
if (av != null) {
av.pause();
}
}
public void resumeAd(Activity activity) {
AdView av = getAdView(activity);
if (av != null) {
av.resume();
}
}
public void destroyAd(Activity activity) {
AdView av = getAdView(activity);
if (av != null) {
av.destroy();
}
}
}

View File

@ -37,42 +37,6 @@
</intent-filter>
</service> -->
<!-- Widgets -->
<!--
<receiver
android:name=".MeditationProvider1"
android:label="@string/widget1x1" >
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="@xml/widget_1" />
</receiver>-->
<receiver
android:name=".MeditationProvider2"
android:label="@string/widget2x1">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="@xml/widget_2" />
</receiver>
<receiver
android:name=".MeditationProvider3"
android:label="@string/widget3x1">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="@xml/widget_3" />
</receiver>
</application>
</manifest>

View File

@ -1,17 +0,0 @@
package sh.ftp.rocketninelabs.meditationassistant;
import android.app.Activity;
public class UtilityAdsMA {
public void loadAd(Activity activity) {
}
public void pauseAd(Activity activity) {
}
public void resumeAd(Activity activity) {
}
public void destroyAd(Activity activity) {
}
}

View File

@ -3,74 +3,15 @@
xmlns:tools="http://schemas.android.com/tools"
package="sh.ftp.rocketninelabs.meditationassistant">
<uses-permission
android:name="android.permission.READ_EXTERNAL_STORAGE"
tools:node="replace" />
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
tools:node="replace" />
<uses-permission
android:name="android.permission.WAKE_LOCK"
tools:node="replace" />
<uses-permission
android:name="android.permission.INTERNET"
tools:node="replace" />
<uses-permission
android:name="android.permission.ACCESS_NETWORK_STATE"
tools:node="replace" />
<uses-permission
android:name="android.permission.ACCESS_NOTIFICATION_POLICY"
tools:node="replace" />
<uses-permission
android:name="android.permission.VIBRATE"
tools:node="replace" />
<uses-permission
android:name="android.permission.RECEIVE_BOOT_COMPLETED"
tools:node="replace" />
<application
android:name="sh.ftp.rocketninelabs.meditationassistant.MeditationAssistant"
android:allowBackup="true"
android:hardwareAccelerated="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/appName"
android:label="@string/appNameShort"
android:theme="@style/MeditationDarkTheme">
<!-- Services -->
<service android:name="sh.ftp.rocketninelabs.meditationassistant.WidgetService"></service>
<!-- Receivers -->
<receiver
android:name="sh.ftp.rocketninelabs.meditationassistant.DailyReminderReceiver"
android:exported="true">
<intent-filter>
<action android:name="sh.ftp.rocketninelabs.meditationassistant.DAILY_NOTIFICATION"></action>
<action android:name="sh.ftp.rocketninelabs.meditationassistant.DAILY_NOTIFICATION_UPDATED"></action>
<action android:name="android.intent.action.EXTERNAL_APPLICATIONS_AVAILABLE" />
<action android:name="android.intent.action.LOCKED_BOOT_COMPLETED" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.PACKAGE_REPLACED" />
<action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
<action android:name="android.intent.action.MY_PACKAGE_UNSUSPENDED" />
<data
android:path="${applicationId}"
android:scheme="package" />
</intent-filter>
</receiver>
<!-- Providers -->
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="${applicationId}.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/nnf_provider_paths" />
</provider>
<!-- Activities -->
<activity
android:name="sh.ftp.rocketninelabs.meditationassistant.MainActivity"
android:configChanges="keyboard|keyboardHidden|screenSize|orientation"
@ -84,6 +25,8 @@
<action android:name="sh.ftp.rocketninelabs.meditationassistant.ALARM"></action>
</intent-filter>
</activity>
<!-- Receivers -->
<activity
android:name="sh.ftp.rocketninelabs.meditationassistant.SettingsActivity"
android:configChanges="keyboard|keyboardHidden|screenSize|orientation"
@ -95,6 +38,8 @@
android:name="android.support.PARENT_ACTIVITY"
android:value="sh.ftp.rocketninelabs.meditationassistant.MainActivity" />
</activity>
<!-- Providers -->
<activity
android:name="sh.ftp.rocketninelabs.meditationassistant.AuthResultActivity"
android:configChanges="keyboard|keyboardHidden|screenSize|orientation"
@ -104,6 +49,20 @@
android:name="android.support.PARENT_ACTIVITY"
android:value="sh.ftp.rocketninelabs.meditationassistant.MainActivity" />
</activity>
<!-- Widgets -->
<!--
<receiver
android:name=".MeditationProvider1"
android:label="@string/widget1x1" >
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="@xml/widget_1" />
</receiver>-->
<activity
android:name="sh.ftp.rocketninelabs.meditationassistant.MediNETActivity"
android:configChanges="keyboard|keyboardHidden|screenSize|orientation"
@ -121,6 +80,8 @@
android:name="android.support.PARENT_ACTIVITY"
android:value="sh.ftp.rocketninelabs.meditationassistant.MainActivity" />
</activity>
<!-- Activities -->
<activity
android:name="sh.ftp.rocketninelabs.meditationassistant.AboutActivity"
android:configChanges="keyboard|keyboardHidden|screenSize|orientation"
@ -146,6 +107,82 @@
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="${applicationId}.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/nnf_provider_paths" />
</provider>
<receiver
android:name="sh.ftp.rocketninelabs.meditationassistant.DailyReminderReceiver"
android:exported="true">
<intent-filter>
<action android:name="sh.ftp.rocketninelabs.meditationassistant.DAILY_NOTIFICATION"></action>
<action android:name="sh.ftp.rocketninelabs.meditationassistant.DAILY_NOTIFICATION_UPDATED"></action>
<action android:name="android.intent.action.EXTERNAL_APPLICATIONS_AVAILABLE" />
<action android:name="android.intent.action.LOCKED_BOOT_COMPLETED" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.PACKAGE_REPLACED" />
<action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
<action android:name="android.intent.action.MY_PACKAGE_UNSUSPENDED" />
<data
android:path="${applicationId}"
android:scheme="package" />
</intent-filter>
</receiver>
<receiver
android:name=".MeditationProvider2"
android:label="@string/widget2x1">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="@xml/widget_2" />
</receiver>
<receiver
android:name=".MeditationProvider3"
android:label="@string/widget3x1">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="@xml/widget_3" />
</receiver>
<service android:name="sh.ftp.rocketninelabs.meditationassistant.WidgetService"></service>
</application>
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
tools:node="replace" />
<uses-permission
android:name="android.permission.WAKE_LOCK"
tools:node="replace" />
<uses-permission
android:name="android.permission.INTERNET"
tools:node="replace" />
<uses-permission
android:name="android.permission.ACCESS_NETWORK_STATE"
tools:node="replace" />
<uses-permission
android:name="android.permission.ACCESS_NOTIFICATION_POLICY"
tools:node="replace" />
<uses-permission
android:name="android.permission.VIBRATE"
tools:node="replace" />
<uses-permission
android:name="android.permission.RECEIVE_BOOT_COMPLETED"
tools:node="replace" />
<uses-permission
android:name="android.permission.READ_EXTERNAL_STORAGE"
tools:node="replace" />
</manifest>

View File

@ -1,8 +1,6 @@
package sh.ftp.rocketninelabs.meditationassistant;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
@ -13,7 +11,6 @@ import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.animation.AnimationUtils;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
@ -35,14 +32,7 @@ public class AboutActivity extends Activity {
TextView txtAboutAppName = (TextView) findViewById(R.id.txtAboutAppName);
TextView txtAboutAppVersion = (TextView) findViewById(R.id.txtAboutAppVersion);
if (BuildConfig.FLAVOR.equals("free")) {
txtAboutAppName.setText(getString(R.string.appName));
Button btnDonate = (Button) findViewById(R.id.btnDonate);
btnDonate.setText(getString(R.string.removeAds));
} else {
txtAboutAppName.setText(getString(R.string.appNameShort));
}
txtAboutAppName.setText(getString(R.string.appNameShort));
PackageInfo pInfo;
try {
@ -139,59 +129,7 @@ public class AboutActivity extends Activity {
}
public void openDonate(View view) {
if (BuildConfig.FLAVOR.equals("free")) {
AlertDialog removeAdsDialog = new AlertDialog.Builder(this)
.setPositiveButton(R.string.ok,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog,
int id) {
if (getMeditationAssistant().getMarketName().equals("bb")) {
startActivity(Intent.createChooser(new Intent(Intent.ACTION_VIEW, Uri.parse("https://appworld.blackberry.com/webstore/content/59939922/")), getString(R.string.openWith)).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
} else if (getMeditationAssistant().getMarketName().equals("google")) {
startActivity(Intent.createChooser(new Intent(Intent.ACTION_VIEW, Uri.parse("http://play.google.com/store/apps/details?id=sh.ftp.rocketninelabs.meditationassistant.full")), getString(R.string.openWith)).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
} else if (getMeditationAssistant().getMarketName().equals("amazon")) {
startActivity(Intent.createChooser(new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.amazon.com/gp/mas/dl/android?p=sh.ftp.rocketninelabs.meditationassistant.full")), getString(R.string.openWith)).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
}
}
}
)
.setNegativeButton(getString(R.string.cancel),
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog,
int id) {
}
})
.setTitle(getString(R.string.removeAds))
.setMessage(getString(R.string.removeAdsHelp))
.setIcon(getResources()
.getDrawable(
getTheme()
.obtainStyledAttributes(
getMeditationAssistant().getMATheme(true),
new int[]{R.attr.actionIconInfo})
.getResourceId(0, 0)
)
).create();
removeAdsDialog.show();
} else {
AlertDialog donateDialog = new AlertDialog.Builder(this)
.setPositiveButton("Liberapay",
(dialog, id) -> startActivity(new Intent(
Intent.ACTION_VIEW,
Uri.parse("https://liberapay.com/~968545")).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)))
.setNegativeButton("PayPal",
(dialog, id) -> startActivity(new Intent(
Intent.ACTION_VIEW,
Uri.parse(MeditationAssistant.URL_ROCKETNINELABS + "/donate")).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)))
.setTitle(getString(R.string.donate))
.create();
donateDialog.show();
}
getMeditationAssistant().showDonationDialog(AboutActivity.this);
}
public MeditationAssistant getMeditationAssistant() {

View File

@ -81,8 +81,6 @@ public class CompleteActivity extends Activity {
getMeditationAssistant().unsetNotificationControl();
getMeditationAssistant().hideNotification(); // Called twice because it seems to help
getMeditationAssistant().utility_ads.loadAd(this);
EditText editSessionMessage = (EditText) findViewById(R.id.editSessionMessage);
if (editSessionMessage.getText().toString().equals("")
&& getMeditationAssistant().getPrefs().getBoolean("pref_remembermessage", false)) {
@ -167,7 +165,6 @@ public class CompleteActivity extends Activity {
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
getMeditationAssistant().utility_ads.loadAd(this);
}
@Override
@ -236,20 +233,17 @@ public class CompleteActivity extends Activity {
@Override
public void onDestroy() {
getMeditationAssistant().utility_ads.destroyAd(this);
super.onDestroy();
}
@Override
public void onPause() {
getMeditationAssistant().utility_ads.pauseAd(this);
super.onPause();
}
@Override
public void onResume() {
super.onResume();
getMeditationAssistant().utility_ads.resumeAd(this);
}
@Override

View File

@ -391,8 +391,6 @@ public class MainActivity extends Activity implements OnShowcaseEventListener {
getMeditationAssistant().getMediNET().updated();
}
getMeditationAssistant().utility_ads.loadAd(this);
onNewIntent(getIntent());
Object language = Locale.getDefault().getLanguage();
@ -458,6 +456,11 @@ public class MainActivity extends Activity implements OnShowcaseEventListener {
getMeditationAssistant().checkNotificationControl(MainActivity.this, "");
if (getMeditationAssistant().asktodonate) {
getMeditationAssistant().asktodonate = false;
getMeditationAssistant().askToDonate(MainActivity.this);
}
// TODO: Implement
//getMeditationAssistant().setupGoogleClient(MainActivity.this);
}
@ -1585,8 +1588,6 @@ public class MainActivity extends Activity implements OnShowcaseEventListener {
getMeditationAssistant().showNotification();
}
getMeditationAssistant().utility_ads.pauseAd(this);
getMeditationAssistant().setScreenOff(true);
getMeditationAssistant().getPrefs().unregisterOnSharedPreferenceChangeListener(sharedPrefslistener);
@ -1663,8 +1664,6 @@ public class MainActivity extends Activity implements OnShowcaseEventListener {
showNextTutorial();
super.onResume();
getMeditationAssistant().utility_ads.resumeAd(this);
}
@Override
@ -1690,8 +1689,6 @@ public class MainActivity extends Activity implements OnShowcaseEventListener {
getMeditationAssistant().getPrefs().edit().putString("key", "").apply();
}
getMeditationAssistant().utility_ads.destroyAd(this);
super.onDestroy();
}
@ -2205,7 +2202,6 @@ public class MainActivity extends Activity implements OnShowcaseEventListener {
if (sv != null && sv.isShown()) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
getMeditationAssistant().utility_ads.loadAd(this);
}
@Override

View File

@ -256,8 +256,6 @@ public class MediNETActivity extends Activity {
.getStringExtra("page").equals("lgpl"))) {
goTo(getIntent().getStringExtra("page"));
}
} else {
getMeditationAssistant().utility_ads.loadAd(this);
}
}
@ -283,8 +281,6 @@ public class MediNETActivity extends Activity {
setContentView(R.layout.activity_medinet);
getActionBar().setDisplayHomeAsUpEnabled(true);
getMeditationAssistant().utility_ads.loadAd(this);
getMeditationAssistant().utility.initializeTracker(this);
initUI(true);
@ -308,8 +304,6 @@ public class MediNETActivity extends Activity {
getMeditationAssistant().getMediNET().updated();
}
getMeditationAssistant().utility_ads.destroyAd(this);
super.onDestroy();
}
@ -365,7 +359,6 @@ public class MediNETActivity extends Activity {
@Override
protected void onPause() {
getMeditationAssistant().utility_ads.pauseAd(this);
super.onPause();
}
@ -392,7 +385,6 @@ public class MediNETActivity extends Activity {
@Override
protected void onResume() {
super.onResume();
getMeditationAssistant().utility_ads.resumeAd(this);
}
@Override

View File

@ -46,7 +46,10 @@ public class MediNETTask extends AsyncTask<MediNET, Integer, MediNET> {
TimeZone tz = TimeZone.getDefault();
Date now = new Date();
int offsetFromUTC = tz.getOffset(now.getTime());
String appVersion = getMeditationAssistant().getMAAppVersion() + BuildConfig.FLAVOR;
String appVersion = getMeditationAssistant().getMAAppVersion();
if (BuildConfig.FLAVOR != "free") {
appVersion += BuildConfig.FLAVOR;
}
if (this.nextURL == null) {
this.nextURL = MeditationAssistant.URL_MEDINET + "/om?v="

View File

@ -106,12 +106,12 @@ public class MeditationAssistant extends Application {
public int previousRingerMode = -1;
public String pendingNotificationAction = "";
public Boolean asktorate = false;
public Boolean asktodonate = false;
public DatabaseHandler db = null;
public PendingIntent reminderPendingIntent = null;
public String theme = null;
public String marketName = null;
public UtilityMA utility = new UtilityMA();
public UtilityAdsMA utility_ads = new UtilityAdsMA();
public Integer previous_volume = null;
private String appVersion = null;
private long timeToStopMeditate = 0;
@ -1024,6 +1024,12 @@ public class MeditationAssistant extends Application {
CookieHandler.setDefault(cookieManager);
Integer applaunches = getPrefs().getInt("applaunches", 0) + 1;
if (applaunches == 1) {
getPrefs().edit().putBoolean("askedtodonate156", true).apply();
} else if (!getPrefs().getBoolean("askedtodonate156", false)) {
asktodonate = true;
getPrefs().edit().putBoolean("askedtodonate156", true).apply();
}
getPrefs().edit().putInt("applaunches", applaunches).apply();
Log.d("MeditationAssistant",
@ -1220,6 +1226,23 @@ public class MeditationAssistant extends Application {
return null;
}
public void showDonationDialog(Activity activity) {
AlertDialog donateDialog = new AlertDialog.Builder(activity)
.setTitle(getString(R.string.donate))
.setMessage(R.string.chooseDonationMethod)
.setPositiveButton("Liberapay",
(dialog, id) -> startActivity(new Intent(
Intent.ACTION_VIEW,
Uri.parse("https://liberapay.com/~968545")).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)))
.setNegativeButton("PayPal",
(dialog, id) -> startActivity(new Intent(
Intent.ACTION_VIEW,
Uri.parse(MeditationAssistant.URL_ROCKETNINELABS + "/donate")).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)))
.create();
donateDialog.show();
}
public void showStreakDifferenceWarning(int oldstreak, int newstreak, boolean twodays, Activity activity) {
try {
Looper.prepare();
@ -1306,7 +1329,7 @@ public class MeditationAssistant extends Application {
.setOngoing(true)
.setSmallIcon(R.drawable.ic_notification)
.setContentTitle(getString(!ispaused ? R.string.sessionInProgress : R.string.sessionPaused))
.setContentText(getString(R.string.appName))
.setContentText(getString(R.string.appNameShort))
.setPriority(NotificationCompat.PRIORITY_LOW)
.setContentInfo(streaktext)
.setContentIntent(pIntent)
@ -1853,6 +1876,37 @@ public class MeditationAssistant extends Application {
activity.startActivityForResult(i, resultCode);
}
public void askToDonate(Activity activity) {
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
builder.setIcon(
getResources()
.getDrawable(
getTheme()
.obtainStyledAttributes(
getMATheme(true),
new int[]{R.attr.actionIconInfo}
)
.getResourceId(0, 0)
)
)
.setTitle(getString(R.string.announcement))
.setMessage(
getString(R.string.donate156))
.setPositiveButton(getString(R.string.donate),
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
showDonationDialog(activity);
}
})
.setNegativeButton(getString(R.string.dismiss),
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
}
}).show();
}
public void showImportSessionsDialog(Activity activity) {
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
builder.setIcon(

View File

@ -59,8 +59,6 @@ public class ProgressActivity extends FragmentActivity {
setContentView(R.layout.activity_progress);
getActionBar().setDisplayHomeAsUpEnabled(true);
getMeditationAssistant().utility_ads.loadAd(this);
mViewPager = (ViewPager) findViewById(R.id.pager);
mPagerAdapter = new ProgressPagerAdapter(
@ -260,19 +258,16 @@ public class ProgressActivity extends FragmentActivity {
@Override
public void onPause() {
getMeditationAssistant().utility_ads.pauseAd(this);
super.onPause();
}
@Override
public void onResume() {
super.onResume();
getMeditationAssistant().utility_ads.resumeAd(this);
}
@Override
public void onDestroy() {
getMeditationAssistant().utility_ads.destroyAd(this);
super.onDestroy();
}

View File

@ -704,13 +704,7 @@ public class SettingsActivity extends PreferenceActivity {
}
bindPreferenceSummaryToValue(preferenceFragment == null ? findPreference("pref_theme") : preferenceFragment.findPreference("pref_theme"));
if (!BuildConfig.FLAVOR.equals("free")) {
bindPreferenceSummaryToValue(preferenceFragment == null ? findPreference("pref_widgetcolor") : preferenceFragment.findPreference("pref_widgetcolor"));
} else { // Hide widget color preference
ColorPickerPreference pref_widgetcolor = (ColorPickerPreference) (preferenceFragment == null ? findPreference("pref_widgetcolor") : preferenceFragment.findPreference("pref_widgetcolor"));
(preferenceFragment == null ? getPreferenceScreen() : preferenceFragment.getPreferenceScreen()).removePreference(pref_widgetcolor);
}
bindPreferenceSummaryToValue(preferenceFragment == null ? findPreference("pref_widgetcolor") : preferenceFragment.findPreference("pref_widgetcolor"));
if (BuildConfig.FLAVOR.equals("opensource")) { // Hide usage statistics preference, as tracking is completely disabled
CheckBoxPreference pref_sendusage = (CheckBoxPreference) (preferenceFragment == null ? findPreference("pref_sendusage") : preferenceFragment.findPreference("pref_sendusage"));

View File

@ -148,14 +148,6 @@
android:textAppearance="?android:attr/textAppearanceSmall"/>
</LinearLayout>
<RelativeLayout
android:id="@+id/adComplete"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/layLowerSessionComplete">
</RelativeLayout>
</RelativeLayout>
</RelativeLayout>
</RelativeLayout>

View File

@ -30,13 +30,6 @@
android:gravity="top"
android:orientation="vertical">
<RelativeLayout
android:id="@+id/adMain"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
</RelativeLayout>
<TextView
android:id="@+id/txtTimer"
android:layout_width="fill_parent"

View File

@ -18,11 +18,4 @@
</LinearLayout>
<RelativeLayout
android:id="@+id/adMediNET"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
</RelativeLayout>
</LinearLayout>

View File

@ -27,11 +27,4 @@
</LinearLayout>
<RelativeLayout
android:id="@+id/adProgress"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
</RelativeLayout>
</LinearLayout>

View File

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools">
<string name="appName">Meditation Assistant Free</string>
<string name="appNameShort">Meditation Assistant</string>
<string name="about">About</string>
<string name="yes">Yes</string>
@ -67,8 +66,7 @@
<string name="version">Version %s</string>
<string name="translate">Translate</string>
<string name="donate">Donate</string>
<string name="removeAds">Remove ads</string>
<string name="removeAdsHelp">The full version of Meditation Assistant is a separate application.\n\nTo keep your existing sessions, sign in to MediNET and tap "Upload sessions" in the Settings window.\n\nOpen the full version and sign in to MediNET once more, then tap "Import".</string>
<string name="chooseDonationMethod">Please choose how you would like to donate.\n\nLiberapay is preferred by the developer and supports more countries and currencies.</string>
<string name="howToMeditate">How to Meditate</string>
<string name="share">Share</string>
<!--Short text displayed in sent application invitations [CHAR LIMIT=100] -->
@ -276,13 +274,10 @@
<string name="signOutOfMediNET">Sign out of MediNET</string>
<string name="signOutOfMediNETConfirmTitle">Sign out of MediNET?</string>
<string name="rateMeditationAssistant">Rate Meditation Assistant</string>
<string name="rateMeditationAssistantText">"If you have found this application beneficial to your meditation practice, would you please add a rating\?
<string name="rateMeditationAssistantText">If you have found this application beneficial to your meditation practice, would you please add a rating?
\n
\nThe paid version of this app contains no ads and features home screen widgets. Please consider purchasing it if you are able to.
\n
\nThis dialog will not appear again."</string>
<string name="translateMeditationAssistantText">This one time you are asked to rate the app :)
\nConsider the paid version has widgets, and no ads.</string>
\nThis dialog will not appear again.</string>
<string name="translateMeditationAssistantText">Are you interested in assisting with translating Meditation Assistant?</string>
<!-- Widgets -->
<string name="widget1x1" tools:ignore="UnusedResources">Meditation Assistant 1x1</string>
<string name="widget2x1" tools:ignore="UnusedResources">Meditation Assistant 2x1</string>

View File

@ -14,4 +14,6 @@
<!-- @hide DO NOT TRANSLATE. Separator between the hour and minute elements in a TimePicker widget -->
<string name="time_picker_separator">:</string>
<string name="donate156">Advertisements have been removed from the application.\n\nIf you would like to support the continued development of Meditation Assistant, please consider donating.\n\nThis dialog will not appear again.</string>
</resources>

View File

@ -8,42 +8,6 @@
android:name="com.google.android.backup.api_key"
android:value="AEdPqrEAAAAIAUEb3SC2bBJt6pLanNwm7yB1Qy2WFS_nm7pHuw" />
<!-- Widgets -->
<!--
<receiver
android:name=".MeditationProvider1"
android:label="@string/widget1x1" >
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="@xml/widget_1" />
</receiver>-->
<receiver
android:name=".MeditationProvider2"
android:label="@string/widget2x1">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="@xml/widget_2" />
</receiver>
<receiver
android:name=".MeditationProvider3"
android:label="@string/widget3x1">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="@xml/widget_3" />
</receiver>
</application>
</manifest>

View File

@ -1,17 +0,0 @@
package sh.ftp.rocketninelabs.meditationassistant;
import android.app.Activity;
public class UtilityAdsMA {
public void loadAd(Activity activity) {
}
public void pauseAd(Activity activity) {
}
public void resumeAd(Activity activity) {
}
public void destroyAd(Activity activity) {
}
}

View File

@ -19,7 +19,6 @@ Your meditation streak is the number of consecutive days you have recorded at le
session. As your streak grows, "not breaking the chain" becomes quite important. Soon you
will be meditating once a day, even if it's five or ten minutes out of your schedule.
Features
------------
- Automatically put your device into priority only, alarms only, vibrate or silent mode while meditating
@ -28,29 +27,20 @@ Features
- Pause your session and come back to it when you are ready
- Upload sessions to [MediNET](https://gitlab.com/tslocum/medinet)
Remove Ads
------------
Please purchase the paid version of the app to remove ads. You could also use the open
source version available on F-Droid, which is ad free.
Donate
------------
- [LiberaPay](https://liberapay.com/rocketnine.space) (preferred)
- [PayPal](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=TEP9HT98XK7QA)
- [LiberaPay](https://liberapay.com/rocketnine.space)
Get Support
------------
Feel free to [open an issue](https://gitlab.com/tslocum/meditationassistant/issues) or
contact the developer: trevor@rocketnine.space
Translate
------------
Translation is handled [online](https://medinet.rocketnine.space/translate/).
Contribute
------------
1. Read the [GitLab forking workflow guide](https://docs.gitlab.com/ee/workflow/forking_workflow.html).
@ -58,7 +48,6 @@ Contribute
3. Commit code changes to your forked repository.
4. Submit a pull request describing your changes.
License
------------
**GNU GPLv3**