Skip to content

Commit

Permalink
shits fucked
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich Jones committed Sep 30, 2010
1 parent b6e906d commit 7df5576
Show file tree
Hide file tree
Showing 12 changed files with 90 additions and 14 deletions.
5 changes: 5 additions & 0 deletions AndroidManifest.xml
Expand Up @@ -11,8 +11,13 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service android:name=".rService"/>

</application>
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.RECORD_VIDEO" />
<uses-permission android:name="android.permission.CAMERA" />



</manifest>
Binary file modified bin/StealthVideoRecorder.apk
Binary file not shown.
Binary file modified bin/classes.dex
Binary file not shown.
Binary file modified bin/org/ale/stealthvideorecorder/MainActivity$1.class
Binary file not shown.
Binary file modified bin/org/ale/stealthvideorecorder/MainActivity.class
Binary file not shown.
Binary file modified bin/org/ale/stealthvideorecorder/R$id.class
Binary file not shown.
Binary file modified bin/org/ale/stealthvideorecorder/R$layout.class
Binary file not shown.
Binary file modified bin/org/ale/stealthvideorecorder/R$string.class
Binary file not shown.
Binary file modified bin/resources.ap_
Binary file not shown.
1 change: 1 addition & 0 deletions gen/org/ale/stealthvideorecorder/R.java
Expand Up @@ -20,6 +20,7 @@ public static final class drawable {
public static final int tile=0x7f020006;
}
public static final class id {
public static final int camcorder_preview=0x7f050001;
public static final int ib=0x7f050000;
}
public static final class layout {
Expand Down
4 changes: 4 additions & 0 deletions res/layout/main.xml
Expand Up @@ -26,4 +26,8 @@
android:background="@drawable/none"
></ImageButton>

<VideoRecorder android:id="@+id/camcorder_preview"
android:layout_width="50dip" android:layout_height="50dip"
android:enabled="false" android:focusable="true" android:clickable="true" />

</LinearLayout>
94 changes: 80 additions & 14 deletions src/org/ale/stealthvideorecorder/MainActivity.java
@@ -1,17 +1,42 @@
package org.ale.stealthvideorecorder;

import android.app.Activity;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.os.RemoteException;
import android.preference.PreferenceManager;
import android.view.MotionEvent;
import android.view.View;
import android.view.Window;
import android.view.View.OnTouchListener;
import android.widget.ImageButton;
import android.widget.Toast;

public class MainActivity extends Activity {
/** Called when the activity is first created. */

public boolean recording = false;
final Handler mHandler = new Handler();
private recordService r_service;
private boolean m_servicedBind = false;

private ServiceConnection m_connection = new ServiceConnection(){

public void onServiceConnected(ComponentName name, IBinder service) {
r_service = recordService.Stub.asInterface(service);
System.out.println("onServiceConnected");
}

public void onServiceDisconnected(ComponentName name) {
r_service = null;
}
};


@Override
Expand All @@ -20,12 +45,16 @@ public void onCreate(Bundle savedInstanceState) {
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.main);


}
}

public void onResume() {
super.onResume();
final ImageButton ib = (ImageButton) findViewById(R.id.ib);
final Context c = this;

SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getBaseContext());
final SharedPreferences.Editor editor = prefs.edit();
final boolean running = prefs.getBoolean("running", false);

ib.setOnTouchListener(new OnTouchListener() {

Expand All @@ -34,24 +63,61 @@ public boolean onTouch(View v, MotionEvent event) {
if(event.getAction() != MotionEvent.ACTION_DOWN) {
return false;
}

SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getBaseContext());
final SharedPreferences.Editor editor = prefs.edit();
boolean runn = prefs.getBoolean("running", false);

// TODO Auto-generated method stub
if(recording) {
ib.setImageResource(R.drawable.grey);
recording = false;
return false;
}
else {
ib.setImageResource(R.drawable.red);
recording = true;
System.out.println("Running is..");
System.out.println(runn);

try {
if(runn){
if(r_service.running()){
ib.setImageResource(R.drawable.grey);
recording = false;
r_service.stop();
editor.putBoolean("running", false);
editor.commit();
Toast.makeText(c, "Recording stopped!", Toast.LENGTH_SHORT).show();
stopService(new Intent(c, rService.class));
r_service = null;
startService(new Intent(c, rService.class));
bindService();
}

return true;
}

else {
ib.setImageResource(R.drawable.red);
recording = true;
r_service.start();
editor.putBoolean("running", true);
editor.commit();
Toast.makeText(c, "Recording started!", Toast.LENGTH_SHORT).show();
finish();
return true;
}
} catch (RemoteException e) {
e.printStackTrace();
}

return true;
}
});
});

if(recording) {
if(running) {
ib.setImageResource(R.drawable.red);
}


startService(new Intent(this, rService.class));
bindService();
}


private void bindService(){
m_servicedBind = bindService(new Intent(this, rService.class),
m_connection, Context.BIND_AUTO_CREATE);
}
}

0 comments on commit 7df5576

Please sign in to comment.