mirror of
https://github.com/woheller69/solxpect.git
synced 2025-09-22 00:40:46 +02:00
show current sun position also in edit location dialog
This commit is contained in:
parent
7ba379a8f9
commit
eb5043d4f2
4 changed files with 49 additions and 6 deletions
|
@ -23,6 +23,10 @@ import android.widget.LinearLayout;
|
|||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import net.e175.klaus.solarpositioning.AzimuthZenithAngle;
|
||||
import net.e175.klaus.solarpositioning.DeltaT;
|
||||
import net.e175.klaus.solarpositioning.Grena3;
|
||||
|
||||
import org.woheller69.weather.R;
|
||||
import org.woheller69.weather.SolarPowerPlant;
|
||||
import org.woheller69.weather.database.City;
|
||||
|
@ -30,10 +34,14 @@ import org.woheller69.weather.database.CityToWatch;
|
|||
import org.woheller69.weather.database.SQLiteHelper;
|
||||
import org.woheller69.weather.dialogs.AddLocationDialogOmGeocodingAPI;
|
||||
import org.woheller69.weather.ui.Help.InputFilterMinMax;
|
||||
import org.woheller69.weather.ui.Help.StringFormatUtils;
|
||||
import org.woheller69.weather.ui.RecycleList.RecyclerItemClickListener;
|
||||
import org.woheller69.weather.ui.RecycleList.RecyclerOverviewListAdapter;
|
||||
import org.woheller69.weather.ui.RecycleList.SimpleItemTouchHelperCallback;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
@ -195,6 +203,19 @@ public class ManageLocationsActivity extends NavigationActivity {
|
|||
EditText editAlbedo = (EditText) dialogView.findViewById(R.id.EditLocation_Albedo);
|
||||
EditText editInverterPowerLimit = (EditText) dialogView.findViewById(R.id.EditLocation_Inverter_Power_Limit);
|
||||
EditText editInverterEfficiency = (EditText) dialogView.findViewById(R.id.EditLocation_Inverter_Efficiency);
|
||||
TextView currentAzimuth = (TextView) dialogView.findViewById(R.id.edit_current_azi_ele);
|
||||
|
||||
Long time = System.currentTimeMillis()/1000;
|
||||
ZonedDateTime dateTime = ZonedDateTime.ofInstant(Instant.ofEpochSecond(time), ZoneId.of("GMT"));
|
||||
AzimuthZenithAngle position = Grena3.calculateSolarPosition(
|
||||
dateTime,
|
||||
city.getLatitude(),
|
||||
city.getLongitude(),
|
||||
DeltaT.estimate(dateTime.toLocalDate()));
|
||||
|
||||
String solarAzimuth = StringFormatUtils.formatDecimal((float) position.getAzimuth(),"");
|
||||
String solarElevation = StringFormatUtils.formatDecimal((float) (90 - position.getZenithAngle()),"");
|
||||
currentAzimuth.setText(getString(R.string.edit_location_hint_azimuth)+": "+solarAzimuth + " " + getString(R.string.action_sun_elevation) + ": " + solarElevation);
|
||||
|
||||
editCity.setText(city.getCityName());
|
||||
editLatitude.setText(Float.toString(city.getLatitude()));
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textStyle="bold"
|
||||
android:hint="@string/edit_location_hint_name"/>
|
||||
<androidx.appcompat.widget.AppCompatEditText
|
||||
android:id="@+id/EditLocation_Name"
|
||||
|
@ -24,6 +25,7 @@
|
|||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textStyle="bold"
|
||||
android:hint="@string/edit_location_hint_latitude"/>
|
||||
<androidx.appcompat.widget.AppCompatEditText
|
||||
android:id="@+id/EditLocation_Lat"
|
||||
|
@ -34,6 +36,7 @@
|
|||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textStyle="bold"
|
||||
android:hint="@string/edit_location_hint_longitude"/>
|
||||
<androidx.appcompat.widget.AppCompatEditText
|
||||
android:id="@+id/EditLocation_Lon"
|
||||
|
@ -44,6 +47,7 @@
|
|||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textStyle="bold"
|
||||
android:hint="@string/edit_location_hint_azimuth"/>
|
||||
|
||||
<com.redinput.compassview.CompassView
|
||||
|
@ -68,6 +72,7 @@
|
|||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textStyle="bold"
|
||||
android:hint="@string/edit_location_hint_tilt"/>
|
||||
<androidx.appcompat.widget.AppCompatEditText
|
||||
android:id="@+id/EditLocation_Tilt"
|
||||
|
@ -78,6 +83,7 @@
|
|||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textStyle="bold"
|
||||
android:hint="@string/edit_location_hint_cells_max_power"/>
|
||||
<androidx.appcompat.widget.AppCompatEditText
|
||||
android:id="@+id/EditLocation_Cell_Max_Power"
|
||||
|
@ -88,6 +94,7 @@
|
|||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textStyle="bold"
|
||||
android:hint="@string/edit_location_hint_cells_area"/>
|
||||
<androidx.appcompat.widget.AppCompatEditText
|
||||
android:id="@+id/EditLocation_Cells_Area"
|
||||
|
@ -98,6 +105,7 @@
|
|||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textStyle="bold"
|
||||
android:hint="@string/edit_location_hint_cells_efficiency"/>
|
||||
<androidx.appcompat.widget.AppCompatEditText
|
||||
android:id="@+id/EditLocation_Cell_Efficiency"
|
||||
|
@ -108,6 +116,7 @@
|
|||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textStyle="bold"
|
||||
android:hint="@string/edit_location_hint_cells_temp_coeff"/>
|
||||
<androidx.appcompat.widget.AppCompatEditText
|
||||
android:id="@+id/EditLocation_Cell_Temp_Coeff"
|
||||
|
@ -118,6 +127,7 @@
|
|||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textStyle="bold"
|
||||
android:hint="@string/edit_location_hint_diffuse_efficiency"/>
|
||||
<androidx.appcompat.widget.AppCompatEditText
|
||||
android:id="@+id/EditLocation_Diffuse_Efficiency"
|
||||
|
@ -125,10 +135,10 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:hint="@string/edit_location_hint_diffuse_efficiency"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textStyle="bold"
|
||||
android:hint="@string/edit_location_hint_albedo"/>
|
||||
<androidx.appcompat.widget.AppCompatEditText
|
||||
android:id="@+id/EditLocation_Albedo"
|
||||
|
@ -136,12 +146,10 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:hint="@string/edit_location_hint_albedo"/>
|
||||
|
||||
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textStyle="bold"
|
||||
android:hint="@string/edit_location_hint_inverter_power_limit"/>
|
||||
<androidx.appcompat.widget.AppCompatEditText
|
||||
android:id="@+id/EditLocation_Inverter_Power_Limit"
|
||||
|
@ -152,6 +160,7 @@
|
|||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textStyle="bold"
|
||||
android:hint="@string/edit_location_hint_inverter_efficiency"/>
|
||||
<androidx.appcompat.widget.AppCompatEditText
|
||||
android:id="@+id/EditLocation_Inverter_Efficiency"
|
||||
|
@ -169,9 +178,22 @@
|
|||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textStyle="bold"
|
||||
android:text="@string/edit_location_shading_heading"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
|
||||
android:layout_marginBottom="10dp"/>
|
||||
<TextView
|
||||
android:paddingLeft="5px"
|
||||
android:text="@string/action_sun_position"
|
||||
android:textStyle="bold"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
<TextView
|
||||
android:id="@+id/edit_current_azi_ele"
|
||||
android:paddingLeft="5px"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="10dp"/>
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
|
|
@ -93,7 +93,7 @@
|
|||
<string name="edit_location_shading_opacity_heading">Abschattung unterhalb dieser Elevation [%]</string>
|
||||
<string name="edit_location_shading_heading">Abschattung</string>
|
||||
<string name="activity_help">Anleitung</string>
|
||||
<string name="action_sun_position">Sonnenposition</string>
|
||||
<string name="action_sun_position">Aktuelle Sonnenposition</string>
|
||||
<string name="action_sun_elevation">Elevation [°]</string>
|
||||
<string name="edit_location_hint_cells_temp_coeff">Temperaturkoeffizient [%/K]</string>
|
||||
<string name="activity_backuprestore">Sichern/Wiederherstellen</string>
|
||||
|
|
|
@ -95,7 +95,7 @@
|
|||
<string name="edit_location_shading_opacity_heading">Shading below this elevation [%]</string>
|
||||
<string name="edit_location_shading_heading">Shading</string>
|
||||
<string name="activity_help">Instructions</string>
|
||||
<string name="action_sun_position">Sun position</string>
|
||||
<string name="action_sun_position">Current sun position</string>
|
||||
<string name="action_sun_elevation">Elevation [°]</string>
|
||||
<string name="edit_location_hint_cells_temp_coeff">Temperature coefficient [%/K]</string>
|
||||
<string name="activity_backuprestore">Backup/Restore</string>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue