Android Open Source - WeatherBar Screen






From Project

Back to project page WeatherBar.

License

The source code is released under:

MIT License

If you think the Android project WeatherBar listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.cjbarker.wb.receiver;
//w w  w  .  j  a  v  a 2  s  . co  m
import com.cjbarker.wb.Prefs;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

public class Screen extends BroadcastReceiver {
  
  private static final String TAG = "Screen";
  
  @Override
  public void onReceive(Context ctx, Intent intent) {
    Log.i(TAG, "Intent received: " + intent.getAction());
    
    if (intent.getAction().equals(Intent.ACTION_SCREEN_ON)) {
      screenOn();
    }
    else {
      screenOff();
    }
  }
  
  private void screenOff() {
    Log.d(TAG, "Screen turned off...");
  }
  
  private void screenOn() {
    Log.d(TAG, "Screen turned on - will refresh data accordingly");
    if (Prefs.getInstance().isOkayToQuery() && Prefs.getInstance().isUpdateExpired()) {
      ;;  // TODO call someone to kickoff weather update and display 
    }
  }
}




Java Source Code List

com.cjbarker.wb.Main.java
com.cjbarker.wb.Notifier.java
com.cjbarker.wb.Prefs.java
com.cjbarker.wb.Util.java
com.cjbarker.wb.receiver.BatteryLevel.java
com.cjbarker.wb.receiver.Connection.java
com.cjbarker.wb.receiver.Screen.java
com.cjbarker.wb.ws.ClientRequestTest.java
com.cjbarker.wb.ws.ClientRequest.java
com.cjbarker.wb.ws.ClientResponse.java
com.cjbarker.wb.ws.OpenWeatherTest.java
com.cjbarker.wb.ws.OpenWeather.java
com.cjbarker.wb.ws.WeatherTest.java
com.cjbarker.wb.ws.Weather.java