mirror of https://github.com/MISP/misp-bump
remove unused settings menu
add email to sync info view change some coloring upload layoutchanges now animated (still laggy)pull/5/head
parent
4585dedc7a
commit
baba45767b
|
@ -38,7 +38,7 @@
|
||||||
</value>
|
</value>
|
||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectType">
|
<component name="ProjectType">
|
||||||
|
|
|
@ -53,10 +53,10 @@ public class HomeActivity extends AppCompatActivity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
if (item.getItemId() == R.id.menu_settings) {
|
// if (item.getItemId() == R.id.menu_settings) {
|
||||||
startActivity(new Intent(HomeActivity.this, PreferenceActivity.class));
|
// startActivity(new Intent(HomeActivity.this, PreferenceActivity.class));
|
||||||
return true;
|
// return true;
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (item.getItemId() == R.id.menu_profile) {
|
if (item.getItemId() == R.id.menu_profile) {
|
||||||
startActivity(new Intent(HomeActivity.this, ProfileActivity.class));
|
startActivity(new Intent(HomeActivity.this, ProfileActivity.class));
|
||||||
|
|
|
@ -167,14 +167,6 @@ public class UploadActivity extends AppCompatActivity {
|
||||||
preferenceManager.addUploadInformation(uploadInformation);
|
preferenceManager.addUploadInformation(uploadInformation);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Start upload to misp instance.
|
|
||||||
*/
|
|
||||||
private void startUpload() {
|
|
||||||
availableAction.setCurrentUploadState(UploadAction.UploadState.LOADING);
|
|
||||||
restClient.isAvailable(availableCallback);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private User generateSyncUser(Organisation organisation) {
|
private User generateSyncUser(Organisation organisation) {
|
||||||
User syncUser = new User();
|
User syncUser = new User();
|
||||||
|
@ -202,6 +194,14 @@ public class UploadActivity extends AppCompatActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Start upload to misp instance.
|
||||||
|
*/
|
||||||
|
private void startUpload() {
|
||||||
|
availableAction.setCurrentUploadState(UploadAction.UploadState.LOADING);
|
||||||
|
restClient.isAvailable(availableCallback);
|
||||||
|
}
|
||||||
|
|
||||||
private void mispAvailable(boolean available, String error) {
|
private void mispAvailable(boolean available, String error) {
|
||||||
if (available) {
|
if (available) {
|
||||||
availableAction.setCurrentUploadState(UploadAction.UploadState.DONE);
|
availableAction.setCurrentUploadState(UploadAction.UploadState.DONE);
|
||||||
|
@ -211,7 +211,6 @@ public class UploadActivity extends AppCompatActivity {
|
||||||
} else {
|
} else {
|
||||||
availableAction.setCurrentUploadState(UploadAction.UploadState.ERROR);
|
availableAction.setCurrentUploadState(UploadAction.UploadState.ERROR);
|
||||||
availableAction.setError(error);
|
availableAction.setError(error);
|
||||||
|
|
||||||
uploadInformation.setCurrentSyncStatus(UploadInformation.SyncStatus.FAILURE);
|
uploadInformation.setCurrentSyncStatus(UploadInformation.SyncStatus.FAILURE);
|
||||||
errorWhileUpload = true;
|
errorWhileUpload = true;
|
||||||
|
|
||||||
|
@ -234,10 +233,10 @@ public class UploadActivity extends AppCompatActivity {
|
||||||
private void organisationAdded(Organisation organisation) {
|
private void organisationAdded(Organisation organisation) {
|
||||||
if (organisation != null) {
|
if (organisation != null) {
|
||||||
orgAction.setCurrentUploadState(UploadAction.UploadState.DONE);
|
orgAction.setCurrentUploadState(UploadAction.UploadState.DONE);
|
||||||
|
|
||||||
uploadInformation.getRemote().organisation.id = organisation.id;
|
uploadInformation.getRemote().organisation.id = organisation.id;
|
||||||
restClient.addUser(generateSyncUser(organisation), userCallback);
|
restClient.addUser(generateSyncUser(organisation), userCallback);
|
||||||
} else {
|
} else {
|
||||||
|
// search by UUID because the error does not give the actual ID
|
||||||
restClient.getOrganisation(uploadInformation.getRemote().organisation.uuid, new MispRestClient.OrganisationCallback() {
|
restClient.getOrganisation(uploadInformation.getRemote().organisation.uuid, new MispRestClient.OrganisationCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void success(Organisation organisation) {
|
public void success(Organisation organisation) {
|
||||||
|
@ -260,7 +259,6 @@ public class UploadActivity extends AppCompatActivity {
|
||||||
userAction.setCurrentUploadState(UploadAction.UploadState.DONE);
|
userAction.setCurrentUploadState(UploadAction.UploadState.DONE);
|
||||||
restClient.getAllServers(allServersCallback);
|
restClient.getAllServers(allServersCallback);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
restClient.getUser(uploadInformation.getRemote().syncUserEmail, new MispRestClient.UserCallback() {
|
restClient.getUser(uploadInformation.getRemote().syncUserEmail, new MispRestClient.UserCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void success(User user) {
|
public void success(User user) {
|
||||||
|
@ -279,17 +277,21 @@ public class UploadActivity extends AppCompatActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void allServersReceived(Server[] servers) {
|
private void allServersReceived(Server[] servers) {
|
||||||
|
if (servers != null) {
|
||||||
Server serverToUpload = generateSyncServer();
|
Server serverToUpload = generateSyncServer();
|
||||||
|
|
||||||
for (Server server : servers) {
|
for (Server server : servers) {
|
||||||
if (server.remote_org_id.equals(serverToUpload.remote_org_id)) {
|
if (server.remote_org_id.equals(serverToUpload.remote_org_id)) {
|
||||||
// server already exists
|
// server already exists: override id to update instead
|
||||||
serverToUpload.id = server.id;
|
serverToUpload.id = server.id;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
restClient.addServer(serverToUpload, serverCallback);
|
restClient.addServer(serverToUpload, serverCallback);
|
||||||
|
} else {
|
||||||
|
serverAction.setCurrentUploadState(UploadAction.UploadState.ERROR);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void serverAdded(Server server) {
|
private void serverAdded(Server server) {
|
||||||
|
@ -304,5 +306,4 @@ public class UploadActivity extends AppCompatActivity {
|
||||||
errorWhileUpload = true;
|
errorWhileUpload = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@ import com.google.android.material.tabs.TabLayout;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import lu.circl.mispbump.R;
|
import lu.circl.mispbump.R;
|
||||||
|
import lu.circl.mispbump.auxiliary.DialogManager;
|
||||||
import lu.circl.mispbump.auxiliary.PreferenceManager;
|
import lu.circl.mispbump.auxiliary.PreferenceManager;
|
||||||
import lu.circl.mispbump.fragments.UploadCredentialsFragment;
|
import lu.circl.mispbump.fragments.UploadCredentialsFragment;
|
||||||
import lu.circl.mispbump.fragments.UploadSettingsFragment;
|
import lu.circl.mispbump.fragments.UploadSettingsFragment;
|
||||||
|
@ -83,7 +84,17 @@ public class UploadInfoActivity extends AppCompatActivity {
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
switch (item.getItemId()) {
|
switch (item.getItemId()) {
|
||||||
case R.id.delete:
|
case R.id.delete:
|
||||||
// TODO delete
|
DialogManager.deleteSyncInformationDialog(UploadInfoActivity.this, new DialogManager.IDialogFeedback() {
|
||||||
|
@Override
|
||||||
|
public void positive() {
|
||||||
|
preferenceManager.removeUploadInformation(uploadInformation.getUuid());
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void negative() {}
|
||||||
|
});
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case android.R.id.home:
|
case android.R.id.home:
|
||||||
|
|
|
@ -48,6 +48,9 @@ public class UploadCredentialsFragment extends Fragment {
|
||||||
MaterialPreferenceText baseUrl = v.findViewById(R.id.baseUrl);
|
MaterialPreferenceText baseUrl = v.findViewById(R.id.baseUrl);
|
||||||
baseUrl.setSubtitle(uploadInformation.getRemote().baseUrl);
|
baseUrl.setSubtitle(uploadInformation.getRemote().baseUrl);
|
||||||
|
|
||||||
|
MaterialPreferenceText email = v.findViewById(R.id.email);
|
||||||
|
email.setSubtitle(uploadInformation.getLocal().syncUserEmail);
|
||||||
|
|
||||||
MaterialPasswordView authkey = v.findViewById(R.id.authkey);
|
MaterialPasswordView authkey = v.findViewById(R.id.authkey);
|
||||||
authkey.setPassword(uploadInformation.getRemote().syncUserAuthkey);
|
authkey.setPassword(uploadInformation.getRemote().syncUserAuthkey);
|
||||||
authkey.addOnCopyClickedListener(onCopyClickListener);
|
authkey.addOnCopyClickedListener(onCopyClickListener);
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:id="@+id/rootLayout"
|
android:id="@+id/rootLayout"
|
||||||
|
@ -26,8 +25,8 @@
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:gravity="center_vertical"
|
||||||
android:gravity="center_vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/qrCode"
|
android:id="@+id/qrCode"
|
||||||
|
@ -44,7 +43,7 @@
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:padding="8dp"
|
android:padding="8dp"
|
||||||
android:text="Scan your partners QR code"
|
android:text="Scan your partners QR code"
|
||||||
android:textColor="@color/colorPrimaryDark"/>
|
android:textColor="@color/black" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/qrInfoStatic"
|
android:id="@+id/qrInfoStatic"
|
||||||
|
@ -52,12 +51,12 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:drawableStart="@drawable/ic_info_outline"
|
android:drawableStart="@drawable/ic_info_outline"
|
||||||
android:drawablePadding="8dp"
|
android:drawablePadding="8dp"
|
||||||
android:drawableTint="@color/colorPrimaryDark"
|
android:drawableTint="@color/colorIconDark"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:padding="8dp"
|
|
||||||
android:lines="2"
|
android:lines="2"
|
||||||
|
android:padding="8dp"
|
||||||
android:text="Continue if your partner also scanned this QR code"
|
android:text="Continue if your partner also scanned this QR code"
|
||||||
android:textColor="@color/colorPrimaryDark"/>
|
android:textColor="@color/black" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:paddingBottom="32dp">
|
android:clipToPadding="false">
|
||||||
|
|
||||||
<lu.circl.mispbump.customViews.MaterialPreferenceText
|
<lu.circl.mispbump.customViews.MaterialPreferenceText
|
||||||
android:id="@+id/baseUrl"
|
android:id="@+id/baseUrl"
|
||||||
|
@ -21,6 +21,24 @@
|
||||||
app:subtitle="www.google.de"
|
app:subtitle="www.google.de"
|
||||||
app:title="Base URL"/>
|
app:title="Base URL"/>
|
||||||
|
|
||||||
|
<lu.circl.mispbump.customViews.MaterialPreferenceText
|
||||||
|
android:id="@+id/email"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:background="@color/white"
|
||||||
|
app:subtitle="syncuser_orga@mispx.yz"
|
||||||
|
app:title="Email"/>
|
||||||
|
|
||||||
|
<lu.circl.mispbump.customViews.MaterialPasswordView
|
||||||
|
android:id="@+id/password"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:background="@color/white"
|
||||||
|
app:title="Password"
|
||||||
|
app:password="abc"/>
|
||||||
|
|
||||||
<lu.circl.mispbump.customViews.MaterialPasswordView
|
<lu.circl.mispbump.customViews.MaterialPasswordView
|
||||||
android:id="@+id/authkey"
|
android:id="@+id/authkey"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -29,15 +47,5 @@
|
||||||
android:background="@color/white"
|
android:background="@color/white"
|
||||||
app:title="Authkey"
|
app:title="Authkey"
|
||||||
app:password="abc"/>
|
app:password="abc"/>
|
||||||
|
|
||||||
<lu.circl.mispbump.customViews.MaterialPasswordView
|
|
||||||
android:id="@+id/password"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="8dp"
|
|
||||||
android:background="@color/white"
|
|
||||||
android:elevation="4dp"
|
|
||||||
app:title="Password"
|
|
||||||
app:password="abc"/>
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</ScrollView>
|
</ScrollView>
|
|
@ -1,8 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<LinearLayout
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
|
@ -19,7 +19,7 @@
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
android:background="?attr/selectableItemBackgroundBorderless"
|
android:background="?attr/selectableItemBackgroundBorderless"
|
||||||
android:src="@drawable/ic_eye"
|
android:src="@drawable/ic_eye"
|
||||||
android:tint="@color/colorPrimaryDark"
|
android:tint="@color/colorIconDark"
|
||||||
app:layout_constraintBottom_toBottomOf="@+id/material_password"
|
app:layout_constraintBottom_toBottomOf="@+id/material_password"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
@ -31,7 +31,7 @@
|
||||||
android:layout_marginEnd="8dp"
|
android:layout_marginEnd="8dp"
|
||||||
android:background="?attr/selectableItemBackgroundBorderless"
|
android:background="?attr/selectableItemBackgroundBorderless"
|
||||||
android:src="@drawable/ic_file_copy"
|
android:src="@drawable/ic_file_copy"
|
||||||
android:tint="@color/colorPrimaryDark"
|
android:tint="@color/colorIconDark"
|
||||||
app:layout_constraintBottom_toBottomOf="@+id/material_password"
|
app:layout_constraintBottom_toBottomOf="@+id/material_password"
|
||||||
app:layout_constraintEnd_toStartOf="@id/visibleToggle"
|
app:layout_constraintEnd_toStartOf="@id/visibleToggle"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
android:layout_marginStart="16dp"
|
android:layout_marginStart="16dp"
|
||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="8dp"
|
||||||
android:layout_marginBottom="8dp"
|
android:layout_marginBottom="8dp"
|
||||||
android:tint="@color/colorPrimaryDark"
|
android:tint="@color/colorIconDark"
|
||||||
app:layout_constraintBottom_toBottomOf="@+id/material_preference_subtitle"
|
app:layout_constraintBottom_toBottomOf="@+id/material_preference_subtitle"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="@+id/material_preference_title"
|
app:layout_constraintTop_toTopOf="@+id/material_preference_title"
|
||||||
|
|
|
@ -6,7 +6,8 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:padding="16dp"
|
android:padding="16dp"
|
||||||
android:foreground="?attr/selectableItemBackgroundBorderless">
|
android:foreground="?attr/selectableItemBackgroundBorderless"
|
||||||
|
android:animateLayoutChanges="true">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/stateView"
|
android:id="@+id/stateView"
|
||||||
|
@ -31,10 +32,11 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="2dp"
|
android:layout_marginTop="2dp"
|
||||||
android:layout_marginEnd="16dp"
|
android:layout_marginEnd="16dp"
|
||||||
|
android:textAppearance="@style/AppTheme.TextAppearance.ListTitle"
|
||||||
app:layout_constraintEnd_toStartOf="@+id/stateView"
|
app:layout_constraintEnd_toStartOf="@+id/stateView"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
tools:text="Title (upload action)" />
|
tools:text="Add Organisation" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
|
@ -42,8 +44,9 @@
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="8dp"
|
||||||
|
android:textAppearance="@style/AppTheme.TextAppearance.ListSubtitle"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/title"
|
app:layout_constraintTop_toBottomOf="@+id/title"
|
||||||
tools:text="Error" />
|
tools:text="Organisation B added successfully" />
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -8,9 +8,9 @@
|
||||||
android:title="Profile"
|
android:title="Profile"
|
||||||
app:showAsAction="ifRoom"/>
|
app:showAsAction="ifRoom"/>
|
||||||
|
|
||||||
<item
|
<!--<item-->
|
||||||
android:id="@+id/menu_settings"
|
<!--android:id="@+id/menu_settings"-->
|
||||||
android:icon="@drawable/ic_settings"
|
<!--android:icon="@drawable/ic_settings"-->
|
||||||
android:title="Settings"
|
<!--android:title="Settings"-->
|
||||||
app:showAsAction="never"/>
|
<!--app:showAsAction="never"/>-->
|
||||||
</menu>
|
</menu>
|
|
@ -1,9 +1,12 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<color name="colorPrimary">#047EB4</color>
|
<color name="colorPrimary">#047EB4</color>
|
||||||
<color name="colorPrimaryDark">#023850</color>
|
<color name="colorPrimaryDark">#066796</color>
|
||||||
<color name="colorAccent">#12B3FA</color>
|
<color name="colorAccent">#12B3FA</color>
|
||||||
|
|
||||||
|
<color name="colorIconLight">#FFFFFF</color>
|
||||||
|
<color name="colorIconDark">#023850</color>
|
||||||
|
|
||||||
<color name="dividerColor">#33000000</color>
|
<color name="dividerColor">#33000000</color>
|
||||||
|
|
||||||
<color name="white">#FFFFFF</color>
|
<color name="white">#FFFFFF</color>
|
||||||
|
|
Loading…
Reference in New Issue