Completely ported to IntelliJ Idea
|
@ -0,0 +1,65 @@
|
|||
# Built application files
|
||||
*.apk
|
||||
*.ap_
|
||||
|
||||
# Files for the ART/Dalvik VM
|
||||
*.dex
|
||||
|
||||
# Java class files
|
||||
*.class
|
||||
|
||||
# Generated files
|
||||
bin/
|
||||
gen/
|
||||
out/
|
||||
|
||||
# Gradle files
|
||||
.gradle/
|
||||
build/
|
||||
|
||||
# Local configuration file (sdk path, etc)
|
||||
local.properties
|
||||
|
||||
# Proguard folder generated by Eclipse
|
||||
proguard/
|
||||
|
||||
# Log Files
|
||||
*.log
|
||||
|
||||
# Android Studio Navigation editor temp files
|
||||
.navigation/
|
||||
|
||||
# Android Studio captures folder
|
||||
captures/
|
||||
|
||||
# IntelliJ
|
||||
*.iml
|
||||
.idea/workspace.xml
|
||||
.idea/tasks.xml
|
||||
.idea/gradle.xml
|
||||
.idea/assetWizardSettings.xml
|
||||
.idea/dictionaries
|
||||
.idea/libraries
|
||||
.idea/caches
|
||||
|
||||
# Keystore files
|
||||
# Uncomment the following line if you do not want to check your keystore files in.
|
||||
#*.jks
|
||||
|
||||
# External native build folder generated in Android Studio 2.2 and later
|
||||
.externalNativeBuild
|
||||
|
||||
# Google Services (e.g. APIs or Firebase)
|
||||
google-services.json
|
||||
|
||||
# Freeline
|
||||
freeline.py
|
||||
freeline/
|
||||
freeline_project_description.json
|
||||
|
||||
# fastlane
|
||||
fastlane/report.xml
|
||||
fastlane/Preview.html
|
||||
fastlane/screenshots
|
||||
fastlane/test_output
|
||||
fastlane/readme.md
|
|
@ -0,0 +1,5 @@
|
|||
<component name="ProjectCodeStyleConfiguration">
|
||||
<state>
|
||||
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
|
||||
</state>
|
||||
</component>
|
|
@ -0,0 +1,36 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="NullableNotNullManager">
|
||||
<option name="myDefaultNullable" value="org.jetbrains.annotations.Nullable" />
|
||||
<option name="myDefaultNotNull" value="android.support.annotation.NonNull" />
|
||||
<option name="myNullables">
|
||||
<value>
|
||||
<list size="6">
|
||||
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
|
||||
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
|
||||
<item index="2" class="java.lang.String" itemvalue="javax.annotation.CheckForNull" />
|
||||
<item index="3" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" />
|
||||
<item index="4" class="java.lang.String" itemvalue="android.support.annotation.Nullable" />
|
||||
<item index="5" class="java.lang.String" itemvalue="androidx.annotation.Nullable" />
|
||||
</list>
|
||||
</value>
|
||||
</option>
|
||||
<option name="myNotNulls">
|
||||
<value>
|
||||
<list size="5">
|
||||
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
|
||||
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
|
||||
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
|
||||
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" />
|
||||
<item index="4" class="java.lang.String" itemvalue="androidx.annotation.NonNull" />
|
||||
</list>
|
||||
</value>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
<option name="id" value="Android" />
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/Misp.iml" filepath="$PROJECT_DIR$/Misp.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,124 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Palette2">
|
||||
<group name="Swing">
|
||||
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
|
||||
</item>
|
||||
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
|
||||
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
|
||||
<initial-values>
|
||||
<property name="text" value="Button" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="RadioButton" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="CheckBox" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="Label" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
|
||||
<preferred-size width="-1" height="20" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
|
||||
</item>
|
||||
</group>
|
||||
</component>
|
||||
</project>
|
After Width: | Height: | Size: 57 KiB |
After Width: | Height: | Size: 122 KiB |
After Width: | Height: | Size: 1.1 MiB |
After Width: | Height: | Size: 88 KiB |
After Width: | Height: | Size: 77 KiB |
|
@ -0,0 +1 @@
|
|||
/build
|
|
@ -0,0 +1,34 @@
|
|||
apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
compileSdkVersion 27
|
||||
buildToolsVersion "27.0.3"
|
||||
defaultConfig {
|
||||
applicationId "de.overview.wg.its.mispauth"
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 27
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
implementation 'com.android.support:appcompat-v7:27.1.1'
|
||||
implementation 'com.android.support.constraint:constraint-layout:1.1.1'
|
||||
testImplementation 'junit:junit:4.12'
|
||||
androidTestImplementation 'com.android.support.test:runner:1.0.2'
|
||||
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
|
||||
implementation 'com.android.support:cardview-v7:27.1.1'
|
||||
implementation 'com.android.support:design:27.1.1'
|
||||
|
||||
implementation 'com.android.volley:volley:1.1.0'
|
||||
implementation 'com.github.kenglxn.QRGen:android:2.4.0'
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
|
@ -0,0 +1,26 @@
|
|||
package de.overview.wg.its.mispauth;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.test.InstrumentationRegistry;
|
||||
import android.support.test.runner.AndroidJUnit4;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Instrumented test, which will execute on an Android device.
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class ExampleInstrumentedTest {
|
||||
@Test
|
||||
public void useAppContext() throws Exception {
|
||||
// Context of the app under test.
|
||||
Context appContext = InstrumentationRegistry.getTargetContext();
|
||||
|
||||
assertEquals("de.overview.wg.its.mispauth", appContext.getPackageName());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="de.overview.wg.its.mispauth">
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme">
|
||||
|
||||
<activity android:name=".activity.MainActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".activity.SettingsActivity"
|
||||
android:label="@string/title_activity_settings"
|
||||
android:parentActivityName=".activity.MainActivity"/>
|
||||
|
||||
<activity
|
||||
android:name=".activity.SyncActivity"
|
||||
android:label="@string/title_activity_sync"
|
||||
android:parentActivityName=".activity.MainActivity"/>
|
||||
</application>
|
||||
|
||||
</manifest>
|
|
@ -0,0 +1,119 @@
|
|||
package de.overview.wg.its.mispauth.activity;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.design.widget.FloatingActionButton;
|
||||
import android.support.v4.widget.SwipeRefreshLayout;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.DividerItemDecoration;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import de.overview.wg.its.mispauth.R;
|
||||
import de.overview.wg.its.mispauth.adapter.ExtOrgAdapter;
|
||||
import de.overview.wg.its.mispauth.auxiliary.PreferenceManager;
|
||||
import de.overview.wg.its.mispauth.model.Organisation;
|
||||
|
||||
public class MainActivity extends AppCompatActivity {
|
||||
|
||||
private Organisation[] externalOrganisations;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
|
||||
Toolbar toolbar = findViewById(R.id.toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
|
||||
getExternalOrganisations();
|
||||
setUpRecyclerView();
|
||||
|
||||
FloatingActionButton fabAdd = findViewById(R.id.fab_add);
|
||||
final FloatingActionButton fabSync = findViewById(R.id.fab_sync);
|
||||
|
||||
fabAdd.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if(fabSync.getVisibility() == View.GONE){
|
||||
fabSync.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
fabSync.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
fabSync.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
startSyncActivity();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
getMenuInflater().inflate(R.menu.menu_main, menu);
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
int id = item.getItemId();
|
||||
|
||||
if (id == R.id.menu_item_settings) {
|
||||
startActivity(new Intent(this, SettingsActivity.class));
|
||||
return true;
|
||||
}
|
||||
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
private void setUpRecyclerView() {
|
||||
RecyclerView orgRecyclerView = findViewById(R.id.orgRecyclerView);
|
||||
orgRecyclerView.setHasFixedSize(true);
|
||||
|
||||
RecyclerView.LayoutManager orgLayoutManager = new LinearLayoutManager(this);
|
||||
orgRecyclerView.setLayoutManager(orgLayoutManager);
|
||||
|
||||
DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(orgRecyclerView.getContext(), 1);
|
||||
orgRecyclerView.addItemDecoration(dividerItemDecoration);
|
||||
|
||||
RecyclerView.Adapter orgAdapter = new ExtOrgAdapter(this, externalOrganisations);
|
||||
orgRecyclerView.setAdapter(orgAdapter);
|
||||
|
||||
if(externalOrganisations.length == 0){
|
||||
orgRecyclerView.setVisibility(View.GONE);
|
||||
findViewById(R.id.empty_view).setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
orgRecyclerView.setVisibility(View.VISIBLE);
|
||||
findViewById(R.id.empty_view).setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
final SwipeRefreshLayout refreshLayout = findViewById(R.id.recycler_refresh);
|
||||
refreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
|
||||
@Override
|
||||
public void onRefresh() {
|
||||
// TODO do stuff
|
||||
// refreshLayout.setRefreshing(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void getExternalOrganisations(){
|
||||
Organisation a = new Organisation();
|
||||
a.setName("Ferrari");
|
||||
a.setDescription("Ferrari has nothing to share");
|
||||
a.setSector("Fast cars");
|
||||
a.setNationality("Italy");
|
||||
a.setUserCount(67);
|
||||
|
||||
externalOrganisations = new Organisation[] {a};
|
||||
}
|
||||
|
||||
private void startSyncActivity(){
|
||||
startActivity(new Intent(this, SyncActivity.class));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,211 @@
|
|||
package de.overview.wg.its.mispauth.activity;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.design.widget.Snackbar;
|
||||
import android.support.design.widget.TextInputLayout;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
import com.android.volley.VolleyError;
|
||||
import de.overview.wg.its.mispauth.R;
|
||||
import de.overview.wg.its.mispauth.auxiliary.PreferenceManager;
|
||||
import de.overview.wg.its.mispauth.auxiliary.ReadableError;
|
||||
import de.overview.wg.its.mispauth.model.Organisation;
|
||||
import de.overview.wg.its.mispauth.model.User;
|
||||
import de.overview.wg.its.mispauth.network.MispRequest;
|
||||
import org.json.JSONObject;
|
||||
|
||||
public class SettingsActivity extends AppCompatActivity {
|
||||
|
||||
private static final String TAG = "DEBUG";
|
||||
|
||||
private PreferenceManager preferenceManager;
|
||||
private ProgressBar progressBar;
|
||||
private TextInputLayout serverUrlLayout, apiKeyLayout;
|
||||
private EditText serverUrlText, apiKeyText;
|
||||
|
||||
private Organisation org;
|
||||
private User user;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_settings);
|
||||
|
||||
Toolbar toolbar = findViewById(R.id.toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
|
||||
getSupportActionBar().setDisplayShowHomeEnabled(true);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
serverUrlLayout = findViewById(R.id.input_layout_server_url);
|
||||
apiKeyLayout = findViewById(R.id.input_layout_api_key);
|
||||
serverUrlText = findViewById(R.id.edit_server_url);
|
||||
apiKeyText = findViewById(R.id.edit_api_key);
|
||||
progressBar = findViewById(R.id.progressBar);
|
||||
|
||||
findViewById(R.id.fab_download_own_org_info).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
downloadMyOrgInfo();
|
||||
}
|
||||
});
|
||||
|
||||
apiKeyText.setOnKeyListener(new View.OnKeyListener() {
|
||||
public boolean onKey(View v, int keyCode, KeyEvent event) {
|
||||
if (keyCode == 66) {
|
||||
hideKeyboard(v);
|
||||
apiKeyText.clearFocus();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
restoreSavedValues();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
getMenuInflater().inflate(R.menu.menu_settings, menu);
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
int id = item.getItemId();
|
||||
|
||||
if (id == R.id.menu_item_deleteData) {
|
||||
serverUrlText.setText("");
|
||||
apiKeyText.setText("");
|
||||
preferenceManager.deleteAllLocalData();
|
||||
return true;
|
||||
}
|
||||
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
private void setOrganisation(Organisation org) {
|
||||
|
||||
if(org == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
TextView title = findViewById(R.id.organisation_title);
|
||||
TextView uuid = findViewById(R.id.organisation_uuid);
|
||||
TextView description = findViewById(R.id.organisation_description);
|
||||
TextView nationality = findViewById(R.id.organisation_nationality);
|
||||
TextView sector = findViewById(R.id.organisation_sector);
|
||||
TextView userCount = findViewById(R.id.organisation_user_count);
|
||||
|
||||
title.setText(org.getName());
|
||||
uuid.setText(org.getUuid());
|
||||
description.setText(org.getDescription());
|
||||
nationality.setText(org.getNationality());
|
||||
sector.setText(org.getSector());
|
||||
userCount.setText("" + org.getUserCount());
|
||||
}
|
||||
|
||||
private void restoreSavedValues() {
|
||||
preferenceManager = PreferenceManager.Instance(this);
|
||||
|
||||
serverUrlText.setText(preferenceManager.getMyServerUrl());
|
||||
apiKeyText.setText(preferenceManager.getMyServerApiKey());
|
||||
|
||||
setOrganisation(preferenceManager.getMyOrganisation());
|
||||
}
|
||||
|
||||
private void downloadMyOrgInfo(){
|
||||
user = new User();
|
||||
org = new Organisation();
|
||||
|
||||
boolean failed = false;
|
||||
|
||||
String tmpServerUrl = serverUrlText.getText().toString();
|
||||
String tmpApiKey = apiKeyText.getText().toString();
|
||||
|
||||
if(tmpServerUrl.isEmpty()) {
|
||||
serverUrlLayout.setError("Server URL is required");
|
||||
failed = true;
|
||||
}
|
||||
|
||||
if(tmpApiKey.isEmpty()) {
|
||||
apiKeyLayout.setError("API Key is required");
|
||||
failed = true;
|
||||
}
|
||||
|
||||
if(failed) {
|
||||
return;
|
||||
} else {
|
||||
serverUrlLayout.setError(null);
|
||||
apiKeyLayout.setError(null);
|
||||
}
|
||||
|
||||
final MispRequest request = MispRequest.Instance(this);
|
||||
request.setServerCredentials(tmpServerUrl, tmpApiKey);
|
||||
|
||||
progressBar.setVisibility(View.VISIBLE);
|
||||
|
||||
request.myUserInformation(new MispRequest.UserInformationCallback() {
|
||||
|
||||
@Override
|
||||
public void onResult(JSONObject myUserInformation) {
|
||||
|
||||
user.fromJSON(myUserInformation);
|
||||
preferenceManager.setMyUser(user);
|
||||
|
||||
int orgID = user.getOrgId();
|
||||
|
||||
request.OrganisationInformation(orgID, new MispRequest.OrganisationInformationCallback() {
|
||||
|
||||
@Override
|
||||
public void onResult(JSONObject organisationInformation) {
|
||||
progressBar.setVisibility(View.GONE);
|
||||
|
||||
org.fromJSON(organisationInformation);
|
||||
|
||||
preferenceManager.setMyOrganisation(org);
|
||||
|
||||
setOrganisation(org);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(VolleyError volleyError) {
|
||||
progressBar.setVisibility(View.GONE);
|
||||
MakeSnackbar(ReadableError.toReadable(volleyError));
|
||||
Log.e(TAG, "onError: " + volleyError.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(VolleyError volleyError) {
|
||||
progressBar.setVisibility(View.GONE);
|
||||
MakeSnackbar(ReadableError.toReadable(volleyError));
|
||||
}
|
||||
});
|
||||
|
||||
// If auth was successful: save new credentials
|
||||
preferenceManager.setMyServerUrl(tmpServerUrl);
|
||||
preferenceManager.setMyServerApiKey(tmpApiKey);
|
||||
}
|
||||
|
||||
private void MakeSnackbar(String msg){
|
||||
View contextView = findViewById(R.id.coordinator);
|
||||
Snackbar.make(contextView, msg, Snackbar.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
private void hideKeyboard(View view) {
|
||||
InputMethodManager manager = (InputMethodManager) view.getContext().getSystemService(INPUT_METHOD_SERVICE);
|
||||
if (manager != null) {
|
||||
manager.hideSoftInputFromWindow(view.getWindowToken(), 0);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package de.overview.wg.its.mispauth.activity;
|
||||
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import de.overview.wg.its.mispauth.R;
|
||||
|
||||
public class SyncActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_sync);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
package de.overview.wg.its.mispauth.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
import de.overview.wg.its.mispauth.R;
|
||||
import de.overview.wg.its.mispauth.auxiliary.OrganisationDialog;
|
||||
import de.overview.wg.its.mispauth.model.Organisation;
|
||||
|
||||
public class ExtOrgAdapter extends RecyclerView.Adapter<ExtOrgAdapter.ViewHolder> {
|
||||
|
||||
private Context context;
|
||||
private Organisation[] dataSet;
|
||||
|
||||
public ExtOrgAdapter(Context context, Organisation[] dataSet) {
|
||||
this.context = context;
|
||||
this.dataSet = dataSet;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View extOrgView = LayoutInflater.from(parent.getContext()).inflate(R.layout.view_holder_ext_org, parent, false);
|
||||
return new ViewHolder(extOrgView);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull ViewHolder holder, final int position) {
|
||||
holder.orgTitle.setText(dataSet[position].getName());
|
||||
holder.subTitle.setText(dataSet[position].getDescription());
|
||||
|
||||
holder.parentLayout.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
OrganisationDialog d = new OrganisationDialog(context);
|
||||
d.createDialog(dataSet[position]);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return dataSet.length;
|
||||
}
|
||||
|
||||
public static class ViewHolder extends RecyclerView.ViewHolder{
|
||||
|
||||
RelativeLayout parentLayout;
|
||||
TextView orgTitle;
|
||||
TextView subTitle;
|
||||
|
||||
public ViewHolder(View v) {
|
||||
super(v);
|
||||
parentLayout = v.findViewById(R.id.parent_layout);
|
||||
orgTitle = v.findViewById(R.id.ext_org_title);
|
||||
subTitle = v.findViewById(R.id.ext_org_sub_title);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
package de.overview.wg.its.mispauth.auxiliary;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
import de.overview.wg.its.mispauth.R;
|
||||
import de.overview.wg.its.mispauth.model.Organisation;
|
||||
|
||||
public class OrganisationDialog {
|
||||
|
||||
private AlertDialog.Builder dialogBuilder;
|
||||
private LayoutInflater inflater;
|
||||
|
||||
public OrganisationDialog(Context context) {
|
||||
dialogBuilder = new AlertDialog.Builder(context);
|
||||
inflater = ((Activity)context).getLayoutInflater();
|
||||
}
|
||||
|
||||
public void createDialog(Organisation org) {
|
||||
|
||||
View dialogContent = inflater.inflate(R.layout.view_holder_organisation, null);
|
||||
dialogBuilder.setView(dialogContent);
|
||||
|
||||
TextView title = dialogContent.findViewById(R.id.organisation_title);
|
||||
title.setText(org.getName());
|
||||
|
||||
TextView description = dialogContent.findViewById(R.id.organisation_description);
|
||||
description.setText(org.getDescription());
|
||||
|
||||
TextView sector = dialogContent.findViewById(R.id.organisation_sector);
|
||||
sector.setText(org.getSector());
|
||||
|
||||
TextView nationality = dialogContent.findViewById(R.id.organisation_nationality);
|
||||
nationality.setText(org.getNationality());
|
||||
|
||||
TextView userCount = dialogContent.findViewById(R.id.organisation_user_count);
|
||||
userCount.setText("" + org.getUserCount());
|
||||
|
||||
dialogBuilder.setPositiveButton("OK", null);
|
||||
dialogBuilder.show();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,95 @@
|
|||
package de.overview.wg.its.mispauth.auxiliary;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import de.overview.wg.its.mispauth.model.Organisation;
|
||||
import de.overview.wg.its.mispauth.model.User;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
public class PreferenceManager {
|
||||
|
||||
private static PreferenceManager instance;
|
||||
private SharedPreferences sharedPreferences;
|
||||
|
||||
private static String PREF_KEY_SERVER_URL = "key_server_url";
|
||||
private static String PREF_KEY_SERVER_API_KEY = "key_server_api_key";
|
||||
private static String PREF_KEY_MY_ORGANISATION = "key_my_organisation";
|
||||
private static String PREF_KEY_MY_USER = "key_my_user";
|
||||
|
||||
private PreferenceManager(Context context) {
|
||||
sharedPreferences = android.preference.PreferenceManager.getDefaultSharedPreferences(context);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return own Organisation if available, else null
|
||||
*/
|
||||
public Organisation getMyOrganisation() {
|
||||
try {
|
||||
JSONObject jsonObject = new JSONObject(sharedPreferences.getString(PREF_KEY_MY_ORGANISATION, ""));
|
||||
Organisation org = new Organisation();
|
||||
org.fromJSON(jsonObject);
|
||||
return org;
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
public void setMyOrganisation(Organisation org) {
|
||||
SharedPreferences.Editor editor = sharedPreferences.edit();
|
||||
editor.putString(PREF_KEY_MY_ORGANISATION, org.toJSON().toString());
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
public User getMyUser() {
|
||||
try {
|
||||
JSONObject jsonObject = new JSONObject(sharedPreferences.getString(PREF_KEY_MY_USER, ""));
|
||||
User user = new User();
|
||||
user.fromJSON(jsonObject);
|
||||
return user;
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
public void setMyUser(User user) {
|
||||
SharedPreferences.Editor editor = sharedPreferences.edit();
|
||||
editor.putString(PREF_KEY_MY_USER, user.toJSON().toString());
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
public String getMyServerUrl() {
|
||||
return sharedPreferences.getString(PREF_KEY_SERVER_URL, "");
|
||||
}
|
||||
public void setMyServerUrl(String serverUrl) {
|
||||
SharedPreferences.Editor editor = sharedPreferences.edit();
|
||||
editor.putString(PREF_KEY_SERVER_URL, serverUrl);
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
public String getMyServerApiKey() {
|
||||
return sharedPreferences.getString(PREF_KEY_SERVER_API_KEY, "");
|
||||
}
|
||||
public void setMyServerApiKey(String apiKey) {
|
||||
SharedPreferences.Editor editor = sharedPreferences.edit();
|
||||
editor.putString(PREF_KEY_SERVER_API_KEY, apiKey);
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
public void deleteAllLocalData() {
|
||||
SharedPreferences.Editor editor = sharedPreferences.edit();
|
||||
editor.clear();
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
public static PreferenceManager Instance(Context context) {
|
||||
if(instance == null) {
|
||||
instance = new PreferenceManager(context);
|
||||
}
|
||||
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
package de.overview.wg.its.mispauth.auxiliary;
|
||||
|
||||
import com.android.volley.AuthFailureError;
|
||||
import com.android.volley.NoConnectionError;
|
||||
import com.android.volley.VolleyError;
|
||||
|
||||
public class ReadableError {
|
||||
|
||||
public static String toReadable(VolleyError volleyError) {
|
||||
|
||||
if(volleyError instanceof NoConnectionError) {
|
||||
return "Connection failed";
|
||||
} else if(volleyError instanceof AuthFailureError) {
|
||||
return "Authentication failed";
|
||||
}
|
||||
|
||||
return "Unknown error";
|
||||
}
|
||||
}
|
|
@ -0,0 +1,186 @@
|
|||
package de.overview.wg.its.mispauth.model;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
public class Organisation {
|
||||
|
||||
private static String ID_KEY = "id";
|
||||
private static String NAME_KEY = "name";
|
||||
private static String DATE_CREATED_KEY = "date_created";
|
||||
private static String DATE_MODIFIED_KEY = "date_modified";
|
||||
private static String TYPE_KEY = "type";
|
||||
private static String NATIONALITY_KEY = "nationality";
|
||||
private static String SECTOR_KEY = "sector";
|
||||
private static String CONTACTS_KEY = "contacts";
|
||||
private static String DESCRIPTION_KEY = "description";
|
||||
private static String LOCAL_KEY = "local";
|
||||
private static String UUID_KEY = "uuid";
|
||||
private static String RESTRICTED_TO_DOMAIN_KEY = "restricted_to_domain";
|
||||
private static String CREATED_BY_KEY = "created_by";
|
||||
private static String USER_COUNT_KEY = "user_count";
|
||||
|
||||
private int id;
|
||||
private String name;
|
||||
private String dateCreated, dateModified;
|
||||
private String type;
|
||||
private String nationality;
|
||||
private String sector;
|
||||
private String contacts;
|
||||
private String description;
|
||||
private boolean local;
|
||||
private String uuid;
|
||||
private String restrictedToDomain;
|
||||
private int createdBy;
|
||||
private int userCount;
|
||||
|
||||
public Organisation() {}
|
||||
|
||||
public void fromJSON(JSONObject org) {
|
||||
|
||||
try {
|
||||
id = org.getInt(ID_KEY);
|
||||
dateCreated = org.getString(DATE_CREATED_KEY);
|
||||
dateModified = org.getString(DATE_MODIFIED_KEY);
|
||||
name = org.getString(NAME_KEY);
|
||||
type = org.getString(TYPE_KEY);
|
||||
nationality = org.getString(NATIONALITY_KEY);
|
||||
sector = org.getString(SECTOR_KEY);
|
||||
contacts = org.getString(CONTACTS_KEY);
|
||||
description = org.getString(DESCRIPTION_KEY);
|
||||
local = org.getBoolean(LOCAL_KEY);
|
||||
uuid = org.getString(UUID_KEY);
|
||||
restrictedToDomain = org.getString(RESTRICTED_TO_DOMAIN_KEY);
|
||||
createdBy = org.getInt(CREATED_BY_KEY);
|
||||
userCount = org.getInt(USER_COUNT_KEY);
|
||||
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public JSONObject toJSON() {
|
||||
JSONObject org = new JSONObject();
|
||||
|
||||
try {
|
||||
org.put(ID_KEY, id);
|
||||
org.put(NAME_KEY, name);
|
||||
org.put(DATE_CREATED_KEY, dateCreated);
|
||||
org.put(DATE_MODIFIED_KEY, dateModified);
|
||||
org.put(TYPE_KEY, type);
|
||||
org.put(NATIONALITY_KEY, nationality);
|
||||
org.put(SECTOR_KEY, sector);
|
||||
org.put(CONTACTS_KEY, contacts);
|
||||
org.put(DESCRIPTION_KEY, description);
|
||||
org.put(LOCAL_KEY, local);
|
||||
org.put(UUID_KEY, uuid);
|
||||
org.put(RESTRICTED_TO_DOMAIN_KEY, restrictedToDomain);
|
||||
org.put(CREATED_BY_KEY, createdBy);
|
||||
org.put(USER_COUNT_KEY, userCount);
|
||||
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return org;
|
||||
}
|
||||
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
public String getName(){
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getSector() {
|
||||
return sector;
|
||||
}
|
||||
public void setSector(String sector) {
|
||||
this.sector = sector;
|
||||
}
|
||||
|
||||
public String getNationality() {
|
||||
return nationality;
|
||||
}
|
||||
public void setNationality(String nationality) {
|
||||
this.nationality = nationality;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getDateCreated() {
|
||||
return dateCreated;
|
||||
}
|
||||
public void setDateCreated(String dateCreated) {
|
||||
this.dateCreated = dateCreated;
|
||||
}
|
||||
|
||||
public String getDateModified() {
|
||||
return dateModified;
|
||||
}
|
||||
public void setDateModified(String dateModified) {
|
||||
this.dateModified = dateModified;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getContacts() {
|
||||
return contacts;
|
||||
}
|
||||
public void setContacts(String contacts) {
|
||||
this.contacts = contacts;
|
||||
}
|
||||
|
||||
public boolean isLocal() {
|
||||
return local;
|
||||
}
|
||||
public void setLocal(boolean local) {
|
||||
this.local = local;
|
||||
}
|
||||
|
||||
public String getUuid() {
|
||||
return uuid;
|
||||
}
|
||||
public void setUuid(String uuid) {
|
||||
this.uuid = uuid;
|
||||
}
|
||||
|
||||
public String getRestrictedToDomain() {
|
||||
return restrictedToDomain;
|
||||
}
|
||||
public void setRestrictedToDomain(String restrictedToDomain) {
|
||||
this.restrictedToDomain = restrictedToDomain;
|
||||
}
|
||||
|
||||
public int getCreatedBy() {
|
||||
return createdBy;
|
||||
}
|
||||
public void setCreatedBy(int createdBy) {
|
||||
this.createdBy = createdBy;
|
||||
}
|
||||
|
||||
public int getUserCount() {
|
||||
return userCount;
|
||||
}
|
||||
public void setUserCount(int userCount) {
|
||||
this.userCount = userCount;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,298 @@
|
|||
package de.overview.wg.its.mispauth.model;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
public class User {
|
||||
|
||||
private static String ID_KEY = "id";
|
||||
private static String PASSWORD_KEY = "password";
|
||||
private static String ORG_ID_KEY = "org_id";
|
||||
private static String EMAIL_KEY = "email";
|
||||
private static String AUTOALERT_KEY = "autoalert";
|
||||
private static String AUTHKEY_KEY = "authkey";
|
||||
private static String INVITED_BY_KEY = "invited_by";
|
||||
private static String GPGKEY_KEY = "gpgkey";
|
||||
private static String CERTIF_PUBLIC = "certif_public";
|
||||
private static String NIDS_SID = "nids_sid";
|
||||
private static String TERMS_ACCEPTED_KEY = "termsaccepted";
|
||||
private static String NEWSREAD_KEY = "newsread";
|
||||
private static String ROLE_ID_KEY = "role_id";
|
||||
private static String CHANGE_PW_KEY = "change_pw";
|
||||
private static String CONTACT_ALERT_KEY = "contactalert";
|
||||
private static String DISABLED_KEY = "disabled";
|
||||
private static String EXPIRATION_KEY = "expiration";
|
||||
private static String CURRENT_LOGIN_KEY = "current_login";
|
||||
private static String LAST_LOGIN_KEY = "last_login";
|
||||
private static String FORCE_LOGOUT_KEY = "force_logout";
|
||||
private static String DATE_CREATED_KEY = "date_created";
|
||||
private static String DATE_MODIFIED_KEY = "date_modified";
|
||||
|
||||
private int id;
|
||||
private String password;
|
||||
private int orgId;
|
||||
private String email;
|
||||
private boolean autoAlert;
|
||||
private String authkey;
|
||||
private int invitedBy;
|
||||
private String gpgKey;
|
||||
private String certifPublic;
|
||||
private int nidsSid;
|
||||
private boolean termsAccepted;
|
||||
private int newsRead; // Integer??
|
||||
private int roleId;
|
||||
private String changePw;
|
||||
private boolean contactAlert;
|
||||
private boolean disabled;
|
||||
private String expiration;
|
||||
private String currentLogin;
|
||||
private String lastLogin;
|
||||
private boolean forceLogout;
|
||||
private String dateCreated;
|
||||
private String dateModified;
|
||||
|
||||
public User() {}
|
||||
|
||||
public void fromJSON(JSONObject user) {
|
||||
try {
|
||||
|
||||
id = user.getInt(ID_KEY);
|
||||
password = user.getString(PASSWORD_KEY);
|
||||
orgId = user.getInt(ORG_ID_KEY);
|
||||
email = user.getString(EMAIL_KEY);
|
||||
autoAlert = user.getBoolean(AUTOALERT_KEY);
|
||||
authkey = user.getString(AUTHKEY_KEY);
|
||||
invitedBy = user.getInt(INVITED_BY_KEY);
|
||||
gpgKey = user.getString(GPGKEY_KEY);
|
||||
certifPublic = user.getString(CERTIF_PUBLIC);
|
||||
nidsSid = user.getInt(NIDS_SID);
|
||||
termsAccepted = user.getBoolean(TERMS_ACCEPTED_KEY);
|
||||
newsRead = user.getInt(NEWSREAD_KEY);
|
||||
roleId = user.getInt(ROLE_ID_KEY);
|
||||
changePw = user.getString(CHANGE_PW_KEY);
|
||||
contactAlert = user.getBoolean(CONTACT_ALERT_KEY);
|
||||
disabled = user.getBoolean(DISABLED_KEY);
|
||||
expiration = user.getString(EXPIRATION_KEY);
|
||||
currentLogin = user.getString(CURRENT_LOGIN_KEY);
|
||||
lastLogin = user.getString(LAST_LOGIN_KEY);
|
||||
forceLogout = user.getBoolean(FORCE_LOGOUT_KEY);
|
||||
dateCreated = user.getString(DATE_CREATED_KEY);
|
||||
dateModified = user.getString(DATE_MODIFIED_KEY);
|
||||
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public JSONObject toJSON() {
|
||||
JSONObject user = new JSONObject();
|
||||
|
||||
try {
|
||||
|
||||
user.put(ID_KEY, id);
|
||||
user.put(PASSWORD_KEY, password);
|
||||
user.put(ORG_ID_KEY, orgId);
|
||||
user.put(EMAIL_KEY, email);
|
||||
user.put(AUTOALERT_KEY, autoAlert);
|
||||
user.put(AUTHKEY_KEY, authkey);
|
||||
user.put(INVITED_BY_KEY, invitedBy);
|
||||
user.put(GPGKEY_KEY, gpgKey);
|
||||
user.put(CERTIF_PUBLIC, certifPublic);
|
||||
user.put(NIDS_SID, nidsSid);
|
||||
user.put(TERMS_ACCEPTED_KEY, termsAccepted);
|
||||
user.put(NEWSREAD_KEY, newsRead);
|
||||
user.put(ROLE_ID_KEY, roleId);
|
||||
user.put(CHANGE_PW_KEY, changePw);
|
||||
user.put(CONTACT_ALERT_KEY, contactAlert);
|
||||
user.put(DISABLED_KEY, disabled);
|
||||
user.put(EXPIRATION_KEY, expiration);
|
||||
user.put(CURRENT_LOGIN_KEY, currentLogin);
|
||||
user.put(LAST_LOGIN_KEY, lastLogin);
|
||||
user.put(FORCE_LOGOUT_KEY, forceLogout);
|
||||
user.put(DATE_CREATED_KEY, dateCreated);
|
||||
user.put(DATE_MODIFIED_KEY, dateModified);
|
||||
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return user;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public int getOrgId() {
|
||||
return orgId;
|
||||
}
|
||||
|
||||
public void setOrgId(int orgId) {
|
||||
this.orgId = orgId;
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
public boolean isAutoAlert() {
|
||||
return autoAlert;
|
||||
}
|
||||
|
||||
public void setAutoAlert(boolean autoAlert) {
|
||||
this.autoAlert = autoAlert;
|
||||
}
|
||||
|
||||
public String getAuthkey() {
|
||||
return authkey;
|
||||
}
|
||||
|
||||
public void setAuthkey(String authkey) {
|
||||
this.authkey = authkey;
|
||||
}
|
||||
|
||||
public int getInvitedBy() {
|
||||
return invitedBy;
|
||||
}
|
||||
|
||||
public void setInvitedBy(int invitedBy) {
|
||||
this.invitedBy = invitedBy;
|
||||
}
|
||||
|
||||
public String getGpgKey() {
|
||||
return gpgKey;
|
||||
}
|
||||
|
||||
public void setGpgKey(String gpgKey) {
|
||||
this.gpgKey = gpgKey;
|
||||
}
|
||||
|
||||
public String getCertifPublic() {
|
||||
return certifPublic;
|
||||
}
|
||||
|
||||
public void setCertifPublic(String certifPublic) {
|
||||
this.certifPublic = certifPublic;
|
||||
}
|
||||
|
||||
public int getNidsSid() {
|
||||
return nidsSid;
|
||||
}
|
||||
|
||||
public void setNidsSid(int nidsSid) {
|
||||
this.nidsSid = nidsSid;
|
||||
}
|
||||
|
||||
public boolean isTermsAccepted() {
|
||||
return termsAccepted;
|
||||
}
|
||||
|
||||
public void setTermsAccepted(boolean termsAccepted) {
|
||||
this.termsAccepted = termsAccepted;
|
||||
}
|
||||
|
||||
public int getNewsRead() {
|
||||
return newsRead;
|
||||
}
|
||||
|
||||
public void setNewsRead(int newsRead) {
|
||||
this.newsRead = newsRead;
|
||||
}
|
||||
|
||||
public int getRoleId() {
|
||||
return roleId;
|
||||
}
|
||||
|
||||
public void setRoleId(int roleId) {
|
||||
this.roleId = roleId;
|
||||
}
|
||||
|
||||
public String getChangePw() {
|
||||
return changePw;
|
||||
}
|
||||
|
||||
public void setChangePw(String changePw) {
|
||||
this.changePw = changePw;
|
||||
}
|
||||
|
||||
public boolean isContactAlert() {
|
||||
return contactAlert;
|
||||
}
|
||||
|
||||
public void setContactAlert(boolean contactAlert) {
|
||||
this.contactAlert = contactAlert;
|
||||
}
|
||||
|
||||
public boolean isDisabled() {
|
||||
return disabled;
|
||||
}
|
||||
|
||||
public void setDisabled(boolean disabled) {
|
||||
this.disabled = disabled;
|
||||
}
|
||||
|
||||
public String getExpiration() {
|
||||
return expiration;
|
||||
}
|
||||
|
||||
public void setExpiration(String expiration) {
|
||||
this.expiration = expiration;
|
||||
}
|
||||
|
||||
public String getCurrentLogin() {
|
||||
return currentLogin;
|
||||
}
|
||||
|
||||
public void setCurrentLogin(String currentLogin) {
|
||||
this.currentLogin = currentLogin;
|
||||
}
|
||||
|
||||
public String getLastLogin() {
|
||||
return lastLogin;
|
||||
}
|
||||
|
||||
public void setLastLogin(String lastLogin) {
|
||||
this.lastLogin = lastLogin;
|
||||
}
|
||||
|
||||
public boolean isForceLogout() {
|
||||
return forceLogout;
|
||||
}
|
||||
|
||||
public void setForceLogout(boolean forceLogout) {
|
||||
this.forceLogout = forceLogout;
|
||||
}
|
||||
|
||||
public String getDateCreated() {
|
||||
return dateCreated;
|
||||
}
|
||||
|
||||
public void setDateCreated(String dateCreated) {
|
||||
this.dateCreated = dateCreated;
|
||||
}
|
||||
|
||||
public String getDateModified() {
|
||||
return dateModified;
|
||||
}
|
||||
|
||||
public void setDateModified(String dateModified) {
|
||||
this.dateModified = dateModified;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,168 @@
|
|||
package de.overview.wg.its.mispauth.network;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.util.Log;
|
||||
import com.android.volley.Request;
|
||||
import com.android.volley.RequestQueue;
|
||||
import com.android.volley.Response;
|
||||
import com.android.volley.VolleyError;
|
||||
import com.android.volley.toolbox.JsonObjectRequest;
|
||||
import com.android.volley.toolbox.Volley;
|
||||
import de.overview.wg.its.mispauth.auxiliary.PreferenceManager;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Simple JSON based API to communicate with MISP-Instances
|
||||
*/
|
||||
public class MispRequest {
|
||||
|
||||
private static final String TAG = "MISP-TAG";
|
||||
private static MispRequest instance;
|
||||
|
||||
private RequestQueue requestQueue;
|
||||
private PreferenceManager preferenceManager;
|
||||
|
||||
private String serverUrl, apiKey;
|
||||
|
||||
/**
|
||||
* @param context for Volley and PreferenceManager
|
||||
*/
|
||||
private MispRequest(Context context) {
|
||||
requestQueue = Volley.newRequestQueue(context);
|
||||
preferenceManager = PreferenceManager.Instance(context);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param orgId organisation ID on the MISP-Instance
|
||||
* @param callback returns a single Organisation-JSON
|
||||
*/
|
||||
public void OrganisationInformation(int orgId, final OrganisationInformationCallback callback) {
|
||||
|
||||
Response.Listener<JSONObject> listener = new Response.Listener<JSONObject>() {
|
||||
@Override
|
||||
public void onResponse(JSONObject response) {
|
||||
try {
|
||||
callback.onResult(response.getJSONObject("Organisation"));
|
||||
return;
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
callback.onResult(response);
|
||||
}
|
||||
};
|
||||
|
||||
Response.ErrorListener errorListener = new Response.ErrorListener() {
|
||||
@Override
|
||||
public void onErrorResponse(VolleyError error) {
|
||||
callback.onError(error);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Request r = objectRequest(Request.Method.GET,
|
||||
serverUrl + "/organisations/view/"+orgId,
|
||||
null,
|
||||
listener,
|
||||
errorListener);
|
||||
|
||||
requestQueue.add(r);
|
||||
}
|
||||
|
||||
/**
|
||||
* Typically used to get the organisation linked with this user
|
||||
* @param callback return user associated with this API-Key
|
||||
*/
|
||||
public void myUserInformation(final UserInformationCallback callback) {
|
||||
|
||||
Response.Listener<JSONObject> listener = new Response.Listener<JSONObject>() {
|
||||
@Override
|
||||
public void onResponse(JSONObject response) {
|
||||
|
||||
try {
|
||||
callback.onResult(response.getJSONObject("User"));
|
||||
return;
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
callback.onResult(response);
|
||||
}
|
||||
};
|
||||
|
||||
Response.ErrorListener errorListener = new Response.ErrorListener() {
|
||||
@Override
|
||||
public void onErrorResponse(VolleyError error) {
|
||||
Log.e(TAG, "onErrorResponse: " + error.toString());
|
||||
callback.onError(error);
|
||||
}
|
||||
};
|
||||
|
||||
if(serverUrl.isEmpty() || apiKey.isEmpty()) {
|
||||
Log.e(TAG, "myUserInformation: server or api key is empty!");
|
||||
return;
|
||||
}
|
||||
|
||||
Request r = objectRequest(
|
||||
Request.Method.GET,
|
||||
serverUrl + "/users/view/me",
|
||||
null,
|
||||
listener,
|
||||
errorListener);
|
||||
|
||||
requestQueue.add(r);
|
||||
}
|
||||
|
||||
|
||||
private JsonObjectRequest objectRequest(int method,
|
||||
String url,
|
||||
@Nullable JSONObject body,
|
||||
Response.Listener<JSONObject> listener,
|
||||
Response.ErrorListener errorListener){
|
||||
|
||||
return new JsonObjectRequest(method, url, body, listener, errorListener) {
|
||||
|
||||
@Override
|
||||
public Map<String, String> getHeaders() {
|
||||
Map<String, String> params = new HashMap<>();
|
||||
|
||||
params.put("Authorization", apiKey);
|
||||
params.put("Accept", "application/json");
|
||||
params.put("Content-Type", "application/json; utf-8");
|
||||
|
||||
return params;
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
public void setServerCredentials(String serverUrl, String apiKey) {
|
||||
this.serverUrl = serverUrl;
|
||||
this.apiKey = apiKey;
|
||||
}
|
||||
|
||||
|
||||
public static MispRequest Instance(Context context) {
|
||||
if(instance == null) {
|
||||
instance = new MispRequest(context);
|
||||
}
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
|
||||
public interface OrganisationInformationCallback {
|
||||
void onResult(JSONObject organisationInformation);
|
||||
void onError(VolleyError volleyError);
|
||||
}
|
||||
public interface UserInformationCallback {
|
||||
void onResult(JSONObject myOrganisationInformation);
|
||||
void onError(VolleyError volleyError);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:aapt="http://schemas.android.com/aapt"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportHeight="108"
|
||||
android:viewportWidth="108">
|
||||
<path
|
||||
android:fillType="evenOdd"
|
||||
android:pathData="M32,64C32,64 38.39,52.99 44.13,50.95C51.37,48.37 70.14,49.57 70.14,49.57L108.26,87.69L108,109.01L75.97,107.97L32,64Z"
|
||||
android:strokeColor="#00000000"
|
||||
android:strokeWidth="1">
|
||||
<aapt:attr name="android:fillColor">
|
||||
<gradient
|
||||
android:endX="78.5885"
|
||||
android:endY="90.9159"
|
||||
android:startX="48.7653"
|
||||
android:startY="61.0927"
|
||||
android:type="linear">
|
||||
<item
|
||||
android:color="#44000000"
|
||||
android:offset="0.0" />
|
||||
<item
|
||||
android:color="#00000000"
|
||||
android:offset="1.0" />
|
||||
</gradient>
|
||||
</aapt:attr>
|
||||
</path>
|
||||
<path
|
||||
android:fillColor="#FFFFFF"
|
||||
android:fillType="nonZero"
|
||||
android:pathData="M66.94,46.02L66.94,46.02C72.44,50.07 76,56.61 76,64L32,64C32,56.61 35.56,50.11 40.98,46.06L36.18,41.19C35.45,40.45 35.45,39.3 36.18,38.56C36.91,37.81 38.05,37.81 38.78,38.56L44.25,44.05C47.18,42.57 50.48,41.71 54,41.71C57.48,41.71 60.78,42.57 63.68,44.05L69.11,38.56C69.84,37.81 70.98,37.81 71.71,38.56C72.44,39.3 72.44,40.45 71.71,41.19L66.94,46.02ZM62.94,56.92C64.08,56.92 65,56.01 65,54.88C65,53.76 64.08,52.85 62.94,52.85C61.8,52.85 60.88,53.76 60.88,54.88C60.88,56.01 61.8,56.92 62.94,56.92ZM45.06,56.92C46.2,56.92 47.13,56.01 47.13,54.88C47.13,53.76 46.2,52.85 45.06,52.85C43.92,52.85 43,53.76 43,54.88C43,56.01 43.92,56.92 45.06,56.92Z"
|
||||
android:strokeColor="#00000000"
|
||||
android:strokeWidth="1" />
|
||||
</vector>
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<solid
|
||||
android:color="#FFFFFF" />
|
||||
|
||||
<corners
|
||||
android:topLeftRadius="6dp"
|
||||
android:topRightRadius="6dp" />
|
||||
|
||||
</shape>
|
|
@ -0,0 +1,5 @@
|
|||
<vector android:height="24dp" android:tint="#FFFFFF"
|
||||
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#FF000000" android:pathData="M19,13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/>
|
||||
</vector>
|
|
@ -0,0 +1,5 @@
|
|||
<vector android:height="24dp" android:tint="#FFFFFF"
|
||||
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#FF000000" android:pathData="M20,11H7.83l5.59,-5.59L12,4l-8,8 8,8 1.41,-1.41L7.83,13H20v-2z"/>
|
||||
</vector>
|
|
@ -0,0 +1,5 @@
|
|||
<vector android:height="24dp" android:tint="#FFFFFF"
|
||||
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#FF000000" android:pathData="M9,16.17L4.83,12l-1.42,1.41L9,19 21,7l-1.41,-1.41z"/>
|
||||
</vector>
|
|
@ -0,0 +1,5 @@
|
|||
<vector android:height="24dp" android:tint="#FFFFFF"
|
||||
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#FF000000" android:pathData="M19.35,10.04C18.67,6.59 15.64,4 12,4 9.11,4 6.6,5.64 5.35,8.04 2.34,8.36 0,10.91 0,14c0,3.31 2.69,6 6,6h13c2.76,0 5,-2.24 5,-5 0,-2.64 -2.05,-4.78 -4.65,-4.96zM17,13l-5,5 -5,-5h3V9h4v4h3z"/>
|
||||
</vector>
|
|
@ -0,0 +1,5 @@
|
|||
<vector android:height="24dp" android:tint="#FFFFFF"
|
||||
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#FF000000" android:pathData="M3,17.25V21h3.75L17.81,9.94l-3.75,-3.75L3,17.25zM20.71,7.04c0.39,-0.39 0.39,-1.02 0,-1.41l-2.34,-2.34c-0.39,-0.39 -1.02,-0.39 -1.41,0l-1.83,1.83 3.75,3.75 1.83,-1.83z"/>
|
||||
</vector>
|
|
@ -0,0 +1,5 @@
|
|||
<vector android:height="24dp" android:tint="#FFFFFF"
|
||||
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#FF000000" android:pathData="M14.4,6L14,4H5v17h2v-7h5.6l0.4,2h7V6z"/>
|
||||
</vector>
|
|
@ -0,0 +1,5 @@
|
|||
<vector android:height="24dp" android:tint="#FFFFFF"
|
||||
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#FF000000" android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM13,17h-2v-6h2v6zM13,9h-2L11,7h2v2z"/>
|
||||
</vector>
|
|
@ -0,0 +1,170 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportHeight="108"
|
||||
android:viewportWidth="108">
|
||||
<path
|
||||
android:fillColor="#26A69A"
|
||||
android:pathData="M0,0h108v108h-108z" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M9,0L9,108"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,0L19,108"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M29,0L29,108"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M39,0L39,108"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M49,0L49,108"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M59,0L59,108"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M69,0L69,108"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M79,0L79,108"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M89,0L89,108"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M99,0L99,108"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,9L108,9"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,19L108,19"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,29L108,29"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,39L108,39"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,49L108,49"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,59L108,59"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,69L108,69"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,79L108,79"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,89L108,89"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,99L108,99"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,29L89,29"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,39L89,39"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,49L89,49"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,59L89,59"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,69L89,69"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,79L89,79"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M29,19L29,89"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M39,19L39,89"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M49,19L49,89"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M59,19L59,89"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M69,19L69,89"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M79,19L79,89"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
</vector>
|
|
@ -0,0 +1,5 @@
|
|||
<vector android:height="24dp" android:tint="#FFFFFF"
|
||||
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#FF000000" android:pathData="M19,3h-1L18,1h-2v2L8,3L8,1L6,1v2L5,3c-1.11,0 -2,0.9 -2,2v14c0,1.1 0.89,2 2,2h14c1.1,0 2,-0.9 2,-2L21,5c0,-1.1 -0.9,-2 -2,-2zM12,6c1.66,0 3,1.34 3,3s-1.34,3 -3,3 -3,-1.34 -3,-3 1.34,-3 3,-3zM18,18L6,18v-1c0,-2 4,-3.1 6,-3.1s6,1.1 6,3.1v1z"/>
|
||||
</vector>
|
|
@ -0,0 +1,5 @@
|
|||
<vector android:height="256dp" android:tint="#FFFFFF"
|
||||
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
||||
android:width="256dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#FF000000" android:pathData="M3,5v4h2L5,5h4L9,3L5,3c-1.1,0 -2,0.9 -2,2zM5,15L3,15v4c0,1.1 0.9,2 2,2h4v-2L5,19v-4zM19,19h-4v2h4c1.1,0 2,-0.9 2,-2v-4h-2v4zM19,3h-4v2h4v4h2L21,5c0,-1.1 -0.9,-2 -2,-2z"/>
|
||||
</vector>
|
|
@ -0,0 +1,5 @@
|
|||
<vector android:height="24dp" android:tint="#FFFFFF"
|
||||
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#FF000000" android:pathData="M4,10v7h3v-7L4,10zM10,10v7h3v-7h-3zM2,22h19v-3L2,19v3zM16,10v7h3v-7h-3zM11.5,1L2,6v2h19L21,6l-9.5,-5z"/>
|
||||
</vector>
|
|
@ -0,0 +1,5 @@
|
|||
<vector android:height="24dp" android:tint="#FFFFFF"
|
||||
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#FF000000" android:pathData="M19.43,12.98c0.04,-0.32 0.07,-0.64 0.07,-0.98s-0.03,-0.66 -0.07,-0.98l2.11,-1.65c0.19,-0.15 0.24,-0.42 0.12,-0.64l-2,-3.46c-0.12,-0.22 -0.39,-0.3 -0.61,-0.22l-2.49,1c-0.52,-0.4 -1.08,-0.73 -1.69,-0.98l-0.38,-2.65C14.46,2.18 14.25,2 14,2h-4c-0.25,0 -0.46,0.18 -0.49,0.42l-0.38,2.65c-0.61,0.25 -1.17,0.59 -1.69,0.98l-2.49,-1c-0.23,-0.09 -0.49,0 -0.61,0.22l-2,3.46c-0.13,0.22 -0.07,0.49 0.12,0.64l2.11,1.65c-0.04,0.32 -0.07,0.65 -0.07,0.98s0.03,0.66 0.07,0.98l-2.11,1.65c-0.19,0.15 -0.24,0.42 -0.12,0.64l2,3.46c0.12,0.22 0.39,0.3 0.61,0.22l2.49,-1c0.52,0.4 1.08,0.73 1.69,0.98l0.38,2.65c0.03,0.24 0.24,0.42 0.49,0.42h4c0.25,0 0.46,-0.18 0.49,-0.42l0.38,-2.65c0.61,-0.25 1.17,-0.59 1.69,-0.98l2.49,1c0.23,0.09 0.49,0 0.61,-0.22l2,-3.46c0.12,-0.22 0.07,-0.49 -0.12,-0.64l-2.11,-1.65zM12,15.5c-1.93,0 -3.5,-1.57 -3.5,-3.5s1.57,-3.5 3.5,-3.5 3.5,1.57 3.5,3.5 -1.57,3.5 -3.5,3.5z"/>
|
||||
</vector>
|
|
@ -0,0 +1,5 @@
|
|||
<vector android:height="24dp" android:tint="#FFFFFF"
|
||||
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#FF000000" android:pathData="M12,4L12,1L8,5l4,4L12,6c3.31,0 6,2.69 6,6 0,1.01 -0.25,1.97 -0.7,2.8l1.46,1.46C19.54,15.03 20,13.57 20,12c0,-4.42 -3.58,-8 -8,-8zM12,18c-3.31,0 -6,-2.69 -6,-6 0,-1.01 0.25,-1.97 0.7,-2.8L5.24,7.74C4.46,8.97 4,10.43 4,12c0,4.42 3.58,8 8,8v3l4,-4 -4,-4v3z"/>
|
||||
</vector>
|
After Width: | Height: | Size: 3.5 MiB |
After Width: | Height: | Size: 3.5 MiB |
After Width: | Height: | Size: 322 KiB |
After Width: | Height: | Size: 64 KiB |
After Width: | Height: | Size: 3.5 MiB |
|
@ -0,0 +1,92 @@
|
|||
<android.support.design.widget.CoordinatorLayout
|
||||
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
||||
tools:context=".activity.SettingsActivity"
|
||||
android:background="@color/colorPrimary">
|
||||
|
||||
<android.support.design.widget.AppBarLayout
|
||||
android:id="@+id/settings.appbar"
|
||||
app:elevation="0dp"
|
||||
android:background="@color/colorPrimaryDark"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:theme="@style/AppTheme.AppBarOverlay">
|
||||
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:backgroundTint="@color/colorPrimary"
|
||||
android:background="@drawable/background_rounded_main"
|
||||
app:popupTheme="@style/AppTheme.PopupOverlay"/>
|
||||
|
||||
</android.support.design.widget.AppBarLayout>
|
||||
|
||||
<android.support.constraint.ConstraintLayout
|
||||
android:id="@+id/constraintLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/background_rounded_main"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/empty_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="@string/empty_ext_org_dataset"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
|
||||
<android.support.v4.widget.SwipeRefreshLayout
|
||||
android:id="@+id/recycler_refresh"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/orgRecyclerView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"/>
|
||||
|
||||
</android.support.v4.widget.SwipeRefreshLayout>
|
||||
|
||||
|
||||
</android.support.constraint.ConstraintLayout>
|
||||
|
||||
<android.support.design.widget.FloatingActionButton
|
||||
android:id="@+id/fab_add"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/fab_margin"
|
||||
app:fabSize="normal"
|
||||
app:layout_anchor="@+id/constraintLayout"
|
||||
app:layout_anchorGravity="right|bottom"
|
||||
app:srcCompat="@drawable/ic_add_white"/>
|
||||
|
||||
<android.support.design.widget.FloatingActionButton
|
||||
android:id="@+id/fab_sync"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="100dp"
|
||||
android:visibility="gone"
|
||||
app:fabSize="mini"
|
||||
app:layout_anchor="@+id/fab_add"
|
||||
app:layout_anchorGravity="top|center_horizontal"
|
||||
app:srcCompat="@drawable/ic_sync_white"/>
|
||||
|
||||
</android.support.design.widget.CoordinatorLayout>
|
|
@ -0,0 +1,112 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.design.widget.CoordinatorLayout
|
||||
|
||||
android:id="@+id/coordinator"
|
||||
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
||||
tools:context=".activity.SettingsActivity"
|
||||
android:background="@color/colorPrimary"
|
||||
android:focusableInTouchMode="true">
|
||||
|
||||
<android.support.design.widget.AppBarLayout
|
||||
android:id="@+id/settings.appbar"
|
||||
app:elevation="0dp"
|
||||
android:background="@color/colorPrimaryDark"
|
||||
android:theme="@style/AppTheme.AppBarOverlay"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:backgroundTint="@color/colorPrimary"
|
||||
android:background="@drawable/background_rounded_main"
|
||||
app:popupTheme="@style/AppTheme.PopupOverlay" />
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:background="@color/colorPrimary"
|
||||
android:id="@+id/input_layout_server_url"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/edit_server_url"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:hint="@string/settings_server_url"
|
||||
android:inputType="textUri"/>
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:background="@color/colorPrimary"
|
||||
android:id="@+id/input_layout_api_key"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:paddingBottom="42dp"
|
||||
app:passwordToggleEnabled="true"
|
||||
app:passwordToggleTint="#FFF"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/edit_api_key"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:hint="@string/settings_api_key"
|
||||
android:inputType="textPassword"/>
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
</android.support.design.widget.AppBarLayout>
|
||||
|
||||
<android.support.constraint.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/background_rounded_main"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progressBar"
|
||||
style="?android:attr/progressBarStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<include layout="@layout/view_holder_organisation"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_width="0dp" android:layout_height="0dp" android:id="@+id/include"/>
|
||||
|
||||
</android.support.constraint.ConstraintLayout>
|
||||
|
||||
<android.support.design.widget.FloatingActionButton
|
||||
android:id="@+id/fab_download_own_org_info"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/fab_margin"
|
||||
app:fabSize="normal"
|
||||
app:layout_anchor="@id/settings.appbar"
|
||||
app:layout_anchorGravity="bottom|right|end"
|
||||
app:srcCompat="@drawable/ic_cloud_download_white"/>
|
||||
|
||||
</android.support.design.widget.CoordinatorLayout>
|
|
@ -0,0 +1,270 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.design.widget.CoordinatorLayout
|
||||
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
||||
tools:context=".activity.SyncActivity"
|
||||
android:background="@color/colorPrimary">
|
||||
|
||||
<android.support.design.widget.AppBarLayout
|
||||
android:id="@+id/sync.appbar"
|
||||
app:elevation="0dp"
|
||||
android:background="@color/colorPrimaryDark"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:theme="@style/AppTheme.AppBarOverlay">
|
||||
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:backgroundTint="@color/colorPrimary"
|
||||
android:background="@drawable/background_rounded_main"
|
||||
app:popupTheme="@style/AppTheme.PopupOverlay" />
|
||||
|
||||
<LinearLayout
|
||||
android:background="@color/colorPrimary"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="Scan"
|
||||
android:textAlignment="center" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="Share"
|
||||
android:textAlignment="center" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="Upload"
|
||||
android:textAlignment="center" />
|
||||
</LinearLayout>
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progressBar"
|
||||
style="@style/Widget.AppCompat.ProgressBar.Horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/colorPrimary"
|
||||
android:indeterminate="false"
|
||||
android:max="100"
|
||||
android:progress="100"
|
||||
android:paddingBottom="8dp"
|
||||
android:paddingEnd="60dp"
|
||||
android:paddingStart="60dp"
|
||||
android:paddingTop="8dp"
|
||||
android:progressTint="@color/colorAccent"
|
||||
android:visibility="visible" />
|
||||
</android.support.design.widget.AppBarLayout>
|
||||
|
||||
<android.support.constraint.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/background_rounded_main"
|
||||
android:padding="0dp"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
||||
|
||||
<!--<LinearLayout-->
|
||||
<!--android:layout_width="match_parent"-->
|
||||
<!--android:layout_height="match_parent"-->
|
||||
<!--android:orientation="vertical">-->
|
||||
|
||||
<!--<FrameLayout-->
|
||||
<!--android:layout_width="match_parent"-->
|
||||
<!--android:layout_height="match_parent">-->
|
||||
|
||||
<!--<ImageView-->
|
||||
<!--android:layout_width="match_parent"-->
|
||||
<!--android:layout_height="match_parent"-->
|
||||
<!--android:adjustViewBounds="true"-->
|
||||
<!--android:cropToPadding="true"-->
|
||||
<!--android:scaleType="centerCrop"-->
|
||||
<!--android:src="@drawable/test_image_low_res" />-->
|
||||
|
||||
<!--<ImageView-->
|
||||
<!--android:layout_width="match_parent"-->
|
||||
<!--android:layout_height="match_parent"-->
|
||||
<!--android:src="@drawable/ic_qr_aim"-->
|
||||
<!--android:tint="@color/colorPrimary" />-->
|
||||
|
||||
<!--</FrameLayout>-->
|
||||
|
||||
<!--<ImageView-->
|
||||
<!--android:id="@+id/sync_my_qr"-->
|
||||
<!--android:layout_width="match_parent"-->
|
||||
<!--android:layout_height="match_parent"-->
|
||||
<!--android:adjustViewBounds="false"-->
|
||||
<!--android:cropToPadding="false"-->
|
||||
<!--android:scaleType="center"/>-->
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
android:layout_margin="16dp"
|
||||
android:id="@+id/cardView_0"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
app:contentPadding="8dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:text="Test connection to server"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:src="@drawable/ic_check"
|
||||
android:tint="@color/colorPrimary" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</android.support.v7.widget.CardView>
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
android:id="@+id/cardView_1"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="16dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="32dp"
|
||||
app:contentPadding="8dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/cardView_0">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:text="Add organisation"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:src="@drawable/ic_check"
|
||||
android:tint="@color/colorPrimary" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</android.support.v7.widget.CardView>
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
android:layout_margin="16dp"
|
||||
android:id="@+id/cardView_2"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="24dp"
|
||||
app:contentPadding="8dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/cardView_1">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:text="Add user to organisation"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:src="@drawable/ic_check"
|
||||
android:tint="@color/colorPrimary" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</android.support.v7.widget.CardView>
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
android:layout_margin="16dp"
|
||||
android:id="@+id/cardView_3"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="24dp"
|
||||
app:contentPadding="8dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/cardView_2">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:text="Add sync server"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:src="@drawable/ic_check"
|
||||
android:tint="@color/colorPrimary" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</android.support.v7.widget.CardView>
|
||||
|
||||
<Button
|
||||
android:id="@+id/button3"
|
||||
style="@style/CustomButton"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/background_rounded_main"
|
||||
android:backgroundTint="@color/colorPrimary"
|
||||
android:text="finish"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<!--</LinearLayout>-->
|
||||
</android.support.constraint.ConstraintLayout>
|
||||
|
||||
</android.support.design.widget.CoordinatorLayout>
|
|
@ -0,0 +1,29 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/parent_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="16dp"
|
||||
android:clickable="true"
|
||||
android:focusable="true">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/ext_org_title"
|
||||
android:layout_marginEnd="40dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentTop="true"
|
||||
android:text="Title"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/ext_org_sub_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/ext_org_title"
|
||||
android:text="Short description describing the description ..."
|
||||
android:textSize="15sp"/>
|
||||
|
||||
</RelativeLayout>
|
|
@ -0,0 +1,84 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.v7.widget.LinearLayoutCompat
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:padding="16dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/organisation_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="left"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold"
|
||||
android:text="Title"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/organisation_uuid"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="left"
|
||||
android:textStyle="italic"
|
||||
android:text="uuid"/>
|
||||
|
||||
<GridLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:rowCount="5"
|
||||
android:columnCount="2">
|
||||
|
||||
<TextView
|
||||
android:paddingTop="32dp"
|
||||
android:text="Description"
|
||||
android:textStyle="bold"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dip"
|
||||
android:layout_gravity="fill_horizontal"
|
||||
android:paddingLeft="16dp"
|
||||
android:id="@+id/organisation_description"
|
||||
android:text="Description"/>
|
||||
|
||||
<TextView
|
||||
android:paddingTop="16dp"
|
||||
android:text="Nationality"
|
||||
android:textStyle="bold"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dip"
|
||||
android:layout_gravity="fill_horizontal"
|
||||
android:paddingLeft="16dp"
|
||||
android:id="@+id/organisation_nationality"
|
||||
android:text="Germany"/>
|
||||
|
||||
<TextView
|
||||
android:paddingTop="16dp"
|
||||
android:text="Sector"
|
||||
android:textStyle="bold"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dip"
|
||||
android:layout_gravity="fill_horizontal"
|
||||
android:paddingLeft="16dp"
|
||||
android:id="@+id/organisation_sector"
|
||||
android:text="Software"/>
|
||||
|
||||
<TextView
|
||||
android:paddingTop="16dp"
|
||||
android:text="Users"
|
||||
android:textStyle="bold"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dip"
|
||||
android:layout_gravity="fill_horizontal"
|
||||
android:paddingLeft="16dp"
|
||||
android:id="@+id/organisation_user_count"
|
||||
android:text="0"/>
|
||||
|
||||
</GridLayout>
|
||||
|
||||
</android.support.v7.widget.LinearLayoutCompat>
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_item_settings"
|
||||
android:title="Settings"
|
||||
android:icon="@drawable/ic_settings_white"
|
||||
app:showAsAction="always">
|
||||
</item>
|
||||
|
||||
</menu>
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item
|
||||
android:title="Delete Local Data"
|
||||
android:id="@+id/menu_item_deleteData">
|
||||
|
||||
</item>
|
||||
|
||||
</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="@drawable/ic_launcher_background" />
|
||||
<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="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
After Width: | Height: | Size: 3.0 KiB |
After Width: | Height: | Size: 4.9 KiB |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 4.5 KiB |
After Width: | Height: | Size: 6.9 KiB |
After Width: | Height: | Size: 6.3 KiB |
After Width: | Height: | Size: 10 KiB |
After Width: | Height: | Size: 9.0 KiB |
After Width: | Height: | Size: 15 KiB |
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="colorPrimary">#424242</color>
|
||||
<color name="colorPrimaryDark">#212121</color>
|
||||
<color name="colorAccent">#42a5f5</color>
|
||||
<color name="color_text_foreground">#ffffff</color>
|
||||
</resources>
|
|
@ -0,0 +1,3 @@
|
|||
<resources>
|
||||
<dimen name="fab_margin">16dp</dimen>
|
||||
</resources>
|
|
@ -0,0 +1,14 @@
|
|||
<resources>
|
||||
<string name="app_name">MISPauth</string>
|
||||
|
||||
<string name="empty_ext_org_dataset">No External Organisations available</string>
|
||||
<string name="empty_local_org_dataset">No Local Information Available</string>
|
||||
|
||||
// Settings
|
||||
|
||||
<string name="settings_server_url">Server URL</string>
|
||||
<string name="settings_api_key">API Key</string>
|
||||
<string name="title_activity_settings">Settings</string>
|
||||
<string name="title_activity_sync">Synchronise</string>
|
||||
|
||||
</resources>
|
|
@ -0,0 +1,28 @@
|
|||
<resources>
|
||||
|
||||
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
|
||||
<item name="colorPrimary">@color/colorPrimary</item>
|
||||
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||
<item name="colorAccent">@color/colorAccent</item>
|
||||
</style>
|
||||
|
||||
<style name="TextLabel" parent="TextAppearance.AppCompat">
|
||||
|
||||
<item name="android:textColorHint">@color/color_text_foreground</item>
|
||||
<item name="android:textSize">20sp</item>
|
||||
<item name="android:textColorPrimary">@color/color_text_foreground</item>
|
||||
|
||||
<item name="android:background">@color/colorPrimary</item>
|
||||
<item name="colorAccent">@color/colorAccent</item>
|
||||
<item name="colorControlNormal">@color/color_text_foreground</item>
|
||||
<item name="colorControlActivated">@color/colorAccent</item>
|
||||
</style>
|
||||
|
||||
<style name="CustomButton" parent="Widget.AppCompat.Button">
|
||||
<item name="android:background">@color/colorPrimary</item>
|
||||
<item name="android:textColor">@color/color_text_foreground</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
|
||||
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
|
||||
</resources>
|
|
@ -0,0 +1,17 @@
|
|||
package de.overview.wg.its.mispauth;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
public class ExampleUnitTest {
|
||||
@Test
|
||||
public void addition_isCorrect() throws Exception {
|
||||
assertEquals(4, 2 + 2);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
|
||||
buildscript {
|
||||
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.1.2'
|
||||
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
maven { url "https://jitpack.io" }
|
||||
}
|
||||
}
|
||||
|
||||
task clean(type: Delete) {
|
||||
delete rootProject.buildDir
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
# Project-wide Gradle settings.
|
||||
# IDE (e.g. Android Studio) users:
|
||||
# Gradle settings configured through the IDE *will override*
|
||||
# any settings specified in this file.
|
||||
# For more details on how to configure your build environment visit
|
||||
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
||||
# Specifies the JVM arguments used for the daemon process.
|
||||
# The setting is particularly useful for tweaking memory settings.
|
||||
org.gradle.jvmargs=-Xmx1536m
|
||||
# When configured, Gradle will run in incubating parallel mode.
|
||||
# This option should only be used with decoupled projects. More details, visit
|
||||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||
# org.gradle.parallel=true
|
|
@ -0,0 +1,6 @@
|
|||
#Thu Jun 07 17:33:27 CEST 2018
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
|
|
@ -0,0 +1,160 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
##############################################################################
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS=""
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn ( ) {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die ( ) {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
esac
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >/dev/null
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD="java"
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin, switch paths to Windows format before running java
|
||||
if $cygwin ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=$((i+1))
|
||||
done
|
||||
case $i in
|
||||
(0) set -- ;;
|
||||
(1) set -- "$args0" ;;
|
||||
(2) set -- "$args0" "$args1" ;;
|
||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
|
||||
function splitJvmOpts() {
|
||||
JVM_OPTS=("$@")
|
||||
}
|
||||
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
|
||||
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
|
||||
|
||||
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
|
|
@ -0,0 +1,90 @@
|
|||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS=
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windowz variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
if "%@eval[2+2]" == "4" goto 4NT_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
set CMD_LINE_ARGS=
|
||||
set _SKIP=2
|
||||
|
||||
:win9xME_args_slurp
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
goto execute
|
||||
|
||||
:4NT_args
|
||||
@rem Get arguments from the 4NT Shell from JP Software
|
||||
set CMD_LINE_ARGS=%$
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
|
@ -0,0 +1 @@
|
|||
include ':app'
|