|
|
@ -1,13 +1,14 @@
|
|
|
|
package com.todoroo.astrid.billing;
|
|
|
|
package com.todoroo.astrid.billing;
|
|
|
|
|
|
|
|
|
|
|
|
import android.app.Activity;
|
|
|
|
import android.app.Activity;
|
|
|
|
|
|
|
|
import android.content.DialogInterface;
|
|
|
|
import android.os.Handler;
|
|
|
|
import android.os.Handler;
|
|
|
|
import android.util.Log;
|
|
|
|
import android.util.Log;
|
|
|
|
import android.widget.Toast;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.timsu.astrid.R;
|
|
|
|
import com.timsu.astrid.R;
|
|
|
|
import com.todoroo.andlib.service.Autowired;
|
|
|
|
import com.todoroo.andlib.service.Autowired;
|
|
|
|
import com.todoroo.andlib.service.DependencyInjectionService;
|
|
|
|
import com.todoroo.andlib.service.DependencyInjectionService;
|
|
|
|
|
|
|
|
import com.todoroo.andlib.utility.DialogUtilities;
|
|
|
|
import com.todoroo.andlib.utility.Preferences;
|
|
|
|
import com.todoroo.andlib.utility.Preferences;
|
|
|
|
import com.todoroo.astrid.actfm.sync.ActFmPreferenceService;
|
|
|
|
import com.todoroo.astrid.actfm.sync.ActFmPreferenceService;
|
|
|
|
import com.todoroo.astrid.actfm.sync.ActFmSyncService;
|
|
|
|
import com.todoroo.astrid.actfm.sync.ActFmSyncService;
|
|
|
@ -56,6 +57,7 @@ public abstract class AstridPurchaseObserver extends PurchaseObserver {
|
|
|
|
|
|
|
|
|
|
|
|
protected abstract void subscriptionsNotSupportedCallback();
|
|
|
|
protected abstract void subscriptionsNotSupportedCallback();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void onPurchaseStateChange(PurchaseState purchaseState, final String itemId,
|
|
|
|
public void onPurchaseStateChange(PurchaseState purchaseState, final String itemId,
|
|
|
|
int quantity, long purchaseTime, String developerPayload, final String purchaseToken) {
|
|
|
|
int quantity, long purchaseTime, String developerPayload, final String purchaseToken) {
|
|
|
@ -79,7 +81,13 @@ public abstract class AstridPurchaseObserver extends PurchaseObserver {
|
|
|
|
mActivity.runOnUiThread(new Runnable() {
|
|
|
|
mActivity.runOnUiThread(new Runnable() {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void run() {
|
|
|
|
public void run() {
|
|
|
|
Toast.makeText(mActivity, R.string.premium_success, Toast.LENGTH_LONG).show();
|
|
|
|
DialogUtilities.okDialog(mActivity, mActivity.getString(R.string.DLG_information_title),
|
|
|
|
|
|
|
|
0, mActivity.getString(R.string.premium_success), new DialogInterface.OnClickListener() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void onClick(DialogInterface dialog, int which) {
|
|
|
|
|
|
|
|
mActivity.finish();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -89,11 +97,19 @@ public abstract class AstridPurchaseObserver extends PurchaseObserver {
|
|
|
|
mActivity.runOnUiThread(new Runnable() {
|
|
|
|
mActivity.runOnUiThread(new Runnable() {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void run() {
|
|
|
|
public void run() {
|
|
|
|
Toast.makeText(mActivity, R.string.premium_success_with_server_error, Toast.LENGTH_LONG).show();
|
|
|
|
DialogUtilities.okDialog(mActivity, mActivity.getString(R.string.DLG_information_title),
|
|
|
|
|
|
|
|
0, mActivity.getString(R.string.premium_success_with_server_error), new DialogInterface.OnClickListener() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void onClick(DialogInterface dialog, int which) {
|
|
|
|
|
|
|
|
mActivity.finish();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
Preferences.setBoolean(BillingConstants.PREF_NEEDS_SERVER_UPDATE, true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}.start();
|
|
|
|
}.start();
|
|
|
|