Commit f0a6e2f9 authored by René Nierath's avatar René Nierath

Commit 3

- Problem solved for HSA EditText updateloop with seekbar in HSA-Umrechner
- Adding filter max value for HSA
- Adding licence
- Deleting ExpandableTextView in Info
- Updating privacy policy
parent e6cd5bba
......@@ -30,6 +30,4 @@ dependencies {
})
compile 'com.android.support:appcompat-v7:26.1.0'
testCompile 'junit:junit:4.12'
compile 'com.ms-square:expandableTextView:0.1.4'
}
......@@ -4,6 +4,8 @@ import android.content.Context;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.text.Editable;
import android.text.InputFilter;
import android.text.Spanned;
import android.text.TextWatcher;
import android.view.View;
import android.view.WindowManager;
......@@ -20,10 +22,38 @@ public class HSA_Umrechner extends AppCompatActivity {
Button Berechnen, Clear, Runden;
final Context context = this;
int Runden_counter;
int Runden_counter, prevent_loop;
double raw_sph_out, raw_cyl_out;
double round_sph_out, round_cyl_out;
// Erstellt einen Filter der die Eingabe des HSA auf max 40 mm beschränkt
public class InputFilterMinMax implements InputFilter {
private int min;
private int max;
public InputFilterMinMax(int min, int max) {
this.min = min;
this.max = max;
}
@Override
public CharSequence filter(CharSequence source, int start, int end, Spanned dest,
int dstart, int dend) {
try {
double input = Double.parseDouble(dest.subSequence(0, dstart).toString() +
source + dest.subSequence(dend, dest.length()));
if (isInRange(min, max, input))
return null;
} catch (NumberFormatException nfe) { }
return "";
}
private boolean isInRange(double a, double b, double c) {
return b > a ? c >= a && c <= b : c >= b && c <= a;
}
}
@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
......@@ -35,7 +65,9 @@ public class HSA_Umrechner extends AppCompatActivity {
Sph_in = (EditText) findViewById(R.id.in_sph);
Cyl_in = (EditText) findViewById(R.id.in_cyl);
HSA_in = (EditText) findViewById(R.id.in_hsa);
HSA_in.setFilters(new InputFilter[]{new InputFilterMinMax(0, 40)});
HSA_out = (EditText) findViewById(R.id.out_hsa);
HSA_out.setFilters(new InputFilter[]{new InputFilterMinMax(0, 40)});
Sph_out = (TextView) findViewById(R.id.out_sph);
Cyl_out = (TextView) findViewById(R.id.out_cyl);
......@@ -48,6 +80,7 @@ public class HSA_Umrechner extends AppCompatActivity {
Runden = (Button) findViewById(R.id.bt_runden);
Runden_counter = 0;
prevent_loop = 0;
// Liest den Status aus dem EditText HSA_in aus und weißt den Betrag
// der Seekbar HSA_bar_in zu
......@@ -65,6 +98,8 @@ public class HSA_Umrechner extends AppCompatActivity {
@Override
public void afterTextChanged(Editable editable) {
prevent_loop = 1;
try {
HSA_bar_in.setProgress(Integer.parseInt(editable.toString()));
} catch (Exception ex) {}
......@@ -88,6 +123,8 @@ public class HSA_Umrechner extends AppCompatActivity {
@Override
public void afterTextChanged(Editable editable) {
prevent_loop = 1;
try {
HSA_bar_out.setProgress(Integer.parseInt(editable.toString()));
} catch (Exception ex) {}
......@@ -112,9 +149,13 @@ public class HSA_Umrechner extends AppCompatActivity {
@Override
public void onProgressChanged(SeekBar seekBar, int progress,boolean fromUser) {
HSA_in.setText(Integer.toString(progress));
if (prevent_loop == 0) {
HSA_in.setText(Integer.toString(progress));
}
HSA_berechnen();
prevent_loop = 0;
}
});
......@@ -135,9 +176,13 @@ public class HSA_Umrechner extends AppCompatActivity {
@Override
public void onProgressChanged(SeekBar seekBar, int progress,boolean fromUser) {
HSA_out.setText(Integer.toString(progress));
if (prevent_loop == 0) {
HSA_out.setText(Integer.toString(progress));
}
HSA_berechnen();
prevent_loop = 0;
}
});
......
......@@ -8,14 +8,11 @@ import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import com.ms.square.android.expandabletextview.ExpandableTextView;
public class Info extends AppCompatActivity {
ImageView banner_hs;
TextView datenschutz, datenverwendung, aenderungen;
ExpandableTextView expand_absturz, expand_berechtigungen, expand_webseiten, expand_source;
TextView absturz, berechtigungen, webseiten, source, lizenz;
@Override
protected void onCreate(Bundle savedInstanceState) {
......@@ -32,7 +29,7 @@ public class Info extends AppCompatActivity {
banner_hs.setVisibility(View.VISIBLE);
}
String datenschutz_textinhalt = "<big><b>Datenschutzerklärung</b></big><br><br><small><small>Stand: 07.07.2017<br><br>" +
String datenschutz_textinhalt = "<big><b>Datenschutzerklärung</b></big><br><br><small><small>Stand: 19.08.2018<br><br>" +
"Entwickler: B. Sc. René Nierath<br>" +
"Versionsnummer: 1.10<br>" +
"<br>" +
......@@ -75,16 +72,43 @@ public class Info extends AppCompatActivity {
String webseiten_textinhalt = "<b>Links zu Webseiten</b><br>" +
"<small><small>Der <b>Aalener Optik-Formelrechner</b> verlinkt die Webseite der Hochschule Aalen, zu GitHub und den Lizenzbestimmungen von Apache als Klartext in der Informationsübersicht. Um auf die Webseite zu gelangen, müssen Sie die Seite manuell in Ihrem Browser aufrufen. Für die Datenschutzbestimmung der verlinkten Seiten ist der jeweilige Seitenbetreiber selbst verantwortlich.</small></small>";
String source_textinhalt = "<b>Open Source Lizenzen</b><br>" +
String lizenz_textinhalt = "<b>Lizenz</b><br>" +
"<small><<b>Aalener Optik-Formelrechner</b></small><br>" +
"<small><small>Copyright 2017-2018 René Nierath<br>" +
"https://gitlab.com/HS_Aalen_RN/Aalener_Optik-Formelrechner</small></small><br>" +
"<br>" +
"<small><small>This program 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.<br>" +
"<br>" +
"This program 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.<br>" +
"<br>" +
"You should have received a copy of the GNU General Public License" +
"along with this program. If not, see <br>https://www.gnu.org/licenses .<br>" +
"<br>" +
"Dieses Programm ist Freie Software: Sie können es unter den Bedingungen" +
"der GNU General Public License, wie von der Free Software Foundation," +
"Version 3 der Lizenz oder (nach Ihrer Wahl) jeder neueren" +
"veröffentlichten Version, weiter verteilen und/oder modifizieren.<br>" +
"<br>" +
"Dieses Programm wird in der Hoffnung bereitgestellt, dass es nützlich sein wird, jedoch" +
"OHNE JEDE GEWÄHR,; sogar ohne die implizite" +
"Gewähr der MARKTFÄHIGKEIT oder EIGNUNG FÜR EINEN BESTIMMTEN ZWECK." +
"Siehe die GNU General Public License für weitere Einzelheiten.<br>" +
"<br>" +
"Sie sollten eine Kopie der GNU General Public License zusammen mit diesem" +
"Programm erhalten haben. Wenn nicht, siehe <br>https://www.gnu.org/licenses .</small></small>";
String source_textinhalt = "<b>Externe Software</b><br>" +
"<small><b>MPAndroidChart</b></small><br>" +
"<small><small>Copyright 2016 Philipp Jahoda<br>" +
"<small><small>Copyright 2018 Philipp Jahoda<br>" +
"https://github.com/PhilJay/MPAndroidChart</small></small><br><br>" +
"<small><b>ExpandableTextView</b></small><br>" +
"<small><small>Copyright 2014 Manabu Shimobe<br>" +
"https://github.com/Manabu-GT/ExpandableTextView<br><br>" +
"Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at<br><br>" +
"<small><small>Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at<br><br>" +
"http://www.apache.org/licenses/LICENSE-2.0<br><br>" +
"Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.</small></small>";
......@@ -94,20 +118,23 @@ public class Info extends AppCompatActivity {
datenschutz = (TextView)findViewById(R.id.datenschutz_text);
datenschutz.setText(Html.fromHtml(datenschutz_textinhalt));
expand_absturz = (ExpandableTextView)findViewById(R.id.expand_text_absturz);
expand_absturz.setText(Html.fromHtml(absturz_textinhalt));
absturz = (TextView) findViewById(R.id.absturz_text);
absturz.setText(Html.fromHtml(absturz_textinhalt));
expand_berechtigungen = (ExpandableTextView)findViewById(R.id.expand_text_berechtigungen);
expand_berechtigungen.setText(Html.fromHtml(berechtigungen_textinhalt));
berechtigungen = (TextView)findViewById(R.id.berechtigungen_text);
berechtigungen.setText(Html.fromHtml(berechtigungen_textinhalt));
datenverwendung = (TextView)findViewById(R.id.datenverwendung_text);
datenverwendung.setText(Html.fromHtml(datenverwendung_textinhalt));
expand_webseiten = (ExpandableTextView)findViewById(R.id.expand_text_webseiten);
expand_webseiten.setText(Html.fromHtml(webseiten_textinhalt));
webseiten = (TextView)findViewById(R.id.webseiten_text);
webseiten.setText(Html.fromHtml(webseiten_textinhalt));
lizenz = (TextView)findViewById(R.id.lizenz_text);
lizenz.setText(Html.fromHtml(lizenz_textinhalt));
expand_source = (ExpandableTextView)findViewById(R.id.expand_text_source);
expand_source.setText(Html.fromHtml(source_textinhalt));
source = (TextView)findViewById(R.id.source_text);
source.setText(Html.fromHtml(source_textinhalt));
aenderungen = (TextView)findViewById(R.id.aenderungen_text);
aenderungen.setText(Html.fromHtml(aenderungen_textinhalt));
......
......@@ -46,72 +46,31 @@
android:layout_height="10dp"
android:visibility="visible" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.ms.square.android.expandabletextview.ExpandableTextView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:expandableTextView="http://schemas.android.com/apk/res-auto"
android:id="@+id/expand_text_absturz"
<TextView
android:id="@+id/absturz_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
expandableTextView:maxCollapsedLines="4"
expandableTextView:animDuration="200">
<TextView
android:id="@id/expandable_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:textSize="16dp"
/>
<ImageButton
android:id="@id/expand_collapse"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:layout_gravity="right|bottom"
android:background="@android:color/transparent"/>
</com.ms.square.android.expandabletextview.ExpandableTextView>
</ScrollView>
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:textSize="16dp"
/>
<Space
android:layout_width="match_parent"
android:layout_height="10dp"
android:visibility="visible" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.ms.square.android.expandabletextview.ExpandableTextView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:expandableTextView="http://schemas.android.com/apk/res-auto"
android:id="@+id/expand_text_berechtigungen"
android:layout_width="match_parent"
android:layout_height="wrap_content"
expandableTextView:maxCollapsedLines="4"
expandableTextView:animDuration="200">
<TextView
android:id="@id/expandable_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:textSize="16dp"
/>
<ImageButton
android:id="@id/expand_collapse"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:layout_gravity="right|bottom"
android:background="@android:color/transparent"/>
</com.ms.square.android.expandabletextview.ExpandableTextView>
</ScrollView>
<TextView
android:id="@+id/berechtigungen_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:textSize="16dp"
/>
<Space
android:layout_width="match_parent"
......@@ -132,72 +91,42 @@
android:layout_height="10dp"
android:visibility="visible" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.ms.square.android.expandabletextview.ExpandableTextView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:expandableTextView="http://schemas.android.com/apk/res-auto"
android:id="@+id/expand_text_webseiten"
android:layout_width="match_parent"
android:layout_height="wrap_content"
expandableTextView:maxCollapsedLines="4"
expandableTextView:animDuration="200">
<TextView
android:id="@id/expandable_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:textSize="16dp"
/>
<ImageButton
android:id="@id/expand_collapse"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:layout_gravity="right|bottom"
android:background="@android:color/transparent"/>
</com.ms.square.android.expandabletextview.ExpandableTextView>
</ScrollView>
<TextView
android:id="@+id/webseiten_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:textSize="16dp"
/>
<Space
android:layout_width="match_parent"
android:layout_height="10dp"
android:visibility="visible" />
<TextView
android:id="@+id/lizenz_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:textSize="16dp"
/>
<Space
android:layout_width="match_parent"
android:layout_height="10dp"
android:visibility="visible" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.ms.square.android.expandabletextview.ExpandableTextView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:expandableTextView="http://schemas.android.com/apk/res-auto"
android:id="@+id/expand_text_source"
android:layout_width="match_parent"
android:layout_height="wrap_content"
expandableTextView:maxCollapsedLines="8"
expandableTextView:animDuration="200">
<TextView
android:id="@id/expandable_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:textSize="16dp"
/>
<ImageButton
android:id="@id/expand_collapse"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:layout_gravity="right|bottom"
android:background="@android:color/transparent"/>
</com.ms.square.android.expandabletextview.ExpandableTextView>
</ScrollView>
<TextView
android:id="@+id/source_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:textSize="16dp"
/>
<Space
android:layout_width="match_parent"
......
Markdown is supported
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