Android Open Source - HeadphoneController H C Input Sequence Commands Table






From Project

Back to project page HeadphoneController.

License

The source code is released under:

GNU General Public License

If you think the Android project HeadphoneController 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 ca.mbabic.headphonecontroller.db;
//w  w  w .j  ava 2 s  . c om
import java.util.ArrayList;

import static ca.mbabic.headphonecontroller.configuration.HCConfigConstants.*;

import android.content.ContentValues;

public class HCInputSequenceCommandsTable extends HCDbTable {

  public static final String INPUTSEQUENCE_KEY = "inputsequence_key";
  public static final String COMMAND_KEY = "command_key";
  public static final String CALLSTATE_ID = "callstate_id";
  
  private HCDbTable cmdTable, csTable, isTable;
  
  public HCInputSequenceCommandsTable() {
    
    cmdTable = new HCCommandTable();
    
    csTable = new HCCallStateTable();
    
    isTable = new HCInputSequenceTable();
    
    TABLE_NAME = "INPUTSEQUENCE_COMMANDS";
    
    PRIMARY_KEY_NAME = "";
    
    CREATION_STMT = 
      "CREATE TABLE " + TABLE_NAME + "("     +
        INPUTSEQUENCE_KEY + " text, "       +
        COMMAND_KEY + " text, "         +
        CALLSTATE_ID + " int, "         +
        "FOREIGN KEY (" + INPUTSEQUENCE_KEY + ") REFERENCES " +
        isTable.getTableName() + "(" + isTable.getPrimaryKeyColumnName() + "), " +
        "FOREIGN KEY (" + COMMAND_KEY + ") REFERENCES " +
        cmdTable.getTableName() + "(" + cmdTable.getPrimaryKeyColumnName() + "), " +
        "FOREIGN KEY (" + CALLSTATE_ID + ") REFERENCES " + 
        csTable.getTableName() + "(" + csTable.getPrimaryKeyColumnName() + ")" +
      ");";
    
    
    
  }

  @Override
  public ArrayList<ContentValues> getDefaultValues() {

    ArrayList<ContentValues> ret;
    ContentValues cv;
    String[] cmds;
    
    ret = new ArrayList<ContentValues>();
    
    for (String seqKey : INPUTSEQUENCE_KEYS) {
      
      cmds = DEFAULT_CONFIGURATION.get(seqKey);
      
      for (int callstateId : CALL_STATE_KEYS) {
        
        cv = new ContentValues();
        
        cv.put(INPUTSEQUENCE_KEY, seqKey);
        
        cv.put(COMMAND_KEY, cmds[callstateId % N_CALL_STATES]);
        
        cv.put(CALLSTATE_ID, callstateId);
        
        ret.add(cv);
      }
      
    }
    
    return ret;
  
  }
}




Java Source Code List

ca.mbabic.headphonecontroller.ConfigurationFragment.java
ca.mbabic.headphonecontroller.HCApplication.java
ca.mbabic.headphonecontroller.HomeActivity.java
ca.mbabic.headphonecontroller.SelectCommandActivity.java
ca.mbabic.headphonecontroller.commands.CommandExecutor.java
ca.mbabic.headphonecontroller.commands.HCCommandContext.java
ca.mbabic.headphonecontroller.commands.HCCommandFactory.java
ca.mbabic.headphonecontroller.commands.HCCommand.java
ca.mbabic.headphonecontroller.commands.MuteMusicCommand.java
ca.mbabic.headphonecontroller.commands.NoOpCommand.java
ca.mbabic.headphonecontroller.commands.PlayPauseCommand.java
ca.mbabic.headphonecontroller.commands.PreviousCommand.java
ca.mbabic.headphonecontroller.commands.SkipCommand.java
ca.mbabic.headphonecontroller.configuration.HCConfigAdapter.java
ca.mbabic.headphonecontroller.configuration.HCConfigConstants.java
ca.mbabic.headphonecontroller.db.DbHelper.java
ca.mbabic.headphonecontroller.db.HCCallStateTable.java
ca.mbabic.headphonecontroller.db.HCCommandCallStateTable.java
ca.mbabic.headphonecontroller.db.HCCommandTable.java
ca.mbabic.headphonecontroller.db.HCDbAdapter.java
ca.mbabic.headphonecontroller.db.HCDbHelper.java
ca.mbabic.headphonecontroller.db.HCDbTable.java
ca.mbabic.headphonecontroller.db.HCInputSequenceCommandsTable.java
ca.mbabic.headphonecontroller.db.HCInputSequenceTable.java
ca.mbabic.headphonecontroller.models.HCCmd.java
ca.mbabic.headphonecontroller.models.HCInputSequence.java
ca.mbabic.headphonecontroller.services.MediaButtonListenerService.java
ca.mbabic.headphonecontroller.services.MediaButtonReceiver.java
ca.mbabic.headphonecontroller.services.MediaStateChangeReceiver.java
ca.mbabic.headphonecontroller.statemachine.FourPressState.java
ca.mbabic.headphonecontroller.statemachine.HCStateMachine.java
ca.mbabic.headphonecontroller.statemachine.HCState.java
ca.mbabic.headphonecontroller.statemachine.InactiveState.java
ca.mbabic.headphonecontroller.statemachine.OnePressState.java
ca.mbabic.headphonecontroller.statemachine.ThreePressState.java
ca.mbabic.headphonecontroller.statemachine.TwoPressState.java
ca.mbabic.headphonecontroller.views.CommandAdapter.java