package com.example.android.Bella;

import android.graphics.Typeface;
import android.os.Build;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.TextView;

import xyz.matteobattilana.library.Common.Constants;
import xyz.matteobattilana.library.WeatherView;

public class MaterialWeatherActivity extends AppCompatActivity {
    TextView ts;
    int value;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_material_weather);

        View someView = findViewById(R.id.weatherView);
        View root = someView.getRootView();

        value = getIntent().getIntExtra("value",0);
        Window window = getWindow();

        if (Build.VERSION.SDK_INT >= 21) {

            window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
            window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        }

        WeatherView mWeatherView = (WeatherView) findViewById(R.id.weather);
        ts = (TextView)findViewById(R.id.weatherText);

        Typeface custom_font = Typeface.createFromAsset(getAssets(),  "fonts/Roboto-Light.ttf");

        ts.setTypeface(custom_font);

        if(value>=37) {
            mWeatherView.setWeather(Constants.weatherStatus.SUN)
                    .setCurrentLifeTime(2000)
                    .setCurrentFadeOutTime(1000)
                    .setCurrentParticles(43)
                    .setFPS(60)
                    .setCurrentAngle(-5)
                    .setOrientationMode(Constants.orientationStatus.ENABLE)
                    .startAnimation();

            ts.setText("It's Sunny");
            root.setBackgroundDrawable(ContextCompat.getDrawable(this, R.drawable.background_sunny));
            window.setStatusBarColor(getResources().getColor(R.color.orange_900));
        } else if ((value<37) && (value>=20)) {
            mWeatherView.setWeather(Constants.weatherStatus.RAIN)
                    .setCurrentLifeTime(2000)
                    .setCurrentFadeOutTime(1000)
                    .setCurrentParticles(43)
                    .setFPS(60)
                    .setCurrentAngle(-5)
                    .setOrientationMode(Constants.orientationStatus.ENABLE)
                    .startAnimation();

            ts.setText("It's Rainy");
            root.setBackgroundDrawable(ContextCompat.getDrawable(this, R.drawable.background));
            window.setStatusBarColor(getResources().getColor(R.color.blue_900));
        } else {
            mWeatherView.setWeather(Constants.weatherStatus.RAIN)
                    .setCurrentLifeTime(2000)
                    .setCurrentFadeOutTime(1000)
                    .setCurrentParticles(43)
                    .setFPS(60)
                    .setCurrentAngle(-5)
                    .setOrientationMode(Constants.orientationStatus.ENABLE)
                    .startAnimation();

            ts.setText("It might Rain");
            root.setBackgroundDrawable(ContextCompat.getDrawable(this, R.drawable.background));
            window.setStatusBarColor(getResources().getColor(R.color.blue_900));
        }
    }
}

@@ -526,18 +526,36 @@
     
+Str
 in
-t
+g
  value;
+%0A    float val;
 %0A%0A  
@@ -860,19 +860,22 @@
 nt().get
-Int
+String
 Extra(%22v
@@ -883,10 +883,47 @@
 lue%22
-,0
+);%0A        val = Float.parseFloat(value
 );%0A 
@@ -1475,14 +1475,12 @@
 (val
-ue
 %3E=3
-7
+2
 ) %7B%0A
@@ -2123,13 +2123,11 @@
 (val
-ue
 %3C3
-7
+2
 ) &&
@@ -2131,18 +2131,16 @@
  && (val
-ue
 %3E=20)) %7B

Fix weather