├── .gitignore
├── .travis.yml
├── README.md
├── app
├── .gitignore
├── build.gradle
├── fabric.properties
├── google-services.json
├── libs
│ └── gcm.jar
├── proguard-rules.pro
├── src
│ └── main
│ │ ├── AndroidManifest.xml
│ │ ├── assets
│ │ ├── integreat.html
│ │ ├── jquery-2.1.4.min.js
│ │ └── style.css
│ │ ├── java
│ │ └── augsburg
│ │ │ └── se
│ │ │ └── alltagsguide
│ │ │ ├── BaseApplication.java
│ │ │ ├── MainModule.java
│ │ │ ├── ServicesModule.java
│ │ │ ├── common
│ │ │ ├── Author.java
│ │ │ ├── AvailableLanguage.java
│ │ │ ├── Event.java
│ │ │ ├── EventCategory.java
│ │ │ ├── EventLocation.java
│ │ │ ├── EventPage.java
│ │ │ ├── EventTag.java
│ │ │ ├── Language.java
│ │ │ ├── Location.java
│ │ │ ├── Page.java
│ │ │ └── UpdateTime.java
│ │ │ ├── event
│ │ │ ├── EventActivity.java
│ │ │ ├── EventOverviewFragment.java
│ │ │ └── EventPageAdapter.java
│ │ │ ├── gcm
│ │ │ ├── GCMCommand.java
│ │ │ ├── GCMIntentService.java
│ │ │ ├── GCMRedirectedBroadcastReceiver.java
│ │ │ ├── ServerUtilities.java
│ │ │ └── command
│ │ │ │ ├── AnnouncementCommand.java
│ │ │ │ └── TestCommand.java
│ │ │ ├── navigation
│ │ │ └── NavigationAdapter.java
│ │ │ ├── network
│ │ │ ├── DisclaimersLoader.java
│ │ │ ├── EventPageLoader.java
│ │ │ ├── EventPagesLoader.java
│ │ │ ├── LanguageLoader.java
│ │ │ ├── LocationLoader.java
│ │ │ ├── NetworkService.java
│ │ │ ├── NetworkServiceMock.java
│ │ │ ├── PageLoader.java
│ │ │ └── PagesLoader.java
│ │ │ ├── overview
│ │ │ └── OverviewActivity.java
│ │ │ ├── page
│ │ │ ├── PageActivity.java
│ │ │ ├── PageAdapter.java
│ │ │ └── PageOverviewFragment.java
│ │ │ ├── persistence
│ │ │ ├── CacheHelper.java
│ │ │ ├── DatabaseCache.java
│ │ │ ├── DatabaseInfo.java
│ │ │ └── resources
│ │ │ │ ├── AvailableLanguageResource.java
│ │ │ │ ├── DisclaimerResource.java
│ │ │ │ ├── EventCategoryResource.java
│ │ │ │ ├── EventPageResource.java
│ │ │ │ ├── EventTagResource.java
│ │ │ │ ├── LanguageResource.java
│ │ │ │ ├── LocationResource.java
│ │ │ │ ├── PageResource.java
│ │ │ │ ├── PersistableNetworkResource.java
│ │ │ │ └── PersistableResource.java
│ │ │ ├── serialization
│ │ │ ├── EventPageSerializer.java
│ │ │ ├── LanguageSerializer.java
│ │ │ ├── LocationSerializer.java
│ │ │ └── PageSerializer.java
│ │ │ ├── settings
│ │ │ ├── PrefFragment.java
│ │ │ └── SettingsActivity.java
│ │ │ ├── start
│ │ │ ├── LanguageAdapter.java
│ │ │ ├── LanguageFragment.java
│ │ │ ├── LocationAdapter.java
│ │ │ ├── LocationFragment.java
│ │ │ └── WelcomeActivity.java
│ │ │ └── utilities
│ │ │ ├── AsyncLoader.java
│ │ │ ├── BaseListFragment.java
│ │ │ ├── BasicLoader.java
│ │ │ ├── ColorManager.java
│ │ │ ├── CommonUtilities.java
│ │ │ ├── FileHelper.java
│ │ │ ├── FontStyle.java
│ │ │ ├── Helper.java
│ │ │ ├── LoadingType.java
│ │ │ ├── Newer.java
│ │ │ ├── Objects.java
│ │ │ ├── PrefUtilities.java
│ │ │ ├── broadcast
│ │ │ ├── NetworkChangeEvent.java
│ │ │ └── NetworkChangeReceiver.java
│ │ │ └── ui
│ │ │ ├── BaseActivity.java
│ │ │ ├── BaseAdapter.java
│ │ │ ├── BaseFragment.java
│ │ │ ├── BasePageWebViewLanguageActivity.java
│ │ │ ├── BitmapColorTransformation.java
│ │ │ ├── BitmapInvertTransformation.java
│ │ │ ├── EmptyRecyclerView.java
│ │ │ ├── LanguageItemAdapter.java
│ │ │ ├── MyLinearLayoutManager.java
│ │ │ └── MyWebViewClient.java
│ │ └── res
│ │ ├── drawable-hdpi
│ │ ├── icon_language_loading.png
│ │ ├── icon_language_loading_error.png
│ │ ├── icon_location_loading.png
│ │ ├── icon_location_loading_error.png
│ │ ├── no_events_found.png
│ │ ├── no_languages_found.png
│ │ ├── no_locations_found.png
│ │ └── no_pages_found.png
│ │ ├── drawable-ldpi
│ │ ├── icon_language_loading.png
│ │ ├── icon_language_loading_error.png
│ │ ├── icon_location_loading.png
│ │ ├── icon_location_loading_error.png
│ │ ├── no_events_found.png
│ │ ├── no_languages_found.png
│ │ ├── no_locations_found.png
│ │ └── no_pages_found.png
│ │ ├── drawable-mdpi
│ │ ├── icon_language_loading.png
│ │ ├── icon_language_loading_error.png
│ │ ├── icon_location_loading.png
│ │ ├── icon_location_loading_error.png
│ │ ├── no_events_found.png
│ │ ├── no_languages_found.png
│ │ ├── no_locations_found.png
│ │ └── no_pages_found.png
│ │ ├── drawable-nodpi
│ │ ├── brandenburger_tor.jpg
│ │ └── circle_background.png
│ │ ├── drawable-tvdpi
│ │ ├── no_events_found.png
│ │ ├── no_locations_found.png
│ │ └── no_pages_found.png
│ │ ├── drawable-xhdpi
│ │ ├── icon_language_loading.png
│ │ ├── icon_language_loading_error.png
│ │ ├── icon_location_loading.png
│ │ ├── icon_location_loading_error.png
│ │ ├── no_events_found.png
│ │ ├── no_languages_found.png
│ │ ├── no_locations_found.png
│ │ └── no_pages_found.png
│ │ ├── drawable-xxhdpi
│ │ ├── icon_language_loading.png
│ │ ├── icon_language_loading_error.png
│ │ ├── icon_location_loading.png
│ │ ├── icon_location_loading_error.png
│ │ ├── no_events_found.png
│ │ ├── no_languages_found.png
│ │ ├── no_locations_found.png
│ │ └── no_pages_found.png
│ │ ├── drawable-xxxhdpi
│ │ ├── no_events_found.png
│ │ ├── no_languages_found.png
│ │ ├── no_locations_found.png
│ │ └── no_pages_found.png
│ │ ├── layout-land
│ │ ├── page_event_item.xml
│ │ └── page_item.xml
│ │ ├── layout
│ │ ├── activity_event.xml
│ │ ├── activity_overview.xml
│ │ ├── activity_page.xml
│ │ ├── activity_settings.xml
│ │ ├── activity_welcome.xml
│ │ ├── category_item.xml
│ │ ├── dialog_language_item.xml
│ │ ├── events_empty_view.xml
│ │ ├── fragment_event_pages.xml
│ │ ├── fragment_language.xml
│ │ ├── fragment_location.xml
│ │ ├── fragment_pages.xml
│ │ ├── language_item_view.xml
│ │ ├── languages_empty_view.xml
│ │ ├── location_item_view.xml
│ │ ├── locations_empty_view.xml
│ │ ├── navigation_empty_view.xml
│ │ ├── navigation_header_view.xml
│ │ ├── navigation_item.xml
│ │ ├── page_event_item.xml
│ │ ├── page_item.xml
│ │ ├── pages_empty_view.xml
│ │ └── tag_item.xml
│ │ ├── menu
│ │ ├── menu_welcome.xml
│ │ └── overview.xml
│ │ ├── mipmap-hdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-mdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xhdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xxhdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xxxhdpi
│ │ └── ic_launcher.png
│ │ ├── values-de
│ │ └── strings.xml
│ │ ├── values-fa
│ │ └── strings.xml
│ │ ├── values-fr
│ │ └── strings.xml
│ │ ├── values-land
│ │ └── integers.xml
│ │ ├── values-v19
│ │ └── styles.xml
│ │ ├── values
│ │ ├── arrays.xml
│ │ ├── attrs.xml
│ │ ├── colors.xml
│ │ ├── integers.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ │ └── xml
│ │ └── preferences.xml
└── version.properties
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── license.txt
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | # Created by https://www.gitignore.io/api/android,eclipse,intellij,netbeans,gradle,java,maven
2 |
3 | ### Android ###
4 | # Built application files
5 | *.apk
6 | *.ap_
7 |
8 | # Files for the Dalvik VM
9 | *.dex
10 |
11 | # Java class files
12 | *.class
13 |
14 | # Generated files
15 | bin/
16 | gen/
17 |
18 | # Gradle files
19 | .gradle/
20 | build/
21 |
22 | # Local configuration file (sdk path, etc)
23 | local.properties
24 |
25 | # Proguard folder generated by Eclipse
26 | proguard/
27 |
28 | # Log Files
29 | *.log
30 |
31 | # Android Studio Navigation editor temp files
32 | .navigation/
33 |
34 | ### Android Patch ###
35 | gen-external-apklibs
36 |
37 |
38 | ### Eclipse ###
39 | *.pydevproject
40 | .metadata
41 | .gradle
42 | bin/
43 | tmp/
44 | *.tmp
45 | *.bak
46 | *.swp
47 | *~.nib
48 | local.properties
49 | .settings/
50 | .loadpath
51 |
52 | # Eclipse Core
53 | .project
54 |
55 | # External tool builders
56 | .externalToolBuilders/
57 |
58 | # Locally stored "Eclipse launch configurations"
59 | *.launch
60 |
61 | # CDT-specific
62 | .cproject
63 |
64 | # JDT-specific (Eclipse Java Development Tools)
65 | .classpath
66 |
67 | # Java annotation processor (APT)
68 | .factorypath
69 |
70 | # PDT-specific
71 | .buildpath
72 |
73 | # sbteclipse plugin
74 | .target
75 |
76 | # TeXlipse plugin
77 | .texlipse
78 |
79 |
80 | ### Intellij ###
81 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio
82 |
83 | *.iml
84 |
85 | ## Directory-based project format:
86 | .idea/
87 | # if you remove the above rule, at least ignore the following:
88 |
89 | # User-specific stuff:
90 | # .idea/workspace.xml
91 | # .idea/tasks.xml
92 | # .idea/dictionaries
93 |
94 | # Sensitive or high-churn files:
95 | # .idea/dataSources.ids
96 | # .idea/dataSources.xml
97 | # .idea/sqlDataSources.xml
98 | # .idea/dynamic.xml
99 | # .idea/uiDesigner.xml
100 |
101 | # Gradle:
102 | # .idea/gradle.xml
103 | # .idea/libraries
104 |
105 | # Mongo Explorer plugin:
106 | # .idea/mongoSettings.xml
107 |
108 | ## File-based project format:
109 | *.ipr
110 | *.iws
111 |
112 | ## Plugin-specific files:
113 |
114 | # IntelliJ
115 | /out/
116 |
117 | # mpeltonen/sbt-idea plugin
118 | .idea_modules/
119 |
120 | # JIRA plugin
121 | atlassian-ide-plugin.xml
122 |
123 | # Crashlytics plugin (for Android Studio and IntelliJ)
124 | com_crashlytics_export_strings.xml
125 | crashlytics.properties
126 | crashlytics-build.properties
127 |
128 |
129 | ### NetBeans ###
130 | nbproject/private/
131 | build/
132 | nbbuild/
133 | dist/
134 | nbdist/
135 | nbactions.xml
136 | nb-configuration.xml
137 | .nb-gradle/
138 |
139 |
140 | ### Gradle ###
141 | .gradle
142 | build/
143 |
144 | # Ignore Gradle GUI config
145 | gradle-app.setting
146 |
147 | # Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
148 | !gradle-wrapper.jar
149 |
150 |
151 | ### Java ###
152 | *.class
153 |
154 | # Mobile Tools for Java (J2ME)
155 | .mtj.tmp/
156 |
157 | # Package Files #
158 | *.war
159 | *.ear
160 |
161 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
162 | hs_err_pid*
163 |
164 |
165 | ### Maven ###
166 | target/
167 | pom.xml.tag
168 | pom.xml.releaseBackup
169 | pom.xml.versionsBackup
170 | pom.xml.next
171 | release.properties
172 | dependency-reduced-pom.xml
173 | buildNumber.properties
174 | .mvn/timing.properties
175 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: android
2 | android:
3 | components:
4 | - tools
5 | - platform-tools
6 | - android-23
7 | - build-tools-23.0.2
8 | - extra
9 |
10 | jdk: oraclejdk7
11 |
12 | notifications:
13 | email: false
14 |
15 | sudo: false
16 |
17 | before_script:
18 | - chmod +x gradlew
19 |
20 | script:
21 | - ./gradlew clean build
22 |
23 | before_cache:
24 | - rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
25 | cache:
26 | directories:
27 | - $HOME/.gradle/caches/
28 | - $HOME/.gradle/wrapper/
29 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | [](https://travis-ci.org/Integreat/app-android)
2 | [](https://dashboard.buddybuild.com/apps/56ac36b536e4870100da4adb/build/latest)
3 |
4 | # Integreat
5 | ###### ehemals Refguide+
6 |
7 | Der mobile Alltagsguide für Flüchtlinge.
8 | Einfach. Digital. Kostenlos.
9 |
10 | www.integreat-app.de
11 |
12 |
13 | ## Collaboration
14 | Feel free to check out the [issues](https://github.com/Integreat/app/issues), fork this repository and send in some pull requests.
15 |
16 | ## License
17 | The source code is licensed under the Lesser General Public License (LGPL) v3
18 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/fabric.properties:
--------------------------------------------------------------------------------
1 | #
2 | # This file is part of Integreat.
3 | #
4 | # Integreat is free software: you can redistribute it and/or modify
5 | # it under the terms of the GNU General Public License as published by
6 | # the Free Software Foundation, either version 3 of the License, or
7 | # (at your option) any later version.
8 | #
9 | # Integreat is distributed in the hope that it will be useful,
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | # GNU General Public License for more details.
13 | #
14 | # You should have received a copy of the GNU General Public License
15 | # along with Integreat. If not, see .
16 | #
17 |
18 | #Contains API Secret used to validate your application. Commit to internal source control; avoid making secret public.
19 | #Wed Sep 30 00:56:18 PDT 2015
20 | apiSecret=d68d280c2620a7762e74f2890e54a9284e75bab6e48c4b4b4565817e1a6108f3
21 |
--------------------------------------------------------------------------------
/app/google-services.json:
--------------------------------------------------------------------------------
1 | {
2 | "project_info": {
3 | "project_id": "integreat-1173",
4 | "project_number": "298364599882",
5 | "name": "Integreat"
6 | },
7 | "client": [
8 | {
9 | "client_info": {
10 | "mobilesdk_app_id": "1:298364599882:android:d40d3b04b3cc30ce",
11 | "client_id": "android:augsburg.se.alltagsguide",
12 | "client_type": 1,
13 | "android_client_info": {
14 | "package_name": "augsburg.se.alltagsguide"
15 | }
16 | },
17 | "oauth_client": [],
18 | "api_key": [],
19 | "services": {
20 | "analytics_service": {
21 | "status": 1
22 | },
23 | "cloud_messaging_service": {
24 | "status": 1,
25 | "apns_config": []
26 | },
27 | "appinvite_service": {
28 | "status": 1,
29 | "other_platform_oauth_client": []
30 | },
31 | "google_signin_service": {
32 | "status": 1
33 | },
34 | "ads_service": {
35 | "status": 1
36 | }
37 | }
38 | },
39 | {
40 | "client_info": {
41 | "mobilesdk_app_id": "1:298364599882:android:9ce64071aff92d6e",
42 | "client_id": "android:tuerantuer.app.integreat",
43 | "client_type": 1,
44 | "android_client_info": {
45 | "package_name": "tuerantuer.app.integreat"
46 | }
47 | },
48 | "oauth_client": [],
49 | "api_key": [],
50 | "services": {
51 | "analytics_service": {
52 | "status": 2,
53 | "analytics_property": {
54 | "tracking_id": "UA-73579165-1"
55 | }
56 | },
57 | "cloud_messaging_service": {
58 | "status": 1,
59 | "apns_config": []
60 | },
61 | "appinvite_service": {
62 | "status": 1,
63 | "other_platform_oauth_client": []
64 | },
65 | "google_signin_service": {
66 | "status": 1
67 | },
68 | "ads_service": {
69 | "status": 1
70 | }
71 | }
72 | }
73 | ],
74 | "client_info": [],
75 | "ARTIFACT_VERSION": "1"
76 | }
--------------------------------------------------------------------------------
/app/libs/gcm.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/digitalfabrik/app-android/a6e0230c6fa455a99178e572f4673ff97289bc5b/app/libs/gcm.jar
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in C:\Users\Daniel-L\AppData\Local\Android\Sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/app/src/main/assets/integreat.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
6 |
7 |
8 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
--------------------------------------------------------------------------------
/app/src/main/java/augsburg/se/alltagsguide/BaseApplication.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Integreat.
3 | *
4 | * Integreat is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Integreat is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Integreat. If not, see .
16 | */
17 |
18 | package augsburg.se.alltagsguide;
19 |
20 | import android.app.Application;
21 | import android.app.Instrumentation;
22 | import android.content.Context;
23 | import android.support.annotation.NonNull;
24 | import android.support.multidex.MultiDex;
25 |
26 | import com.crashlytics.android.Crashlytics;
27 | import com.google.android.gms.analytics.GoogleAnalytics;
28 | import com.google.android.gms.analytics.Logger;
29 | import com.google.android.gms.analytics.Tracker;
30 | import com.google.inject.Injector;
31 | import com.liulishuo.filedownloader.FileDownloader;
32 |
33 | import io.fabric.sdk.android.Fabric;
34 | import roboguice.RoboGuice;
35 |
36 | /**
37 | * Created by Daniel-L on 16.08.2015.
38 | */
39 | public class BaseApplication extends Application {
40 | /**
41 | * The injector which can inject objects later on
42 | */
43 | private static Injector injector;
44 | private Tracker mTracker;
45 |
46 | public BaseApplication() {
47 | super();
48 | }
49 |
50 | public BaseApplication(Instrumentation instrumentation) {
51 | super();
52 | attachBaseContext(instrumentation.getTargetContext());
53 | }
54 |
55 | @Override
56 | public void onCreate() {
57 | super.onCreate();
58 | Fabric.with(this, new Crashlytics());
59 | RoboGuice.setUseAnnotationDatabases(false);
60 | injector = RoboGuice.getOrCreateBaseApplicationInjector(this, RoboGuice.DEFAULT_STAGE,
61 | RoboGuice.newDefaultRoboModule(this), new MainModule());
62 | GoogleAnalytics.getInstance(this).getLogger()
63 | .setLogLevel(Logger.LogLevel.VERBOSE);
64 | FileDownloader.init(this);
65 | }
66 |
67 | /**
68 | * Gets the default {@link Tracker} for this {@link Application}.
69 | *
70 | * @return tracker
71 | */
72 | synchronized public Tracker getDefaultTracker() {
73 | if (mTracker == null) {
74 | GoogleAnalytics analytics = GoogleAnalytics.getInstance(this);
75 | // To enable debug logging use: adb shell setprop log.tag.GAv4 DEBUG
76 | mTracker = analytics.newTracker("UA-73579165-1");
77 | mTracker.setAnonymizeIp(true);
78 | }
79 | return mTracker;
80 | }
81 |
82 | /**
83 | * Injects the object
84 | *
85 | * @param object object which should be injected manually
86 | */
87 | public static void inject(@NonNull Object object) {
88 | injector.injectMembers(object);
89 | }
90 |
91 |
92 | @Override
93 | protected void attachBaseContext(Context base) {
94 | super.attachBaseContext(base);
95 | MultiDex.install(this);
96 | }
97 |
98 |
99 | }
100 |
--------------------------------------------------------------------------------
/app/src/main/java/augsburg/se/alltagsguide/common/Author.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Integreat.
3 | *
4 | * Integreat is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Integreat is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Integreat. If not, see .
16 | */
17 |
18 | package augsburg.se.alltagsguide.common;
19 |
20 | import android.database.Cursor;
21 | import android.support.annotation.NonNull;
22 | import android.support.annotation.Nullable;
23 |
24 | import com.google.gson.JsonObject;
25 |
26 | import java.io.Serializable;
27 |
28 | import augsburg.se.alltagsguide.BuildConfig;
29 | import augsburg.se.alltagsguide.persistence.CacheHelper;
30 | import augsburg.se.alltagsguide.utilities.Objects;
31 |
32 | /**
33 | * Created by Daniel-L on 09.10.2015.
34 | */
35 | public class Author implements Serializable {
36 | @Nullable private String mLogin;
37 | @Nullable private String mFirstName;
38 | @Nullable private String mLastName;
39 |
40 | public Author(@Nullable String login, @Nullable String firstName, @Nullable String lastName) {
41 | mLogin = login;
42 | mFirstName = firstName;
43 | mLastName = lastName;
44 | }
45 |
46 | @Nullable
47 | public String getLogin() {
48 | return mLogin;
49 | }
50 |
51 | @Nullable
52 | public String getFirstName() {
53 | return mFirstName;
54 | }
55 |
56 | @Nullable
57 | public String getLastName() {
58 | return mLastName;
59 | }
60 |
61 | @NonNull
62 | public static Author fromJson(@NonNull final JsonObject jsonTag) {
63 | String login = jsonTag.get("login").getAsString();
64 | String firstName = jsonTag.get("first_name").getAsString();
65 | String lastName = jsonTag.get("last_name").getAsString();
66 | return new Author(login, firstName, lastName);
67 | }
68 |
69 | @NonNull
70 | public static Author fromCursor(@NonNull Cursor cursor) {
71 | if (BuildConfig.DEBUG) {
72 | if (cursor.isClosed()) {
73 | throw new IllegalStateException("Cursor should not be closed");
74 | }
75 | }
76 | String login = cursor.getString(cursor.getColumnIndex(CacheHelper.AUTHOR_USERNAME));
77 | String firstName = cursor.getString(cursor.getColumnIndex(CacheHelper.AUTHOR_FIRSTNAME));
78 | String lastName = cursor.getString(cursor.getColumnIndex(CacheHelper.AUTHOR_LASTNAME));
79 | return new Author(login, firstName, lastName);
80 | }
81 |
82 | @NonNull
83 | public String toText() {
84 | String text = "";
85 | if (mFirstName != null) {
86 | text += mFirstName + " ";
87 | }
88 | if (mLastName != null) {
89 | text += mLastName;
90 | }
91 | text = text.trim();
92 | if (Objects.isNullOrEmpty(text)) {
93 | text += mLogin;
94 | }
95 | return text;
96 | }
97 | }
98 |
--------------------------------------------------------------------------------
/app/src/main/java/augsburg/se/alltagsguide/common/AvailableLanguage.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Integreat.
3 | *
4 | * Integreat is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Integreat is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Integreat. If not, see .
16 | */
17 |
18 | package augsburg.se.alltagsguide.common;
19 |
20 | import android.database.Cursor;
21 | import android.support.annotation.NonNull;
22 | import android.support.annotation.Nullable;
23 | import android.util.Log;
24 |
25 | import com.google.gson.Gson;
26 | import com.google.gson.JsonElement;
27 | import com.google.gson.reflect.TypeToken;
28 |
29 | import java.io.Serializable;
30 | import java.util.ArrayList;
31 | import java.util.List;
32 | import java.util.Map;
33 |
34 | import augsburg.se.alltagsguide.persistence.CacheHelper;
35 |
36 | /**
37 | * Created by Daniel-L on 10.10.2015.
38 | */
39 | public class AvailableLanguage implements Serializable {
40 | @NonNull private String mLanguage;
41 | private int mOtherPageId;
42 | private int mOwnPageId;
43 |
44 | @Nullable private Language mLoadedLanguage;
45 |
46 | public AvailableLanguage(@NonNull String language, int otherPageId) {
47 | mLanguage = language;
48 | mOtherPageId = otherPageId;
49 | }
50 |
51 | public void setLanguage(@NonNull Language language) {
52 | mLoadedLanguage = language;
53 | }
54 |
55 | public void setOwnPageId(int ownPageId) {
56 | mOwnPageId = ownPageId;
57 | }
58 |
59 | public int getOwnPageId() {
60 | return mOwnPageId;
61 | }
62 |
63 | @NonNull
64 | public static List fromJson(@NonNull JsonElement elem) {
65 | List languages = new ArrayList<>();
66 | try {
67 | Map languagesMap = new Gson().fromJson(elem, new TypeToken