show profile on main screen

This commit is contained in:
jens 2022-02-03 14:05:42 +01:00
parent d402986dc3
commit da244d1bbe
8 changed files with 55 additions and 7 deletions

View File

@ -42,7 +42,7 @@ public class ActivityMainScreen extends ActivityGeneric
ToggleButton toggleService, tbLockSound;
Button bShowHelp, bPrivacy, bAddSoundLockTIme, bDonate, bControlCenter;
TextView tvActivePoi, tvClosestPoi, tvLastRule, tvMainScreenNotePermissions, tvMainScreenNoteFeaturesFromOtherFlavor, tvMainScreenNoteLocationImpossibleBlameGoogle, tvMainScreenNoteNews, tvLockSoundDuration;
TextView tvActivePoi, tvClosestPoi, tvLastRule, tvLastProfile, tvMainScreenNotePermissions, tvMainScreenNoteFeaturesFromOtherFlavor, tvMainScreenNoteLocationImpossibleBlameGoogle, tvMainScreenNoteNews, tvLockSoundDuration;
ListView lvRuleHistory;
ArrayAdapter<Rule> ruleHistoryListViewAdapter;
@ -68,7 +68,8 @@ public class ActivityMainScreen extends ActivityGeneric
tvActivePoi = (TextView) findViewById(R.id.tvActivePoi);
tvClosestPoi = (TextView) findViewById(R.id.tvClosestPoi);
lvRuleHistory = (ListView) findViewById(R.id.lvRuleHistory);
tvLastRule = (TextView) findViewById(R.id.tvTimeFrameHelpText);
tvLastRule = (TextView) findViewById(R.id.tvLastRule);
tvLastProfile = (TextView)findViewById(R.id.tvLastProfile);
tvMainScreenNotePermissions = (TextView) findViewById(R.id.tvMainScreenNotePermissions);
tvMainScreenNoteFeaturesFromOtherFlavor = (TextView) findViewById(R.id.tvMainScreenNoteFeaturesFromOtherFlavor);
tvMainScreenNoteLocationImpossibleBlameGoogle = (TextView) findViewById(R.id.tvMainScreenNoteLocationImpossibleBlameGoogle);
@ -365,6 +366,16 @@ public class ActivityMainScreen extends ActivityGeneric
{
activityMainScreenInstance.tvLastRule.setText("n./a.");
}
try
{
activityMainScreenInstance.tvLastProfile.setText(Profile.getLastActivatedProfile().getName());
activityMainScreenInstance.updateListView();
}
catch (Exception e)
{
activityMainScreenInstance.tvLastRule.setText("n./a.");
}
}
else
{
@ -373,6 +384,7 @@ public class ActivityMainScreen extends ActivityGeneric
activityMainScreenInstance.tvActivePoi.setText(activityMainScreenInstance.getResources().getString(R.string.serviceNotRunning));
activityMainScreenInstance.tvClosestPoi.setText("");
activityMainScreenInstance.tvLastRule.setText("");
activityMainScreenInstance.tvLastProfile.setText("");
}
// uiUpdateRunning = true;

View File

@ -776,4 +776,11 @@ public class Profile implements Comparable<Profile>
return this.oldName;
}
public static Profile getLastActivatedProfile()
{
if(Profile.profileActivationHistory != null && Profile.profileActivationHistory.size() > 0)
return Profile.profileActivationHistory.get(Profile.profileActivationHistory.size() - 1);
else
return null;
}
}

View File

@ -46,7 +46,7 @@
android:orientation="horizontal" >
<TextView
android:id="@+id/tvTimeFrameHelpText"
android:id="@+id/tvLastRule"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="@string/latitude"

View File

@ -23,7 +23,7 @@
android:layout_height="wrap_content" />
<TextView
android:id="@+id/tvTimeFrameHelpText"
android:id="@+id/tvLastRule"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/end"

View File

@ -151,7 +151,7 @@
android:orientation="vertical"
android:layout_margin="10dp" >
<TextView
android:id="@+id/tvTimeFrameHelpText"
android:id="@+id/tvLastRule"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/helpTextTimeFrame" />

View File

@ -193,7 +193,7 @@
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="@+id/tvTimeFrameHelpText"
android:id="@+id/tvLastRule"
android:layout_width="0dip"
android:layout_weight="5"
android:layout_height="wrap_content"
@ -203,6 +203,34 @@
android:singleLine="false"
android:textSize="20dp" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:layout_marginTop="20dp" >
<TextView
android:layout_width="0dip"
android:layout_weight="5"
android:layout_height="wrap_content"
android:gravity="right"
android:text="@string/lastProfile"
android:scrollHorizontally="false"
android:singleLine="false"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="@+id/tvLastProfile"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_weight="5"
android:scrollHorizontally="false"
android:singleLine="false"
android:text="n./a."
android:textSize="20dp" />
</TableRow>
<TableRow
android:layout_width="fill_parent"

View File

@ -51,7 +51,7 @@
android:background="@color/barBackgroundColor" >
<TextView
android:id="@+id/tvTimeFrameHelpText"
android:id="@+id/tvLastRule"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/ruleList"

View File

@ -795,4 +795,5 @@
<string name="musicCheckFrequencyTitle">Check frequency [ms]</string>
<string name="musicCheckFrequencySummary">Milliseconds between checks</string>
<string name="locationNotWorkingOn12">Getting the location does not seem to be working on Android 12 devices currently. If it isn\'t working for you, I\'m sorry. I\'ll try to fix this as soon as I know the cause. So if the donut doesn\'t stop spinning, you know why.</string>
<string name="lastProfile">Last profile:</string>
</resources>