1 /* ownCloud Android client application
2 * Copyright (C) 2012-2013 ownCloud Inc.
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2,
6 * as published by the Free Software Foundation.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 package com
.owncloud
.android
;
19 import com
.owncloud
.android
.lib
.common
.OwnCloudClientManagerFactory
;
20 import com
.owncloud
.android
.lib
.common
.OwnCloudClientManagerFactory
.Policy
;
22 import android
.app
.Application
;
23 import android
.content
.Context
;
25 * Main Application of the project
27 * Contains methods to build the "static" strings. These strings were before constants in different
31 * @author David A. Velasco
33 public class MainApp
extends Application
{
35 private static final String AUTH_ON
= "on";
37 @SuppressWarnings("unused")
38 private static final String POLICY_SINGLE_SESSION_PER_ACCOUNT
= "single session per account";
39 @SuppressWarnings("unused")
40 private static final String POLICY_ALWAYS_NEW_CLIENT
= "always new client";
42 private static Context mContext
;
44 public void onCreate(){
46 MainApp
.mContext
= getApplicationContext();
48 boolean isSamlAuth
= AUTH_ON
.equals(getString(R
.string
.auth_method_saml_web_sso
));
51 OwnCloudClientManagerFactory
.setDefaultPolicy(Policy
.SINGLE_SESSION_PER_ACCOUNT
);
54 OwnCloudClientManagerFactory
.setDefaultPolicy(Policy
.ALWAYS_NEW_CLIENT
);
59 public static Context
getAppContext() {
60 return MainApp
.mContext
;
63 // Methods to obtain Strings referring app_name
64 // From AccountAuthenticator
65 // public static final String ACCOUNT_TYPE = "owncloud";
66 public static String
getAccountType() {
67 return getAppContext().getResources().getString(R
.string
.account_type
);
70 // From AccountAuthenticator
71 // public static final String AUTHORITY = "org.owncloud";
72 public static String
getAuthority() {
73 return getAppContext().getResources().getString(R
.string
.authority
);
76 // From AccountAuthenticator
77 // public static final String AUTH_TOKEN_TYPE = "org.owncloud";
78 public static String
getAuthTokenType() {
79 return getAppContext().getResources().getString(R
.string
.authority
);
83 // public static final String DB_FILE = "owncloud.db";
84 public static String
getDBFile() {
85 return getAppContext().getResources().getString(R
.string
.db_file
);
89 // private final String mDatabaseName = "ownCloud";
90 public static String
getDBName() {
91 return getAppContext().getResources().getString(R
.string
.db_name
);
95 public static String
getDataFolder() {
96 return getAppContext().getResources().getString(R
.string
.data_folder
);
100 public static String
getLogName() {
101 return getAppContext().getResources().getString(R
.string
.log_name
);