Commit 2ebf2bec by Thomas Krex

commit vor dem push

parent b74b0cef
......@@ -41,6 +41,7 @@
</activity>
<activity
android:name="tttclient.activities.PlayerActivity"
android:configChanges="orientation|screenSize"
android:screenOrientation="landscape" >
</activity>
......
......@@ -41,6 +41,7 @@
</activity>
<activity
android:name="tttclient.activities.PlayerActivity"
android:configChanges="orientation|screenSize"
android:screenOrientation="landscape" >
</activity>
......
......@@ -104,7 +104,7 @@ public class FeedActivity extends SherlockActivity implements
return;
}
// using apache library to validate url
url.replaceAll("\\s+", "");
Feed feed = new Feed(name, url);
FeedDbManager fm = new FeedDbManager(getParent());
......
......@@ -5,7 +5,6 @@ import java.io.IOException;
import tttclient.core.Recording;
import tttclient.services.DownloadService;
import android.annotation.SuppressLint;
import android.app.ProgressDialog;
import android.media.MediaPlayer;
import android.net.Uri;
......@@ -50,6 +49,7 @@ public class PlayerActivity extends SherlockActivity implements
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_player_main);
Log.d("PlayerActivity", "onCreate");
scrollView = (ScrollView) findViewById(R.id.indexScrollView);
switcher = (ViewSwitcher) findViewById(R.id.viewSwitcher);
......@@ -212,6 +212,13 @@ public class PlayerActivity extends SherlockActivity implements
}
@Override
protected void onPause() {
recording.pause();
super.onPause();
}
@Override
public boolean onTouchEvent(MotionEvent event) {
if (audioController != null)
audioController.show();
......@@ -222,12 +229,12 @@ public class PlayerActivity extends SherlockActivity implements
@Override
protected void onDestroy() {
super.onDestroy();
Log.d("PlayerActivity", "onDestroy");
recording.stop();
recording = null;
audioPlayer.release();
}
@SuppressLint("NewApi")
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getSupportMenuInflater();
......
......@@ -21,11 +21,8 @@ public class FeedDbManager {
public FeedDbManager(Context context) {
db = DBManager.getDB(context);
// Log.d("SQL", TABLE_CREATE);
db.execSQL("CREATE TABLE IF NOT EXISTS feeds ("
+ "id INTEGER PRIMARY KEY AUTOINCREMENT, name VARCHAR, feedUrl VARCHAR)");
// Log.d("SQL", this.getAllFromDB().getColumnNames().toString());
// db.execSQL(TABLE_CREATE);
}
public Cursor getAllFromDB() {
......@@ -50,11 +47,12 @@ public class FeedDbManager {
Cursor c = db.rawQuery("SELECT id FROM feeds WHERE 'feedUrl' = ?",
new String[] { f.url });
Log.d("SQL", "Count: " + c.getCount());
// checks if already a entry with the same name exists and update it if
// so
if (c.moveToNext()) {
db.execSQL("UPDATE feeds SET 'name' =?, 'feedUrl' =? WHERE id=?",
new String[] { f.name, f.url, c.getString(0) });
if (c.moveToFirst()) {
db.execSQL("UPDATE feeds SET 'name' =? WHERE id=?", new String[] {
f.name, c.getString(0) });
Log.d("SQL", "Entry with same URL found");
} else
db.execSQL("INSERT INTO feeds ( name , feedUrl) VALUES (?, ?)",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment