Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Login edit #15

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .idea/misc.xml

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

Original file line number Diff line number Diff line change
Expand Up @@ -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<String, String>();
m_li.put("appliances", formula_value);
m_li.put("value", url_value);
Expand Down
1 change: 1 addition & 0 deletions app/src/main/java/com/vmal/solarify/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

Expand Down
31 changes: 16 additions & 15 deletions app/src/main/java/com/vmal/solarify/PowerForecastActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);

}
Expand Down Expand Up @@ -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);
}
});

Expand All @@ -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";


Expand All @@ -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=" +
Expand All @@ -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() {
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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";
Expand Down Expand Up @@ -391,7 +393,6 @@ void tilt() {

}
else{ // bigger than zero

if(month == 9 || month == 10 || month == 11){
season = "fall";
}else
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down