Commit 8d22684c authored by Massimiliano's avatar Massimiliano
Browse files

Cleaned up code for better maintenance+

Made Third party links klickable+
Made application&device info fully translatable
parent af8bcd6a
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<codeStyleSettings language="XML">
<indentOptions>
<option name="CONTINUATION_INDENT_SIZE" value="4" />
</indentOptions>
<arrangement>
<rules>
<section>
<rule>
<match>
<AND>
<NAME>xmlns:android</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>xmlns:.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*:id</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*:name</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>name</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>style</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
<order>ANDROID_ATTRIBUTE_ORDER</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>.*</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
</rules>
</arrangement>
</codeStyleSettings>
</code_scheme>
</component>
\ No newline at end of file
......@@ -6,8 +6,8 @@ android {
applicationId "org.disroot.disrootapp"
minSdkVersion 15
targetSdkVersion 28
versionCode 21
versionName "1.2.2"
versionCode 22
versionName "1.2.3"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
......@@ -35,7 +35,7 @@ dependencies {
//noinspection GradleCompatible
implementation 'com.android.support:customtabs:28.0.0'
//noinspection GradleCompatible
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support:cardview-v7:28.0.0'
}
dependencies {
......@@ -46,5 +46,5 @@ repositories {
}
dependencies {
implementation 'com.android.support.constraint:constraint-layout:+'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
}
......@@ -29,7 +29,8 @@ import java.util.HashMap;
import java.util.Timer;
import java.util.TimerTask;
import static android.support.constraint.motion.MotionScene.TAG;
import static android.support.constraint.Constraints.TAG;
public class StatusService extends Service {
......
......@@ -4,23 +4,22 @@ package org.disroot.disrootapp.ui;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.design.widget.TabLayout;
import android.support.design.widget.FloatingActionButton;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.text.method.LinkMovementMethod;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.TextView;
......@@ -28,7 +27,9 @@ import android.widget.TextView;
import org.disroot.disrootapp.R;
import org.disroot.disrootapp.utils.Constants;
import static org.disroot.disrootapp.BuildConfig.*;
import static org.disroot.disrootapp.BuildConfig.APPLICATION_ID;
import static org.disroot.disrootapp.BuildConfig.VERSION_CODE;
import static org.disroot.disrootapp.BuildConfig.VERSION_NAME;
public class AboutActivity extends AppCompatActivity {
......@@ -74,14 +75,13 @@ public class AboutActivity extends AppCompatActivity {
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Uri uri = Uri.parse(String.valueOf(Constants.URL_SUPPORT));
Uri uri = Uri.parse(Constants.URL_SUPPORT);
Intent support = new Intent(Intent.ACTION_VIEW, Uri.parse(String.valueOf(uri)));
startActivity(support);
// Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
// .setAction("Action", null).show();
}
});
}
......@@ -152,7 +152,7 @@ public class AboutActivity extends AppCompatActivity {
ContributeBtn.setOnClickListener(new View.OnClickListener()
{
public void onClick(View arg0) {
Uri uri = Uri.parse(String.valueOf(Constants.URL_SOURCE));
Uri uri = Uri.parse(Constants.URL_SOURCE);
Intent code = new Intent(Intent.ACTION_VIEW, Uri.parse(String.valueOf(uri)));
startActivity(code);
}
......@@ -162,7 +162,7 @@ public class AboutActivity extends AppCompatActivity {
TranslateBtn.setOnClickListener(new View.OnClickListener()
{
public void onClick(View arg0) {
Uri uri = Uri.parse(String.valueOf(Constants.URL_TRANSLATE));
Uri uri = Uri.parse(Constants.URL_TRANSLATE);
Intent translate = new Intent(Intent.ACTION_VIEW, Uri.parse(String.valueOf(uri)));
startActivity(translate);
}
......@@ -173,7 +173,7 @@ public class AboutActivity extends AppCompatActivity {
FeedbackBtn1.setOnClickListener(new View.OnClickListener()
{
public void onClick(View arg0) {
Uri uri = Uri.parse(String.valueOf(Constants.URL_BUGS));
Uri uri = Uri.parse(Constants.URL_BUGS);
Intent feedback1 = new Intent(Intent.ACTION_VIEW, Uri.parse(String.valueOf(uri)));
startActivity(feedback1);
}
......@@ -183,7 +183,7 @@ public class AboutActivity extends AppCompatActivity {
FeedbackBtn2.setOnClickListener(new View.OnClickListener()
{
public void onClick(View arg0) {
Uri uri = Uri.parse(String.valueOf(Constants.URL_XMPP));
Uri uri = Uri.parse(Constants.URL_XMPP);
Intent feedback2 = new Intent(Intent.ACTION_VIEW, Uri.parse(String.valueOf(uri)));
startActivity(feedback2);
}
......@@ -195,7 +195,7 @@ public class AboutActivity extends AppCompatActivity {
fDroidBtn.setOnClickListener(new View.OnClickListener()
{
public void onClick(View arg0) {
Uri uri = Uri.parse(String.valueOf(Constants.URL_FDROID));
Uri uri = Uri.parse(Constants.URL_FDROID);
Intent fDroid = new Intent(Intent.ACTION_VIEW, Uri.parse(String.valueOf(uri)));
startActivity(fDroid);
}
......@@ -205,23 +205,23 @@ public class AboutActivity extends AppCompatActivity {
homeBtn.setOnClickListener(new View.OnClickListener()
{
public void onClick(View arg0) {
Uri uri = Uri.parse(String.valueOf(Constants.URL_DISROOT));
Uri uri = Uri.parse(Constants.URL_DISROOT);
Intent home = new Intent(Intent.ACTION_VIEW, Uri.parse(String.valueOf(uri)));
startActivity(home);
}
});
final TextView PackageName= rootView.findViewById(R.id.PackageName);
PackageName.setText("ID: " + APPLICATION_ID);
PackageName.setText(getString( R.string.id ) + " "+ APPLICATION_ID);
final TextView AppVersion= rootView.findViewById(R.id.AppVersion);
AppVersion.setText("Version: " + VERSION_NAME + "(" + VERSION_CODE + ")");
AppVersion.setText(getString( R.string.version ) + " " + VERSION_NAME + "(" + VERSION_CODE + ")");
final TextView AndroidVersion= rootView.findViewById(R.id.AndroidVersion);
AndroidVersion.setText("Android version: " + Build.VERSION.RELEASE);
AndroidVersion.setText(getString( R.string.androidVersion ) + " " + Build.VERSION.RELEASE);
final TextView Device;
Device = rootView.findViewById(R.id.Device);
Device.setText("Device name: " + Build.MANUFACTURER + Build.MODEL);
Device.setText(getString( R.string.deviceName ) + " " + Build.MANUFACTURER + Build.MODEL);
break;
case 3:
rootView = inflater.inflate(R.layout.fragment_about_license, container, false);
......@@ -231,7 +231,7 @@ public class AboutActivity extends AppCompatActivity {
licenseBtn.setOnClickListener(new View.OnClickListener()
{
public void onClick(View arg0) {
Uri uri = Uri.parse(String.valueOf(Constants.URL_LICENSE));
Uri uri = Uri.parse(Constants.URL_LICENSE);
Intent license = new Intent(Intent.ACTION_VIEW, Uri.parse(String.valueOf(uri)));
startActivity(license);
}
......@@ -241,7 +241,7 @@ public class AboutActivity extends AppCompatActivity {
disrootBtn.setOnClickListener(new View.OnClickListener()
{
public void onClick(View arg0) {
Uri uri = Uri.parse(String.valueOf(Constants.URL_DISROOT));
Uri uri = Uri.parse(Constants.URL_DISROOT);
Intent disroot = new Intent(Intent.ACTION_VIEW, Uri.parse(String.valueOf(uri)));
startActivity(disroot);
}
......@@ -251,11 +251,13 @@ public class AboutActivity extends AppCompatActivity {
dioBtn.setOnClickListener(new View.OnClickListener()
{
public void onClick(View arg0) {
Uri uri = Uri.parse(String.valueOf(Constants.URL_DIO));
Uri uri = Uri.parse(Constants.URL_DIO);
Intent dio = new Intent(Intent.ACTION_VIEW, Uri.parse(String.valueOf(uri)));
startActivity(dio);
}
});
final TextView htmlToTextView = rootView.findViewById(R.id.ThirdParty);// textview links clickable
htmlToTextView.setMovementMethod( LinkMovementMethod.getInstance());// textview links clickable
break;
}
return rootView;
......
/*
This file is part of the dandelion*.
dandelion* is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
dandelion* is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with the dandelion*.
If not, see <http://www.gnu.org/licenses/>.
*/
package org.disroot.disrootapp.ui;
import android.content.Context;
import android.support.v7.widget.AppCompatTextView;
import android.text.Html;
import android.text.SpannableString;
import android.text.util.Linkify;
import android.util.AttributeSet;
import android.util.Patterns;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* TextView, that renders HTML with highlited and clickable links and hashtags.
* Links are opened in a webbrowser.
* Hashtags open the MainActivity, load the new-post site of the selected pod and insert the
* hashtag into the post editor. See data/HashtagContentProvider.
*/
public class HtmlTextView extends AppCompatTextView {
public HtmlTextView(Context context) {
super(context);
init();
}
public HtmlTextView(Context context, AttributeSet attrs) {
super(context, attrs);
init();
}
public HtmlTextView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init();
}
/**
* Linkify, format markdown and escape the displayed message.
*/
private void init() {
formatHtmlAndCustomTags();
}
private void formatHtmlAndCustomTags() {
setText(new SpannableString(Html.fromHtml(getText().toString())));
Linkify.TransformFilter filter = new Linkify.TransformFilter() {
public final String transformUrl(final Matcher match, String url) {
return match.group();
}
};
Pattern hashtagPattern = Pattern.compile("[#]+[A-Za-z0-9-_]+\\b");
String hashtagScheme = MainActivity.CONTENT_HASHTAG;
Linkify.addLinks(this, hashtagPattern, hashtagScheme, null, filter);
Pattern urlPattern = Patterns.WEB_URL;
Linkify.addLinks(this, urlPattern, null, null, filter);
}
}
\ No newline at end of file
......@@ -227,7 +227,7 @@
android:textColor="#ffffff" />
<Button
android:id="@+id/HowtoBtn"
android:id="@+id/HowToBtn"
style="?android:attr/borderlessButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
......@@ -244,7 +244,7 @@
android:id="@+id/group5"
android:layout_below="@+id/group4"><!-- android:gravity="center_horizontal" -->
<Button
android:id="@+id/AboudBtn"
android:id="@+id/AboutBtn"
style="?android:attr/borderlessButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
......
......@@ -172,7 +172,7 @@
android:text="@string/SpreadTheWord"
android:layout_marginBottom="8dp"/>
<org.disroot.disrootapp.ui.HtmlTextView
<TextView
android:id="@+id/fragment_about__spread_the_word_text"
android:textAppearance="@style/TextAppearance.AppCompat"
android:layout_width="match_parent"
......
......@@ -176,6 +176,7 @@
android:layout_marginBottom="8dp"/>
<TextView
android:id="@+id/ThirdParty"
android:textAppearance="@style/TextAppearance.AppCompat"
android:layout_width="match_parent"
android:layout_height="wrap_content"
......
......@@ -199,5 +199,9 @@
<string name="action_optimization">Energiesparfunktion</string>
<string name="OptimizationTitle">Energiesparfunktion!</string>
<string name="OptimizationInfo">Mit diesem Update kann sich die App mit der Status Seite von Disroot synchronisieren. Das heißt du wirst sofort über geplante Wartungsarbeiten oder Problemen mit dem Server informiert. Dich erreichen alle wichtigen Verkündungen die veröffentlicht werden auf: https://state.disroot.org\n Wir empfehlen Energiesparfunktionen abzuwählen und die Nutzung im Hintergrund zuzulassen. Wenn du dir gerade nicht sicher bist, kannst du diese Einstellungen jederzeit über das Disroot App Menu ändern.</string>
<string name="id">id:</string>
<string name="version">App version:</string>
<string name="androidVersion">Android version:</string>
<string name="deviceName">Device name:</string>
</resources>
......@@ -160,4 +160,8 @@
<string name="action_optimization">Optimización de la batería</string>
<string name="OptimizationTitle">Optimización de la batería!</string>
<string name="OptimizationInfo">Con esta nueva versión la aplicación puede sincronizar con la página de estado de Disroot. Esto significa que recibirás actualizaciones en tiempo real sobre inconvenientes, caídas, mantenimientos programados y otros que fueran publicados a través de https://state.disroot.org\nRecomendamos apagar la optimización de batería y permitir a la aplicación de Disroot correr en segundo plano. Si no estás seguro, siempre puedes volver a cambiar la configuración desde el menu de la aplicación de Disroot.</string>
<string name="id">id:</string>
<string name="version">App version:</string>
<string name="androidVersion">Android version:</string>
<string name="deviceName">Device name:</string>
</resources>
......@@ -197,4 +197,8 @@
<string name="action_optimization">Optimisation de la batterie</string>
<string name="OptimizationTitle">Optimisation de la batterie!</string>
<string name="OptimizationInfo">Avec cette mise à jour, l\'application peut se synchroniser avec la page de statut de Disroot. Cela signifie que vous recevrez des mises à jour en temps réel sur les problèmes, les temps d\'arrêt, la maintenance programmée et d\'autres informations publiées via https://state.disroot.org\nNous vous recommandons de désactiver l\'optimisation de la batterie et d\'autoriser l\'exécution de l\'application Disroot en arrière-plan. Si vous n\'êtes pas sûr, vous pouvez toujours changer le réglage à partir du menu de l\'application Disroot plus tard.</string>
<string name="id">id:</string>
<string name="version">App version:</string>
<string name="androidVersion">Android version:</string>
<string name="deviceName">Device name:</string>
</resources>
......@@ -159,4 +159,8 @@
<string name="action_optimization">Ottimizzazione batteria</string>
<string name="OptimizationTitle">Ottimizzazione batteria!</string>
<string name="OptimizationInfo">Con questo aggiornamento l\'applicazione può sincronizzarsi con la pagina di stato di Disroot. Questo significa che riceverai in tempo reale gli aggiornamenti sui problemi, i tempi di inattività, la manutenzione programmata e altri aggiornamenti pubblicati su https://state.disroot.org\nSi consiglia di disattivare l\'ottimizzazione della batteria e consentire all\'applicazione Disroot di funzionare in background. Se non si è sicuri, è sempre possibile modificare le impostazioni dal menu dell\'applicazione Disroot in un secondo momento.</string>
<string name="id">id:</string>
<string name="version">App version:</string>
<string name="androidVersion">Android version:</string>
<string name="deviceName">Device name:</string>
</resources>
......@@ -161,4 +161,8 @@
<string name="action_optimization">Batterij optimalisatie</string>
<string name="OptimizationTitle">Batterij optimalisatie!</string>
<string name="OptimizationInfo">Met deze update kan de app synchroniseren met de statuspagina van Disroot. Dit betekent dat u realtime updates ontvangt over issues, downtime, gepland onderhoud en andere zaken die gepubliceerd worden via https://state.disroot.org\nWe raden aan om de batterijoptimalisatie uit te schakelen en de Disroot app op de achtergrond te laten draaien. Als u niet zeker bent, kunt u de instelling later altijd nog wijzigen vanuit het Disroot app menu.</string>
<string name="id">id:</string>
<string name="version">App version:</string>
<string name="androidVersion">Android version:</string>
<string name="deviceName">Device name:</string>
</resources>
......@@ -159,4 +159,8 @@
<string name="action_optimization">Battery optimization</string>
<string name="OptimizationTitle">Battery optimization!</string>
<string name="OptimizationInfo">With this update the app can sync with the status page of Disroot. This means you will receive realtime updates on issues, downtimes, scheduled maintenace and others published via https://state.disroot.org\nWe recommend to turn off battery optimization and allow Disroot app to run in background. If you\'re not sure, you can always change the setting from the menu of the Disroot app later.</string>
<string name="id">id:</string>
<string name="version">App version:</string>
<string name="androidVersion">Android version:</string>
<string name="deviceName">Device name:</string>
</resources>
......@@ -160,4 +160,8 @@
<string name="action_optimization">Optimizacija baterije</string>
<string name="OptimizationTitle">Optimizacija baterije!</string>
<string name="OptimizationInfo">Ova verzija aplikacija donosi mogućnost sinhronizacije sa statusnom stranom Disroot sajta. To znači da ćete u realnom vremenu dobijati poruke o problemima, zastojima, zakazanom održavanju i sl. putem https://state.disroot.org\nPreporučujemo da isključite optimizaciju baterije i dozvolite aplikaciji da radi u pozadini. Ako niste sigurni, podešavanja možete izmeniti iz menija Disroot aplikacije.</string>
<string name="id">id:</string>
<string name="version">App version:</string>
<string name="androidVersion">Android version:</string>
<string name="deviceName">Device name:</string>
</resources>
......@@ -160,4 +160,8 @@
<string name="action_optimization">Battery optimization</string>
<string name="OptimizationTitle">Battery optimization!</string>
<string name="OptimizationInfo">With this update the app can sync with the status page of Disroot. This means you will receive realtime updates on issues, downtimes, scheduled maintenace and others published via https://state.disroot.org\nWe recommend to turn off battery optimization and allow Disroot app to run in background. If you\'re not sure, you can always change the setting from the menu of the Disroot app later.</string>
<string name="id">id:</string>
<string name="version">App version:</string>
<string name="androidVersion">Android version:</string>
<string name="deviceName">Device name:</string>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<changelog>
<release version="1.2.3" versioncode="22" >
<change>Cleaned up code for better maintenance</change>
<change>Made Third party links klickable</change>
<change>Made application info fully translatable</change>
<change>Made Device info cully translatable</change>
</release>
<release version="1.2.2" versioncode="21" >
<change>Removed battery optimization promt on updates</change>
<change>Corrected links in description in F-droid</change>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment