0
0
mirror of https://github.com/TrianguloY/UrlChecker.git synced 2024-09-19 20:02:16 +02:00

Close on finish

This commit is contained in:
Pablo Ortigosa 2022-09-27 17:01:02 +01:00
parent 7ee92eeaac
commit 477efafbc6
4 changed files with 24 additions and 4 deletions

View File

@ -35,6 +35,10 @@ import java.util.List;
*/
public class OpenModule extends AModuleData {
public static GenericPref.Bool CLOSEOPEN_PREF() {
return new GenericPref.Bool("open_closeopen", true);
}
public static GenericPref.Bool CLOSESHARE_PREF() {
return new GenericPref.Bool("open_closeshare", true);
}
@ -69,6 +73,7 @@ class OpenDialog extends AModuleDialog implements View.OnClickListener, PopupMen
private LastOpened lastOpened;
private final GenericPref.Bool closeOpenPref = OpenModule.CLOSEOPEN_PREF();
private final GenericPref.Bool closeSharePref = OpenModule.CLOSESHARE_PREF();
private final GenericPref.Enumeration<CTabs.Config> ctabsPref = CTabs.PREF();
@ -84,6 +89,7 @@ class OpenDialog extends AModuleDialog implements View.OnClickListener, PopupMen
public OpenDialog(MainDialog dialog) {
super(dialog);
ctabsPref.init(dialog);
closeOpenPref.init(dialog);
closeSharePref.init(dialog);
}
@ -277,6 +283,10 @@ class OpenDialog extends AModuleDialog implements View.OnClickListener, PopupMen
}
PackageUtilities.startActivity(intent, R.string.toast_noApp, getActivity());
if (closeOpenPref.get()){
this.getActivity().finish();
}
}
/**
@ -340,12 +350,14 @@ class OpenDialog extends AModuleDialog implements View.OnClickListener, PopupMen
class OpenConfig extends AModuleConfig {
private final GenericPref.Bool closeOpenPref = OpenModule.CLOSEOPEN_PREF();
private final GenericPref.Bool closeSharePref = OpenModule.CLOSESHARE_PREF();
private final GenericPref.Enumeration<CTabs.Config> ctabsPref = CTabs.PREF();
public OpenConfig(ConfigActivity activity) {
super(activity);
ctabsPref.init(activity);
closeOpenPref.init(activity);
closeSharePref.init(activity);
}
@ -361,6 +373,7 @@ class OpenConfig extends AModuleConfig {
@Override
public void onInitialize(View views) {
closeOpenPref.attachToCheckBox(views.findViewById(R.id.closeopen_pref));
closeSharePref.attachToCheckBox(views.findViewById(R.id.closeshare_pref));
if (CTabs.isAvailable()) {
ctabsPref.attachToSpinner(views.findViewById(R.id.ctabs_pref));

View File

@ -29,8 +29,15 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />
</LinearLayout>
<CheckBox
android:id="@+id/closeopen_pref"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/mOpen_closeopenSetting" />
<CheckBox
android:id="@+id/closeshare_pref"
android:layout_width="match_parent"

View File

@ -57,8 +57,8 @@ Nota: si editas los patrones, nuevos patrones incorporados en futuras actualizac
<string name="mOpen_desc">"Contiene los siguientes botones (de izquierda a derecha):
- Botón de 'custom tabs': activa/desactiva la característica de 'custom tabs'. Cuando se activa el navegador se debería abrir en un modo reducido 'lite'.
- Boton de abrir: pulsa el nombre de la aplicación para abrir el enlace en ella. Si un enlace puede ser abierto por varias se mostrará una flecha para poder elegir.
- Botón de compartir: Púlsalo para compartir el enlace. Mantenlo pulsado para copiarlo diréctamente en el navegador.
Este módulo no puede ser deshabilitado."</string>
- Botón de compartir: Púlsalo para compartir el enlace. Mantenlo pulsado para copiarlo diréctamente en el navegador."</string>
<string name="mOpen_closeopenSetting">Cierra la ventana después de abrir</string>
<string name="mOpen_closeshareSetting">Cierra la ventana después de compartir</string>
<string name="mOpen_ctabsSetting">"'Custom tabs':"</string>
<string name="mOpen_ctabsOn">Activado por defecto</string>

View File

@ -58,8 +58,8 @@ Note: if you edit the patterns, new built-in patterns from app updates will not
<string name="mOpen_desc">"Contains the following buttons (left to right):
- Custom Tabs button: toggle to enable/disable the custom tab feature. When enabled the browser should be opened in a 'lite' mode.
- Open button: Press the app name to open the link on that app. If a link can be opened with multiple apps, an arrow will be shown to let you choose.
- Share button: Press the button to share the link. Long press to quickly copy to clipboard.
This module can't be disabled."</string>
- Share button: Press the button to share the link. Long press to quickly copy to clipboard."</string>
<string name="mOpen_closeopenSetting">Close dialog after opening</string>
<string name="mOpen_closeshareSetting">Close dialog after sharing</string>
<string name="mOpen_ctabsSetting">Custom tabs:</string>
<string name="mOpen_ctabsOn">Enabled by default</string>