add material preference switch to detail view

update gradle
add animations
remove expandable card view
pull/8/head
Felix Prahl-Kamps 2019-10-04 17:42:16 +02:00
parent 40e3cfb430
commit 21af9e1307
14 changed files with 550 additions and 365 deletions

View File

@ -57,5 +57,4 @@ dependencies {
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation project(path: ':expandablecardview')
}

View File

@ -111,7 +111,7 @@ public class HomeActivity extends AppCompatActivity {
private void initRecyclerView() {
recyclerView = findViewById(R.id.recyclerView);
recyclerView.setLayoutManager(new LinearLayoutManager(HomeActivity.this));
syncInfoAdapter = new SyncInfoAdapter();
syncInfoAdapter = new SyncInfoAdapter(HomeActivity.this);
syncInfoAdapter.setOnRecyclerPositionClickListener(onRecyclerItemClickListener());
recyclerView.setAdapter(syncInfoAdapter);
}

View File

@ -26,7 +26,7 @@ public class LauncherActivity extends AppCompatActivity {
startActivity(login);
}
// closes the activity to prevent going back to this (empty) activity
// close activity to prevent going back
finish();
}

View File

@ -189,10 +189,8 @@ public class LoginActivity extends AppCompatActivity {
};
/**
* TODO: Check if url is valid.
*
* @param url url to check
* @return true or false
* @return true if valid else false
*/
private boolean isValidUrl(String url) {
Uri uri = Uri.parse(url);
@ -205,12 +203,10 @@ public class LoginActivity extends AppCompatActivity {
}
/**
* TODO: Check if automation key is valid.
*
* @param automationKey the key to check
* @return true or false
* @return true if not empty else false
*/
private boolean isValidAutomationKey(String automationKey) {
return !automationKey.equals("");
return !automationKey.isEmpty();
}
}

View File

