Merge branch '1-patch-master' into 'master'

Resolve "Connect with MISP"

Closes #1

See merge request its-wg/overview/overview-ubo/misp-auth!1
pull/5/head
Felix Prahl-Kamps 2018-04-22 02:01:21 +02:00
commit 3b343e3cd9
28 changed files with 1049 additions and 136 deletions

View File

@ -23,7 +23,7 @@
<PersistentState>
<option name="values">
<map>
<entry key="url" value="jar:file:/opt/android-studio/plugins/android/lib/android.jar!/images/material_design_icons/action/ic_settings_black_24dp.xml" />
<entry key="url" value="jar:file:/opt/android-studio/plugins/android/lib/android.jar!/images/material_design_icons/image/ic_center_focus_weak_black_24dp.xml" />
</map>
</option>
</PersistentState>
@ -33,7 +33,6 @@
</option>
<option name="values">
<map>
<entry key="outputName" value="ic_settings" />
<entry key="theme" value="HOLO_DARK" />
</map>
</option>

View File

@ -3,7 +3,7 @@
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
<module fileurl="file://$PROJECT_DIR$/misp-auth.iml" filepath="$PROJECT_DIR$/misp-auth.iml" />
<module fileurl="file://$PROJECT_DIR$/mispAuth-v2.iml" filepath="$PROJECT_DIR$/mispAuth-v2.iml" />
</modules>
</component>
</project>

View File

@ -3,7 +3,7 @@ apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "de.korrelator.overview.mispauth"
applicationId "de.korrelator.overview.mispauthv2"
minSdkVersion 21
targetSdkVersion 27
versionCode 1
@ -20,14 +20,13 @@ android {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.google.android.gms:play-services-vision:12.0.1'
implementation 'com.github.kenglxn.QRGen:android:2.4.0'
implementation 'com.android.support:support-v4:27.1.0'
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation 'com.android.volley:volley:1.1.0'
implementation 'com.github.kenglxn.QRGen:android:2.4.0'
}

View File

@ -0,0 +1,26 @@
package de.korrelator.overview.mispauthv2;
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() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("de.korrelator.overview.mispauthv2", appContext.getPackageName());
}
}

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="de.korrelator.overview.mispauth">
package="de.korrelator.overview.mispauthv2">
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
@ -11,10 +11,6 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<meta-data
android:name="com.google.android.gms.vision.DEPENDENCIES"
android:value="barcode" />
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@ -22,19 +18,7 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".ReadQrActivity"
android:parentActivityName=".MainActivity"
android:theme="@style/AppTheme.NoActionBar" />
<activity
android:name=".GenerateQrActivity"
android:parentActivityName=".MainActivity" />
<activity
android:name=".SettingsActivity"
android:parentActivityName=".MainActivity"/>
<activity android:name=".SyncActivity"></activity>
</application>
</manifest>

View File

@ -0,0 +1,209 @@
package de.korrelator.overview.mispauthv2;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import com.android.volley.VolleyError;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import de.korrelator.overview.mispauthv2.models.Organisation;
import de.korrelator.overview.mispauthv2.models.OrganisationBuilder;
import de.korrelator.overview.mispauthv2.models.Server;
import de.korrelator.overview.mispauthv2.models.ServerBuilder;
import de.korrelator.overview.mispauthv2.models.User;
import de.korrelator.overview.mispauthv2.models.UserBuilder;
import de.korrelator.overview.mispauthv2.network.MispRequests;
public class MainActivity extends AppCompatActivity {
private static final String TAG = "MISPAUTH";
private static final int SYNC_EVENTS_REQUEST = 1000;
private MispRequests mispRequests;
private String myOrgName = "My Orgname";
private String myEmail = "example@email.bar";
private String baseURL = "http://192.168.178.200";
private TextView textViewResponse;
private int tmpOrgID, tmpSyncUserID;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mispRequests = new MispRequests(getApplicationContext(), baseURL);
textViewResponse = findViewById(R.id.textview_json_result);
Button syncEventsButton = findViewById(R.id.button_sync_events);
syncEventsButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
SyncEvents();
}
});
Button shareEventsButton = findViewById(R.id.button_share_events);
shareEventsButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ShareEvents();
}
});
Button receiveEventsButton = findViewById(R.id.button_receive_events);
receiveEventsButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ReceiveEvents();
}
});
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
switch (requestCode){
case SYNC_EVENTS_REQUEST:
String qrContent = data.getStringExtra("qr_data");
try {
JSONArray qrData = new JSONArray(qrContent);
JSONObject serverInfo = Server.fromJSON(qrData.getJSONObject(0)).toJSON();
JSONObject userInfo = User.fromJSON(qrData.getJSONObject(1)).toJSON();
JSONObject orgInfo = Organisation.fromJSON(qrData.getJSONObject(2)).toJSON();
mispRequests.EditOrganisation(tmpOrgID, orgInfo, new MispRequests.EditOrganisationResponse() {
@Override
public void result(boolean success) {
}
@Override
public void error(VolleyError volleyError) {
}
});
mispRequests.EditUser(tmpSyncUserID, userInfo, new MispRequests.EditUserResponse() {
@Override
public void result(JSONObject msg) {
}
@Override
public void error(VolleyError volleyError) {
}
});
mispRequests.AddServer(serverInfo, new MispRequests.AddServerResponse() {
@Override
public void result(JSONObject result) {
}
@Override
public void error(VolleyError volleyError) {
}
});
} catch (JSONException e){
e.printStackTrace();
}
break;
default:
Log.e(TAG, "requestCode " + requestCode + " is not known!");
}
}
private void SyncEvents(){
JSONObject tmpOrgBody = new OrganisationBuilder().local(true).build().toJSON();
mispRequests.AddOrganisation(tmpOrgBody, new MispRequests.AddOrganisationResponse() {
@Override
public void result(int orgID) {
tmpOrgID = orgID;
JSONObject tmpSyncUser = new UserBuilder().orgID(orgID).roleType(User.RoleType.SYNC_USER).build().toJSON();
mispRequests.AddUser(tmpSyncUser, new MispRequests.AddUserResponse() {
@Override
public void result(int id, String authKey) {
tmpSyncUserID = id;
JSONArray array = new JSONArray();
JSONObject myServerInformation = new ServerBuilder()
.url(baseURL)
.name(myOrgName)
.authKey(authKey)
.build().toJSON();
JSONObject myUserInformation = new UserBuilder()
.email("felixpk@outlug.de")
.build()
.toJSON();
JSONObject myOrganisationInformation = new OrganisationBuilder()
.name(myOrgName)
.local(true)
.description("sample description")
.nationality("DE")
.sector("Programming")
.build()
.toJSON();
array.put(myServerInformation);
array.put(myUserInformation);
array.put(myOrganisationInformation);
Intent syncIntent = new Intent(getApplicationContext(), SyncActivity.class);
syncIntent.putExtra("qr_data", array.toString());
startActivityForResult(syncIntent, SYNC_EVENTS_REQUEST);
}
@Override
public void error(VolleyError volleyError) {
textViewResponse.setText(volleyError.toString());
}
});
}
@Override
public void error(VolleyError error) {
}
});
}
private void ShareEvents(){
}
private void ReceiveEvents(){
}
}

View File

@ -0,0 +1,51 @@
package de.korrelator.overview.mispauthv2;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Point;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Display;
import android.widget.ImageView;
import net.glxn.qrgen.android.QRCode;
public class SyncActivity extends AppCompatActivity {
private Point displaySize;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sync);
Display display = getWindowManager().getDefaultDisplay();
displaySize = new Point();
display.getSize(displaySize);
Intent intent = getIntent();
String qrData = intent.getStringExtra("qr_data");
PopulateMyQR(qrData);
}
private void PopulateMyQR(String qrData){
ImageView qrView = findViewById(R.id.image_view_sync_qr);
Bitmap bitmap =
QRCode.from(qrData)
.withSize(displaySize.x, displaySize.x)
.withColor(0xFF000000, 0x00000000)
.bitmap();
qrView.setImageBitmap(bitmap);
}
private void returnQrData(String qrData){
Intent resultIntent = new Intent();
resultIntent.putExtra("qr_data", qrData);
setResult(Activity.RESULT_OK, resultIntent);
finish();
}
}

View File

