This commit is contained in:
parent
4ac58eed77
commit
b4c068d730
@ -17,8 +17,11 @@
|
|||||||
*/
|
*/
|
||||||
package net.schueller.peertube.activity;
|
package net.schueller.peertube.activity;
|
||||||
|
|
||||||
|
import android.app.AlertDialog;
|
||||||
|
import android.content.DialogInterface;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.provider.SearchRecentSuggestions;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
@ -44,6 +47,7 @@ import net.schueller.peertube.adapter.ServerListAdapter;
|
|||||||
import net.schueller.peertube.database.Server;
|
import net.schueller.peertube.database.Server;
|
||||||
import net.schueller.peertube.database.ServerViewModel;
|
import net.schueller.peertube.database.ServerViewModel;
|
||||||
import net.schueller.peertube.fragment.AddServerFragment;
|
import net.schueller.peertube.fragment.AddServerFragment;
|
||||||
|
import net.schueller.peertube.provider.SearchSuggestionsProvider;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -118,13 +122,25 @@ public class ServerAddressBookActivity extends CommonActivity implements AddServ
|
|||||||
@Override
|
@Override
|
||||||
public void onSwiped(@NonNull RecyclerView.ViewHolder viewHolder,
|
public void onSwiped(@NonNull RecyclerView.ViewHolder viewHolder,
|
||||||
int direction) {
|
int direction) {
|
||||||
|
|
||||||
|
|
||||||
|
new AlertDialog.Builder(ServerAddressBookActivity.this)
|
||||||
|
.setTitle(getString(R.string.server_book_del_alert_title))
|
||||||
|
.setMessage(getString(R.string.server_book_del_alert_msg))
|
||||||
|
.setPositiveButton(android.R.string.yes, (dialog, which) -> {
|
||||||
int position = viewHolder.getAdapterPosition();
|
int position = viewHolder.getAdapterPosition();
|
||||||
Server server = adapter.getServerAtPosition(position);
|
Server server = adapter.getServerAtPosition(position);
|
||||||
Toast.makeText(ServerAddressBookActivity.this, "Deleting " +
|
// Toast.makeText(ServerAddressBookActivity.this, "Deleting " +
|
||||||
server.getServerName(), Toast.LENGTH_LONG).show();
|
// server.getServerName(), Toast.LENGTH_LONG).show();
|
||||||
|
|
||||||
// Delete the server
|
// Delete the server
|
||||||
mServerViewModel.delete(server);
|
mServerViewModel.delete(server);
|
||||||
|
})
|
||||||
|
.setNegativeButton(android.R.string.no, (dialog, which) -> {
|
||||||
|
adapter.notifyItemChanged(viewHolder.getAdapterPosition());
|
||||||
|
})
|
||||||
|
.setIcon(android.R.drawable.ic_dialog_alert)
|
||||||
|
.show();
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
helper.attachToRecyclerView(recyclerView);
|
helper.attachToRecyclerView(recyclerView);
|
||||||
|
@ -361,6 +361,8 @@
|
|||||||
<string name="pref_token_type" translatable="false">pref_token_type</string>
|
<string name="pref_token_type" translatable="false">pref_token_type</string>
|
||||||
<string name="pref_auth_username" translatable="false">pref_auth_username</string>
|
<string name="pref_auth_username" translatable="false">pref_auth_username</string>
|
||||||
<string name="pref_auth_password" translatable="false">pref_auth_password</string>
|
<string name="pref_auth_password" translatable="false">pref_auth_password</string>
|
||||||
|
<string name="server_book_del_alert_title">Remove Server</string>
|
||||||
|
<string name="server_book_del_alert_msg">Are you sure you want to remove this server from the address book?</string>
|
||||||
|
|
||||||
<!-- TODO: Remove or change this placeholder text -->
|
<!-- TODO: Remove or change this placeholder text -->
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user