@@ -0,0 +1,45 @@
|
||||
# generic files
|
||||
*~
|
||||
*.lock
|
||||
*.DS_Store
|
||||
*.swp
|
||||
*.out
|
||||
Thumbs.db
|
||||
thumbs.db
|
||||
|
||||
# maven
|
||||
target/
|
||||
|
||||
# eclipse
|
||||
.settings/
|
||||
.classpath
|
||||
.project
|
||||
.factorypath
|
||||
|
||||
# netbeans
|
||||
nbproject/private/
|
||||
|
||||
# intellij
|
||||
.idea/
|
||||
*.iml
|
||||
/out/artifacts/*
|
||||
gen-external-apklibs/
|
||||
|
||||
# android
|
||||
gen/
|
||||
bin/
|
||||
lint.xml
|
||||
|
||||
#vscode
|
||||
.vscode/
|
||||
|
||||
#nodejs
|
||||
node/
|
||||
node_modules/
|
||||
|
||||
#gradle
|
||||
build/
|
||||
.gradle/
|
||||
|
||||
#android
|
||||
local.properties
|
||||
@@ -0,0 +1,70 @@
|
||||
#!groovy
|
||||
|
||||
// this groovy script is executed by jenkins
|
||||
node {
|
||||
|
||||
|
||||
def gradleInfo
|
||||
def server = Artifactory.server 'project.nes.uni-due.de'
|
||||
def gradleBuild = Artifactory.newGradleBuild()
|
||||
gradleBuild.tool = 'gradle-5.5.1'
|
||||
gradleBuild.usesPlugin = true
|
||||
|
||||
environment {
|
||||
ANDROID_SDK_ROOT = '/var/lib/android-sdk'
|
||||
}
|
||||
|
||||
|
||||
// checkout code from scm
|
||||
stage('Checkout') {
|
||||
checkout scm
|
||||
}
|
||||
|
||||
def version = ''
|
||||
|
||||
// configure the deployer based on the version
|
||||
stage('Configure') {
|
||||
version = sh(returnStdout: true, script: "./gradlew properties -q | grep \"version:\" | awk '{print \$2}'", label: "Detecting project version.").trim()
|
||||
println "Version is: '${version}'"
|
||||
if (version.endsWith("-SNAPSHOT")) {
|
||||
println "Using internal-snapshots for publication."
|
||||
gradleBuild.deployer server: server, repo: 'internal-snapshots'
|
||||
} else {
|
||||
println "Using internal-releases for publication."
|
||||
gradleBuild.deployer server: server, repo: 'internal-releases'
|
||||
}
|
||||
}
|
||||
|
||||
// build the source code with gradle
|
||||
stage('Build') {
|
||||
withCredentials([string(credentialsId: 'mowesta-keystore-password', variable: 'PASSWD')]) {
|
||||
def switches = "-Djenkins.build.number=${env.BUILD_NUMBER} -Dandroid.keystore.password=${PASSWD}".toString()
|
||||
gradleInfo = gradleBuild.run buildFile: 'build.gradle', tasks: 'clean build', switches: switches
|
||||
}
|
||||
}
|
||||
|
||||
// deploy the maven publications to artifactory
|
||||
stage ('Publish') {
|
||||
if (env.BRANCH_NAME == "master") {
|
||||
withCredentials([string(credentialsId: 'mowesta-keystore-password', variable: 'PASSWD')]) {
|
||||
def switches = "-Djenkins.build.number=${env.BUILD_NUMBER} -Dandroid.keystore.password=${PASSWD}".toString()
|
||||
gradleInfo = gradleBuild.run buildFile: 'build.gradle', tasks: 'artifactoryPublish', switches: switches
|
||||
}
|
||||
} else {
|
||||
echo "Skipping deployment for non-master branch."
|
||||
}
|
||||
}
|
||||
|
||||
// deploy the build output on the server
|
||||
stage ('Deploy') {
|
||||
if (env.BRANCH_NAME == "master") {
|
||||
withCredentials([sshUserPrivateKey(credentialsId: "mowesta-server-key", keyFileVariable: "keyfile")]) {
|
||||
sh "scp -i ${keyfile} site-ear/build/libs/site-ear-${version}.ear wildfly@srv.nes.uni-due.de:/opt/wildfly-17-mowesta/standalone/deployments/mowesta.ear"
|
||||
sh "scp -i ${keyfile} android-app/build/outputs/apk/release/*.apk wildfly@srv.nes.uni-due.de:/opt/android/mowesta/"
|
||||
}
|
||||
} else {
|
||||
echo "Skipping deployment for non-master branch."
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
# About
|
||||
|
||||
The source code of the location-based services project group that develops a crowd-sourcing backend and apps for temperature information. For more information see the [Mobile Weather Station](https://www.mowesta.com) website.
|
||||
|
||||
# Setup
|
||||
|
||||
This project is configured to be built with [Gradle](https://gradle.org) which allows automated building and testing using [Jenkins](https://jenkins.io/index.html). The project is a multi-module project so that different system components can be developed in separate library projects. Widely used integrated development environments such as [IntelliJ IDEA](https://www.jetbrains.com/idea/) or [Eclipse](https://www.eclipse.org) enable direct imports of the Gradle modules. IntelliJ supports this out of the box. Eclipse uses the [Buildship Plugin](https://projects.eclipse.org/projects/tools.buildship) to generate the Eclipse settings from the build.gradle files.
|
||||
|
||||
# Building
|
||||
|
||||
To build the project, you will have to install [Java](http://www.oracle.com/technetwork/java/index.html), [Gradle](https://gradle.org) and the [Android SDK](https://developer.android.com/studio/index.html). Make sure to install the platform packages for API level 28 using the SDK manager, as they are required to build the application. When everything is set up, simply run 'gradle build' or 'gradle clean build' to trigger a build.
|
||||
|
||||
# Jenkins CI
|
||||
|
||||
Pull requests and new commits to any branch are automatically built by a Jenkins service. A Gitea webhook informs the service about changes to the repository. In addition, the service will automatically scan the lbs Gitea organization for new repositories every hour. Successful builds of new commits are indicated by a green tick on the commit page. The build status of pull requests is currently not shown in Gitea. However, you can go to the [Jenkins](https://project.nes.uni-due.de/jenkins/job/LocationBasedServices/job/mowesta/) service to view the result of builds including the console output. To modify the build process, you can change the Jenkinsfile groovy script in the root of the repository, if necessary.
|
||||
@@ -0,0 +1,95 @@
|
||||
description = "Mowesta Android App"
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: "libs", include: ["*.jar"])
|
||||
implementation project(":android-feign")
|
||||
implementation "androidx.legacy:legacy-support-v4:${versionAndroidx10}"
|
||||
implementation "androidx.appcompat:appcompat:${versionAndroidx11}"
|
||||
implementation "androidx.preference:preference:${versionAndroidx11}"
|
||||
implementation "androidx.cardview:cardview:${versionAndroidx10}"
|
||||
implementation "androidx.recyclerview:recyclerview:${versionAndroidx10}"
|
||||
implementation "com.google.android.material:material:${versionAndroidx10}"
|
||||
implementation "com.google.android.gms:play-services-oss-licenses:${versionPlay}"
|
||||
testImplementation "junit:junit:${versionJunit}"
|
||||
testImplementation "org.robolectric:robolectric:${versionRobolectric}"
|
||||
testImplementation "androidx.test:core:${versionAndroidxTest}"
|
||||
}
|
||||
|
||||
configurations {
|
||||
all {
|
||||
exclude group: 'com.google.auto.service', module: 'auto-service'
|
||||
}
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdkVersion 28
|
||||
defaultConfig {
|
||||
applicationId "com.mowesta.android.app"
|
||||
minSdkVersion 14
|
||||
targetSdkVersion 28
|
||||
versionCode 7
|
||||
versionName "${version}"
|
||||
buildConfigField "long", "BUILD_TIME", System.currentTimeMillis() + "L"
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
resValue "string", "application_long", "MoWeSta"
|
||||
resValue "string", "application_short", "MoWeSta"
|
||||
|
||||
}
|
||||
|
||||
signingConfigs {
|
||||
release {
|
||||
storeFile file("src/main/key/mowesta.jks")
|
||||
keyAlias "app"
|
||||
storePassword System.properties['android.keystore.password']
|
||||
keyPassword System.properties['android.keystore.password']
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
useProguard false
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
// add signing config if key is provided via system property
|
||||
if (System.properties['android.keystore.password'] != null) signingConfig signingConfigs.release
|
||||
}
|
||||
|
||||
debug {
|
||||
applicationIdSuffix ".debug"
|
||||
versionNameSuffix "-dbg"
|
||||
resValue "string", "application_long", "MoWeStaDbg"
|
||||
resValue "string", "application_short", "MWSDBG"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
testOptions {
|
||||
unitTests {
|
||||
includeAndroidResources = true
|
||||
}
|
||||
}
|
||||
|
||||
lintOptions {
|
||||
disable 'RtlSymmetry', 'RelativeOverlap'
|
||||
// abortOnError false
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
tasks.register('makeEclipseDir') {
|
||||
doLast {
|
||||
file('build/generated/source/aidl/debug').mkdirs();
|
||||
file('build/generated/source/r/debug').mkdirs();
|
||||
}
|
||||
}
|
||||
|
||||
tasks['build'].dependsOn('makeEclipseDir')
|
||||
tasks['eclipse'].dependsOn('makeEclipseDir')
|
||||
|
||||
// enable unchecked and deprecation warning during compilation
|
||||
// gradle.projectsEvaluated {
|
||||
// tasks.withType(JavaCompile) {
|
||||
// options.encoding = 'UTF-8'
|
||||
// options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
|
||||
// }
|
||||
//}
|
||||
@@ -0,0 +1,17 @@
|
||||
# This file is automatically generated by Android Tools.
|
||||
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
|
||||
#
|
||||
# This file must be checked in Version Control Systems.
|
||||
#
|
||||
# To customize properties used by the Ant build system edit
|
||||
# "ant.properties", and override values to adapt the script to your
|
||||
# project structure.
|
||||
#
|
||||
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
|
||||
#proguard.config=${sdk.dir}\tools\proguard\proguard-android.txt:proguard-project.txt
|
||||
|
||||
# Project target.
|
||||
android.library.reference.1=../leafless
|
||||
android.library.reference.2=../leafless
|
||||
project.type=0
|
||||
target=android-25
|
||||
@@ -0,0 +1,60 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.mowesta.android.app">
|
||||
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK"/>
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
|
||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
|
||||
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
|
||||
|
||||
<!-- required for notification with LED lights, this is idiotic -->
|
||||
<uses-permission android:name="android.permission.VIBRATE"/>
|
||||
<!-- background sync and boot completion -->
|
||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
|
||||
|
||||
<application android:name=".MowestaApp"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:label="@string/application_long"
|
||||
android:theme="@style/Theme.MowestaTheme"
|
||||
android:allowBackup="true"
|
||||
android:supportsRtl="true"
|
||||
android:fullBackupContent="@xml/backup">
|
||||
<activity
|
||||
android:name=".StartActivity"
|
||||
android:launchMode="singleTask"
|
||||
android:theme="@style/Theme.MowestaTheme.NoActionBar"
|
||||
android:exported="true"
|
||||
android:label="@string/application_long">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:launchMode="singleTask"
|
||||
android:name=".LoginActivity"
|
||||
android:windowSoftInputMode="stateHidden"
|
||||
android:exported="false"
|
||||
android:label="@string/application_long">
|
||||
</activity>
|
||||
<activity
|
||||
android:launchMode="singleTask"
|
||||
android:name=".MainActivity"
|
||||
android:windowSoftInputMode="adjustResize"
|
||||
android:exported="true"
|
||||
android:label="@string/application_long">
|
||||
</activity>
|
||||
<receiver android:name=".BootReceiver">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.BOOT_COMPLETED"/>
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
<service android:name=".MeasureService"/>
|
||||
</application>
|
||||
</manifest>
|
||||
@@ -0,0 +1,13 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
||||
</head>
|
||||
<body>
|
||||
<link rel="stylesheet" type="text/css" href="style.css">
|
||||
<div id="gdpr-app" data-lang="de" data-interactive="true" data-source="./"></div>
|
||||
<script src="app.js" type="text/javascript"></script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,110 @@
|
||||
.gdpr-content {
|
||||
font-family: 'Open Sans'
|
||||
}
|
||||
|
||||
.gdpr-chapter.gdpr-header {
|
||||
background: #01579b;
|
||||
padding: 10px;
|
||||
margin: 25px 0px 10px 0px;
|
||||
}
|
||||
|
||||
h1.gdpr-loading, h1.gdpr-error {
|
||||
font-size: 1.2em;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
h1.gdpr-chapter {
|
||||
font-size: 1.2em;
|
||||
font-weight: bold;
|
||||
margin: 0px;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
h2.gdpr-chapter {
|
||||
font-size: 1.5em;
|
||||
margin: 0px;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
h3.gdpr-chapter {
|
||||
margin: 0px;
|
||||
font-size: 1.2em;
|
||||
font-weight: normal;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
.gdpr-article.gdpr-header {
|
||||
padding: 10px 10px 0px 10px;
|
||||
margin: 0px;
|
||||
}
|
||||
|
||||
h4.gdpr-article {
|
||||
font-size: 1.2em;
|
||||
font-weight: bold;
|
||||
padding: 0px;
|
||||
margin: 5px 5px 5px 5px;
|
||||
color: #01579b;
|
||||
}
|
||||
|
||||
.gdpr-chapter.gdpr-header.gdpr-selected, .gdpr-chapter.gdpr-header.gdpr-interactive:hover {
|
||||
background: #f9af37;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.gdpr-article.gdpr-header.gdpr-selected > h4, .gdpr-article.gdpr-header.gdpr-interactive:hover > h4 {
|
||||
color: #f9af37;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
h4.gdpr-section {
|
||||
color: #01579b;
|
||||
padding: 0px;
|
||||
margin: 0px;
|
||||
font-size: 1.2em;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
@media screen and (min-width: 500px) {
|
||||
.gdpr-article.gdpr-header {
|
||||
padding: 10px 10px 0px 10px;
|
||||
margin: 0px;
|
||||
}
|
||||
|
||||
.gdpr-paragraph {
|
||||
padding: 2px 20px 2px 20px;
|
||||
margin: 0px;
|
||||
}
|
||||
|
||||
.gdpr-section.gdpr-header {
|
||||
padding: 0px;
|
||||
margin: 25px 15px 5px 15px;
|
||||
}
|
||||
|
||||
p.gdpr-paragraph {
|
||||
text-indent: -22px;
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (max-width: 499px) {
|
||||
|
||||
.gdpr-article.gdpr-header {
|
||||
padding: 10px 0px 0px 0px;
|
||||
margin: 0px;
|
||||
}
|
||||
|
||||
.gdpr-section.gdpr-header {
|
||||
padding: 0px;
|
||||
margin: 25px 5px 5px 5px;
|
||||
}
|
||||
|
||||
.gdpr-paragraph {
|
||||
padding: 2px 5px 2px 10px;
|
||||
margin: 0px;
|
||||
}
|
||||
|
||||
p.gdpr-paragraph {
|
||||
text-indent: -10px;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
|
||||
<link rel="stylesheet" type="text/css" href="style.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
TODO: Datenschutzerklärung
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,26 @@
|
||||
body {
|
||||
font-family: 'Roboto';
|
||||
font-size: 10pt;
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
p {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 14pt;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
h2 {
|
||||
margin-top: 32px;
|
||||
font-size: 12pt;
|
||||
color: #01579b;
|
||||
}
|
||||
|
||||
a, a:any-link {
|
||||
font-weight: bold;
|
||||
text-decoration: none;
|
||||
color: #f9a825;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
|
||||
<link rel="stylesheet" type="text/css" href="style.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
TODO: Nutzungsbedingungen
|
||||
|
||||
</body></html>
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.mowesta.android.app;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.util.Log;
|
||||
|
||||
/**
|
||||
* A broadcast receiver that registers the background activites at
|
||||
* device boot time.
|
||||
*
|
||||
* @author Marcus
|
||||
*/
|
||||
public class BootReceiver extends BroadcastReceiver {
|
||||
|
||||
/**
|
||||
* The log tag for this class.
|
||||
*/
|
||||
private static final String TAG = "BootReceiver";
|
||||
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
// should not happen but nobody likes crashing apps in background
|
||||
if (intent == null || context == null) return;
|
||||
Log.d(TAG, "Received an intent with action " + intent.getAction() + ".");
|
||||
if (context.getApplicationContext() instanceof MowestaApp) {
|
||||
MowestaApp app = (MowestaApp)context.getApplicationContext();
|
||||
if (Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction())) {
|
||||
MeasureService.runService(app);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.mowesta.android.app;
|
||||
|
||||
import com.mowesta.android.app.fragment.AbstractLoginFragment;
|
||||
import com.mowesta.android.app.fragment.LoginCreateFragment;
|
||||
import com.mowesta.android.app.fragment.LoginUpdateFragment;
|
||||
|
||||
import android.os.Bundle;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
/**
|
||||
* The activity to login or create a device. The
|
||||
* assumption is that this activity is only started
|
||||
* when there is no device handle.
|
||||
*
|
||||
* @author Marcus
|
||||
*/
|
||||
public class LoginActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_login);
|
||||
Fragment f = getSupportFragmentManager().findFragmentById(R.id.coordinator);
|
||||
if (f == null) {
|
||||
AbstractLoginFragment loginFragment = null;
|
||||
if (getApp().getRepository().deviceHandle.getValue() == null) {
|
||||
loginFragment = new LoginCreateFragment();
|
||||
} else {
|
||||
loginFragment = new LoginUpdateFragment();
|
||||
}
|
||||
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
|
||||
ft.replace(R.id.coordinator, loginFragment);
|
||||
ft.commit();
|
||||
}
|
||||
}
|
||||
|
||||
private MowestaApp getApp() {
|
||||
return (MowestaApp) getApplicationContext();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
if (isFinishing()) getApp().getRepository().creatingDevice.setValue(null);
|
||||
super.onDestroy();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,344 @@
|
||||
package com.mowesta.android.app;
|
||||
|
||||
import com.mowesta.android.app.fragment.SettingsFragment;
|
||||
import com.mowesta.android.app.fragment.TermsFragment;
|
||||
import com.mowesta.android.app.fragment.WebViewFragment;
|
||||
import com.mowesta.android.app.repository.IValueListener;
|
||||
import com.mowesta.android.app.repository.Value;
|
||||
import com.mowesta.android.app.task.UpdateUserTask;
|
||||
import com.mowesta.android.app.util.TabletUtil;
|
||||
import com.mowesta.android.feign.model.DeviceHandle;
|
||||
import com.mowesta.android.feign.model.User;
|
||||
|
||||
import android.Manifest;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import androidx.annotation.NonNull;
|
||||
import com.google.android.material.navigation.NavigationView;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
import androidx.core.content.PermissionChecker;
|
||||
import androidx.drawerlayout.widget.DrawerLayout;
|
||||
import androidx.appcompat.app.ActionBarDrawerToggle;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import android.util.Log;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
|
||||
/**
|
||||
* The main activity that is launched once the device is registered.
|
||||
* It contains a lateral menu to access all app functions.
|
||||
*
|
||||
* @author Marcus
|
||||
*/
|
||||
public class MainActivity extends AppCompatActivity implements SettingsFragment.SettingsFragmentActivity {
|
||||
|
||||
/**
|
||||
* A tag for the fragment.
|
||||
*/
|
||||
private static final String TAG = "MainActivity";
|
||||
|
||||
/**
|
||||
* The tag that is used to identify "returnable" dialogs on the back stack.
|
||||
*/
|
||||
private static final String TAG_SLAVE = "slave";
|
||||
|
||||
/**
|
||||
* The tag that is used for the master screens.
|
||||
*/
|
||||
private static final String TAG_MASTER = "master";
|
||||
|
||||
/**
|
||||
* A tag to request permissions.
|
||||
*/
|
||||
private static final int CODE_REQUEST_PERMISSIONS = 1;
|
||||
|
||||
/**
|
||||
* A listener for the user that updates the drawer header with the
|
||||
* right username.
|
||||
*/
|
||||
private IValueListener<User> userListener = new IValueListener<User>() {
|
||||
@Override
|
||||
public void onValueChanged(Value<User> source, User oldValue, User newValue) {
|
||||
DeviceHandle handle = source.getRepository().deviceHandle.getValue();
|
||||
if (newValue != null) {
|
||||
usernameView.setText(newValue.getName());
|
||||
} else if (handle != null && handle.getUser() == null) {
|
||||
usernameView.setText(R.string.nav_user_none);
|
||||
} else {
|
||||
usernameView.setText(R.string.nav_user_error);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Updates the visibility of the menu items based on the login state.
|
||||
*/
|
||||
private IValueListener<DeviceHandle> deviceListener = new IValueListener<DeviceHandle>() {
|
||||
@Override
|
||||
public void onValueChanged(Value<DeviceHandle> source, DeviceHandle oldValue, DeviceHandle newValue) {
|
||||
if (newValue != null) {
|
||||
MenuItem connect = navigationView.getMenu().findItem(R.id.menu_connect);
|
||||
connect.setVisible(newValue.getUser() == null);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Navigation Drawer menu.
|
||||
*/
|
||||
private DrawerLayout drawerLayout;
|
||||
/**
|
||||
* The navigation view.
|
||||
*/
|
||||
private NavigationView navigationView;
|
||||
|
||||
/**
|
||||
* The view with the user name.
|
||||
*/
|
||||
private TextView usernameView;
|
||||
|
||||
/**
|
||||
* The reference to the app.
|
||||
*/
|
||||
private MowestaApp app;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
app = (MowestaApp) getApplicationContext();
|
||||
MeasureService.runService(this);
|
||||
setTitle(R.string.application_short);
|
||||
if (TabletUtil.isLandscapeTablet(this)) {
|
||||
setContentView(R.layout.activity_main_tablet);
|
||||
} else {
|
||||
setContentView(R.layout.activity_main_default);
|
||||
}
|
||||
if (savedInstanceState == null) {
|
||||
setScreen(Screen.DEVICES);
|
||||
}
|
||||
createNavigationDrawer();
|
||||
checkPermissions();
|
||||
new UpdateUserTask(app).execute();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
app.getRepository().user.addValueListener(userListener, true);
|
||||
app.getRepository().deviceHandle.addValueListener(deviceListener, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
app.getRepository().deviceHandle.removeValueListener(deviceListener);
|
||||
app.getRepository().user.removeValueListener(userListener);
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
private void createNavigationDrawer() {
|
||||
drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
|
||||
navigationView = (NavigationView) findViewById(R.id.navigation_view);
|
||||
View header = navigationView.getHeaderView(0);
|
||||
usernameView = (TextView)header.findViewById(R.id.view_header_username);
|
||||
TextView deviceView = (TextView)header.findViewById(R.id.view_header_device);
|
||||
deviceView.setText(Build.MANUFACTURER + " " + Build.DEVICE);
|
||||
getSupportActionBar().setDisplayUseLogoEnabled(true);
|
||||
getSupportActionBar().setDisplayShowHomeEnabled(true);
|
||||
getSupportActionBar().setHomeButtonEnabled(true);
|
||||
prepareDrawerIfNeeded();
|
||||
navigationView.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() {
|
||||
@Override
|
||||
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.menu_devices:
|
||||
setScreen(Screen.DEVICES);
|
||||
break;
|
||||
case R.id.menu_settings:
|
||||
showSettings();
|
||||
break;
|
||||
case R.id.menu_connect:
|
||||
showLogin();
|
||||
break;
|
||||
}
|
||||
closeDrawerIfNeeded();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
// override method so toggling with burger icon is possible
|
||||
switch (item.getItemId()) {
|
||||
case android.R.id.home:
|
||||
handleHomeIfNeeded();
|
||||
return true;
|
||||
default:
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles presses to the home button, if there is a drawer.
|
||||
*/
|
||||
private void handleHomeIfNeeded() {
|
||||
if (drawerLayout != null) {
|
||||
if (drawerLayout.isDrawerOpen(navigationView)) {
|
||||
drawerLayout.closeDrawer(navigationView);
|
||||
} else {
|
||||
drawerLayout.openDrawer(navigationView);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the drawer setup, if it is contained in the layout
|
||||
*/
|
||||
private void prepareDrawerIfNeeded() {
|
||||
if (drawerLayout != null) {
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
// toggle with burger icon
|
||||
ActionBarDrawerToggle drawerToggle = new ActionBarDrawerToggle(this, drawerLayout, R.string.drawer_open, R.string.drawer_close) {
|
||||
public void onDrawerClosed(View view) {
|
||||
super.onDrawerClosed(view);
|
||||
setTitle(R.string.application_short);
|
||||
}
|
||||
|
||||
public void onDrawerOpened(View drawerView) {
|
||||
super.onDrawerOpened(drawerView);
|
||||
setTitle(R.string.drawer_title);
|
||||
}
|
||||
|
||||
};
|
||||
drawerToggle.setDrawerIndicatorEnabled(true); // show burger icon
|
||||
drawerToggle.syncState(); // show burger / back arrow
|
||||
drawerLayout.addDrawerListener(drawerToggle);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes the drawer, if there is one.
|
||||
*/
|
||||
private void closeDrawerIfNeeded() {
|
||||
if (drawerLayout != null) {
|
||||
drawerLayout.closeDrawer(navigationView);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to request location permission for the app.
|
||||
*/
|
||||
private void checkPermissions() {
|
||||
boolean permissionGranted = PermissionChecker.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION) == PermissionChecker.PERMISSION_GRANTED &&
|
||||
PermissionChecker.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) == PermissionChecker.PERMISSION_GRANTED;
|
||||
if (!permissionGranted) {
|
||||
Log.d(TAG, "Requesting permissions.");
|
||||
ActivityCompat.requestPermissions(this, new String[]{android.Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.ACCESS_FINE_LOCATION}, CODE_REQUEST_PERMISSIONS);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method handles the requested permission (whether it was given or not).
|
||||
*
|
||||
* @param requestCode requestCode identifies requested permission
|
||||
* @param permissions permissions The permissions.
|
||||
* @param grantResults results The results for the permissions.
|
||||
*/
|
||||
@Override
|
||||
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
|
||||
switch (requestCode) {
|
||||
case CODE_REQUEST_PERMISSIONS: {
|
||||
StringBuilder b = new StringBuilder();
|
||||
for (int i = 0, s = Math.min(permissions.length, grantResults.length); i < s; i++) {
|
||||
b.append(permissions[i] + " " + (grantResults[i] == PackageManager.PERMISSION_GRANTED) + "\n");
|
||||
}
|
||||
Log.d(TAG, "Permission result:\n" + b.toString());
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to set the current screen (content fragment).
|
||||
*
|
||||
* @param view screen to set
|
||||
*/
|
||||
private void setScreen(@NonNull Screen view) {
|
||||
closeViews(TAG_SLAVE);
|
||||
Fragment current = getSupportFragmentManager().findFragmentById(R.id.container);
|
||||
switch (view) {
|
||||
case DEVICES:
|
||||
closeViews(TAG_MASTER);
|
||||
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
|
||||
ft.replace(R.id.container, new WebViewFragment());
|
||||
ft.addToBackStack(TAG_MASTER);
|
||||
ft.commit();
|
||||
break;
|
||||
default:
|
||||
// cannot happen
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showTerms() {
|
||||
showSlave(new TermsFragment());
|
||||
}
|
||||
|
||||
private void showSettings() {
|
||||
closeViews(TAG_SLAVE);
|
||||
showSlave(new SettingsFragment());
|
||||
}
|
||||
|
||||
private void showLogin() {
|
||||
startActivity(new Intent(this, LoginActivity.class));
|
||||
}
|
||||
|
||||
private void showPlaces() {
|
||||
// start browser to goto places
|
||||
|
||||
}
|
||||
|
||||
private void showSlave(Fragment fragment) {
|
||||
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
|
||||
ft.replace(R.id.container, fragment);
|
||||
ft.addToBackStack(TAG_SLAVE);
|
||||
ft.commit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
Fragment f = getSupportFragmentManager().findFragmentById(R.id.container);
|
||||
if (f instanceof TermsFragment) {
|
||||
if (((TermsFragment)f).canGoBack()) {
|
||||
((TermsFragment) f).goBack();
|
||||
return;
|
||||
}
|
||||
}
|
||||
super.onBackPressed();
|
||||
}
|
||||
|
||||
private void closeViews(String tag) {
|
||||
getSupportFragmentManager().popBackStack(tag, FragmentManager.POP_BACK_STACK_INCLUSIVE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Available screens to display as content.
|
||||
*/
|
||||
public enum Screen {
|
||||
/** The devices web view. */
|
||||
DEVICES,
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,258 @@
|
||||
package com.mowesta.android.app;
|
||||
|
||||
import android.app.AlarmManager;
|
||||
import android.app.Notification;
|
||||
import android.app.NotificationChannel;
|
||||
import android.app.NotificationManager;
|
||||
import android.app.PendingIntent;
|
||||
import android.app.Service;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Build;
|
||||
import android.os.Handler;
|
||||
import android.os.IBinder;
|
||||
import android.os.PowerManager;
|
||||
import android.os.SystemClock;
|
||||
import androidx.core.app.NotificationCompat;
|
||||
import android.util.Log;
|
||||
|
||||
/**
|
||||
* A service to perform background measurements.
|
||||
*
|
||||
* @author Marcus
|
||||
*/
|
||||
public class MeasureService extends Service {
|
||||
|
||||
/**
|
||||
* The code for the alarm.
|
||||
*/
|
||||
private static final int ALARM_CODE = 3321;
|
||||
|
||||
/**
|
||||
* A boolean extra to indicate whether the call is
|
||||
* coming from the alarm manager.
|
||||
*/
|
||||
private static final String EXTRA_ALARM = "alarm";
|
||||
|
||||
/**
|
||||
* The tag for the wakelock.
|
||||
*/
|
||||
private static final String WAKELOCK_TAG = "mowesta:measure";
|
||||
|
||||
/**
|
||||
* The timeout for the wakelock.
|
||||
*/
|
||||
private static final long WAKELOCK_TIMEOUT = 60000 * 10;
|
||||
|
||||
/**
|
||||
* The log tag to produce debug output.
|
||||
*/
|
||||
private static final String TAG = "MeasureService";
|
||||
|
||||
/**
|
||||
* The channel id of the localization channel.
|
||||
*/
|
||||
private static final String CHANNEL_ID = "measure";
|
||||
|
||||
/**
|
||||
* The notification id of the foreground service indicator.
|
||||
*/
|
||||
private static final int NOTIFICATION_ID = 5544;
|
||||
|
||||
/**
|
||||
* The application.
|
||||
*/
|
||||
private MowestaApp app;
|
||||
|
||||
/**
|
||||
* The power manager to request cpu locks.
|
||||
*/
|
||||
private PowerManager powerManager;
|
||||
|
||||
/**
|
||||
* The handler to process timeouts in the ui thread.
|
||||
*/
|
||||
private Handler handler;
|
||||
|
||||
|
||||
/**
|
||||
* A wake lock that is held while the service is localizing.
|
||||
*/
|
||||
private PowerManager.WakeLock wakeLock;
|
||||
|
||||
|
||||
@Override
|
||||
public IBinder onBind(Intent intent) {
|
||||
// do not support binding
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
Log.d(TAG, "Creating location service.");
|
||||
super.onCreate();
|
||||
handler = new Handler();
|
||||
app = (MowestaApp) getApplicationContext();
|
||||
createNotificationChannel(app);
|
||||
startForeground(NOTIFICATION_ID, getNotification(R.string.measure_notification_idle));
|
||||
powerManager = (PowerManager) app.getSystemService(POWER_SERVICE);
|
||||
wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, WAKELOCK_TAG);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
Log.d(TAG, "Releasing wake lock.");
|
||||
if (wakeLock.isHeld()) wakeLock.release();
|
||||
Log.d(TAG, "Stopping foreground execution.");
|
||||
stopForeground(true);
|
||||
Log.d(TAG, "Destroying service.");
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||
/*
|
||||
if (!app.getRepository().isMeasurementEnabled()) {
|
||||
Log.d(TAG, "Stopping since localization is disabled.");
|
||||
cancelExecution(this);
|
||||
stopSelf();
|
||||
return START_NOT_STICKY;
|
||||
} else if (!hasDeviceHandle()) {
|
||||
Log.d(TAG, "Stopping since device is not available.");
|
||||
cancelExecution(this);
|
||||
stopSelf();
|
||||
return START_NOT_STICKY;
|
||||
}
|
||||
// TODO: create measurement
|
||||
*/
|
||||
|
||||
return START_STICKY;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether there is a device handle.
|
||||
*
|
||||
* @return True if there is a device handle, false otherwise.
|
||||
*/
|
||||
private boolean hasDeviceHandle() {
|
||||
return (app.getRepository().deviceHandle.getValue() != null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Starts the service, if it is not running already.
|
||||
*
|
||||
* @param context The context.
|
||||
*/
|
||||
public static void runService(Context context) {
|
||||
Intent intent = new Intent();
|
||||
intent.setClass(context, MeasureService.class);
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
|
||||
context.startService(intent);
|
||||
} else {
|
||||
context.startForegroundService(intent);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Stops the service unconditionally.
|
||||
*
|
||||
* @param context The context.
|
||||
*/
|
||||
public static void stopService(Context context) {
|
||||
Intent intent = new Intent();
|
||||
intent.setClass(context, MeasureService.class);
|
||||
context.stopService(intent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Schedules the service for the next execution.
|
||||
*
|
||||
* @param context The context used to schedule this.
|
||||
*/
|
||||
private static void scheduleExecution(Context context, long lastTime) {
|
||||
PendingIntent pending = createIntent(context);
|
||||
AlarmManager manager = (AlarmManager)context.getSystemService(Context.ALARM_SERVICE);
|
||||
long now = SystemClock.elapsedRealtime();
|
||||
long next = 60000; // one minute
|
||||
Log.d(TAG, "Updating alarm to execute in " + next + " ms.");
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
|
||||
manager.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime() + next, pending);
|
||||
} else {
|
||||
manager.setExact(AlarmManager.RTC_WAKEUP, System.currentTimeMillis() + next, pending);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Cancels the periodic service execution.
|
||||
*
|
||||
* @param context The context.
|
||||
*/
|
||||
private static void cancelExecution(Context context) {
|
||||
AlarmManager manager = (AlarmManager)context.getSystemService(Context.ALARM_SERVICE);
|
||||
manager.cancel(createIntent(context));
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a pending intent to start or cancel the periodic service execution.
|
||||
*
|
||||
* @param context The context.
|
||||
* @return The pending intent.
|
||||
*/
|
||||
private static PendingIntent createIntent(Context context) {
|
||||
Intent intent = new Intent();
|
||||
intent.setClass(context, MeasureService.class);
|
||||
intent.putExtra(EXTRA_ALARM, true);
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
|
||||
return PendingIntent.getService(context, ALARM_CODE, intent, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
} else {
|
||||
return PendingIntent.getForegroundService(context, ALARM_CODE, intent, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Updates the foreground service notification with new text.
|
||||
*
|
||||
* @param content The content.
|
||||
*/
|
||||
private void updateNotification(int content) {
|
||||
Notification notification = getNotification(content);
|
||||
NotificationManager manager = (NotificationManager)app.getSystemService(NOTIFICATION_SERVICE);
|
||||
manager.notify(NOTIFICATION_ID, notification);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the notification that is displayed during upload.
|
||||
*
|
||||
* @param content The notification content (res id).
|
||||
* @return The notification.
|
||||
*/
|
||||
private Notification getNotification(int content) {
|
||||
NotificationCompat.Builder builder = new NotificationCompat.Builder(app, CHANNEL_ID)
|
||||
.setContentTitle(getText(R.string.measure_notification_title))
|
||||
.setContentText(getText(content))
|
||||
.setOngoing(true)
|
||||
.setContentIntent(PendingIntent.getActivity(app, 445, new Intent(app, StartActivity.class), PendingIntent.FLAG_UPDATE_CURRENT))
|
||||
.setSmallIcon(R.drawable.icon_notification_small);
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a notification channel for the app.
|
||||
*
|
||||
* @param app The app to retrieve the notification manager.
|
||||
*/
|
||||
public static void createNotificationChannel(MowestaApp app) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
CharSequence name = app.getString(R.string.measure_channel_name);
|
||||
String description = app.getString(R.string.measure_channel_description);
|
||||
int importance = NotificationManager.IMPORTANCE_LOW;
|
||||
NotificationChannel channel = new NotificationChannel(CHANNEL_ID, name, importance);
|
||||
channel.setDescription(description);
|
||||
NotificationManager notificationManager = app.getSystemService(NotificationManager.class);
|
||||
notificationManager.createNotificationChannel(channel);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,176 @@
|
||||
package com.mowesta.android.app;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import com.mowesta.android.app.repository.IValueListener;
|
||||
import com.mowesta.android.app.repository.Repository;
|
||||
import com.mowesta.android.app.repository.Value;
|
||||
import com.mowesta.android.feign.ApiClient;
|
||||
import com.mowesta.android.feign.api.DefaultApi;
|
||||
import com.mowesta.android.feign.model.DeviceHandle;
|
||||
|
||||
import android.app.Application;
|
||||
import android.content.SharedPreferences;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.util.Log;
|
||||
import feign.RequestInterceptor;
|
||||
import feign.RequestTemplate;
|
||||
import feign.auth.BasicAuthRequestInterceptor;
|
||||
|
||||
/**
|
||||
* The application class that will be constructed automatically
|
||||
* by Android when the linux process for this app starts. There
|
||||
* will be only one instance per process and it can be accessed
|
||||
* through Context.getApplicationContext().
|
||||
*
|
||||
* @author Marcus
|
||||
*/
|
||||
public class MowestaApp extends Application {
|
||||
|
||||
/**
|
||||
* The log tag for debugging.
|
||||
*/
|
||||
private static final String TAG = "MowestaApp";
|
||||
|
||||
/**
|
||||
* The preference key for the mowesta url.
|
||||
*/
|
||||
private static final String KEY_MOWESTA_URL = "mowesta_url";
|
||||
|
||||
/**
|
||||
* The application repository.
|
||||
*/
|
||||
protected Repository repository;
|
||||
|
||||
/**
|
||||
* The api client to access the server.
|
||||
*/
|
||||
private DefaultApi apiClient;
|
||||
|
||||
/**
|
||||
* A listener that triggers the service, when the localization is toggled on.
|
||||
*/
|
||||
private SharedPreferences.OnSharedPreferenceChangeListener preferenceListener =new SharedPreferences.OnSharedPreferenceChangeListener() {
|
||||
@Override
|
||||
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
|
||||
if (Repository.KEY_PRIVACY_MEASURE.equals(key)) {
|
||||
if (sharedPreferences.getBoolean(key, false)) {
|
||||
MeasureService.runService(MowestaApp.this);
|
||||
} else {
|
||||
MeasureService.stopService(MowestaApp.this);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
PreferenceManager.getDefaultSharedPreferences(this).registerOnSharedPreferenceChangeListener(preferenceListener);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the application repository.
|
||||
*
|
||||
* @return The application repository.
|
||||
*/
|
||||
public Repository getRepository() {
|
||||
if (repository == null) {
|
||||
// lazy initialization to minimize impact at startup
|
||||
repository = new Repository(this);
|
||||
repository.deviceHandle.addValueListener(new IValueListener<DeviceHandle>() {
|
||||
@Override
|
||||
public void onValueChanged(Value<DeviceHandle> source, DeviceHandle oldValue, DeviceHandle newValue) {
|
||||
Log.d(TAG, "Resetting api client due to modified device handle.");
|
||||
apiClient = null;
|
||||
}
|
||||
});
|
||||
PreferenceManager.getDefaultSharedPreferences(this).registerOnSharedPreferenceChangeListener(new SharedPreferences.OnSharedPreferenceChangeListener() {
|
||||
@Override
|
||||
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
|
||||
if (KEY_MOWESTA_URL.equals(key)) {
|
||||
Log.d(TAG, "Resetting api client due to modified url.");
|
||||
apiClient = null;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
return repository;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an api client to access the server.
|
||||
*
|
||||
* @return The api client.
|
||||
*/
|
||||
public DefaultApi getApiClient() {
|
||||
if (apiClient == null) {
|
||||
ApiClient client = new ApiClient();
|
||||
client.setBasePath(getMowestaUrl());
|
||||
if (repository.deviceHandle.getValue() != null) {
|
||||
final String token = repository.deviceHandle.getValue().getToken();
|
||||
client.addAuthorization("bearer", new RequestInterceptor() {
|
||||
@Override
|
||||
public void apply(RequestTemplate requestTemplate) {
|
||||
requestTemplate.header("Authorization", "Bearer " + token);
|
||||
}
|
||||
});
|
||||
}
|
||||
apiClient = client.buildClient(DefaultApi.class);
|
||||
}
|
||||
return apiClient;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new api client that performs basic auth with the specified
|
||||
* username and password. This client is intended only for the login
|
||||
* procedure. For all other tasks, use the method without parameters.
|
||||
*
|
||||
* @param username The username.
|
||||
* @param password The password.
|
||||
* @return The default api client with basic auth.
|
||||
*/
|
||||
public DefaultApi getApiClient(String username, String password) {
|
||||
ApiClient client = new ApiClient();
|
||||
client.setBasePath(getMowestaUrl());
|
||||
client.addAuthorization("basic", new BasicAuthRequestInterceptor(username, password));
|
||||
if (repository.deviceHandle.getValue() != null) {
|
||||
final String token = repository.deviceHandle.getValue().getToken();
|
||||
client.addAuthorization("bearer", new RequestInterceptor() {
|
||||
@Override
|
||||
public void apply(RequestTemplate requestTemplate) {
|
||||
Collection<String> headers = requestTemplate.headers().get("Authorization");
|
||||
List<String> newHeaders = new ArrayList<>();
|
||||
if (headers != null) newHeaders.addAll(headers);
|
||||
newHeaders.add("Bearer " + token);
|
||||
requestTemplate.header("Authorization", newHeaders);
|
||||
}
|
||||
});
|
||||
}
|
||||
return client.buildClient(DefaultApi.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the url to the mowesta service.
|
||||
*
|
||||
* @return The url to the mowesta service.
|
||||
*/
|
||||
private String getMowestaUrl() {
|
||||
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
String defaultUrl = getString(R.string.mowesta_url_default);
|
||||
String url = preferences.getString(KEY_MOWESTA_URL, defaultUrl);
|
||||
try {
|
||||
new URL(url);
|
||||
} catch (Exception e) {
|
||||
Log.d(TAG, "Mowesta url detected, resetting to default.");
|
||||
preferences.edit().putString(KEY_MOWESTA_URL, defaultUrl).apply();
|
||||
url = defaultUrl;
|
||||
}
|
||||
return url;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,139 @@
|
||||
package com.mowesta.android.app;
|
||||
|
||||
import com.mowesta.android.app.fragment.LogoFragment;
|
||||
import com.mowesta.android.app.fragment.TermsFragment;
|
||||
import com.mowesta.android.app.repository.Repository;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import android.view.View;
|
||||
|
||||
/**
|
||||
* Activity displayed at app start, shows mowesta logo and
|
||||
* the license terms or continues to the login or main activity.
|
||||
*
|
||||
* @author sarah
|
||||
*/
|
||||
public class StartActivity extends AppCompatActivity {
|
||||
|
||||
/**
|
||||
* The timeout to show the logo.
|
||||
*/
|
||||
private static final long LOGO_TIMEOUT = 1000;
|
||||
|
||||
/**
|
||||
* The app to access the repository.
|
||||
*/
|
||||
private MowestaApp app;
|
||||
|
||||
/**
|
||||
* The current fragment that is displayed.
|
||||
*/
|
||||
private Fragment currentFragment;
|
||||
/**
|
||||
* The listener that we register in the terms fragment.
|
||||
*/
|
||||
private View.OnClickListener continueListener = new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
continueExecution();
|
||||
}
|
||||
};
|
||||
/**
|
||||
* A runnable that moves on to the next step.
|
||||
*/
|
||||
private Runnable moveOnRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
continueExecution();
|
||||
}
|
||||
};
|
||||
/**
|
||||
* The handler to execute deferred operations.
|
||||
*/
|
||||
private Handler handler = new Handler();
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
app = (MowestaApp) getApplicationContext();
|
||||
setContentView(R.layout.activity_start);
|
||||
currentFragment = getSupportFragmentManager().findFragmentById(R.id.start_content);
|
||||
if (currentFragment == null) {
|
||||
showLogoFragment();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
if (currentFragment instanceof LogoFragment) {
|
||||
handler.postDelayed(moveOnRunnable, LOGO_TIMEOUT);
|
||||
} else if (currentFragment instanceof TermsFragment) {
|
||||
((TermsFragment) currentFragment).setOnContinueListener(continueListener);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
handler.removeCallbacks(moveOnRunnable);
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to continue app execution, shows terms & conditions or starts app directly.
|
||||
*/
|
||||
private void continueExecution() {
|
||||
Repository repository = app.getRepository();
|
||||
if (!repository.isTermsAccepted()) {
|
||||
showTermsFragment();
|
||||
} else if (repository.deviceHandle.getValue() != null) {
|
||||
Intent intent = new Intent(this, LoginActivity.class);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
} else {
|
||||
Intent intent = new Intent(this, MainActivity.class);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the logo fragment.
|
||||
*/
|
||||
private void showLogoFragment() {
|
||||
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
|
||||
currentFragment = new LogoFragment();
|
||||
ft.replace(R.id.start_content, currentFragment);
|
||||
ft.commit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the terms fragment.
|
||||
*/
|
||||
private void showTermsFragment() {
|
||||
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
|
||||
TermsFragment terms = new TermsFragment();
|
||||
terms.setOnContinueListener(continueListener);
|
||||
currentFragment = terms;
|
||||
ft.replace(R.id.start_content, currentFragment);
|
||||
ft.commit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
Fragment f = getSupportFragmentManager().findFragmentById(R.id.start_content);
|
||||
if (f instanceof TermsFragment) {
|
||||
if (((TermsFragment)f).canGoBack()) {
|
||||
((TermsFragment) f).goBack();
|
||||
return;
|
||||
}
|
||||
}
|
||||
super.onBackPressed();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.mowesta.android.app.adapter;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import com.mowesta.android.app.R;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.TextView;
|
||||
|
||||
/**
|
||||
* An alert dialog list adapter that displays an icon and a text.
|
||||
*
|
||||
* @author Marcus
|
||||
*/
|
||||
public class AlertDialogAdapter extends ArrayAdapter<String> {
|
||||
|
||||
/**
|
||||
* The list of images.
|
||||
*/
|
||||
private List<Integer> images;
|
||||
|
||||
/**
|
||||
* Creates a new adapter with the strings and images.
|
||||
*
|
||||
* @param context The context.
|
||||
* @param items The strings.
|
||||
* @param images The images for the strings.
|
||||
*/
|
||||
public AlertDialogAdapter(Context context, String[] items, Integer[] images) {
|
||||
super(context, R.layout.view_alert_dialog, items);
|
||||
this.images = Arrays.asList(images);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
View view = super.getView(position, convertView, parent);
|
||||
TextView textView = (TextView) view.findViewById(R.id.dialog_text);
|
||||
textView.setText(getItem(position));
|
||||
textView.setCompoundDrawablesWithIntrinsicBounds(images.get(position), 0, 0, 0);
|
||||
return view;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.mowesta.android.app.fragment;
|
||||
|
||||
import com.mowesta.android.app.MowestaApp;
|
||||
import com.mowesta.android.app.repository.Repository;
|
||||
|
||||
import android.content.Context;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import android.util.Log;
|
||||
|
||||
/**
|
||||
* A base class for fragments that knows how to access the
|
||||
* application repository and the mowesta app.
|
||||
*
|
||||
* @author Marcus
|
||||
*/
|
||||
public abstract class AbstractFragment extends Fragment {
|
||||
|
||||
/**
|
||||
* The log tag for debug messages.
|
||||
*/
|
||||
private static final String TAG = "AbstractFragment";
|
||||
|
||||
/**
|
||||
* Returns the application repository. Note that
|
||||
* this method can only be called while the fragment_map
|
||||
* is attached to an activity.
|
||||
*
|
||||
* @return A reference to the repository or null.
|
||||
*/
|
||||
public @Nullable Repository getRepository() {
|
||||
MowestaApp app = getApp();
|
||||
if (app != null) return app.getRepository();
|
||||
else return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the application context and casts it
|
||||
* to the appropriate type.
|
||||
*
|
||||
* @return The application context.
|
||||
*/
|
||||
public @Nullable
|
||||
MowestaApp getApp() {
|
||||
Context c = getContext();
|
||||
if (c == null) {
|
||||
Log.d(TAG, "You are trying to access the activity of a fragment while it is not attached (fix your code).");
|
||||
return null;
|
||||
}
|
||||
c = c.getApplicationContext();
|
||||
if (c instanceof MowestaApp) {
|
||||
// this cast will always work unless the mowesta app
|
||||
// is taken out of the application manifest
|
||||
return (MowestaApp)c.getApplicationContext();
|
||||
} else {
|
||||
Log.d(TAG, "Application context does not have the expected type (check app manifest).");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,212 @@
|
||||
package com.mowesta.android.app.fragment;
|
||||
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import android.text.method.PasswordTransformationMethod;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.mowesta.android.app.R;
|
||||
import com.mowesta.android.app.repository.AsyncError;
|
||||
import com.mowesta.android.app.repository.AsyncInteraction;
|
||||
import com.mowesta.android.app.repository.IValueListener;
|
||||
import com.mowesta.android.app.repository.Repository;
|
||||
import com.mowesta.android.app.repository.Value;
|
||||
|
||||
/**
|
||||
* A base class for fragment that handle the login.
|
||||
*
|
||||
* @author sarah
|
||||
*/
|
||||
public abstract class AbstractLoginFragment extends AbstractFragment {
|
||||
|
||||
private Button loginButton;
|
||||
private Button noLoginButton;
|
||||
private ImageButton passwordButton;
|
||||
private TextView registerText;
|
||||
private EditText usernameText;
|
||||
private EditText passwordText;
|
||||
private AlertDialog dialog;
|
||||
private ProgressBar progressBar;
|
||||
|
||||
private int title;
|
||||
private int explanation;
|
||||
private int login;
|
||||
private boolean passwordVisible = false;
|
||||
|
||||
/**
|
||||
* The listener that listens to changes announced by the async task.
|
||||
*/
|
||||
private IValueListener<AsyncInteraction> loginListener = new IValueListener<AsyncInteraction>() {
|
||||
@Override
|
||||
public void onValueChanged(Value<AsyncInteraction> source, AsyncInteraction oldValue, AsyncInteraction newValue) {
|
||||
onUpdateInteraction(newValue);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a login fragment with the specified title resource,
|
||||
* explanation resource and login button resource.
|
||||
*
|
||||
* @param title The string resource with the title.
|
||||
* @param explanation The string resource with the explanation.
|
||||
* @param login The string resource with the login button.
|
||||
*/
|
||||
public AbstractLoginFragment(int title, int explanation, int login) {
|
||||
this.title = title;
|
||||
this.explanation = explanation;
|
||||
this.login = login;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
final View view = inflater.inflate(R.layout.fragment_login, container, false);
|
||||
TextView titleView = (TextView)view.findViewById(R.id.login_title);
|
||||
titleView.setText(title);
|
||||
TextView explainView = (TextView)view.findViewById(R.id.login_explain);
|
||||
explainView.setText(explanation);
|
||||
loginButton = (Button) view.findViewById(R.id.button_login);
|
||||
loginButton.setText(login);
|
||||
noLoginButton = (Button) view.findViewById(R.id.button_no_login);
|
||||
registerText = (TextView) view.findViewById(R.id.text_register);
|
||||
usernameText = (EditText) view.findViewById(R.id.input_username);
|
||||
passwordText = (EditText) view.findViewById(R.id.input_password);
|
||||
progressBar = (ProgressBar) view.findViewById(R.id.progressBar);
|
||||
loginButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
String username = usernameText.getText().toString();
|
||||
String password = passwordText.getText().toString();
|
||||
username = analyzeInput(username);
|
||||
password = analyzeInput(password);
|
||||
if (username == null || password == null) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
|
||||
builder.setMessage(R.string.login_failed_msg);
|
||||
builder.setPositiveButton(android.R.string.ok, null);
|
||||
builder.create().show();
|
||||
} else {
|
||||
onLogin(username, password);
|
||||
}
|
||||
}
|
||||
});
|
||||
passwordButton = (ImageButton) view.findViewById(R.id.button_password);
|
||||
passwordButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
setPasswordVisible(!passwordVisible);
|
||||
}
|
||||
});
|
||||
noLoginButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
onContinue();
|
||||
}
|
||||
});
|
||||
registerText.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// start browser to register at mowesta web app
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(v.getContext().getString(R.string.mowesta_url_register)));
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
return view;
|
||||
}
|
||||
|
||||
public abstract void onLogin(String username, String password);
|
||||
|
||||
public abstract void onContinue();
|
||||
|
||||
private void onUpdateInteraction(AsyncInteraction interaction) {
|
||||
if (interaction == null) {
|
||||
setEnabled(true);
|
||||
hideDialog();
|
||||
} else if (!interaction.isComplete()) {
|
||||
setEnabled(false);
|
||||
hideDialog();
|
||||
} else if (interaction.hasError()) {
|
||||
AsyncError e = interaction.getError();
|
||||
String text = e.getMessage(getActivity());
|
||||
if (text != null) {
|
||||
showDialog(interaction, text);
|
||||
}
|
||||
setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
private void showDialog(final AsyncInteraction interaction, String text) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
|
||||
builder.setMessage(text);
|
||||
builder.setPositiveButton(android.R.string.ok, null);
|
||||
if (interaction.canRetry()) {
|
||||
builder.setNeutralButton(R.string.login_button_retry, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
interaction.retry();
|
||||
}
|
||||
});
|
||||
}
|
||||
dialog = builder.create();
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
private void hideDialog() {
|
||||
if (dialog != null) {
|
||||
dialog.dismiss();
|
||||
dialog = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void setPasswordVisible(boolean visible) {
|
||||
if (visible) {
|
||||
passwordButton.setImageResource(R.drawable.ic_visibility_off_black_24dp);
|
||||
passwordText.setTransformationMethod(null);
|
||||
} else {
|
||||
passwordButton.setImageResource(R.drawable.ic_visibility_black_24dp);
|
||||
passwordText.setTransformationMethod(new PasswordTransformationMethod());
|
||||
}
|
||||
this.passwordVisible = visible;
|
||||
}
|
||||
|
||||
private void setEnabled(boolean enabled) {
|
||||
loginButton.setEnabled(enabled);
|
||||
noLoginButton.setEnabled(enabled);
|
||||
registerText.setEnabled(enabled);
|
||||
usernameText.setEnabled(enabled);
|
||||
passwordText.setEnabled(enabled);
|
||||
progressBar.setVisibility(enabled?View.GONE:View.VISIBLE);
|
||||
if (!enabled) setPasswordVisible(false);
|
||||
}
|
||||
|
||||
private String analyzeInput(String input) {
|
||||
input = input.trim();
|
||||
if (input.length() <= 0) {
|
||||
return null;
|
||||
}
|
||||
return input;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
Repository repository = getRepository();
|
||||
repository.creatingDevice.addValueListener(loginListener, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
Repository repository = getRepository();
|
||||
repository.creatingDevice.removeValueListener(loginListener);
|
||||
super.onPause();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package com.mowesta.android.app.fragment;
|
||||
|
||||
import com.mowesta.android.app.MainActivity;
|
||||
import com.mowesta.android.app.R;
|
||||
import com.mowesta.android.app.repository.IValueListener;
|
||||
import com.mowesta.android.app.repository.Repository;
|
||||
import com.mowesta.android.app.repository.Value;
|
||||
import com.mowesta.android.app.task.CreateDeviceTask;
|
||||
import com.mowesta.android.feign.model.DeviceHandle;
|
||||
|
||||
import android.content.Intent;
|
||||
|
||||
/**
|
||||
* Fragment that handles the login.
|
||||
*
|
||||
* @author sarah
|
||||
*/
|
||||
public class LoginCreateFragment extends AbstractLoginFragment {
|
||||
|
||||
/**
|
||||
* The listener that keeps track of the device creation.
|
||||
*/
|
||||
private IValueListener<DeviceHandle> deviceListener = new IValueListener<DeviceHandle>() {
|
||||
@Override
|
||||
public void onValueChanged(Value<DeviceHandle> source, DeviceHandle oldValue, DeviceHandle newValue) {
|
||||
if (newValue != null) {
|
||||
Intent intent = new Intent();
|
||||
intent.setClass(getActivity(), MainActivity.class);
|
||||
getActivity().startActivity(intent);
|
||||
getActivity().finish();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates the fragment and sets the strings.
|
||||
*/
|
||||
public LoginCreateFragment() {
|
||||
super(R.string.login_title_create, R.string.login_explain_create, R.string.login_button_create);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLogin(String username, String password) {
|
||||
CreateDeviceTask task = new CreateDeviceTask(getApp(), username, password);
|
||||
task.execute();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onContinue() {
|
||||
CreateDeviceTask task = new CreateDeviceTask(getApp());
|
||||
task.execute();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
Repository repository = getRepository();
|
||||
repository.deviceHandle.addValueListener(deviceListener, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
Repository repository = getRepository();
|
||||
repository.deviceHandle.removeValueListener(deviceListener);
|
||||
super.onPause();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.mowesta.android.app.fragment;
|
||||
|
||||
import com.mowesta.android.app.R;
|
||||
import com.mowesta.android.app.repository.IValueListener;
|
||||
import com.mowesta.android.app.repository.Repository;
|
||||
import com.mowesta.android.app.repository.Value;
|
||||
import com.mowesta.android.app.task.UpdateDeviceTask;
|
||||
import com.mowesta.android.feign.model.DeviceHandle;
|
||||
|
||||
/**
|
||||
* A fragment that enables the user to associate an existing device
|
||||
* with an account.
|
||||
*
|
||||
* @author Marcus
|
||||
*/
|
||||
public class LoginUpdateFragment extends AbstractLoginFragment {
|
||||
|
||||
/**
|
||||
* The listener that keeps track of the device updates.
|
||||
*/
|
||||
private IValueListener<DeviceHandle> deviceListener = new IValueListener<DeviceHandle>() {
|
||||
@Override
|
||||
public void onValueChanged(Value<DeviceHandle> source, DeviceHandle oldValue, DeviceHandle newValue) {
|
||||
if (newValue != null && newValue.getUser() != null) {
|
||||
getActivity().finish();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates the fragment and sets the strings.
|
||||
*/
|
||||
public LoginUpdateFragment() {
|
||||
super(R.string.login_title_update, R.string.login_explain_update, R.string.login_button_update);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLogin(String username, String password) {
|
||||
UpdateDeviceTask task = new UpdateDeviceTask(getApp(), username, password);
|
||||
task.execute();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onContinue() {
|
||||
getActivity().finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
Repository repository = getRepository();
|
||||
repository.deviceHandle.addValueListener(deviceListener, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
Repository repository = getRepository();
|
||||
repository.deviceHandle.removeValueListener(deviceListener);
|
||||
super.onPause();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.mowesta.android.app.fragment;
|
||||
|
||||
import com.mowesta.android.app.R;
|
||||
|
||||
import android.os.Bundle;
|
||||
import androidx.annotation.Nullable;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
/**
|
||||
* Fragment to display mowesta logo.
|
||||
*
|
||||
* @author sarah
|
||||
*/
|
||||
public class LogoFragment extends AbstractFragment {
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
return inflater.inflate(R.layout.fragment_logo, container, false);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,382 @@
|
||||
|
||||
package com.mowesta.android.app.fragment;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
|
||||
import com.google.android.gms.oss.licenses.OssLicensesMenuActivity;
|
||||
import com.mowesta.android.app.BuildConfig;
|
||||
import com.mowesta.android.app.MowestaApp;
|
||||
import com.mowesta.android.app.R;
|
||||
import com.mowesta.android.app.repository.Repository;
|
||||
import com.mowesta.android.feign.model.DeviceHandle;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.provider.Settings;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceCategory;
|
||||
import androidx.preference.PreferenceFragmentCompat;
|
||||
import androidx.preference.PreferenceGroup;
|
||||
import androidx.preference.PreferenceScreen;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Toast;
|
||||
|
||||
/**
|
||||
* Displays the preferences.
|
||||
*
|
||||
* @author Sarah
|
||||
*/
|
||||
public class SettingsFragment extends PreferenceFragmentCompat {
|
||||
|
||||
/**
|
||||
* The interface expected from the activity.
|
||||
*/
|
||||
public interface SettingsFragmentActivity {
|
||||
/**
|
||||
* Shows the license terms.
|
||||
*/
|
||||
void showTerms();
|
||||
}
|
||||
|
||||
/**
|
||||
* The number of times a user must click the version button to switch
|
||||
* between developer mode and non-developer mode.
|
||||
*/
|
||||
private static final int DEVELOPMENT_CLICKS = 5;
|
||||
|
||||
/**
|
||||
* The settings fragment log tag.
|
||||
*/
|
||||
private static final String TAG = "SettingsFragment";
|
||||
|
||||
/**
|
||||
* The to show the build information.
|
||||
*/
|
||||
private static final String KEY_ABOUT_BUILD = "about_build";
|
||||
|
||||
/**
|
||||
* The key to show the terms and conditions.
|
||||
*/
|
||||
private static final String KEY_ABOUT_TERMS = "about_terms";
|
||||
|
||||
/**
|
||||
* The key to show the oss licenses.
|
||||
*/
|
||||
private static final String KEY_ABOUT_LICENSES = "about_licenses";
|
||||
|
||||
/**
|
||||
* The key to reset the device.
|
||||
*/
|
||||
private static final String KEY_PRIVACY_RESET = "privacy_reset";
|
||||
|
||||
/**
|
||||
* The key for the development preference category.
|
||||
*/
|
||||
private static final String KEY_DEVELOPMENT = "development";
|
||||
|
||||
/**
|
||||
* The key to show the device id.
|
||||
*/
|
||||
private static final String KEY_DEVELOPMENT_DEVICE = "development_device";
|
||||
|
||||
/**
|
||||
* The key to show the device token.
|
||||
*/
|
||||
private static final String KEY_DEVELOPMENT_TOKEN = "development_token";
|
||||
|
||||
/**
|
||||
* The key for the notification preference category.
|
||||
*/
|
||||
private static final String KEY_NOTIFICATION = "notification";
|
||||
|
||||
/**
|
||||
* The notification settings for the mowesta app.
|
||||
*/
|
||||
private static final String KEY_NOTIFICATION_APP = "notification_app";
|
||||
|
||||
/**
|
||||
* The notification settings for foreground services.
|
||||
*/
|
||||
private static final String KEY_NOTIFICATION_OS = "notification_os";
|
||||
|
||||
|
||||
/**
|
||||
* The number of times the version button has been clicked since the last
|
||||
* loading.
|
||||
*/
|
||||
private int clickCount = 0;
|
||||
|
||||
/**
|
||||
* The preference group with the developmentGroup settings.
|
||||
*/
|
||||
private PreferenceGroup developmentGroup;
|
||||
|
||||
|
||||
@Override
|
||||
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
|
||||
setPreferencesFromResource(R.xml.settings, rootKey);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater paramLayoutInflater, ViewGroup paramViewGroup, Bundle paramBundle) {
|
||||
View v = super.onCreateView(paramLayoutInflater, paramViewGroup, paramBundle);
|
||||
updateBuild();
|
||||
updateDevice();
|
||||
updateNotification();
|
||||
bindReset();
|
||||
bindTerms();
|
||||
bindLicenses();
|
||||
return v;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
clickCount = 0;
|
||||
if (!getRepository().isDevelopmentMode()) {
|
||||
disableDevelopmentMode();
|
||||
} else {
|
||||
enableDevelopmentMode();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the version information by reading out the package version and
|
||||
* the build date of classes.dex.
|
||||
*/
|
||||
private void updateBuild() {
|
||||
try {
|
||||
ApplicationInfo ai = getActivity().getPackageManager().getApplicationInfo(getActivity().getPackageName(), 0);
|
||||
PackageInfo pi = getActivity().getPackageManager().getPackageInfo(getActivity().getPackageName(), 0);
|
||||
String summary = getResources().getString(R.string.setting_about_build_summary);
|
||||
summary = summary.replace("$version$", BuildConfig.VERSION_NAME);
|
||||
summary = summary.replace("$code$", "" + BuildConfig.VERSION_CODE);
|
||||
summary = summary.replace("$build$", SimpleDateFormat.getInstance().format(new java.util.Date(BuildConfig.BUILD_TIME)));
|
||||
setSummary(KEY_ABOUT_BUILD, summary);
|
||||
} catch (Exception e) {
|
||||
setSummary(KEY_ABOUT_BUILD, "?");
|
||||
}
|
||||
setClickListener(KEY_ABOUT_BUILD, new Preference.OnPreferenceClickListener() {
|
||||
@Override
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
clickCount += 1;
|
||||
if (clickCount >= DEVELOPMENT_CLICKS) {
|
||||
boolean mode = !getRepository().isDevelopmentMode();
|
||||
getRepository().setDevelopmentMode(mode);
|
||||
if (mode) {
|
||||
enableDevelopmentMode();
|
||||
Toast.makeText(getActivity(), R.string.setting_development_mode_enter, Toast.LENGTH_SHORT).show();
|
||||
} else {
|
||||
disableDevelopmentMode();
|
||||
Toast.makeText(getActivity(), R.string.setting_development_mode_leave, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
clickCount = 0;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the development mode screen with the device information.
|
||||
*/
|
||||
private void updateDevice() {
|
||||
DeviceHandle h = getRepository().deviceHandle.getValue();
|
||||
if (h != null) {
|
||||
setSummary(KEY_DEVELOPMENT_DEVICE, "" + h.getId());
|
||||
setSummary(KEY_DEVELOPMENT_TOKEN, "" + h.getToken());
|
||||
}
|
||||
}
|
||||
|
||||
private void updateNotification() {
|
||||
PreferenceCategory category = (PreferenceCategory)findPreference(KEY_NOTIFICATION);
|
||||
if (category == null) {
|
||||
Log.d(TAG, "Cannot find notification category.");
|
||||
} else {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
|
||||
// there are no notification settings on older devices
|
||||
getPreferenceScreen().removePreference(category);
|
||||
} else {
|
||||
setClickListener(KEY_NOTIFICATION_APP, createNotificationSettingsListener(getApp().getPackageName(), null));
|
||||
setClickListener(KEY_NOTIFICATION_OS, createNotificationSettingsListener("android", "FOREGROUND_SERVICE"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a preference listener that will open the notification settings for a package
|
||||
* or a channel.
|
||||
*
|
||||
* @param packageName The name of the package.
|
||||
* @param channelId The optional channel id. If id is null, the listener will open the app settings,
|
||||
* otherwise it will open the channel settings.
|
||||
* @return The preference listener to trigger the action.
|
||||
*/
|
||||
@TargetApi(26)
|
||||
private Preference.OnPreferenceClickListener createNotificationSettingsListener(final String packageName, final String channelId) {
|
||||
return new Preference.OnPreferenceClickListener() {
|
||||
@Override
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
Log.d(TAG, "Starting channel settings.");
|
||||
Intent intent = new Intent();
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
intent.putExtra(Settings.EXTRA_APP_PACKAGE, packageName);
|
||||
if (channelId != null) {
|
||||
intent.putExtra(Settings.EXTRA_CHANNEL_ID, channelId);
|
||||
intent.setAction(Settings.ACTION_CHANNEL_NOTIFICATION_SETTINGS);
|
||||
} else {
|
||||
intent.setAction(Settings.ACTION_APP_NOTIFICATION_SETTINGS);
|
||||
}
|
||||
try {
|
||||
startActivity(intent);
|
||||
} catch (ActivityNotFoundException e) {
|
||||
Log.d(TAG, "Failed to open notification settings (" + packageName + ":" + channelId + ").");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Binds the listener to reset the device.
|
||||
*/
|
||||
private void bindReset() {
|
||||
setClickListener(KEY_PRIVACY_RESET, new Preference.OnPreferenceClickListener() {
|
||||
@Override
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
AlertDialog.Builder b = new AlertDialog.Builder(getActivity());
|
||||
b.setTitle(R.string.setting_privacy_reset_title);
|
||||
b.setMessage(R.string.setting_privacy_reset_message);
|
||||
b.setIcon(R.drawable.ic_delete_black_24dp);
|
||||
b.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
getRepository().user.setValue(null);
|
||||
getRepository().deviceHandle.setValue(null); // remove the device handle
|
||||
getActivity().finish();
|
||||
}
|
||||
});
|
||||
b.setNegativeButton(android.R.string.no, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
// nothing to be done
|
||||
}
|
||||
});
|
||||
b.show();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void bindTerms() {
|
||||
setClickListener(KEY_ABOUT_TERMS, new Preference.OnPreferenceClickListener() {
|
||||
@Override
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
SettingsFragmentActivity a = (SettingsFragmentActivity)getActivity();
|
||||
a.showTerms();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private void bindLicenses() {
|
||||
setClickListener(KEY_ABOUT_LICENSES, new Preference.OnPreferenceClickListener() {
|
||||
@Override
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
OssLicensesMenuActivity.setActivityTitle(getString(R.string.setting_about_licenses_title));
|
||||
startActivity(new Intent(getApp(), OssLicensesMenuActivity.class));
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables the developmentGroup mode.
|
||||
*/
|
||||
private void enableDevelopmentMode() {
|
||||
Log.d(TAG, "Enabling development mode.");
|
||||
if (developmentGroup != null) {
|
||||
getPreferenceScreen().addPreference(developmentGroup);
|
||||
developmentGroup = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Disables the developmentGroup mode.
|
||||
*/
|
||||
private void disableDevelopmentMode() {
|
||||
Log.d(TAG, "Disabling development mode.");
|
||||
PreferenceScreen s = getPreferenceScreen();
|
||||
PreferenceGroup group = (PreferenceGroup) findPreference(KEY_DEVELOPMENT);
|
||||
if (s != null && group != null) {
|
||||
developmentGroup = group;
|
||||
s.removePreference(group);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the on preference click listener of a particular preference.
|
||||
*
|
||||
* @param key The key of the preference.
|
||||
* @param listener The listener.
|
||||
*/
|
||||
private void setClickListener(String key, Preference.OnPreferenceClickListener listener) {
|
||||
Preference p = findPreference(key);
|
||||
if (p == null) Log.d(TAG, "Cannot find preference " + key + " (check the code).");
|
||||
else p.setOnPreferenceClickListener(listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the summary of a preference to the specified text.
|
||||
*
|
||||
* @param key The key.
|
||||
* @param text The text.
|
||||
*/
|
||||
private void setSummary(String key, String text) {
|
||||
Preference p = findPreference(key);
|
||||
if (p == null) Log.d(TAG, "Cannot find preference " + key + " (check the code).");
|
||||
else p.setSummary(text);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the repository.
|
||||
*
|
||||
* @return The repository or null.
|
||||
*/
|
||||
private Repository getRepository() {
|
||||
MowestaApp app = getApp();
|
||||
if (app == null) return null;
|
||||
else return app.getRepository();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the mowesta app.
|
||||
*
|
||||
* @return The mowesta app or null.
|
||||
*/
|
||||
private MowestaApp getApp() {
|
||||
Context c = getActivity();
|
||||
if (c != null) c = c.getApplicationContext();
|
||||
if (c instanceof MowestaApp) {
|
||||
return (MowestaApp)c;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,164 @@
|
||||
package com.mowesta.android.app.fragment;
|
||||
|
||||
import com.mowesta.android.app.R;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.net.MailTo;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import androidx.annotation.Nullable;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.webkit.WebView;
|
||||
import android.webkit.WebViewClient;
|
||||
import android.widget.Button;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
|
||||
/**
|
||||
* Fragment to display terms & conditions and ask for research permission.
|
||||
*
|
||||
* @author sarah
|
||||
*/
|
||||
public class TermsFragment extends AbstractFragment {
|
||||
|
||||
/**
|
||||
* The log tag for debugging.
|
||||
*/
|
||||
private static final String TAG = "TermsFragment";
|
||||
|
||||
/**
|
||||
* The listener that is executed when the user hits the continue button.
|
||||
*/
|
||||
private View.OnClickListener continueListener;
|
||||
|
||||
/**
|
||||
* Sets the listener that is executed when the user hits the continue button.
|
||||
*
|
||||
* @param continueListener The lis
|
||||
*/
|
||||
public void setOnContinueListener(View.OnClickListener continueListener) {
|
||||
this.continueListener = continueListener;
|
||||
}
|
||||
|
||||
/**
|
||||
* The web view we are using.
|
||||
*/
|
||||
private WebView webView;
|
||||
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressLint("SetJavaScriptEnabled") // its ok, we need it for the dsgvo viewer
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.fragment_terms, container, false);
|
||||
// load the license terms from the assets folder
|
||||
webView = (WebView) view.findViewById(R.id.web_view);
|
||||
webView.getSettings().setJavaScriptEnabled(true);
|
||||
if (Build.VERSION.SDK_INT >= 16) {
|
||||
webView.getSettings().setAllowFileAccessFromFileURLs(true);
|
||||
}
|
||||
webView.setWebViewClient(new WebViewClient() {
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
||||
if (url.startsWith("mailto:")) {
|
||||
openMailto(url);
|
||||
} else if (url.startsWith("tel:")) {
|
||||
openTel(url);
|
||||
} else {
|
||||
return super.shouldOverrideUrlLoading(view, url);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
webView.loadUrl("file:///android_asset/terms.html");
|
||||
View acceptView = view.findViewById(R.id.fragment_terms_accept);
|
||||
acceptView.setVisibility(getRepository().isTermsAccepted()?View.GONE:View.VISIBLE);
|
||||
final Button continueButton = (Button) view.findViewById(R.id.start_button_continue);
|
||||
continueButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
getRepository().setTermsAccepted(true);
|
||||
if (continueListener != null) continueListener.onClick(v);
|
||||
}
|
||||
});
|
||||
|
||||
final CheckBox permissionCheckbox = (CheckBox) view.findViewById(R.id.permission_checkbox_start);
|
||||
permissionCheckbox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
continueButton.setEnabled(isChecked);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the web view can navigate to a previous page.
|
||||
*
|
||||
* @return True if back navigation is possible.
|
||||
*/
|
||||
public boolean canGoBack() {
|
||||
if (webView != null) return webView.canGoBack();
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Navigates to the previous page in the web view.
|
||||
*/
|
||||
public void goBack() {
|
||||
if (webView != null) webView.goBack();;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Opens an email from a mailto url.
|
||||
*
|
||||
* @param url The mailto url.
|
||||
*/
|
||||
private void openMailto(String url) {
|
||||
final Activity activity = getActivity();
|
||||
if (activity != null) {
|
||||
try {
|
||||
MailTo mt = MailTo.parse(url);
|
||||
Intent intent = new Intent(Intent.ACTION_SEND);
|
||||
intent.putExtra(Intent.EXTRA_EMAIL, new String[] { mt.getTo() });
|
||||
intent.putExtra(Intent.EXTRA_TEXT, mt.getBody());
|
||||
intent.putExtra(Intent.EXTRA_SUBJECT, mt.getSubject());
|
||||
intent.putExtra(Intent.EXTRA_CC, mt.getCc());
|
||||
intent.setType("message/rfc822");
|
||||
activity.startActivity(intent);
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "Failed to create email.", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens a tel link from an url.
|
||||
*
|
||||
* @param url The tel url.
|
||||
*/
|
||||
private void openTel(String url) {
|
||||
if (url.startsWith("tel:")) {
|
||||
try {
|
||||
Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse(url));
|
||||
startActivity(intent);
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "Failed to dial number.", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.mowesta.android.app.fragment;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.webkit.WebView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mowesta.android.app.R;
|
||||
|
||||
public class WebViewFragment extends AbstractFragment {
|
||||
|
||||
WebView webView;
|
||||
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setRetainInstance(true);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
@SuppressLint("SetJavaScriptEnabled")
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
View v = inflater.inflate(R.layout.fragment_webview, container, false);
|
||||
webView = v.findViewById(R.id.web_view);
|
||||
webView.loadUrl("https://www.mowesta.com/app/login");
|
||||
webView.getSettings().setJavaScriptEnabled(true);
|
||||
webView.getSettings().setLoadWithOverviewMode(true);
|
||||
return v;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
package com.mowesta.android.app.model;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import android.util.Log;
|
||||
|
||||
/**
|
||||
* Utilities to set fields in the model generated by the feign module
|
||||
* that are marked in swagger as read-only and thus, result in
|
||||
* missing setters. This is using reflection, so it is not type-safe.
|
||||
*
|
||||
* @author Marcus
|
||||
*/
|
||||
public class ModelUtils {
|
||||
|
||||
/**
|
||||
* The model utilities.
|
||||
*/
|
||||
public static final String TAG = "ModelUtils";
|
||||
|
||||
/**
|
||||
* The fields that we already searched for cached globally and for
|
||||
* the lifetime of the linux process to avoid repeated lookup through
|
||||
* the inheritance hierarchy.
|
||||
*/
|
||||
private static final Map<Class<?>, Map<String, Field>> fields = new HashMap<>();
|
||||
|
||||
/**
|
||||
* Sets the field with the specified name to the specified long value.
|
||||
*
|
||||
* @param o The object whose field should be set.
|
||||
* @param name The name of the field.
|
||||
* @param value The value to set.
|
||||
* @return True if set, false if something happens.
|
||||
*/
|
||||
public static boolean setField(@NonNull Object o, @NonNull String name, long value) {
|
||||
return setField(o, name, new Class[]{long.class, Long.class}, value);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the field with the specified name to the specified value.
|
||||
*
|
||||
* @param o The object whose field should be set.
|
||||
* @param name The name of the field.
|
||||
* @param expectedFieldTypes The expected type(s) of the field.
|
||||
* @param value The value to set.
|
||||
* @return True if success, false otherwise.
|
||||
*/
|
||||
public static boolean setField(@NonNull Object o, @NonNull String name, @NonNull Class<?>[] expectedFieldTypes, Object value) {
|
||||
try {
|
||||
Field f = getField(o.getClass(), name);
|
||||
if (f == null) {
|
||||
Log.e(TAG, "Cannot find field " + name + " in class " + o.getClass().getName() + " (fix your code).");
|
||||
return false;
|
||||
}
|
||||
// perform type check on the field type
|
||||
boolean typeFound = false;
|
||||
for (int i = expectedFieldTypes.length - 1; i >= 0; i--) {
|
||||
if (expectedFieldTypes[i] == f.getType()) {
|
||||
typeFound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!typeFound) {
|
||||
Log.e(TAG, "Cannot set value to field " + name + " of type " + f.getType().getName() + " in class " + o.getClass().getName() + " (fix your code).");
|
||||
return false;
|
||||
} else {
|
||||
f.set(o, value);
|
||||
return true;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "Failure while setting field value (this should not happen).", e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the first field with the specified name from the class.
|
||||
*
|
||||
* @param c The class.
|
||||
* @param name The name of the field.
|
||||
* @return The first field or null.
|
||||
*/
|
||||
public static Field getField(@NonNull Class<?> c, @NonNull String name) {
|
||||
Map<String, Field> fs = fields.get(c);
|
||||
if (fs == null) {
|
||||
fs = new HashMap<>();
|
||||
fields.put(c, fs);
|
||||
}
|
||||
if (!fs.containsKey(name)) {
|
||||
Field f = findField(c, name);
|
||||
// open the vm protection of the field
|
||||
if (f != null) {
|
||||
f.setAccessible(true);
|
||||
}
|
||||
fs.put(name, f);
|
||||
}
|
||||
return fs.get(name);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Searches a field in the inheritance hierarchy with
|
||||
* a specified name and returns the first declared field.
|
||||
*
|
||||
* @param c The class to start from.
|
||||
* @param name The name of the field.
|
||||
* @return The field or null.
|
||||
*/
|
||||
private static @Nullable
|
||||
Field findField(@NonNull Class<?> c, String name) {
|
||||
List<Class<?>> moreClasses = new ArrayList<>();
|
||||
moreClasses.add(c);
|
||||
while (moreClasses.size() > 0) {
|
||||
Class<?> next = moreClasses.remove(0);
|
||||
if (next.getSuperclass() != Object.class) {
|
||||
moreClasses.add(next.getSuperclass());
|
||||
}
|
||||
Field[] fields = next.getDeclaredFields();
|
||||
for (int i = 0; i < fields.length; i++) {
|
||||
if (fields[i].getName().equals(name)) {
|
||||
return fields[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
package com.mowesta.android.app.repository;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
/**
|
||||
* Models a remote error that has an integer error code,
|
||||
* and an optional string message or an optional resource
|
||||
* id.
|
||||
*
|
||||
* @author Marcus
|
||||
*/
|
||||
public class AsyncError {
|
||||
|
||||
/**
|
||||
* The resource id or null.
|
||||
*/
|
||||
private Integer resource;
|
||||
|
||||
/**
|
||||
* The string or null.
|
||||
*/
|
||||
private String string;
|
||||
|
||||
/**
|
||||
* The error code.
|
||||
*/
|
||||
private int code;
|
||||
|
||||
/**
|
||||
* Creates a remote error without message.
|
||||
*
|
||||
* @param code The code.
|
||||
*/
|
||||
public AsyncError(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a remote error with the specified
|
||||
* string message.
|
||||
*
|
||||
* @param code The error code.
|
||||
* @param str The text string.
|
||||
*/
|
||||
public AsyncError(int code, String str) {
|
||||
this.string = str;
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a remote error with the specified
|
||||
* resource id as message.
|
||||
*
|
||||
* @param code The code.
|
||||
* @param res The resource id.
|
||||
*/
|
||||
public AsyncError(int code, int res) {
|
||||
this.resource = res;
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the remote error code.
|
||||
*
|
||||
* @return The remote error code.
|
||||
*/
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether the resource
|
||||
* is set.
|
||||
*
|
||||
* @return True if the error contains a
|
||||
* resource id as message.
|
||||
*/
|
||||
private boolean hasResource() {
|
||||
return resource != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether a string message is set.
|
||||
*
|
||||
* @return True if a string message is set.
|
||||
*/
|
||||
private boolean hasString() {
|
||||
return string != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the string message or null, if none
|
||||
* is set.
|
||||
*
|
||||
* @return The string message.
|
||||
*/
|
||||
public String getString() {
|
||||
return string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the message for the error, if it has one.
|
||||
*
|
||||
* @param context The context to resolve resource ids.
|
||||
* @return The message.
|
||||
*/
|
||||
public String getMessage(Context context) {
|
||||
if (hasString()) {
|
||||
return string;
|
||||
}
|
||||
if (hasResource()) {
|
||||
return context.getResources().getString(resource);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CODE (" + code + ") RESOURCE (" + resource + ") STRING (" + string + ")";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
package com.mowesta.android.app.repository;
|
||||
|
||||
/**
|
||||
* Represents the state of a remote interaction.
|
||||
*
|
||||
* @author Marcus
|
||||
*/
|
||||
public class AsyncInteraction {
|
||||
|
||||
/**
|
||||
* A flag to indicate whether the interaction
|
||||
* is complete.
|
||||
*/
|
||||
private boolean complete;
|
||||
|
||||
/**
|
||||
* An optional error to signal a problem during
|
||||
* the execution.
|
||||
*/
|
||||
private AsyncError error;
|
||||
|
||||
/**
|
||||
* An optional task to retry the execution.
|
||||
*/
|
||||
private Runnable retryTask;
|
||||
|
||||
/**
|
||||
* A flag to memorize whether we retried
|
||||
* the execution.
|
||||
*/
|
||||
private boolean retried;
|
||||
|
||||
/**
|
||||
* Creates a remote interaction that is
|
||||
* either ongoing or completed without error.
|
||||
*
|
||||
* @param complete True to mark as complete,
|
||||
* false to mark as ongoing.
|
||||
*/
|
||||
public AsyncInteraction(boolean complete) {
|
||||
this.complete = complete;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a completed remote interaction
|
||||
* that has an error but cannot be retried.
|
||||
*
|
||||
* @param error The error, must not be null.
|
||||
* @throws NullPointerException Thrown if the error is null.
|
||||
*/
|
||||
public AsyncInteraction(AsyncError error) {
|
||||
if (error == null) {
|
||||
throw new NullPointerException("Error must not be null.");
|
||||
}
|
||||
this.complete = true;
|
||||
this.error = error;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a completed remote interaction that has
|
||||
* an error but can be retried.
|
||||
*
|
||||
* @param error The error.
|
||||
* @param retryTask The retry task.
|
||||
* @throws NullPointerException Thrown if the error or the task are null.
|
||||
*/
|
||||
public AsyncInteraction(AsyncError error, Runnable retryTask) {
|
||||
this(error);
|
||||
if (retryTask == null) {
|
||||
throw new NullPointerException("Retry task must not be null.");
|
||||
}
|
||||
this.retryTask = retryTask;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether the task is complete.
|
||||
*
|
||||
* @return True if complete.
|
||||
*/
|
||||
public boolean isComplete() {
|
||||
return complete;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether there is an error.
|
||||
*
|
||||
* @return True if there is an error.
|
||||
*/
|
||||
public boolean hasError() {
|
||||
return error != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the error or null.
|
||||
*
|
||||
* @return The error if set or null.
|
||||
*/
|
||||
public AsyncError getError() {
|
||||
return error;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether the interaction can
|
||||
* be retried.
|
||||
*
|
||||
* @return True if retried, false otherwise.
|
||||
*/
|
||||
public boolean canRetry() {
|
||||
return retryTask != null && !retried;
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes the retry task and marks it as
|
||||
* retried.
|
||||
*/
|
||||
public void retry() {
|
||||
if (retryTask != null && !retried) {
|
||||
retried = true;
|
||||
retryTask.run();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.mowesta.android.app.repository;
|
||||
|
||||
/**
|
||||
* An interface for listeners.
|
||||
*
|
||||
* @author Marcus
|
||||
*
|
||||
* @param <T> The type of the value.
|
||||
*/
|
||||
public interface IValueListener<T> {
|
||||
|
||||
/**
|
||||
* Called whenever the value of the source changes.
|
||||
*
|
||||
* @param source The source emitting the event.
|
||||
* @param oldValue The old value that is no longer valid.
|
||||
* @param newValue The new value that has been set.
|
||||
*/
|
||||
void onValueChanged(Value<T> source, T oldValue, T newValue);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.mowesta.android.app.repository;
|
||||
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
/**
|
||||
* A serializer that uses jackson's object mapper
|
||||
* to serialize and deserialize data. This serializer
|
||||
* can be used to store any data type used by the api.
|
||||
*
|
||||
* @author Marcus
|
||||
*
|
||||
* @param <T> The type of the serializer.
|
||||
*/
|
||||
public class JacksonSerializer<T> implements Serializer<T> {
|
||||
|
||||
/**
|
||||
* The type to serialize.
|
||||
*/
|
||||
private Class<T> type;
|
||||
|
||||
/**
|
||||
* The object mapper provided by jackson.
|
||||
*/
|
||||
private ObjectMapper mapper;
|
||||
|
||||
/**
|
||||
* Creates a new serializer for the type.
|
||||
*
|
||||
* @param type The type.
|
||||
*/
|
||||
public JacksonSerializer(Class<T> type) {
|
||||
this.type = type;
|
||||
this.mapper = new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public T read(String data) throws Exception {
|
||||
if (data.length() == 0) {
|
||||
return null;
|
||||
}
|
||||
return mapper.readValue(data, type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String write(T object) throws Exception {
|
||||
if (object == null) {
|
||||
return "";
|
||||
}
|
||||
return mapper.writeValueAsString(object);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,158 @@
|
||||
package com.mowesta.android.app.repository;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import android.content.Context;
|
||||
import androidx.annotation.Nullable;
|
||||
import android.util.Log;
|
||||
|
||||
/**
|
||||
* A value that is stored on disk.
|
||||
*
|
||||
* @author Marcus
|
||||
*
|
||||
* @param <T> The type of the value.
|
||||
*/
|
||||
public class PersistentValue<T> extends Value<T> {
|
||||
|
||||
/**
|
||||
* The log tag for debugging.
|
||||
*/
|
||||
private static final String TAG = "PersistentValue";
|
||||
|
||||
/**
|
||||
* The relative file name to store the data.
|
||||
*/
|
||||
private String filename;
|
||||
|
||||
/**
|
||||
* The serializer to (de)serialize the data.
|
||||
*/
|
||||
private Serializer<T> serializer;
|
||||
|
||||
/**
|
||||
* Creates a persistent value for the repository that can
|
||||
* be read and written using the serializer and that will
|
||||
* be stored in a private with the specified name.
|
||||
*
|
||||
* @param repository The repository.
|
||||
* @param serializer The serializer.
|
||||
* @param filename The file name.
|
||||
*/
|
||||
public PersistentValue(Repository repository, Serializer<T> serializer, String filename) {
|
||||
this(repository, serializer, filename, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a persistent value for the repository that can
|
||||
* be read and written using the serializer and that will
|
||||
* be stored in a private with the specified name.
|
||||
*
|
||||
* @param repository The repository.
|
||||
* @param serializer The serializer.
|
||||
* @param filename The file name.
|
||||
* @param initialValue The initial value to be used, if
|
||||
* there is no stored data or the stored data cannot be
|
||||
* loaded.
|
||||
*/
|
||||
public PersistentValue(Repository repository, Serializer<T> serializer, String filename, T initialValue) {
|
||||
super(repository);
|
||||
this.filename = filename;
|
||||
this.serializer = serializer;
|
||||
if (!load()) {
|
||||
this.value = initialValue;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the data and returns true if successful.
|
||||
*
|
||||
* @return True if the data was loaded, false if
|
||||
* there was not data stored or the data could
|
||||
* not be loaded.
|
||||
*/
|
||||
private boolean load() {
|
||||
File source = getFile();
|
||||
if (!source.exists()) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
FileInputStream fis = new FileInputStream(source);
|
||||
try {
|
||||
// load the file contents
|
||||
ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
||||
byte[] buffer = new byte[2048];
|
||||
int read;
|
||||
while ((read = fis.read(buffer)) != -1) {
|
||||
bos.write(buffer, 0, read);
|
||||
}
|
||||
String data = new String(bos.toByteArray(), "UTF-8");
|
||||
try {
|
||||
this.value = serializer.read(data);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "Failed to deserialize data.", e);
|
||||
return false;
|
||||
}
|
||||
} finally {
|
||||
fis.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
Log.e(TAG, "Failed to load data.", e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Stores the data that is passed to the method.
|
||||
*
|
||||
* @param value The value to store.
|
||||
* @return True if successful, false otherwise.
|
||||
*/
|
||||
private boolean store(T value) {
|
||||
byte[] data;
|
||||
try {
|
||||
String s = serializer.write(value);
|
||||
data = s.getBytes("UTF-8");
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "Failed to serialize data.", e);
|
||||
return false;
|
||||
}
|
||||
File file = getFile();
|
||||
try {
|
||||
FileOutputStream fos = new FileOutputStream(file);
|
||||
try {
|
||||
fos.write(data);
|
||||
} finally {
|
||||
fos.close();
|
||||
}
|
||||
return true;
|
||||
} catch (IOException e) {
|
||||
Log.e(TAG, "Failed to write data.", e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the location of the file to store
|
||||
* and load the data.
|
||||
*
|
||||
* @return The file to store and load data.
|
||||
*/
|
||||
private File getFile() {
|
||||
Context c = getRepository().getContext();
|
||||
File dir = c.getFilesDir();
|
||||
return new File(dir, filename);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValue(@Nullable T value) {
|
||||
store(value);
|
||||
super.setValue(value);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,153 @@
|
||||
package com.mowesta.android.app.repository;
|
||||
|
||||
import com.mowesta.android.app.R;
|
||||
import com.mowesta.android.feign.model.DeviceHandle;
|
||||
import com.mowesta.android.feign.model.User;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.preference.PreferenceManager;
|
||||
|
||||
|
||||
/**
|
||||
* A class that models the central data repository for information
|
||||
* that should be made available globally. Note that it really makes
|
||||
* no sense to store data here that is only used and modified inside
|
||||
* a view.
|
||||
*
|
||||
* @author Marcus
|
||||
*/
|
||||
public class Repository {
|
||||
|
||||
/**
|
||||
* * The key to globally enable or disable any background measurements.
|
||||
*/
|
||||
public static final String KEY_PRIVACY_MEASURE = "privacy_measure";
|
||||
|
||||
/**
|
||||
* The key to memorize whether we are in development mode.
|
||||
*/
|
||||
private static final String KEY_DEVELOPMENT_MODE = "development_mode";
|
||||
|
||||
/**
|
||||
* The key to determine whether the user accepted the license conditions.
|
||||
*/
|
||||
private static final String KEY_TERMS_ACCEPTED = "terms_accepted";
|
||||
|
||||
/**
|
||||
* A remote interaction state that is used to keep track of the initial
|
||||
* login and device creation.
|
||||
*/
|
||||
public final Value<AsyncInteraction> creatingDevice = new Value<>(this, null);
|
||||
/**
|
||||
* The device handle that is stored persistently on disk as a json string in
|
||||
* a file.
|
||||
*/
|
||||
public final Value<DeviceHandle> deviceHandle ;
|
||||
|
||||
/**
|
||||
* A remote interaction state that is used to keep track of the user update procedure.
|
||||
*/
|
||||
public final Value<Boolean> updatingUser = new Value<>(this, Boolean.FALSE);
|
||||
|
||||
/**
|
||||
* The user associated with the device that is stored persistently on disk as
|
||||
* a json string in a file.
|
||||
*/
|
||||
public final Value<User> user;
|
||||
|
||||
/**
|
||||
* The context associated with the repository.
|
||||
*/
|
||||
protected Context context;
|
||||
|
||||
/**
|
||||
* Creates a new repository with the specified context.
|
||||
*
|
||||
* @param context The context.
|
||||
*/
|
||||
public Repository(Context context) {
|
||||
this.context = context;
|
||||
this.deviceHandle = new PersistentValue<DeviceHandle>(this, new JacksonSerializer<DeviceHandle>(DeviceHandle.class), "device.json");
|
||||
this.user = new PersistentValue<User>(this, new JacksonSerializer<User>(User.class), "user.json");
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the repository's context.
|
||||
*
|
||||
* @return The context.
|
||||
*/
|
||||
public Context getContext() {
|
||||
return context;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether localization is globally enabled.
|
||||
*
|
||||
* @return True if localization is globally enabled, false otherwise.
|
||||
*/
|
||||
public boolean isMeasurementEnabled() {
|
||||
return getPreference(KEY_PRIVACY_MEASURE, R.bool.privacy_measure_default);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether the app is in development mode.
|
||||
*
|
||||
* @return True to if development mode.
|
||||
*/
|
||||
public boolean isDevelopmentMode() {
|
||||
return getPreference(KEY_DEVELOPMENT_MODE, R.bool.development_mode_default);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether the app is in development mode.
|
||||
*
|
||||
* @param enabled True to enable development mode, false otherwise.
|
||||
*/
|
||||
public void setDevelopmentMode(boolean enabled) {
|
||||
setPreference(KEY_DEVELOPMENT_MODE, enabled);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether the license terms are accepted by the user.
|
||||
*
|
||||
* @return True if the terms are accepted, false otherwise.
|
||||
*/
|
||||
public boolean isTermsAccepted() {
|
||||
return getPreference(KEY_TERMS_ACCEPTED, R.bool.terms_accepted_default);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the flag whether the user has accepted the license terms.
|
||||
*
|
||||
* @param accept True to mark as accepted, false otherwise.
|
||||
*/
|
||||
public void setTermsAccepted(boolean accept) {
|
||||
setPreference(KEY_TERMS_ACCEPTED, accept);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns a boolean preference if set, or the default value otherwise.
|
||||
*
|
||||
* @param key The key of the preference.
|
||||
* @param defaultValue The resource with the default value.
|
||||
* @return The value of the preference.
|
||||
*/
|
||||
private boolean getPreference(String key, int defaultValue) {
|
||||
boolean def = getContext().getResources().getBoolean(defaultValue);
|
||||
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(getContext());
|
||||
return preferences.getBoolean(key, def);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the preference with the key to the value.
|
||||
*
|
||||
* @param key The key of the preference.
|
||||
* @param value The value of the preference.
|
||||
*/
|
||||
private void setPreference(String key, boolean value) {
|
||||
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(getContext());
|
||||
preferences.edit().putBoolean(key, value).apply();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.mowesta.android.app.repository;
|
||||
|
||||
/**
|
||||
* A serializer and deserializer for objects of a particular
|
||||
* type.
|
||||
*
|
||||
* @author Marcus
|
||||
* @param <T> The type of the serializer.
|
||||
*/
|
||||
public interface Serializer<T> {
|
||||
|
||||
/**
|
||||
* Deserializes the object from the string
|
||||
* or throws an exception, if the string
|
||||
* cannot be deserialized.
|
||||
*
|
||||
* @param data The data representing the object.
|
||||
* @return The deserialized object.
|
||||
* @throws Exception Thrown if the deserialization fails.
|
||||
*/
|
||||
T read(String data) throws Exception;
|
||||
|
||||
/**
|
||||
* Serializes the object into a string
|
||||
* or throws an exception, if the serialization
|
||||
* fails.
|
||||
*
|
||||
* @param object The object to write.
|
||||
* @return The string representing the object.
|
||||
* @throws Exception Thrown if the deserialization fails.
|
||||
*/
|
||||
String write(T object) throws Exception;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,154 @@
|
||||
package com.mowesta.android.app.repository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* A value that can be observed by a value listener.
|
||||
*
|
||||
* @param <T> The type of the value.
|
||||
* @author Marcus
|
||||
*/
|
||||
public class Value<T> {
|
||||
|
||||
/**
|
||||
* The current value.
|
||||
*/
|
||||
protected @Nullable
|
||||
T value;
|
||||
/**
|
||||
* The repository context.
|
||||
*/
|
||||
protected Repository repository;
|
||||
/**
|
||||
* The list of change listeners that is currently registered. We are using
|
||||
* a copy on write array list here since we expect that clients might be
|
||||
* calling the remove method inside an event handler and we assume that the
|
||||
* number of registrations is lower than the number of fired events (otherwise
|
||||
* it would be more efficient to copy the list when firing an event).
|
||||
*/
|
||||
private List<IValueListener<T>> valueListeners = new CopyOnWriteArrayList<>();
|
||||
|
||||
/**
|
||||
* Creates a new value with the repository.
|
||||
*
|
||||
* @param repository The repository to set.
|
||||
*/
|
||||
public Value(Repository repository) {
|
||||
this.repository = repository;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new value with the repository and
|
||||
* the specified initial value.
|
||||
*
|
||||
* @param repository The repository.
|
||||
* @param initialValue The initial value.
|
||||
*/
|
||||
public Value(Repository repository, T initialValue) {
|
||||
this.repository = repository;
|
||||
this.value = initialValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the repository that hosts the value.
|
||||
*
|
||||
* @return The repository hosting the value.
|
||||
*/
|
||||
public Repository getRepository() {
|
||||
return repository;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current value.
|
||||
*
|
||||
* @return The current value.
|
||||
*/
|
||||
public @Nullable
|
||||
T getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the current value and notifies
|
||||
* all listeners.
|
||||
*
|
||||
* @param value The value to set.
|
||||
*/
|
||||
public void setValue(@Nullable T value) {
|
||||
setValue(value, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value and conditionally notifies the listeners.
|
||||
*
|
||||
* @param value The new value to set.
|
||||
* @param notifyListeners whether to notify listeners
|
||||
*/
|
||||
private void setValue(@Nullable T value, boolean notifyListeners) {
|
||||
T oldValue = this.value;
|
||||
this.value = value;
|
||||
if (notifyListeners) {
|
||||
fireChange(oldValue, value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Signals a change to all registered listeners.
|
||||
*
|
||||
* @param oldValue The old value.
|
||||
* @param newValue The new value.
|
||||
*/
|
||||
private void fireChange(@Nullable T oldValue, @Nullable T newValue) {
|
||||
for (IValueListener<T> valueListener : valueListeners) {
|
||||
valueListener.onValueChanged(this, oldValue, newValue);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a value listener to the set of listeners.
|
||||
*
|
||||
* @param listener The listener to add.
|
||||
*/
|
||||
public void addValueListener(@NonNull IValueListener<T> listener) {
|
||||
addValueListener(listener, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a value listener to the set of listeners and optionally
|
||||
* calls the listener's onValueChange method as part of the registration.
|
||||
* If notify immediately is set, the onValueChange event sent to the
|
||||
* listener will have both, the old and the new value, set to the current
|
||||
* value.
|
||||
*
|
||||
* @param listener The listener to add.
|
||||
* @param notifyImmediately A flag to indicate whether the listeners
|
||||
* onValueChanged method should be called immediately as a side-effect
|
||||
* of this method. Note that the call will then occur (!) before the
|
||||
* method returns.
|
||||
*/
|
||||
public void addValueListener(@NonNull IValueListener<T> listener, boolean notifyImmediately) {
|
||||
valueListeners.add(listener);
|
||||
if (notifyImmediately) {
|
||||
listener.onValueChanged(this, value, value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the specified listener from the set of registered listeners
|
||||
* and returns whether a listener has been removed.
|
||||
*
|
||||
* @param listener The listener to remove.
|
||||
* @return True if a listener has been found and removed, false if the
|
||||
* listener was not registered.
|
||||
*/
|
||||
public boolean removeValueListener(@Nullable IValueListener<T> listener) {
|
||||
return valueListeners.remove(listener);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.mowesta.android.app.task;
|
||||
|
||||
import com.mowesta.android.app.MowestaApp;
|
||||
import com.mowesta.android.feign.api.DefaultApi;
|
||||
|
||||
import android.os.AsyncTask;
|
||||
|
||||
/**
|
||||
* An async task that executes an api operation in the background.
|
||||
*
|
||||
* @author Marcus
|
||||
*
|
||||
* @param <Params> The parameter type of the task.
|
||||
* @param <Progress> The progress type of the task.
|
||||
* @param <Result> The result type of the task.
|
||||
*/
|
||||
public abstract class AbstractApiTask<Params, Progress, Result> extends AsyncTask<Params, Progress, Result> {
|
||||
|
||||
/**
|
||||
* The app.
|
||||
*/
|
||||
protected MowestaApp app;
|
||||
|
||||
/**
|
||||
* The api client.
|
||||
*/
|
||||
protected DefaultApi apiClient;
|
||||
|
||||
/**
|
||||
* Creates a new api task.
|
||||
*
|
||||
* @param app The app.
|
||||
*/
|
||||
public AbstractApiTask(MowestaApp app) {
|
||||
this.app = app;
|
||||
this.apiClient = app.getApiClient();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,156 @@
|
||||
package com.mowesta.android.app.task;
|
||||
|
||||
import java.net.HttpURLConnection;
|
||||
|
||||
import com.mowesta.android.app.MowestaApp;
|
||||
import com.mowesta.android.app.R;
|
||||
import com.mowesta.android.app.repository.AsyncError;
|
||||
import com.mowesta.android.app.repository.AsyncInteraction;
|
||||
import com.mowesta.android.feign.model.DeviceHandle;
|
||||
import com.mowesta.android.feign.model.DeviceInfo;
|
||||
import com.mowesta.android.feign.model.User;
|
||||
|
||||
import android.os.Build;
|
||||
import android.util.Log;
|
||||
import feign.FeignException;
|
||||
|
||||
/**
|
||||
* A task that will create a new device, either with
|
||||
* or without a user. The task will report the result
|
||||
* through the repository.
|
||||
*
|
||||
* @author Marcus
|
||||
*/
|
||||
public class CreateDeviceTask extends AbstractApiTask<Void, Void, AsyncError> {
|
||||
|
||||
/**
|
||||
* The log tag for the task.
|
||||
*/
|
||||
private static final String TAG = "CreateDeviceTask";
|
||||
|
||||
/**
|
||||
* The error code for network errors.
|
||||
*/
|
||||
public static final int ERROR_NETWORK = 1;
|
||||
/**
|
||||
* The error code for login errors.
|
||||
*/
|
||||
public static final int ERROR_LOGIN = 2;
|
||||
|
||||
/**
|
||||
* The optional username.
|
||||
*/
|
||||
private String username;
|
||||
/**
|
||||
* The optional password.
|
||||
*/
|
||||
private String password;
|
||||
/**
|
||||
* A flag that determines whether there is a user.
|
||||
*/
|
||||
private boolean authenticated;
|
||||
|
||||
/**
|
||||
* The device handle that has been fetched.
|
||||
*/
|
||||
private DeviceHandle deviceHandle;
|
||||
|
||||
/**
|
||||
* Creates a create device task without username and password.
|
||||
*
|
||||
* @param app The app.
|
||||
*/
|
||||
public CreateDeviceTask(MowestaApp app) {
|
||||
this(app, null, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a create device task with the specified username and
|
||||
* password.
|
||||
*
|
||||
* @param app The app.
|
||||
* @param username The username.
|
||||
* @param password The password.
|
||||
*/
|
||||
public CreateDeviceTask(MowestaApp app, String username, String password) {
|
||||
super(app);
|
||||
this.username = username;
|
||||
this.password = password;
|
||||
authenticated = (username != null && password != null);
|
||||
if (authenticated) {
|
||||
apiClient = app.getApiClient(username, password);
|
||||
} else {
|
||||
apiClient = app.getApiClient();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes the task.
|
||||
*/
|
||||
public void execute() {
|
||||
app.getRepository().creatingDevice.setValue(new AsyncInteraction(false));
|
||||
super.execute(new Void[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AsyncError doInBackground(Void... voids) {
|
||||
if (authenticated) {
|
||||
try {
|
||||
User user = apiClient.getCurrentUser();
|
||||
Log.d(TAG, "Login success for " + username + " with id " + (user==null?"":user.getId()) + ".");
|
||||
} catch (FeignException e) {
|
||||
Log.d(TAG, "Login failure: " + e.status() + " " + e.getMessage());
|
||||
return getError(e);
|
||||
}
|
||||
}
|
||||
try {
|
||||
DeviceInfo deviceInfo = new DeviceInfo();
|
||||
deviceInfo.setDevice(Build.DEVICE);
|
||||
deviceInfo.setManufacturer(Build.MANUFACTURER);
|
||||
deviceInfo.setOs(DeviceInfo.OsEnum.ANDROID);
|
||||
deviceInfo.setModel(Build.MODEL);
|
||||
deviceHandle = apiClient.createDevice(deviceInfo);
|
||||
Log.d(TAG, "Device created for user id " + (deviceHandle==null?"":deviceHandle.getUser()) + ".");
|
||||
} catch (FeignException e) {
|
||||
Log.d(TAG, "Device creation failure: " + e.status() + " " + e.getMessage());
|
||||
return getError(e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a feign exception into an error.
|
||||
*
|
||||
* @param e The exception.
|
||||
* @return The associated error.
|
||||
*/
|
||||
private AsyncError getError(FeignException e) {
|
||||
if (e.status() == HttpURLConnection.HTTP_FORBIDDEN) {
|
||||
return new AsyncError(ERROR_LOGIN, R.string.login_failed_msg);
|
||||
} else {
|
||||
return new AsyncError(ERROR_NETWORK, R.string.login_device_failed);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(AsyncError asyncError) {
|
||||
AsyncInteraction interaction;
|
||||
if (asyncError == null) {
|
||||
interaction = new AsyncInteraction(true);
|
||||
} else if (asyncError.getCode() == ERROR_LOGIN){
|
||||
// do not allow retry when username and password are wrong
|
||||
interaction = new AsyncInteraction(asyncError);
|
||||
} else {
|
||||
// allow retry for everything else
|
||||
final CreateDeviceTask retry = new CreateDeviceTask(app, username, password);
|
||||
interaction = new AsyncInteraction(asyncError, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
retry.execute();
|
||||
}
|
||||
});
|
||||
}
|
||||
app.getRepository().creatingDevice.setValue(interaction);
|
||||
if (deviceHandle != null) app.getRepository().deviceHandle.setValue(deviceHandle);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,160 @@
|
||||
package com.mowesta.android.app.task;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import com.mowesta.android.app.MowestaApp;
|
||||
import com.mowesta.android.app.R;
|
||||
import com.mowesta.android.app.repository.AsyncError;
|
||||
import com.mowesta.android.app.repository.AsyncInteraction;
|
||||
import com.mowesta.android.feign.model.Device;
|
||||
import com.mowesta.android.feign.model.DeviceHandle;
|
||||
import com.mowesta.android.feign.model.User;
|
||||
|
||||
import java.net.HttpURLConnection;
|
||||
|
||||
import feign.FeignException;
|
||||
|
||||
/**
|
||||
* A task that will associate an existing device with a user.
|
||||
* The task will report the result through the repository.
|
||||
*
|
||||
* @author Marcus
|
||||
*/
|
||||
public class UpdateDeviceTask extends AbstractApiTask<Void, Void, AsyncError> {
|
||||
|
||||
/**
|
||||
* The log tag for the task.
|
||||
*/
|
||||
private static final String TAG = "UpdateDeviceTask";
|
||||
|
||||
/**
|
||||
* The error code for network errors.
|
||||
*/
|
||||
public static final int ERROR_NETWORK = 1;
|
||||
/**
|
||||
* The error code for login errors.
|
||||
*/
|
||||
public static final int ERROR_LOGIN = 2;
|
||||
/**
|
||||
* The error code if the device has been associated already.
|
||||
*/
|
||||
public static final int ERROR_UPDATE = 3;
|
||||
|
||||
/**
|
||||
* The optional username.
|
||||
*/
|
||||
private String username;
|
||||
/**
|
||||
* The optional password.
|
||||
*/
|
||||
private String password;
|
||||
|
||||
/**
|
||||
* The device that has been registered.
|
||||
*/
|
||||
private Device device;
|
||||
|
||||
/**
|
||||
* The user that has been fetched.
|
||||
*/
|
||||
private User user;
|
||||
|
||||
/**
|
||||
* Creates a create device task with the specified username and
|
||||
* password.
|
||||
*
|
||||
* @param app The app.
|
||||
* @param username The username.
|
||||
* @param password The password.
|
||||
*/
|
||||
public UpdateDeviceTask(MowestaApp app, String username, String password) {
|
||||
super(app);
|
||||
this.username = username;
|
||||
this.password = password;
|
||||
apiClient = app.getApiClient(username, password);
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes the task.
|
||||
*/
|
||||
public void execute() {
|
||||
app.getRepository().creatingDevice.setValue(new AsyncInteraction(false));
|
||||
super.execute(new Void[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AsyncError doInBackground(Void... voids) {
|
||||
try {
|
||||
user = apiClient.getCurrentUser();
|
||||
Log.d(TAG, "Login success for " + username + " with id " + (user==null?"":user.getId()) + ".");
|
||||
} catch (FeignException e) {
|
||||
Log.d(TAG, "Login failure for user: " + e.status() + " " + e.getMessage());
|
||||
return getError(e);
|
||||
}
|
||||
try {
|
||||
device = apiClient.getCurrentDevice();
|
||||
Log.d(TAG, "Login success for device with id " + (device==null?"":device.getId()) + ".");
|
||||
} catch (FeignException e) {
|
||||
Log.d(TAG, "Login failure for device:" + e.status() + " " + e.getMessage());
|
||||
return getError(e);
|
||||
}
|
||||
try {
|
||||
device = apiClient.setCurrentDeviceUser();
|
||||
Log.d(TAG, "Device associated for user id " + device.getUser() + ".");
|
||||
} catch (FeignException e) {
|
||||
Log.d(TAG, "Device creation failure: " + e.status() + " " + e.getMessage());
|
||||
return getError(e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a feign exception into an error.
|
||||
*
|
||||
* @param e The exception.
|
||||
* @return The associated error.
|
||||
*/
|
||||
private AsyncError getError(FeignException e) {
|
||||
if (e.status() == HttpURLConnection.HTTP_FORBIDDEN) {
|
||||
return new AsyncError(ERROR_LOGIN, R.string.login_failed_msg);
|
||||
} else if (e.status() == HttpURLConnection.HTTP_CONFLICT) {
|
||||
return new AsyncError(ERROR_UPDATE, R.string.login_conflict_msg);
|
||||
} else {
|
||||
return new AsyncError(ERROR_NETWORK, R.string.login_device_failed);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(AsyncError asyncError) {
|
||||
AsyncInteraction interaction;
|
||||
if (asyncError == null) {
|
||||
interaction = new AsyncInteraction(true);
|
||||
} else if (asyncError.getCode() == ERROR_LOGIN || asyncError.getCode() == ERROR_UPDATE){
|
||||
// do not allow retry when username and password are wrong
|
||||
interaction = new AsyncInteraction(asyncError);
|
||||
} else {
|
||||
// allow retry for everything else
|
||||
final UpdateDeviceTask retry = new UpdateDeviceTask(app, username, password);
|
||||
interaction = new AsyncInteraction(asyncError, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
retry.execute();
|
||||
}
|
||||
});
|
||||
}
|
||||
app.getRepository().creatingDevice.setValue(interaction);
|
||||
DeviceHandle handle = app.getRepository().deviceHandle.getValue();
|
||||
if (device != null && device.getUser() != null) {
|
||||
Log.d(TAG, "Updating device handle.");
|
||||
handle.setUser(device.getUser());
|
||||
app.getRepository().deviceHandle.setValue(handle);
|
||||
if (user != null && device.getUser().equals(user.getId())) {
|
||||
Log.d(TAG, "Setting user directly.");
|
||||
app.getRepository().user.setValue(user);
|
||||
} else {
|
||||
Log.d(TAG, "Setting user via task.");
|
||||
new UpdateUserTask(app).execute();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package com.mowesta.android.app.task;
|
||||
|
||||
import com.mowesta.android.app.MowestaApp;
|
||||
import com.mowesta.android.app.repository.Repository;
|
||||
import com.mowesta.android.feign.model.DeviceHandle;
|
||||
import com.mowesta.android.feign.model.User;
|
||||
|
||||
import android.util.Log;
|
||||
import feign.FeignException;
|
||||
|
||||
/**
|
||||
* A task that updates the user in the background.
|
||||
*
|
||||
* @author Marcus
|
||||
*/
|
||||
public class UpdateUserTask extends AbstractApiTask<Void, Void, User> {
|
||||
|
||||
/**
|
||||
* The log tag.
|
||||
*/
|
||||
private static final String TAG = "UpdateUserTask";
|
||||
|
||||
/**
|
||||
* The repository.
|
||||
*/
|
||||
private Repository repository;
|
||||
|
||||
/**
|
||||
* The app.
|
||||
*
|
||||
* @param app The app.
|
||||
*/
|
||||
public UpdateUserTask(MowestaApp app) {
|
||||
super(app);
|
||||
repository = app.getRepository();
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes the upload task.
|
||||
*/
|
||||
public void execute() {
|
||||
DeviceHandle handle = app.getRepository().deviceHandle.getValue();
|
||||
boolean hasUser = (handle != null) && (handle.getUser() != null);
|
||||
boolean isUpdating = repository.updatingUser.getValue();
|
||||
if (hasUser && !isUpdating) {
|
||||
Log.d(TAG, "Update user started.");
|
||||
repository.updatingUser.setValue(Boolean.TRUE);
|
||||
super.execute(new Void[0]);
|
||||
} else if (isUpdating) {
|
||||
Log.d(TAG, "Ignoring request for user update due to running update.");
|
||||
} else if (! hasUser) {
|
||||
Log.d(TAG, "Ignoring request for user update due to missing user.");
|
||||
repository.user.setValue(null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected User doInBackground(Void... voids) {
|
||||
try {
|
||||
return apiClient.getCurrentDeviceUser();
|
||||
} catch (FeignException e) {
|
||||
Log.d(TAG, "Failed to update user.", e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(User user) {
|
||||
super.onPostExecute(user);
|
||||
if (user != null) repository.user.setValue(user);
|
||||
repository.updatingUser.setValue(Boolean.FALSE);
|
||||
Log.d(TAG, "Update user finished.");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package com.mowesta.android.app.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.mowesta.android.app.R;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
import android.util.TypedValue;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
/**
|
||||
* A snackbar that is properly colored based on the theme.
|
||||
*
|
||||
* @author Marcus
|
||||
*/
|
||||
public class ColoredSnackbar {
|
||||
|
||||
/**
|
||||
* Creates a snackbar.
|
||||
*
|
||||
* @param view The view.
|
||||
* @param text The text.
|
||||
* @param duration The duration.
|
||||
* @return The snackbar.
|
||||
*/
|
||||
public static Snackbar make(View view, CharSequence text, int duration) {
|
||||
Snackbar snackbar = Snackbar.make(view, text, duration);
|
||||
snackbar.getView().setBackgroundColor(getAttribute(view.getContext(), R.attr.colorAccent));
|
||||
List<View> views = new ArrayList<>();
|
||||
views.add(snackbar.getView());
|
||||
while (! views.isEmpty()) {
|
||||
View v = views.remove(0);
|
||||
if (v instanceof ViewGroup) {
|
||||
ViewGroup vg = (ViewGroup)v;
|
||||
for (int i = vg.getChildCount() - 1; i >= 0; i--) {
|
||||
views.add(vg.getChildAt(i));
|
||||
}
|
||||
} else if (v instanceof TextView) {
|
||||
((TextView)v).setTextColor(Color.BLACK);
|
||||
}
|
||||
}
|
||||
return snackbar;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates a snackbar.
|
||||
*
|
||||
* @param view The view.
|
||||
* @param resId The text resource.
|
||||
* @param duration The duration.
|
||||
* @return The snackbar.
|
||||
*/
|
||||
public static Snackbar make(View view, int resId, int duration) {
|
||||
return make(view, view.getResources().getText(resId), duration);
|
||||
}
|
||||
|
||||
|
||||
private static int getAttribute(Context context, int resId) {
|
||||
TypedValue typedValue = new TypedValue();
|
||||
context.getTheme().resolveAttribute(resId, typedValue, true);
|
||||
return typedValue.data;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package com.mowesta.android.app.util;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
/**
|
||||
* Formats timestamps as date, time or date with time.
|
||||
*
|
||||
* @author Mark
|
||||
*/
|
||||
public class DateFormatter {
|
||||
|
||||
/**
|
||||
* The context to load the user defaults.
|
||||
*/
|
||||
private Context context;
|
||||
|
||||
/**
|
||||
* Creates a new formatter.
|
||||
*
|
||||
* @param context The context.
|
||||
*/
|
||||
public DateFormatter(Context context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats the time in Epoch millis as date with time.
|
||||
*
|
||||
* @param time The time in epoch millis.
|
||||
* @return The formatted date with time.
|
||||
*/
|
||||
public String asDateTime(long time) {
|
||||
Date date = new Date(time);
|
||||
return getDateFormat().format(date) + " " + getTimeFormat().format(date);
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats the time in Epoch millis as date.
|
||||
*
|
||||
* @param time The time in epoch millis.
|
||||
* @return The formatted date.
|
||||
*/
|
||||
public String asDate(long time) {
|
||||
return getDateFormat().format(new Date(time));
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats the time in Epoch millis as time.
|
||||
*
|
||||
* @param time The time in epoch millis.
|
||||
* @return The formatted time.
|
||||
*/
|
||||
public String asTime(long time) {
|
||||
return getTimeFormat().format(new Date(time));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the date format that is set for the device.
|
||||
*
|
||||
* @return The date format to generate dates.
|
||||
*/
|
||||
private DateFormat getDateFormat() {
|
||||
return android.text.format.DateFormat.getDateFormat(context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the time format that is set for the device.
|
||||
*
|
||||
* @return The time format to generate times.
|
||||
*/
|
||||
private DateFormat getTimeFormat() {
|
||||
return android.text.format.DateFormat.getTimeFormat(context);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.mowesta.android.app.util;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
|
||||
/**
|
||||
* Utility to detect tablets running in landscape mode.
|
||||
*
|
||||
* @author Marcus
|
||||
*/
|
||||
public class TabletUtil {
|
||||
|
||||
/**
|
||||
* Returns true if this device has a large screen.
|
||||
*
|
||||
* @param context The context.
|
||||
* @return True if there is a large screen.
|
||||
*/
|
||||
public static boolean isTablet(Context context) {
|
||||
return (context.getResources().getConfiguration().screenLayout
|
||||
& Configuration.SCREENLAYOUT_SIZE_MASK)
|
||||
>= Configuration.SCREENLAYOUT_SIZE_LARGE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this device is in landscape mode.
|
||||
*
|
||||
* @param context The context.
|
||||
* @return True if landscape mode.
|
||||
*/
|
||||
public static boolean isLandscape(Context context) {
|
||||
return context.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the device has a large screen AND is in landscape mode.
|
||||
*
|
||||
* @param context The context.
|
||||
* @return True if tablet in landscape, false otherwise.
|
||||
*/
|
||||
public static boolean isLandscapeTablet(Context context) {
|
||||
return isLandscape(context) && isTablet(context);
|
||||
}
|
||||
|
||||
}
|
||||
|
After Width: | Height: | Size: 36 KiB |
|
After Width: | Height: | Size: 857 B |
|
After Width: | Height: | Size: 608 B |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 1.9 KiB |
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape>
|
||||
<gradient
|
||||
android:gradientRadius="100%p"
|
||||
android:centerX="0.2"
|
||||
android:endColor="#00695C"
|
||||
android:startColor="#ABBDD1"
|
||||
android:type="radial" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
||||
@@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M6,18c0,0.55 0.45,1 1,1h1v3.5c0,0.83 0.67,1.5 1.5,1.5s1.5,-0.67 1.5,-1.5L11,19h2v3.5c0,0.83 0.67,1.5 1.5,1.5s1.5,-0.67 1.5,-1.5L16,19h1c0.55,0 1,-0.45 1,-1L18,8L6,8v10zM3.5,8C2.67,8 2,8.67 2,9.5v7c0,0.83 0.67,1.5 1.5,1.5S5,17.33 5,16.5v-7C5,8.67 4.33,8 3.5,8zM20.5,8c-0.83,0 -1.5,0.67 -1.5,1.5v7c0,0.83 0.67,1.5 1.5,1.5s1.5,-0.67 1.5,-1.5v-7c0,-0.83 -0.67,-1.5 -1.5,-1.5zM15.53,2.16l1.3,-1.3c0.2,-0.2 0.2,-0.51 0,-0.71 -0.2,-0.2 -0.51,-0.2 -0.71,0l-1.48,1.48C13.85,1.23 12.95,1 12,1c-0.96,0 -1.86,0.23 -2.66,0.63L7.85,0.15c-0.2,-0.2 -0.51,-0.2 -0.71,0 -0.2,0.2 -0.2,0.51 0,0.71l1.31,1.31C6.97,3.26 6,5.01 6,7h12c0,-1.99 -0.97,-3.75 -2.47,-4.84zM10,5L9,5L9,4h1v1zM15,5h-1L14,4h1v1z"/>
|
||||
</vector>
|
||||
@@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M9.4,16.6L4.8,12l4.6,-4.6L8,6l-6,6 6,6 1.4,-1.4zM14.6,16.6l4.6,-4.6 -4.6,-4.6L16,6l6,6 -6,6 -1.4,-1.4z"/>
|
||||
</vector>
|
||||
@@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M6,19c0,1.1 0.9,2 2,2h8c1.1,0 2,-0.9 2,-2V7H6v12zM19,4h-3.5l-1,-1h-5l-1,1H5v2h14V4z"/>
|
||||
</vector>
|
||||
@@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M6,19c0,1.1 0.9,2 2,2h8c1.1,0 2,-0.9 2,-2L18,7L6,7v12zM8.46,11.88l1.41,-1.41L12,12.59l2.12,-2.12 1.41,1.41L13.41,14l2.12,2.12 -1.41,1.41L12,15.41l-2.12,2.12 -1.41,-1.41L10.59,14l-2.13,-2.12zM15.5,4l-1,-1h-5l-1,1L5,4v2h14L19,4z"/>
|
||||
</vector>
|
||||
@@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M4,6h18L22,4L4,4c-1.1,0 -2,0.9 -2,2v11L0,17v3h14v-3L4,17L4,6zM23,8h-6c-0.55,0 -1,0.45 -1,1v10c0,0.55 0.45,1 1,1h6c0.55,0 1,-0.45 1,-1L24,9c0,-0.55 -0.45,-1 -1,-1zM22,17h-4v-7h4v7z"/>
|
||||
</vector>
|
||||
@@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M12,8c-2.21,0 -4,1.79 -4,4s1.79,4 4,4 4,-1.79 4,-4 -1.79,-4 -4,-4zM20.94,11c-0.46,-4.17 -3.77,-7.48 -7.94,-7.94L13,1h-2v2.06C6.83,3.52 3.52,6.83 3.06,11L1,11v2h2.06c0.46,4.17 3.77,7.48 7.94,7.94L11,23h2v-2.06c4.17,-0.46 7.48,-3.77 7.94,-7.94L23,13v-2h-2.06zM12,19c-3.87,0 -7,-3.13 -7,-7s3.13,-7 7,-7 7,3.13 7,7 -3.13,7 -7,7z"/>
|
||||
</vector>
|
||||
@@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M11,17h2v-6h-2v6zM12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,20c-4.41,0 -8,-3.59 -8,-8s3.59,-8 8,-8 8,3.59 8,8 -3.59,8 -8,8zM11,9h2L13,7h-2v2z"/>
|
||||
</vector>
|
||||
@@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M19,19H5V5h7V3H5c-1.11,0 -2,0.9 -2,2v14c0,1.1 0.89,2 2,2h14c1.1,0 2,-0.9 2,-2v-7h-2v7zM14,3v2h3.59l-9.83,9.83 1.41,1.41L19,6.41V10h2V3h-7z"/>
|
||||
</vector>
|
||||
@@ -0,0 +1,29 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:aapt="http://schemas.android.com/aapt"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="2999.8975"
|
||||
android:viewportHeight="3028.25">
|
||||
<group android:translateX="622.4787"
|
||||
android:translateY="605.65">
|
||||
<path
|
||||
android:pathData="M877.47,0l181.73,454.24l438.74,-188.16l-181.73,454.24l438.73,188.16l-438.73,188.15l181.73,454.24l-438.74,-188.16l-181.73,454.24l-181.73,-454.24l-438.74,188.16l181.74,-454.24l-438.74,-188.15l438.74,-188.16l-181.74,-454.24l438.74,188.16z"
|
||||
android:fillColor="#FFD95A"/>
|
||||
<path
|
||||
android:pathData="M877.47,205.26l129.23,53.52l139.88,0l98.91,98.91l129.23,53.53l53.53,129.23l98.91,98.92l0,139.88l53.53,129.23l-53.53,129.23l0,139.88l-98.91,98.91l-53.53,129.23l-129.23,53.53l-98.91,98.91l-139.88,0l-129.23,53.53l-129.23,-53.53l-139.88,0l-98.91,-98.91l-129.23,-53.53l-53.53,-129.23l-98.91,-98.91l0,-139.89l-53.53,-129.22l53.53,-129.24l0,-139.87l98.91,-98.91l53.53,-129.24l129.23,-53.52l98.91,-98.92l139.88,0z"
|
||||
android:fillColor="#FFD95A"/>
|
||||
<path
|
||||
android:pathData="M877.47,908.48m-607.8,0a607.8,607.8 0,1 1,1215.6 0a607.8,607.8 0,1 1,-1215.6 0">
|
||||
<aapt:attr name="android:fillColor">
|
||||
<gradient
|
||||
android:gradientRadius="607.7969"
|
||||
android:centerX="1205.875"
|
||||
android:centerY="555.6719"
|
||||
android:type="radial">
|
||||
<item android:offset="0" android:color="#FFFFFFFF"/>
|
||||
<item android:offset="1" android:color="#FFF9A825"/>
|
||||
</gradient>
|
||||
</aapt:attr>
|
||||
</path>
|
||||
</group>
|
||||
</vector>
|
||||
@@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M3.9,12c0,-1.71 1.39,-3.1 3.1,-3.1h4L11,7L7,7c-2.76,0 -5,2.24 -5,5s2.24,5 5,5h4v-1.9L7,15.1c-1.71,0 -3.1,-1.39 -3.1,-3.1zM8,13h8v-2L8,11v2zM17,7h-4v1.9h4c1.71,0 3.1,1.39 3.1,3.1s-1.39,3.1 -3.1,3.1h-4L13,17h4c2.76,0 5,-2.24 5,-5s-2.24,-5 -5,-5z"/>
|
||||
</vector>
|
||||
@@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M12,17c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2 -2,0.9 -2,2 0.9,2 2,2zM18,8h-1L17,6c0,-2.76 -2.24,-5 -5,-5S7,3.24 7,6v2L6,8c-1.1,0 -2,0.9 -2,2v10c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2L20,10c0,-1.1 -0.9,-2 -2,-2zM8.9,6c0,-1.71 1.39,-3.1 3.1,-3.1s3.1,1.39 3.1,3.1v2L8.9,8L8.9,6zM18,20L6,20L6,10h12v10z"/>
|
||||
</vector>
|
||||
@@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M12,22c1.1,0 2,-0.9 2,-2h-4c0,1.1 0.9,2 2,2zM18,16v-5c0,-3.07 -1.63,-5.64 -4.5,-6.32L13.5,4c0,-0.83 -0.67,-1.5 -1.5,-1.5s-1.5,0.67 -1.5,1.5v0.68C7.64,5.36 6,7.92 6,11v5l-2,2v1h16v-1l-2,-2zM16,17L8,17v-6c0,-2.48 1.51,-4.5 4,-4.5s4,2.02 4,4.5v6z"/>
|
||||
</vector>
|
||||
@@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M13,7h-2v2h2L13,7zM13,11h-2v6h2v-6zM17,1.01L7,1c-1.1,0 -2,0.9 -2,2v18c0,1.1 0.9,2 2,2h10c1.1,0 2,-0.9 2,-2L19,3c0,-1.1 -0.9,-1.99 -2,-1.99zM17,19L7,19L7,5h10v14z"/>
|
||||
</vector>
|
||||
@@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M12,5.9c1.16,0 2.1,0.94 2.1,2.1s-0.94,2.1 -2.1,2.1S9.9,9.16 9.9,8s0.94,-2.1 2.1,-2.1m0,9c2.97,0 6.1,1.46 6.1,2.1v1.1L5.9,18.1L5.9,17c0,-0.64 3.13,-2.1 6.1,-2.1M12,4C9.79,4 8,5.79 8,8s1.79,4 4,4 4,-1.79 4,-4 -1.79,-4 -4,-4zM12,13c-2.67,0 -8,1.34 -8,4v3h16v-3c0,-2.66 -5.33,-4 -8,-4z"/>
|
||||
</vector>
|
||||
@@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M15,12c2.21,0 4,-1.79 4,-4s-1.79,-4 -4,-4 -4,1.79 -4,4 1.79,4 4,4zM6,10L6,7L4,7v3L1,10v2h3v3h2v-3h3v-2L6,10zM15,14c-2.67,0 -8,1.34 -8,4v2h16v-2c0,-2.66 -5.33,-4 -8,-4z"/>
|
||||
</vector>
|
||||
@@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M19.1,12.9a2.8,2.8 0,0 0,0.1 -0.9,2.8 2.8,0 0,0 -0.1,-0.9l2.1,-1.6a0.7,0.7 0,0 0,0.1 -0.6L19.4,5.5a0.7,0.7 0,0 0,-0.6 -0.2l-2.4,1a6.5,6.5 0,0 0,-1.6 -0.9l-0.4,-2.6a0.5,0.5 0,0 0,-0.5 -0.4H10.1a0.5,0.5 0,0 0,-0.5 0.4L9.3,5.4a5.6,5.6 0,0 0,-1.7 0.9l-2.4,-1a0.4,0.4 0,0 0,-0.5 0.2l-2,3.4c-0.1,0.2 0,0.4 0.2,0.6l2,1.6a2.8,2.8 0,0 0,-0.1 0.9,2.8 2.8,0 0,0 0.1,0.9L2.8,14.5a0.7,0.7 0,0 0,-0.1 0.6l1.9,3.4a0.7,0.7 0,0 0,0.6 0.2l2.4,-1a6.5,6.5 0,0 0,1.6 0.9l0.4,2.6a0.5,0.5 0,0 0,0.5 0.4h3.8a0.5,0.5 0,0 0,0.5 -0.4l0.3,-2.6a5.6,5.6 0,0 0,1.7 -0.9l2.4,1a0.4,0.4 0,0 0,0.5 -0.2l2,-3.4c0.1,-0.2 0,-0.4 -0.2,-0.6ZM12,15.6A3.6,3.6 0,1 1,15.6 12,3.6 3.6,0 0,1 12,15.6Z"/>
|
||||
</vector>
|
||||
@@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M12,1L3,5v6c0,5.55 3.84,10.74 9,12 5.16,-1.26 9,-6.45 9,-12L21,5l-9,-4zM10,17l-4,-4 1.41,-1.41L10,14.17l6.59,-6.59L18,9l-8,8z"/>
|
||||
</vector>
|
||||
@@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M12,4.5C7,4.5 2.73,7.61 1,12c1.73,4.39 6,7.5 11,7.5s9.27,-3.11 11,-7.5c-1.73,-4.39 -6,-7.5 -11,-7.5zM12,17c-2.76,0 -5,-2.24 -5,-5s2.24,-5 5,-5 5,2.24 5,5 -2.24,5 -5,5zM12,9c-1.66,0 -3,1.34 -3,3s1.34,3 3,3 3,-1.34 3,-3 -1.34,-3 -3,-3z"/>
|
||||
</vector>
|
||||
@@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M12,7c2.76,0 5,2.24 5,5 0,0.65 -0.13,1.26 -0.36,1.83l2.92,2.92c1.51,-1.26 2.7,-2.89 3.43,-4.75 -1.73,-4.39 -6,-7.5 -11,-7.5 -1.4,0 -2.74,0.25 -3.98,0.7l2.16,2.16C10.74,7.13 11.35,7 12,7zM2,4.27l2.28,2.28 0.46,0.46C3.08,8.3 1.78,10.02 1,12c1.73,4.39 6,7.5 11,7.5 1.55,0 3.03,-0.3 4.38,-0.84l0.42,0.42L19.73,22 21,20.73 3.27,3 2,4.27zM7.53,9.8l1.55,1.55c-0.05,0.21 -0.08,0.43 -0.08,0.65 0,1.66 1.34,3 3,3 0.22,0 0.44,-0.03 0.65,-0.08l1.55,1.55c-0.67,0.33 -1.41,0.53 -2.2,0.53 -2.76,0 -5,-2.24 -5,-5 0,-0.79 0.2,-1.53 0.53,-2.2zM11.84,9.02l3.15,3.15 0.02,-0.16c0,-1.66 -1.34,-3 -3,-3l-0.17,0.01z"/>
|
||||
</vector>
|
||||
@@ -0,0 +1,82 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="97.0978dp"
|
||||
android:height="7.6401dp"
|
||||
android:viewportWidth="17235.49"
|
||||
android:viewportHeight="1356.17">
|
||||
<path
|
||||
android:pathData="M1233.1,1333.9l-164.6,0l0,-1115.5l-374.1,1115.5l-155.7,0l-373.8,-1115.5l0,1115.5l-164.9,0l0,-1311.6l260.5,0l355.2,1093.2l357,-1093.2l260.5,0z"
|
||||
android:fillColor="#FEFEFE"
|
||||
android:fillType="nonZero"/>
|
||||
<path
|
||||
android:pathData="M1888.7,363.1c135.3,0 243.4,43.4 324.3,129.8 80.9,86.4 121.2,208.9 121.2,366.8 0,157.6 -40.3,279.7 -121.2,366.4 -80.9,86.7 -189,130.1 -324.3,130.1 -134.7,0 -242.5,-43.4 -323.4,-130.1 -80.9,-86.7 -121.2,-208.9 -121.2,-366.4 0,-157.9 40.3,-280.3 121.2,-366.8 80.9,-86.4 188.7,-129.8 323.4,-129.8zM1888.7,1223.9c80.6,0 146,-30.5 196.1,-91.9 50.1,-61.1 75.1,-151.8 75.1,-272.4 0,-120.9 -25,-212.2 -75.1,-273.3 -50.1,-61.1 -115.4,-91.6 -196.1,-91.6 -80.6,0 -145.7,30.5 -196,91.6 -50.1,61.1 -75.1,152.4 -75.1,273.3 0,120.6 25,211.3 75.1,272.4 50.4,61.4 115.4,91.9 196,91.9z"
|
||||
android:fillColor="#FEFEFE"
|
||||
android:fillType="nonZero"/>
|
||||
<path
|
||||
android:pathData="M2692.2,498.4c75.1,-90.1 165.5,-135.3 271.2,-135.3 124,0 219.9,44 288,131.9 68.1,87.9 102,207 102,356.7 0,155.7 -38.2,278.5 -114.2,368.9 -76,90.4 -171.9,135.6 -287.4,135.6 -102.6,0 -189.4,-31.8 -259.6,-95.6l0,73.3 -169.2,0 0,-1311.6 169.2,0 0,476.1zM2692.2,1108.5c72.1,76.9 155.1,115.4 248.6,115.4 73,0 130.7,-31.1 173.8,-93.8 42.7,-62.3 64.4,-155.1 64.4,-278.5 0,-117 -20.5,-205.5 -61.1,-266.3 -40.3,-60.5 -97.1,-90.7 -169.8,-90.7 -93.7,0 -178.9,54.3 -255.9,162.8l0,451z"
|
||||
android:fillColor="#FEFEFE"
|
||||
android:fillType="nonZero"/>
|
||||
<path
|
||||
android:pathData="M3711.2,1333.9l-169.2,0 0,-949.1 169.2,0 0,949.1zM3711.2,204.9l-169.2,0 0,-182.6 169.2,0 0,182.6z"
|
||||
android:fillColor="#FEFEFE"
|
||||
android:fillType="nonZero"/>
|
||||
<path
|
||||
android:pathData="M4128.9,1333.9l-169.2,0l0,-1311.6l169.2,0z"
|
||||
android:fillColor="#FEFEFE"
|
||||
android:fillType="nonZero"/>
|
||||
<path
|
||||
android:pathData="M4781.2,1356.2c-139.6,0 -251.9,-43.7 -336.5,-131 -84.6,-87.3 -127,-209.2 -127,-365.5 0,-155.1 40.9,-276.7 123.1,-364.6 81.8,-87.9 189,-131.9 321.5,-131.9 135.3,0 243.4,43.4 324.3,129.8 80.9,86.4 121.2,208.9 121.2,366.8l0,40.3 -714.9,0c7.3,109.6 37.6,191.2 91,244.3 53.2,53.1 119.1,79.7 197.3,79.7 58.9,0 112.1,-15.3 159.4,-45.2 47.6,-30.3 72.4,-73 74.8,-128.6l174.4,0c-13.1,98 -57.4,173.5 -132.8,226.3 -75.4,53.1 -167.4,79.7 -275.8,79.7zM5029.8,767.7c-13.8,-91.3 -44.6,-159.7 -92.2,-204.9 -47.6,-45.5 -106,-68.1 -175.3,-68.1 -67.5,0 -125.2,22.6 -173.4,67.5 -48.6,45.2 -79.1,113.6 -92.2,205.5l533.2,0z"
|
||||
android:fillColor="#FEFEFE"
|
||||
android:fillType="nonZero"/>
|
||||
<path
|
||||
android:pathData="M7470.3,22.3l-363.1,1311.6l-166.4,0l-314.8,-1139.6l-315.8,1139.6l-166.4,0l-362.5,-1311.6l182.6,0l262,1068.2l295.3,-1068.2l208.6,0l295.3,1068.2l262,-1068.2z"
|
||||
android:fillColor="#FEFEFE"
|
||||
android:fillType="nonZero"/>
|
||||
<path
|
||||
android:pathData="M8016.3,1356.2c-139.6,0 -251.9,-43.7 -336.5,-131 -84.6,-87.3 -127,-209.2 -127,-365.5 0,-155.1 40.9,-276.7 123.1,-364.6 81.8,-87.9 189,-131.9 321.5,-131.9 135.3,0 243.4,43.4 324.3,129.8 80.9,86.4 121.2,208.9 121.2,366.8l0,40.3 -714.9,0c7.3,109.6 37.6,191.2 91,244.3 53.2,53.1 119.1,79.7 197.3,79.7 58.9,0 112.1,-15.3 159.4,-45.2 47.6,-30.3 72.4,-73 74.8,-128.6l174.4,0c-13.1,98 -57.4,173.5 -132.8,226.3 -75.4,53.1 -167.4,79.7 -275.8,79.7zM8264.9,767.7c-13.8,-91.3 -44.6,-159.7 -92.2,-204.9 -47.6,-45.5 -106,-68.1 -175.3,-68.1 -67.5,0 -125.2,22.6 -173.4,67.5 -48.6,45.2 -79.1,113.6 -92.2,205.5l533.2,0z"
|
||||
android:fillColor="#FEFEFE"
|
||||
android:fillType="nonZero"/>
|
||||
<path
|
||||
android:pathData="M9000.2,1335.7c-36.9,7 -77.3,10.7 -120.6,10.7 -69.3,0 -120,-12.5 -152.1,-37.2 -32.4,-24.7 -52.2,-56.5 -60.2,-95.3 -7.6,-38.8 -11.6,-91.3 -11.6,-158.2l0,-538.7 -117,0 0,-132.2 117,0 0,-236.4 168.3,0 0,236.4 153.9,0 0,132.2 -153.9,0 0,547.5c0,65 8.3,106.3 24.7,124 16.2,17.7 38.8,26.3 67.5,26.3 29.3,0 57.1,-2.2 84,-7l0,127.9z"
|
||||
android:fillColor="#FEFEFE"
|
||||
android:fillType="nonZero"/>
|
||||
<path
|
||||
android:pathData="M9509.3,1335.7c-36.9,7 -77.3,10.7 -120.6,10.7 -69.3,0 -120,-12.5 -152.1,-37.2 -32.4,-24.7 -52.2,-56.5 -60.2,-95.3 -7.6,-38.8 -11.6,-91.3 -11.6,-158.2l0,-538.7 -117,0 0,-132.2 117,0 0,-236.4 168.3,0 0,236.4 153.9,0 0,132.2 -153.9,0 0,547.5c0,65 8.3,106.3 24.7,124 16.2,17.7 38.8,26.3 67.5,26.3 29.3,0 57.1,-2.2 84,-7l0,127.9z"
|
||||
android:fillColor="#FEFEFE"
|
||||
android:fillType="nonZero"/>
|
||||
<path
|
||||
android:pathData="M10053.5,1356.2c-139.6,0 -251.9,-43.7 -336.5,-131 -84.6,-87.3 -127,-209.2 -127,-365.5 0,-155.1 40.9,-276.7 123.1,-364.6 81.8,-87.9 189,-131.9 321.5,-131.9 135.3,0 243.4,43.4 324.3,129.8 80.9,86.4 121.2,208.9 121.2,366.8l0,40.3 -714.9,0c7.3,109.6 37.6,191.2 91,244.3 53.2,53.1 119.1,79.7 197.3,79.7 58.9,0 112.1,-15.3 159.4,-45.2 47.6,-30.3 72.4,-73 74.8,-128.6l174.4,0c-13.1,98 -57.4,173.5 -132.8,226.3 -75.4,53.1 -167.4,79.7 -275.8,79.7zM10302,767.7c-13.8,-91.3 -44.6,-159.7 -92.2,-204.9 -47.6,-45.5 -106,-68.1 -175.3,-68.1 -67.5,0 -125.2,22.6 -173.4,67.5 -48.6,45.2 -79.1,113.6 -92.2,205.5l533.2,0z"
|
||||
android:fillColor="#FEFEFE"
|
||||
android:fillType="nonZero"/>
|
||||
<path
|
||||
android:pathData="M11161.9,538.7c-24.1,-7.3 -58.3,-11 -102.9,-11 -86.1,0 -159.7,45.2 -221.1,135.3l0,670.9 -169.2,0 0,-949.1 169.2,0 0,132.2c70.8,-102.6 153.3,-153.9 247,-153.9 23.8,0 49.5,2.5 76.9,7.3l0,168.3z"
|
||||
android:fillColor="#FEFEFE"
|
||||
android:fillType="nonZero"/>
|
||||
<path
|
||||
android:pathData="M12283,1356.2c-185.1,0 -323.1,-41.5 -414.7,-124.3 -91.6,-82.8 -139.9,-189.3 -144.4,-319.4l167,0c9.2,97.7 49.8,170.1 122.2,217.1 72.7,46.7 160,69.9 262.6,69.9 97.4,0 175.6,-19.9 234.8,-59.8 59.5,-40 89.2,-94.1 89.2,-162.8 0,-72.1 -30.9,-124.6 -92.2,-157.6 -61.4,-32.7 -167,-65 -317.3,-96.8 -149.9,-32.1 -257.4,-76.3 -322.8,-133.1 -65.4,-56.5 -98,-131.9 -98,-226.3 0,-106 42.5,-193.3 127.3,-261.1 85.2,-68.1 197.9,-102 338.7,-102 148.1,0 267.2,34.2 357.9,102.9 90.7,68.4 138.6,165.5 144.1,290.7l-169.2,0c-17.1,-158.8 -125.8,-237.9 -325.5,-237.9 -96.8,0 -171.6,18 -224.8,54.3 -52.8,36.3 -79.4,84.9 -79.4,145.1 0,55 21.1,95.9 63.8,123.4 42.7,27.5 122.4,54 238.8,79.7 116.6,25.6 209.2,51 277.9,76 68.7,25 127.3,63.8 176.2,116.7 48.9,52.8 73.3,123.7 73.3,212.5 0,112.7 -44.9,206.4 -134.4,280.9 -89.8,74.5 -207,111.8 -351.2,111.8z"
|
||||
android:fillColor="#FEFEFE"
|
||||
android:fillType="nonZero"/>
|
||||
<path
|
||||
android:pathData="M13356.3,1335.7c-36.9,7 -77.3,10.7 -120.6,10.7 -69.3,0 -120,-12.5 -152.1,-37.2 -32.4,-24.7 -52.2,-56.5 -60.2,-95.3 -7.6,-38.8 -11.6,-91.3 -11.6,-158.2l0,-538.7 -117,0 0,-132.2 117,0 0,-236.4 168.3,0 0,236.4 153.9,0 0,132.2 -153.9,0 0,547.5c0,65 8.3,106.3 24.7,124 16.2,17.7 38.8,26.3 67.5,26.3 29.3,0 57.1,-2.2 84,-7l0,127.9z"
|
||||
android:fillColor="#FEFEFE"
|
||||
android:fillType="nonZero"/>
|
||||
<path
|
||||
android:pathData="M14098.1,1084.4l0,-210.4 -115.4,0c-244.6,0 -366.8,66.6 -366.8,199.4 0,48.6 17.7,85.5 53.8,111.5 35.7,26 84,39.1 144.7,39.1 55.6,0 109.3,-12.5 161.3,-37.6 51.9,-25 92.5,-59.3 122.5,-102zM14098.1,1236.5c-85.8,79.7 -196.7,119.7 -332,119.7 -94,0 -171.6,-25.4 -232.7,-76.3 -60.8,-51 -91,-117 -91,-197.3 0,-222 191.2,-332.9 573.2,-332.9l82.4,0c0,-68.1 -3.7,-117.3 -10.7,-148.1 -7.3,-30.9 -27.2,-56.2 -59.8,-76.3 -33,-20.5 -85.2,-30.5 -156.7,-30.5 -150.2,0 -227.8,53.8 -232.7,160.9l-168.3,0c12.5,-194.8 149.3,-292.5 409.8,-292.5 121.8,0 216.5,24.1 284.6,72.7 67.8,48.3 102,142.9 102,284.3l0,613.8 -168.3,0 0,-97.4z"
|
||||
android:fillColor="#FEFEFE"
|
||||
android:fillType="nonZero"/>
|
||||
<path
|
||||
android:pathData="M14884.4,1335.7c-36.9,7 -77.3,10.7 -120.6,10.7 -69.3,0 -120,-12.5 -152.1,-37.2 -32.4,-24.7 -52.2,-56.5 -60.2,-95.3 -7.6,-38.8 -11.6,-91.3 -11.6,-158.2l0,-538.7 -117,0 0,-132.2 117,0 0,-236.4 168.3,0 0,236.4 153.9,0 0,132.2 -153.9,0 0,547.5c0,65 8.3,106.3 24.7,124 16.2,17.7 38.8,26.3 67.5,26.3 29.3,0 57.1,-2.2 84,-7l0,127.9z"
|
||||
android:fillColor="#FEFEFE"
|
||||
android:fillType="nonZero"/>
|
||||
<path
|
||||
android:pathData="M15194.1,1333.9l-169.2,0 0,-949.1 169.2,0 0,949.1zM15194.1,204.9l-169.2,0 0,-182.6 169.2,0 0,182.6z"
|
||||
android:fillColor="#FEFEFE"
|
||||
android:fillType="nonZero"/>
|
||||
<path
|
||||
android:pathData="M15827.4,363.1c135.3,0 243.4,43.4 324.3,129.8 80.9,86.4 121.2,208.9 121.2,366.8 0,157.6 -40.3,279.7 -121.2,366.4 -80.9,86.7 -189,130.1 -324.3,130.1 -134.7,0 -242.5,-43.4 -323.4,-130.1 -80.9,-86.7 -121.2,-208.9 -121.2,-366.4 0,-157.9 40.3,-280.3 121.2,-366.8 80.9,-86.4 188.7,-129.8 323.4,-129.8zM15827.4,1223.9c80.6,0 146,-30.5 196.1,-91.9 50.1,-61.1 75.1,-151.8 75.1,-272.4 0,-120.9 -25,-212.2 -75.1,-273.3 -50.1,-61.1 -115.4,-91.6 -196.1,-91.6 -80.6,0 -145.7,30.5 -196,91.6 -50.1,61.1 -75.1,152.4 -75.1,273.3 0,120.6 25,211.3 75.1,272.4 50.4,61.4 115.4,91.9 196,91.9z"
|
||||
android:fillColor="#FEFEFE"
|
||||
android:fillType="nonZero"/>
|
||||
<path
|
||||
android:pathData="M16630.9,505.4c84,-94.7 178.6,-142.3 283.7,-142.3 214.1,0 320.9,116.7 320.9,350l0,620.8 -168.9,0 0,-613.8c0,-77.6 -14,-133.1 -41.5,-167.4 -27.8,-33.9 -73.3,-51 -136.5,-51 -86.1,0 -171.9,50.7 -257.7,152.1l0,680.1 -169.2,0 0,-949.1 169.2,0 0,120.6z"
|
||||
android:fillColor="#FEFEFE"
|
||||
android:fillType="nonZero"/>
|
||||
</vector>
|
||||
@@ -0,0 +1,26 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:aapt="http://schemas.android.com/aapt"
|
||||
android:width="78dp"
|
||||
android:height="80dp"
|
||||
android:viewportWidth="1754.94"
|
||||
android:viewportHeight="1816.95">
|
||||
<path
|
||||
android:pathData="M877.47,0l181.73,454.24l438.74,-188.16l-181.73,454.24l438.73,188.16l-438.73,188.15l181.73,454.24l-438.74,-188.16l-181.73,454.24l-181.73,-454.24l-438.74,188.16l181.74,-454.24l-438.74,-188.15l438.74,-188.16l-181.74,-454.24l438.74,188.16z"
|
||||
android:fillColor="#FFD95A"/>
|
||||
<path
|
||||
android:pathData="M877.47,205.26l129.23,53.52l139.88,0l98.91,98.91l129.23,53.53l53.53,129.23l98.91,98.92l0,139.88l53.53,129.23l-53.53,129.23l0,139.88l-98.91,98.91l-53.53,129.23l-129.23,53.53l-98.91,98.91l-139.88,0l-129.23,53.53l-129.23,-53.53l-139.88,0l-98.91,-98.91l-129.23,-53.53l-53.53,-129.23l-98.91,-98.91l0,-139.89l-53.53,-129.22l53.53,-129.24l0,-139.87l98.91,-98.91l53.53,-129.24l129.23,-53.52l98.91,-98.92l139.88,0z"
|
||||
android:fillColor="#FFD95A"/>
|
||||
<path
|
||||
android:pathData="M877.47,908.48m-607.8,0a607.8,607.8 0,1 1,1215.6 0a607.8,607.8 0,1 1,-1215.6 0">
|
||||
<aapt:attr name="android:fillColor">
|
||||
<gradient
|
||||
android:gradientRadius="607.7969"
|
||||
android:centerX="1205.875"
|
||||
android:centerY="555.6719"
|
||||
android:type="radial">
|
||||
<item android:offset="0" android:color="#FFFFFFFF"/>
|
||||
<item android:offset="1" android:color="#FFF9A825"/>
|
||||
</gradient>
|
||||
</aapt:attr>
|
||||
</path>
|
||||
</vector>
|
||||
@@ -0,0 +1,34 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="96.9388dp"
|
||||
android:height="17.0957dp"
|
||||
android:viewportWidth="17229.16"
|
||||
android:viewportHeight="3038.46">
|
||||
<path
|
||||
android:pathData="M2733.5,2988.5l-364.9,0l0,-2499.3l-829.3,2499.3l-345.2,0l-828.6,-2499.3l0,2499.3l-365.5,0l0,-2938.6l577.4,0l787.3,2449.4l791.4,-2449.4l577.4,0z"
|
||||
android:fillColor="#F9A825"
|
||||
android:fillType="nonZero"/>
|
||||
<path
|
||||
android:pathData="M4187,813.5c299.9,0 539.5,97.2 718.9,290.8 179.4,193.6 268.8,468 268.8,821.7 0,353 -89.3,626.7 -268.8,821 -179.4,194.3 -419,291.5 -718.9,291.5 -298.5,0 -537.5,-97.2 -716.9,-291.5 -179.4,-194.3 -268.8,-468 -268.8,-821 0,-353.7 89.4,-628.1 268.8,-821.7 179.4,-193.6 418.4,-290.8 716.9,-290.8zM4187,2742.2c178.7,0 323.6,-68.4 434.6,-205.9 111.1,-136.8 166.5,-340 166.5,-610.3 0,-270.9 -55.5,-475.5 -166.5,-612.3 -111,-136.8 -255.9,-205.3 -434.6,-205.3 -178.7,0 -322.9,68.4 -434.6,205.3 -111.1,136.8 -166.5,341.4 -166.5,612.3 0,270.3 55.5,473.5 166.5,610.3 111.7,137.5 255.9,205.9 434.6,205.9z"
|
||||
android:fillColor="#F9A825"
|
||||
android:fillType="nonZero"/>
|
||||
<path
|
||||
android:pathData="M9111.1,49.9l-804.9,2938.6l-369,0l-697.9,-2553.4l-700,2553.4l-368.9,0l-803.5,-2938.6l404.8,0l580.8,2393.3l654.6,-2393.3l462.4,0l654.6,2393.3l580.8,-2393.3z"
|
||||
android:fillColor="#F9A825"
|
||||
android:fillType="nonZero"/>
|
||||
<path
|
||||
android:pathData="M10321.5,3038.5c-309.4,0 -558.5,-97.8 -746,-293.5 -187.5,-195.7 -281.6,-468.7 -281.6,-819 0,-347.6 90.7,-619.9 272.8,-816.9 181.4,-197.1 419,-295.6 712.8,-295.6 299.9,0 539.5,97.2 718.9,290.8 179.4,193.6 268.8,468 268.8,821.7l0,90.3 -1584.8,0c16.2,245.6 83.3,428.3 201.7,547.4 117.8,119.1 264,178.6 437.3,178.6 130.7,0 248.4,-34.2 353.4,-101.3 105.6,-67.7 160.4,-163.5 165.8,-288l386.5,0c-29.1,219.6 -127.3,388.6 -294.5,507 -167.2,119.1 -371,178.6 -611.3,178.6zM10872.6,1720c-30.5,-204.6 -98.8,-357.8 -204.4,-459.1 -105.6,-101.9 -234.9,-152.6 -388.6,-152.6 -149.6,0 -277.5,50.6 -384.5,151.2 -107.6,101.3 -175.3,254.5 -204.4,460.5l1182,0z"
|
||||
android:fillColor="#F9A825"
|
||||
android:fillType="nonZero"/>
|
||||
<path
|
||||
android:pathData="M12832.3,3038.5c-410.2,0 -716.2,-93 -919.3,-278.5 -203.1,-185.4 -310,-424.2 -320.2,-715.7l370.3,0c20.3,218.9 110.3,381.1 270.8,486.5 161.1,104.7 354.7,156.7 582.2,156.7 216,0 389.3,-44.5 520.6,-134.1 132,-89.6 197.7,-210.7 197.7,-364.7 0,-161.5 -68.4,-279.1 -204.4,-353 -136.1,-73.2 -370.3,-145.7 -703.4,-216.9 -332.4,-71.8 -570.7,-171.1 -715.5,-298.3 -144.9,-126.6 -217.3,-295.6 -217.3,-507 0,-237.4 94.1,-433.1 282.3,-585 188.9,-152.6 438.7,-228.5 750.7,-228.5 328.3,0 592.3,76.6 793.4,230.6 201.1,153.3 307.4,370.8 319.5,651.3l-375,0c-37.9,-355.8 -278.9,-533 -721.7,-533 -214.6,0 -380.4,40.4 -498.2,121.8 -117.1,81.4 -176,190.2 -176,325 0,123.2 46.7,214.8 141.5,276.4 94.8,61.6 271.5,121.1 529.4,178.6 258.6,57.5 463.7,114.3 616,170.4 152.3,56.1 282.3,143 390.6,261.4 108.3,118.3 162.5,277.1 162.5,476.2 0,252.5 -99.5,462.5 -297.9,629.5 -199,166.9 -459,250.4 -778.5,250.4z"
|
||||
android:fillColor="#F9A825"
|
||||
android:fillType="nonZero"/>
|
||||
<path
|
||||
android:pathData="M15211.8,2992.6c-81.9,15.7 -171.3,23.9 -267.4,23.9 -153.7,0 -266,-28 -337.1,-83.5 -71.8,-55.4 -115.8,-126.6 -133.4,-213.5 -16.9,-86.9 -25.7,-204.6 -25.7,-354.4l0,-1206.9 -259.3,0 0,-296.2 259.3,0 0,-529.5 373,0 0,529.5 341.2,0 0,296.2 -341.2,0 0,1226.7c0,145.7 18.3,238.1 54.8,277.8 35.9,39.7 85.9,58.8 149.6,58.8 65,0 126.6,-4.8 186.2,-15.8l0,286.7z"
|
||||
android:fillColor="#F9A825"
|
||||
android:fillType="nonZero"/>
|
||||
<path
|
||||
android:pathData="M16856.2,2429.5l0,-471.4 -255.9,0c-542.2,0 -813,149.1 -813,446.8 0,108.8 39.3,191.6 119.2,249.7 79.2,58.2 186.2,87.6 320.9,87.6 123.2,0 242.3,-28.1 357.4,-84.2 115.1,-56.1 205.1,-132.7 271.5,-228.5zM16856.2,2770.3c-190.2,178.6 -436,268.2 -735.9,268.2 -208.5,0 -380.4,-56.8 -515.8,-171.1 -134.7,-114.3 -201.7,-262 -201.7,-442 0,-497.4 423.8,-745.8 1270.7,-745.8l182.8,0c0,-152.6 -8.1,-262.7 -23.7,-331.8 -16.2,-69.1 -60.2,-125.9 -132.7,-171.1 -73.1,-45.8 -188.9,-68.4 -347.3,-68.4 -333.1,0 -505,120.4 -515.8,360.6l-373,0c27.7,-436.5 331,-655.4 908.5,-655.4 270.1,0 480,54 630.9,162.8 150.3,108.1 226.1,320.2 226.1,637l0,1375.2 -373,0 0,-218.3z"
|
||||
android:fillColor="#F9A825"
|
||||
android:fillType="nonZero"/>
|
||||
</vector>
|
||||
@@ -0,0 +1,267 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="199.06dp"
|
||||
android:height="96.3837dp"
|
||||
android:viewportWidth="19663.86"
|
||||
android:viewportHeight="9521.11">
|
||||
<path
|
||||
android:pathData="M12021.4,2959.3l-277.7,-51.3 40.8,-32.9 -237.2,-482.9c31.5,-91 173.2,-191.6 278.8,-147.7 293.1,122 -147.8,54.7 -49.2,220.5 72.8,122.3 266.9,81.6 235.1,181.9 -29,91.5 -112.9,-63.8 -18,121.1 54.8,106.9 60.2,64.2 27.4,191.4zM10350.9,1339.6l-251.6,67.3 -179.1,292.2 -545.1,31.9 -8.7,-47.5 116.6,-54.2c-61.5,-24.8 -162.9,-67.2 -198.2,-121.8l-28.2,230.6 -755.1,402.7c216.5,134.7 180.2,51.7 136.8,335.8l-412.3,-16c-34.3,48 -51,347.3 -59.8,425.7 116.5,141.6 374.6,119.5 495.7,-3.6 89.1,-90.5 28.1,-130.9 136.7,-222.7 266.8,-225.3 1,-132.4 510.5,-249.6l419.9,398.6 96.1,-107.4 -382,-326.5 68.3,-75.9 535.9,523.1 43.8,137.1 63.7,-15.8c-9,-56.3 -13.5,-203.4 -55.3,-235l308.6,-82.4 164,-407.4c59,76.7 59.9,58.8 207.7,116.6 35.3,-83.9 34.1,-59.6 229.9,-139.7l-34.4,174.4 274,203.4 -23.5,43.6 -884.7,48.5c25.6,467.1 367.2,253.2 625.8,311.6 -21,92.8 -53.4,356.1 -117.4,409.1l-841.4,-157.3 -61.7,177.7c-201.4,-2.3 -239.5,-124.2 -372.2,-169.6 -252.7,-86.4 -178.3,-49.8 -207,-313.2l-998.2,146.9 -6.4,-39.2c-151.1,169.9 -191.2,131.7 -279.8,366 -42.2,111.7 -207.1,177.8 -308.5,337.4 -125,196.8 -184.9,223.4 -139.1,455.1 38,192.2 -100.6,334.5 -32,490.2 84.5,191.9 412.2,614.1 686.4,559.2 225.3,-45.1 309.1,-47 542.4,-108.9 130.4,-34.6 129.5,-5.3 208.7,74.7 128.5,129.8 113.5,-25.3 242.4,98.9 91.1,119.7 -24.5,266.6 8,387.3 21.1,78.5 134.8,156 186.1,279.7 170.6,411.3 93.9,352.5 -0.6,687.3 -46.3,164.2 371,1319.3 452.8,1389.9 55.1,45.9 431.3,-17.4 550.9,-118.4 115.7,-97.7 286.1,-258.9 317,-400.5 50,-228.8 28.4,-67.3 154.2,-207.2 99.3,-110.3 -6.2,-142.3 2.8,-251.5 14,-170.1 290.6,-263.4 362.3,-368.8 226.8,-333.6 -364.2,-450.2 165.4,-1071 170.5,-199.9 637,-576.6 545.5,-881.8 -99.6,21.1 -399.4,99.1 -480.3,90.4l-792.8,-1341.6c52.2,-15.9 125.3,43.1 173,67.1l640.3,1105.1c209.1,46.7 944.3,-454.4 976.2,-689.2l-243.1,-260.4 -179.2,151.3c-16.3,-40.2 -145.5,-105.6 -188.2,-132.3l-157.9,-294.7c194.7,-80.3 135.3,205.3 410.8,223.3 259.2,17 181.4,120.7 499.4,118.5 425.7,-3 150.2,-48.5 468.8,142.9 189.9,114.1 -119,-5.2 50.3,127.6 155.4,121.9 121.3,-56.6 183.3,-41.5l-37.9,14.9 411.9,956.5c229.3,-21 71.1,-407.5 285.2,-611.6 181,-172.6 287,-381.9 539.4,-393.8l297.1,473 148.7,-66.7c86.8,187.7 196,1155 508.6,1087.3 31.2,-124.4 -104.1,-292.8 -196.6,-384.5 -176.4,-174.7 -111.6,-236.6 -111.5,-462.5l376.8,322.6 279.3,-229.7 -335.1,-560.5c42.8,-39.1 124.2,-138.4 179.2,-139.2l92.2,97.6c212.4,-238.8 431.9,-25.5 563.1,-453.2 108.6,-354 -155.7,-296.7 -240.5,-598.3l131.3,-155.9 -351.8,-100.8 166.1,-156.9 576.8,421.1 -37,46.7c53.7,-27.4 120.7,-51.3 163.6,-93.3l-270.4,-267.6 95.7,-241.2 151,-16.5c320.5,-494.3 -118,-727 -499.5,-816.8 109.7,-458.1 311.2,-255.1 677.7,-291l40.4,-164.5 214.1,44.9c24.2,-11.4 142.7,-196 136.5,26.3 -3.1,112.4 -90.1,171.9 -33.8,280.8 41.6,80.3 292.9,336 376.7,351.8l71.7,-34.2 -256.9,-539.3 534,-196.9 -259.8,-116.5 100.4,-72.1 386.9,78.9c-96.9,-164.7 -839.5,-298.2 -1065.1,-329.6 -198.6,-27.6 -162.2,16 -208,32.8 -10.2,3.7 -233.7,-21.8 -302.3,-22.1 -210.4,-1 -393.5,-62 -645.6,-72 -189.6,-7.5 -383.3,-119.9 -594.3,-108.6 -44.1,2.4 -320.7,162.3 -513.2,88.1 -547.8,-211.2 -682.2,-69.1 -1167.3,-127.2l145.1,-113.7 -618.3,-113.4 -986.3,339.1 177.6,203.5c-95.1,313.2 -121.8,-47.5 -154.9,-95.7 -87.1,-126.8 -179.8,-252.3 -327.9,-119.1l176.4,196 -434.5,-41.3 -702.7,94.3c-57.6,20.2 -293.2,200.2 -354.4,191.9l-225.1,-154.5 392.8,26.7c12.7,-187.2 -825.5,-285.8 -999.8,-227.3 -78.1,26.2 -705.2,489.5 -749.7,540.3 11.1,60.4 13.9,172.2 57,213.4l210.6,-42.8c48.3,75.4 101.9,190.8 173.4,241.7l257.1,-286.2 -96.3,-150.6c49.5,-80.4 493.6,-441.9 298.9,-136.1 -238.8,374.9 221.5,168.3 346.1,257.8z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M3755.3,2589.3c211.4,-212 183.2,85.4 0,0zM4042.9,2486.8l118.3,-76 11,33.7 -129.3,42.3zM3393.6,2234.7l345.7,-141.5c38.5,47.9 55.3,128.6 75.6,187.6l193,69.9 -207,127.8 -37.1,-28.6 36,-114.2 -47.2,-35.8 -275.6,303.2 -53.3,-50.8 328.8,-308.5 -359,-9.2zM3551,928.9l-247.3,-85.8c-25,-7.8 8.7,-61.6 -204.2,-100.7 -571.3,-105 -578.3,84.6 -961.9,-6.8 -469.4,-111.7 -863,-90.5 -1321.6,66.2l37.8,110.4 -372.7,61.8 4.2,54.4 235.1,4.9 -553.2,309.8 32.9,63.2 169.3,24.8 -369.3,177c282.5,7.5 799.6,-387.3 1160.7,-310.9 186.1,39.3 451.1,103.7 424.5,337 -9.4,83 -66.4,197.5 -35.1,269.2 44.8,102.3 165.2,89 98.7,244.6 -112,113.2 -53.6,-126 -182.3,102.8 -191.4,340.1 -331.6,309.9 -279.2,689.1 32,231.8 22.3,118.5 123.2,237.3 48.2,56.6 39.8,172.7 75.9,283.3 34.4,105.2 99.2,413.7 231.1,450.1l-181.8,-580.5 38.3,-11.5c16.8,4.6 304.3,516.7 345.9,588.2 175.9,302.3 -159.8,195.2 406.5,489.8 221.9,115.4 218.3,-30.1 343.5,48.7 127.2,80 86.8,143.9 287.4,174.5 155.2,23.7 112.5,112.9 202.1,234.8 72.4,98.6 181.3,122.5 284.8,181.6l152.2,-80.5c100.9,63.3 93,348.4 -17.9,493.1 -140.1,182.7 -100,271.7 -144.7,446.9 -22.6,88.8 389.6,762.7 543.7,849.6 411,231.7 242.2,643.7 310.7,1088.6 35,227.2 -6.7,403.5 54.2,609.4 56.9,192.3 254,242.2 101.8,472.3 168.5,83.2 225.9,551.5 490.3,418.6l57.9,-332.5 -102.1,-117.6c15.4,-182.4 133.1,-81.8 24.5,-316.1 -101.7,-219.5 129.8,173.7 121.4,-190.5l282.7,-120.3 -146.4,-227.4 278.8,56.5 290.6,-680.4 -46.8,-20c304.4,-271 436.9,17.9 529.1,-547.2 43.3,-264.9 -49.8,-208.1 111.6,-444.5 292.5,-428.7 77.2,-240.5 148.6,-415.1l-605.7,-247.4 -26.8,60.7c-148.5,-201.8 -62.2,-180.6 -361.6,-64.4l82.7,-107.3 -39.2,-48.4 -210.9,113.6c45.5,-165.8 232,-89.1 66.1,-369.2 -136.4,-230.3 -257.3,-87.1 -417.2,-193.3 -124.7,-82.9 -165.3,-203.5 -334.2,-257.7 -47.7,-15.3 -458.4,-112.3 -461,-111l-131.1,174.5c11.1,-59 50.1,-204 38.4,-254.8l-344.3,290.5c-1.2,0 -387.1,-58.2 -392.6,-63 -136,-116.8 4.2,-285.5 -44.2,-441.5l-293.6,-14.9 136.5,-388.6c-269.9,-102.3 -209.5,278.4 -503.6,203.8 -232.2,-58.9 -146.5,-377.3 -102.4,-514.3 50.7,-157.8 227.3,-351.9 415.1,-300.6 196.5,53.6 356.7,-152.5 550.5,22.7l78.6,302c227.5,-57.8 -95.9,-296.5 202,-535.9 73.1,-58.8 168.6,-91.2 231.4,-145.4 207.6,-179.3 -239.9,-185.8 1018.9,-774.9l-118.7,142.9 359.2,-142.4c-70.2,-12.2 -184.1,-6.4 -228.8,-64.6l60.6,-193.4 -305.7,95.2c178.8,-270.8 914.2,-45.8 929.8,-412.8l-161.1,-8.2 -62.8,-404.2 -264,133.6 -21.6,-193.8c-256.5,-111.9 -416.5,-75.2 -489.6,206.9 -9.1,35.2 -334,452.9 -449.2,442.2l24.7,-227.8 -471.5,-236.3 -9.9,-102.7 1209.5,-554.3 -36.4,-77.3 -303.9,146.9 -124.5,-246.4c-164.2,86.3 -111.8,-10.1 -146.6,136.8 -15.3,64.7 -134.8,122.1 -220.4,111.8 -196.9,-23.7 -419.6,-117 -554.2,63zM4617.9,4879.3c15.5,4.5 79.1,-32.7 17.8,-52.5 -58.1,-18.7 -56.8,41 -17.8,52.5z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M17569,6686.4l43.9,-196.1c-318.7,-174.6 -404.4,134.2 -478,181.5 -307.8,-127.8 -197.5,-22.9 -416.6,141.2 -270.3,202.5 -52.5,124 -432.5,267.1 -302.9,114.1 -263.4,105.2 -285.7,414.3 -10.1,139.4 -3.3,181.7 1.6,312.7 6.5,176 -101.1,178.8 -73.8,252.1 357.4,200.9 913.7,-517.1 1260.5,13.2l160.2,-83.5 -39.2,106.2 48.2,14.2 6.1,190.9c334.6,275 939,-270.9 1085.2,-581.9 129.5,-275.4 9.3,-424.5 -152.3,-664.5 -105.1,-156 -140.4,-568.9 -266,-648.7 -132.9,159.5 -40.8,709.1 -461.4,281.3z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M6441.8,736.2c-96.2,161.1 -199.6,27.1 -196.8,314.2 1.6,169.6 96.8,265.7 270.1,257.6 266.6,-158 17.7,-195.3 527.3,-367.8 151.1,-51.2 133.5,-111.7 315.2,-133.2 95.6,-11.4 303.5,-27.5 373.1,-75.4l-156.9,-37.8 56.5,-82.8 214.2,42.9 -122.3,-85.1 597.2,-508.9 26.7,31.3c-83.8,-55.5 -675.6,-74.2 -826.7,-73.3 -279.7,1.6 -620.1,44.1 -933.4,53.2 -164.7,4.8 -233,53.7 -382.2,102.2 -118.9,38.7 -382.8,33.4 -317.6,127.5 69.5,100.2 271.2,-24.6 397,92.4 47.1,43.8 161,283.1 158.7,343z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M17462,5861.4c234.6,33.8 373.6,105.3 318.3,309.6l285.5,98.4 124.4,-136.7 412.1,284.2 21,-30.7c-44.8,-67.5 -366.5,-469 -415.6,-499.3 -479.5,-296.1 -378.4,-99.6 -620.3,-61.4 -81.5,-81.2 -53.1,-233.2 -188.1,-179.6 -100.6,40 -21.5,44.4 8.8,81 99,119.4 -29.8,19.7 53.7,134.5z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M15967,5795.7l338.3,53.9c75.6,-89.3 197.9,-306.2 176.3,-390.2 -22.6,-87.8 57.1,-442.9 -130.4,-309 -134.3,95.9 -209,193.8 -329,284.3 -89.2,67.2 -253.9,108 -55.2,361z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M5390.8,921l-486.2,104.5 405,131 21.3,-62.5 159.4,43.3 -5.8,-181.1 225.2,24.8c28.3,-233.6 -515.1,-587 -790.3,-388.1 -17.5,-36.1 154.6,-212.3 -113.3,-61.2 -168.6,95.1 -112.5,160.8 57.3,169.5 106.8,5.5 278.1,-23.8 333,5.4 49.4,26.2 193.8,204.7 194.4,214.3z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M11910.4,6479.8c-51.3,63.1 -64.2,128.6 -156.9,194.1 -83.9,59.3 -176,63.2 -191.8,166.7 -21.7,141.5 63.3,81.1 -45.5,277.7 -45,81.2 -47.5,211.9 22.8,272.8 71,61.6 177.7,-1.9 211.9,-74.1 30.3,-63.9 59.1,-197 84.9,-273.9 49.3,-146.8 178.5,-412.4 74.7,-563.4z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M3375.5,556.1l5.3,5.3c-0.4,-0.3 -7.1,-3.6 -5.3,-5.3zM3093.1,605.3c67.3,68 162,11.8 245,-32.8 7.4,8.1 50.3,42.8 51.9,46.7 11.2,25.9 11.1,-7.3 -7.8,32.1l120.9,40 -199.3,26.7c100,87.8 237.3,104.6 365.8,59.4 155.5,-54.6 187,50.2 383,-73.2l-88.1,-52.9 63.4,-127.5c-110.7,-1.6 -68.3,13.6 -154.7,63.5l-39.1,-65.2c-108.6,62.1 -138.2,7.5 -243.3,-1.9l23.5,-26.2c-130.8,-39.5 -173.9,-72.1 -303.9,-20.7 -72.4,28.6 -185.4,76.2 -217.3,131.9z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M14981.8,5202.2c8.9,37.3 254.8,354.1 305.3,430.2 45.5,68.6 228.4,464.5 354.4,338.6 71.6,-71.6 -9.3,-194 -63.5,-252.8 -79.7,-86.4 -93.4,-159.9 -162.6,-214.1 -123.1,-96.6 -261.2,-298.2 -433.6,-301.9z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M5420.5,72.4c49.4,68.4 220.3,35.2 304.9,35.2 -42.2,59 -137.5,36.2 -216.7,34.9 -197.7,-3.1 -110.2,10.1 -119.5,77.3l-90.6,27.5c-3.5,18 55.6,2.7 -28,32.4 -48.2,17.1 -118.6,7.3 -173.1,7.3 44,61.2 79.1,32.2 161.3,36.2 103,5 93.9,44.6 171.2,28.3 26.5,-5.6 263,-112 301.2,-130.4 180.7,-87.1 450.5,-71.1 622.1,-221.1l-932.8,72.4z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M16901.3,3121.3c145,67.1 148.2,-104 305,71.8 44.6,-184.1 251.8,-51.1 217.8,-235 -24.8,-134.3 -23.5,-299.5 -199.9,-303.2 39.1,165.1 128.9,173 -22.7,300.1 -131.5,110.3 -219.3,43 -300.2,166.3z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M8626.9,1744.7c-17,26.7 -77,71.7 -121,138.9l87.2,35.2 -108.1,66.6c110.5,5.7 193.8,-30.3 308,-30.1l71.8,-125.6c-91.7,-35.5 -40.4,58.7 -120.1,-94.9 -38.4,-74.1 -55.6,-100.3 -131.1,-138.3l56,-69.8c-16.7,-8.6 -37.5,-18.1 -51.5,-24.9l-55.3,-26.3c-40.6,44.8 -74.3,80.7 -48.4,146 41.9,105.7 10.6,-7.7 86.1,77.7 8.9,10.1 18.2,31.1 26.4,45.3z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M9533.1,287c36.1,-18.8 23.5,-20.5 67.1,17.9 -10.1,0 -29.4,0.4 -34.4,-1.2 -36.5,-11.4 -16.3,-4.2 -32.8,-16.7zM9367,215.3c56.3,85.7 78.2,42.6 133.2,100 0.6,0.6 20.7,74.2 149.2,92.7l113.8,-140.4c24.9,14.6 22.8,18.5 38.8,33 59.8,54.3 102.4,53.8 140.6,49.6 40.2,-4.4 8.1,7 35.9,-10.9 -37.8,-46.4 -23.4,-25.9 -75.4,-50.2 -47.6,-22.3 -46.1,-19.1 -87.6,-55.9 90.1,8 183.3,59.3 251.1,-35.9 -81.5,-19.6 -109.7,-15.7 -195.7,-21.8 -135.4,-9.6 -65,17.7 -129.1,25.3l-171.1,10.7c-76.9,-9.1 -119.6,-35 -203.6,3.8z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M16560.5,5991.5c129.6,-36.6 10.7,-64.8 71.8,-197.3 83.4,59.5 36,116.1 143.5,125.6 -1.8,-82.9 -26.2,-90.3 -33.3,-149.6 -13.1,-109.8 15,-43.5 69.2,-119.5 -110.2,9.8 -92.5,51.9 -197.3,-17.9 44.4,-86.6 71.3,-80 172.3,-63.7 84.8,13.7 124.7,15.7 150.6,-79.8 -259.9,27.8 -309.4,-15.3 -351.7,114.7 -43.6,134.1 -84.5,263.7 -25,387.5z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M18569.6,8897.6c148.4,75.8 240.2,-24.4 361.9,-104.5 107.6,-70.8 316.4,-161.4 298.9,-233.2 -22.5,-92.4 -137.1,40.7 -326,134.4 -108.9,54.1 -269,103.8 -334.9,203.3z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M11344.9,641.2c63.7,46.4 145.1,58.6 228.6,58.4 -28.1,-39.3 -5.8,-8.7 -34.7,-37.1l-18.4,-17.5c-3.2,-3.1 -14.5,-12.9 -18.6,-17.2 142.8,-281.9 349.4,-137.7 430.5,-251.1 -78.1,-36 -546.9,-17 -587.4,264.5z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M19358.9,8395.3c0,176.1 -23.7,68.1 -53.8,179.4 75.4,-6.5 341.2,-186.3 358.8,-251.1 -4.5,-2.6 -73.8,-9.9 -103.8,-56.5 -58.7,-91.3 23.2,-98.5 -56.2,-160.3 -32.7,53 21.6,107.9 -12.3,187.3 -19.6,45.9 -87.7,71.8 -132.8,101.3z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M3214,4000.3c69.6,27.7 281,-118.5 412.6,143.5l233.2,0c-33.5,-123.7 -522.3,-320.3 -645.8,-143.5z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M15650.2,6066.4c14.2,93.4 192.6,79 277.8,91.2 139.3,19.9 178.7,49.2 345.4,49.2 -100.8,-153.5 -335.7,-115 -443.6,-148.5 -55.6,-17.3 -138.4,-27.9 -179.6,8.1z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M7698.7,1076.3c141.3,3 86.2,71.9 226.6,31.2 99.4,-28.8 146.1,-36 217.2,-107.6 -101.2,-87.5 -97.1,-39.5 -229.5,-32 -91.2,5.1 -187,7.3 -214.3,108.4z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M5312.9,2170.6c106.1,9.4 291.1,59.8 358.8,-35.9 -17.4,-63.1 -62,-74.3 -125.6,-89.7l17.4,-107.7c-75,55.3 -200.6,157.8 -250.6,233.3z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M16811.6,4646.1c-39.6,-144.7 -81.4,4.5 -179.4,-143.5 19.3,-79.8 50.6,-65.1 25.9,-149.5 -24.5,-83.8 -46.8,-82.6 -115.6,-83.7 0.3,162.3 -81.1,161.2 30.5,274.2 89.3,90.5 129.4,100.1 238.6,102.5z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M8236.9,1722.1c7.2,82.4 11.8,32.5 0.2,94.6 -8.3,44.2 -24.6,94.4 31.5,91.4 3.2,-0.2 36.5,-6.7 37.2,-6.9 116.8,-34.8 136.5,-100.1 164.4,-215 -18,-12.5 12.9,-9.7 -44.4,-22.7 -73.6,-16.7 -113.3,40.3 -188.8,58.6z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M4810.6,430.5c291.4,0 402.8,80.2 533.5,-31.3 -78.2,-56.8 -217.7,-7.1 -313.5,-27.4 -87.6,-18.6 -207.8,-80.8 -220,58.7z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M16738.3,5039.3c27.2,17.5 1,1.7 36,9.5 127.5,28.7 66.6,142.1 158,128.6 58.6,-8.6 28.3,-18.5 22.8,-82.8 2.5,0.6 37.6,9.5 41.3,9.3 30.3,-1.3 10,2.5 30.4,-9.3l-68,-198.7c-65.2,49.5 -26.3,62.4 -98.9,85.6 -87.4,27.9 -52,-35.2 -121.7,57.7z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M17192.9,2614.4c2,-3.2 4,-12.6 4.8,-10.1 5.7,17.9 8.9,-16.6 11.3,-20 30.8,-42.9 -11,-6.1 33.1,-37 78.6,18.9 139.4,32.8 156.8,-67.1 -12.9,-9.4 -221.1,-108.4 -264.5,-130.2 62.4,263.6 -51.1,124.9 58.4,264.5z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M17152.4,2278.2c-24.6,-37.2 -59.8,-75.9 -86.8,-112.6 -52.7,-71.6 -9,-110.2 -7.5,-116 -98.9,-77.6 -152.6,-104.2 -230,-200.5 -53.4,-66.4 -2.2,-48.9 -88.3,-55.2 94.4,145.5 173.4,194.9 274.7,389 41.7,80 51.3,93.9 137.9,95.3z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M4841.5,9436.4c101.4,131.1 210.7,70.9 345.8,71.1 -49.1,-43.3 -254.7,-155.5 -322.9,-161.4l-22.9,90.3z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M17708.5,8556.8c-78.5,-18.9 -136.8,-17 -215.3,-35.9 0.2,109.9 -71.7,214.1 41,186.3 59.8,-14.8 143,-103.2 174.2,-150.4z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M3949.5,4233.5l-127.4,27.2c118.2,8.6 326.1,53.5 396.5,-45.2 -59.4,-27.5 -129.5,-53.8 -197.3,-53.8l-71.8,0 0,71.8z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M4469.7,1112.2c193.8,-17.3 33.5,-17.8 233.2,0 -1.1,-64.2 32.8,-108 -179.4,-107.6 -43.5,66.4 -46.2,22.7 -53.8,107.6z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M4182.7,538.2l64.2,61.4c2.5,2.5 6.6,6.8 8.8,9.1l16.7,19.2c85.5,-20.7 171.1,-68.9 179.4,-161.4 -128.3,35.8 -165.6,71.9 -269.1,71.8z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M13959.3,5148.4c197.5,-3.8 79.8,-180.8 0,-233.2 -33.6,140.1 -2.5,114.2 0,233.2z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M4990,179.4c67.1,30.9 137.5,35 198.4,2 83.3,-45 32,1.3 52.8,-55.9 -78.8,-69.9 -209.4,-10 -251.1,53.8z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M16434.9,3910.6l47.2,76.2c73.3,-52.5 69.3,-145.8 42.5,-201.8 -62.8,20.5 -73.7,59.4 -89.7,125.6z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M1617.5,2116.8c-9.6,-110.9 -55.3,-143.4 -161.4,-143.5 22.6,93.7 67.6,120.8 161.4,143.5z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M4487.7,556.1c45.4,20.7 115.8,-0.2 176.6,-20.7 79.8,-26.9 -36.4,21.5 26,-9.9 24.1,-12.1 17.3,-11.4 30.6,-23.2 -69,-60.7 -185.2,-19.3 -233.2,53.8z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M16811.6,6332.4l226.9,-117.2c-0,4.4 -5,-3.2 -6.5,-0l-46.8,-19.8c-25.9,-4.2 -57.4,2.1 -81.9,12.7 -51.6,22.4 -85.9,60.4 -91.6,124.3z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M19484.5,7211.4c-8.1,-30 -165.8,-230.4 -197.3,-251.1 2.2,102.3 103.6,225.8 197.3,251.1z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M18497.8,6009.5c48.2,127.1 206.3,10.1 215.3,-89.7 -74.7,42 -116.2,87.6 -215.3,89.7z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M16968.4,3332c65.3,-82.8 -13.1,-149 -103,-156.8 12.2,50.6 10.5,40.4 38.8,87 45.3,74.8 30.9,61.2 64.3,69.8z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M17152.4,5614.8c0,-92.6 -2.6,-112.3 17.9,-197.3 -77.2,24.4 -66.6,28 -76.3,105.9 -7.4,58.9 -19.2,70.2 58.3,91.5z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M5281.6,9259.5c15.7,55.1 43.6,10.4 67.1,68.7 66.7,-33.8 89.3,-23 107.6,-89.7 -64.7,0 -135.3,-13.5 -174.8,21z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M15878.8,4161.8c-47.8,0 -62.1,-8.9 -96.2,13.7 -34.7,23 -41.8,53 -15.1,79.6 57.5,57.4 99.8,-46 111.3,-93.3z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M16399,4987c82.5,-41.4 135.1,-82.7 143.5,-179.4 -65.7,48 -123.7,97.5 -143.5,179.4z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M9510.5,2870.2c35.7,50 88.7,65.7 130.2,58.4 44.4,-117.8 -108.1,-78.7 -130.2,-58.4z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M9290.7,2775.9c36.7,-46.6 22.5,-51.6 22.5,-121l-71.8,0c0,31 -4.4,57.6 5.7,84.9 27.2,74.1 20.3,30 43.5,36z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M10353.7,3085.5l0,-35.9 -178.8,-22.6c16.2,46.6 -36.1,29.6 58.3,53.4 36.9,9.3 80.5,5.2 120.4,5.2z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M4109.4,772.9c33.6,43.1 14,45.7 78.8,24.6 37,-12.1 63.4,-32.8 84.2,-62 -79.6,0 -120,-12.1 -163,37.4z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M16594.8,6213c40.2,42 73.4,56.1 140.4,-1.5 -105.2,-76.4 -140.3,1.5 -140.4,1.5z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M16363.1,6242.7c77.6,0.2 85.2,20.5 125.6,-35.9 -64.2,-29.6 -113,-41.8 -125.6,35.9z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M17133,5818.3c42.4,44.2 70.5,45 122.5,7.2 -0.3,-0.2 -24.1,-26.8 -52.5,-30.3 -97.3,-12 -56.5,12.3 -70,23.1z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M10735,3080.9c35.6,24.3 13.5,33.1 68.2,6.5 103.9,-50.6 35,-55.4 34.8,-55.7 -11.8,-4 -72.7,1.8 -103,49.2z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M16955.1,4807.6c-15.6,-57.6 -50,-92 -107.6,-107.6 19.2,70.5 39.3,91.2 107.6,107.6z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M3572.8,4287.4c83.9,1.8 70.3,30 120.9,-4.6 -39.2,-33.7 -107.5,-81.8 -120.9,4.6z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M17026.9,3229c74.7,-6.6 65.2,3 71.8,-71.8l-71.8,0 0,71.8z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M18892.5,6099.2c6.2,-14.4 34.7,19.6 -15.6,-53.8 -24.6,-35.8 -21.5,-31.1 -56.1,-53.8 22.3,93.2 27.6,126.6 71.8,107.6z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M18765.8,5921.1c-18,-72.2 -87.8,-127.3 -160.3,-144.9l160.3,144.9z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M4295,4282.8c60.2,44.8 80.1,-10.3 86.6,-14.9 -23,-27.5 -5.9,-36.5 -50.5,-27.3 -71.5,14.8 -33.5,26.6 -36.2,42.1z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M433.5,1542.7l146.1,-46c-40.9,-33.2 -122.3,-16.7 -146.1,46z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M16686,4825.5c68.9,-18.8 101.9,-60.4 0,-71.8l0,71.8z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M16735.7,4932.4c72.4,-17.5 88.5,-41.4 22,-88.9l-22,88.9z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M9313.2,2601.1l0,-71.8c-71.4,22.6 -80.2,49.7 0,71.8z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M3680.4,3820.9l-25.6,-86.9c-50.1,67.9 -39.8,69.4 25.6,86.9z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M16883.4,4879.3c-12.8,-53 -8.5,-57.4 -53.8,-89.7 5.8,66.8 0.4,69.4 53.8,89.7z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M8864.7,2762.6c72,28.5 62.7,-10 71.8,-17.9 -20.8,-12.6 30.8,-27.9 -34.4,-13 -25.5,5.9 -32,10.1 -37.3,30.9z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M19018.1,6153c-38.8,-75.6 3.9,-32.9 -71.8,-71.8 15.1,56.2 12.4,55.7 71.8,71.8z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M3626.6,3677.4c42.6,16.9 30.7,26.7 71.8,-35.9 -39.7,4.2 -63,1.5 -71.8,35.9z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M3954.1,3964.5c50.7,25 48,14.8 85.1,-17.9 -11.4,0 -42.2,-1.2 -52.2,1.3 -39.3,9.8 -15.6,3.5 -32.9,16.6z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M19036,6242.7l-47.2,-76.2c-1.4,75.1 -22.8,57.3 47.2,76.2z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M19177.8,6335c-16.9,-72.3 1,-51.2 -70,-56.4l70,56.4z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M16650.2,4717.9c-14.3,-52.8 -2,-37.7 -53.8,-71.8 14.1,52.2 -0.2,36.2 53.8,71.8z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M3841.9,4036.2l75.2,-28.4c-39.4,-20.7 -58.9,-27 -75.2,28.4z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M19143.6,6224.8l-68.1,-75.4c11.5,59.9 8.7,59.3 68.1,75.4z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M19233.3,6296.5c-1.8,-3.9 -15.7,-37.8 -15.8,-38 -17,-33.4 -8.3,-16.8 -20,-33.8 2.3,105.1 -12.6,53.2 35.9,71.8z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M16547.1,6296.5c27.7,15.1 27,23.9 62.5,4.6 -29.1,-21.2 -27.2,-31 -62.5,-4.6z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M3770.1,3695.4l-31.3,-56.5c3,92 -22.9,38.8 31.3,56.5z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M12362.8,5973.6c0,21.1 38.6,40.4 27.8,0 -10.9,-40.5 45.6,-0.5 -8.3,-5.3 -22.6,-2 -19.5,-31.2 -19.5,5.3z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M12291,7103.7c0,21.1 38.6,40.4 27.8,0 -10.9,-40.5 45.6,-0.5 -8.3,-5.3 -22.6,-2 -19.5,-31.2 -19.5,5.3z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M9147.1,5525.1c-25.4,25.4 -10.3,35.1 11.6,6.6 26,-33.8 14.5,-32.8 -11.6,-6.6z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M12412,7032c-25.4,25.4 -10.3,35.1 11.6,6.6 26,-33.8 14.5,-32.8 -11.6,-6.6z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M8523.9,1740.1c18.6,18 64.7,-25.2 20.9,-9.4 -0.4,0.2 -43.1,-12.1 -20.9,9.4z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M9241.5,5350.4c-7.8,40.3 36.4,-11.2 22.4,-11.4 -32.5,-0.5 -15.9,-21.8 -22.4,11.4z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M11572,6517.9c0,34.4 38.8,-10.1 13.2,-5.3 -0,0 -1.7,0.3 -1.7,0.3 -6.8,2.3 -11.4,-57.1 -11.4,4.9z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M19245,6390.5l-23.3,-62.5z"
|
||||
android:fillColor="#66003D33"/>
|
||||
<path
|
||||
android:pathData="M17504.6,5072.1l49.3,-44.6z"
|
||||
android:fillColor="#66003D33"/>
|
||||
</vector>
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true"
|
||||
android:id="@+id/coordinator">
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
@@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/coordinator">
|
||||
|
||||
<androidx.drawerlayout.widget.DrawerLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/drawer_layout">
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/container"
|
||||
android:orientation="vertical">
|
||||
</FrameLayout>
|
||||
|
||||
<com.google.android.material.navigation.NavigationView
|
||||
android:id="@+id/navigation_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="start"
|
||||
app:headerLayout="@layout/view_drawer_header"
|
||||
app:menu="@menu/menu_drawer"/>
|
||||
|
||||
|
||||
|
||||
</androidx.drawerlayout.widget.DrawerLayout>
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
@@ -0,0 +1,35 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<com.google.android.material.navigation.NavigationView
|
||||
android:id="@+id/navigation_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="start"
|
||||
app:headerLayout="@layout/view_drawer_header"
|
||||
app:menu="@menu/menu_drawer"/>
|
||||
|
||||
|
||||
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||
android:layout_weight="1"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/coordinator">
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/container"
|
||||
android:orientation="vertical">
|
||||
</FrameLayout>
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/start_content"/>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -0,0 +1,114 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ScrollView android:layout_width="@dimen/max_view_width"
|
||||
android:fillViewport="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<LinearLayout android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/space_large"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/login_title"
|
||||
tools:text="@string/login_title_create"
|
||||
android:layout_marginBottom="@dimen/space_medium"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/login_explain"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/space_medium"
|
||||
tools:text="@string/login_explain_create"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatEditText
|
||||
android:id="@+id/input_username"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:drawableStart="@drawable/ic_perm_identity_black_24dp"
|
||||
android:drawableLeft="@drawable/ic_perm_identity_black_24dp"
|
||||
android:drawablePadding="@dimen/space_medium"
|
||||
android:layout_marginBottom="@dimen/space_medium"
|
||||
android:hint="@string/login_hint_user"
|
||||
android:inputType="text"
|
||||
style="@style/input"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/space_large"
|
||||
android:orientation="horizontal">
|
||||
<androidx.appcompat.widget.AppCompatEditText
|
||||
android:id="@+id/input_password"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/space_medium"
|
||||
android:drawableStart="@drawable/ic_lock_outline_black_24dp"
|
||||
android:drawableLeft="@drawable/ic_lock_outline_black_24dp"
|
||||
android:drawablePadding="@dimen/space_medium"
|
||||
android:hint="@string/login_hint_password"
|
||||
android:inputType="textPassword"
|
||||
style="@style/input"/>
|
||||
<ImageButton
|
||||
android:id="@+id/button_password"
|
||||
android:contentDescription="@string/login_password_show"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="@dimen/space_medium"
|
||||
android:background="@android:color/transparent"
|
||||
android:src="@drawable/ic_visibility_black_24dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatButton
|
||||
android:id="@+id/button_login"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/space_large"
|
||||
android:theme="@style/button_highlighted"
|
||||
tools:text="@string/login_button_create"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatButton
|
||||
android:id="@+id/button_no_login"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/space_large"
|
||||
android:layout_marginRight="@dimen/space_large"
|
||||
android:layout_marginBottom="@dimen/space_large"
|
||||
android:theme="@style/button"
|
||||
android:text="@string/login_button_continue"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/text_register"
|
||||
android:gravity="center"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:text="@string/login_text_register"
|
||||
style="@style/text_small_hyperlink"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</ScrollView>
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progressBar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
style="?android:attr/progressBarStyleLarge"
|
||||
android:visibility="visible"/>
|
||||
|
||||
</RelativeLayout>
|
||||
@@ -0,0 +1,81 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:background="@drawable/bg_launch_gradient"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/icon_launch_person"
|
||||
android:src="@drawable/icon_launch_world"
|
||||
android:contentDescription="@null"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="fitCenter"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_centerInParent="true"
|
||||
android:orientation="horizontal"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<View
|
||||
android:layout_weight="0.05"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"/>
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/icon_launch_map"
|
||||
android:contentDescription="@string/application_long"
|
||||
android:src="@drawable/icon_launch_sun"
|
||||
android:scaleType="fitCenter"
|
||||
android:adjustViewBounds="true"
|
||||
android:layout_weight="0.15"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<View
|
||||
android:layout_weight="0.05"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"/>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_weight="0.70"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
|
||||
<ImageView
|
||||
android:contentDescription="@null"
|
||||
android:src="@drawable/icon_launch_title"
|
||||
android:scaleType="fitCenter"
|
||||
android:adjustViewBounds="true"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
<ImageView
|
||||
android:contentDescription="@null"
|
||||
android:src="@drawable/icon_launch_subtitle"
|
||||
android:scaleType="fitCenter"
|
||||
android:adjustViewBounds="true"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<View
|
||||
android:layout_weight="0.05"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"/>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
@@ -0,0 +1,46 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<WebView
|
||||
android:id="@+id/web_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/fragment_terms_accept"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/margin_default">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="6dp"
|
||||
android:layout_marginBottom="6dp">
|
||||
|
||||
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/permission_checkbox_start"
|
||||
android:layout_width="0dp"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:text="@string/terms_permisson_checkbox"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.1"/>
|
||||
</LinearLayout>
|
||||
|
||||
<Button
|
||||
android:id="@+id/start_button_continue"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/terms_button_accept"
|
||||
android:theme="@style/button_highlighted"/>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<WebView
|
||||
android:id="@+id/web_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
tools:text="Pick an action"
|
||||
android:id="@+id/dialog_text"
|
||||
android:drawableLeft="@drawable/ic_launch_black_24dp"
|
||||
android:drawableStart="@drawable/ic_launch_black_24dp"
|
||||
android:drawablePadding="@dimen/space_large"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:gravity="center_vertical"
|
||||
android:padding="@dimen/margin_default"
|
||||
android:layout_margin="@dimen/space_medium"
|
||||
android:textSize="8pt"
|
||||
android:textColor="@android:color/black"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
@@ -0,0 +1,42 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<ImageView android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/bg_launch_gradient"
|
||||
android:src="@drawable/icon_launch_world"
|
||||
android:contentDescription="@null"
|
||||
android:scaleType="fitCenter" />
|
||||
<LinearLayout
|
||||
android:paddingBottom="@dimen/space_medium"
|
||||
android:paddingRight="@dimen/space_medium"
|
||||
android:paddingEnd="@dimen/space_medium"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
tools:text="Sony Xperia Foo"
|
||||
android:layout_gravity="end"
|
||||
android:id="@+id/view_header_device"
|
||||
android:textAppearance="?android:attr/textAppearanceMediumInverse"
|
||||
/>
|
||||
<TextView android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/view_header_username"
|
||||
android:layout_gravity="end"
|
||||
tools:text="John Doe"
|
||||
android:textAppearance="?android:attr/textAppearanceMediumInverse"
|
||||
android:textStyle="bold"/>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:auto="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<group android:id="@+id/group_main" android:checkableBehavior="single" >
|
||||
<item android:title="@string/nav_devices"
|
||||
android:id="@+id/menu_devices"
|
||||
android:icon="@drawable/ic_devices_black_24dp"
|
||||
/>
|
||||
</group>
|
||||
<group android:id="@+id/group_settings" android:checkableBehavior="single" >
|
||||
<item android:title="@string/nav_settings"
|
||||
android:id="@+id/menu_settings"
|
||||
android:icon="@drawable/ic_settings_black_24dp"
|
||||
/>
|
||||
</group>
|
||||
<group android:id="@+id/group_account" android:checkableBehavior="single" >
|
||||
<item android:title="@string/nav_signin"
|
||||
android:id="@+id/menu_connect"
|
||||
android:icon="@drawable/ic_person_add_black_24dp" />
|
||||
</group>
|
||||
</menu>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@color/colorPrimary"/>
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
|
||||
</adaptive-icon>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@color/colorPrimary"/>
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
|
||||
</adaptive-icon>
|
||||
|
After Width: | Height: | Size: 2.7 KiB |
|
After Width: | Height: | Size: 4.8 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 3.9 KiB |