<commit_before>package com.bitdubai.android_core.app;

import android.app.ActionBar;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.StrictMode;
import android.support.v4.app.*;
import android.support.v4.view.MenuItemCompat;
import android.support.v4.view.ViewPager;
import android.support.v4.widget.DrawerLayout;

import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

//import android.support.v7.widget.SearchView;
import android.widget.SearchView;
import android.util.TypedValue;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;

import com.bitdubai.android_core.app.common.version_1.classes.MyApplication;

import com.bitdubai.android_core.app.common.version_1.classes.PagerSlidingTabStrip;

import com.bitdubai.android_core.app.common.version_1.fragment.NavigationDrawerFragment;

import com.bitdubai.android_core.app.common.PagerAdapter;
import com.bitdubai.android_core.app.subapp.shop.version_1.fragment.ShopChatFragment;
import com.bitdubai.android_core.app.subapp.shop.version_1.fragment.ShopHistoryFragment;
import com.bitdubai.android_core.app.subapp.shop.version_1.fragment.ShopMapFragment;
import com.bitdubai.android_core.app.subapp.shop.version_1.fragment.ShopProductsFragment;
import com.bitdubai.android_core.app.subapp.shop.version_1.fragment.ShopReviewsFragment;
import com.bitdubai.android_core.app.subapp.shop.version_1.fragment.ShopShopFragment;
import com.bitdubai.reference_niche_wallet.bitcoin_wallet.fragments.ReceiveFragment;

import com.bitdubai.fermat_api.layer.dmp_middleware.app_runtime.*;
import com.bitdubai.sub_app.shop_manager.fragment.ShopDesktopFragment;

import com.bitdubai.android_core.layer._2_os.android.developer.bitdubai.version_1.AndroidOsDataBaseSystem;
import com.bitdubai.android_core.layer._2_os.android.developer.bitdubai.version_1.AndroidOsFileSystem;
import com.bitdubai.android_core.layer._2_os.android.developer.bitdubai.version_1.AndroidOsLocationSystem;
import com.bitdubai.sub_app.wallet_store.fragment.AllFragment;
import com.bitdubai.sub_app.wallet_store.fragment.FreeFragment;

import com.bitdubai.fermat_api.layer.dmp_module.wallet_runtime.WalletRuntimeManager;

import com.bitdubai.sub_app.wallet_manager.fragment.WalletDesktopFragment;

import com.bitdubai.fermat_dmp_plugin.layer.middleware.app_runtime.developer.bitdubai.version_1.structure.RuntimeFragment;
import com.bitdubai.android_core.app.subapp.wallet_runtime.wallet_segment.age.sub_segment.teens.sub_segment.all.developer.bitdubai.version_1.fragment.BalanceFragment;
import com.bitdubai.android_core.app.subapp.wallet_runtime.wallet_segment.age.sub_segment.teens.sub_segment.all.developer.bitdubai.version_1.fragment.DiscountsFragment;
import com.bitdubai.android_core.app.subapp.wallet_runtime.wallet_segment.age.sub_segment.teens.sub_segment.all.developer.bitdubai.version_1.fragment.HomeFragment;
import com.bitdubai.android_core.app.subapp.wallet_runtime.wallet_segment.age.sub_segment.teens.sub_segment.all.developer.bitdubai.version_1.fragment.RefillFragment;
import com.bitdubai.android_core.app.subapp.wallet_runtime.wallet_segment.age.sub_segment.teens.sub_segment.all.developer.bitdubai.version_1.fragment.SendFragment;
import com.bitdubai.android_core.app.subapp.wallet_runtime.wallet_segment.age.sub_segment.teens.sub_segment.all.developer.bitdubai.version_1.fragment.ShopFragment;
import com.bitdubai.android_core.app.subapp.wallet_runtime.wallet_segment.age.sub_segment.teens.sub_segment.all.developer.bitdubai.version_1.fragment.AccountDetailAllFragment;
import com.bitdubai.android_core.app.subapp.wallet_runtime.wallet_segment.age.sub_segment.teens.sub_segment.all.developer.bitdubai.version_1.fragment.AccountDetailCreditsFragment;

import android.view.View;
import android.widget.TextView;
import android.widget.Toast;
import android.view.ViewGroup;

import com.bitdubai.fermat_api.CantReportCriticalStartingProblem;
import com.bitdubai.fermat_api.CantStartPlatformException;

import com.bitdubai.fermat_api.layer.dmp_middleware.app_runtime.enums.Activities;
import com.bitdubai.fermat_api.layer.dmp_middleware.app_runtime.enums.Fragments;
import com.bitdubai.fermat_api.layer.all_definition.enums.Plugins;
import com.bitdubai.fermat_core.Platform;
import com.bitdubai.smartwallet.R;


