add dialog to delete sync option

add colors for new fabs
pull/9/head
Felix Prahl-Kamps 2019-10-14 11:30:13 +02:00
parent a1c3a37a32
commit 5494cf3d45
10 changed files with 87 additions and 9 deletions

View File

@ -43,6 +43,29 @@ public class HomeActivity extends AppCompatActivity {
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

View File

@ -12,6 +12,7 @@ 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 java.util.UUID;
@ -66,12 +67,22 @@ public class SyncInfoDetailActivity extends AppCompatActivity {
@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
// preferenceManager.removeUploadInformation(syncUUID);
if (item.getItemId() == android.R.id.home) {
onBackPressed();
return true;
} else return item.getItemId() == R.id.menu_delete_sync;
} 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

View File

@ -39,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>

View File

@ -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>

View File

@ -175,7 +175,6 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_cloud_upload"
android:tint="@color/white"
android:layout_margin="16dp"
android:layout_gravity="bottom|end" />

View File

@ -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>

View File

@ -4,6 +4,6 @@
<item
android:id="@+id/menu_delete_sync"
android:icon="@drawable/ic_delete_forever"
android:title="Delete Synchronisation" />
android:title="@string/label_delete_sync" />
</menu>

View File

@ -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>

View File

@ -57,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>

View File

@ -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>