This repository has been archived by the owner on Jan 6, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
/
BladeApplication.java
53 lines (49 loc) · 2.11 KB
/
BladeApplication.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package v.blade;
import android.app.Application;
import android.content.Context;
import android.content.SharedPreferences;
import android.widget.Toast;
import org.acra.ACRA;
import org.acra.config.CoreConfigurationBuilder;
import org.acra.config.HttpSenderConfigurationBuilder;
import org.acra.config.ToastConfigurationBuilder;
import org.acra.data.StringFormat;
import org.acra.sender.HttpSender;
import v.blade.ui.settings.SettingsActivity;
import v.blade.ui.settings.ThemesActivity;
public class BladeApplication extends Application
{
@Override
protected void attachBaseContext(Context base)
{
super.attachBaseContext(base);
//initialize ACRA
CoreConfigurationBuilder builder = new CoreConfigurationBuilder(this);
builder.setBuildConfigClass(BuildConfig.class)
.setReportFormat(StringFormat.JSON);
builder.getPluginConfigurationBuilder(ToastConfigurationBuilder.class)
.setResText(R.string.oncrash)
.setLength(Toast.LENGTH_LONG).setEnabled(true);
builder.getPluginConfigurationBuilder(HttpSenderConfigurationBuilder.class)
.setUri("http://valou3433.fr:5984/acra-blade/_design/acra-storage/_update/report")
.setBasicAuthLogin("REPORTER")
.setBasicAuthPassword("thereporterpassword")
.setHttpMethod(HttpSender.Method.PUT)
.setEnabled(true);
ACRA.init(this, builder);
//load saved theme
SharedPreferences generalPrefs = base.getSharedPreferences(SettingsActivity.PREFERENCES_GENERAL_FILE_NAME, Context.MODE_PRIVATE);
String theme = generalPrefs.getString("theme", null);
if(theme != null)
{
if(theme.equalsIgnoreCase("nightly"))
ThemesActivity.setThemeToNightly();
else if(theme.equalsIgnoreCase("blade"))
ThemesActivity.setThemeToBlade();
else if(theme.equalsIgnoreCase("green"))
ThemesActivity.setThemeToGreen();
else if(theme.equalsIgnoreCase("red"))
ThemesActivity.setThemeToRed();
}
}
}