8783daffa3161b5548910d44bd36d88ff866e8bd
[pub/Android/ownCloud.git] / oc_framework / src / com / owncloud / android / oc_framework / MainApp.java
1 package com.owncloud.android.oc_framework;
2
3 import android.app.Application;
4 import android.content.Context;
5
6 public class MainApp extends Application {
7
8 private static Context mContext;
9
10 public void onCreate(){
11 super.onCreate();
12 MainApp.mContext = getApplicationContext();
13 }
14
15 public static Context getAppContext() {
16 return MainApp.mContext;
17 }
18
19 // Methods to obtain Strings referring app_name
20 // From AccountAuthenticator
21 // public static final String ACCOUNT_TYPE = "owncloud";
22 public static String getAccountType() {
23 return getAppContext().getResources().getString(R.string.account_type);
24 }
25
26 // From AccountAuthenticator
27 // public static final String AUTHORITY = "org.owncloud";
28 public static String getAuthority() {
29 return getAppContext().getResources().getString(R.string.authority);
30 }
31
32 // From AccountAuthenticator
33 // public static final String AUTH_TOKEN_TYPE = "org.owncloud";
34 public static String getAuthTokenType() {
35 return getAppContext().getResources().getString(R.string.authority);
36 }
37
38 // From AccountAuthenticator
39 // public static final String AUTH_TOKEN_TYPE_PASSWORD = "owncloud.password";
40 public static String getAuthTokenTypePass() {
41 return getAppContext().getResources().getString(R.string.account_type) + ".password";
42 }
43
44 // From AccountAuthenticator
45 // public static final String AUTH_TOKEN_TYPE_ACCESS_TOKEN = "owncloud.oauth2.access_token";
46 public static String getAuthTokenTypeAccessToken() {
47 return getAppContext().getResources().getString(R.string.account_type) + ".oauth2.access_token";
48 }
49
50 // From AccountAuthenticator
51 // public static final String AUTH_TOKEN_TYPE_REFRESH_TOKEN = "owncloud.oauth2.refresh_token";
52 public static String getAuthTokenTypeRefreshToken() {
53 return getAppContext().getResources().getString(R.string.account_type) + ".oauth2.refresh_token";
54 }
55
56 // From AccountAuthenticator
57 // public static final String AUTH_TOKEN_TYPE_SAML_WEB_SSO_SESSION_COOKIE = "owncloud.saml.web_sso.session_cookie";
58 public static String getAuthTokenTypeSamlSessionCookie() {
59 return getAppContext().getResources().getString(R.string.account_type) + ".saml.web_sso.session_cookie";
60 }
61
62 }