improve design

pull/5/head
Felix Prahl-Kamps 2019-06-11 14:52:41 +02:00
parent 467f7541c7
commit 86f3bbb08c
51 changed files with 1029 additions and 434 deletions

View File

@ -1,4 +1,6 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-android'
android {
compileSdkVersion 28
@ -9,6 +11,7 @@ android {
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
@ -26,8 +29,9 @@ dependencies {
implementation 'com.squareup.okhttp3:logging-interceptor:3.8.0'
// android
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
@ -47,4 +51,8 @@ dependencies {
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 "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
repositories {
mavenCentral()
}

View File

@ -15,7 +15,6 @@
android:supportsRtl="true"
android:theme="@style/AppTheme"
tools:ignore="GoogleAppIndexingWarning">
<activity android:name=".activities.MainActivity"></activity>
<activity android:name=".activities.StartUpActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@ -33,6 +32,12 @@
android:name=".activities.SyncActivity"
android:label="@string/sync"
android:parentActivityName=".activities.HomeActivity" />
<activity
android:name=".activities.ProfileActivity"
android:label="Profile"
android:theme="@style/AppTheme.Translucent"
android:parentActivityName=".activities.HomeActivity"/>
</application>
</manifest>

View File

@ -1,23 +1,20 @@
package lu.circl.mispbump.activities;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.support.design.widget.CoordinatorLayout;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.Gravity;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;
import java.util.List;
@ -26,67 +23,38 @@ import lu.circl.mispbump.adapters.SyncAdapter;
import lu.circl.mispbump.auxiliary.PreferenceManager;
import lu.circl.mispbump.models.UploadInformation;
import lu.circl.mispbump.restful_client.MispRestClient;
import lu.circl.mispbump.restful_client.Organisation;
import lu.circl.mispbump.restful_client.User;
import lu.circl.mispbump.security.KeyStoreWrapper;
public class HomeActivity extends AppCompatActivity {
public static final String TAG = "Home";
private CoordinatorLayout layout;
private TextView title;
private RecyclerView recyclerView;
private PreferenceManager preferenceManager;
private MispRestClient mispRestClient;
private View.OnClickListener onFabClicked = new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent sync = new Intent(HomeActivity.this, SyncActivity.class);
startActivity(sync);
}
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home);
// populate Toolbar (Actionbar)
Toolbar myToolbar = findViewById(R.id.toolbar);
setSupportActionBar(myToolbar);
ActionBar ab = getSupportActionBar();
if (ab != null) {
ab.setDisplayHomeAsUpEnabled(false);
}
View titleView = getLayoutInflater().inflate(R.layout.actionbar_home, null);
title = titleView.findViewById(R.id.actionbar_title);
ActionBar.LayoutParams params = new ActionBar.LayoutParams(
ActionBar.LayoutParams.WRAP_CONTENT,
ActionBar.LayoutParams.MATCH_PARENT,
Gravity.CENTER);
ab.setCustomView(titleView, params);
ab.setDisplayShowCustomEnabled(true);
ab.setDisplayShowTitleEnabled(false);
layout = findViewById(R.id.layout);
recyclerView = findViewById(R.id.recyclerView);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
preferenceManager = PreferenceManager.getInstance(this);
mispRestClient = new MispRestClient(this);
populateViewsWithInfo();
initializeViews();
}
@Override
protected void onResume() {
super.onResume();
populateRecyclerView();
FloatingActionButton sync_fab = findViewById(R.id.home_fab);
sync_fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i = new Intent(getApplicationContext(), SyncActivity.class);
startActivity(i);
}
});
}
@Override
@ -97,13 +65,13 @@ public class HomeActivity extends AppCompatActivity {
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == R.id.main_menu_clear_and_logout) {
clearDeviceAndLogOut();
if (item.getItemId() == R.id.menu_settings) {
return true;
}
if (item.getItemId() == R.id.update) {
updateProfile();
if (item.getItemId() == R.id.menu_profile) {
Intent profile = new Intent(HomeActivity.this, ProfileActivity.class);
startActivity(profile);
return true;
}
@ -111,88 +79,40 @@ public class HomeActivity extends AppCompatActivity {
return super.onOptionsItemSelected(item);
}
private void initializeViews() {
layout = findViewById(R.id.rootLayout);
public void updateProfile() {
mispRestClient.getMyUser(new MispRestClient.UserCallback() {
@Override
public void success(final User user) {
// populate Toolbar (Actionbar)
Toolbar myToolbar = findViewById(R.id.toolbar);
setSupportActionBar(myToolbar);
preferenceManager.setUserInfo(user);
ActionBar ab = getSupportActionBar();
if (ab != null) {
ab.setDisplayHomeAsUpEnabled(false);
}
mispRestClient.getOrganisation(user.org_id, new MispRestClient.OrganisationCallback() {
@Override
public void success(Organisation organisation) {
preferenceManager.setUserOrgInfo(organisation);
populateViewsWithInfo();
}
recyclerView = findViewById(R.id.recyclerView);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
@Override
public void failure(String error) {
Snackbar.make(layout, error, Snackbar.LENGTH_LONG).show();
}
});
}
@Override
public void failure(String error) {
Snackbar.make(layout, error, Snackbar.LENGTH_LONG).show();
}
});
}
private void populateViewsWithInfo() {
Organisation org = preferenceManager.getUserOrganisation();
title.setText(org.name);
TextView userCount = findViewById(R.id.user_count);
userCount.setText("" + org.user_count);
TextView sector = findViewById(R.id.sector);
sector.setText(org.sector);
TextView nationality = findViewById(R.id.nationality);
nationality.setText(org.nationality);
FloatingActionButton sync_fab = findViewById(R.id.home_fab);
sync_fab.setOnClickListener(onFabClicked);
}
private void populateRecyclerView() {
List<UploadInformation> uploadInformationList = preferenceManager.getUploadInformation();
Log.i(TAG, "Size: " + uploadInformationList.size());
SyncAdapter syncAdapter = new SyncAdapter(uploadInformationList);
TextView empty = findViewById(R.id.emtpy);
if (uploadInformationList == null) {
empty.setVisibility(View.VISIBLE);
recyclerView.setVisibility(View.GONE);
return;
}
empty.setVisibility(View.GONE);
recyclerView.setVisibility(View.VISIBLE);
SyncAdapter syncAdapter = new SyncAdapter(uploadInformationList, HomeActivity.this);
recyclerView.setAdapter(syncAdapter);
}
private void clearDeviceAndLogOut() {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Clear all saved data and logout");
builder.setMessage("Do you really want to delete all data and logout?");
builder.setNegativeButton("Discard", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
}
});
builder.setPositiveButton("Delete & Logout", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
PreferenceManager prefs = PreferenceManager.getInstance(getApplicationContext());
prefs.clearAllData();
KeyStoreWrapper.deleteAllStoredKeys();
Intent login = new Intent(getApplicationContext(), LoginActivity.class);
startActivity(login);
finish();
}
});
builder.create().show();
}
@Override
protected void onResume() {
super.onResume();
populateRecyclerView();
}
}

