-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Formatting change and added gitignore
Added code formatting changes and added gitignore to ignore binary files
- Loading branch information
Saurabh Gangarde
committed
Sep 23, 2012
1 parent
fb2fa44
commit 7d80f0a
Showing
15 changed files
with
400 additions
and
360 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# built application files | ||
*.apk | ||
*.ap_ | ||
|
||
# files for the dex VM | ||
*.dex | ||
|
||
# Java class files | ||
*.class | ||
|
||
# generated files | ||
bin/ | ||
gen/ | ||
|
||
# Local configuration file (sdk path, etc) | ||
local.properties | ||
|
||
# Eclipse project files | ||
.classpath | ||
.project | ||
|
||
/libs | ||
KinoSenseFramework/.classpath |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,14 @@ | ||
/** | ||
* Copyright 2012 Pune-GDG (http://meetup.com/pune-gdg) | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on | ||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations under the License. | ||
*/ | ||
package org.punegdg.kinosense; | ||
|
||
|
@@ -25,61 +22,60 @@ | |
import android.view.Menu; | ||
|
||
/** | ||
* Currently this Activity is bootstrap to number of things in the PoC state e.g like the Service which listens to Sensor events and code which registers various broadcast recievers. | ||
* Currently this Activity is bootstrap to number of things in the PoC state e.g like the Service which listens to | ||
* Sensor events and code which registers various broadcast recievers. | ||
* | ||
* @author "Rohit Ghatol"<[email protected]> | ||
* | ||
* | ||
*/ | ||
public class MainActivity extends Activity { | ||
public class MainActivity extends Activity | ||
{ | ||
|
||
/** | ||
* Power Connected Disconnected BroadCastReceiver | ||
*/ | ||
private BroadCastReceiverBasedTrigger bbTrigger = new PowerConnectedTrigger(); | ||
|
||
|
||
|
||
|
||
/* (non-Javadoc) | ||
/* | ||
* (non-Javadoc) | ||
* @see android.app.Activity#onCreate(android.os.Bundle) | ||
*/ | ||
@Override | ||
public void onCreate(Bundle savedInstanceState) { | ||
public void onCreate(Bundle savedInstanceState) | ||
{ | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_main); | ||
|
||
bbTrigger.onCreate(getApplicationContext()); | ||
|
||
Intent startServiceIntent = new Intent(getApplicationContext(), | ||
SensorService.class); | ||
Intent startServiceIntent = new Intent(getApplicationContext(), SensorService.class); | ||
startService(startServiceIntent); | ||
|
||
} | ||
|
||
|
||
|
||
/* (non-Javadoc) | ||
/* | ||
* (non-Javadoc) | ||
* @see android.app.Activity#onCreateOptionsMenu(android.view.Menu) | ||
*/ | ||
@Override | ||
|
||
public boolean onCreateOptionsMenu(Menu menu) { | ||
public boolean onCreateOptionsMenu(Menu menu) | ||
{ | ||
getMenuInflater().inflate(R.menu.activity_main, menu); | ||
return true; | ||
} | ||
|
||
|
||
|
||
/* (non-Javadoc) | ||
/* | ||
* (non-Javadoc) | ||
* @see android.app.Activity#onStop() | ||
*/ | ||
@Override | ||
protected void onStop() { | ||
protected void onStop() | ||
{ | ||
super.onStop(); | ||
bbTrigger.onDestroy(); | ||
} | ||
|
||
|
||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,14 @@ | ||
/** | ||
* Copyright 2012 Pune-GDG (http://meetup.com/pune-gdg) | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on | ||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations under the License. | ||
*/ | ||
package org.punegdg.kinosense.actions; | ||
|
||
|
@@ -20,41 +17,39 @@ | |
import android.content.Context; | ||
|
||
/** | ||
* Contract for all Action classes. The life cycle methods are explained as | ||
* follows | ||
* Contract for all Action classes. The life cycle methods are explained as follows | ||
* <ul> | ||
* <li>onCreate - Called once when creating an instance of this action. | ||
* Application Context is passed here</li> | ||
* <li>onCreate - Called once when creating an instance of this action. Application Context is passed here</li> | ||
* <li>performAction - Called each time when an action needs to be performed</li> | ||
* <li>onDestroy - Called once when this action needs to be destroyed. Clean up | ||
* needs to be done here</li> | ||
* <li>onDestroy - Called once when this action needs to be destroyed. Clean up needs to be done here</li> | ||
* | ||
* | ||
* </ul> | ||
* | ||
* @author "Rohit Ghatol"<[email protected]> | ||
* | ||
*/ | ||
public interface AbstractAction { | ||
public interface AbstractAction | ||
{ | ||
/** | ||
* Called once when creating an instance of this action. | ||
* | ||
* @param context | ||
* Android Application Context | ||
* @param context Android Application Context | ||
*/ | ||
public void onCreate(Context context); | ||
|
||
|
||
/** | ||
* Called each time when an action needs to be performed | ||
* | ||
* @param action | ||
* @param extra | ||
*/ | ||
public void perform(Map<String,Object> data); | ||
public void perform(Map<String, Object> data); | ||
|
||
|
||
/** | ||
* Called once when this action needs to be destroyed. Clean up needs to be | ||
* done here | ||
* Called once when this action needs to be destroyed. Clean up needs to be done here | ||
*/ | ||
public void onDestroy(); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,14 @@ | ||
/** | ||
* Copyright 2012 Pune-GDG (http://meetup.com/pune-gdg) | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on | ||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations under the License. | ||
*/ | ||
package org.punegdg.kinosense.actions; | ||
|
||
|
@@ -21,15 +18,15 @@ | |
import android.media.AudioManager; | ||
|
||
/** | ||
* Action which can silent the phone and on the flip side raise the volume to | ||
* max. | ||
* Action which can silent the phone and on the flip side raise the volume to max. | ||
* | ||
*@author "Rohit Ghatol"<[email protected]> | ||
* @author "Rohit Ghatol"<[email protected]> | ||
* | ||
*/ | ||
// FIXME - Need to decide what is the scope of Silent Action, also what can we | ||
// do to undo this action | ||
public class SilentAction implements AbstractAction { | ||
public class SilentAction implements AbstractAction | ||
{ | ||
|
||
/** | ||
* Android Application Context | ||
|
@@ -39,52 +36,52 @@ public class SilentAction implements AbstractAction { | |
* Audio Manager used to change the ringer volume | ||
*/ | ||
private AudioManager audioManager = null; | ||
|
||
/** | ||
* Last stored volume | ||
*/ | ||
private int lastVolume = 0; | ||
|
||
|
||
/* | ||
* (non-Javadoc) | ||
* | ||
* @see | ||
* org.punegdg.kinosense.actions.BaseAction#onCreate(android.content.Context | ||
* ) | ||
* @see org.punegdg.kinosense.actions.BaseAction#onCreate(android.content.Context ) | ||
*/ | ||
public void onCreate(Context context) { | ||
public void onCreate(Context context) | ||
{ | ||
this.context = context; | ||
audioManager = (AudioManager) context | ||
.getSystemService(context.AUDIO_SERVICE); | ||
audioManager = (AudioManager)context.getSystemService(context.AUDIO_SERVICE); | ||
// lastVolume = audioManager.getStreamVolume(AudioManager.STREAM_RING); | ||
} | ||
|
||
|
||
/* | ||
* (non-Javadoc) | ||
* | ||
* @see org.punegdg.kinosense.actions.BaseAction#onAction(java.lang.String, | ||
* java.lang.String) | ||
* @see org.punegdg.kinosense.actions.BaseAction#onAction(java.lang.String, java.lang.String) | ||
*/ | ||
public void perform(Map<String,Object> data) { | ||
public void perform(Map<String, Object> data) | ||
{ | ||
String action = (String)data.get("action"); | ||
if ("Silence".equals(action)) { | ||
if ( "Silence".equals(action) ) | ||
{ | ||
lastVolume = audioManager.getStreamVolume(AudioManager.STREAM_RING); | ||
audioManager.setStreamVolume(AudioManager.STREAM_RING, 0, | ||
AudioManager.FLAG_SHOW_UI + AudioManager.FLAG_PLAY_SOUND); | ||
} else if ("Restore".equals(action)) { | ||
audioManager.setStreamVolume(AudioManager.STREAM_RING, 7, | ||
AudioManager.FLAG_SHOW_UI + AudioManager.FLAG_PLAY_SOUND); | ||
audioManager.setStreamVolume(AudioManager.STREAM_RING, 0, AudioManager.FLAG_SHOW_UI | ||
+ AudioManager.FLAG_PLAY_SOUND); | ||
} | ||
else if ( "Restore".equals(action) ) | ||
{ | ||
audioManager.setStreamVolume(AudioManager.STREAM_RING, 7, AudioManager.FLAG_SHOW_UI | ||
+ AudioManager.FLAG_PLAY_SOUND); | ||
} | ||
} | ||
|
||
|
||
/* | ||
* (non-Javadoc) | ||
* | ||
* @see | ||
* org.punegdg.kinosense.actions.BaseAction#onDestroy(android.content.Context | ||
* ) | ||
* @see org.punegdg.kinosense.actions.BaseAction#onDestroy(android.content.Context ) | ||
*/ | ||
public void onDestroy() { | ||
public void onDestroy() | ||
{ | ||
audioManager = null; | ||
} | ||
|
||
|
Oops, something went wrong.