Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
AmbientSound
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alisa Jung
AmbientSound
Commits
d3abf1ff
Commit
d3abf1ff
authored
May 28, 2016
by
Alisa Jung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
meh zwischenstand, aber android studio ist abgeschmiert. hab paar activities gemacht.
parent
c7a9c696
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
312 additions
and
22 deletions
+312
-22
build.gradle
app/build.gradle
+1
-0
AndroidManifest.xml
app/src/main/AndroidManifest.xml
+6
-0
MainActivity.java
...va/com/soundapp/alisajung/ambientsounds/MainActivity.java
+14
-2
ManagePlaylistsActivity.java
...dapp/alisajung/ambientsounds/ManagePlaylistsActivity.java
+38
-0
PlaylistEditor.java
.../com/soundapp/alisajung/ambientsounds/PlaylistEditor.java
+130
-0
activity_main.xml
app/src/main/res/layout/activity_main.xml
+15
-20
activity_manage_playlists.xml
app/src/main/res/layout/activity_manage_playlists.xml
+40
-0
activity_playlist_editor.xml
app/src/main/res/layout/activity_playlist_editor.xml
+48
-0
styles.xml
app/src/main/res/values-v21/styles.xml
+9
-0
dimens.xml
app/src/main/res/values/dimens.xml
+1
-0
strings.xml
app/src/main/res/values/strings.xml
+1
-0
styles.xml
app/src/main/res/values/styles.xml
+9
-0
No files found.
app/build.gradle
View file @
d3abf1ff
...
@@ -23,4 +23,5 @@ dependencies {
...
@@ -23,4 +23,5 @@ dependencies {
compile
fileTree
(
dir:
'libs'
,
include:
[
'*.jar'
])
compile
fileTree
(
dir:
'libs'
,
include:
[
'*.jar'
])
testCompile
'junit:junit:4.12'
testCompile
'junit:junit:4.12'
compile
'com.android.support:appcompat-v7:22.2.0'
compile
'com.android.support:appcompat-v7:22.2.0'
compile
'com.android.support:design:22.2.0'
}
}
app/src/main/AndroidManifest.xml
View file @
d3abf1ff
...
@@ -15,6 +15,11 @@
...
@@ -15,6 +15,11 @@
<category
android:name=
"android.intent.category.LAUNCHER"
/>
<category
android:name=
"android.intent.category.LAUNCHER"
/>
</intent-filter>
</intent-filter>
</activity>
</activity>
<activity
android:name=
".ManagePlaylistsActivity"
android:label=
"@string/title_activity_manage_playlists"
android:theme=
"@style/AppTheme.NoActionBar"
/>
<activity
android:name=
".PlaylistEditor"
></activity>
</application>
</application>
</manifest>
</manifest>
\ No newline at end of file
app/src/main/java/com/soundapp/alisajung/ambientsounds/MainActivity.java
View file @
d3abf1ff
package
com
.
soundapp
.
alisajung
.
ambientsounds
;
package
com
.
soundapp
.
alisajung
.
ambientsounds
;
import
android.content.ContentResolver
;
import
android.content.ContentResolver
;
import
android.content.Intent
;
import
android.database.Cursor
;
import
android.database.Cursor
;
import
android.media.MediaPlayer
;
import
android.media.MediaPlayer
;
import
android.net.Uri
;
import
android.net.Uri
;
...
@@ -22,12 +23,23 @@ public class MainActivity extends AppCompatActivity {
...
@@ -22,12 +23,23 @@ public class MainActivity extends AppCompatActivity {
private
static
final
String
TAG
=
"LOGTAG"
;
private
static
final
String
TAG
=
"LOGTAG"
;
public
void
loadEditPlaylistsActivity
(
View
view
){
Log
.
d
(
TAG
,
"Button pressed"
);
Intent
intent
=
new
Intent
(
this
,
ManagePlaylistsActivity
.
class
);
startActivity
(
intent
);
}
public
void
stopAll
(
View
view
){
Log
.
d
(
TAG
,
"TODO: stop playing stuff."
);
}
@Override
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_main
);
setContentView
(
R
.
layout
.
activity_main
);
mediaList
=
(
ListView
)
findViewById
(
R
.
id
.
medialist1
);
/*
mediaList = (ListView) findViewById(R.id.medialist1);
ContentResolver cr = getContentResolver();
ContentResolver cr = getContentResolver();
mediaImporter = new MediaImporter(cr,mediaList, getApplicationContext());
mediaImporter = new MediaImporter(cr,mediaList, getApplicationContext());
...
@@ -43,6 +55,6 @@ public class MainActivity extends AppCompatActivity {
...
@@ -43,6 +55,6 @@ public class MainActivity extends AppCompatActivity {
});
});
loadMediaButton = (Button) findViewById(R.id.loadmedia);
loadMediaButton = (Button) findViewById(R.id.loadmedia);
loadMediaButton
.
setOnClickListener
(
mediaImporter
);
loadMediaButton.setOnClickListener(mediaImporter);
*/
}
}
}
}
app/src/main/java/com/soundapp/alisajung/ambientsounds/ManagePlaylistsActivity.java
0 → 100644
View file @
d3abf1ff
package
com
.
soundapp
.
alisajung
.
ambientsounds
;
import
android.content.Intent
;
import
android.os.Bundle
;
import
android.support.design.widget.FloatingActionButton
;
import
android.support.design.widget.Snackbar
;
import
android.support.v7.app.AppCompatActivity
;
import
android.support.v7.widget.Toolbar
;
import
android.util.Log
;
import
android.view.View
;
public
class
ManagePlaylistsActivity
extends
AppCompatActivity
{
public
static
int
PLAYLIST_ADD
=
0
;
public
static
int
PLAYLIST_EDIT
=
1
;
public
static
String
EDIT_MODE
=
"editmode"
;
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_manage_playlists
);
}
public
void
backToMainMenu
(
View
view
){
Log
.
d
(
"Hallo"
,
"Back To main Menu pressed"
);
finish
();
}
public
void
addPlaylist
(
View
view
){
Log
.
d
(
"Hallo"
,
"TODO: Add Playlist"
);
Intent
intent
=
new
Intent
(
this
,
PlaylistEditor
.
class
);
int
message
=
PLAYLIST_ADD
;
intent
.
putExtra
(
EDIT_MODE
,
PLAYLIST_ADD
);
startActivity
(
intent
);
}
}
app/src/main/java/com/soundapp/alisajung/ambientsounds/PlaylistEditor.java
0 → 100644
View file @
d3abf1ff
package
com
.
soundapp
.
alisajung
.
ambientsounds
;
import
android.content.ContentResolver
;
import
android.content.ContentUris
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.database.Cursor
;
import
android.media.AudioManager
;
import
android.media.MediaPlayer
;
import
android.net.Uri
;
import
android.support.v7.app.AppCompatActivity
;
import
android.os.Bundle
;
import
android.util.Log
;
import
android.view.View
;
import
android.widget.AdapterView
;
import
android.widget.ArrayAdapter
;
import
android.widget.Button
;
import
android.widget.ListView
;
import
java.io.IOException
;
import
java.util.ArrayList
;
public
class
PlaylistEditor
extends
AppCompatActivity
implements
AdapterView
.
OnItemClickListener
{
private
ContentResolver
contentResolver
;
private
static
String
LOGTAG
=
"Media Importer"
;
private
ListView
mediaListView
;
private
Context
context
;
private
ArrayList
arrayListTitles
;
private
ArrayList
<
Long
>
arrayListIds
;
private
ArrayAdapter
arrayAdapater
;
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_playlist_editor
);
mediaListView
=
(
ListView
)
findViewById
(
R
.
id
.
medialist1
);
ContentResolver
cr
=
getContentResolver
();
Intent
intent
=
getIntent
();
int
message
=
intent
.
getIntExtra
(
ManagePlaylistsActivity
.
EDIT_MODE
,-
1
);
Log
.
d
(
"Hilfe"
,
"Test"
);
Log
.
d
(
"Hilfe"
,
"Message: "
+
message
);
if
(
message
==
ManagePlaylistsActivity
.
PLAYLIST_ADD
){
Log
.
d
(
"Hilfe"
,
"bla"
);
arrayListIds
=
new
ArrayList
<
Long
>();
Log
.
d
(
"Hilfe"
,
"bla4"
);
mediaListView
.
setOnItemClickListener
(
this
);
Log
.
d
(
"Hilfe"
,
"bla5"
);
//loadMedia();
//Log.d("Hilfe", "bla3");
}
else
if
(
message
==
ManagePlaylistsActivity
.
PLAYLIST_EDIT
){
}
else
{
Log
.
d
(
"Hilfe"
,
"FUCK FUCK FUCK "
+
message
+
" sollte "
+
ManagePlaylistsActivity
.
PLAYLIST_ADD
);
}
}
private
void
loadMedia
()
{
Uri
uri
=
android
.
provider
.
MediaStore
.
Audio
.
Media
.
EXTERNAL_CONTENT_URI
;
Cursor
cursor
=
contentResolver
.
query
(
uri
,
null
,
null
,
null
,
null
);
long
lastid
=
0
;
if
(
cursor
==
null
)
{
Log
.
d
(
LOGTAG
,
"Cursor fail"
);
// query failed, handle error.
}
else
if
(!
cursor
.
moveToFirst
())
{
Log
.
d
(
LOGTAG
,
"Curser move fist fail"
);
// no media on the device
}
else
{
Log
.
d
(
LOGTAG
,
"Stuff."
);
arrayListTitles
=
new
ArrayList
();
arrayAdapater
=
new
ArrayAdapter
(
context
,
android
.
R
.
layout
.
simple_list_item_1
,
arrayListTitles
);
mediaListView
.
setAdapter
(
arrayAdapater
);
int
titleColumn
=
cursor
.
getColumnIndex
(
android
.
provider
.
MediaStore
.
Audio
.
Media
.
TITLE
);
int
idColumn
=
cursor
.
getColumnIndex
(
android
.
provider
.
MediaStore
.
Audio
.
Media
.
_ID
);
arrayListIds
.
clear
();
arrayListTitles
.
clear
();
do
{
long
thisId
=
cursor
.
getLong
(
idColumn
);
String
thisTitle
=
cursor
.
getString
(
titleColumn
);
Log
.
d
(
LOGTAG
,
"Logging!"
+
thisTitle
);
// ...process entry...
lastid
=
thisId
;
arrayListTitles
.
add
(
thisTitle
);
arrayListIds
.
add
(
thisId
);
}
while
(
cursor
.
moveToNext
());
// playSongWithID(lastid);
}
}
public
void
playSongWithID
(
long
id
){
Log
.
d
(
LOGTAG
,
"Try playing "
);
Uri
contentUri
=
ContentUris
.
withAppendedId
(
android
.
provider
.
MediaStore
.
Audio
.
Media
.
EXTERNAL_CONTENT_URI
,
id
);
MediaPlayer
mMediaPlayer
=
new
MediaPlayer
();
mMediaPlayer
.
setAudioStreamType
(
AudioManager
.
STREAM_MUSIC
);
try
{
mMediaPlayer
.
setDataSource
(
context
,
contentUri
);
}
catch
(
IOException
e
)
{
Log
.
d
(
LOGTAG
,
"Fail. mist."
);
e
.
printStackTrace
();
}
try
{
mMediaPlayer
.
prepare
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
mMediaPlayer
.
start
();
}
@Override
public
void
onItemClick
(
AdapterView
<?>
parent
,
View
view
,
int
position
,
long
id
)
{
playSongWithID
(
arrayListIds
.
get
(
position
));
}
}
app/src/main/res/layout/activity_main.xml
View file @
d3abf1ff
...
@@ -9,36 +9,31 @@
...
@@ -9,36 +9,31 @@
android:paddingTop=
"@dimen/activity_vertical_margin"
android:paddingTop=
"@dimen/activity_vertical_margin"
tools:context=
"com.soundapp.alisajung.ambientsounds.MainActivity"
>
tools:context=
"com.soundapp.alisajung.ambientsounds.MainActivity"
>
<
Tex
tView
<
Lis
tView
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"toller text"
android:id=
"@+id/medialist1"
android:id=
"@+id/textView"
/>
android:layout_alignParentLeft=
"true"
android:layout_alignParentStart=
"true"
android:layout_marginTop=
"58dp"
android:clickable=
"true"
/>
<Button
<Button
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"
Play Sample
"
android:text=
"
Edit Lists
"
android:id=
"@+id/
sampleButton1
"
android:id=
"@+id/
editlists
"
android:
layout_below=
"@+id/textView
"
android:
onClick=
"loadEditPlaylistsActivity
"
android:layout_alignParent
Lef
t=
"true"
android:layout_alignParent
Righ
t=
"true"
android:layout_alignParent
Start
=
"true"
/>
android:layout_alignParent
End
=
"true"
/>
<Button
<Button
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"Load Media"
android:text=
"Stop all"
android:id=
"@+id/loadmedia"
android:id=
"@+id/button5"
android:layout_below=
"@+id/textView"
android:layout_centerHorizontal=
"true"
/>
<ListView
android:onClick=
"stopAll"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:id=
"@+id/medialist1"
android:layout_below=
"@+id/sampleButton1"
android:layout_alignParentLeft=
"true"
android:layout_alignParentLeft=
"true"
android:layout_alignParentStart=
"true"
android:layout_alignParentStart=
"true"
/>
android:layout_marginTop=
"58dp"
android:clickable=
"true"
/>
</RelativeLayout>
</RelativeLayout>
app/src/main/res/layout/activity_manage_playlists.xml
0 → 100644
View file @
d3abf1ff
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:paddingBottom=
"@dimen/activity_vertical_margin"
android:paddingLeft=
"@dimen/activity_horizontal_margin"
android:paddingRight=
"@dimen/activity_horizontal_margin"
android:paddingTop=
"@dimen/activity_vertical_margin"
tools:context=
"com.soundapp.alisajung.ambientsounds.ManagePlaylistsActivity"
>
<ListView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:id=
"@+id/listView2"
android:layout_alignParentLeft=
"true"
android:layout_alignParentStart=
"true"
android:layout_above=
"@+id/button2"
/>
<Button
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"Back"
android:id=
"@+id/button2"
android:onClick=
"backToMainMenu"
android:layout_alignTop=
"@+id/button3"
android:layout_alignRight=
"@+id/listView2"
android:layout_alignEnd=
"@+id/listView2"
/>
<Button
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"Add List"
android:id=
"@+id/button3"
android:onClick=
"addPlaylist"
android:layout_alignParentBottom=
"true"
android:layout_alignParentLeft=
"true"
android:layout_alignParentStart=
"true"
/>
</RelativeLayout>
app/src/main/res/layout/activity_playlist_editor.xml
0 → 100644
View file @
d3abf1ff
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:paddingBottom=
"@dimen/activity_vertical_margin"
android:paddingLeft=
"@dimen/activity_horizontal_margin"
android:paddingRight=
"@dimen/activity_horizontal_margin"
android:paddingTop=
"@dimen/activity_vertical_margin"
tools:context=
"com.soundapp.alisajung.ambientsounds.PlaylistEditor"
>
<EditText
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:id=
"@+id/editText"
android:layout_alignParentTop=
"true"
android:layout_alignParentLeft=
"true"
android:layout_alignParentStart=
"true"
android:layout_alignParentRight=
"true"
android:layout_alignParentEnd=
"true"
android:text=
"Playlist_Name"
/>
<ListView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:id=
"@+id/medialist1"
android:layout_alignParentLeft=
"true"
android:layout_alignParentStart=
"true"
android:layout_below=
"@+id/editText"
/>
<Button
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"Done"
android:id=
"@+id/button2"
android:layout_alignParentBottom=
"true"
android:layout_alignParentRight=
"true"
android:layout_alignParentEnd=
"true"
/>
<Button
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"Delete List"
android:id=
"@+id/button3"
android:layout_alignTop=
"@+id/button2"
android:layout_alignParentLeft=
"true"
android:layout_alignParentStart=
"true"
/>
</RelativeLayout>
app/src/main/res/values-v21/styles.xml
0 → 100644
View file @
d3abf1ff
<resources>
<style
name=
"AppTheme.NoActionBar"
>
<item
name=
"windowActionBar"
>
false
</item>
<item
name=
"windowNoTitle"
>
true
</item>
<item
name=
"android:windowDrawsSystemBarBackgrounds"
>
true
</item>
<item
name=
"android:statusBarColor"
>
@android:color/transparent
</item>
</style>
</resources>
app/src/main/res/values/dimens.xml
View file @
d3abf1ff
...
@@ -2,4 +2,5 @@
...
@@ -2,4 +2,5 @@
<!-- Default screen margins, per the Android Design guidelines. -->
<!-- Default screen margins, per the Android Design guidelines. -->
<dimen
name=
"activity_horizontal_margin"
>
16dp
</dimen>
<dimen
name=
"activity_horizontal_margin"
>
16dp
</dimen>
<dimen
name=
"activity_vertical_margin"
>
16dp
</dimen>
<dimen
name=
"activity_vertical_margin"
>
16dp
</dimen>
<dimen
name=
"fab_margin"
>
16dp
</dimen>
</resources>
</resources>
app/src/main/res/values/strings.xml
View file @
d3abf1ff
<resources>
<resources>
<string
name=
"app_name"
>
AmbientSounds
</string>
<string
name=
"app_name"
>
AmbientSounds
</string>
<string
name=
"title_activity_manage_playlists"
>
ManagePlaylistsActivity
</string>
</resources>
</resources>
app/src/main/res/values/styles.xml
View file @
d3abf1ff
...
@@ -8,4 +8,13 @@
...
@@ -8,4 +8,13 @@
<item
name=
"colorAccent"
>
@color/colorAccent
</item>
<item
name=
"colorAccent"
>
@color/colorAccent
</item>
</style>
</style>
<style
name=
"AppTheme.NoActionBar"
>
<item
name=
"windowActionBar"
>
false
</item>
<item
name=
"windowNoTitle"
>
true
</item>
</style>
<style
name=
"AppTheme.AppBarOverlay"
parent=
"ThemeOverlay.AppCompat.Dark.ActionBar"
/>
<style
name=
"AppTheme.PopupOverlay"
parent=
"ThemeOverlay.AppCompat.Light"
/>
</resources>
</resources>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment