From 9ab170c05b8b6f0bb17087d30b68ade2da533cec Mon Sep 17 00:00:00 2001 From: Felix Prahl-Kamps Date: Mon, 14 Oct 2019 12:36:13 +0200 Subject: [PATCH] remove leftovers of expandablecardview improve readme add string/content description --- README.md | 13 +- .../res/layout/row_upload_information.xml | 3 +- app/src/main/res/values/strings.xml | 1 + expandablecardview/.gitignore | 1 - expandablecardview/build.gradle | 34 ---- expandablecardview/proguard-rules.pro | 21 --- .../ExampleInstrumentedTest.java | 29 --- .../src/main/AndroidManifest.xml | 1 - .../ExpandableCardView.java | 177 ------------------ .../src/main/res/drawable/ic_info_outline.xml | 9 - .../res/drawable/ic_keyboard_arrow_down.xml | 9 - .../layout/expandable_card_view_header.xml | 37 ---- .../src/main/res/values/attrs.xml | 17 -- .../src/main/res/values/strings.xml | 3 - .../expandablecardview/ExampleUnitTest.java | 19 -- 15 files changed, 9 insertions(+), 365 deletions(-) delete mode 100644 expandablecardview/.gitignore delete mode 100644 expandablecardview/build.gradle delete mode 100644 expandablecardview/proguard-rules.pro delete mode 100644 expandablecardview/src/androidTest/java/lu/circl/expandablecardview/ExampleInstrumentedTest.java delete mode 100644 expandablecardview/src/main/AndroidManifest.xml delete mode 100644 expandablecardview/src/main/java/lu/circl/expandablecardview/ExpandableCardView.java delete mode 100644 expandablecardview/src/main/res/drawable/ic_info_outline.xml delete mode 100644 expandablecardview/src/main/res/drawable/ic_keyboard_arrow_down.xml delete mode 100644 expandablecardview/src/main/res/layout/expandable_card_view_header.xml delete mode 100644 expandablecardview/src/main/res/values/attrs.xml delete mode 100644 expandablecardview/src/main/res/values/strings.xml delete mode 100644 expandablecardview/src/test/java/lu/circl/expandablecardview/ExampleUnitTest.java diff --git a/README.md b/README.md index 0a5ba26..812c168 100644 --- a/README.md +++ b/README.md @@ -4,13 +4,12 @@ Simple and secure synchronisation of MISP instances # What is MISPbump? With MISPbump admins can easily synchronize MISP instances by exchanging relevant information via encrypted QR codes. -Note: only **use case 1** from the [documentation](https://www.circl.lu/doc/misp/sharing/) is supported. +> Note that only **use case 1** from the [documentation](https://www.circl.lu/doc/misp/sharing/) is supported. # How does MISPbump work? -First of all: MISP admins login by providing the base URL of their instance and their authkey (automationkey). +MISP admins log in by providing the **base URL** of their instance and their **authkey**. -On a successfull login the admins profile and the linked organisation information will be downloaded automatically. -This information can be updated at any time in the profile screen. +After a successfull login the admin's profile and the linked organisation information will be downloaded. In the main screen you can start a synchronisation process by pressing the dedicated button. @@ -26,11 +25,11 @@ The synchronisation process consists of 3 steps: + Own User: Email + Own MISP instance: base URL + Generated: sync user authkey, sync user password - (your partner will create a sync user with these credentials) + (your partner will create a sync user with these credentials for you) The synchronisation information is encrypted with AES using the shared secret (from step 1). - The sync process information will be saved securely on the device, that means the upload can be started any time in the future. + The synchronisation process information will be saved securely on the device. 1. **Upload information to own MISP instance** @@ -41,7 +40,7 @@ The synchronisation process consists of 3 steps: 1. Create sync user & add to organisation 1. Create sync server & populate with information above -After that the two MISP instances are connected. +After that the two MISP instances are able to share Events based on their permissions. # Dependencies + [Retrofit](https://github.com/square/retrofit) diff --git a/app/src/main/res/layout/row_upload_information.xml b/app/src/main/res/layout/row_upload_information.xml index 260d482..4b95493 100644 --- a/app/src/main/res/layout/row_upload_information.xml +++ b/app/src/main/res/layout/row_upload_information.xml @@ -57,7 +57,8 @@ android:layout_margin="16dp" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintTop_toTopOf="parent" /> + app:layout_constraintTop_toTopOf="parent" + android:contentDescription="@string/content_description_sync_status_icon" /> Upload Changes Download Changes Delete Synchronisation + Shows if local changes are already uploaded to MISP instance diff --git a/expandablecardview/.gitignore b/expandablecardview/.gitignore deleted file mode 100644 index 796b96d..0000000 --- a/expandablecardview/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/build diff --git a/expandablecardview/build.gradle b/expandablecardview/build.gradle deleted file mode 100644 index 8f1186a..0000000 --- a/expandablecardview/build.gradle +++ /dev/null @@ -1,34 +0,0 @@ -apply plugin: 'com.android.library' - -android { - compileSdkVersion 29 - buildToolsVersion "29.0.1" - - - defaultConfig { - minSdkVersion 21 - targetSdkVersion 29 - versionCode 1 - versionName "1.0" - - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - - } - - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' - } - } - -} - -dependencies { - implementation fileTree(dir: 'libs', include: ['*.jar']) - - implementation 'androidx.appcompat:appcompat:1.0.2' - testImplementation 'junit:junit:4.12' - androidTestImplementation 'androidx.test:runner:1.2.0' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' -} diff --git a/expandablecardview/proguard-rules.pro b/expandablecardview/proguard-rules.pro deleted file mode 100644 index f1b4245..0000000 --- a/expandablecardview/proguard-rules.pro +++ /dev/null @@ -1,21 +0,0 @@ -# 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 diff --git a/expandablecardview/src/androidTest/java/lu/circl/expandablecardview/ExampleInstrumentedTest.java b/expandablecardview/src/androidTest/java/lu/circl/expandablecardview/ExampleInstrumentedTest.java deleted file mode 100644 index 5363ad2..0000000 --- a/expandablecardview/src/androidTest/java/lu/circl/expandablecardview/ExampleInstrumentedTest.java +++ /dev/null @@ -1,29 +0,0 @@ -package lu.circl.expandablecardview; - - -import android.content.Context; - -import androidx.test.InstrumentationRegistry; -import androidx.test.runner.AndroidJUnit4; - -import org.junit.Test; -import org.junit.runner.RunWith; - -import static org.junit.Assert.assertEquals; - - -/** - * Instrumented test, which will execute on an Android device. - * - * @see Testing documentation - */ -@RunWith(AndroidJUnit4.class) -public class ExampleInstrumentedTest { - @Test - public void useAppContext() { - // Context of the app under test. - Context appContext = InstrumentationRegistry.getTargetContext(); - - assertEquals("lu.circl.expandablecardview.test", appContext.getPackageName()); - } -} diff --git a/expandablecardview/src/main/AndroidManifest.xml b/expandablecardview/src/main/AndroidManifest.xml deleted file mode 100644 index 29832b5..0000000 --- a/expandablecardview/src/main/AndroidManifest.xml +++ /dev/null @@ -1 +0,0 @@ - diff --git a/expandablecardview/src/main/java/lu/circl/expandablecardview/ExpandableCardView.java b/expandablecardview/src/main/java/lu/circl/expandablecardview/ExpandableCardView.java deleted file mode 100644 index 6f4ed2f..0000000 --- a/expandablecardview/src/main/java/lu/circl/expandablecardview/ExpandableCardView.java +++ /dev/null @@ -1,177 +0,0 @@ -package lu.circl.expandablecardview; - -import android.content.Context; -import android.content.res.TypedArray; -import android.graphics.drawable.GradientDrawable; -import android.util.AttributeSet; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.view.animation.Animation; -import android.view.animation.Transformation; -import android.widget.FrameLayout; -import android.widget.ImageButton; -import android.widget.ImageView; -import android.widget.LinearLayout; -import android.widget.TextView; - - -public class ExpandableCardView extends LinearLayout { - - private Context context; - - private FrameLayout contentLayout; - private int cardContentPadding; - - private boolean isExpanded = true; - private int animationSpeed = 200; - - - public ExpandableCardView(Context context) { - this(context, null); - } - - public ExpandableCardView(Context context, AttributeSet attrs) { - this(context, attrs, 0); - } - - public ExpandableCardView(Context context, AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - this.context = context; - - setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); - setOrientation(VERTICAL); - setClipToOutline(true); - - TypedArray customAttributes = context.getTheme().obtainStyledAttributes(attrs, R.styleable.ExpandableCardView, defStyleAttr, 0); - - // general - int cornerRadius = customAttributes.getDimensionPixelSize(R.styleable.ExpandableCardView_card_corner_radius, 12); - - // header - String cardTitle = customAttributes.getString(R.styleable.ExpandableCardView_card_title); - int iconRes = customAttributes.getResourceId(R.styleable.ExpandableCardView_card_icon, 0x0); - int headerForegroundColor = customAttributes.getColor(R.styleable.ExpandableCardView_card_header_foreground_color, 0xFF000000); - int headerBackgroundColor = customAttributes.getColor(R.styleable.ExpandableCardView_card_header_background_color, 0xFFFFFFFF); - - // content - cardContentPadding = customAttributes.getDimensionPixelSize(R.styleable.ExpandableCardView_card_content_padding, 0); - int cardContentBackgroundColor = customAttributes.getColor(R.styleable.ExpandableCardView_card_content_background_color, 0xFFFFFFFF); - - customAttributes.recycle(); - - GradientDrawable cardBackground = new GradientDrawable(); - cardBackground.setCornerRadius(cornerRadius); - cardBackground.setColor(cardContentBackgroundColor); - - setBackground(cardBackground); - setElevation(10); - - initHeader(cardTitle, iconRes, headerBackgroundColor, headerForegroundColor); - } - - @Override - public void addView(View child, int index, ViewGroup.LayoutParams params) { - if (getChildCount() == 0) { - super.addView(child, index, params); // add header - } else { - if (contentLayout == null) { - contentLayout = new FrameLayout(context); - contentLayout.setLayoutParams(new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); - contentLayout.setPadding(cardContentPadding, cardContentPadding, cardContentPadding, cardContentPadding); - - super.addView(contentLayout, index, new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); - } - - contentLayout.addView(child); - } - } - - - private void initHeader(String title, int iconRes, int backgroundColor, int foregroundColor) { - View header = LayoutInflater.from(context).inflate(R.layout.expandable_card_view_header, this, true); - LinearLayout ll = header.findViewById(R.id.llRoot); - ll.setBackgroundColor(backgroundColor); - - TextView titleTextView = header.findViewById(R.id.expandable_card_view_header_title); - titleTextView.setText(title); - titleTextView.setTextColor(foregroundColor); - - ImageView iconView = header.findViewById(R.id.expandable_card_view_header_icon); - if (iconRes == 0x0) { - iconView.setVisibility(GONE); - } else { - iconView.setImageResource(iconRes); - iconView.setColorFilter(foregroundColor); - } - - final ImageButton expandToggle = header.findViewById(R.id.expandable_card_view_header_toggle); - expandToggle.setColorFilter(foregroundColor); - expandToggle.setOnClickListener(new OnClickListener() { - @Override - public void onClick(View view) { - if (isExpanded) { - collapse(contentLayout); - expandToggle.animate().rotation(0).setDuration(animationSpeed); - } else { - expand(contentLayout); - expandToggle.animate().rotation(180).setDuration(animationSpeed); - } - - isExpanded = !isExpanded; - } - }); - } - - private void expand(final View v) { - int matchParentMeasureSpec = View.MeasureSpec.makeMeasureSpec(((View) v.getParent()).getWidth(), View.MeasureSpec.EXACTLY); - int wrapContentMeasureSpec = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED); - v.measure(matchParentMeasureSpec, wrapContentMeasureSpec); - final int targetHeight = v.getMeasuredHeight(); - - v.getLayoutParams().height = 1; - v.setVisibility(View.VISIBLE); - Animation a = new Animation() { - @Override - protected void applyTransformation(float interpolatedTime, Transformation t) { - v.getLayoutParams().height = interpolatedTime == 1 - ? LayoutParams.WRAP_CONTENT - : (int) (targetHeight * interpolatedTime); - v.requestLayout(); - } - - @Override - public boolean willChangeBounds() { - return true; - } - }; - - a.setDuration(animationSpeed); - v.startAnimation(a); - } - - private void collapse(final View v) { - final int initialHeight = v.getMeasuredHeight(); - - Animation a = new Animation() { - @Override - protected void applyTransformation(float interpolatedTime, Transformation t) { - if (interpolatedTime == 1) { - v.setVisibility(View.GONE); - } else { - v.getLayoutParams().height = initialHeight - (int) (initialHeight * interpolatedTime); - v.requestLayout(); - } - } - - @Override - public boolean willChangeBounds() { - return true; - } - }; - - a.setDuration(animationSpeed); - v.startAnimation(a); - } - -} diff --git a/expandablecardview/src/main/res/drawable/ic_info_outline.xml b/expandablecardview/src/main/res/drawable/ic_info_outline.xml deleted file mode 100644 index cf53e14..0000000 --- a/expandablecardview/src/main/res/drawable/ic_info_outline.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - diff --git a/expandablecardview/src/main/res/drawable/ic_keyboard_arrow_down.xml b/expandablecardview/src/main/res/drawable/ic_keyboard_arrow_down.xml deleted file mode 100644 index ad33063..0000000 --- a/expandablecardview/src/main/res/drawable/ic_keyboard_arrow_down.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - diff --git a/expandablecardview/src/main/res/layout/expandable_card_view_header.xml b/expandablecardview/src/main/res/layout/expandable_card_view_header.xml deleted file mode 100644 index 53ce5da..0000000 --- a/expandablecardview/src/main/res/layout/expandable_card_view_header.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - diff --git a/expandablecardview/src/main/res/values/attrs.xml b/expandablecardview/src/main/res/values/attrs.xml deleted file mode 100644 index 78a2ccc..0000000 --- a/expandablecardview/src/main/res/values/attrs.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - // general - - - // header - - - - - - // content - - - - diff --git a/expandablecardview/src/main/res/values/strings.xml b/expandablecardview/src/main/res/values/strings.xml deleted file mode 100644 index f771913..0000000 --- a/expandablecardview/src/main/res/values/strings.xml +++ /dev/null @@ -1,3 +0,0 @@ - - ExpandableCardView - diff --git a/expandablecardview/src/test/java/lu/circl/expandablecardview/ExampleUnitTest.java b/expandablecardview/src/test/java/lu/circl/expandablecardview/ExampleUnitTest.java deleted file mode 100644 index d16f0c4..0000000 --- a/expandablecardview/src/test/java/lu/circl/expandablecardview/ExampleUnitTest.java +++ /dev/null @@ -1,19 +0,0 @@ -package lu.circl.expandablecardview; - - -import org.junit.Test; - -import static org.junit.Assert.assertEquals; - - -/** - * Example local unit test, which will execute on the development machine (host). - * - * @see Testing documentation - */ -public class ExampleUnitTest { - @Test - public void addition_isCorrect() { - assertEquals(4, 2 + 2); - } -}