Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit c43d699
Showing
127 changed files
with
6,823 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
*.iml | ||
.gradle | ||
/local.properties | ||
/.idea/caches/build_file_checksums.ser | ||
/.idea/libraries | ||
/.idea/modules.xml | ||
/.idea/workspace.xml | ||
.DS_Store | ||
/build | ||
/captures | ||
.externalNativeBuild |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
apply plugin: 'com.android.application' | ||
|
||
android { | ||
compileSdkVersion 28 | ||
defaultConfig { | ||
applicationId "de.synyx.android.meetingroom" | ||
minSdkVersion 23 | ||
targetSdkVersion 28 | ||
versionCode 1 | ||
versionName "1.0" | ||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" | ||
} | ||
|
||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
|
||
compileOptions { | ||
sourceCompatibility JavaVersion.VERSION_1_8 | ||
targetCompatibility JavaVersion.VERSION_1_8 | ||
} | ||
|
||
dataBinding { | ||
enabled = true | ||
} | ||
|
||
} | ||
|
||
dependencies { | ||
def lifecycle_version = "1.1.1" | ||
def support_version = "28.0.0" | ||
|
||
implementation "com.android.support:design:$support_version" | ||
implementation "com.android.support:appcompat-v7:$support_version" | ||
implementation 'com.android.support.constraint:constraint-layout:1.1.3' | ||
|
||
//ViewModel and LiveData (AAC) | ||
implementation "android.arch.lifecycle:extensions:$lifecycle_version" | ||
implementation "android.arch.lifecycle:reactivestreams:$lifecycle_version" | ||
annotationProcessor "android.arch.lifecycle:compiler:$lifecycle_version" | ||
|
||
//rxjava2 | ||
implementation 'io.reactivex.rxjava2:rxjava:2.2.2' | ||
implementation 'io.reactivex.rxjava2:rxandroid:2.1.0' | ||
implementation 'com.squareup.sqlbrite3:sqlbrite:3.2.0' | ||
implementation 'com.jakewharton.rxbinding2:rxbinding-appcompat-v7:2.2.0' | ||
|
||
implementation 'joda-time:joda-time:2.10.1' | ||
runtimeOnly 'org.slf4j:slf4j-android:1.7.25' | ||
|
||
//Tests | ||
testImplementation 'junit:junit:4.12' | ||
testImplementation 'org.assertj:assertj-core:3.11.1' | ||
androidTestImplementation 'com.android.support.test:runner:1.0.2' | ||
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Add project specific ProGuard rules here. | ||
# You can control the set of applied configuration files using the | ||
# proguardFiles setting in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} | ||
|
||
# Uncomment this to preserve the line number information for | ||
# debugging stack traces. | ||
#-keepattributes SourceFile,LineNumberTable | ||
|
||
# If you keep the line number information, uncomment this to | ||
# hide the original source file name. | ||
#-renamesourcefileattribute SourceFile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="de.synyx.android.meetingroom"> | ||
|
||
<uses-permission android:name="android.permission.INTERNET" /> | ||
<uses-permission android:name="android.permission.GET_ACCOUNTS" /> | ||
<uses-permission android:name="android.permission.READ_SYNC_STATS" /> | ||
<uses-permission android:name="android.permission.READ_SYNC_SETTINGS" /> | ||
<uses-permission android:name="android.permission.READ_CALENDAR" /> | ||
<uses-permission android:name="android.permission.WRITE_CALENDAR" /> | ||
<uses-permission android:name="android.permission.READ_CONTACTS" /> | ||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> | ||
|
||
<application | ||
android:name=".MeetingRoomApplication" | ||
android:allowBackup="true" | ||
android:label="@string/app_name" | ||
android:supportsRtl="true" | ||
android:theme="@style/AppTheme"> | ||
|
||
<activity | ||
android:name="de.synyx.android.meetingroom.screen.login.LoginActivity" | ||
android:configChanges="orientation|screenSize" | ||
android:label="@string/app_name" | ||
android:screenOrientation="sensorLandscape"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
|
||
<activity | ||
android:name="de.synyx.android.meetingroom.screen.main.MainActivity" | ||
android:theme="@style/AppThemeDark" /> | ||
<activity | ||
android:name="de.synyx.android.meetingroom.screen.settings.SettingsActivity" | ||
android:label="@string/title_activity_settings" /> | ||
|
||
</application> | ||
</manifest> |
17 changes: 17 additions & 0 deletions
17
app/src/main/java/de/synyx/android/meetingroom/DefaultConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package de.synyx.android.meetingroom; | ||
|
||
import de.synyx.android.meetingroom.config.Registry; | ||
import de.synyx.android.meetingroom.util.DefaultTimeProvider; | ||
import de.synyx.android.meetingroom.util.TimeProvider; | ||
|
||
|
||
/** | ||
* @author Max Dobler - dobler@synyx.de | ||
*/ | ||
class DefaultConfig { | ||
|
||
public static void init() { | ||
|
||
Registry.put(TimeProvider.class, new DefaultTimeProvider()); | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
app/src/main/java/de/synyx/android/meetingroom/MeetingRoomApplication.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package de.synyx.android.meetingroom; | ||
|
||
import android.app.Application; | ||
|
||
import de.synyx.android.meetingroom.config.MainConfig; | ||
import de.synyx.android.meetingroom.screen.login.LoginConfig; | ||
import de.synyx.android.meetingroom.util.proxy.ProxyConfig; | ||
|
||
|
||
/** | ||
* @author Max Dobler - dobler@synyx.de | ||
*/ | ||
public class MeetingRoomApplication extends Application { | ||
|
||
@Override | ||
public void onCreate() { | ||
|
||
super.onCreate(); | ||
initConfig(); | ||
} | ||
|
||
|
||
private void initConfig() { | ||
|
||
DefaultConfig.init(); | ||
ProxyConfig.init(this); | ||
LoginConfig.init(this); | ||
MainConfig.init(); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
app/src/main/java/de/synyx/android/meetingroom/business/account/AccountService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package de.synyx.android.meetingroom.business.account; | ||
|
||
/** | ||
* @author Julian Heetel - heetel@synyx.de | ||
*/ | ||
public interface AccountService { | ||
|
||
String[] getAccountNames(); | ||
|
||
|
||
String getUserAccountName(); | ||
|
||
|
||
String getUserAccountType(); | ||
|
||
|
||
void syncCalendar(); | ||
} |
69 changes: 69 additions & 0 deletions
69
app/src/main/java/de/synyx/android/meetingroom/business/account/AccountServiceImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
package de.synyx.android.meetingroom.business.account; | ||
|
||
import android.accounts.Account; | ||
import android.accounts.AccountManager; | ||
|
||
import android.content.Context; | ||
|
||
import android.os.Bundle; | ||
|
||
import de.synyx.android.meetingroom.config.Config; | ||
|
||
import io.reactivex.Observable; | ||
|
||
import static android.content.ContentResolver.requestSync; | ||
|
||
|
||
/** | ||
* @author Julian Heetel - heetel@synyx.de | ||
*/ | ||
public class AccountServiceImpl implements AccountService { | ||
|
||
private final String CALENDAR_SYNC_AUTHORITY = "com.android.calendar"; | ||
|
||
private Context context; | ||
|
||
public AccountServiceImpl(Context context) { | ||
|
||
this.context = context; | ||
} | ||
|
||
@Override | ||
public String[] getAccountNames() { | ||
|
||
Account[] accounts = AccountManager.get(context).getAccounts(); | ||
|
||
return Observable.fromArray(accounts) | ||
.map(account -> account.name) | ||
.toList(accounts.length) | ||
.blockingGet() | ||
.toArray(new String[accounts.length]); | ||
} | ||
|
||
|
||
@Override | ||
public String getUserAccountName() { | ||
|
||
return Config.getInstance(context).getPreferencesService().getUserAccountName(); | ||
} | ||
|
||
|
||
@Override | ||
public String getUserAccountType() { | ||
|
||
return Config.getInstance(context).getPreferencesService().getUserAccountType(); | ||
} | ||
|
||
|
||
@Override | ||
public void syncCalendar() { | ||
|
||
String userAccountName = getUserAccountName(); | ||
Account[] accounts = AccountManager.get(context).getAccounts(); | ||
|
||
Observable.fromArray(accounts) | ||
.filter(account -> account.name.equals(userAccountName)) | ||
.firstElement() | ||
.subscribe(account -> requestSync(account, CALENDAR_SYNC_AUTHORITY, new Bundle())); | ||
} | ||
} |
Oops, something went wrong.