mirror of https://github.com/MISP/misp-bump
commit
250aebca0e
|
@ -1,6 +1,4 @@
|
|||
# MISPbump
|
||||
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/72e7c12910284125b6971bb9d9c08229)](https://www.codacy.com/app/felixpk/misp-bump?utm_source=github.com&utm_medium=referral&utm_content=MISP/misp-bump&utm_campaign=Badge_Grade)
|
||||
|
||||
Simple and secure synchronisation of MISP instances
|
||||
|
||||
# What is MISPbump?
|
||||
|
|
|
@ -32,17 +32,17 @@ repositories {
|
|||
|
||||
dependencies {
|
||||
// android
|
||||
implementation 'com.google.android.material:material:1.0.0'
|
||||
implementation 'com.google.android.material:material:1.1.0-beta01'
|
||||
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
||||
implementation 'androidx.appcompat:appcompat:1.1.0-rc01'
|
||||
implementation 'androidx.appcompat:appcompat:1.1.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
|
||||
implementation 'androidx.cardview:cardview:1.0.0'
|
||||
implementation 'androidx.recyclerview:recyclerview:1.0.0'
|
||||
implementation 'androidx.preference:preference:1.1.0-rc01'
|
||||
implementation 'androidx.preference:preference:1.1.0'
|
||||
|
||||
// retrofit
|
||||
implementation 'com.squareup.retrofit2:retrofit:2.6.1'
|
||||
implementation 'com.squareup.retrofit2:converter-gson:2.6.1'
|
||||
implementation 'com.squareup.retrofit2:converter-gson:2.6.2'
|
||||
implementation 'com.squareup.okhttp3:logging-interceptor:4.1.0'
|
||||
|
||||
// barcode reading
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="lu.circl.mispbump">
|
||||
|
||||
<uses-permission android:name="android.permission.CAMERA" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
|
||||
<application
|
||||
android:allowBackup="false"
|
||||
android:hardwareAccelerated="true"
|
||||
|
@ -47,8 +50,5 @@
|
|||
android:parentActivityName=".activities.HomeActivity"
|
||||
android:theme="@style/AppTheme.Translucent" />
|
||||
</application>
|
||||
<uses-permission android:name="android.permission.CAMERA" />
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
|
||||
</manifest>
|
||||
|
|
|
@ -10,11 +10,9 @@ import android.widget.TextView;
|
|||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.core.app.ActivityOptionsCompat;
|
||||
import androidx.core.util.Pair;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||
|
||||
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
|
@ -26,28 +24,49 @@ import lu.circl.mispbump.adapters.SyncInfoAdapter;
|
|||
import lu.circl.mispbump.auxiliary.MispRestClient;
|
||||
import lu.circl.mispbump.auxiliary.PreferenceManager;
|
||||
import lu.circl.mispbump.interfaces.OnRecyclerItemClickListener;
|
||||
import lu.circl.mispbump.models.ExchangeInformation;
|
||||
import lu.circl.mispbump.models.SyncInformation;
|
||||
import lu.circl.mispbump.models.restModels.MispServer;
|
||||
import lu.circl.mispbump.models.restModels.MispUser;
|
||||
import lu.circl.mispbump.models.restModels.Organisation;
|
||||
import lu.circl.mispbump.models.restModels.Role;
|
||||
import lu.circl.mispbump.models.restModels.Server;
|
||||
import lu.circl.mispbump.models.restModels.User;
|
||||
|
||||
|
||||
public class HomeActivity extends AppCompatActivity {
|
||||
|
||||
private List<SyncInformation> syncInformationList;
|
||||
private PreferenceManager preferenceManager;
|
||||
private MispRestClient restClient;
|
||||
|
||||
private List<SyncInformation> syncInformationList;
|
||||
private RecyclerView recyclerView;
|
||||
private SyncInfoAdapter syncInfoAdapter;
|
||||
private TextView emptyRecyclerView;
|
||||
|
||||
private SwipeRefreshLayout swipeRefreshLayout;
|
||||
private OnRecyclerItemClickListener<Integer> onItemClick = (v, index) -> {
|
||||
Intent detailActivity = new Intent(HomeActivity.this, SyncInfoDetailActivity.class);
|
||||
detailActivity.putExtra(SyncInfoDetailActivity.EXTRA_SYNC_INFO_UUID, syncInformationList.get(index).getUuid());
|
||||
startActivity(detailActivity);
|
||||
|
||||
// SyncInformation syncInfo = preferenceManager.getSyncInformation(syncInformationList.get(index).getUuid());
|
||||
//
|
||||
// View dialogContent = getLayoutInflater().inflate(R.layout.dialog_credentials, null);
|
||||
//
|
||||
// MaterialPreferenceText url = dialogContent.findViewById(R.id.url);
|
||||
// url.setSubtitle(syncInfo.getRemote().getServer().getUrl());
|
||||
//
|
||||
// MaterialPreferenceText email = dialogContent.findViewById(R.id.email);
|
||||
// email.setSubtitle(syncInfo.getLocal().getSyncUser().getEmail());
|
||||
//
|
||||
// MaterialPasswordView authkey = dialogContent.findViewById(R.id.authkey);
|
||||
// authkey.setPassword(syncInfo.getLocal().getSyncUser().getAuthkey());
|
||||
//
|
||||
// MaterialPasswordView password = dialogContent.findViewById(R.id.password);
|
||||
// password.setPassword(syncInfo.getLocal().getSyncUser().getPassword());
|
||||
//
|
||||
// new MaterialAlertDialogBuilder(HomeActivity.this)
|
||||
// .setTitle("Credentials")
|
||||
// .setMessage("These credentials are valid for the sync user on your partners MISP instance")
|
||||
// .setView(dialogContent)
|
||||
// .setPositiveButton(android.R.string.ok, null)
|
||||
// .show();
|
||||
};
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -55,8 +74,6 @@ public class HomeActivity extends AppCompatActivity {
|
|||
setContentView(R.layout.activity_home);
|
||||
|
||||
preferenceManager = PreferenceManager.getInstance(this);
|
||||
Pair<String, String> credentials = preferenceManager.getUserCredentials();
|
||||
restClient = MispRestClient.getInstance(credentials.first, credentials.second);
|
||||
|
||||
initViews();
|
||||
initRecyclerView();
|
||||
|
@ -99,20 +116,13 @@ public class HomeActivity extends AppCompatActivity {
|
|||
|
||||
FloatingActionButton syncFab = findViewById(R.id.home_fab);
|
||||
syncFab.setOnClickListener(v -> startActivity(new Intent(HomeActivity.this, ExchangeActivity.class)));
|
||||
|
||||
swipeRefreshLayout = findViewById(R.id.swipeRefresh);
|
||||
swipeRefreshLayout.setOnRefreshListener(() -> {
|
||||
checkUnimportedSyncs();
|
||||
|
||||
syncInfoAdapter.setItems(syncInformationList);
|
||||
});
|
||||
}
|
||||
|
||||
private void initRecyclerView() {
|
||||
recyclerView = findViewById(R.id.recyclerView);
|
||||
recyclerView.setLayoutManager(new LinearLayoutManager(HomeActivity.this));
|
||||
syncInfoAdapter = new SyncInfoAdapter(HomeActivity.this);
|
||||
syncInfoAdapter.setOnRecyclerPositionClickListener(onRecyclerItemClickListener());
|
||||
syncInfoAdapter.setOnRecyclerPositionClickListener(onItemClick);
|
||||
recyclerView.setAdapter(syncInfoAdapter);
|
||||
}
|
||||
|
||||
|
@ -173,113 +183,4 @@ public class HomeActivity extends AppCompatActivity {
|
|||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void checkUnimportedSyncs() {
|
||||
restClient.getAllServers(new MispRestClient.AllRawServersCallback() {
|
||||
@Override
|
||||
public void success(List<MispServer> mispServers) {
|
||||
if (mispServers.size() < 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
List<SyncInformation> syncInformationList = preferenceManager.getSyncInformationList();
|
||||
|
||||
for (MispServer mispServer : mispServers) {
|
||||
|
||||
boolean existsOffline = false;
|
||||
|
||||
for (SyncInformation syncInformation : syncInformationList) {
|
||||
int localServerId = syncInformation.getRemote().getServer().getId();
|
||||
int remoteServerId = mispServer.getServer().getId();
|
||||
|
||||
if (remoteServerId == localServerId) {
|
||||
existsOffline = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!existsOffline) {
|
||||
// mispServer is not locally available
|
||||
SyncInformation syncInformation = new SyncInformation();
|
||||
|
||||
ExchangeInformation local = new ExchangeInformation();
|
||||
local.setOrganisation(preferenceManager.getUserOrganisation().toSyncOrganisation());
|
||||
User syncUser = preferenceManager.getUserInfo().toSyncUser();
|
||||
syncUser.setAuthkey("Could not be recovered");
|
||||
syncUser.setPassword("Could not be recovered");
|
||||
local.setSyncUser(syncUser);
|
||||
local.setServer(new Server(preferenceManager.getUserCredentials().first));
|
||||
|
||||
ExchangeInformation remote = new ExchangeInformation();
|
||||
remote.setServer(mispServer.getServer());
|
||||
|
||||
restClient.getOrganisation(mispServer.getRemoteOrganisation().getId(), new MispRestClient.OrganisationCallback() {
|
||||
@Override
|
||||
public void success(Organisation organisation) {
|
||||
remote.setOrganisation(organisation);
|
||||
|
||||
restClient.getAllUsers(new MispRestClient.AllMispUsersCallback() {
|
||||
@Override
|
||||
public void success(List<MispUser> users) {
|
||||
for (MispUser mispUser : users) {
|
||||
|
||||
boolean isSyncUserRole = false;
|
||||
|
||||
Role[] roles = preferenceManager.getRoles();
|
||||
|
||||
for (Role role : roles) {
|
||||
if (role.getId().equals(mispUser.getRole().getId())) {
|
||||
isSyncUserRole = role.isSyncUserRole();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (mispUser.getOrganisation().getId().equals(organisation.getId()) && isSyncUserRole) {
|
||||
remote.setSyncUser(mispUser.getUser());
|
||||
|
||||
syncInformation.setLocal(local);
|
||||
syncInformation.setRemote(remote);
|
||||
|
||||
preferenceManager.addSyncInformation(syncInformation);
|
||||
refreshRecyclerView();
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void failure(String error) {
|
||||
swipeRefreshLayout.setRefreshing(false);
|
||||
Snackbar.make(recyclerView, error, Snackbar.LENGTH_LONG).show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void failure(String error) {
|
||||
swipeRefreshLayout.setRefreshing(false);
|
||||
Snackbar.make(recyclerView, error, Snackbar.LENGTH_LONG).show();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
swipeRefreshLayout.setRefreshing(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void failure(String error) {
|
||||
Snackbar.make(swipeRefreshLayout, error, Snackbar.LENGTH_SHORT).show();
|
||||
swipeRefreshLayout.setRefreshing(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private OnRecyclerItemClickListener<Integer> onRecyclerItemClickListener() {
|
||||
return (v, index) -> {
|
||||
Intent i = new Intent(HomeActivity.this, SyncInfoDetailActivity.class);
|
||||
i.putExtra(SyncInfoDetailActivity.EXTRA_SYNC_INFO_UUID, syncInformationList.get(index).getUuid());
|
||||
|
||||
ActivityOptionsCompat options = ActivityOptionsCompat.makeClipRevealAnimation(v.findViewById(R.id.rootLayout), (int) v.getX(), (int) v.getY(), v.getWidth(), v.getHeight());
|
||||
startActivity(i, options.toBundle());
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,35 +1,31 @@
|
|||
package lu.circl.mispbump.activities;
|
||||
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.view.MenuItem;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.ActionBar;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceCategory;
|
||||
import androidx.preference.PreferenceFragmentCompat;
|
||||
import androidx.preference.PreferenceScreen;
|
||||
|
||||
import lu.circl.mispbump.R;
|
||||
import lu.circl.mispbump.auxiliary.PreferenceManager;
|
||||
|
||||
|
||||
public class PreferenceActivity extends AppCompatActivity {
|
||||
|
||||
private PreferenceManager preferenceManager;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_preference);
|
||||
|
||||
preferenceManager = PreferenceManager.getInstance(PreferenceActivity.this);
|
||||
|
||||
initializeViews();
|
||||
}
|
||||
|
||||
private void initializeViews() {
|
||||
Toolbar myToolbar = findViewById(R.id.toolbar);
|
||||
setSupportActionBar(myToolbar);
|
||||
|
||||
|
@ -37,29 +33,75 @@ public class PreferenceActivity extends AppCompatActivity {
|
|||
assert ab != null;
|
||||
ab.setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
FragmentManager fragmentManager = getSupportFragmentManager();
|
||||
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
|
||||
PreferencesFragment preferencesFragment = new PreferencesFragment();
|
||||
// preferencesFragment.onDeleteAllSyncsListener = preference -> {
|
||||
// preferenceManager.clearUploadInformation();
|
||||
// return true;
|
||||
// };
|
||||
|
||||
fragmentTransaction.add(R.id.fragmentContainer, preferencesFragment, PreferencesFragment.class.getSimpleName());
|
||||
fragmentTransaction.commit();
|
||||
getSupportFragmentManager()
|
||||
.beginTransaction()
|
||||
.add(R.id.fragmentContainer, new PreferencesFragment(PreferenceActivity.this))
|
||||
.commit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
|
||||
if (item.getItemId() == android.R.id.home) {
|
||||
onBackPressed();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public static class PreferencesFragment extends PreferenceFragmentCompat {
|
||||
|
||||
private Preference.OnPreferenceClickListener onDeleteAllSyncsListener;
|
||||
private Context context;
|
||||
|
||||
PreferencesFragment(Context context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
|
||||
setPreferencesFromResource(R.xml.preference_screen_main, rootKey);
|
||||
PreferenceScreen preferenceScreen = getPreferenceManager().createPreferenceScreen(context);
|
||||
setPreferenceScreen(preferenceScreen);
|
||||
|
||||
// Preference deleteAllSyncInfo = findPreference("PREF_DELETE_ALL_SYNCS");
|
||||
// assert deleteAllSyncInfo != null;
|
||||
// deleteAllSyncInfo.setOnPreferenceClickListener(onDeleteAllSyncsListener);
|
||||
// General
|
||||
|
||||
// PreferenceCategory generalCategory = new PreferenceCategory(context);
|
||||
// generalCategory.setTitle("General");
|
||||
// getPreferenceScreen().addPreference(generalCategory);
|
||||
//
|
||||
// SwitchPreference fetchOnlyLocalSyncs = new SwitchPreference(context);
|
||||
// fetchOnlyLocalSyncs.setTitle("Display local syncs only");
|
||||
// fetchOnlyLocalSyncs.setSummaryOn("Only those syncs that were made with MISPbump are displayed.");
|
||||
// fetchOnlyLocalSyncs.setSummaryOff("Existing syncs from your MISP instance are fetched (experimental)");
|
||||
// fetchOnlyLocalSyncs.setChecked(preferenceManager.getShowLocalSyncsOnly());
|
||||
// fetchOnlyLocalSyncs.setOnPreferenceChangeListener((preference, newValue) -> {
|
||||
// preferenceManager.setShowLocalSyncsOnly((boolean) newValue);
|
||||
// return true;
|
||||
// });
|
||||
//
|
||||
// generalCategory.addPreference(fetchOnlyLocalSyncs);
|
||||
|
||||
// App Information
|
||||
|
||||
PreferenceCategory appInfoCategory = new PreferenceCategory(context);
|
||||
appInfoCategory.setTitle("App Information");
|
||||
getPreferenceScreen().addPreference(appInfoCategory);
|
||||
|
||||
Preference githubPreference = new Preference(context);
|
||||
githubPreference.setIcon(context.getDrawable(R.drawable.ic_github));
|
||||
githubPreference.setTitle("Github");
|
||||
githubPreference.setSummary("Visit the Github project");
|
||||
Intent viewOnGithub = new Intent(Intent.ACTION_VIEW);
|
||||
viewOnGithub.setData(Uri.parse("https://github.com/MISP/misp-bump"));
|
||||
githubPreference.setIntent(viewOnGithub);
|
||||
|
||||
Preference versionPreference = new Preference(context);
|
||||
versionPreference.setIcon(context.getDrawable(R.drawable.ic_info_outline_dark));
|
||||
versionPreference.setTitle("Version");
|
||||
versionPreference.setSummary("1.0");
|
||||
|
||||
appInfoCategory.addPreference(githubPreference);
|
||||
appInfoCategory.addPreference(versionPreference);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import android.graphics.Shader;
|
|||
import android.graphics.drawable.AnimatedVectorDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
|
@ -74,11 +75,15 @@ public class ProfileActivity extends AppCompatActivity {
|
|||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
|
||||
if (item.getItemId() == R.id.menu_delete_profile) {
|
||||
if (item.getItemId() == android.R.id.home) {
|
||||
onBackPressed();
|
||||
return true;
|
||||
} else if (item.getItemId() == R.id.menu_delete_profile) {
|
||||
clearDeviceAndLogOut();
|
||||
return true;
|
||||
}
|
||||
|
||||
return super.onOptionsItemSelected(item);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
@ -122,6 +127,11 @@ public class ProfileActivity extends AppCompatActivity {
|
|||
|
||||
MaterialPreferenceText description = findViewById(R.id.description);
|
||||
description.setSubtitle(organisation.getDescription());
|
||||
|
||||
Role[] roles = preferenceManager.getRoles();
|
||||
for (Role role : roles) {
|
||||
Log.d("ROLES", role.toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,22 +1,19 @@
|
|||
package lu.circl.mispbump.activities;
|
||||
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.ValueAnimator;
|
||||
import android.content.Intent;
|
||||
import android.graphics.drawable.AnimatedVectorDrawable;
|
||||
import android.os.Bundle;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
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;
|
||||
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -32,38 +29,65 @@ public class SyncInfoDetailActivity extends AppCompatActivity {
|
|||
|
||||
public static String EXTRA_SYNC_INFO_UUID = "EXTRA_SYNC_INFO_UUID";
|
||||
|
||||
private UUID syncUUID;
|
||||
private PreferenceManager preferenceManager;
|
||||
private SyncInformation syncInformation;
|
||||
|
||||
private boolean fabMenuExpanded;
|
||||
private boolean dataLocallyChanged;
|
||||
private View.OnClickListener onUploadClicked = v -> {
|
||||
preferenceManager.addSyncInformation(syncInformation);
|
||||
Intent upload = new Intent(SyncInfoDetailActivity.this, UploadActivity.class);
|
||||
upload.putExtra(UploadActivity.EXTRA_SYNC_INFO_UUID, syncInformation.getUuid().toString());
|
||||
startActivity(upload);
|
||||
};
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_sync_info_detail_v2);
|
||||
setContentView(R.layout.activity_sync_info_detail);
|
||||
|
||||
preferenceManager = PreferenceManager.getInstance(SyncInfoDetailActivity.this);
|
||||
syncInformation = preferenceManager.getSyncInformation(getExtraUuid());
|
||||
syncUUID = getExtraUuid();
|
||||
syncInformation = preferenceManager.getSyncInformation(syncUUID);
|
||||
|
||||
if (syncInformation == null) {
|
||||
throw new RuntimeException("Could not find UploadInformation with UUID {" + getExtraUuid().toString() + "}");
|
||||
throw new RuntimeException("Could not find UploadInformation with UUID {" + syncUUID + "}");
|
||||
}
|
||||
|
||||
initToolbar();
|
||||
initFabMenu();
|
||||
initViews();
|
||||
populateContent();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
getMenuInflater().inflate(R.menu.menu_sync_detail, menu);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
|
||||
if (item.getItemId() == android.R.id.home) {
|
||||
onBackPressed();
|
||||
return true;
|
||||
} else if (item.getItemId() == R.id.menu_delete_sync) {
|
||||
new MaterialAlertDialogBuilder(SyncInfoDetailActivity.this)
|
||||
.setTitle("Delete Sync Locally")
|
||||
.setMessage("This will not remove the information from your MISP instance.")
|
||||
.setPositiveButton("Remove", (dialog, which) -> {
|
||||
preferenceManager.removeUploadInformation(syncUUID);
|
||||
})
|
||||
.setNegativeButton("Discard", null)
|
||||
.show();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
|
||||
if (dataLocallyChanged) {
|
||||
syncInformation.setSyncedWithRemote(false);
|
||||
}
|
||||
|
||||
preferenceManager.addSyncInformation(syncInformation);
|
||||
}
|
||||
|
||||
|
@ -82,139 +106,9 @@ public class SyncInfoDetailActivity extends AppCompatActivity {
|
|||
ab.setDisplayHomeAsUpEnabled(true);
|
||||
}
|
||||
|
||||
private void initFabMenu() {
|
||||
FloatingActionButton fab = findViewById(R.id.fab_main);
|
||||
FloatingActionButton fabUpload = findViewById(R.id.fab_upload);
|
||||
FloatingActionButton fabDownload = findViewById(R.id.fab_download);
|
||||
|
||||
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);
|
||||
|
||||
int animationSpeed = 200;
|
||||
|
||||
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) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
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);
|
||||
upload.putExtra(UploadActivity.EXTRA_SYNC_INFO_UUID, syncInformation.getUuid().toString());
|
||||
startActivity(upload);
|
||||
});
|
||||
|
||||
fabDownload.setOnClickListener(view -> {
|
||||
// TODO download content from MISP instance
|
||||
Snackbar.make(view, "Not implemented yet", Snackbar.LENGTH_LONG).show();
|
||||
});
|
||||
private void initViews() {
|
||||
FloatingActionButton uploadFab = findViewById(R.id.fab_main);
|
||||
uploadFab.setOnClickListener(onUploadClicked);
|
||||
}
|
||||
|
||||
private void populateContent() {
|
||||
|
@ -239,28 +133,28 @@ public class SyncInfoDetailActivity extends AppCompatActivity {
|
|||
allowSelfSigned.setChecked(syncInformation.getRemote().getServer().getSelfSigned());
|
||||
allowSelfSigned.setOnCheckedChangeListener((cb, b) -> {
|
||||
syncInformation.getRemote().getServer().setSelfSigned(b);
|
||||
dataLocallyChanged = true;
|
||||
syncInformation.setHasUnpublishedChanges(true);
|
||||
});
|
||||
|
||||
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;
|
||||
syncInformation.setHasUnpublishedChanges(true);
|
||||
});
|
||||
|
||||
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;
|
||||
syncInformation.setHasUnpublishedChanges(true);
|
||||
});
|
||||
|
||||
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;
|
||||
syncInformation.setHasUnpublishedChanges(true);
|
||||
});
|
||||
|
||||
// credentials
|
||||
|
|
|
@ -172,7 +172,7 @@ public class UploadActivity extends AppCompatActivity {
|
|||
server.setPull(syncInformation.getRemote().getServer().getPull());
|
||||
server.setPush(syncInformation.getRemote().getServer().getPush());
|
||||
server.setCachingEnabled(syncInformation.getRemote().getServer().getCachingEnabled());
|
||||
server.setSelfSigned(syncInformation.getRemote().getServer().getCachingEnabled());
|
||||
server.setSelfSigned(syncInformation.getRemote().getServer().getSelfSigned());
|
||||
return server;
|
||||
}
|
||||
|
||||
|
@ -259,6 +259,7 @@ public class UploadActivity extends AppCompatActivity {
|
|||
private void serverAdded(Server server) {
|
||||
if (server != null) {
|
||||
serverAction.done();
|
||||
syncInformation.setHasUnpublishedChanges(false);
|
||||
preferenceManager.addSyncInformation(syncInformation);
|
||||
} else {
|
||||
serverAction.error("Could not create Sync Server");
|
||||
|
|
|
@ -53,7 +53,7 @@ public class SyncInfoAdapter extends RecyclerView.Adapter<SyncInfoAdapter.ViewHo
|
|||
|
||||
holder.orgName.setText(item.getRemote().getOrganisation().getName());
|
||||
|
||||
if (item.isSyncedWithRemote()) {
|
||||
if (!item.getHasUnpublishedChanges()) {
|
||||
ImageViewCompat.setImageTintList(holder.syncStatus, ColorStateList.valueOf(context.getColor(R.color.status_green)));
|
||||
holder.syncStatus.setImageResource(R.drawable.ic_check_outline);
|
||||
} else {
|
||||
|
@ -61,21 +61,6 @@ public class SyncInfoAdapter extends RecyclerView.Adapter<SyncInfoAdapter.ViewHo
|
|||
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)));
|
||||
// holder.syncStatus.setImageResource(R.drawable.ic_check_outline);
|
||||
// break;
|
||||
// case FAILURE:
|
||||
// ImageViewCompat.setImageTintList(holder.syncStatus, ColorStateList.valueOf(context.getColor(R.color.status_red)));
|
||||
// holder.syncStatus.setImageResource(R.drawable.ic_error_outline);
|
||||
// break;
|
||||
// case PENDING:
|
||||
// ImageViewCompat.setImageTintList(holder.syncStatus, ColorStateList.valueOf(context.getColor(R.color.status_amber)));
|
||||
// holder.syncStatus.setImageResource(R.drawable.ic_pending);
|
||||
// break;
|
||||
// }
|
||||
|
||||
holder.rootView.setOnClickListener(view -> onRecyclerPositionClickListener.onClick(view, position));
|
||||
}
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ public class MispRestClient {
|
|||
Retrofit retrofit = new Retrofit.Builder()
|
||||
.baseUrl(url)
|
||||
.addConverterFactory(GsonConverterFactory.create())
|
||||
.client(getCustomClient(true, true, authkey))
|
||||
.client(getCustomClient(false, false, authkey))
|
||||
.build();
|
||||
|
||||
mispService = retrofit.create(MispService.class);
|
||||
|
|
|
@ -37,12 +37,16 @@ public class PreferenceManager {
|
|||
private static final String USER_ORG_INFOS = "user_org_infos";
|
||||
|
||||
private static final String SYNC_INFO = "sync_info";
|
||||
|
||||
private static final String MISP_ROLES = "misp_roles";
|
||||
|
||||
private static final String SHOW_MISPBUMP_SYNCS_ONLY = "show_mispbump_syncs_only";
|
||||
|
||||
private SharedPreferences preferences;
|
||||
private static PreferenceManager instance;
|
||||
|
||||
private List<SyncInformation> cachedSyncInformationList;
|
||||
|
||||
|
||||
private PreferenceManager(Context context) {
|
||||
preferences = context.getSharedPreferences(PREFERENCES_FILE, Context.MODE_PRIVATE);
|
||||
}
|
||||
|
@ -146,15 +150,7 @@ public class PreferenceManager {
|
|||
SharedPreferences.Editor editor = preferences.edit();
|
||||
editor.putString(USER_ORG_INFOS, encrypted);
|
||||
editor.apply();
|
||||
} catch (NoSuchPaddingException e) {
|
||||
e.printStackTrace();
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
e.printStackTrace();
|
||||
} catch (InvalidKeyException e) {
|
||||
e.printStackTrace();
|
||||
} catch (BadPaddingException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IllegalBlockSizeException e) {
|
||||
} catch (NoSuchPaddingException | NoSuchAlgorithmException | InvalidKeyException | BadPaddingException | IllegalBlockSizeException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
@ -175,17 +171,7 @@ public class PreferenceManager {
|
|||
KeyStoreWrapper keyStoreWrapper = new KeyStoreWrapper(KeyStoreWrapper.USER_ORGANISATION_INFO_ALIAS);
|
||||
String decrypted = keyStoreWrapper.decrypt(preferences.getString(USER_ORG_INFOS, ""));
|
||||
return new Gson().fromJson(decrypted, Organisation.class);
|
||||
} catch (NoSuchPaddingException e) {
|
||||
e.printStackTrace();
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
e.printStackTrace();
|
||||
} catch (InvalidAlgorithmParameterException e) {
|
||||
e.printStackTrace();
|
||||
} catch (InvalidKeyException e) {
|
||||
e.printStackTrace();
|
||||
} catch (BadPaddingException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IllegalBlockSizeException e) {
|
||||
} catch (NoSuchPaddingException | NoSuchAlgorithmException | InvalidAlgorithmParameterException | InvalidKeyException | BadPaddingException | IllegalBlockSizeException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
@ -223,8 +209,6 @@ public class PreferenceManager {
|
|||
}
|
||||
|
||||
|
||||
private List<SyncInformation> cachedSyncInformationList;
|
||||
|
||||
private void loadSyncInformationList() {
|
||||
KeyStoreWrapper ksw = new KeyStoreWrapper(KeyStoreWrapper.SYNC_INFORMATION_ALIAS);
|
||||
String storedSyncInfoString = preferences.getString(SYNC_INFO, null);
|
||||
|
@ -282,6 +266,11 @@ public class PreferenceManager {
|
|||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add or update a {@link SyncInformation} to local storage
|
||||
*
|
||||
* @param syncInformation to be added
|
||||
*/
|
||||
public void addSyncInformation(SyncInformation syncInformation) {
|
||||
if (cachedSyncInformationList == null) {
|
||||
loadSyncInformationList();
|
||||
|
@ -330,11 +319,20 @@ public class PreferenceManager {
|
|||
}
|
||||
|
||||
|
||||
public boolean getShowLocalSyncsOnly() {
|
||||
return preferences.getBoolean(SHOW_MISPBUMP_SYNCS_ONLY, true);
|
||||
}
|
||||
|
||||
public void setShowLocalSyncsOnly(boolean showLocalSyncsOnly) {
|
||||
SharedPreferences.Editor editor = preferences.edit();
|
||||
editor.putBoolean(SHOW_MISPBUMP_SYNCS_ONLY, showLocalSyncsOnly);
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
|
||||
public void clearAllData() {
|
||||
SharedPreferences.Editor editor = preferences.edit();
|
||||
|
||||
// clearServerUrl();
|
||||
// clearAutomationKey();
|
||||
clearUploadInformation();
|
||||
|
||||
editor.clear();
|
||||
|
|
|
@ -21,7 +21,7 @@ public class SyncInformation {
|
|||
private ExchangeInformation remote;
|
||||
private ExchangeInformation local;
|
||||
|
||||
private boolean syncedWithRemote;
|
||||
private boolean hasUnpublishedChanges;
|
||||
|
||||
|
||||
public SyncInformation() {
|
||||
|
@ -62,11 +62,11 @@ public class SyncInformation {
|
|||
return df.format(date);
|
||||
}
|
||||
|
||||
public void setSyncedWithRemote(boolean syncedWithRemote) {
|
||||
this.syncedWithRemote = syncedWithRemote;
|
||||
public void setHasUnpublishedChanges(boolean hasUnpublishedChanges) {
|
||||
this.hasUnpublishedChanges = hasUnpublishedChanges;
|
||||
}
|
||||
public boolean isSyncedWithRemote() {
|
||||
return syncedWithRemote;
|
||||
public boolean getHasUnpublishedChanges() {
|
||||
return hasUnpublishedChanges;
|
||||
}
|
||||
|
||||
public ExchangeInformation getRemote() {
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package lu.circl.mispbump.models.restModels;
|
||||
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
|
||||
|
@ -302,4 +304,40 @@ public class Role {
|
|||
public void setPermissionDescription(String permissionDescription) {
|
||||
this.permissionDescription = permissionDescription;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Role{" +
|
||||
"id=" + id +
|
||||
", name='" + name + '\'' +
|
||||
", created='" + created + '\'' +
|
||||
", modified='" + modified + '\'' +
|
||||
", permAdd=" + permAdd +
|
||||
", permModify=" + permModify +
|
||||
", permModifyOrg=" + permModifyOrg +
|
||||
", permPublish=" + permPublish +
|
||||
", permDelegate=" + permDelegate +
|
||||
", permSync=" + permSync +
|
||||
", permAdmin=" + permAdmin +
|
||||
", permAudit=" + permAudit +
|
||||
", permAuth=" + permAuth +
|
||||
", permSiteAdmin=" + permSiteAdmin +
|
||||
", permRegexpAccess=" + permRegexpAccess +
|
||||
", permTagger=" + permTagger +
|
||||
", permTemplate=" + permTemplate +
|
||||
", permSharingGroup=" + permSharingGroup +
|
||||
", permTagEditor=" + permTagEditor +
|
||||
", permSighting=" + permSighting +
|
||||
", permObjectTemplate=" + permObjectTemplate +
|
||||
", defaultRole=" + defaultRole +
|
||||
", memoryLimit='" + memoryLimit + '\'' +
|
||||
", maxExecutionTime='" + maxExecutionTime + '\'' +
|
||||
", restrictedToSiteAdmin=" + restrictedToSiteAdmin +
|
||||
", permPublishZmq=" + permPublishZmq +
|
||||
", permPublishKafka=" + permPublishKafka +
|
||||
", permission='" + permission + '\'' +
|
||||
", permissionDescription='" + permissionDescription + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
<?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>
|
|
@ -1,10 +0,0 @@
|
|||
<?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>
|
|
@ -1,14 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<translate
|
||||
android:fromYDelta="100%p"
|
||||
android:toYDelta="0"
|
||||
android:duration="300"
|
||||
/>
|
||||
<alpha
|
||||
android:fromAlpha="0.0"
|
||||
android:toAlpha="1.0"
|
||||
android:duration="300"
|
||||
/>
|
||||
</set>
|
|
@ -1,14 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<translate
|
||||
android:fromYDelta="0"
|
||||
android:toYDelta="-100%p"
|
||||
android:duration="300"
|
||||
/>
|
||||
<alpha
|
||||
android:fromAlpha="1.0"
|
||||
android:toAlpha="0.0"
|
||||
android:duration="300"
|
||||
/>
|
||||
</set>
|
|
@ -1,15 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<scale
|
||||
android:duration="500"
|
||||
android:fromXScale="1.0"
|
||||
android:fromYScale="0.0"
|
||||
android:pivotX="50%"
|
||||
android:pivotY="10%"
|
||||
android:toXScale="1.0"
|
||||
android:toYScale="1.0"
|
||||
/>
|
||||
|
||||
</set>
|
|
@ -1,14 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<translate
|
||||
android:fromXDelta="50%p"
|
||||
android:toXDelta="0"
|
||||
android:duration="@android:integer/config_mediumAnimTime"
|
||||
/>
|
||||
<alpha
|
||||
android:fromAlpha="0.0"
|
||||
android:toAlpha="1.0"
|
||||
android:duration="@android:integer/config_mediumAnimTime"
|
||||
/>
|
||||
</set>
|
|
@ -1,14 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<translate
|
||||
android:fromXDelta="0"
|
||||
android:toXDelta="-50%p"
|
||||
android:duration="@android:integer/config_mediumAnimTime"
|
||||
/>
|
||||
<alpha
|
||||
android:fromAlpha="1.0"
|
||||
android:toAlpha="0.0"
|
||||
android:duration="@android:integer/config_mediumAnimTime"
|
||||
/>
|
||||
</set>
|
|
@ -1,14 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<objectAnimator
|
||||
android:interpolator="@android:interpolator/accelerate_cubic"
|
||||
android:duration="300"
|
||||
android:propertyName="x"
|
||||
android:valueFrom="1000"
|
||||
android:valueTo="0"
|
||||
android:valueType="floatType"
|
||||
/>
|
||||
|
||||
</set>
|
|
@ -1,14 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<objectAnimator
|
||||
android:interpolator="@android:interpolator/accelerate_cubic"
|
||||
android:duration="300"
|
||||
android:propertyName="x"
|
||||
android:valueFrom="-1000"
|
||||
android:valueTo="0"
|
||||
android:valueType="floatType"
|
||||
/>
|
||||
|
||||
</set>
|
|
@ -1,13 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<objectAnimator
|
||||
android:duration="300"
|
||||
android:propertyName="x"
|
||||
android:valueFrom="0"
|
||||
android:valueTo="1000"
|
||||
android:valueType="floatType"
|
||||
/>
|
||||
|
||||
</set>
|
|
@ -1,13 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<objectAnimator
|
||||
android:duration="300"
|
||||
android:propertyName="x"
|
||||
android:valueFrom="0"
|
||||
android:valueTo="-1000"
|
||||
android:valueType="floatType"
|
||||
/>
|
||||
|
||||
</set>
|
|
@ -18,18 +18,11 @@
|
|||
app:popupTheme="@style/PopupTheme"/>
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||
android:id="@+id/swipeRefresh"
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||
android:id="@+id/recyclerView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recyclerView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/empty"
|
||||
|
@ -46,8 +39,6 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|end"
|
||||
android:layout_margin="16dp"
|
||||
app:backgroundTint="@color/colorAccent"
|
||||
android:tint="@color/white"
|
||||
android:src="@drawable/ic_qrcode_scan"/>
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
|
|
|
@ -134,8 +134,6 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|end"
|
||||
android:layout_margin="16dp"
|
||||
android:backgroundTint="@color/colorAccent"
|
||||
android:src="@drawable/ic_sync_black_24dp"
|
||||
android:tint="@color/white"/>
|
||||
android:src="@drawable/ic_sync_black_24dp" />
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
<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:id="@+id/rootLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".activities.SyncInfoDetailActivity"
|
||||
|
@ -129,54 +130,6 @@
|
|||
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"
|
||||
|
@ -217,108 +170,12 @@
|
|||
|
||||
</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>
|
||||
<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_cloud_upload"
|
||||
android:layout_margin="16dp"
|
||||
android:layout_gravity="bottom|end" />
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
|
@ -0,0 +1,40 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:padding="8dp"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<lu.circl.mispbump.customViews.MaterialPreferenceText
|
||||
android:id="@+id/url"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:title="URL"
|
||||
app:subtitle="0.0.0.0" />
|
||||
|
||||
<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>
|
|
@ -42,9 +42,7 @@
|
|||
app:layout_constraintEnd_toStartOf="@id/material_preference_switch"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/material_preference_title"
|
||||
tools:text="Subtitle"
|
||||
android:inAnimation="@anim/push_up_in"
|
||||
android:outAnimation="@anim/push_up_out"/>
|
||||
tools:text="Subtitle" />
|
||||
|
||||
<Switch
|
||||
android:id="@+id/material_preference_switch"
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
<item
|
||||
android:id="@+id/menu_delete_profile"
|
||||
android:icon="@drawable/ic_delete_forever"
|
||||
android:title="Delete Profile"
|
||||
/>
|
||||
android:title="Delete Profile" />
|
||||
|
||||
</menu>
|
||||
|
|
|
@ -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_sync"
|
||||
android:icon="@drawable/ic_delete_forever"
|
||||
android:title="@string/label_delete_sync" />
|
||||
|
||||
</menu>
|
|
@ -1,56 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="login">Anmelden</string>
|
||||
<string name="logout">Abmelden</string>
|
||||
<string name="menu_login_help_label">Hilfe</string>
|
||||
<string name="misp_automation_hint">MISP Automatisierungs-Schlüssel</string>
|
||||
<string name="no_information">Keine Informationen</string>
|
||||
<string name="save_automation_key_hint">Automatisierungs-Schlüssel speichern</string>
|
||||
<string name="login_help_text"><b>MISP Server URL</b>\nDie URL unter der Ihre MISP Instanz erreichbar ist.\n\n<b>MISP Automatisierungs Schlüssel</b></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>
|
||||
<string name="activity_exchange_scan_partner_qr_hint">Scannen den QR code ihres Partners</string>
|
||||
<string name="activity_exchange_continue_if_scanned">Fahren sie fort, sobald dieser QR Code gescannt wurde</string>
|
||||
<string name="button_continue">Weiter</string>
|
||||
<string name="button_prev">Zurück</string>
|
||||
<string name="nationality">Nationalität</string>
|
||||
<string name="sector">Sektor</string>
|
||||
<string name="description">Beschreibung</string>
|
||||
<string name="settings">Einstellungen</string>
|
||||
<string name="credentials">Zugangsdaten</string>
|
||||
<string name="authkey">Authentifizierungsschlüssel</string>
|
||||
<string name="password">Passwort</string>
|
||||
<string name="fragment_upload_settings_title">Diese Organisation soll die folgenden Rechte erhalten</string>
|
||||
<string name="settings_self_signed_title">Selbstsignierte Zertifikate erlauben</string>
|
||||
<string name="settings_self_signed_on">Zertifikate von unbekannten CA\'s werden akzeptiert (nicht empfohlen)</string>
|
||||
<string name="settings_self_signed_off">Nur Zertifikate von bekannten CA\'s werden akzeptiert</string>
|
||||
<string name="settings_push_off">Ereignisse und deren Attribute können nicht hochgeladen werden</string>
|
||||
<string name="settings_push_on">Ereignisse und deren Attribute können hochgeladen werden</string>
|
||||
<string name="settings_pull_off">Ereignisse und deren Attribute können nicht heruntergeladen werden</string>
|
||||
<string name="settings_pull_on">Ereignisse und deren Attribute können heruntergeladen werden</string>
|
||||
<string name="settings_cache_off">Ereignisse und deren Attribute werden nicht zwischengespeichert</string>
|
||||
<string name="settings_cache_on">Ereignisse und deren Attribute werden zwischengespeichert</string>
|
||||
<string name="settings_cache_title">Zwischenspeichern</string>
|
||||
<string name="settings_pull_title">Herunterladen</string>
|
||||
<string name="settings_push_title">Hochladen</string>
|
||||
<string name="upload">Hochladen</string>
|
||||
<string name="upload_action_available">MISP Instanz erreichbar</string>
|
||||
<string name="upload_action_add_org">Organisation hinzufügen</string>
|
||||
<string name="upload_action_add_server">Server hinzufügen</string>
|
||||
<string name="upload_action_add_user">Benutzer hinzufügen</string>
|
||||
<string name="public_key">Öffentlicher Schlüssel</string>
|
||||
<string name="scan_qr_hint">Scannen Sie den QR code ihres Partners</string>
|
||||
<string name="public_key_received_hint">Öffentlicher Schlüssel empfangen</string>
|
||||
<string name="sync_info_received_hint">Synchronisations-Informationen empfangen</string>
|
||||
<string name="sync_information">Synchronisations-Informationen</string>
|
||||
<string name="preference_delete_all_syncs">Alle Synchronisierungen löschen</string>
|
||||
<string name="preference_delete_all_syncs_summary">Die Synchronisierungen werden nur lokal gelöscht</string>
|
||||
<string name="preference_category_general">Allgemein</string>
|
||||
<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>
|
|
@ -2,6 +2,10 @@
|
|||
<resources>
|
||||
<color name="colorPrimary">#047EB4</color>
|
||||
<color name="colorPrimaryDark">#066796</color>
|
||||
|
||||
<color name="colorSecondary">#047EB4</color>
|
||||
<color name="colorOnSecondary">#FFF</color>
|
||||
|
||||
<color name="colorAccent">#12B3FA</color>
|
||||
|
||||
<color name="colorIconLight">#FFFFFF</color>
|
||||
|
|
|
@ -12,8 +12,6 @@
|
|||
<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>
|
||||
|
||||
<!-- TODO: Remove or change this placeholder text -->
|
||||
<string name="activity_exchange_scan_partner_qr_hint">Scan your partners QR code</string>
|
||||
<string name="activity_exchange_continue_if_scanned">Continue if your partner also scanned this QR code</string>
|
||||
<string name="button_continue">next</string>
|
||||
|
@ -59,4 +57,5 @@
|
|||
<string name="information">Information</string>
|
||||
<string name="upload_changes">Upload Changes</string>
|
||||
<string name="download_changes">Download Changes</string>
|
||||
<string name="label_delete_sync">Delete Synchronisation</string>
|
||||
</resources>
|
||||
|
|
|
@ -3,6 +3,10 @@
|
|||
<style name="AppTheme" parent="Theme.MaterialComponents.Light.NoActionBar">
|
||||
<item name="colorPrimary">@color/colorPrimary</item>
|
||||
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||
|
||||
<item name="colorSecondary">@color/colorSecondary</item>
|
||||
<item name="colorOnSecondary">@color/colorOnSecondary</item>
|
||||
|
||||
<item name="colorAccent">@color/colorAccent</item>
|
||||
</style>
|
||||
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PreferenceScreen
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<!-- <PreferenceCategory android:title="@string/preference_category_general">-->
|
||||
<!-- <Preference-->
|
||||
<!-- android:key="PREF_DELETE_ALL_SYNCS"-->
|
||||
<!-- android:icon="@drawable/ic_delete_forever"-->
|
||||
<!-- android:title="@string/preference_delete_all_syncs"-->
|
||||
<!-- android:summary="@string/preference_delete_all_syncs_summary"/>-->
|
||||
<!-- </PreferenceCategory>-->
|
||||
|
||||
<PreferenceCategory android:title="@string/preference_category_information">
|
||||
<Preference
|
||||
android:icon="@drawable/ic_github"
|
||||
android:title="Github"
|
||||
android:summary="@string/preference_github_summary">
|
||||
<intent
|
||||
android:action="android.intent.action.VIEW"
|
||||
android:data="https://github.com/MISP/misp-bump"/>
|
||||
</Preference>
|
||||
|
||||
<Preference
|
||||
android:icon="@drawable/ic_info_outline_dark"
|
||||
android:title="Version"
|
||||
android:summary="1.1.2"/>
|
||||
</PreferenceCategory>
|
||||
</PreferenceScreen>
|
Loading…
Reference in New Issue