Android Open Source - sigimera-android-app Application Controller






From Project

Back to project page sigimera-android-app.

License

The source code is released under:

GNU General Public License

If you think the Android project sigimera-android-app 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

/**
 * Sigimera Crises Information Platform Android Client
 * Copyright (C) 2012 by Sigimera/*  ww w .jav a  2  s .  c o m*/
 * All Rights Reserved
 * 
 * This program 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 2 of the License, or (at your option)
 * any later version.
 *
 * This program 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 this program; if not, write to the Free Software Foundation, Inc., 51
 * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 */
package org.sigimera.app.android.controller;

import org.sigimera.app.android.backend.PersistentStorage;

import android.app.ActionBar;
import android.content.Context;
import android.content.SharedPreferences;

public class ApplicationController {
  public static ApplicationController instance = null;
  
  private SessionHandler sessionHandler;
  
  private Context context;
  private SharedPreferences settings;
  private PersistentStorage pershandler;
  private ActionBar actionBar;
  
  private boolean updatingEverything = false;
  private boolean updateOnce = false;
  
  private ApplicationController() {}
  
  public static ApplicationController getInstance() {
    if ( null == instance )
      instance = new ApplicationController();
    return instance;
  }
  
  public void init(Context _context, SharedPreferences _settings, ActionBar _actionBar) {
    this.context = _context;
    this.settings = _settings;
    this.pershandler = PersistentStorage.getInstance();
    this.sessionHandler = SessionHandler.getInstance(this.settings);
    this.actionBar = _actionBar;
  }
  
  public void setApplicationContext(Context _context) {
    this.context = _context;
  }
  
  public void setSharedPreferences(SharedPreferences _settings) {
    this.settings = _settings;
  }
  
  public void setActionbar(ActionBar _actionBar) {
    this.actionBar = _actionBar;        
  }
  
  public synchronized void setEverythingUpdated(boolean _updatingEverything) {
    updatingEverything = _updatingEverything;
  }
  
  public synchronized void setUpdatedOnce(boolean _update) {
    updateOnce = _update;
  }
  
  public Context getApplicationContext() { return this.context; }
  public PersistentStorage getPersistentStorageHandler() { return this.pershandler; }
  public ActionBar getActionbar() { return this.actionBar; }
  
  public SessionHandler getSessionHandler() { return this.sessionHandler; }
  
  public SharedPreferences getSharedPreferences() { return this.settings; }
  public SharedPreferences getSharedPreferences(String preferenceName) {
      return context.getSharedPreferences(preferenceName, 0);      
    }
  
  public synchronized boolean isEverythingUpdated() {
    return updatingEverything;
  }  
  
  public synchronized boolean isUpdatedOne() {
    return updateOnce;
  }
}




Java Source Code List

org.sigimera.app.android.CrisesListFragment.java
org.sigimera.app.android.CrisisActivity.java
org.sigimera.app.android.CrisisAlertActivity.java
org.sigimera.app.android.GCMIntentService.java
org.sigimera.app.android.LoginFragment.java
org.sigimera.app.android.MainActivity.java
org.sigimera.app.android.OfflineMode.java
org.sigimera.app.android.ProfileFragment.java
org.sigimera.app.android.StatisticFragment.java
org.sigimera.app.android.StatsFragment.java
org.sigimera.app.android.TabManager.java
org.sigimera.app.android.TabsAdapter.java
org.sigimera.app.android.ToastNotification.java
org.sigimera.app.android.backend.PersistentStorage.java
org.sigimera.app.android.backend.auth.AccountAuthenticator.java
org.sigimera.app.android.backend.auth.AuthenticationService.java
org.sigimera.app.android.backend.auth.AuthenticatorActivity.java
org.sigimera.app.android.backend.network.CrisesHttpHelper.java
org.sigimera.app.android.backend.network.LocationUpdaterHttpHelper.java
org.sigimera.app.android.backend.network.LoginHttpHelper.java
org.sigimera.app.android.backend.network.MyHttpClient.java
org.sigimera.app.android.backend.network.NearCrisesHttpHelper.java
org.sigimera.app.android.backend.network.SingleCrisisHttpHelper.java
org.sigimera.app.android.backend.network.StatisticCrisesHttpHelper.java
org.sigimera.app.android.backend.network.StatisticUsersHttpHelper.java
org.sigimera.app.android.controller.ApplicationController.java
org.sigimera.app.android.controller.DistanceController.java
org.sigimera.app.android.controller.LocationController.java
org.sigimera.app.android.controller.PersistanceController.java
org.sigimera.app.android.controller.SessionHandler.java
org.sigimera.app.android.exception.AuthenticationErrorException.java
org.sigimera.app.android.model.Constants.java
org.sigimera.app.android.model.CrisesStats.java
org.sigimera.app.android.model.Crisis.java
org.sigimera.app.android.model.UserSettings.java
org.sigimera.app.android.model.User.java
org.sigimera.app.android.model.UsersStats.java
org.sigimera.app.android.model.map.CollectionOverlay.java
org.sigimera.app.android.util.Common.java
org.sigimera.app.android.util.Config.java
org.sigimera.app.android.util.MD5Util.java