View File

@ -50,7 +50,7 @@ public class LoginActivity extends AppCompatActivity {
ab.setDisplayHomeAsUpEnabled(false);
}
constraintLayout = findViewById(R.id.layout);
constraintLayout = findViewById(R.id.rootLayout);
progressBar = findViewById(R.id.login_progressbar);
serverUrl = findViewById(R.id.login_server_url);
serverAutomationKey = findViewById(R.id.login_automation_key);

View File

@ -1,24 +0,0 @@
package lu.circl.mispbump.activities;
import android.os.Bundle;
import android.support.design.widget.BottomNavigationView;
import android.support.v7.app.AppCompatActivity;
import lu.circl.mispbump.R;
public class MainActivity extends AppCompatActivity {
private BottomNavigationView bottomNavigationView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
initializeViews();
}
private void initializeViews() {
// bottomNavigationView = findViewById(R.id.bottom_navigation);
}
}

View File

@ -0,0 +1,197 @@
package lu.circl.mispbump.activities;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Shader;
import android.graphics.drawable.AnimatedVectorDrawable;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.support.design.widget.CoordinatorLayout;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v4.widget.ContentLoadingProgressBar;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.animation.RotateAnimation;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;
import java.util.Random;
import lu.circl.mispbump.R;
import lu.circl.mispbump.auxiliary.PreferenceManager;
import lu.circl.mispbump.auxiliary.TileDrawable;
import lu.circl.mispbump.custom_views.MaterialPreferenceText;
import lu.circl.mispbump.restful_client.MispRestClient;
import lu.circl.mispbump.restful_client.Organisation;
import lu.circl.mispbump.restful_client.User;
import lu.circl.mispbump.security.KeyStoreWrapper;
public class ProfileActivity extends AppCompatActivity {
private CoordinatorLayout rootLayout;
private MispRestClient mispRestClient;
private PreferenceManager preferenceManager;
private FloatingActionButton fab;
private AnimatedVectorDrawable fabLoadingDrawable;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_profile);
mispRestClient = new MispRestClient(this);
preferenceManager = PreferenceManager.getInstance(this);
initializeViews();
populateInformationViews();
}
private void initializeViews() {
rootLayout = findViewById(R.id.rootLayout);
ImageView headerBg = findViewById(R.id.headerBg);
headerBg.setImageDrawable(new TileDrawable(getRandomHeader(), Shader.TileMode.REPEAT));
// populate Toolbar (Actionbar)
Toolbar myToolbar = findViewById(R.id.toolbar);
setSupportActionBar(myToolbar);
ActionBar ab = getSupportActionBar();
if (ab != null) {
ab.setDisplayHomeAsUpEnabled(true);
ab.setDisplayShowTitleEnabled(true);
}
fab = findViewById(R.id.fab);
fab.setOnClickListener(onFabClicked());
fabLoadingDrawable = (AnimatedVectorDrawable) getDrawable(R.drawable.animated_sync);
}
private void populateInformationViews() {
Organisation organisation = preferenceManager.getUserOrganisation();
TextView name = findViewById(R.id.orgName);
name.setText(organisation.name);
MaterialPreferenceText uuid = findViewById(R.id.uuid);
uuid.setSubText(organisation.uuid);
uuid.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
TextView tv = v.findViewById(R.id.material_preference_subtitle);
Snackbar.make(rootLayout, "clicked: " + tv.getText().toString(), Snackbar.LENGTH_LONG).show();
}
});
MaterialPreferenceText nationality = findViewById(R.id.nationality);
nationality.setSubText(organisation.nationality);
MaterialPreferenceText sector = findViewById(R.id.sector);
sector.setSubText(organisation.sector);
MaterialPreferenceText description = findViewById(R.id.description);
description.setSubText(organisation.description);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_profile, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == R.id.menu_delete_profile) {
clearDeviceAndLogOut();
}
return super.onOptionsItemSelected(item);
}
private View.OnClickListener onFabClicked() {
return new View.OnClickListener() {
@Override
public void onClick(View v) {
fab.setImageDrawable(fabLoadingDrawable);
fabLoadingDrawable.start();
updateProfile();
}
};
}
private Drawable getRandomHeader() {
int[] ids = {R.drawable.ic_bank_note, R.drawable.ic_polka_dots, R.drawable.ic_wiggle, R.drawable.ic_circuit_board};
return getDrawable(ids[new Random().nextInt(ids.length)]);
}
public void updateProfile() {
// progressBar.setVisibility(View.VISIBLE);
mispRestClient.getMyUser(new MispRestClient.UserCallback() {
@Override
public void success(final User user) {
preferenceManager.setUserInfo(user);
mispRestClient.getOrganisation(user.org_id, new MispRestClient.OrganisationCallback() {
@Override
public void success(Organisation organisation) {
fabLoadingDrawable.stop();
preferenceManager.setUserOrgInfo(organisation);
}
@Override
public void failure(String error) {
fabLoadingDrawable.stop();
Snackbar.make(rootLayout, error, Snackbar.LENGTH_LONG).show();
}
});
}
@Override
public void failure(String error) {
fabLoadingDrawable.stop();
Snackbar.make(rootLayout, error, Snackbar.LENGTH_LONG).show();
}
});
}
private void clearDeviceAndLogOut() {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Clear all saved data and logout");
builder.setMessage("Do you really want to delete all data and logout?");
builder.setNegativeButton("Discard", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
}
});
builder.setPositiveButton("Delete & Logout", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
PreferenceManager prefs = PreferenceManager.getInstance(getApplicationContext());
prefs.clearAllData();
KeyStoreWrapper.deleteAllStoredKeys();
Intent login = new Intent(getApplicationContext(), LoginActivity.class);
startActivity(login);
finish();
}
});
builder.create().show();
}
}

View File

@ -2,6 +2,7 @@ package lu.circl.mispbump.activities;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.support.design.bottomappbar.BottomAppBar;
import android.support.design.widget.CoordinatorLayout;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
@ -68,22 +69,22 @@ public class SyncActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sync);
setContentView(R.layout.activity_sync_2);
Toolbar myToolbar = findViewById(R.id.appbar);
setSupportActionBar(myToolbar);
// BottomAppBar myToolbar = findViewById(R.id.bottomNavigation);
// setSupportActionBar(myToolbar);
//
// ActionBar ab = getSupportActionBar();
// if (ab != null) {
// ab.setDisplayHomeAsUpEnabled(true);
// }
ActionBar ab = getSupportActionBar();
if (ab != null) {
ab.setDisplayHomeAsUpEnabled(true);
}
layout = findViewById(R.id.layout);
layout = findViewById(R.id.rootLayout);
qrCodeView = findViewById(R.id.qrcode);
continueButton = findViewById(R.id.continue_fab);
continueButton.setOnClickListener(onContinueClicked);
continueButton.hide();
// continueButton = findViewById(R.id.fab);
// continueButton.setOnClickListener(onContinueClicked);
// continueButton.hide();
diffieHellman = DiffieHellman.getInstance();
restClient = new MispRestClient(this);
@ -182,7 +183,7 @@ public class SyncActivity extends AppCompatActivity {
new DialogManager.IDialogFeedback() {
@Override
public void positive() {
uploadInformation.remote = remoteSyncInfo;
uploadInformation.setRemote(remoteSyncInfo);
continueButton.show();
}
@ -215,7 +216,7 @@ public class SyncActivity extends AppCompatActivity {
@Override
public void available() {
restClient.addOrganisation(uploadInformation.remote.organisation, new MispRestClient.OrganisationCallback() {
restClient.addOrganisation(uploadInformation.getRemote().organisation, new MispRestClient.OrganisationCallback() {
@Override
public void success(final Organisation organisation) {
// create syncUser object from syncInfo
@ -227,8 +228,8 @@ public class SyncActivity extends AppCompatActivity {
String emailSaveOrgName = organisation.name.replace(" ", "").toLowerCase();
syncUser.email = "syncuser_" + emailSaveOrgName + "@misp.de";
syncUser.password = uploadInformation.remote.syncUserPassword;
syncUser.authkey = uploadInformation.remote.syncUserAuthkey;
syncUser.password = uploadInformation.getRemote().syncUserPassword;
syncUser.authkey = uploadInformation.getRemote().syncUserAuthkey;
syncUser.termsaccepted = true;
// add user to local organisation
@ -237,9 +238,9 @@ public class SyncActivity extends AppCompatActivity {
public void success(User user) {
Server server = new Server();
server.name = organisation.name + "'s Sync Server";
server.url = uploadInformation.remote.baseUrl;
server.url = uploadInformation.getRemote().baseUrl;
server.remote_org_id = organisation.id;
server.authkey = uploadInformation.local.syncUserAuthkey;
server.authkey = uploadInformation.getLocal().syncUserAuthkey;
server.self_signed = true;
restClient.addServer(server, new MispRestClient.ServerCallback() {
@ -253,14 +254,14 @@ public class SyncActivity extends AppCompatActivity {
@Override
public void success(Server server) {
uploadInformation.currentSyncStatus = UploadInformation.SyncStatus.COMPLETE;
uploadInformation.setCurrentSyncStatus(UploadInformation.SyncStatus.COMPLETE);
preferenceManager.setUploadInformation(uploadInformation);
finish();
}
@Override
public void failure(String error) {
uploadInformation.currentSyncStatus = UploadInformation.SyncStatus.FAILURE;
uploadInformation.setCurrentSyncStatus(UploadInformation.SyncStatus.FAILURE);
preferenceManager.setUploadInformation(uploadInformation);
Snackbar.make(layout, error, Snackbar.LENGTH_LONG).show();
Log.e(TAG, error);
@ -270,7 +271,7 @@ public class SyncActivity extends AppCompatActivity {
@Override
public void failure(String error) {
uploadInformation.currentSyncStatus = UploadInformation.SyncStatus.FAILURE;
uploadInformation.setCurrentSyncStatus(UploadInformation.SyncStatus.FAILURE);
preferenceManager.setUploadInformation(uploadInformation);
Snackbar.make(layout, error, Snackbar.LENGTH_LONG).show();
Log.e(TAG, error);
@ -280,7 +281,7 @@ public class SyncActivity extends AppCompatActivity {
@Override
public void failure(String error) {
uploadInformation.currentSyncStatus = UploadInformation.SyncStatus.FAILURE;
uploadInformation.setCurrentSyncStatus(UploadInformation.SyncStatus.FAILURE);
preferenceManager.setUploadInformation(uploadInformation);
Snackbar.make(layout, error, Snackbar.LENGTH_LONG).show();
Log.e(TAG, error);

View File

@ -1,64 +1,87 @@
package lu.circl.mispbump.adapters;
import android.content.Context;
import android.content.Intent;
import android.support.annotation.NonNull;
import android.support.v7.widget.CardView;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import java.util.List;
import lu.circl.mispbump.R;
import lu.circl.mispbump.activities.HomeActivity;
import lu.circl.mispbump.activities.ProfileActivity;
import lu.circl.mispbump.models.UploadInformation;
public class SyncAdapter extends RecyclerView.Adapter<SyncAdapter.SyncViewHolder> {
private Context context;
private List<UploadInformation> uploadInformationList;
static class SyncViewHolder extends RecyclerView.ViewHolder {
TextView title, status;
TextView orgName, date;
ImageView syncStatus;
ImageButton retry, delete;
SyncViewHolder(View v) {
SyncViewHolder(View v, final Context context) {
super(v);
title = v.findViewById(R.id.title);
status = v.findViewById(R.id.syncStatus);
orgName = v.findViewById(R.id.orgName);
date = v.findViewById(R.id.date);
retry = v.findViewById(R.id.retry_button);
delete = v.findViewById(R.id.delete_button);
syncStatus = v.findViewById(R.id.syncStatus);
retry = v.findViewById(R.id.retryButton);
delete = v.findViewById(R.id.deleteButton);
v.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// context.startActivity(new Intent(context, ProfileActivity.class));
}
});
}
}
public SyncAdapter(List<UploadInformation> uploadInformationList) {
public SyncAdapter(List<UploadInformation> uploadInformationList, Context context) {
this.uploadInformationList = uploadInformationList;
this.context = context;
}
@NonNull
@Override
public SyncViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
View v = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.viewholder_sync, viewGroup, false);
return new SyncViewHolder(v);
View v = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.viewholder_sync_card, viewGroup, false);
return new SyncViewHolder(v, context);
}
@Override
public void onBindViewHolder(@NonNull SyncViewHolder syncViewHolder, int i) {
syncViewHolder.title.setText(uploadInformationList.get(i).remote.organisation.name);
switch (uploadInformationList.get(i).currentSyncStatus) {
syncViewHolder.orgName.setText(uploadInformationList.get(i).getRemote().organisation.name);
syncViewHolder.date.setText(uploadInformationList.get(i).getDateString());
switch (uploadInformationList.get(i).getCurrentSyncStatus()) {
case COMPLETE:
syncViewHolder.status.setText("Synced");
syncViewHolder.syncStatus.setBackgroundColor(context.getColor(R.color.status_green));
syncViewHolder.syncStatus.setImageResource(R.drawable.ic_check);
syncViewHolder.retry.setVisibility(View.GONE);
break;
case FAILURE:
syncViewHolder.status.setText("Error");
syncViewHolder.syncStatus.setBackgroundColor(context.getColor(R.color.status_red));
syncViewHolder.syncStatus.setImageResource(R.drawable.ic_error_outline);
syncViewHolder.retry.setVisibility(View.VISIBLE);
break;
case PENDING:
syncViewHolder.status.setText("Pending");
syncViewHolder.syncStatus.setBackgroundColor(context.getColor(R.color.status_green));
syncViewHolder.retry.setVisibility(View.GONE);
break;
}

View File

@ -0,0 +1,49 @@
package lu.circl.mispbump.auxiliary
import android.graphics.Bitmap
import android.graphics.BitmapShader
import android.graphics.Canvas
import android.graphics.ColorFilter
import android.graphics.Paint
import android.graphics.PixelFormat
import android.graphics.Shader
import android.graphics.drawable.BitmapDrawable
import android.graphics.drawable.Drawable
class TileDrawable(drawable: Drawable, tileMode: Shader.TileMode) : Drawable() {
private val paint: Paint
init {
paint = Paint().apply {
shader = BitmapShader(getBitmap(drawable), tileMode, tileMode)
}
}
override fun draw(canvas: Canvas) {
canvas.drawPaint(paint)
}
override fun setAlpha(alpha: Int) {
paint.alpha = alpha
}
override fun getOpacity() = PixelFormat.TRANSLUCENT
override fun setColorFilter(colorFilter: ColorFilter?) {
paint.colorFilter = colorFilter
}
private fun getBitmap(drawable: Drawable): Bitmap {
if (drawable is BitmapDrawable) {
return drawable.bitmap
}
val bmp = Bitmap.createBitmap(drawable.intrinsicWidth, drawable.intrinsicHeight,
Bitmap.Config.ARGB_8888)
val c = Canvas(bmp)
drawable.setBounds(0, 0, drawable.intrinsicWidth, drawable.intrinsicHeight)
drawable.draw(c)
return bmp
}
}

View File

@ -0,0 +1,47 @@
package lu.circl.mispbump.custom_views;
import android.content.Context;
import android.content.res.TypedArray;
import android.support.constraint.ConstraintLayout;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import lu.circl.mispbump.R;
public class MaterialPreferenceText extends ConstraintLayout {
private View baseView;
private TextView title, subtitle;
public MaterialPreferenceText(Context context, AttributeSet attrs) {
super(context, attrs);
LayoutInflater inflater = LayoutInflater.from(context);
baseView = inflater.inflate(R.layout.material_preference_text, this);
TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.MaterialPreferenceText);
ImageView icon = baseView.findViewById(R.id.material_preference_src);
icon.setImageResource(a.getResourceId(R.styleable.MaterialPreferenceText_pref_icon, 0x0));
title = baseView.findViewById(R.id.material_preference_title);
title.setText(a.getString(R.styleable.MaterialPreferenceText_text));
subtitle = baseView.findViewById(R.id.material_preference_subtitle);
subtitle.setText(a.getString(R.styleable.MaterialPreferenceText_subText));
a.recycle();
}
public void setSubText(String subText) {
subtitle.setText(subText);
}
// @Override
// public void onClick(View v) {
//
// }
}

View File

@ -0,0 +1,8 @@
package lu.circl.mispbump.fragments;
import android.support.v4.app.Fragment;
public class HomeFragment extends Fragment {
}

View File

@ -1,5 +1,10 @@
package lu.circl.mispbump.models;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
public class UploadInformation {
public enum SyncStatus {
@ -8,20 +13,62 @@ public class UploadInformation {
PENDING
}
public SyncStatus currentSyncStatus = SyncStatus.PENDING;
public SyncInformation local;
public SyncInformation remote;
private SyncStatus currentSyncStatus = SyncStatus.PENDING;
private SyncInformation local;
private SyncInformation remote;
private Date date;
public UploadInformation() {
this(null, null);
}
public UploadInformation(SyncInformation local) {
this.local = local;
this(local, null);
}
public UploadInformation(SyncInformation local, SyncInformation remote) {
date = Calendar.getInstance().getTime();
this.local = local;
this.remote = remote;
date = Calendar.getInstance().getTime();
}
// getter and setter
public void setCurrentSyncStatus(SyncStatus status) {
currentSyncStatus = status;
}
public SyncStatus getCurrentSyncStatus() {
return currentSyncStatus;
}
public void setLocal(SyncInformation local) {
this.local = local;
}
public SyncInformation getLocal() {
return local;
}
public void setRemote(SyncInformation remote) {
this.remote = remote;
}
public SyncInformation getRemote() {
return remote;
}
public void setDate(Date date) {
this.date = date;
}
public Date getDate() {
return date;
}
public String getDateString() {
SimpleDateFormat df = new SimpleDateFormat("dd.mm.yyyy", Locale.getDefault());
return df.format(date);
}
}

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<alpha
android:interpolator="@android:anim/accelerate_interpolator"
android:fromAlpha="0.0"
android:toAlpha="1.0"
android:duration="@android:integer/config_shortAnimTime" />
</set>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<alpha
android:interpolator="@android:anim/accelerate_interpolator"
android:fromAlpha="1.0"
android:toAlpha="0.0"
android:duration="@android:integer/config_shortAnimTime" />
</set>

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<objectAnimator
xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="500"
android:repeatCount="infinite"
android:repeatMode="restart"
android:propertyName="rotation"
android:valueFrom="0"
android:valueTo="-180"
android:valueType="floatType"/>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<animated-vector
xmlns:android="http://schemas.android.com/apk/res/android"
android:drawable="@drawable/ic_sync_black_24dp">
<target
android:name="rotation"
android:animation="@animator/rotation_cw"/>
</animated-vector>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="true" android:color="@color/white" />
<item android:color="@color/white_50"/>
</selector>

View File

@ -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,4l-1.41,1.41L16.17,11H4v2h12.17l-5.58,5.59L12,20l8,-8z"/>
</vector>

View File

@ -0,0 +1,13 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="100dp"
android:height="20dp"
android:viewportWidth="100"
android:viewportHeight="20">
<path
android:pathData="M21.184,20C21.541,19.87 21.904,19.736 22.272,19.598C22.635,19.463 23.871,19 24.04,18.937C33.64,15.348 39.647,14 50,14C60.271,14 65.362,15.222 74.629,18.928C75.584,19.311 76.498,19.668 77.379,20L83.604,20C81.093,19.269 78.465,18.309 75.371,17.072C65.888,13.278 60.562,12 50,12C39.374,12 33.145,13.397 23.34,17.063C23.169,17.127 21.934,17.59 21.573,17.725C19.098,18.648 16.913,19.399 14.849,20L21.184,20L21.184,20ZM21.184,0C13.258,2.892 8.077,4 0,4L0,4L0,2C5.744,2 9.951,1.426 14.849,0L21.184,0L21.184,0ZM77.379,0C85.239,2.966 90.502,4 100,4L100,2C93.158,2 88.614,1.458 83.604,0L77.379,0L77.379,0ZM0,14C8.441,14 13.718,12.79 22.272,9.598C22.635,9.463 23.871,9 24.04,8.937C33.64,5.348 39.647,4 50,4C60.271,4 65.362,5.222 74.629,8.928C84.112,12.722 89.438,14 100,14L100,12C89.729,12 84.638,10.778 75.371,7.072C65.888,3.278 60.562,2 50,2C39.374,2 33.145,3.397 23.34,7.063C23.169,7.127 21.934,7.59 21.573,7.725C13.224,10.84 8.164,12 0,12L0,14L0,14L0,14Z"
android:strokeWidth="1"
android:fillColor="@color/colorAccent"
android:fillAlpha="0.5"
android:fillType="evenOdd"
android:strokeColor="#00000000"/>
</vector>

File diff suppressed because one or more lines are too long

View File

@ -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,6.41L17.59,5 12,10.59 6.41,5 5,6.41 10.59,12 5,17.59 6.41,19 12,13.41 17.59,19 19,17.59 13.41,12z"/>
</vector>

View File

@ -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.4,16.6L4.8,12l4.6,-4.6L8,6l-6,6 6,6 1.4,-1.4zM14.6,16.6l4.6,-4.6 -4.6,-4.6L16,6l6,6 -6,6 -1.4,-1.4z"/>
</vector>

View File

@ -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,2L6,2c-1.1,0 -1.99,0.9 -1.99,2L4,20c0,1.1 0.89,2 1.99,2L18,22c1.1,0 2,-0.9 2,-2L20,8l-6,-6zM16,18L8,18v-2h8v2zM16,14L8,14v-2h8v2zM13,9L13,3.5L18.5,9L13,9z"/>
</vector>

View File

@ -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="M11,15h2v2h-2zM11,7h2v6h-2zM11.99,2C6.47,2 2,6.48 2,12s4.47,10 9.99,10C17.52,22 22,17.52 22,12S17.52,2 11.99,2zM12,20c-4.42,0 -8,-3.58 -8,-8s3.58,-8 8,-8 8,3.58 8,8 -3.58,8 -8,8z"/>
</vector>

View File

@ -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="M11.99,2C6.47,2 2,6.48 2,12s4.47,10 9.99,10C17.52,22 22,17.52 22,12S17.52,2 11.99,2zM18.92,8h-2.95c-0.32,-1.25 -0.78,-2.45 -1.38,-3.56 1.84,0.63 3.37,1.91 4.33,3.56zM12,4.04c0.83,1.2 1.48,2.53 1.91,3.96h-3.82c0.43,-1.43 1.08,-2.76 1.91,-3.96zM4.26,14C4.1,13.36 4,12.69 4,12s0.1,-1.36 0.26,-2h3.38c-0.08,0.66 -0.14,1.32 -0.14,2 0,0.68 0.06,1.34 0.14,2L4.26,14zM5.08,16h2.95c0.32,1.25 0.78,2.45 1.38,3.56 -1.84,-0.63 -3.37,-1.9 -4.33,-3.56zM8.03,8L5.08,8c0.96,-1.66 2.49,-2.93 4.33,-3.56C8.81,5.55 8.35,6.75 8.03,8zM12,19.96c-0.83,-1.2 -1.48,-2.53 -1.91,-3.96h3.82c-0.43,1.43 -1.08,2.76 -1.91,3.96zM14.34,14L9.66,14c-0.09,-0.66 -0.16,-1.32 -0.16,-2 0,-0.68 0.07,-1.35 0.16,-2h4.68c0.09,0.65 0.16,1.32 0.16,2 0,0.68 -0.07,1.34 -0.16,2zM14.59,19.56c0.6,-1.11 1.06,-2.31 1.38,-3.56h2.95c-0.96,1.65 -2.49,2.93 -4.33,3.56zM16.36,14c0.08,-0.66 0.14,-1.32 0.14,-2 0,-0.68 -0.06,-1.34 -0.14,-2h3.38c0.16,0.64 0.26,1.31 0.26,2s-0.1,1.36 -0.26,2h-3.38z"/>
</vector>

View File

@ -0,0 +1,13 @@
<vector android:height="24dp" android:viewportHeight="20"
android:viewportWidth="20" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path
android:pathData="M3,3m-3,0a3,3 0,1 1,6 0a3,3 0,1 1,-6 0"
android:fillColor="@color/colorAccent"
android:fillAlpha="0.5"
android:fillType="evenOdd"/>
<path
android:pathData="M13,13m-3,0a3,3 0,1 1,6 0a3,3 0,1 1,-6 0"
android:fillColor="@color/colorAccent"
android:fillAlpha="0.4"
android:fillType="evenOdd"/>
</vector>

View File

@ -0,0 +1,8 @@
<!-- drawable/qrcode.xml -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp"
android:width="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path android:fillColor="#FFF" android:pathData="M3,11H5V13H3V11M11,5H13V9H11V5M9,11H13V15H11V13H9V11M15,11H17V13H19V11H21V13H19V15H21V19H19V21H17V19H13V21H11V17H15V15H17V13H15V11M19,19V15H17V19H19M15,3H21V9H15V3M17,5V7H19V5H17M3,3H9V9H3V3M5,5V7H7V5H5M3,15H9V21H3V15M5,17V19H7V17H5Z" />
</vector>

View File

@ -0,0 +1,8 @@
<!-- drawable/qrcode_scan.xml -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp"
android:width="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path android:fillColor="#FFF" android:pathData="M4,4H10V10H4V4M20,4V10H14V4H20M14,15H16V13H14V11H16V13H18V11H20V13H18V15H20V18H18V20H16V18H13V20H11V16H14V15M16,15V18H18V15H16M4,20V14H10V20H4M6,6V8H8V6H6M16,6V8H18V6H16M6,16V18H8V16H6M4,11H6V13H4V11M9,11H13V15H11V13H9V11M11,6H13V10H11V6M2,2V6H0V2A2,2 0 0,1 2,0H6V2H2M22,0A2,2 0 0,1 24,2V6H22V2H18V0H22M2,18V22H6V24H2A2,2 0 0,1 0,22V18H2M22,22V18H24V22A2,2 0 0,1 22,24H18V22H22Z" />
</vector>

View File

@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#FFFFFF"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M19.1,12.9a2.8,2.8 0,0 0,0.1 -0.9,2.8 2.8,0 0,0 -0.1,-0.9l2.1,-1.6a0.7,0.7 0,0 0,0.1 -0.6L19.4,5.5a0.7,0.7 0,0 0,-0.6 -0.2l-2.4,1a6.5,6.5 0,0 0,-1.6 -0.9l-0.4,-2.6a0.5,0.5 0,0 0,-0.5 -0.4H10.1a0.5,0.5 0,0 0,-0.5 0.4L9.3,5.4a5.6,5.6 0,0 0,-1.7 0.9l-2.4,-1a0.4,0.4 0,0 0,-0.5 0.2l-2,3.4c-0.1,0.2 0,0.4 0.2,0.6l2,1.6a2.8,2.8 0,0 0,-0.1 0.9,2.8 2.8,0 0,0 0.1,0.9L2.8,14.5a0.7,0.7 0,0 0,-0.1 0.6l1.9,3.4a0.7,0.7 0,0 0,0.6 0.2l2.4,-1a6.5,6.5 0,0 0,1.6 0.9l0.4,2.6a0.5,0.5 0,0 0,0.5 0.4h3.8a0.5,0.5 0,0 0,0.5 -0.4l0.3,-2.6a5.6,5.6 0,0 0,1.7 -0.9l2.4,1a0.4,0.4 0,0 0,0.5 -0.2l2,-3.4c0.1,-0.2 0,-0.4 -0.2,-0.6ZM12,15.6A3.6,3.6 0,1 1,15.6 12,3.6 3.6,0 0,1 12,15.6Z"/>
</vector>

View File

@ -1,5 +1,18 @@
<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 xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="#FFFFFF"
android:viewportWidth="24"
android:viewportHeight="24">
<group
android:name="rotation"
android:pivotX="12"
android:pivotY="12">
<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" />
</group>
</vector>

View File

@ -0,0 +1,11 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="52dp"
android:height="26dp"
android:viewportWidth="52"
android:viewportHeight="26">
<path
android:pathData="M10,10c0,-2.21 -1.79,-4 -4,-4 -3.314,0 -6,-2.686 -6,-6h2c0,2.21 1.79,4 4,4 3.314,0 6,2.686 6,6 0,2.21 1.79,4 4,4 3.314,0 6,2.686 6,6 0,2.21 1.79,4 4,4v2c-3.314,0 -6,-2.686 -6,-6 0,-2.21 -1.79,-4 -4,-4 -3.314,0 -6,-2.686 -6,-6zM35.464,8.05l8.486,8.486 -1.414,1.414 -8.486,-8.486 1.414,-1.414z"
android:fillColor="@color/colorAccent"
android:fillAlpha="0.5"
android:fillType="evenOdd"/>
</vector>

View File

@ -1,21 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="@+id/actionbar_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:maxLines="1"
android:clickable="false"
android:focusable="false"
android:longClickable="false"
android:textStyle="bold"
android:textSize="18sp"
android:textColor="#FFFFFF" />
</LinearLayout>

View File

@ -3,12 +3,11 @@
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:id="@+id/layout"
android:id="@+id/rootLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content">
@ -17,95 +16,24 @@
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:elevation="0dp"
android:elevation="4dp"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="16dp">
<TextView
android:id="@+id/user_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:textColor="#FFFFFF"
android:drawableStart="@drawable/ic_person"
android:drawablePadding="4dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/sector"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="11" />
<View
android:layout_width="1dp"
android:layout_height="0dp"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:background="#55FFFFFF"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/sector"
app:layout_constraintStart_toEndOf="@+id/user_count"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/sector"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:gravity="center_vertical"
android:textColor="#FFFFFF"
android:drawableStart="@drawable/ic_sector"
android:drawablePadding="4dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/nationality"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="@+id/user_count"
app:layout_constraintTop_toTopOf="parent"
tools:text="Financial" />
<View
android:layout_width="1dp"
android:layout_height="0dp"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:background="#55FFFFFF"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/nationality"
app:layout_constraintStart_toEndOf="@+id/sector"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/nationality"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:gravity="center_vertical"
android:textColor="#FFFFFF"
android:drawableStart="@drawable/ic_location"
android:drawablePadding="4dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="@+id/sector"
app:layout_constraintTop_toTopOf="parent"
tools:text="Germany" />
</android.support.constraint.ConstraintLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<TextView
android:id="@+id/emtpy"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
</android.support.v7.widget.RecyclerView>
android:gravity="center"
android:text="@string/no_syncs_hint"/>
<android.support.design.widget.FloatingActionButton
android:id="@+id/home_fab"
@ -113,6 +41,6 @@
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="16dp"
android:src="@drawable/ic_add" />
android:src="@drawable/ic_qrcode_scan" />
</android.support.design.widget.CoordinatorLayout>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
android:id="@+id/layout"
android:id="@+id/rootLayout"
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"

View File

@ -1,18 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!--<android.support.design.widget.BottomNavigationView-->
<!--android:id="@+id/bottom_navigation"-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="56dp"-->
<!--android:layout_gravity="bottom"-->
<!--android:background="@color/colorPrimary"-->
<!--app:itemIconTint="#FFF"-->
<!--app:itemTextColor="#FFF"-->
<!--app:menu="@menu/menu_bottom_navigation" />-->
</android.support.design.widget.CoordinatorLayout>

View File

@ -0,0 +1,144 @@
<?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:id="@+id/rootLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
tools:context=".activities.ProfileActivity">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true">
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/headerBg"
android:layout_width="0dp"
android:layout_height="0dp"
android:adjustViewBounds="false"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/circle"
android:layout_width="112dp"
android:layout_height="112dp"
android:layout_above="@id/orgName"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:src="@drawable/ic_account_circle"
android:tint="@color/white"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/toolbar" />
<TextView
android:id="@+id/orgName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginEnd="24dp"
android:layout_marginBottom="8dp"
android:text="Organisation A"
android:textAlignment="center"
android:textColor="@color/white"
android:textSize="24sp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/circle" />
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:layout_marginTop="24dp"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
app:titleTextColor="@color/white" />
</android.support.constraint.ConstraintLayout>
</android.support.design.widget.AppBarLayout>
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<lu.circl.mispbump.custom_views.MaterialPreferenceText
android:id="@+id/description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/sector"
app:pref_icon="@drawable/ic_description"
app:subText="Hier steht ein sehr langer Text. Er kann sowohl mehrere Zeilen haben als auch keine Ahnung was noch. Aber auf jeden Fall viel Text."
app:text="Description">
</lu.circl.mispbump.custom_views.MaterialPreferenceText>
<lu.circl.mispbump.custom_views.MaterialPreferenceText
android:id="@+id/uuid"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:pref_icon="@drawable/ic_code_black_24dp"
app:subText="8464-4546546-8464684-654654"
app:text="UUID" />
<lu.circl.mispbump.custom_views.MaterialPreferenceText
android:id="@+id/nationality"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/uuid"
app:pref_icon="@drawable/ic_language"
app:subText="German"
app:text="Nationality">
</lu.circl.mispbump.custom_views.MaterialPreferenceText>
<lu.circl.mispbump.custom_views.MaterialPreferenceText
android:id="@+id/sector"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/nationality"
app:pref_icon="@drawable/ic_sector"
app:subText="Industrial"
app:text="Sector">
</lu.circl.mispbump.custom_views.MaterialPreferenceText>
</android.support.constraint.ConstraintLayout>
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="16dp"
android:src="@drawable/ic_sync_black_24dp" />
</android.support.design.widget.CoordinatorLayout>

View File

@ -4,7 +4,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layout"
android:id="@+id/rootLayout"
tools:context=".activities.SyncActivity"
android:layout_height="match_parent"
android:layout_width="match_parent">

View File

@ -0,0 +1,51 @@
<?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"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:id="@+id/sync_fragment_container"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/qrcode"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/qr_code"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>
<!--<android.support.design.bottomappbar.BottomAppBar-->
<!--style="@style/Widget.MaterialComponents.BottomAppBar.Colored"-->
<!--android:id="@+id/bottomNavigation"-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="56dp"-->
<!--android:layout_gravity="bottom"-->
<!--app:navigationIcon="@drawable/ic_close"-->
<!--app:fabAlignmentMode="center" />-->
<!--<android.support.design.widget.FloatingActionButton-->
<!--android:id="@+id/fab"-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--app:borderWidth="0dp"-->
<!--android:clickable="true"-->
<!--android:focusable="true"-->
<!--app:fabSize="normal"-->
<!--app:layout_anchor="@id/bottomNavigation"-->
<!--app:srcCompat="@drawable/ic_arrow_forward"/>-->
</android.support.design.widget.CoordinatorLayout>

View File

@ -0,0 +1,48 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<ImageView
android:id="@+id/material_preference_src"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginStart="24dp"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:tint="@color/colorPrimaryDark"
app:layout_constraintBottom_toBottomOf="@+id/material_preference_subtitle"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/material_preference_title"
app:srcCompat="@drawable/ic_language" />
<TextView
android:id="@+id/material_preference_title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="24dp"
android:text="Language"
android:textAppearance="@style/Text.Title"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/material_preference_src"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/material_preference_subtitle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginEnd="24dp"
android:layout_marginBottom="16dp"
android:text="German"
android:textAppearance="@style/Text.SubTitle"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/material_preference_src"
app:layout_constraintTop_toBottomOf="@+id/material_preference_title" />
</android.support.constraint.ConstraintLayout>

View File

@ -1,85 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout 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="wrap_content">
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="16dp"
app:layout_constraintStart_toEndOf="@+id/label_name"
app:layout_constraintTop_toTopOf="parent"
tools:text="Organisation B" />
<View
android:id="@+id/divider"
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_marginTop="16dp"
android:background="?android:attr/listDivider"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/label_status" />
<TextView
android:id="@+id/syncStatus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
app:layout_constraintStart_toEndOf="@+id/label_status"
app:layout_constraintTop_toBottomOf="@+id/label_name"
tools:text="successful" />
<TextView
android:id="@+id/label_status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:text="Status"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/label_name" />
<TextView
android:id="@+id/label_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:text="Name"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageButton
android:id="@+id/delete_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:src="@drawable/ic_delete_forever"
android:padding="8dp"
android:background="?android:selectableItemBackground"
app:layout_constraintBottom_toBottomOf="@+id/label_status"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/label_name" />
<ImageButton
android:id="@+id/retry_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:background="?android:selectableItemBackground"
android:padding="8dp"
android:src="@drawable/ic_autorenew"
app:layout_constraintBottom_toBottomOf="@+id/label_status"
app:layout_constraintEnd_toStartOf="@+id/delete_button"
app:layout_constraintTop_toTopOf="@+id/label_name" />
</android.support.constraint.ConstraintLayout>

View File

@ -0,0 +1,81 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.card.MaterialCardView
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:id="@+id/rootLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
app:cardElevation="2dp">
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/syncStatus"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:background="@color/status_red"
android:paddingStart="4dp"
android:paddingEnd="4dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/ic_error_outline" />
<TextView
android:id="@+id/orgName"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="8dp"
android:text="Organisation A"
android:textAppearance="@style/Text.Title"
app:layout_constraintEnd_toStartOf="@+id/retryButton"
app:layout_constraintStart_toEndOf="@+id/syncStatus"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/date"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="16dp"
android:text="20.6.2019"
android:textAppearance="@style/Text.SubTitle"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/retryButton"
app:layout_constraintStart_toEndOf="@+id/syncStatus"
app:layout_constraintTop_toBottomOf="@+id/orgName" />
<ImageButton
android:id="@+id/retryButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:background="?attr/selectableItemBackground"
android:padding="8dp"
app:layout_constraintBottom_toBottomOf="@+id/syncStatus"
app:layout_constraintEnd_toStartOf="@+id/deleteButton"
app:layout_constraintTop_toTopOf="@+id/syncStatus"
app:srcCompat="@drawable/ic_autorenew" />
<ImageButton
android:id="@+id/deleteButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:padding="8dp"
android:layout_marginEnd="8dp"
app:layout_constraintBottom_toBottomOf="@+id/syncStatus"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/syncStatus"
app:srcCompat="@drawable/ic_delete_forever" />
</android.support.constraint.ConstraintLayout>
</android.support.design.card.MaterialCardView>

View File

@ -3,12 +3,14 @@
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:icon="@drawable/ic_cloud_download_light_24dp"
android:id="@+id/update"
android:title="Update Organisation"
app:showAsAction="never"/>
android:id="@+id/menu_profile"
android:icon="@drawable/ic_person"
android:title="Profile"
app:showAsAction="ifRoom"/>
<item android:id="@+id/main_menu_clear_and_logout"
android:title="@string/logout"
<item
android:id="@+id/menu_settings"
android:icon="@drawable/ic_settings"
android:title="Settings"
app:showAsAction="never"/>
</menu>

View File

@ -1,19 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/menu_syncs"
android:icon="@drawable/ic_sync_black_24dp"
android:title="Syncs" />
<item
android:id="@+id/menu_add"
android:icon="@drawable/ic_add"
android:title="Add" />
<item
android:id="@+id/menu_profile"
android:icon="@drawable/ic_person"
android:title="Profile" />
</menu>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/menu_delete_profile"
android:icon="@drawable/ic_delete_forever"
android:title="Delete Profile" />
</menu>

View File

@ -0,0 +1,9 @@
<?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/bla"
android:icon="@drawable/ic_delete_forever"
android:title="delete"
app:showAsAction="ifRoom"/>
</menu>

View File

@ -11,4 +11,5 @@
<string name="login_help_text">Das ist der Anmelde Informations Text.</string>
<string name="qr_code">QR code</string>
<string name="sync">Synchronisation</string>
<string name="no_syncs_hint">Sie haben noch keine MISP Instanzen verknüpft.</string>
</resources>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="MaterialPreferenceText">
<attr name="pref_icon" format="reference"/>
<attr name="text"/>
<attr name="subText"/>
</declare-styleable>
</resources>

View File

@ -3,5 +3,13 @@
<color name="colorPrimary">#047EB4</color>
<color name="colorPrimaryDark">#023850</color>
<color name="colorAccent">#12B3FA</color>
<color name="colorAccent_50">#8012B3FA</color>
<color name="dividerColor">#33000000</color>
<!-- colors -->
<color name="white">#FFFFFF</color>
<color name="white_50">#80FFFFFF</color>
<color name="status_green">#4CAF50</color>
<color name="status_red">#E53935</color>
</resources>

View File

@ -13,4 +13,5 @@
<string name="ok" translatable="false">Okay</string>
<string name="qr_code">QR code</string>
<string name="sync">Synchronization</string>
<string name="no_syncs_hint">You have not synced any MISP instances yet.</string>
</resources>

View File

@ -4,4 +4,20 @@
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="AppTheme.Translucent" parent="AppTheme">
<item name="android:windowTranslucentStatus">true</item>
</style>
<style name="Text"/>
<style name="Text.Title" >
<item name="android:textColor">#de000000</item>
<item name="android:textSize">16dp</item>
</style>
<style name="Text.SubTitle" >
<item name="android:textColor">#99000000</item>
<item name="android:textSize">14dp</item>
</style>
</resources>

View File

@ -1,6 +1,7 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.3.31'
repositories {
google()
jcenter()
@ -8,7 +9,8 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
@ -18,7 +20,6 @@ allprojects {
repositories {
google()
jcenter()
}
}