// Path: src/com/beerbong/zipinst/core/Core.java
// public interface Core extends Serializable {
// 
//     public static final String PLUGIN_UI = "UIPlugin";
//     public static final String PLUGIN_SUPERUSER = "SuperUserPlugin";
//     public static final String PLUGIN_RECOVERY = "RecoveryPlugin";
//     public static final String PLUGIN_STORAGE = "StoragePlugin";
//     public static final String PLUGIN_REBOOT = "RebootPlugin";
//     public static final String PLUGIN_LICENSE = "LicensePlugin";
//     public static final String PLUGIN_UPDATE = "UpdatePlugin";
// 
//     public interface CoreListener {
// 
//         public void pluginStarted(String name);
// 
//         public void pluginStopped(String name);
// 
//         public void coreMessage(int resId);
// 
//         public void coreStarted();
// 
//         public void coreStopped();
//     }
// 
//     public void destroy();
// 
//     public boolean isStarted();
// 
//     public Context getContext();
// 
//     public void setContext(Context context);
// 
//     public Plugin getPlugin(String name);
// 
//     public Preferences getPreferences();
// 
//     public CloudStorage getCloudStorage();
// 
//     public void setCloudStorage(int cloudStorage);
// 
//     public ONandroid getONandroid();
// 
//     public Version getVersion();
// 
//     public void moveToInstall();
// }
// 
// Path: src/com/beerbong/zipinst/core/CoreFactory.java
// public class CoreFactory {
// 
//     private static Core sInstance;
// 
//     public static synchronized void init(Context context) {
//         init(context, null);
//     }
// 
//     public static synchronized void init(Context context, CoreListener listener) {
//         if (sInstance == null) {
//             sInstance = new CoreImpl(context, listener);
//         } else {
//             sInstance.setContext(context);
//         }
//     }
// 
//     public static Core getCore() {
//         return sInstance;
//     }
// 
// }
// 
// Path: src/com/beerbong/zipinst/core/plugins/ui/UIPlugin.java
// public class UIPlugin extends Plugin {
// 
//     private static final String ROBOTO_THIN = "font/Roboto-Light.ttf";
// 
//     private Map<String, UIInterface> mUiInterfaces;
//     private Typeface mRobotoThin;
// 
//     public UIPlugin(Core core) {
//         super(core, Core.PLUGIN_UI);
//     }
// 
//     @Override
//     public void start() {
//         ((CoreImpl) getCore()).setMessage(R.string.initializing_ui);
// 
// 
//         (new AsyncTask<Void, Void, Void>() {
// 
//             @Override
//             protected Void doInBackground(Void... params) {
//                 mUiInterfaces = new HashMap<String, UIInterface>();
// 
//                 mRobotoThin = Typeface
//                         .createFromAsset(getCore().getContext().getAssets(), ROBOTO_THIN);
//                 return (Void) null;
//             }
// 
//             @Override
//             protected void onPostExecute(Void result) {
//                 started();
//             }
//         }).execute((Void) null);
//     }
// 
//     @Override
//     public void stop() {
//         stopped();
//     }
// 
//     public void unregisterUI(UIInterface uIInterface) {
//         if (mUiInterfaces != null) {
//             mUiInterfaces.remove(uIInterface.getClass().getName());
//         }
//     }
// 
//     public void registerUI(UIInterface uIInterface) {
//         boolean darkTheme = getCore().getPreferences().isDarkTheme();
//         uIInterface.setTheme(darkTheme ? R.style.AppTheme_Dark
//                 : R.style.AppTheme);
// 
//         redraw(uIInterface);
// 
//         if (mUiInterfaces != null) {
//             mUiInterfaces.put(uIInterface.getClass().getName(), uIInterface);
//         }
//     }
// 
//     public void redraw() {
//         Iterator<String> it = mUiInterfaces.keySet().iterator();
//         while (it.hasNext()) {
//             String key = it.next();
//             UIInterface uiInterface = mUiInterfaces.get(key);
//             redraw(uiInterface);
//         }
//     }
// 
//     public void redraw(UIInterface uIInterface) {
//         redraw(uIInterface.getMainView());
//     }
// 
//     public void redraw(View view) {
//         setFont(view);
//     }
// 
//     private void setFont(View view) {
//         if (view == null) {
//             return;
//         }
//         if (view instanceof ViewGroup) {
//             int count = ((ViewGroup) view).getChildCount();
//             for (int i = 0; i < count; i++) {
//                 setFont(((ViewGroup) view).getChildAt(i));
//             }
//         } else if (view instanceof TextView) {
//             ((TextView) view).setTypeface(mRobotoThin);
//         }
//     }
// 
// }


import java.io.Serializable;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import com.beerbong.zipinst.core.Core;
import com.beerbong.zipinst.core.CoreFactory;
import com.beerbong.zipinst.core.plugins.ui.UIPlugin;
/*
 * Copyright 2014 ZipInstaller Project
 *
 * This file is part of ZipInstaller.
 *
 * ZipInstaller is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * ZipInstaller is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with ZipInstaller.  If not, see <http://www.gnu.org/licenses/>.
 */

package com.beerbong.zipinst.ui;




public abstract class UIActivity extends Activity implements UIInterface, Serializable {

    private Core mCore;