@ -0,0 +1,34 @@
package de.korrelator.overview.mispauthv2.camera;
import android.Manifest;
import android.content.Context;
import android.hardware.camera2.CameraCharacteristics;
import android.hardware.camera2.CameraManager;
import android.support.v4.app.ActivityCompat;
import android.view.TextureView;
public class QRScanner {
private static final int CAM_REQUEST_CODE = 1;
private Context context;
private TextureView textureView;
private CameraManager cameraManager;
private int cameraFacing;
public QRScanner(Context context, TextureView textureView){
this.context = context.getApplicationContext();
this.textureView = textureView;
Initialize();
}
private void Initialize(){
// ActivityCompat.requestPermissions(, new String[]{Manifest.permission.CAMERA}, CAM_REQUEST_CODE);
// cameraManager = (CameraManager) getSystemService(Context.CAMERA_SERVICE);
// cameraFacing = CameraCharacteristics.LENS_FACING_BACK;
}
}

View File

@ -0,0 +1,94 @@
package de.korrelator.overview.mispauthv2.models;
import android.net.Uri;
import org.json.JSONException;
import org.json.JSONObject;
public class Organisation {
private String name;
private String description;
private String nationality;
private String sector;
private String uuid;
private boolean local;
public Organisation(String name, boolean local, String description, String nationality, String sector, String uuid){
this.name = name;
this.description = description;
this.nationality = nationality;
this.sector = sector;
this.uuid = uuid;
this.local = local;
}
public String getName() {
return name;
}
public String getDescription() {
return description;
}
public String getSector() {
return sector;
}
public String getUuid() {
return uuid;
}
public boolean isLocal() {
return local;
}
public JSONObject toJSON(){
JSONObject organisation = new JSONObject();
try {
organisation.put("local", local);
if(!name.equals("")){
organisation.put("name", Uri.decode(name));
}
if(!description.equals("")){
organisation.put("description", Uri.decode(description));
}
if(!nationality.equals("")){
organisation.put("nationality", Uri.decode(nationality));
}
if(!sector.equals("")){
organisation.put("sector", Uri.decode(sector));
}
if(!uuid.equals("")){
organisation.put("uuid", Uri.decode(uuid));
}
} catch (JSONException e) {
e.printStackTrace();
}
return organisation;
}
public static Organisation fromJSON(JSONObject json){
return new OrganisationBuilder()
.name(json.optString("name", ""))
.local(json.optBoolean("local", true))
.description(json.optString("description", ""))
.nationality(json.optString("nationality", ""))
.sector(json.optString("sector", ""))
.uuid(json.optString("uuid", ""))
.build();
}
}

View File

@ -0,0 +1,47 @@
package de.korrelator.overview.mispauthv2.models;
public class OrganisationBuilder {
private String name = "Default Org";
private boolean local = true;
private String description = "";
private String nationality = "";
private String sector = "";
private String uuid = "";
public OrganisationBuilder() {}
public Organisation build(){
return new Organisation(name, local, description, nationality, sector, uuid);
}
public OrganisationBuilder name(String name){
this.name = name;
return this;
}
public OrganisationBuilder local(boolean local){
this.local = local;
return this;
}
public OrganisationBuilder description(String description){
this.description = description;
return this;
}
public OrganisationBuilder nationality(String nationality){
this.nationality = nationality;
return this;
}
public OrganisationBuilder sector(String sector){
this.sector = sector;
return this;
}
public OrganisationBuilder uuid(String uuid){
this.uuid = uuid;
return this;
}
}

View File

@ -0,0 +1,77 @@
package de.korrelator.overview.mispauthv2.models;
import android.support.annotation.NonNull;
import org.json.JSONException;
import org.json.JSONObject;
public class Server {
private String url;
private String name;
private String organisationType;
private String authKey;
public Server(String url, String name, String organisationType, String authKey) {
this.url = url;
this.name = name;
this.organisationType = organisationType;
this.authKey = authKey;
}
public String getUrl() {
return url;
}
public String getName() {
return name;
}
public String getOrganisationType() {
return organisationType;
}
public String getAuthKey() {
return authKey;
}
public JSONObject toJSON(){
JSONObject server = new JSONObject();
try {
if(!url.equals("")){
server.put("url", url);
}
if(!name.equals("")){
server.put("name", name);
}
if(!organisationType.equals("")){
server.put("organisation_type", organisationType);
}
if(!authKey.equals("")){
server.put("authkey", authKey);
}
} catch (JSONException e) {
e.printStackTrace();
}
return server;
}
public static Server fromJSON(JSONObject json){
return new Server(
json.optString("url", ""),
json.optString("name", ""),
json.optString("organisation_type", ""),
json.optString("authkey", ""));
}
}

