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>
|
||||
</option>
|
||||
</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" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
|
|
|
@ -53,10 +53,10 @@ public class HomeActivity extends AppCompatActivity {
|
|||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
if (item.getItemId() == R.id.menu_settings) {
|
||||
startActivity(new Intent(HomeActivity.this, PreferenceActivity.class));
|
||||
return true;
|
||||
}
|
||||
// if (item.getItemId() == R.id.menu_settings) {
|
||||
// startActivity(new Intent(HomeActivity.this, PreferenceActivity.class));
|
||||
// return true;
|
||||
// }
|
||||
|
||||
if (item.getItemId() == R.id.menu_profile) {
|
||||
startActivity(new Intent(HomeActivity.this, ProfileActivity.class));
|
||||
|
|
|
@ -167,14 +167,6 @@ public class UploadActivity extends AppCompatActivity {
|
|||
preferenceManager.addUploadInformation(uploadInformation);
|
||||
}
|
||||
|
||||
/**
|
||||
* Start upload to misp instance.
|
||||
*/
|
||||
private void startUpload() {
|
||||
availableAction.setCurrentUploadState(UploadAction.UploadState.LOADING);
|
||||
restClient.isAvailable(availableCallback);
|
||||
}
|
||||
|
||||
|
||||
private User generateSyncUser(Organisation organisation) {
|
||||
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) {
|
||||
if (available) {
|
||||
availableAction.setCurrentUploadState(UploadAction.UploadState.DONE);
|
||||
|
@ -211,7 +211,6 @@ public class UploadActivity extends AppCompatActivity {
|
|||
} else {
|
||||
availableAction.setCurrentUploadState(UploadAction.UploadState.ERROR);
|
||||
availableAction.setError(error);
|
||||
|
||||
uploadInformation.setCurrentSyncStatus(UploadInformation.SyncStatus.FAILURE);
|
||||
errorWhileUpload = true;
|
||||
|
||||
|
@ -234,10 +233,10 @@ public class UploadActivity extends AppCompatActivity {
|
|||
private void organisationAdded(Organisation organisation) {
|
||||
if (organisation != null) {
|
||||
orgAction.setCurrentUploadState(UploadAction.UploadState.DONE);
|
||||
|
||||
uploadInformation.getRemote().organisation.id = organisation.id;
|
||||
restClient.addUser(generateSyncUser(organisation), userCallback);
|
||||
} else {
|
||||
// search by UUID because the error does not give the actual ID
|
||||
restClient.getOrganisation(uploadInformation.getRemote().organisation.uuid, new MispRestClient.OrganisationCallback() {
|
||||
@Override
|
||||
public void success(Organisation organisation) {
|
||||
|
@ -260,7 +259,6 @@ public class UploadActivity extends AppCompatActivity {
|
|||
userAction.setCurrentUploadState(UploadAction.UploadState.DONE);
|
||||
restClient.getAllServers(allServersCallback);
|
||||
} else {
|
||||
|
||||
restClient.getUser(uploadInformation.getRemote().syncUserEmail, new MispRestClient.UserCallback() {
|
||||
@Override
|
||||
public void success(User user) {
|
||||
|
@ -279,17 +277,21 @@ public class UploadActivity extends AppCompatActivity {
|
|||
}
|
||||
|
||||
private void allServersReceived(Server[] servers) {
|
||||
if (servers != null) {
|
||||
Server serverToUpload = generateSyncServer();
|
||||
|
||||
for (Server server : servers) {
|
||||
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;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
restClient.addServer(serverToUpload, serverCallback);
|
||||
} else {
|
||||
serverAction.setCurrentUploadState(UploadAction.UploadState.ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
private void serverAdded(Server server) {
|
||||
|
@ -304,5 +306,4 @@ public class UploadActivity extends AppCompatActivity {
|
|||
errorWhileUpload = true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ import com.google.android.material.tabs.TabLayout;
|
|||
import java.util.UUID;
|
||||
|
||||
import lu.circl.mispbump.R;
|
||||
import lu.circl.mispbump.auxiliary.DialogManager;
|
||||
import lu.circl.mispbump.auxiliary.PreferenceManager;
|
||||
import lu.circl.mispbump.fragments.UploadCredentialsFragment;
|
||||
import lu.circl.mispbump.fragments.UploadSettingsFragment;
|
||||
|
@ -83,7 +84,17 @@ public class UploadInfoActivity extends AppCompatActivity {
|
|||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
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;
|
||||
|
||||
case android.R.id.home:
|
||||
|
|
|
@ -48,6 +48,9 @@ public class UploadCredentialsFragment extends Fragment {
|
|||
MaterialPreferenceText baseUrl = v.findViewById(R.id.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);
|
||||
authkey.setPassword(uploadInformation.getRemote().syncUserAuthkey);
|
||||
authkey.addOnCopyClickedListener(onCopyClickListener);
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<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"
|
||||
|
@ -26,8 +25,8 @@
|
|||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center_vertical">
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/qrCode"
|
||||
|
@ -44,7 +43,7 @@
|
|||
android:gravity="center_vertical"
|
||||
android:padding="8dp"
|
||||
android:text="Scan your partners QR code"
|
||||
android:textColor="@color/colorPrimaryDark"/>
|
||||
android:textColor="@color/black" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/qrInfoStatic"
|
||||
|
@ -52,12 +51,12 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:drawableStart="@drawable/ic_info_outline"
|
||||
android:drawablePadding="8dp"
|
||||
android:drawableTint="@color/colorPrimaryDark"
|
||||
android:drawableTint="@color/colorIconDark"
|
||||
android:gravity="center_vertical"
|
||||
android:padding="8dp"
|
||||
android:lines="2"
|
||||
android:padding="8dp"
|
||||
android:text="Continue if your partner also scanned this QR code"
|
||||
android:textColor="@color/colorPrimaryDark"/>
|
||||
android:textColor="@color/black" />
|
||||
|
||||
</LinearLayout>
|
||||
</FrameLayout>
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="32dp">
|
||||
android:clipToPadding="false">
|
||||
|
||||
<lu.circl.mispbump.customViews.MaterialPreferenceText
|
||||
android:id="@+id/baseUrl"
|
||||
|
@ -21,6 +21,24 @@
|
|||
app:subtitle="www.google.de"
|
||||
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
|
||||
android:id="@+id/authkey"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -29,15 +47,5 @@
|
|||
android:background="@color/white"
|
||||
app:title="Authkey"
|
||||
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>
|
||||
</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:background="?attr/selectableItemBackgroundBorderless"
|
||||
android:src="@drawable/ic_eye"
|
||||
android:tint="@color/colorPrimaryDark"
|
||||
android:tint="@color/colorIconDark"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/material_password"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
@ -31,7 +31,7 @@
|
|||
android:layout_marginEnd="8dp"
|
||||
android:background="?attr/selectableItemBackgroundBorderless"
|
||||
android:src="@drawable/ic_file_copy"
|
||||
android:tint="@color/colorPrimaryDark"
|
||||
android:tint="@color/colorIconDark"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/material_password"
|
||||
app:layout_constraintEnd_toStartOf="@id/visibleToggle"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:tint="@color/colorPrimaryDark"
|
||||
android:tint="@color/colorIconDark"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/material_preference_subtitle"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/material_preference_title"
|
||||
|
|
|
@ -6,7 +6,8 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="16dp"
|
||||
android:foreground="?attr/selectableItemBackgroundBorderless">
|
||||
android:foreground="?attr/selectableItemBackgroundBorderless"
|
||||
android:animateLayoutChanges="true">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/stateView"
|
||||
|
@ -31,10 +32,11 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="2dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:textAppearance="@style/AppTheme.TextAppearance.ListTitle"
|
||||
app:layout_constraintEnd_toStartOf="@+id/stateView"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="Title (upload action)" />
|
||||
tools:text="Add Organisation" />
|
||||
|
||||
<TextView
|
||||
android:visibility="gone"
|
||||
|
@ -42,8 +44,9 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:textAppearance="@style/AppTheme.TextAppearance.ListSubtitle"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/title"
|
||||
tools:text="Error" />
|
||||
tools:text="Organisation B added successfully" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -8,9 +8,9 @@
|
|||
android:title="Profile"
|
||||
app:showAsAction="ifRoom"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_settings"
|
||||
android:icon="@drawable/ic_settings"
|
||||
android:title="Settings"
|
||||
app:showAsAction="never"/>
|
||||
<!--<item-->
|
||||
<!--android:id="@+id/menu_settings"-->
|
||||
<!--android:icon="@drawable/ic_settings"-->
|
||||
<!--android:title="Settings"-->
|
||||
<!--app:showAsAction="never"/>-->
|
||||
</menu>
|
|
@ -1,9 +1,12 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="colorPrimary">#047EB4</color>
|
||||
<color name="colorPrimaryDark">#023850</color>
|
||||
<color name="colorPrimaryDark">#066796</color>
|
||||
<color name="colorAccent">#12B3FA</color>
|
||||
|
||||
<color name="colorIconLight">#FFFFFF</color>
|
||||
<color name="colorIconDark">#023850</color>
|
||||
|
||||
<color name="dividerColor">#33000000</color>
|
||||
|
||||
<color name="white">#FFFFFF</color>
|
||||
|
|
Loading…
Reference in New Issue