diff --git a/.idea/misc.xml b/.idea/misc.xml index 8774759..7158618 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -37,7 +37,7 @@ - + diff --git a/app/src/main/java/com/vmal/solarify/ApplianceListActivity.java b/app/src/main/java/com/vmal/solarify/ApplianceListActivity.java index b8304ed..4d140bf 100644 --- a/app/src/main/java/com/vmal/solarify/ApplianceListActivity.java +++ b/app/src/main/java/com/vmal/solarify/ApplianceListActivity.java @@ -108,7 +108,6 @@ protected void onPreExecute() { String formula_value = jo_inside.getString("A"); String url_value = jo_inside.getString("B"); - //Add your values in your `ArrayList` as below: m_li = new HashMap(); m_li.put("appliances", formula_value); m_li.put("value", url_value); diff --git a/app/src/main/java/com/vmal/solarify/MainActivity.java b/app/src/main/java/com/vmal/solarify/MainActivity.java index 0945a8f..d645dfd 100644 --- a/app/src/main/java/com/vmal/solarify/MainActivity.java +++ b/app/src/main/java/com/vmal/solarify/MainActivity.java @@ -169,6 +169,7 @@ public void updateUI(FirebaseUser user){ // Start home activity startActivity(new Intent(this, PlanetActivity.class)); finish(); + //this sends you to the next page } } diff --git a/app/src/main/java/com/vmal/solarify/PowerForecastActivity.java b/app/src/main/java/com/vmal/solarify/PowerForecastActivity.java index 571ea66..a0e0d50 100644 --- a/app/src/main/java/com/vmal/solarify/PowerForecastActivity.java +++ b/app/src/main/java/com/vmal/solarify/PowerForecastActivity.java @@ -90,21 +90,12 @@ protected void onCreate(Bundle savedInstanceState) { boolean enabled = service .isProviderEnabled(LocationManager.GPS_PROVIDER); - // check if enabled and if not send user to the GSP settings - // Better solution would be to display a dialog and suggesting to - // go to the settings if (!enabled) { Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS); startActivity(intent); } if (ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) { - // TODO: Consider calling - // ActivityCompat#requestPermissions - // here to request the missing permissions, and then overriding - // public void onRequestPermissionsResult(int requestCode, String[] permissions, - // int[] grantResults) - // to handle the case where the user grants the permission. See the documentation - // for ActivityCompat#requestPermissions for more details. + requestPermissions(new String[]{android.Manifest.permission.ACCESS_FINE_LOCATION}, 1); } @@ -167,8 +158,6 @@ public void onCancelled(DatabaseError databaseError) { avgConsumption.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { -// Intent i = new Intent(PowerForecastActivity.this, ApplianceListActivity.class); -// startActivity(i); } }); @@ -178,6 +167,7 @@ public void onClick(View v) { void getPowerData() { + // this is the base URL for NREL API that is used to fetch the sunlight hourly data though out the day String BASE_URL = "https://developer.nrel.gov/api/pvwatts/v5.json?api_key=KhjqE5Ln7Ri9ckKXIej5onPadY3FDvCzlusgqPYB"; @@ -199,7 +189,7 @@ void getPowerData() { String losses = "0"; //fixed String dataset = "intl"; String timeFrame = "hourly"; - String radius = "900"; + String radius = "1200"; final String JSONRequest = BASE_URL + "&lat=" + lati + "&lon=" + lon + "&system_capacity=" + systemCapacity + "&azimuth=" + azimuth + "&tilt=" + tilt + "&array_type=" + arrayType + "&module_type=" + moduleType + "&losses=" + @@ -226,7 +216,7 @@ protected String doInBackground(Void... params) { Log.d("testData", testData2); acData = acDataString.split(","); - // Log.d("DataInStringArray", acData[13]); + runOnUiThread(new Runnable() { @Override public void run() { @@ -273,6 +263,10 @@ void calcData(String[] data) { } + /* + viewData is responsible for viewing the days of the week for the power forecast + */ + void viewData() { // Calendar calendar = Calendar.getInstance(); @@ -342,6 +336,14 @@ void viewData() { case 0: + d1 = "Sun"; + d2 = "Mon"; + d3 = "Tue"; + d4 = "Wed"; + d5 = "Thu"; + d6 = "Fri"; + break; + default: d1 = "Sun"; d2 = "Mon"; d3 = "Tue"; @@ -391,7 +393,6 @@ void tilt() { } else{ // bigger than zero - if(month == 9 || month == 10 || month == 11){ season = "fall"; }else diff --git a/build.gradle b/build.gradle index 1376266..34ab191 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:2.3.1' + classpath 'com.android.tools.build:gradle:2.3.3' classpath 'com.google.gms:google-services:3.0.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files