    @Override
    protected void onCreate(Bundle savedInstanceState) {

        CoreFactory.init(this);

        mCore = CoreFactory.getCore();

// Path: src/com/beerbong/zipinst/core/Core.java
// public interface Core extends Serializable {
// 
//     public static final String PLUGIN_UI = "UIPlugin";
//     public static final String PLUGIN_SUPERUSER = "SuperUserPlugin";
//     public static final String PLUGIN_RECOVERY = "RecoveryPlugin";
//     public static final String PLUGIN_STORAGE = "StoragePlugin";
//     public static final String PLUGIN_REBOOT = "RebootPlugin";
//     public static final String PLUGIN_LICENSE = "LicensePlugin";
//     public static final String PLUGIN_UPDATE = "UpdatePlugin";
// 
//     public interface CoreListener {
// 
//         public void pluginStarted(String name);
// 
//         public void pluginStopped(String name);
// 
//         public void coreMessage(int resId);
// 
//         public void coreStarted();
// 
//         public void coreStopped();
//     }
// 
//     public void destroy();
// 
//     public boolean isStarted();
// 
//     public Context getContext();
// 
//     public void setContext(Context context);
// 
//     public Plugin getPlugin(String name);
// 
//     public Preferences getPreferences();
// 
//     public CloudStorage getCloudStorage();
// 
//     public void setCloudStorage(int cloudStorage);
// 
//     public ONandroid getONandroid();
// 
//     public Version getVersion();
// 
//     public void moveToInstall();
// }
// 
// Path: src/com/beerbong/zipinst/core/CoreFactory.java
// public class CoreFactory {
// 
//     private static Core sInstance;
// 
//     public static synchronized void init(Context context) {
//         init(context, null);
//     }
// 
//     public static synchronized void init(Context context, CoreListener listener) {
//         if (sInstance == null) {
//             sInstance = new CoreImpl(context, listener);
//         } else {
//             sInstance.setContext(context);
//         }
//     }
// 
//     public static Core getCore() {
//         return sInstance;
//     }
// 
// }
// 
// Path: src/com/beerbong/zipinst/core/plugins/ui/UIPlugin.java
// public class UIPlugin extends Plugin {
// 
//     private static final String ROBOTO_THIN = "font/Roboto-Light.ttf";
// 
//     private Map<String, UIInterface> mUiInterfaces;
//     private Typeface mRobotoThin;
// 
//     public UIPlugin(Core core) {
//         super(core, Core.PLUGIN_UI);
//     }
// 
//     @Override
//     public void start() {
//         ((CoreImpl) getCore()).setMessage(R.string.initializing_ui);
// 
// 
//         (new AsyncTask<Void, Void, Void>() {
// 
//             @Override
//             protected Void doInBackground(Void... params) {
//                 mUiInterfaces = new HashMap<String, UIInterface>();
// 
//                 mRobotoThin = Typeface
//                         .createFromAsset(getCore().getContext().getAssets(), ROBOTO_THIN);
//                 return (Void) null;
//             }
// 
//             @Override
//             protected void onPostExecute(Void result) {
//                 started();
//             }
//         }).execute((Void) null);
//     }
// 
//     @Override
//     public void stop() {
//         stopped();
//     }
// 
//     public void unregisterUI(UIInterface uIInterface) {
//         if (mUiInterfaces != null) {
//             mUiInterfaces.remove(uIInterface.getClass().getName());
//         }
//     }
// 
//     public void registerUI(UIInterface uIInterface) {
//         boolean darkTheme = getCore().getPreferences().isDarkTheme();
//         uIInterface.setTheme(darkTheme ? R.style.AppTheme_Dark
//                 : R.style.AppTheme);
// 
//         redraw(uIInterface);
// 
//         if (mUiInterfaces != null) {
//             mUiInterfaces.put(uIInterface.getClass().getName(), uIInterface);
//         }
//     }
// 
//     public void redraw() {
//         Iterator<String> it = mUiInterfaces.keySet().iterator();
//         while (it.hasNext()) {
//             String key = it.next();
//             UIInterface uiInterface = mUiInterfaces.get(key);
//             redraw(uiInterface);
//         }
//     }
// 
//     public void redraw(UIInterface uIInterface) {
//         redraw(uIInterface.getMainView());
//     }
// 
//     public void redraw(View view) {
//         setFont(view);
//     }
// 
//     private void setFont(View view) {
//         if (view == null) {
//             return;
//         }
//         if (view instanceof ViewGroup) {
//             int count = ((ViewGroup) view).getChildCount();
//             for (int i = 0; i < count; i++) {
//                 setFont(((ViewGroup) view).getChildAt(i));
//             }
//         } else if (view instanceof TextView) {
//             ((TextView) view).setTypeface(mRobotoThin);
//         }
//     }
// 
// }


// Path: src/com/beerbong/zipinst/ui/UIActivity.java
import java.io.Serializable;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import com.beerbong.zipinst.core.Core;
import com.beerbong.zipinst.core.CoreFactory;
import com.beerbong.zipinst.core.plugins.ui.UIPlugin;

/*
 * Copyright 2014 ZipInstaller Project
 *
 * This file is part of ZipInstaller.
 *
 * ZipInstaller is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * ZipInstaller is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with ZipInstaller.  If not, see <http://www.gnu.org/licenses/>.
 */

package com.beerbong.zipinst.ui;




public abstract class UIActivity extends Activity implements UIInterface, Serializable {

    private Core mCore;

    @Override
    protected void onCreate(Bundle savedInstanceState) {

        CoreFactory.init(this);

        mCore = CoreFactory.getCore();

        ((UIPlugin) mCore.getPlugin(Core.PLUGIN_UI)).registerUI(this);