Skip to content

Commit

Permalink
Card functioning. Imporving performance and accuracy
Browse files Browse the repository at this point in the history
  • Loading branch information
ppanero committed Mar 20, 2015
1 parent e462bf9 commit 9f5fa98
Show file tree
Hide file tree
Showing 11 changed files with 196 additions and 214 deletions.
12 changes: 12 additions & 0 deletions .idea/libraries/aware_core_3_3_3.xml

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

2 changes: 1 addition & 1 deletion app/app.iml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
<orderEntry type="library" exported="" name="support-annotations-21.0.3" level="project" />
<orderEntry type="library" exported="" name="gridlayout-v7-21.0.3" level="project" />
<orderEntry type="library" exported="" name="support-v4-21.0.3" level="project" />
<orderEntry type="library" exported="" name="aware-core-3.3.2" level="project" />
<orderEntry type="library" exported="" name="aware-core-3.3.3" level="project" />
<orderEntry type="library" exported="" name="cardview-v7-21.0.3" level="project" />
</component>
</module>
6 changes: 3 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ android {
applicationId "com.aware.plugin.io_panero"
minSdkVersion 10
targetSdkVersion 21
versionCode 22
versionName "22.0"
versionCode 32
versionName "32.0"
}
buildTypes {
release {
Expand All @@ -27,5 +27,5 @@ dependencies {
compile 'com.google.android.gms:play-services:6.5.87'
compile 'com.android.support:cardview-v7:21.0.3'

compile 'com.awareframework:aware-core:3.3.2@aar'
compile 'com.awareframework:aware-core:3.3.3@aar'
}
14 changes: 7 additions & 7 deletions app/src/main/java/com/aware/plugin/io_panero/ContextCard.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ public class ContextCard implements IContextCard {
private Context sContext;

//Set how often your card needs to refresh if the stream is visible (in milliseconds)
private int alarm_frequency = Integer.parseInt(Aware.getSetting(sContext.getApplicationContext(), Settings.FREQUENCY_IO_METER));
private int time_offset = 30 * 1000;
private int refresh_interval = (alarm_frequency * 60 * 1000) + time_offset; //1 second = 1000 milliseconds

//private int alarm_frequency = Integer.parseInt(Aware.getSetting(sContext.getApplicationContext(), Settings.FREQUENCY_IO_METER));
//private int time_offset = 30 * 1000;
//private int refresh_interval = (alarm_frequency * 60 * 1000) + time_offset; //1 second = 1000 milliseconds
private int refresh_interval = 90 * 1000; //1 second = 1000 milliseconds

//Declare here all the UI elements you'll be accessing
private View card;
Expand All @@ -49,7 +49,7 @@ public void run() {
//Modify card's content here once it's initialized
if( card != null ) {
//Modify card's content
Cursor ioMeter = sContext.getContentResolver().query(Provider.IOMeter_Data.CONTENT_URI,
Cursor ioMeter = sContext.getContentResolver().query(Provider.IOMeter_Data.CONTENT_URI,
null, null, null, Provider.IOMeter_Data.TIMESTAMP + " DESC LIMIT 1");
if (ioMeter != null && ioMeter.moveToFirst()) {
double io_confidence = ioMeter.getDouble(ioMeter.getColumnIndex(Provider.IOMeter_Data.IO_CONFIDENCE));
Expand Down Expand Up @@ -96,7 +96,7 @@ public View getContextCard(Context context) {
io_light_text = (TextView) card.findViewById(R.id.io_light);
io_telephony_text = (TextView) card.findViewById(R.id.io_gsm_strength);
//Modify card's content
/*Cursor ioMeter = sContext.getContentResolver().query(Provider.IOMeter_Data.CONTENT_URI,
Cursor ioMeter = sContext.getContentResolver().query(Provider.IOMeter_Data.CONTENT_URI,
null, null, null, Provider.IOMeter_Data.TIMESTAMP + " DESC LIMIT 1");
if (ioMeter != null && ioMeter.moveToFirst()) {
double io_confidence = ioMeter.getDouble(ioMeter.getColumnIndex(Provider.IOMeter_Data.IO_CONFIDENCE));
Expand All @@ -114,7 +114,7 @@ public View getContextCard(Context context) {
io_light_text.setText("Light: " + io_light);
io_telephony_text.setText("GSM Strength: " + io_telephony);
}
if( ioMeter != null && !ioMeter.isClosed()) ioMeter.close();*/
if( ioMeter != null && !ioMeter.isClosed()) ioMeter.close();

//Begin refresh cycle
uiRefresher.post(uiChanger);
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/com/aware/plugin/io_panero/IOAlarm.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class IOAlarm extends BroadcastReceiver {

@Override
public void onReceive(Context context, Intent intent) {
Plugin.alarmSet = false;
//Plugin.alarmSet = false;
Aware.setSetting(context, Aware_Preferences.STATUS_LIGHT, true);
Aware.setSetting(context, Aware_Preferences.STATUS_ACCELEROMETER, true);
Aware.setSetting(context, Aware_Preferences.STATUS_MAGNETOMETER, true);
Expand All @@ -27,7 +27,7 @@ public void onReceive(Context context, Intent intent) {

public void SetAlarm(Context context, int interval) {
AlarmManager am = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
Plugin.alarmSet = true;
//Plugin.alarmSet = true;
Intent i = new Intent(context, IOAlarm.class);
PendingIntent pi = PendingIntent.getBroadcast(context, 0, i, 0);
//interval must come in minutes
Expand Down
Loading

0 comments on commit 9f5fa98

Please sign in to comment.