import com.bitdubai.fermat_core.CorePlatformContext;


import java.util.List;
import java.util.Map;
import java.util.Iterator;
import java.util.Vector;



/**
 * Created by toshiba on 16/02/2015.
 */
public class RuntimeAppActivity extends FragmentActivity implements NavigationDrawerFragment.NavigationDrawerCallbacks{

    private NavigationDrawerFragment NavigationDrawerFragment;

    private PagerAdapter PagerAdapter;
    public CharSequence Title; // NATALIA TODO:porque esto es publico? LUIS lo usa la funcion Restore Action bar
    private Menu menu;
    private PagerSlidingTabStrip tabStrip;
    private App app;
    private SubApp subApp;
    private Activity activity;
    private Map<Fragments, com.bitdubai.fermat_api.layer.dmp_middleware.app_runtime.Fragment> fragments;
    private AppRuntimeManager appRuntimeMiddleware;
    private WalletRuntimeManager walletRuntimeMiddleware;

    private  AndroidOsFileSystem fileSystemOs;
    private CorePlatformContext platformContext;
    private AndroidOsDataBaseSystem databaseSystemOs;
    private AndroidOsLocationSystem locationSystemOs;

    private ViewPager pager;
    private ViewPager pagertabs;
    private MyPagerAdapter adapter;
    private  TextView abTitle;
    private Drawable oldBackground = null;
    private int currentColor = 0xFF666666;
    private  MainMenu mainMenumenu;
    private SideMenu sidemenu;
    private String walletStyle = "";
    private TabStrip tabs;
    private TitleBar titleBar; // Comment
    private boolean firstexecute = true;
    private Bundle savedInstanceState;
    private ViewGroup collection;
    private Platform platform;
    private SearchView mSearchView;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);


        try {
            try {
                setContentView(R.layout.runtime_app_activity_runtime);
            }
            catch (Exception e)
            {
                System.err.println("Can't set content view as runtime_app_activity_runtime: " + e.getMessage());
            }

            this.savedInstanceState = savedInstanceState;
            //init runtime app

            Context context = this.getApplicationContext();


            platform = MyApplication.getPlatform();


            StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
            StrictMode.setThreadPolicy(policy);


            //set Os Addons in platform
            this.fileSystemOs = new AndroidOsFileSystem();
            this.fileSystemOs.setContext(this);
            platform.setFileSystemOs(fileSystemOs);


            this.databaseSystemOs = new AndroidOsDataBaseSystem();
            this.databaseSystemOs.setContext(this);
            platform.setDataBaseSystemOs(databaseSystemOs);

            this.locationSystemOs = new AndroidOsLocationSystem();
            this.locationSystemOs.setContext(this);
            platform.setLocationSystemOs(locationSystemOs);

            Bundle bundle = getIntent().getExtras();

            try
            {
                if(bundle != null){
                    if(bundle.getString("executeStart").toString() == "0")
                        platform.start();
                }else
                {
                    platform.start();
                }
            }
            catch (CantStartPlatformException | CantReportCriticalStartingProblem e) {
                System.err.println("CantStartPlatformException: " + e.getMessage());

                Toast.makeText(getApplicationContext(), "Error Started Platform, null point",
                        Toast.LENGTH_LONG).show();
            }


            //get platform object
            this.platformContext = platform.getCorePlatformContext();

            //get instances of Runtime Middleware object
            this.appRuntimeMiddleware =  (AppRuntimeManager)platformContext.getPlugin(Plugins.BITDUBAI_APP_RUNTIME_MIDDLEWARE);
            this.walletRuntimeMiddleware =  (WalletRuntimeManager)platformContext.getPlugin(Plugins.BITDUBAI_WALLET_RUNTIME_MODULE);

            //save object on global class
            MyApplication.setAppRuntime(appRuntimeMiddleware);
            MyApplication.setWalletRuntime(walletRuntimeMiddleware);

            /** Download wallet images **/

/*
           try{
                WalletResourcesManager  walletResourceManger = (WalletResourcesManager)platformContext.getPlugin(Plugins.BITDUBAI_WALLET_RESOURCES_NETWORK_SERVICE);
                walletResourceManger.setwalletType(Wallets.CWP_WALLET_RUNTIME_WALLET_AGE_KIDS_ALL_BITDUBAI);
                walletResourceManger.checkResources();
            }
            catch (CantCheckResourcesException e) {
                e.printStackTrace();}*/
<commit_msg>not to call platform start twice<commit_after>package com.bitdubai.android_core.app;

import android.app.ActionBar;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.StrictMode;
import android.support.v4.app.*;
import android.support.v4.view.MenuItemCompat;
import android.support.v4.view.ViewPager;
import android.support.v4.widget.DrawerLayout;

import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

//import android.support.v7.widget.SearchView;
import android.widget.SearchView;
import android.util.TypedValue;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;

import com.bitdubai.android_core.app.common.version_1.classes.MyApplication;

import com.bitdubai.android_core.app.common.version_1.classes.PagerSlidingTabStrip;

import com.bitdubai.android_core.app.common.version_1.fragment.NavigationDrawerFragment;

import com.bitdubai.android_core.app.common.PagerAdapter;
import com.bitdubai.android_core.app.subapp.shop.version_1.fragment.ShopChatFragment;
import com.bitdubai.android_core.app.subapp.shop.version_1.fragment.ShopHistoryFragment;
import com.bitdubai.android_core.app.subapp.shop.version_1.fragment.ShopMapFragment;
import com.bitdubai.android_core.app.subapp.shop.version_1.fragment.ShopProductsFragment;
import com.bitdubai.android_core.app.subapp.shop.version_1.fragment.ShopReviewsFragment;
import com.bitdubai.android_core.app.subapp.shop.version_1.fragment.ShopShopFragment;
import com.bitdubai.reference_niche_wallet.bitcoin_wallet.fragments.ReceiveFragment;

import com.bitdubai.fermat_api.layer.dmp_middleware.app_runtime.*;
import com.bitdubai.sub_app.shop_manager.fragment.ShopDesktopFragment;

import com.bitdubai.android_core.layer._2_os.android.developer.bitdubai.version_1.AndroidOsDataBaseSystem;
import com.bitdubai.android_core.layer._2_os.android.developer.bitdubai.version_1.AndroidOsFileSystem;
import com.bitdubai.android_core.layer._2_os.android.developer.bitdubai.version_1.AndroidOsLocationSystem;
import com.bitdubai.sub_app.wallet_store.fragment.AllFragment;
import com.bitdubai.sub_app.wallet_store.fragment.FreeFragment;

import com.bitdubai.fermat_api.layer.dmp_module.wallet_runtime.WalletRuntimeManager;

import com.bitdubai.sub_app.wallet_manager.fragment.WalletDesktopFragment;

import com.bitdubai.fermat_dmp_plugin.layer.middleware.app_runtime.developer.bitdubai.version_1.structure.RuntimeFragment;
import com.bitdubai.android_core.app.subapp.wallet_runtime.wallet_segment.age.sub_segment.teens.sub_segment.all.developer.bitdubai.version_1.fragment.BalanceFragment;
import com.bitdubai.android_core.app.subapp.wallet_runtime.wallet_segment.age.sub_segment.teens.sub_segment.all.developer.bitdubai.version_1.fragment.DiscountsFragment;
import com.bitdubai.android_core.app.subapp.wallet_runtime.wallet_segment.age.sub_segment.teens.sub_segment.all.developer.bitdubai.version_1.fragment.HomeFragment;
import com.bitdubai.android_core.app.subapp.wallet_runtime.wallet_segment.age.sub_segment.teens.sub_segment.all.developer.bitdubai.version_1.fragment.RefillFragment;
import com.bitdubai.android_core.app.subapp.wallet_runtime.wallet_segment.age.sub_segment.teens.sub_segment.all.developer.bitdubai.version_1.fragment.SendFragment;
import com.bitdubai.android_core.app.subapp.wallet_runtime.wallet_segment.age.sub_segment.teens.sub_segment.all.developer.bitdubai.version_1.fragment.ShopFragment;
import com.bitdubai.android_core.app.subapp.wallet_runtime.wallet_segment.age.sub_segment.teens.sub_segment.all.developer.bitdubai.version_1.fragment.AccountDetailAllFragment;
import com.bitdubai.android_core.app.subapp.wallet_runtime.wallet_segment.age.sub_segment.teens.sub_segment.all.developer.bitdubai.version_1.fragment.AccountDetailCreditsFragment;

import android.view.View;
import android.widget.TextView;
import android.widget.Toast;
import android.view.ViewGroup;

import com.bitdubai.fermat_api.CantReportCriticalStartingProblem;
import com.bitdubai.fermat_api.CantStartPlatformException;

import com.bitdubai.fermat_api.layer.dmp_middleware.app_runtime.enums.Activities;
import com.bitdubai.fermat_api.layer.dmp_middleware.app_runtime.enums.Fragments;
import com.bitdubai.fermat_api.layer.all_definition.enums.Plugins;
import com.bitdubai.fermat_core.Platform;
import com.bitdubai.smartwallet.R;


import com.bitdubai.fermat_core.CorePlatformContext;


import java.util.List;
import java.util.Map;
import java.util.Iterator;
import java.util.Vector;



/**
 * Created by toshiba on 16/02/2015.
 */
public class RuntimeAppActivity extends FragmentActivity implements NavigationDrawerFragment.NavigationDrawerCallbacks{

    private NavigationDrawerFragment NavigationDrawerFragment;

    private PagerAdapter PagerAdapter;
    public CharSequence Title; // NATALIA TODO:porque esto es publico? LUIS lo usa la funcion Restore Action bar
    private Menu menu;
    private PagerSlidingTabStrip tabStrip;
    private App app;
    private SubApp subApp;
    private Activity activity;
    private Map<Fragments, com.bitdubai.fermat_api.layer.dmp_middleware.app_runtime.Fragment> fragments;
    private AppRuntimeManager appRuntimeMiddleware;
    private WalletRuntimeManager walletRuntimeMiddleware;

    private  AndroidOsFileSystem fileSystemOs;
    private CorePlatformContext platformContext;
    private AndroidOsDataBaseSystem databaseSystemOs;
    private AndroidOsLocationSystem locationSystemOs;

    private ViewPager pager;
    private ViewPager pagertabs;
    private MyPagerAdapter adapter;
    private  TextView abTitle;
    private Drawable oldBackground = null;
    private int currentColor = 0xFF666666;
    private  MainMenu mainMenumenu;
    private SideMenu sidemenu;
    private String walletStyle = "";
    private TabStrip tabs;
    private TitleBar titleBar; // Comment
    private boolean firstexecute = true;
    private Bundle savedInstanceState;
    private ViewGroup collection;
    private Platform platform;
    private SearchView mSearchView;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);


        try {
            try {
                setContentView(R.layout.runtime_app_activity_runtime);
            }
            catch (Exception e)
            {
                System.err.println("Can't set content view as runtime_app_activity_runtime: " + e.getMessage());
            }

            this.savedInstanceState = savedInstanceState;
            //init runtime app

            Context context = this.getApplicationContext();


            platform = MyApplication.getPlatform();


            StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
            StrictMode.setThreadPolicy(policy);


            //set Os Addons in platform
            this.fileSystemOs = new AndroidOsFileSystem();
            this.fileSystemOs.setContext(this);
            platform.setFileSystemOs(fileSystemOs);


            this.databaseSystemOs = new AndroidOsDataBaseSystem();
            this.databaseSystemOs.setContext(this);
            platform.setDataBaseSystemOs(databaseSystemOs);

            this.locationSystemOs = new AndroidOsLocationSystem();
            this.locationSystemOs.setContext(this);
            platform.setLocationSystemOs(locationSystemOs);

            Bundle bundle = getIntent().getExtras();

            try {
                if (bundle != null) {
                    if (bundle.getString("executeStart").toString() == "0") {
                        if (firstexecute)
                            platform.start();
                    }
                } else {
                    if (firstexecute)
                        platform.start();
                }
            } catch (CantStartPlatformException | CantReportCriticalStartingProblem e) {
                System.err.println("CantStartPlatformException: " + e.getMessage());

                Toast.makeText(getApplicationContext(), "Error Started Platform, null point",
                        Toast.LENGTH_LONG).show();
            }


            //get platform object
            this.platformContext = platform.getCorePlatformContext();

            //get instances of Runtime Middleware object
            this.appRuntimeMiddleware =  (AppRuntimeManager)platformContext.getPlugin(Plugins.BITDUBAI_APP_RUNTIME_MIDDLEWARE);
            this.walletRuntimeMiddleware =  (WalletRuntimeManager)platformContext.getPlugin(Plugins.BITDUBAI_WALLET_RUNTIME_MODULE);

            //save object on global class
            MyApplication.setAppRuntime(appRuntimeMiddleware);
            MyApplication.setWalletRuntime(walletRuntimeMiddleware);

            /** Download wallet images **/

/*
           try{
                WalletResourcesManager  walletResourceManger = (WalletResourcesManager)platformContext.getPlugin(Plugins.BITDUBAI_WALLET_RESOURCES_NETWORK_SERVICE);
                walletResourceManger.setwalletType(Wallets.CWP_WALLET_RUNTIME_WALLET_AGE_KIDS_ALL_BITDUBAI);
                walletResourceManger.checkResources();
            }
            catch (CantCheckResourcesException e) {
                e.printStackTrace();}*/

{'fraction_non_alphanumeric': 0.08366811291445712, 'fraction_numerical': 0.005142214366061385, 'mean_word_length': 4.013426423200859, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3025109', 'n_tokens_mistral': 5563, 'n_tokens_neox': 5475, 'n_words': 747}