@ -1,19 +1,16 @@
package lu.circl.mispbump.activities;
import android.animation.Animator;
import android.animation.ValueAnimator;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.AnimatedVectorDrawable;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewGroupOverlay;
import android.widget.CheckBox;
import android.view.animation.DecelerateInterpolator;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
@ -25,6 +22,7 @@ import java.util.UUID;
import lu.circl.mispbump.R;
import lu.circl.mispbump.auxiliary.PreferenceManager;
import lu.circl.mispbump.customViews.MaterialPasswordView;
import lu.circl.mispbump.customViews.MaterialPreferenceSwitch;
import lu.circl.mispbump.customViews.MaterialPreferenceText;
import lu.circl.mispbump.models.SyncInformation;
@ -37,12 +35,13 @@ public class SyncInfoDetailActivity extends AppCompatActivity {
private SyncInformation syncInformation;
private boolean fabMenuExpanded;
private boolean dataLocallyChanged;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sync_info_detail);
setContentView(R.layout.activity_sync_info_detail_v2);
preferenceManager = PreferenceManager.getInstance(SyncInfoDetailActivity.this);
syncInformation = preferenceManager.getSyncInformation(getExtraUuid());
@ -59,6 +58,11 @@ public class SyncInfoDetailActivity extends AppCompatActivity {
@Override
protected void onPause() {
super.onPause();
if (dataLocallyChanged) {
syncInformation.setSyncedWithRemote(false);
}
preferenceManager.addSyncInformation(syncInformation);
}
@ -85,25 +89,121 @@ public class SyncInfoDetailActivity extends AppCompatActivity {
LinearLayout uploadLayout = findViewById(R.id.layout_upload);
LinearLayout downloadLayout = findViewById(R.id.layout_download);
TextView uploadText = findViewById(R.id.fab_upload_text);
TextView downloadText = findViewById(R.id.fab_download_text);
View menuBackground = findViewById(R.id.menu_background);
uploadLayout.setVisibility(View.GONE);
downloadLayout.setVisibility(View.GONE);
fab.setOnClickListener(view -> {
if (fabMenuExpanded) {
uploadLayout.setVisibility(View.GONE);
downloadLayout.setVisibility(View.GONE);
int animationSpeed = 200;
fabMenuExpanded = false;
} else {
ValueAnimator openAnimation = ValueAnimator.ofFloat(0f, 1f);
openAnimation.setDuration(animationSpeed);
openAnimation.setInterpolator(new DecelerateInterpolator());
openAnimation.addUpdateListener(updateAnimation -> {
float x = (float) updateAnimation.getAnimatedValue();
fabUpload.setAlpha(x);
fabUpload.setTranslationY((1 - x) * 50);
uploadText.setAlpha(x);
uploadText.setTranslationX((1 - x) * -200);
fabDownload.setAlpha(x);
fabDownload.setTranslationY((1 - x) * 50);
downloadText.setAlpha(x);
downloadText.setTranslationX((1 - x) * -200);
menuBackground.setAlpha(x * 0.9f);
});
openAnimation.addListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animator) {
uploadLayout.setVisibility(View.VISIBLE);
downloadLayout.setVisibility(View.VISIBLE);
}
@Override
public void onAnimationEnd(Animator animator) {
}
@Override
public void onAnimationCancel(Animator animator) {
}
@Override
public void onAnimationRepeat(Animator animator) {
fabMenuExpanded = true;
}
});
fabUpload.setOnClickListener(view -> {
ValueAnimator closeAnimation = ValueAnimator.ofFloat(1f, 0f);
closeAnimation.setDuration(animationSpeed);
closeAnimation.setInterpolator(new DecelerateInterpolator());
closeAnimation.addUpdateListener(updateAnimation -> {
float x = (float) updateAnimation.getAnimatedValue();
fabUpload.setAlpha(x);
fabUpload.setTranslationY((1 - x) * 50);
uploadText.setAlpha(x);
uploadText.setTranslationX((1 - x) * -200);
fabDownload.setAlpha(x);
fabDownload.setTranslationY((1 - x) * 50);
downloadText.setAlpha(x);
downloadText.setTranslationX((1 - x) * -200);
menuBackground.setAlpha(x * 0.9f);
});
closeAnimation.addListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animator) {
uploadLayout.setVisibility(View.VISIBLE);
downloadLayout.setVisibility(View.VISIBLE);
}
@Override
public void onAnimationEnd(Animator animator) {
uploadLayout.setVisibility(View.GONE);
downloadLayout.setVisibility(View.GONE);
}
@Override
public void onAnimationCancel(Animator animator) {
}
@Override
public void onAnimationRepeat(Animator animator) {
}
});
AnimatedVectorDrawable open = (AnimatedVectorDrawable) getDrawable(R.drawable.animated_arrow_cloud_down);
AnimatedVectorDrawable close = (AnimatedVectorDrawable) getDrawable(R.drawable.animated_arrow_down_cloud);
View.OnClickListener expandCollapseClick = view -> {
if (fabMenuExpanded) {
menuBackground.setClickable(false);
fab.setImageDrawable(close);
close.start();
closeAnimation.start();
fabMenuExpanded = false;
} else {
menuBackground.setClickable(true);
fab.setImageDrawable(open);
open.start();
openAnimation.start();
fabMenuExpanded = true;
}
};
menuBackground.setOnClickListener(expandCollapseClick);
menuBackground.setClickable(false);
fab.setOnClickListener(expandCollapseClick);
fabUpload.setOnClickListener(view -> {
preferenceManager.addSyncInformation(syncInformation);
Intent upload = new Intent(SyncInfoDetailActivity.this, UploadActivity.class);
@ -134,24 +234,61 @@ public class SyncInfoDetailActivity extends AppCompatActivity {
// settings
CheckBox allowSelfSigned = findViewById(R.id.checkbox_self_signed);
MaterialPreferenceSwitch allowSelfSigned = findViewById(R.id.switch_allow_self_signed);
allowSelfSigned.setChecked(syncInformation.getRemote().getServer().getSelfSigned());
allowSelfSigned.setOnCheckedChangeListener((compoundButton, b) -> {
allowSelfSigned.setOnCheckedChangeListener((cb, b) -> {
syncInformation.getRemote().getServer().setSelfSigned(b);
dataLocallyChanged = true;
});
CheckBox push = findViewById(R.id.checkbox_push);
push.setChecked(syncInformation.getRemote().getServer().getPush());
push.setOnCheckedChangeListener((compoundButton, b) -> syncInformation.getRemote().getServer().setPush(b));
MaterialPreferenceSwitch allowPush = findViewById(R.id.switch_allow_push);
allowPush.setChecked(syncInformation.getRemote().getServer().getPush());
allowPush.setOnCheckedChangeListener((cb, b) -> {
syncInformation.getRemote().getServer().setPush(b);
dataLocallyChanged = true;
});
CheckBox pull = findViewById(R.id.checkbox_pull);
pull.setChecked(syncInformation.getRemote().getServer().getPull());
pull.setOnCheckedChangeListener((compundButton, b) -> syncInformation.getRemote().getServer().setPull(b));
MaterialPreferenceSwitch allowPull = findViewById(R.id.switch_allow_pull);
allowPull.setChecked(syncInformation.getRemote().getServer().getPull());
allowPull.setOnCheckedChangeListener((cb, b) -> {
syncInformation.getRemote().getServer().setPull(b);
dataLocallyChanged = true;
});
CheckBox cache = findViewById(R.id.checkbox_cache);
cache.setChecked(syncInformation.getRemote().getServer().getCachingEnabled());
cache.setOnCheckedChangeListener((compoundButton, b) -> syncInformation.getRemote().getServer().setCachingEnabled(b));
MaterialPreferenceSwitch allowCache = findViewById(R.id.switch_allow_cache);
allowCache.setChecked(syncInformation.getRemote().getServer().getCachingEnabled());
allowCache.setOnCheckedChangeListener((cb, b) -> {
syncInformation.getRemote().getServer().setCachingEnabled(b);
dataLocallyChanged = true;
});
// CheckBox allowSelfSigned = findViewById(R.id.checkbox_self_signed);
// allowSelfSigned.setChecked(syncInformation.getRemote().getServer().getSelfSigned());
// allowSelfSigned.setOnCheckedChangeListener((compoundButton, b) -> {
// syncInformation.getRemote().getServer().setSelfSigned(b);
// dataLocallyChanged = true;
// });
// CheckBox push = findViewById(R.id.checkbox_push);
// push.setChecked(syncInformation.getRemote().getServer().getPush());
// push.setOnCheckedChangeListener((compoundButton, b) -> {
// syncInformation.getRemote().getServer().setPush(b);
// dataLocallyChanged = true;
// });
//
// CheckBox pull = findViewById(R.id.checkbox_pull);
// pull.setChecked(syncInformation.getRemote().getServer().getPull());
// pull.setOnCheckedChangeListener((compundButton, b) -> {
// syncInformation.getRemote().getServer().setPull(b);
// dataLocallyChanged = true;
// });
//
// CheckBox cache = findViewById(R.id.checkbox_cache);
// cache.setChecked(syncInformation.getRemote().getServer().getCachingEnabled());
// cache.setOnCheckedChangeListener((compoundButton, b) -> {
// syncInformation.getRemote().getServer().setCachingEnabled(b);
// dataLocallyChanged = true;
// });
// credentials
@ -164,27 +301,4 @@ public class SyncInfoDetailActivity extends AppCompatActivity {
MaterialPasswordView authkey = findViewById(R.id.authkey);
authkey.setPassword(syncInformation.getLocal().getSyncUser().getAuthkey());
}
public static void applyDim(@NonNull ViewGroup parent, float dimAmount) {
// ViewGroup root = (ViewGroup) getWindow().getDecorView().getRootView();
Drawable dim = new ColorDrawable(Color.BLACK);
dim.setBounds(0, 0, parent.getWidth(), parent.getHeight());
ValueAnimator valueAnimator = ValueAnimator.ofFloat(dimAmount);
valueAnimator.addUpdateListener(valueAnim -> {
float value = (float) valueAnim.getAnimatedValue();
dim.setAlpha((int) (255 * value));
ViewGroupOverlay overlay = parent.getOverlay();
overlay.add(dim);
});
valueAnimator.start();
}
public static void clearDim(@NonNull ViewGroup parent) {
ViewGroupOverlay overlay = parent.getOverlay();
overlay.clear();
}
}

View File

@ -1,6 +1,8 @@
package lu.circl.mispbump.adapters;
import android.content.Context;
import android.content.res.ColorStateList;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@ -8,6 +10,7 @@ import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.core.widget.ImageViewCompat;
import androidx.recyclerview.widget.RecyclerView;
import java.text.SimpleDateFormat;
@ -21,10 +24,16 @@ import lu.circl.mispbump.models.SyncInformation;
public class SyncInfoAdapter extends RecyclerView.Adapter<SyncInfoAdapter.ViewHolder> {
private Context context;
private List<SyncInformation> items;
private OnRecyclerItemClickListener<Integer> onRecyclerPositionClickListener;
public SyncInfoAdapter(Context context) {
this.context = context;
}
@NonNull
@Override
public SyncInfoAdapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
@ -44,6 +53,14 @@ public class SyncInfoAdapter extends RecyclerView.Adapter<SyncInfoAdapter.ViewHo
holder.orgName.setText(item.getRemote().getOrganisation().getName());
if (item.isSyncedWithRemote()) {
ImageViewCompat.setImageTintList(holder.syncStatus, ColorStateList.valueOf(context.getColor(R.color.status_green)));
holder.syncStatus.setImageResource(R.drawable.ic_check_outline);
} else {
ImageViewCompat.setImageTintList(holder.syncStatus, ColorStateList.valueOf(context.getColor(R.color.status_amber)));
holder.syncStatus.setImageResource(R.drawable.ic_error_outline);
}
// switch (item.getCurrentSyncStatus()) {
// case COMPLETE:
// ImageViewCompat.setImageTintList(holder.syncStatus, ColorStateList.valueOf(context.getColor(R.color.status_green)));

View File

@ -17,16 +17,15 @@ import lu.circl.mispbump.R;
public class MaterialPreferenceSwitch extends ConstraintLayout {
private View rootView;
private TextView titleView, subTitleView;
private Switch switchView;
private CompoundButton.OnCheckedChangeListener onCheckedChangeListener;
public MaterialPreferenceSwitch(Context context, AttributeSet attrs) {
super(context, attrs);
View view = LayoutInflater.from(context).inflate(R.layout.material_preference_switch, this);
rootView = view.findViewById(R.id.rootLayout);
View rootView = view.findViewById(R.id.rootLayout);
TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.MaterialPreferenceSwitch);
String title = a.getString(R.styleable.MaterialPreferenceSwitch_title);
@ -42,22 +41,29 @@ public class MaterialPreferenceSwitch extends ConstraintLayout {
switchView = view.findViewById(R.id.material_preference_switch);
rootView.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
rootView.setOnClickListener(v -> {
if (switchView.isEnabled()) {
switchView.setChecked(!switchView.isChecked());
}
}
});
switchView.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
switchView.setOnCheckedChangeListener((buttonView, isChecked) -> {
if (onCheckedChangeListener != null) {
onCheckedChangeListener.onCheckedChanged(buttonView, isChecked);
}
if (isChecked) {
if (!onText.isEmpty()) {
subTitleView.setText(onText);
} else {
subTitleView.setVisibility(GONE);
}
} else {
if (!offText.isEmpty()) {
subTitleView.setText(offText);
} else {
subTitleView.setVisibility(GONE);
}
}
});
@ -75,4 +81,8 @@ public class MaterialPreferenceSwitch extends ConstraintLayout {
return switchView.isChecked();
}
public void setOnCheckedChangeListener(CompoundButton.OnCheckedChangeListener onCheckedChangeListener) {
this.onCheckedChangeListener = onCheckedChangeListener;
}
}

View File

@ -21,6 +21,8 @@ public class SyncInformation {
private ExchangeInformation remote;
private ExchangeInformation local;
private boolean syncedWithRemote;
public SyncInformation() {
uuid = UUID.randomUUID();
@ -60,6 +62,12 @@ public class SyncInformation {
return df.format(date);
}
public void setSyncedWithRemote(boolean syncedWithRemote) {
this.syncedWithRemote = syncedWithRemote;
}
public boolean isSyncedWithRemote() {
return syncedWithRemote;
}
public ExchangeInformation getRemote() {
return remote;

View File

@ -1,289 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".activities.SyncInfoDetailActivity"
android:orientation="vertical">
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:theme="@style/ToolbarTheme"
app:popupTheme="@style/PopupTheme" />
</com.google.android.material.appbar.AppBarLayout>
<ScrollView
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<lu.circl.expandablecardview.ExpandableCardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
app:card_header_background_color="@color/colorPrimary"
app:card_header_foreground_color="@color/white"
app:card_icon="@drawable/ic_info_outline"
app:card_title="Information">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<lu.circl.mispbump.customViews.MaterialPreferenceText
android:id="@+id/name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:title="Name"
app:subtitle="No name" />
<lu.circl.mispbump.customViews.MaterialPreferenceText
android:id="@+id/uuid"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/name"
app:layout_constraintEnd_toEndOf="parent"
app:title="UUID"
app:subtitle="No UUID" />
<lu.circl.mispbump.customViews.MaterialPreferenceText
android:id="@+id/sector"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/uuid"
app:layout_constraintEnd_toEndOf="parent"
app:title="Sector"
app:subtitle="No sector" />
<lu.circl.mispbump.customViews.MaterialPreferenceText
android:id="@+id/description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/uuid"
app:layout_constraintEnd_toEndOf="parent"
app:title="@string/description"
app:subtitle="No description" />
</LinearLayout>
</lu.circl.expandablecardview.ExpandableCardView>
<lu.circl.expandablecardview.ExpandableCardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
app:card_header_background_color="@color/colorPrimary"
app:card_header_foreground_color="@color/white"
app:card_icon="@drawable/ic_settings"
app:card_title="@string/settings">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<CheckBox
android:id="@+id/checkbox_self_signed"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:text="@string/settings_self_signed_title"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<CheckBox
android:id="@+id/checkbox_push"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:text="@string/settings_push_title"
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/checkbox_self_signed" />
<CheckBox
android:id="@+id/checkbox_pull"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="32dp"
android:layout_marginTop="8dp"
android:text="@string/settings_pull_title"
app:layout_constraintStart_toEndOf="@+id/checkbox_push"
app:layout_constraintTop_toBottomOf="@id/checkbox_self_signed" />
<CheckBox
android:id="@+id/checkbox_cache"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:layout_marginBottom="16dp"
android:text="@string/settings_cache_title"
app:layout_constraintTop_toBottomOf="@id/checkbox_push"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toBottomOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</lu.circl.expandablecardview.ExpandableCardView>
<lu.circl.expandablecardview.ExpandableCardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
app:card_header_background_color="@color/colorPrimary"
app:card_header_foreground_color="@color/white"
app:card_icon="@drawable/ic_verified_user"
app:card_title="@string/credentials">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<lu.circl.mispbump.customViews.MaterialPreferenceText
android:id="@+id/email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:title="Email"
app:subtitle="Keine Ahnung" />
<lu.circl.mispbump.customViews.MaterialPasswordView
android:id="@+id/password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:title="Password"
app:password="Weiß ich leider auch nicht" />
<lu.circl.mispbump.customViews.MaterialPasswordView
android:id="@+id/authkey"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:title="Authkey"
app:password="Den erst recht nicht ..." />
</LinearLayout>
</lu.circl.expandablecardview.ExpandableCardView>
<View
android:layout_width="match_parent"
android:layout_height="86dp"/>
</LinearLayout>
</ScrollView>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_gravity="bottom|end"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false">
<!-- <FrameLayout-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="match_parent"-->
<!-- android:background="@color/black_50"/>-->
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fab_main"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_keyboard_arrow_down"
android:tint="@color/white"
android:layout_margin="16dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>
<LinearLayout
android:id="@+id/layout_upload"
android:visibility="visible"
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:layout_marginBottom="16dp"
android:padding="8dp"
android:clipToPadding="false"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toTopOf="@id/fab_main">
<TextView
android:text="Upload to MISP instance"
android:textColor="@color/white"
android:padding="8dp"
android:background="@drawable/tooltip_background"
android:backgroundTint="@color/black_70"
android:layout_gravity="center_vertical"
android:layout_marginEnd="16dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fab_upload"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_cloud_upload"
app:fabSize="mini"/>
</LinearLayout>
<LinearLayout
android:visibility="visible"
android:id="@+id/layout_download"
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:layout_marginBottom="16dp"
android:padding="8dp"
android:clipToPadding="false"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toTopOf="@id/layout_upload">
<TextView
android:text="Download changes from MISP instance"
android:textColor="@color/white"
android:padding="8dp"
android:background="@drawable/tooltip_background"
android:backgroundTint="@color/black_70"
android:layout_gravity="center_vertical"
android:layout_marginEnd="16dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fab_download"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_cloud_download"
app:fabSize="mini"/>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@ -0,0 +1,324 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".activities.SyncInfoDetailActivity"
android:orientation="vertical">
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:theme="@style/ToolbarTheme"
app:popupTheme="@style/PopupTheme" />
</com.google.android.material.appbar.AppBarLayout>
<ScrollView
android:id="@+id/scrollview"
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/scrollview_content"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="80dp"
android:alpha="1">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginStart="16dp"
android:textColor="@color/colorPrimary"
android:text="@string/information"
android:textAppearance="@style/TextAppearance.MaterialComponents.Overline" />
<lu.circl.mispbump.customViews.MaterialPreferenceText
android:id="@+id/name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:title="Name"
app:subtitle="No name" />
<lu.circl.mispbump.customViews.MaterialPreferenceText
android:id="@+id/uuid"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/name"
app:layout_constraintEnd_toEndOf="parent"
app:title="UUID"
app:subtitle="No UUID" />
<lu.circl.mispbump.customViews.MaterialPreferenceText
android:id="@+id/sector"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/uuid"
app:layout_constraintEnd_toEndOf="parent"
app:title="Sector"
app:subtitle="No sector" />
<lu.circl.mispbump.customViews.MaterialPreferenceText
android:id="@+id/description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/uuid"
app:layout_constraintEnd_toEndOf="parent"
app:title="@string/description"
app:subtitle="No description" />
<View
android:background="@color/dividerColor"
android:layout_width="match_parent"
android:layout_height="1dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginStart="16dp"
android:textColor="@color/colorPrimary"
android:text="@string/settings"
android:textAppearance="@style/TextAppearance.MaterialComponents.Overline" />
<lu.circl.mispbump.customViews.MaterialPreferenceSwitch
android:id="@+id/switch_allow_self_signed"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:title="@string/settings_self_signed_title"
app:offText="@string/settings_self_signed_off"
app:onText="@string/settings_self_signed_on" />
<lu.circl.mispbump.customViews.MaterialPreferenceSwitch
android:id="@+id/switch_allow_push"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:title="@string/settings_push_title"
app:offText="@string/settings_push_off"
app:onText="@string/settings_push_on" />
<lu.circl.mispbump.customViews.MaterialPreferenceSwitch
android:id="@+id/switch_allow_pull"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:title="@string/settings_pull_title"
app:offText="@string/settings_pull_off"
app:onText="@string/settings_pull_on" />
<lu.circl.mispbump.customViews.MaterialPreferenceSwitch
android:id="@+id/switch_allow_cache"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:title="@string/settings_cache_title"
app:offText="@string/settings_cache_off"
app:onText="@string/settings_cache_on" />
<!-- <androidx.constraintlayout.widget.ConstraintLayout-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="match_parent">-->
<!-- <CheckBox-->
<!-- android:id="@+id/checkbox_self_signed"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_marginStart="16dp"-->
<!-- android:layout_marginTop="16dp"-->
<!-- android:text="@string/settings_self_signed_title"-->
<!-- app:layout_constraintStart_toStartOf="parent"-->
<!-- app:layout_constraintTop_toTopOf="parent" />-->
<!-- <CheckBox-->
<!-- android:id="@+id/checkbox_push"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_marginStart="16dp"-->
<!-- android:layout_marginTop="8dp"-->
<!-- android:text="@string/settings_push_title"-->
<!-- app:layout_constraintHorizontal_chainStyle="packed"-->
<!-- app:layout_constraintStart_toStartOf="parent"-->
<!-- app:layout_constraintTop_toBottomOf="@id/checkbox_self_signed" />-->
<!-- <CheckBox-->
<!-- android:id="@+id/checkbox_pull"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_marginStart="32dp"-->
<!-- android:layout_marginTop="8dp"-->
<!-- android:text="@string/settings_pull_title"-->
<!-- app:layout_constraintStart_toEndOf="@+id/checkbox_push"-->
<!-- app:layout_constraintTop_toBottomOf="@id/checkbox_self_signed" />-->
<!-- <CheckBox-->
<!-- android:id="@+id/checkbox_cache"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_marginStart="16dp"-->
<!-- android:layout_marginTop="8dp"-->
<!-- android:layout_marginBottom="16dp"-->
<!-- android:text="@string/settings_cache_title"-->
<!-- app:layout_constraintTop_toBottomOf="@id/checkbox_push"-->
<!-- app:layout_constraintStart_toStartOf="parent"-->
<!-- app:layout_constraintBottom_toBottomOf="parent" />-->
<!-- </androidx.constraintlayout.widget.ConstraintLayout>-->
<View
android:background="@color/dividerColor"
android:layout_width="match_parent"
android:layout_height="1dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginStart="16dp"
android:textColor="@color/colorPrimary"
android:text="@string/credentials"
android:textAppearance="@style/TextAppearance.MaterialComponents.Overline" />
<lu.circl.mispbump.customViews.MaterialPreferenceText
android:id="@+id/email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:title="Email"
app:subtitle="Keine Ahnung" />
<lu.circl.mispbump.customViews.MaterialPasswordView
android:id="@+id/password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:title="@string/password"
app:password="Weiß ich leider auch nicht" />
<lu.circl.mispbump.customViews.MaterialPasswordView
android:id="@+id/authkey"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:title="@string/authkey"
app:password="Den erst recht nicht ..." />
</LinearLayout>
</ScrollView>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_gravity="bottom|end"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:id="@+id/menu_background"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:alpha="0"
android:background="@color/white"
android:clickable="false"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fab_main"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/animated_arrow_cloud_down"
android:tint="@color/white"
android:layout_margin="16dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent" />
<LinearLayout
android:id="@+id/layout_upload"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="12dp"
android:clipToPadding="false"
android:orientation="horizontal"
android:padding="24dp"
android:visibility="visible"
app:layout_constraintBottom_toTopOf="@id/fab_main"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
<View
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="match_parent" />
<TextView
android:id="@+id/fab_upload_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginEnd="16dp"
android:background="@drawable/tooltip_background"
android:backgroundTint="@color/black_70"
android:padding="8dp"
android:text="@string/upload_changes"
android:textColor="@color/white" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fab_upload"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_cloud_upload"
app:fabSize="mini" />
</LinearLayout>
<LinearLayout
android:id="@+id/layout_download"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:clipToPadding="false"
android:orientation="horizontal"
android:padding="24dp"
android:visibility="visible"
app:layout_constraintBottom_toTopOf="@id/layout_upload"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
<View
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="match_parent" />
<TextView
android:id="@+id/fab_download_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginEnd="16dp"
android:background="@drawable/tooltip_background"
android:backgroundTint="@color/black_70"
android:padding="8dp"
android:text="@string/download_changes"
android:textColor="@color/white" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fab_download"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_cloud_download"
app:fabSize="mini" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@ -50,4 +50,7 @@
<string name="preference_github_summary">Besuchen Sie das Github Projekt</string>
<string name="preference_category_information">App Informationen</string>
<string name="sync_details_activity_label">Synchronisations Details</string>
<string name="information">Informationen</string>
<string name="upload_changes">Änderungen hochladen</string>
<string name="download_changes">Änderungen herunterladen</string>
</resources>

View File

@ -56,4 +56,7 @@
<string name="preference_category_information">App information</string>
<string name="preference_github_summary">Visit the Github project</string>
<string name="sync_details_activity_label">Synchronisation details</string>
<string name="information">Information</string>
<string name="upload_changes">Upload Changes</string>
<string name="download_changes">Download Changes</string>
</resources>

View File

@ -8,7 +8,7 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
classpath 'com.android.tools.build:gradle:3.5.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong

View File

@ -1 +1 @@
include ':app', ':expandablecardview'
include ':app'