View File

@ -0,0 +1,35 @@
package de.korrelator.overview.mispauthv2.models;
public class ServerBuilder {
private String url = "";
private String name = "";
private String organisationType = "";
private String authKey = "";
public ServerBuilder() {}
public Server build(){
return new Server(url, name, organisationType, authKey);
}
public ServerBuilder url(String url){
this.url = url;
return this;
}
public ServerBuilder name(String name){
this.name = name;
return this;
}
public ServerBuilder organisationType(String organisationType){
this.organisationType = organisationType;
return this;
}
public ServerBuilder authKey(String authKey){
this.authKey = authKey;
return this;
}
}

View File

@ -0,0 +1,80 @@
package de.korrelator.overview.mispauthv2.models;
import org.json.JSONException;
import org.json.JSONObject;
public class User {
private String email;
private int orgID;
private int roleType;
private String authKey;
public User(String email, int orgID, int roleType, String authKey) {
this.email = email;
this.orgID = orgID;
this.roleType = roleType;
this.authKey = authKey;
}
public String getEmail() {
return email;
}
public int getOrgID() {
return orgID;
}
public int getRoleType() {
return roleType;
}
public String getAuthKey() {
return authKey;
}
public JSONObject toJSON(){
JSONObject user = new JSONObject();
try {
if(!email.equals("")){
user.put("email", email);
}
if(orgID > -1){
user.put("org_id", orgID);
}
if(roleType > -1){
user.put("role_id", roleType);
}
if(!authKey.equals("")){
user.put("authkey", authKey);
}
} catch (JSONException e) {
e.printStackTrace();
}
return user;
}
public static User fromJSON(JSONObject json){
return new User(
json.optString("name", ""),
json.optInt("org_id", -1),
json.optInt("role_id", -1),
json.optString("authkey", ""));
}
public interface RoleType{
int ADMIN = 0;
int SYNC_USER = 5;
}
}

View File

@ -0,0 +1,35 @@
package de.korrelator.overview.mispauthv2.models;
public class UserBuilder {
private String email = "default@email.bar";
private int orgID = -1;
private int roleType = -1;
private String authKey = "";
public UserBuilder(){}
public User build(){
return new User(email, orgID, roleType, authKey);
}
public UserBuilder email(String email){
this.email = email;
return this;
}
public UserBuilder orgID(int orgID){
this.orgID = orgID;
return this;
}
public UserBuilder roleType(int roleType){
this.roleType = roleType;
return this;
}
public UserBuilder authKey(String authKey){
this.authKey = authKey;
return this;
}
}

View File

