clipboard: Confirmation dialog for history entries

This commit is contained in:
Jules Aguillon 2024-06-29 23:06:24 +02:00
parent 8d29d80fce
commit 2f8a2917a2
19 changed files with 42 additions and 35 deletions

View File

@ -117,6 +117,6 @@ Tato aplikace neobsahuje žádné reklamy, nevyužívá připojení k síti a je
<string name="key_descr_end">End</string> <string name="key_descr_end">End</string>
<!-- <string name="clipboard_history_heading">Recently copied text</string> --> <!-- <string name="clipboard_history_heading">Recently copied text</string> -->
<!-- <string name="clipboard_pin_heading">Pinned</string> --> <!-- <string name="clipboard_pin_heading">Pinned</string> -->
<!-- <string name="clipboard_remove_confirm">Remove this saved clipboard?</string> --> <!-- <string name="clipboard_remove_confirm">Remove this clipboard?</string> -->
<!-- <string name="clipboard_remove_confirmed">Yes</string> --> <!-- <string name="clipboard_remove_confirmed">Yes</string> -->
</resources> </resources>

View File

@ -117,6 +117,6 @@ Diese App enthält keine Werbung, benötigt keinen Netzwerkzugriff und ist quell
<string name="key_descr_end">Ende</string> <string name="key_descr_end">Ende</string>
<!-- <string name="clipboard_history_heading">Recently copied text</string> --> <!-- <string name="clipboard_history_heading">Recently copied text</string> -->
<!-- <string name="clipboard_pin_heading">Pinned</string> --> <!-- <string name="clipboard_pin_heading">Pinned</string> -->
<!-- <string name="clipboard_remove_confirm">Remove this saved clipboard?</string> --> <!-- <string name="clipboard_remove_confirm">Remove this clipboard?</string> -->
<!-- <string name="clipboard_remove_confirmed">Yes</string> --> <!-- <string name="clipboard_remove_confirmed">Yes</string> -->
</resources> </resources>

View File

@ -117,6 +117,6 @@ La misma no contiene ningún anuncio/publicidad, no realiza peticiones de red y
<string name="key_descr_end">Fin</string> <string name="key_descr_end">Fin</string>
<!-- <string name="clipboard_history_heading">Recently copied text</string> --> <!-- <string name="clipboard_history_heading">Recently copied text</string> -->
<!-- <string name="clipboard_pin_heading">Pinned</string> --> <!-- <string name="clipboard_pin_heading">Pinned</string> -->
<!-- <string name="clipboard_remove_confirm">Remove this saved clipboard?</string> --> <!-- <string name="clipboard_remove_confirm">Remove this clipboard?</string> -->
<!-- <string name="clipboard_remove_confirmed">Yes</string> --> <!-- <string name="clipboard_remove_confirmed">Yes</string> -->
</resources> </resources>

View File

@ -117,6 +117,6 @@ This application contains no ads, doesn't make any network requests and is Open
<!-- <string name="key_descr_end">End</string> --> <!-- <string name="key_descr_end">End</string> -->
<!-- <string name="clipboard_history_heading">Recently copied text</string> --> <!-- <string name="clipboard_history_heading">Recently copied text</string> -->
<!-- <string name="clipboard_pin_heading">Pinned</string> --> <!-- <string name="clipboard_pin_heading">Pinned</string> -->
<!-- <string name="clipboard_remove_confirm">Remove this saved clipboard?</string> --> <!-- <string name="clipboard_remove_confirm">Remove this clipboard?</string> -->
<!-- <string name="clipboard_remove_confirmed">Yes</string> --> <!-- <string name="clipboard_remove_confirmed">Yes</string> -->
</resources> </resources>

View File

@ -117,6 +117,6 @@ Cette application ne contient pas de publicité, n'accède pas au réseau et est
<string name="key_descr_end">Fin</string> <string name="key_descr_end">Fin</string>
<!-- <string name="clipboard_history_heading">Recently copied text</string> --> <!-- <string name="clipboard_history_heading">Recently copied text</string> -->
<!-- <string name="clipboard_pin_heading">Pinned</string> --> <!-- <string name="clipboard_pin_heading">Pinned</string> -->
<!-- <string name="clipboard_remove_confirm">Remove this saved clipboard?</string> --> <!-- <string name="clipboard_remove_confirm">Remove this clipboard?</string> -->
<!-- <string name="clipboard_remove_confirmed">Yes</string> --> <!-- <string name="clipboard_remove_confirmed">Yes</string> -->
</resources> </resources>

