refactored GUI
This commit is contained in:
parent
79a4b177c6
commit
15d39f4895
|
@ -0,0 +1,78 @@
|
||||||
|
# ---> Android
|
||||||
|
# Gradle files
|
||||||
|
.gradle/
|
||||||
|
build/
|
||||||
|
|
||||||
|
# Local configuration file (sdk path, etc)
|
||||||
|
local.properties
|
||||||
|
|
||||||
|
# Log/OS Files
|
||||||
|
*.log
|
||||||
|
|
||||||
|
# Android Studio generated files and folders
|
||||||
|
captures/
|
||||||
|
.externalNativeBuild/
|
||||||
|
.cxx/
|
||||||
|
*.apk
|
||||||
|
output.json
|
||||||
|
|
||||||
|
# IntelliJ
|
||||||
|
*.iml
|
||||||
|
.idea/
|
||||||
|
|
||||||
|
# Keystore files
|
||||||
|
*.jks
|
||||||
|
*.keystore
|
||||||
|
|
||||||
|
# Google Services (e.g. APIs or Firebase)
|
||||||
|
google-services.json
|
||||||
|
|
||||||
|
# Android Profiling
|
||||||
|
*.hprof
|
||||||
|
|
||||||
|
# ---> Kotlin
|
||||||
|
# Compiled class file
|
||||||
|
*.class
|
||||||
|
|
||||||
|
# Log file
|
||||||
|
*.log
|
||||||
|
|
||||||
|
# BlueJ files
|
||||||
|
*.ctxt
|
||||||
|
|
||||||
|
# Mobile Tools for Java (J2ME)
|
||||||
|
.mtj.tmp/
|
||||||
|
|
||||||
|
# Package Files #
|
||||||
|
*.jar
|
||||||
|
*.war
|
||||||
|
*.nar
|
||||||
|
*.ear
|
||||||
|
*.zip
|
||||||
|
*.tar.gz
|
||||||
|
*.rar
|
||||||
|
|
||||||
|
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||||
|
hs_err_pid*
|
||||||
|
replay_pid*
|
||||||
|
|
||||||
|
# ---> Gradle
|
||||||
|
.gradle
|
||||||
|
**/build/
|
||||||
|
!src/**/build/
|
||||||
|
|
||||||
|
# Ignore Gradle GUI config
|
||||||
|
gradle-app.setting
|
||||||
|
|
||||||
|
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
|
||||||
|
!gradle-wrapper.jar
|
||||||
|
|
||||||
|
# Cache of project
|
||||||
|
.gradletasknamecache
|
||||||
|
|
||||||
|
# Eclipse Gradle plugin generated files
|
||||||
|
# Eclipse Core
|
||||||
|
.project
|
||||||
|
# JDT-specific (Eclipse Java Development Tools)
|
||||||
|
.classpath
|
||||||
|
|
|
@ -8,6 +8,7 @@ import android.location.LocationManager;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import android.widget.EditText;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
@ -46,7 +47,7 @@ public class MainActivity extends AppCompatActivity {
|
||||||
Toast.makeText(cntxToastInternGNSSUpdate, "Permission granted!", Toast.LENGTH_SHORT).show();
|
Toast.makeText(cntxToastInternGNSSUpdate, "Permission granted!", Toast.LENGTH_SHORT).show();
|
||||||
|
|
||||||
// Get the output UI
|
// Get the output UI
|
||||||
output = (TextView) findViewById(R.id.interngnss);
|
// output = (TextView) findViewById(R.id.interngnssLongTextView);
|
||||||
|
|
||||||
// Test print
|
// Test print
|
||||||
///printlnOnView(output, "Running!");
|
///printlnOnView(output, "Running!");
|
||||||
|
@ -78,12 +79,10 @@ public class MainActivity extends AppCompatActivity {
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
private void setEditTextLabel(final EditText v, final String str) {
|
||||||
// Die Nachfolgenden Methoden können Sie aus einem Worker-Thread aufrufen
|
|
||||||
private void printlnOnView(final TextView v, final String str) {
|
|
||||||
Runnable myRun = new Runnable() {
|
Runnable myRun = new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
v.setText(str + "\n");
|
v.setText(str);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
runOnUiThread(myRun);
|
runOnUiThread(myRun);
|
||||||
|
@ -143,48 +142,32 @@ public class MainActivity extends AppCompatActivity {
|
||||||
}).start();
|
}).start();
|
||||||
} else {
|
} else {
|
||||||
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, locationListener);
|
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, locationListener);
|
||||||
|
|
||||||
// Worker-Thread
|
// Worker-Thread
|
||||||
new Thread(
|
new Thread(
|
||||||
new Runnable() {
|
new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|
||||||
|
|
||||||
while (doRun) {
|
while (doRun) {
|
||||||
// Log.i("HAG", "ok");
|
if (locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER) != null) {
|
||||||
|
setEditTextLabel((EditText) findViewById(R.id.interngnssLatNumber), Double.toString(locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER).getLatitude()));
|
||||||
//
|
setEditTextLabel((EditText) findViewById(R.id.interngnssLongNumber), Double.toString(locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER).getLongitude()));
|
||||||
// Aufgabe 3
|
setEditTextLabel((EditText) findViewById(R.id.interngnssAltitudeNumber), Double.toString(locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER).getAltitude()));
|
||||||
//
|
setEditTextLabel((EditText) findViewById(R.id.interngnssAccuracyNumber), Double.toString(locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER).getAccuracy()));
|
||||||
// Geben Sie via printOnView die getLastKnownLocation() von
|
setEditTextLabel((EditText) findViewById(R.id.interngnssSatCountNumber), Integer.toString(locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER).getExtras().getInt("satellites")));
|
||||||
// Network-Provider und GPS-Provider aus
|
|
||||||
//
|
|
||||||
|
|
||||||
printlnOnView(output, "Lat: " + locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER).getLatitude()
|
|
||||||
+ " Long: " + locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER).getLongitude()
|
|
||||||
+ " Accuracy: " + locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER).getAccuracy()
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// Aufgabe 4
|
|
||||||
//
|
|
||||||
// Erzeugen Sie eine WebView und zeigen Sie mittels der WebView
|
|
||||||
// alternierend die Location von Network und GPS auf der Karte an
|
|
||||||
//
|
|
||||||
//
|
|
||||||
|
|
||||||
|
}else{
|
||||||
|
setEditTextLabel((EditText) findViewById(R.id.interngnssLatNumber), "no signal");
|
||||||
|
setEditTextLabel((EditText) findViewById(R.id.interngnssLongNumber), "no signal");
|
||||||
|
setEditTextLabel((EditText) findViewById(R.id.interngnssAltitudeNumber), "no signal");
|
||||||
|
setEditTextLabel((EditText) findViewById(R.id.interngnssAccuracyNumber), "no signal");
|
||||||
|
setEditTextLabel((EditText) findViewById(R.id.interngnssSatCountNumber),"no signal");
|
||||||
|
}
|
||||||
runOnUiThread(new Runnable() {
|
runOnUiThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
//Update
|
//Update
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
sleep(10000);
|
sleep(10000);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
|
@ -193,7 +176,6 @@ public class MainActivity extends AppCompatActivity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).start();
|
}).start();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,15 +7,156 @@
|
||||||
android:layout_height="fill_parent">
|
android:layout_height="fill_parent">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/interngnss"
|
android:id="@+id/interngnssLongTextView"
|
||||||
android:layout_width="390dp"
|
android:layout_width="70dp"
|
||||||
android:layout_height="46dp"
|
android:layout_height="32dp"
|
||||||
android:layout_marginStart="21dp"
|
android:layout_marginStart="16dp"
|
||||||
android:layout_marginLeft="21dp"
|
android:layout_marginLeft="16dp"
|
||||||
android:layout_marginTop="176dp"
|
android:text="Long:"
|
||||||
android:text="TextView"
|
android:textSize="18sp"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintBottom_toBottomOf="@+id/interngnssLongNumber"
|
||||||
app:layout_constraintHorizontal_bias="1.0"
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/interngnssLatTextView"
|
||||||
|
android:layout_width="70dp"
|
||||||
|
android:layout_height="32dp"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:layout_marginLeft="16dp"
|
||||||
|
android:text="Lat:"
|
||||||
|
android:textSize="18sp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@+id/interngnssLatNumber"
|
||||||
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/interngnssAltitudeTextView"
|
||||||
|
android:layout_width="70dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:layout_marginLeft="16dp"
|
||||||
|
android:text="Altitude:"
|
||||||
|
android:textSize="18sp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@+id/interngnssAltitudeNumber"
|
||||||
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/interngnssNameTextView"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="32dp"
|
||||||
|
android:layout_marginLeft="32dp"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:clickable="false"
|
||||||
|
android:text="Intern GNSS Receiver"
|
||||||
|
android:textAppearance="@style/TextAppearance.AppCompat.Large"
|
||||||
|
android:textStyle="bold"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/interngnssAccuracyTextView"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="32dp"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:layout_marginLeft="16dp"
|
||||||
|
android:text="Accuracy:"
|
||||||
|
android:textSize="18sp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@+id/interngnssAccuracyNumber"
|
||||||
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/interngnssSatCountTextView"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="32dp"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:layout_marginLeft="16dp"
|
||||||
|
android:text="Satellites:"
|
||||||
|
android:textSize="18sp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@+id/interngnssSatCountNumber"
|
||||||
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/interngnssLatNumber"
|
||||||
|
android:layout_width="150dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="128dp"
|
||||||
|
android:layout_marginLeft="128dp"
|
||||||
|
android:layout_marginTop="4dp"
|
||||||
|
android:clickable="false"
|
||||||
|
android:cursorVisible="false"
|
||||||
|
android:ems="16"
|
||||||
|
android:focusable="false"
|
||||||
|
android:focusableInTouchMode="false"
|
||||||
|
android:inputType="numberDecimal"
|
||||||
|
android:textSize="16sp"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/interngnssNameTextView" />
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/interngnssLongNumber"
|
||||||
|
android:layout_width="150dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="128dp"
|
||||||
|
android:layout_marginLeft="128dp"
|
||||||
|
android:layout_marginTop="4dp"
|
||||||
|
android:clickable="false"
|
||||||
|
android:cursorVisible="false"
|
||||||
|
android:ems="16"
|
||||||
|
android:focusable="false"
|
||||||
|
android:focusableInTouchMode="false"
|
||||||
|
android:inputType="numberDecimal"
|
||||||
|
android:textSize="16sp"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/interngnssLatNumber" />
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/interngnssAltitudeNumber"
|
||||||
|
android:layout_width="150dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="128dp"
|
||||||
|
android:layout_marginLeft="128dp"
|
||||||
|
android:layout_marginTop="4dp"
|
||||||
|
android:clickable="false"
|
||||||
|
android:cursorVisible="false"
|
||||||
|
android:ems="16"
|
||||||
|
android:focusable="false"
|
||||||
|
android:focusableInTouchMode="false"
|
||||||
|
android:inputType="numberDecimal"
|
||||||
|
android:textSize="16sp"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/interngnssLongNumber" />
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/interngnssAccuracyNumber"
|
||||||
|
android:layout_width="150dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="128dp"
|
||||||
|
android:layout_marginLeft="128dp"
|
||||||
|
android:layout_marginTop="4dp"
|
||||||
|
android:clickable="false"
|
||||||
|
android:cursorVisible="false"
|
||||||
|
android:ems="16"
|
||||||
|
android:focusable="false"
|
||||||
|
android:focusableInTouchMode="false"
|
||||||
|
android:inputType="numberDecimal"
|
||||||
|
android:textSize="16sp"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/interngnssAltitudeNumber" />
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/interngnssSatCountNumber"
|
||||||
|
android:layout_width="150dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="128dp"
|
||||||
|
android:layout_marginLeft="128dp"
|
||||||
|
android:layout_marginTop="4dp"
|
||||||
|
android:clickable="false"
|
||||||
|
android:cursorVisible="false"
|
||||||
|
android:ems="16"
|
||||||
|
android:focusable="false"
|
||||||
|
android:focusableInTouchMode="false"
|
||||||
|
android:inputType="number"
|
||||||
|
android:textSize="16sp"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/interngnssAccuracyNumber" />
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
Loading…
Reference in New Issue