Android Open Source - hackspacewidget Internal Helper






From Project

Back to project page hackspacewidget.

License

The source code is released under:

Apache License

If you think the Android project hackspacewidget 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 de.ring0.hackspace.database;
// w  ww  .  j a  va  2s . c  o  m
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;

class InternalHelper extends SQLiteOpenHelper {

  public static final String TABLE_SPACES = "spaces";
  public static final String TABLE_STATUS = "status";
  
  public static final int TABLE_VERSION = 0;
  
  
  public static final String CREATE_TABLE_SPACES = 
      "CREATE TABLE spaces (" +
      "  spaceid INTEGER AUTO_INCREMENT," +
      "  name TEXT," +
      "  url TEXT," +
      "  PRIMARY KEY(`id`)" +
      ");";
  
  public static final String CREATE_TABLE_STATUS = 
      "CREATE TABLE status (" +
      "  space INTEGER," +
      "  json TEXT," +
      "  open BLOB," +
      "  closed BLOB," +
      "  FOREIGN KEY(space) REFERENCES(spaceid)" +
      ");";

  public InternalHelper(Context context, String name) {
    super(context, name, null, TABLE_VERSION);
  }

  @Override
  public void onCreate(SQLiteDatabase db) {
    db.execSQL(CREATE_TABLE_SPACES);
    db.execSQL(CREATE_TABLE_STATUS);
  }

  @Override
  public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
    Log.w(InternalHelper.class.getSimpleName(), 
      String.format("Upgrading from version %d to new version %d", oldVersion, newVersion));
    db.execSQL("DROP TABLE " + TABLE_SPACES);
    db.execSQL("DROP TABLE " + TABLE_STATUS);
    onCreate(db);  
  }
}




Java Source Code List

de.ring0.hackspace.HackspaceInfoFragment.java
de.ring0.hackspace.HackspaceListFragment.java
de.ring0.hackspace.HackspaceStatusAPI.java
de.ring0.hackspace.HackspaceStatusProvider.java
de.ring0.hackspace.HackspaceViewActivity.java
de.ring0.hackspace.HackspaceWidgetConfig.java
de.ring0.hackspace.UpdateWidgetTask.java
de.ring0.hackspace.database.InternalHelper.java
de.ring0.hackspace.database.SpaceDataSource.java
de.ring0.hackspace.database.StatusDataSource.java
de.ring0.hackspace.datatypes.Space.java
de.ring0.hackspace.datatypes.field.SpaceCache.java
de.ring0.hackspace.datatypes.field.SpaceContact.java
de.ring0.hackspace.datatypes.field.SpaceEvent.java
de.ring0.hackspace.datatypes.field.SpaceFED.java
de.ring0.hackspace.datatypes.field.SpaceFeeds.java
de.ring0.hackspace.datatypes.field.SpaceIcon.java
de.ring0.hackspace.datatypes.field.SpaceKeymaster.java
de.ring0.hackspace.datatypes.field.SpaceLocation.java
de.ring0.hackspace.datatypes.field.SpaceRadioShow.java
de.ring0.hackspace.datatypes.field.SpaceSensors.java
de.ring0.hackspace.datatypes.field.SpaceState.java
de.ring0.hackspace.datatypes.sensors.AccountBalance.java
de.ring0.hackspace.datatypes.sensors.Barometer.java
de.ring0.hackspace.datatypes.sensors.BeverageSupply.java
de.ring0.hackspace.datatypes.sensors.DoorLocked.java
de.ring0.hackspace.datatypes.sensors.Humidity.java
de.ring0.hackspace.datatypes.sensors.NetworkConnections.java
de.ring0.hackspace.datatypes.sensors.PeopleNowPresent.java
de.ring0.hackspace.datatypes.sensors.PowerConsumption.java
de.ring0.hackspace.datatypes.sensors.Radiation.java
de.ring0.hackspace.datatypes.sensors.Sensor.java
de.ring0.hackspace.datatypes.sensors.Temperature.java
de.ring0.hackspace.datatypes.sensors.TotalMemberCount.java
de.ring0.hackspace.datatypes.sensors.Wind.java