From f210a6e363927421ce8aaf3c2d695a351e483eb9 Mon Sep 17 00:00:00 2001 From: Nite Date: Sun, 13 Feb 2022 19:42:34 +0100 Subject: [PATCH] Redesigned the About fragment - removed WebView --- ultrasonic/src/main/assets/html/de/index.html | 48 ------ ultrasonic/src/main/assets/html/en/index.html | 52 ------ ultrasonic/src/main/assets/html/fr/index.html | 61 ------- .../src/main/assets/html/img/paypal.png | Bin 1955 -> 0 bytes .../src/main/assets/html/img/ultrasonic.png | Bin 2109 -> 0 bytes ultrasonic/src/main/assets/html/style.css | 11 -- .../ultrasonic/fragment/AboutFragment.java | 149 ------------------ .../ultrasonic/fragment/AboutFragment.kt | 74 +++++++++ ultrasonic/src/main/res/layout/help.xml | 79 +++++----- ultrasonic/src/main/res/values-cs/strings.xml | 1 - ultrasonic/src/main/res/values-de/strings.xml | 1 - ultrasonic/src/main/res/values-es/strings.xml | 1 - ultrasonic/src/main/res/values-fr/strings.xml | 1 - ultrasonic/src/main/res/values-hu/strings.xml | 1 - ultrasonic/src/main/res/values-it/strings.xml | 1 - ultrasonic/src/main/res/values-nl/strings.xml | 1 - ultrasonic/src/main/res/values-pl/strings.xml | 1 - .../src/main/res/values-pt-rBR/strings.xml | 1 - ultrasonic/src/main/res/values-pt/strings.xml | 1 - ultrasonic/src/main/res/values-ru/strings.xml | 1 - .../src/main/res/values-zh-rCN/strings.xml | 1 - ultrasonic/src/main/res/values/strings.xml | 7 +- 22 files changed, 120 insertions(+), 373 deletions(-) delete mode 100644 ultrasonic/src/main/assets/html/de/index.html delete mode 100644 ultrasonic/src/main/assets/html/en/index.html delete mode 100644 ultrasonic/src/main/assets/html/fr/index.html delete mode 100644 ultrasonic/src/main/assets/html/img/paypal.png delete mode 100644 ultrasonic/src/main/assets/html/img/ultrasonic.png delete mode 100644 ultrasonic/src/main/assets/html/style.css delete mode 100644 ultrasonic/src/main/java/org/moire/ultrasonic/fragment/AboutFragment.java create mode 100644 ultrasonic/src/main/kotlin/org/moire/ultrasonic/fragment/AboutFragment.kt diff --git a/ultrasonic/src/main/assets/html/de/index.html b/ultrasonic/src/main/assets/html/de/index.html deleted file mode 100644 index cba4bb7a..00000000 --- a/ultrasonic/src/main/assets/html/de/index.html +++ /dev/null @@ -1,48 +0,0 @@ - - - About Ultrasonic - - - - - - -

Ultrasonic

- -

- Mit Ultrasonic können Sie mit dem Subsonic Media Streamer ganz einfach Musik von Ihrem Heimcomputer auf Ihr Android-Handy streamen oder - herunterladen. Die Subsonic-Server-Software erfordert eine zusätzliche, von Ultrasonic getrennte Konfiguration. Für weitere Informationen oder - zur Installation der Subsonic-Server-Software auf Ihrem Computer besuchen Sie bitte subsonic.org. Die Basisversion - von Subsonic ist kostenlos. Wenn Sie Subsonic zum ersten Mal installieren, sind die Premium-Funktionen 30 Tage lang verfügbar, so dass Sie sie - ausprobieren können, bevor Sie sich für ein Upgrade entscheiden. Klicken Sie hier, um - ein Upgrade auf Subsonic Premium durchzuführen. -

- -

- Standardmäßig ist Ultrasonic nicht konfiguriert. Wenn Sie Ihren eigenen Server eingerichtet haben, gehen Sie bitte zu Einstellungen und - ändern Sie die Konfiguration so, dass er mit Ihrem eigenen Computer verbunden wird. -

- -

- -

- -

- Wenn Sie mit Ultrasonic zufrieden sind, klicken Sie bitte auf "Spenden", um die weitere Entwicklung zu unterstützen. Diese Spende ist von der - Subsonic-Server-Software getrennt und gewährt Ihnen keinen Zugang zu den Premium-Funktionen von Subsonic. -

- -
- - - - -
- -

- Um Feature-Anfragen oder Fehlerberichte einzureichen, besuchen Sie bitte das Ultrasonic für Android Forum. - Der Quellcode von Ultrasonic ist unter github.com verfügbar und unter den Bedingungen der GNU General Public License Version 3 (GPLv3) lizenziert. -

- - - diff --git a/ultrasonic/src/main/assets/html/en/index.html b/ultrasonic/src/main/assets/html/en/index.html deleted file mode 100644 index 8680d88b..00000000 --- a/ultrasonic/src/main/assets/html/en/index.html +++ /dev/null @@ -1,52 +0,0 @@ - - - About Ultrasonic - - - - -

Ultrasonic

- -

- With Ultrasonic you can easily stream or download music from your - home computer to your Android phone using the Subsonic media streamer. - The Subsonic server software requires additional configuration separate - from Ultrasonic. For more information or to install the Subsonic server - software on your computer, please visit - subsonic.org. The basic version of - Subsonic is free. When you first install Subsonic, the premium features - are available for 30 days so you can try them out before deciding to - upgrade. Click - here to upgrade - to Subsonic Premium. -

- -

- By default, Ultrasonic is not configured. Once you've set up your own - server, please go to Settings and change the configuration so - that it connects to your own computer. -

- -

- If you are pleased with Ultrasonic, please click "Donate" to help - further development. This donation is separate from the Subsonic server - software and does not grant you access to the premium features of - Subsonic. -

- -
- - - - -
- -

- To submit feature requests or file bug reports, please visit the - Ultrasonic for Android - forum. - Source code for Ultrasonic is available at - github.com. -

- - diff --git a/ultrasonic/src/main/assets/html/fr/index.html b/ultrasonic/src/main/assets/html/fr/index.html deleted file mode 100644 index b786767d..00000000 --- a/ultrasonic/src/main/assets/html/fr/index.html +++ /dev/null @@ -1,61 +0,0 @@ - - - Aide de Ultrasonic - - - - - - -

Bienvenue dans Ultrasonic

- -

- Avec Ultrasonic, vous pouvez facilement écouter ou télécharger de la musique à partir de votre ordinateur personnel sur votre appareil Android - (et bien d'autres choses sont possibles). -

- -

- Pour installer le serveur Subsonic sur votre ordinateur, visitez subsonic.org. - Celui-ci est disponible pour Windows, Mac, Linux et Unix. -

- -

- Par défaut, cette application n'est pas configurée. Après avoir configuré votre - serveur personnel, veuillez accéder aux Paramètres et modifier la configuration afin de vous connecter à votre propre ordinateur ou vos appareils mobiles. -

- -

- Vous pouvez utiliser cette application gratuitement pendant 30 jours. - Ensuite, vous devrez effectuer un don au projet Subsonic. - En tant que donateur, vous obtiendrez les bénéfices suivants: -

- - -

- Le montant suggéré pour le don est de 20€, mais n'importe quel montant est traité et accepté. -

- -

- Cliquez sur le bouton suivants pour accéder à PayPal, d'où vous pourrez payer soit par carte de crédit, soit en utilisant votre compte PayPal. - Une fois le don reçu et traité, vous recevrez votre clé d'activation par e-mail. -

- -
- - - - -
- -

- Pour plus d'information, veuiller visitez subsonic.org. Le code source de Ultrasonic est disponible à l'adresse suivante : github.com. -

- - - diff --git a/ultrasonic/src/main/assets/html/img/paypal.png b/ultrasonic/src/main/assets/html/img/paypal.png deleted file mode 100644 index 6563293784f9e89b973306c989840ed18f5d2992..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1955 zcmV;U2VD4xP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D02*{fSaefwW^{L9 za%BKeVQFr3E>1;MAa*k@H7+qQF!XYv00093P)t-s|Ns9IGiDn$WFtIhDMD;6Ms6}l zZZc<^HEEnTO>;VIo<37`K5(EwRCYjdpFvi6LUN%+T6;%Wbw_rjN?w0VV1P_|rBY>q zQhlUTV|!I+gjIm1Re-2geV@{W zdX#ICvTb;WZjPjHk*sikmUDrWbe6Jqg`9YNeR!3rdYid`jGlm>xP*|PgrdENnxcr5 zrHiJ#jHI!Rk&lk3yONuzld8CxmWr9M!=0n2qqMiAtg@uGyr;RtsIR1{y2Y!#%B--f zt+TeSw7IXs&#=MCv8a-=x4pHxwYIyyw!6Z&xv9FLYP!C^y2r`9$U9K#?I8o($&by!_UgD&(F=!)zZ_^!_(8t)Y;C}%&yhk-P+pO+u`Hf;MLv2 zjNr3h;N8&R*Md}(eLi)@Zq@f>eln|XCv z&3^vRg#OWn{?dZ})s_C&jsDk}{@9!T+noN}qW;{S{@kSg-J$;Ass81%{^hm)=ePdw z%l`G@|Cs>)ngjo*BLAo&|EMGXsV4ubCjY7@|EnnftSkSmE&r`B|E@3purmL#HUF|X z|FS&)vp)Z{I{&pj|F%T`w@LrHME|^3|Gi58y-feTS^vLZ|HEeg#A^S>YX8V@|H^j% z%X|OLc>m9R|Idg2(vJVrlK<3(|J0HH*_8j=rT^TO|Jaz<|Kz;?<-7mpzW?dM|LMp7>bw8y$^Yxk|Le~G?au%1#{cff|L)TN@74eC(Esq% z|MA)X^4Rb6ab zH55L!Z;~}>lBTQDbV=8;BDAV%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+uK=(*)%* zxE!6d3Ca-o@_lb&+;cu!y7QwR3$7P_Pa;BO8cI3O$mk1n*2{DYorZa?ZTo*mb-leai8 z=uz4S=kS^fgwsdyox#IV%G$fato=Y=ZTRWF{=Rhj#3V~Wu>?kM|Dn?H+@*H@*iT## z-r@W(P`N=P1inXax%`H|@^kk@Q@hXZe*Gnul46Oh-u^I|=&&50y)u&K?I^WTE0qPM n%HOl$P0t2O8skqt%2N9ecuge!eYebI00000NkvXXu0mjft}z5x diff --git a/ultrasonic/src/main/assets/html/style.css b/ultrasonic/src/main/assets/html/style.css deleted file mode 100644 index 9c1d55f2..00000000 --- a/ultrasonic/src/main/assets/html/style.css +++ /dev/null @@ -1,11 +0,0 @@ -/* -* Taken from http://yui.yahooapis.com/2.8.0r4/build/fonts/fonts.css -*/ -body { - font: 13px / 1.231 arial, helvetica, clean, sans-serif; -} - -table { - font-size:inherit; - font:100%; -} \ No newline at end of file diff --git a/ultrasonic/src/main/java/org/moire/ultrasonic/fragment/AboutFragment.java b/ultrasonic/src/main/java/org/moire/ultrasonic/fragment/AboutFragment.java deleted file mode 100644 index dd8d735d..00000000 --- a/ultrasonic/src/main/java/org/moire/ultrasonic/fragment/AboutFragment.java +++ /dev/null @@ -1,149 +0,0 @@ -package org.moire.ultrasonic.fragment; - -import android.graphics.Bitmap; -import android.os.Bundle; -import android.view.KeyEvent; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.webkit.WebView; -import android.webkit.WebViewClient; -import android.widget.Button; -import android.widget.ImageView; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.fragment.app.Fragment; -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; - -import org.jetbrains.annotations.NotNull; -import org.moire.ultrasonic.R; -import org.moire.ultrasonic.util.Util; - -/** - * Displays online help and about information in a WebView - */ -public class AboutFragment extends Fragment { - - private WebView webView; - private ImageView backButton; - private ImageView forwardButton; - private SwipeRefreshLayout swipeRefresh; - - @Override - public void onCreate(@Nullable Bundle savedInstanceState) { - Util.applyTheme(this.getContext()); - super.onCreate(savedInstanceState); - } - - @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - return inflater.inflate(R.layout.help, container, false); - } - - @Override - public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - - swipeRefresh = view.findViewById(R.id.help_refresh); - swipeRefresh.setEnabled(false); - - webView = view.findViewById(R.id.help_contents); - webView.getSettings().setJavaScriptEnabled(true); - webView.setWebViewClient(new HelpClient()); - - if (savedInstanceState != null) - { - webView.restoreState(savedInstanceState); - } - else - { - webView.loadUrl(getResources().getString(R.string.help_url)); - } - - backButton = view.findViewById(R.id.help_back); - backButton.setOnClickListener(new Button.OnClickListener() - { - @Override - public void onClick(View view) - { - webView.goBack(); - } - }); - - ImageView stopButton = view.findViewById(R.id.help_stop); - stopButton.setOnClickListener(new Button.OnClickListener() - { - @Override - public void onClick(View view) - { - webView.stopLoading(); - swipeRefresh.setRefreshing(false); - } - }); - - forwardButton = view.findViewById(R.id.help_forward); - forwardButton.setOnClickListener(new Button.OnClickListener() - { - @Override - public void onClick(View view) - { - webView.goForward(); - } - }); - - // TODO: Nicer Back key handling? - webView.setFocusableInTouchMode(true); - webView.requestFocus(); - webView.setOnKeyListener( new View.OnKeyListener() - { - @Override - public boolean onKey( View v, int keyCode, KeyEvent event ) - { - if (keyCode == KeyEvent.KEYCODE_BACK) - { - if (webView.canGoBack()) - { - webView.goBack(); - return true; - } - } - return false; - } - } ); - } - - @Override - public void onSaveInstanceState(@NotNull Bundle state) - { - webView.saveState(state); - super.onSaveInstanceState(state); - } - - private final class HelpClient extends WebViewClient - { - @Override - public void onPageStarted(WebView view, String url, Bitmap favicon) { - swipeRefresh.setRefreshing(true); - super.onPageStarted(view, url, favicon); - } - - @Override - public void onPageFinished(WebView view, String url) - { - swipeRefresh.setRefreshing(false); - String versionName = Util.getVersionName(getContext()); - String title = String.format("%s (%s)", view.getTitle(), versionName); - - FragmentTitle.Companion.setTitle(AboutFragment.this, title); - - backButton.setEnabled(view.canGoBack()); - forwardButton.setEnabled(view.canGoForward()); - } - - @Override - public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) - { - Util.toast(getContext(), description); - } - } -} diff --git a/ultrasonic/src/main/kotlin/org/moire/ultrasonic/fragment/AboutFragment.kt b/ultrasonic/src/main/kotlin/org/moire/ultrasonic/fragment/AboutFragment.kt new file mode 100644 index 00000000..4408c941 --- /dev/null +++ b/ultrasonic/src/main/kotlin/org/moire/ultrasonic/fragment/AboutFragment.kt @@ -0,0 +1,74 @@ +/* + * AboutFragment.kt + * Copyright (C) 2009-2021 Ultrasonic developers + * + * Distributed under terms of the GNU GPLv3 license. + */ + +package org.moire.ultrasonic.fragment + +import android.content.Intent +import android.net.Uri +import android.os.Bundle +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import android.widget.Button +import android.widget.TextView +import androidx.fragment.app.Fragment +import java.util.Locale +import org.moire.ultrasonic.R +import org.moire.ultrasonic.fragment.FragmentTitle.Companion.setTitle +import org.moire.ultrasonic.util.Util.applyTheme +import org.moire.ultrasonic.util.Util.getVersionName + +/** + * Displays the About page + */ +class AboutFragment : Fragment() { + private var titleText: TextView? = null + private var webPageButton: Button? = null + private var reportBugButton: Button? = null + + override fun onCreate(savedInstanceState: Bundle?) { + applyTheme(this.context) + super.onCreate(savedInstanceState) + } + + override fun onCreateView( + inflater: LayoutInflater, + container: ViewGroup?, + savedInstanceState: Bundle? + ): View? { + return inflater.inflate(R.layout.help, container, false) + } + + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + titleText = view.findViewById(R.id.help_title) + webPageButton = view.findViewById(R.id.help_webpage) + reportBugButton = view.findViewById(R.id.help_report) + + val versionName = getVersionName(requireContext()) + val title = String.format( + Locale.getDefault(), + "%s (%s)", + getString(R.string.common_appname), + versionName + ) + + setTitle(this@AboutFragment, title) + titleText?.text = title + + webPageButton?.setOnClickListener { + startActivity( + Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.about_webpage_url))) + ) + } + + reportBugButton?.setOnClickListener { + startActivity( + Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.about_report_url))) + ) + } + } +} diff --git a/ultrasonic/src/main/res/layout/help.xml b/ultrasonic/src/main/res/layout/help.xml index b06b9b00..56084a0a 100644 --- a/ultrasonic/src/main/res/layout/help.xml +++ b/ultrasonic/src/main/res/layout/help.xml @@ -1,46 +1,47 @@ + a:layout_width="fill_parent" + a:layout_height="fill_parent"> - + - - - + - - - +