View File

@ -117,6 +117,6 @@ This application contains no ads, doesn't make any network requests and is Open
<!-- <string name="key_descr_end">End</string> --> <!-- <string name="key_descr_end">End</string> -->
<!-- <string name="clipboard_history_heading">Recently copied text</string> --> <!-- <string name="clipboard_history_heading">Recently copied text</string> -->
<!-- <string name="clipboard_pin_heading">Pinned</string> --> <!-- <string name="clipboard_pin_heading">Pinned</string> -->
<!-- <string name="clipboard_remove_confirm">Remove this saved clipboard?</string> --> <!-- <string name="clipboard_remove_confirm">Remove this clipboard?</string> -->
<!-- <string name="clipboard_remove_confirmed">Yes</string> --> <!-- <string name="clipboard_remove_confirmed">Yes</string> -->
</resources> </resources>

View File

@ -117,6 +117,6 @@ This application contains no ads, doesn't make any network requests and is Open
<!-- <string name="key_descr_end">End</string> --> <!-- <string name="key_descr_end">End</string> -->
<!-- <string name="clipboard_history_heading">Recently copied text</string> --> <!-- <string name="clipboard_history_heading">Recently copied text</string> -->
<!-- <string name="clipboard_pin_heading">Pinned</string> --> <!-- <string name="clipboard_pin_heading">Pinned</string> -->
<!-- <string name="clipboard_remove_confirm">Remove this saved clipboard?</string> --> <!-- <string name="clipboard_remove_confirm">Remove this clipboard?</string> -->
<!-- <string name="clipboard_remove_confirmed">Yes</string> --> <!-- <string name="clipboard_remove_confirmed">Yes</string> -->
</resources> </resources>

View File

@ -119,6 +119,6 @@ Tagad lieliski piemērota izmantošanai ikdienā.
<string name="key_descr_end">Beigas</string> <string name="key_descr_end">Beigas</string>
<!-- <string name="clipboard_history_heading">Recently copied text</string> --> <!-- <string name="clipboard_history_heading">Recently copied text</string> -->
<!-- <string name="clipboard_pin_heading">Pinned</string> --> <!-- <string name="clipboard_pin_heading">Pinned</string> -->
<!-- <string name="clipboard_remove_confirm">Remove this saved clipboard?</string> --> <!-- <string name="clipboard_remove_confirm">Remove this clipboard?</string> -->
<!-- <string name="clipboard_remove_confirmed">Yes</string> --> <!-- <string name="clipboard_remove_confirmed">Yes</string> -->
</resources> </resources>

View File

@ -117,6 +117,6 @@ Aplikacja nie zawiera reklam, nie żąda dostępu do internetu, a jej kod źród
<string name="key_descr_end">End</string> <string name="key_descr_end">End</string>
<!-- <string name="clipboard_history_heading">Recently copied text</string> --> <!-- <string name="clipboard_history_heading">Recently copied text</string> -->
<!-- <string name="clipboard_pin_heading">Pinned</string> --> <!-- <string name="clipboard_pin_heading">Pinned</string> -->
<!-- <string name="clipboard_remove_confirm">Remove this saved clipboard?</string> --> <!-- <string name="clipboard_remove_confirm">Remove this clipboard?</string> -->
<!-- <string name="clipboard_remove_confirmed">Yes</string> --> <!-- <string name="clipboard_remove_confirmed">Yes</string> -->
</resources> </resources>

View File

@ -117,6 +117,6 @@ Este aplicativo não contém anúncios, não faz nenhuma solicitação de rede e
<string name="key_descr_end">End</string> <string name="key_descr_end">End</string>
<!-- <string name="clipboard_history_heading">Recently copied text</string> --> <!-- <string name="clipboard_history_heading">Recently copied text</string> -->
<!-- <string name="clipboard_pin_heading">Pinned</string> --> <!-- <string name="clipboard_pin_heading">Pinned</string> -->
<!-- <string name="clipboard_remove_confirm">Remove this saved clipboard?</string> --> <!-- <string name="clipboard_remove_confirm">Remove this clipboard?</string> -->
<!-- <string name="clipboard_remove_confirmed">Yes</string> --> <!-- <string name="clipboard_remove_confirmed">Yes</string> -->
</resources> </resources>

View File

@ -117,6 +117,6 @@ Această aplicație nu conține publicitate, nu folosește rețeaua deloc și e
<!-- <string name="key_descr_end">End</string> --> <!-- <string name="key_descr_end">End</string> -->
<!-- <string name="clipboard_history_heading">Recently copied text</string> --> <!-- <string name="clipboard_history_heading">Recently copied text</string> -->
<!-- <string name="clipboard_pin_heading">Pinned</string> --> <!-- <string name="clipboard_pin_heading">Pinned</string> -->
<!-- <string name="clipboard_remove_confirm">Remove this saved clipboard?</string> --> <!-- <string name="clipboard_remove_confirm">Remove this clipboard?</string> -->
<!-- <string name="clipboard_remove_confirmed">Yes</string> --> <!-- <string name="clipboard_remove_confirmed">Yes</string> -->
</resources> </resources>

View File

@ -117,6 +117,6 @@
<string name="key_descr_end">End</string> <string name="key_descr_end">End</string>
<!-- <string name="clipboard_history_heading">Recently copied text</string> --> <!-- <string name="clipboard_history_heading">Recently copied text</string> -->
<!-- <string name="clipboard_pin_heading">Pinned</string> --> <!-- <string name="clipboard_pin_heading">Pinned</string> -->
<!-- <string name="clipboard_remove_confirm">Remove this saved clipboard?</string> --> <!-- <string name="clipboard_remove_confirm">Remove this clipboard?</string> -->
<!-- <string name="clipboard_remove_confirmed">Yes</string> --> <!-- <string name="clipboard_remove_confirmed">Yes</string> -->
</resources> </resources>

View File

@ -117,6 +117,6 @@ Bu uygulama açık kaynaklıdır. Reklam içermez ve internete bağlanmaz."</str
<string name="key_descr_end">SON(Sağ yön tuşu)</string> <string name="key_descr_end">SON(Sağ yön tuşu)</string>
<!-- <string name="clipboard_history_heading">Recently copied text</string> --> <!-- <string name="clipboard_history_heading">Recently copied text</string> -->
<!-- <string name="clipboard_pin_heading">Pinned</string> --> <!-- <string name="clipboard_pin_heading">Pinned</string> -->
<!-- <string name="clipboard_remove_confirm">Remove this saved clipboard?</string> --> <!-- <string name="clipboard_remove_confirm">Remove this clipboard?</string> -->
<!-- <string name="clipboard_remove_confirmed">Yes</string> --> <!-- <string name="clipboard_remove_confirmed">Yes</string> -->
</resources> </resources>

View File

@ -117,6 +117,6 @@
<string name="key_descr_end">End</string> <string name="key_descr_end">End</string>
<!-- <string name="clipboard_history_heading">Recently copied text</string> --> <!-- <string name="clipboard_history_heading">Recently copied text</string> -->
<!-- <string name="clipboard_pin_heading">Pinned</string> --> <!-- <string name="clipboard_pin_heading">Pinned</string> -->
<!-- <string name="clipboard_remove_confirm">Remove this saved clipboard?</string> --> <!-- <string name="clipboard_remove_confirm">Remove this clipboard?</string> -->
<!-- <string name="clipboard_remove_confirmed">Yes</string> --> <!-- <string name="clipboard_remove_confirmed">Yes</string> -->
</resources> </resources>

View File

@ -117,6 +117,6 @@ Bây giờ đã hoàn hảo cho việc sử dụng hàng ngày.
<!-- <string name="key_descr_end">End</string> --> <!-- <string name="key_descr_end">End</string> -->
<!-- <string name="clipboard_history_heading">Recently copied text</string> --> <!-- <string name="clipboard_history_heading">Recently copied text</string> -->
<!-- <string name="clipboard_pin_heading">Pinned</string> --> <!-- <string name="clipboard_pin_heading">Pinned</string> -->
<!-- <string name="clipboard_remove_confirm">Remove this saved clipboard?</string> --> <!-- <string name="clipboard_remove_confirm">Remove this clipboard?</string> -->
<!-- <string name="clipboard_remove_confirmed">Yes</string> --> <!-- <string name="clipboard_remove_confirmed">Yes</string> -->
</resources> </resources>

View File

@ -117,6 +117,6 @@
<string name="key_descr_end">End</string> <string name="key_descr_end">End</string>
<!-- <string name="clipboard_history_heading">Recently copied text</string> --> <!-- <string name="clipboard_history_heading">Recently copied text</string> -->
<!-- <string name="clipboard_pin_heading">Pinned</string> --> <!-- <string name="clipboard_pin_heading">Pinned</string> -->
<!-- <string name="clipboard_remove_confirm">Remove this saved clipboard?</string> --> <!-- <string name="clipboard_remove_confirm">Remove this clipboard?</string> -->
<!-- <string name="clipboard_remove_confirmed">Yes</string> --> <!-- <string name="clipboard_remove_confirmed">Yes</string> -->
</resources> </resources>

View File

@ -117,6 +117,6 @@ This application contains no ads, doesn't make any network requests and is Open
<string name="key_descr_end">End</string> <string name="key_descr_end">End</string>
<string name="clipboard_history_heading">Recently copied text</string> <string name="clipboard_history_heading">Recently copied text</string>
<string name="clipboard_pin_heading">Pinned</string> <string name="clipboard_pin_heading">Pinned</string>
<string name="clipboard_remove_confirm">Remove this saved clipboard?</string> <string name="clipboard_remove_confirm">Remove this clipboard?</string>
<string name="clipboard_remove_confirmed">Yes</string> <string name="clipboard_remove_confirmed">Yes</string>
</resources> </resources>

View File

@ -1,6 +1,8 @@
package juloo.keyboard2; package juloo.keyboard2;
import android.app.AlertDialog;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
@ -95,7 +97,21 @@ public final class ClipboardHistoryView extends NonScrollListView
new View.OnClickListener() new View.OnClickListener()
{ {
@Override @Override
public void onClick(View v) { remove_entry(pos); } public void onClick(View v)
{
AlertDialog d = new AlertDialog.Builder(getContext())
.setTitle(R.string.clipboard_remove_confirm)
.setPositiveButton(R.string.clipboard_remove_confirmed,
new DialogInterface.OnClickListener(){
public void onClick(DialogInterface _dialog, int _which)
{
remove_entry(pos);
}
})
.setNegativeButton(android.R.string.cancel, null)
.create();
Utils.show_dialog_on_ime(d, v.getWindowToken());
}
}); });
return v; return v;
} }

View File

@ -7,8 +7,6 @@ import android.content.SharedPreferences;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.BaseAdapter; import android.widget.BaseAdapter;
import android.widget.TextView; import android.widget.TextView;
import java.util.ArrayList; import java.util.ArrayList;
@ -121,25 +119,18 @@ public final class ClipboardPinView extends NonScrollListView
@Override @Override
public void onClick(View v) public void onClick(View v)
{ {
// Confirmation dialog for removing a clip
AlertDialog d = new AlertDialog.Builder(getContext()) AlertDialog d = new AlertDialog.Builder(getContext())
.setTitle(R.string.clipboard_remove_confirm) .setTitle(R.string.clipboard_remove_confirm)
.setPositiveButton(R.string.clipboard_remove_confirmed, new DialogInterface.OnClickListener(){ .setPositiveButton(R.string.clipboard_remove_confirmed,
public void onClick(DialogInterface _dialog, int _which) new DialogInterface.OnClickListener(){
{ public void onClick(DialogInterface _dialog, int _which)
remove_entry(pos); {
} remove_entry(pos);
}) }
})
.setNegativeButton(android.R.string.cancel, null) .setNegativeButton(android.R.string.cancel, null)
.create(); .create();
// https://stackoverflow.com/questions/3494476/android-ime-how-to-show-a-pop-up-dialog Utils.show_dialog_on_ime(d, v.getWindowToken());
Window dw = d.getWindow();
WindowManager.LayoutParams lp = dw.getAttributes();
lp.token = v.getWindowToken();
lp.type = WindowManager.LayoutParams.TYPE_APPLICATION_ATTACHED_DIALOG;
dw.setAttributes(lp);
dw.addFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
d.show();
} }
}); });
return v; return v;