Android Open Source - game_guess_lib Guess Game Base App






From Project

Back to project page game_guess_lib.

License

The source code is released under:

MIT License

If you think the Android project game_guess_lib listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.wkmf.guess.lib.impl;
//from  w w  w  . j a  va2  s  .  c  o m
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.IBinder;

import com.actionbarsherlock.app.SherlockActivity;
import com.android.vending.billing.IInAppBillingService;
import com.wkmf.guess.lib.structure.GuessConfig;
import com.wkmf.guess.lib.structure.GuessGame;

/**
 * Created by ernestofndz on 22/02/14.
 */
public abstract class GuessGameBaseApp extends SherlockActivity{

    public static GuessConfig config; // configuracion del juego que hay que inicializar
    public static GuessGame guessGame; // objeto principal del juego
    private Context context; // contexto de la aplicacin
    public static IInAppBillingService inAppBillingService;

    // in app service
    public static ServiceConnection serviceConnection = new ServiceConnection() {
        @Override
        public void onServiceDisconnected(ComponentName name) {
            inAppBillingService = null;
        }
        @Override
        public void onServiceConnected(ComponentName name, IBinder service) {
            inAppBillingService = IInAppBillingService.Stub.asInterface(service);
        }
    };

    // recuperar los datos
    protected abstract void getData();
    // cargar la pantalla
    protected abstract void loadScreen();
    // que hacer al recibir un OK de la pantalla anterior
    protected abstract void resultOK();

    // get/set
    public Context getContext() {
        return context;
    }
    public void setContext(Context context) {
        this.context = context;
    }

    // animacin al pulsar el botn de atrs
    @Override
    public void onBackPressed() {
        super.onBackPressed();
        overridePendingTransition(android.R.anim.slide_in_left, android.R.anim.slide_out_right);
    }

    // recargar la pantalla cuando se recibe un OK
    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        switch (resultCode){
            case RESULT_OK:
                resultOK();
                break;
        }
    }

    // al destruirse, desconectamos el servicio
    @Override
    public void onDestroy() {
        super.onDestroy();
        if (inAppBillingService != null) {
            unbindService(serviceConnection);
        }
    }

}




Java Source Code List

com.android.vending.billing.util.Base64DecoderException.java
com.android.vending.billing.util.Base64.java
com.android.vending.billing.util.IabException.java
com.android.vending.billing.util.IabHelper.java
com.android.vending.billing.util.IabResult.java
com.android.vending.billing.util.Inventory.java
com.android.vending.billing.util.Purchase.java
com.android.vending.billing.util.Security.java
com.android.vending.billing.util.SkuDetails.java
com.wkmf.guess.lib.common.Constants.java
com.wkmf.guess.lib.common.ads.GuessGameAdsListener.java
com.wkmf.guess.lib.common.ads.GuessGameAds.java
com.wkmf.guess.lib.common.api.GuessApi.java
com.wkmf.guess.lib.common.api.GuessRestApi.java
com.wkmf.guess.lib.common.async.DownloadTask.java
com.wkmf.guess.lib.common.dialog.DialogElement.java
com.wkmf.guess.lib.common.dialog.DialogModalListAdapter.java
com.wkmf.guess.lib.common.dialog.DialogModal.java
com.wkmf.guess.lib.data.GuessGameBDDHandler.java
com.wkmf.guess.lib.data.GuessSQL.java
com.wkmf.guess.lib.impl.GuessGameBaseApp.java
com.wkmf.guess.lib.impl.GuessGameImageDownload.java
com.wkmf.guess.lib.impl.GuessGameInterface.java
com.wkmf.guess.lib.purchase.items.GuessGameItems.java
com.wkmf.guess.lib.screen.GuessLevelScreen.java
com.wkmf.guess.lib.screen.GuessMainScreen.java
com.wkmf.guess.lib.screen.GuessQuestionScreen.java
com.wkmf.guess.lib.screen.adapter.LevelsAdapter.java
com.wkmf.guess.lib.screen.adapter.QuestionsAdapter.java
com.wkmf.guess.lib.service.GuessGameService.java
com.wkmf.guess.lib.service.GuessGameUpdater.java
com.wkmf.guess.lib.service.ServiceStarter.java
com.wkmf.guess.lib.structure.GuessConfig.java
com.wkmf.guess.lib.structure.GuessDrawable.java
com.wkmf.guess.lib.structure.GuessGame.java
com.wkmf.guess.lib.structure.GuessLevelType.java
com.wkmf.guess.lib.structure.GuessLevel.java
com.wkmf.guess.lib.structure.GuessQuestion.java