mirror of https://github.com/M66B/NetGuard.git
parent
8a7061a1eb
commit
2ab2ff00ec
|
@ -69,6 +69,8 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences
|
|||
private AlertDialog dialogVpn = null;
|
||||
private AlertDialog dialogAbout = null;
|
||||
|
||||
private IAB iab = null;
|
||||
|
||||
private static final int REQUEST_VPN = 1;
|
||||
private static final int REQUEST_INVITE = 2;
|
||||
private static final int REQUEST_LOGCAT = 3;
|
||||
|
@ -254,9 +256,9 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences
|
|||
|
||||
// Update IAB SKUs
|
||||
try {
|
||||
new IAB(new IAB.Delegate() {
|
||||
iab = new IAB(new IAB.Delegate() {
|
||||
@Override
|
||||
public void onReady(IAB iab) {
|
||||
public void onReady() {
|
||||
try {
|
||||
iab.updatePurchases();
|
||||
|
||||
|
@ -272,9 +274,11 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences
|
|||
Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex));
|
||||
} finally {
|
||||
iab.unbind();
|
||||
iab = null;
|
||||
}
|
||||
}
|
||||
}, this).bind();
|
||||
}, this);
|
||||
iab.bind();
|
||||
} catch (Throwable ex) {
|
||||
Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex));
|
||||
}
|
||||
|
@ -337,6 +341,11 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences
|
|||
dialogAbout = null;
|
||||
}
|
||||
|
||||
if (iab != null) {
|
||||
iab.unbind();
|
||||
iab = null;
|
||||
}
|
||||
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
|
|
|
@ -124,7 +124,7 @@ public class ActivityPro extends AppCompatActivity {
|
|||
try {
|
||||
iab = new IAB(new IAB.Delegate() {
|
||||
@Override
|
||||
public void onReady(final IAB iab) {
|
||||
public void onReady() {
|
||||
Log.i(TAG, "IAB ready");
|
||||
try {
|
||||
iab.updatePurchases();
|
||||
|
|
|
@ -48,7 +48,7 @@ public class IAB implements ServiceConnection {
|
|||
private static final int IAB_VERSION = 3;
|
||||
|
||||
public interface Delegate {
|
||||
void onReady(IAB iab);
|
||||
void onReady();
|
||||
}
|
||||
|
||||
public IAB(Delegate delegate, Context context) {
|
||||
|
@ -75,7 +75,7 @@ public class IAB implements ServiceConnection {
|
|||
public void onServiceConnected(ComponentName name, IBinder binder) {
|
||||
Log.i(TAG, "Connected");
|
||||
service = IInAppBillingService.Stub.asInterface(binder);
|
||||
delegate.onReady(this);
|
||||
delegate.onReady();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue