Skip to content

Commit

Permalink
Added android:screenOrientation="portrait" to prevent activity recrea…
Browse files Browse the repository at this point in the history
…tion on screen orientation changes. Also added a counter for the number of rows written to output CSV file.
  • Loading branch information
nstevens1040 committed Jul 1, 2024
1 parent 7eaf597 commit f0dfe57
Show file tree
Hide file tree
Showing 6 changed files with 890 additions and 849 deletions.
2 changes: 1 addition & 1 deletion .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,23 @@
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS"/>
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<!-- android:configChanges="keyboardHidden|orientation|screenSize"-->
<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@drawable/tower_icon"
android:configChanges="keyboardHidden|orientation|screenSize"
android:label="@string/app_name"
android:roundIcon="@drawable/new_circle_icon"
android:supportsRtl="true"
android:theme="@style/Theme.CellPerf"
tools:targetApi="31">
<activity
android:name=".MainActivity"
android:screenOrientation="portrait"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Expand Down
8 changes: 7 additions & 1 deletion app/src/main/java/org/nanick/nr5gperf/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
import org.apache.commons.io.IOUtils;

public class MainActivity extends AppCompatActivity {
public Integer csvRowNumber = 0;
public CellInfoObj cio = null;
private TelephonyManager telephonyManager;
public Double Latitude;
Expand Down Expand Up @@ -223,6 +224,7 @@ public void writeCsvRow(CellInfoObj cio){
csv_writer = new FileWriter(csv,true);
csv_writer.write(csv_string);
csv_writer.close();
this.csvRowNumber++;
// this.cio.Speed = 0.0;
// this.cio.Upload = 0.0;
} catch (IOException e) {
Expand Down Expand Up @@ -326,8 +328,8 @@ protected CellInfoObj doInBackground(Void...Params) {
protected void onPostExecute(CellInfoObj results) {
Log.i("nr5gperf","onPostExecute");

updateTextViews(results);
updateCsv(results);
updateTextViews(results);
}
private CellInfoObj DownloadTest(CellInfoObj cellios) throws IOException {
Log.i("nr5gperf","begin download test");
Expand Down Expand Up @@ -503,6 +505,8 @@ public void run() {
});
}
public void writeTextViews(CellInfoObj cellio){
fixTextViewHeight(allTextViews.rows,this.fortydpi,this.csvRowNumber+"");
fixTextViewHeight(allTextViews.rows_label,this.fortydpi);
fixTextViewHeight(allTextViews.rsrp,this.fortydpi,cellio.Rsrp+" dBm");
fixTextViewHeight(allTextViews.rsrp_label,this.fortydpi);
if(cellio.SsRsrp != 0){
Expand Down Expand Up @@ -1044,6 +1048,7 @@ private void updateLocation(Location location) {
public class AllTextViews {
public AllTextViews(){
}
public TextView rows = ((TextView)findViewById(R.id.rows));
public TextView rsrp = ((TextView)findViewById(R.id.rsrp));
public TextView ssrsrp = ((TextView)findViewById(R.id.ssrsrp));
public TextView downloadspeed = ((TextView)findViewById(R.id.downloadspeed));
Expand All @@ -1068,6 +1073,7 @@ public AllTextViews(){
public TextView nrspectrum = ((TextView)findViewById(R.id.nrspectrum));
public TextView nrpci = ((TextView)findViewById(R.id.nrpci));
public TextView nrtac = ((TextView)findViewById(R.id.nrtac));
public TextView rows_label = ((TextView)findViewById(R.id.rows_label));
public TextView rsrp_label = ((TextView)findViewById(R.id.rsrp_label));
public TextView ssrsrp_label = ((TextView)findViewById(R.id.ssrsrp_label));
public TextView downloadspeed_label = ((TextView)findViewById(R.id.downloadspeed_label));
Expand Down
Loading

0 comments on commit f0dfe57

Please sign in to comment.