diff --git a/README.md b/README.md index 2ee16cc..bb8317f 100644 --- a/README.md +++ b/README.md @@ -76,7 +76,11 @@ are a list of other projects that might be of interest to you. ## Changelog -##### [0.3.0](https://github.com/christianrowlands/android-network-survey-rooted/releases/tag/v0.2.0) - 2021-07-12 +##### [0.4.0](https://github.com/christianrowlands/android-network-survey-rooted/releases/tag/v0.4.0) - 2021-08-04 + * Added support for logging GSM RR Signaling messages to pcap records. + * Added the version number to the home screen. + +##### [0.3.0](https://github.com/christianrowlands/android-network-survey-rooted/releases/tag/v0.3.0) - 2021-07-12 * Added support for logging UMTS NAS and WCDMA RRC messages to pcap records. ##### [0.2.0](https://github.com/christianrowlands/android-network-survey-rooted/releases/tag/v0.2.0) - 2021-01-29 diff --git a/app/build.gradle b/app/build.gradle index c007cfe..de99eeb 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -12,7 +12,7 @@ android { minSdkVersion 26 targetSdkVersion 29 versionCode 6 - versionName "0.4.0-alpha01" + versionName "0.4.0" setProperty("archivesBaseName", "$applicationName-$versionName") testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } diff --git a/app/src/main/java/com/craxiom/networksurveyplus/ui/home/HomeFragment.java b/app/src/main/java/com/craxiom/networksurveyplus/ui/home/HomeFragment.java index 634c34e..45e46f6 100644 --- a/app/src/main/java/com/craxiom/networksurveyplus/ui/home/HomeFragment.java +++ b/app/src/main/java/com/craxiom/networksurveyplus/ui/home/HomeFragment.java @@ -2,6 +2,7 @@ import android.Manifest; import android.content.Context; +import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.graphics.Color; import android.location.Location; @@ -55,6 +56,10 @@ public View onCreateView(@NonNull LayoutInflater inflater, recordCount -> binding.tvRecordCount.setText(String.format(Locale.US, "%d", recordCount))); homeViewModel.getProviderStatus().observe(viewLifecycleOwner, this::updateLocationProviderStatus); + homeViewModel.getAppVersion().observe(viewLifecycleOwner, versionName -> binding.appVersionName.setText(getString(R.string.app_version, versionName))); + + setAppVersionNumber(); + return binding.getRoot(); } @@ -210,4 +215,22 @@ private void updateLocationProviderStatus(ServiceStatusMessage.LocationProviderS break; } } + + /** + * Get the app version number and set it at the bottom of the view. + * + * @since 0.4.0 + */ + private void setAppVersionNumber() + { + try + { + final Context context = requireContext(); + final PackageInfo info = context.getPackageManager().getPackageInfo(context.getPackageName(), 0); + binding.getVm().setAppVersion(info.versionName); + } catch (Exception e) + { + Timber.wtf(e, "Could not set the app version number"); + } + } } \ No newline at end of file diff --git a/app/src/main/java/com/craxiom/networksurveyplus/ui/home/HomeViewModel.java b/app/src/main/java/com/craxiom/networksurveyplus/ui/home/HomeViewModel.java index f758f5d..919a97e 100644 --- a/app/src/main/java/com/craxiom/networksurveyplus/ui/home/HomeViewModel.java +++ b/app/src/main/java/com/craxiom/networksurveyplus/ui/home/HomeViewModel.java @@ -20,6 +20,7 @@ public class HomeViewModel extends ViewModel implements IServiceStatusListener private final MutableLiveData location = new MutableLiveData<>(); private final MutableLiveData recordCount = new MutableLiveData<>(); private final MutableLiveData providerStatus = new MutableLiveData<>(); + private final MutableLiveData appVersion = new MutableLiveData<>(); public LiveData getLocation() { @@ -58,4 +59,14 @@ public void onServiceStatusMessage(ServiceStatusMessage serviceMessage) break; } } + + public LiveData getAppVersion() + { + return appVersion; + } + + public void setAppVersion(String version) + { + appVersion.postValue(version); + } } \ No newline at end of file diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index fc9ce7c..711c295 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -32,7 +32,7 @@ android:id="@+id/nav_host_fragment" android:name="androidx.navigation.fragment.NavHostFragment" android:layout_width="match_parent" - android:layout_height="wrap_content" + android:layout_height="match_parent" app:defaultNavHost="true" app:navGraph="@navigation/mobile_navigation" /> diff --git a/app/src/main/res/layout/fragment_home.xml b/app/src/main/res/layout/fragment_home.xml index 735473b..5e0c15a 100644 --- a/app/src/main/res/layout/fragment_home.xml +++ b/app/src/main/res/layout/fragment_home.xml @@ -1,79 +1,78 @@ + xmlns:tools="http://schemas.android.com/tools"> + name="vm" + type="com.craxiom.networksurveyplus.ui.home.HomeViewModel" /> - + + android:id="@+id/status_card_view" + style="?attr/cardStyle" + android:layout_width="match_parent" + android:layout_height="wrap_content"> + android:layout_width="match_parent" + android:layout_height="match_parent" + android:layout_marginLeft="10dp" + android:layout_marginTop="10dp" + android:layout_marginRight="10dp" + android:layout_marginBottom="10dp" + android:orientation="vertical"> + android:id="@+id/ll_location" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal"> + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_marginBottom="5dp" + android:layout_weight="1" + android:text="@string/location_placeholder" + android:textAppearance="@style/StatusText" /> + android:id="@+id/tv_location" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginBottom="5dp" + android:textAppearance="@style/StatusText" /> + android:id="@+id/ll_recordCount" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal"> + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="1" + android:text="@string/records_logged_placeholder" + android:textAppearance="@style/StatusText" /> + android:id="@+id/tv_recordCount" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:textAppearance="@style/StatusText" /> @@ -81,6 +80,23 @@ - + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 5f58e1d..717b9db 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -4,6 +4,8 @@ Settings MQTT + v%1$s + Network Survey+ Permissions The Network Survey+ app requires a couple permissions to work. Denying these permissions will result in the app not functioning properly. \n\n1. Access this Device\'s Location: This app creates a log file which includes the location at which the cellular record was captured.