Merge branch 'develop' into refactor_remote_operation_to_create_folder
[pub/Android/ownCloud.git] / src / com / owncloud / android / MainApp.java
1 /* ownCloud Android client application
2 * Copyright (C) 2012-2013 ownCloud Inc.
3 *
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.
7 *
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.
12 *
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/>.
15 *
16 */
17 package com.owncloud.android;
18
19 import android.app.Application;
20 import android.content.Context;
21 /**
22 * Main Application of the project
23 *
24 * Contains methods to build the "static" strings. These strings were before constants in different classes
25 *
26 * @author masensio
27 */
28 public class MainApp extends Application {
29
30 private static Context mContext;
31
32 public void onCreate(){
33 super.onCreate();
34 MainApp.mContext = getApplicationContext();
35 }
36
37 public static Context getAppContext() {
38 return MainApp.mContext;
39 }
40
41 // Methods to obtain Strings referring app_name
42 // From AccountAuthenticator
43 // public static final String ACCOUNT_TYPE = "owncloud";
44 public static String getAccountType() {
45 return getAppContext().getResources().getString(R.string.account_type);
46 }
47
48 // From AccountAuthenticator
49 // public static final String AUTHORITY = "org.owncloud";
50 public static String getAuthority() {
51 return getAppContext().getResources().getString(R.string.authority);
52 }
53
54 // From AccountAuthenticator
55 // public static final String AUTH_TOKEN_TYPE = "org.owncloud";
56 public static String getAuthTokenType() {
57 return getAppContext().getResources().getString(R.string.authority);
58 }
59
60 // From ProviderMeta
61 // public static final String DB_FILE = "owncloud.db";
62 public static String getDBFile() {
63 return getAppContext().getResources().getString(R.string.db_file);
64 }
65
66 // From ProviderMeta
67 // private final String mDatabaseName = "ownCloud";
68 public static String getDBName() {
69 return getAppContext().getResources().getString(R.string.db_name);
70 }
71
72 // data_folder
73 public static String getDataFolder() {
74 return getAppContext().getResources().getString(R.string.data_folder);
75 }
76
77 // log_name
78 public static String getLogName() {
79 return getAppContext().getResources().getString(R.string.log_name);
80 }
81 }