@ -0,0 +1,269 @@
package de.korrelator.overview.mispauthv2.network;
import android.content.Context;
import android.support.annotation.Nullable;
import com.android.volley.AuthFailureError;
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.JsonArrayRequest;
import com.android.volley.toolbox.JsonObjectRequest;
import com.android.volley.toolbox.Volley;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import de.korrelator.overview.mispauthv2.R;
public class MispRequests {
private Context context;
private RequestQueue queue;
private String baseURL;
public MispRequests(Context context, String baseURL){
this.context = context.getApplicationContext();
this.baseURL = baseURL;
queue = Volley.newRequestQueue(this.context);
}
public void GetSyncUsers(final GetSyncUsersResponse resp){
String currentURL = baseURL + "/admin/users";
Response.Listener<JSONArray> responseListener = new Response.Listener<JSONArray>() {
@Override
public void onResponse(JSONArray response) {
int userCount = response.length();
List<Integer> userIDList = new ArrayList<>();
for(int i = 0; i < userCount; i++){
try{
JSONObject root = response.getJSONObject(i);
JSONObject role = root.getJSONObject("Role");
JSONObject user = root.getJSONObject("User");
if(role.getInt("id") == 5){
userIDList.add(user.getInt("id"));
}
} catch (JSONException e){
e.printStackTrace();
}
}
resp.result(userIDList.toArray(new Integer[userIDList.size()]));
}
};
Response.ErrorListener errorListener = new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
resp.error(error);
}
};
queue.add(arrayRequest(Request.Method.GET, currentURL, null, responseListener, errorListener));
}
public void AddUser(JSONObject body, final AddUserResponse resp){
String currentURL = baseURL + "/admin/users/add";
Response.Listener<JSONObject> responseListener = new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
try {
JSONObject user = response.getJSONObject("User");
resp.result(user.getInt("id"), user.getString("authkey"));
} catch (JSONException e){
e.printStackTrace();
}
}
};
Response.ErrorListener errorListener = new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
resp.error(error);
}
};
queue.add(objectRequest(Request.Method.POST, currentURL, body, responseListener, errorListener));
}
public void EditUser(int userID, JSONObject body, final EditUserResponse resp){
String currentURL = baseURL + "/admin/users/edit/" + userID;
Response.Listener<JSONObject> responseListener = new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
resp.result(response);
}
};
Response.ErrorListener errorListener = new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
resp.error(error);
}
};
queue.add(objectRequest(Request.Method.POST, currentURL, body, responseListener, errorListener));
}
public void AddOrganisation(JSONObject body, final AddOrganisationResponse response){
String currentURL = baseURL + "/admin/organisations/add";
Response.Listener<JSONObject> responseListener = new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject resp) {
try {
JSONObject org = resp.getJSONObject("Organisation");
response.result(org.getInt("id"));
} catch (JSONException e){
e.printStackTrace();
}
}
};
Response.ErrorListener errorListener = new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
response.error(error);
}
};
queue.add(objectRequest(Request.Method.POST, currentURL, body, responseListener, errorListener));
}
public void EditOrganisation(int orgID, JSONObject updateBody, final EditOrganisationResponse resp){
String currentURL = baseURL + "/admin/organisations/edit/" + orgID;
Response.Listener<JSONObject> responseListener = new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
resp.result(true);
}
};
Response.ErrorListener errorListener = new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
resp.error(error);
}
};
queue.add(objectRequest(Request.Method.POST, currentURL, updateBody, responseListener, errorListener));
}
public void AddServer(JSONObject body, final AddServerResponse resp){
String currentURL = baseURL + "/servers/add";
Response.Listener<JSONObject> responseListener = new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
resp.result(response);
}
};
Response.ErrorListener errorListener = new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
resp.error(error);
}
};
queue.add(objectRequest(Request.Method.POST, currentURL, body, responseListener, errorListener));
}
private JsonObjectRequest objectRequest(int method, String url, @Nullable JSONObject body, Response.Listener listener, Response.ErrorListener errorListener){
return new JsonObjectRequest(
method,
url,
body,
listener,
errorListener) {
@Override
public Map<String, String> getHeaders() throws AuthFailureError {
Map<String, String> params = new HashMap<>();
params.put("Authorization", context.getString(R.string.api_key));
params.put("Accept", "application/json");
params.put("Content-Type", "application/json; utf-8");
return params;
}
};
}
private JsonArrayRequest arrayRequest(int method, String url, @Nullable JSONArray body, Response.Listener listener, Response.ErrorListener errorListener){
return new JsonArrayRequest(
method,
url,
body,
listener,
errorListener){
@Override
public Map<String, String> getHeaders() throws AuthFailureError {
Map<String, String> params = new HashMap<>();
params.put("Authorization", context.getString(R.string.api_key));
params.put("Accept", "application/json");
params.put("Content-Type", "application/json; utf-8");
return params;
}
};
}
public interface GetSyncUsersResponse{
void result(Integer[] userIDs);
void error(VolleyError volleyError);
}
public interface AddOrganisationResponse{
void result(int orgID);
void error(VolleyError error);
}
public interface EditOrganisationResponse{
void result(boolean success);
void error(VolleyError volleyError);
}
public interface AddUserResponse {
void result(int id, String authKey);
void error(VolleyError volleyError);
}
public interface EditUserResponse{
void result(JSONObject msg);
void error(VolleyError volleyError);
}
public interface AddServerResponse{
void result(JSONObject result);
void error(VolleyError volleyError);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 362 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 262 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 437 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 736 B

View File

@ -1,35 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
<LinearLayout
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"
android:orientation="vertical"
tools:context=".MainActivity">
<Button
android:id="@+id/button_scan"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Scan"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
android:id="@+id/button_sync_events"
android:layout_width="match_parent"
android:layout_height="56dp"
android:text="@string/sync_events"/>
<Button
android:id="@+id/button_generate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Generate"
app:layout_constraintBottom_toBottomOf="@id/button_scan"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
android:id="@+id/button_share_events"
android:layout_width="match_parent"
android:layout_height="56dp"
android:text="@string/share_events"/>
<Button
android:id="@+id/button_receive_events"
android:layout_width="match_parent"
android:layout_height="56dp"
android:text="@string/receive_events"/>
<TextView
android:id="@+id/text_view_qr_result"
android:id="@+id/textview_json_result"
android:layout_width="match_parent"
android:layout_height="48dp" />
android:layout_height="match_parent" />
</android.support.constraint.ConstraintLayout>
</LinearLayout>

View File

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".SyncActivity">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.5">
<TextureView
android:id="@+id/texture_view_sync_qr"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/ic_action_name"/>
</FrameLayout>
<ImageView
android:id="@+id/image_view_sync_qr"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.5" />
</LinearLayout>

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="api_key">HWnFznJAccL7CkxnrsE5pcRzkiUmGobwTF2ExR8i</string>
</resources>

View File

@ -1,76 +1,9 @@
<resources>
<string name="app_name">MispAuth</string>
<string name="title_activity_settings">Settings</string>
<!-- Strings related to Settings -->
//main
<string name="sync_events">Synchronise Events</string>
<string name="share_events">Share Events</string>
<string name="receive_events">Receive Events</string>
<!-- Example General settings -->
<string name="pref_header_general">General</string>
<string name="pref_title_social_recommendations">Enable social recommendations</string>
<string name="pref_description_social_recommendations">Recommendations for people to contact
based on your message history
</string>
<string name="pref_title_display_name">Display name</string>
<string name="pref_default_display_name">John Smith</string>
<string name="pref_title_add_friends_to_messages">Add friends to messages</string>
<string-array name="pref_example_list_titles">
<item>Always</item>
<item>When possible</item>
<item>Never</item>
</string-array>
<string-array name="pref_example_list_values">
<item>1</item>
<item>0</item>
<item>-1</item>
</string-array>
<!-- Example settings for Data & Sync -->
<string name="pref_header_data_sync">Data &amp; sync</string>
<string name="pref_title_sync_frequency">Sync frequency</string>
<string-array name="pref_sync_frequency_titles">
<item>15 minutes</item>
<item>30 minutes</item>
<item>1 hour</item>
<item>3 hours</item>
<item>6 hours</item>
<item>Never</item>
</string-array>
<string-array name="pref_sync_frequency_values">
<item>15</item>
<item>30</item>
<item>60</item>
<item>180</item>
<item>360</item>
<item>-1</item>
</string-array>
<string-array name="list_preference_entries">
<item>Entry 1</item>
<item>Entry 2</item>
<item>Entry 3</item>
</string-array>
<string-array name="list_preference_entry_values">
<item>1</item>
<item>2</item>
<item>3</item>
</string-array>
<string-array name="multi_select_list_preference_default_value" />
<string name="pref_title_system_sync_settings">System sync settings</string>
<!-- Example settings for Notifications -->
<string name="pref_header_notifications">Notifications</string>
<string name="pref_title_new_message_notifications">New message notifications</string>
<string name="pref_title_ringtone">Ringtone</string>
<string name="pref_ringtone_silent">Silent</string>
<string name="pref_title_vibrate">Vibrate</string>
</resources>

View File

@ -2,14 +2,10 @@
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="AppTheme.NoActionBar" parent="Theme.AppCompat.Light.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
</resources>

View File

@ -0,0 +1,17 @@
package de.korrelator.overview.mispauthv2;
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() {
assertEquals(4, 2 + 2);
}
}

View File

@ -20,13 +20,7 @@ allprojects {
google()
jcenter()
maven {
url "https://maven.google.com"
}
maven {
url "https://jitpack.io"
}
maven { url "https://jitpack.io" }
}
}

View File

@ -10,4 +10,4 @@ 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
# org.gradle.parallel=true

View File

@ -1,4 +1,4 @@
#Sat Mar 31 19:37:39 CEST 2018
#Fri Apr 20 12:42:32 CEST 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME