Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Casanowow Life for love
VLC-Android
Commits
32c24877
Commit
32c24877
authored
Jul 28, 2011
by
Michael Merg
Browse files
UI: show info dialog on startup
parent
a9b911d5
Changes
11
Hide whitespace changes
Inline
Side-by-side
vlc-android/AndroidManifest.xml
View file @
32c24877
...
...
@@ -61,6 +61,9 @@
<activity
android:name=
".AudioActivityGroup"
android:theme=
"@android:style/Theme.NoTitleBar"
/>
<activity
android:name=
".AudioPlayerActivity"
android:theme=
"@android:style/Theme.NoTitleBar"
/>
<service
android:name=
".AudioService"
/>
<activity
...
...
vlc-android/res/layout/audio_player.xml
View file @
32c24877
...
...
@@ -3,6 +3,7 @@
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:orientation=
"vertical"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"#000000"
>
android:layout_height=
"match_parent"
>
</LinearLayout>
\ No newline at end of file
vlc-android/res/layout/info_dialog.xml
0 → 100644
View file @
32c24877
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:orientation=
"vertical"
android:layout_width=
"fill_parent"
android:layout_height=
"fill_parent"
android:weightSum=
"1"
>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:background=
"#444444"
android:gravity=
"center_vertical"
android:layout_marginBottom=
"10dip"
android:padding=
"10dip"
>
<ImageView
android:layout_width=
"32dip"
android:layout_height=
"32dip"
android:scaleType=
"centerInside"
android:src=
"@drawable/icon"
android:layout_marginRight=
"5dip"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:textAppearance=
"?android:attr/textAppearanceLarge"
android:text=
"@string/info_title"
/>
</LinearLayout>
<TextView
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:textAppearance=
"?android:attr/textAppearanceMedium"
android:text=
"@string/beta_warning"
android:padding=
"10dip"
/>
<View
android:layout_width=
"match_parent"
android:layout_height=
"0dip"
android:layout_weight=
"1"
/>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
android:gravity=
"center_vertical"
android:padding=
"10dip"
>
<CheckBox
android:id=
"@+id/not_show_again"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginRight=
"4dip"
/>
<TextView
android:id=
"@+id/hide"
android:singleLine=
"true"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:textAppearance=
"?android:attr/textAppearanceMedium"
android:text=
"@string/not_show_again"
/>
</LinearLayout>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
android:gravity=
"center_horizontal"
android:weightSum=
"1"
>
<Button
android:id=
"@+id/ok"
android:layout_width=
"0dip"
android:layout_height=
"wrap_content"
android:layout_weight=
"0.5"
android:text=
"@android:string/ok"
/>
</LinearLayout>
</LinearLayout>
vlc-android/res/layout/list_header.xml
View file @
32c24877
...
...
@@ -3,7 +3,7 @@
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:orientation=
"vertical"
android:layout_width=
"match_parent"
android:layout_height=
"
wrap_cont
ent"
android:layout_height=
"
match_par
ent"
android:background=
"@drawable/bg_with_shadow"
>
<TextView
android:id=
"@+id/text"
...
...
vlc-android/res/values/strings.xml
View file @
32c24877
...
...
@@ -21,4 +21,8 @@
<string
name=
"hide_mini_player"
>
Hide Mini-Player
</string>
<string
name=
"play"
>
Play
</string>
<string
name=
"pause"
>
Pause
</string>
<string
name=
"close"
>
Close
</string>
<string
name=
"not_show_again"
>
"Don't show this Message again."
</string>
<string
name=
"beta_warning"
>
This is a early alpha version\n(NOT STABLE!).
</string>
<string
name=
"info_title"
>
Information
</string>
</resources>
vlc-android/res/values/styles.xml
0 → 100644
View file @
32c24877
<?xml version="1.0" encoding="UTF-8"?>
<resources
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<style
name=
"info_dialog"
parent=
"@android:style/Theme.Dialog"
>
<item
name=
"android:layout_width"
>
match_parent
</item>
<item
name=
"android:layout_height"
>
match_parent
</item>
<item
name=
"android:windowIsFloating"
>
true
</item>
<item
name=
"android:backgroundDimEnabled"
>
true
</item>
<item
name=
"android:windowNoTitle"
>
true
</item>
</style>
</resources>
vlc-android/src/org/videolan/vlc/android/AudioPlayer.java
0 → 100644
View file @
32c24877
package
org.videolan.vlc.android
;
import
android.graphics.Bitmap
;
public
interface
AudioPlayer
{
public
void
update
();
public
interface
AudioPlayerControl
{
String
getTitle
();
Bitmap
getCover
();
int
getLength
();
int
getTime
();
boolean
hasMedia
();
String
getArtist
();
void
play
();
void
pause
();
boolean
isPlaying
();
}
}
vlc-android/src/org/videolan/vlc/android/AudioPlayerActivity.java
0 → 100644
View file @
32c24877
package
org.videolan.vlc.android
;
import
android.app.Activity
;
import
android.os.Bundle
;
import
android.widget.ImageButton
;
import
android.widget.ImageView
;
import
android.widget.SeekBar
;
import
android.widget.TextView
;
public
class
AudioPlayerActivity
extends
Activity
implements
AudioPlayer
{
public
final
static
String
TAG
=
"VLC/AudioPlayerActiviy"
;
private
ImageView
mCover
;
private
TextView
mTitle
;
private
TextView
mArtist
;
private
TextView
mAlbum
;
private
TextView
mGenre
;
private
ImageButton
mPlayPause
;
private
ImageButton
mNext
;
private
ImageButton
mPrevious
;
private
ImageButton
mShuffle
;
private
ImageButton
mRepeat
;
private
SeekBar
mTimeline
;
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
audio_player
);
mCover
=
(
ImageView
)
findViewById
(
R
.
id
.
cover
);
mTitle
=
(
TextView
)
findViewById
(
R
.
id
.
title
);
mArtist
=
(
TextView
)
findViewById
(
R
.
id
.
artist
);
// mAlbum = (TextView) findViewById(R.id.album);
// mGenre = (TextView) findViewById(R.id.genre);
// mPlayPause = (ImageButton) findViewById(R.id.play_pause);
// mNext = (ImageButton) findViewById(R.id.next);
// mPrevious = (ImageButton) findViewById(R.id.previous);
// mShuffle = (ImageButton) findViewById(R.id.shuffle);
// mRepeat = (ImageButton) findViewById(R.id.repeat);
mTimeline
=
(
SeekBar
)
findViewById
(
R
.
id
.
timeline
);
}
@Override
public
void
update
()
{
}
}
vlc-android/src/org/videolan/vlc/android/AudioServiceController.java
View file @
32c24877
...
...
@@ -3,8 +3,8 @@ package org.videolan.vlc.android;
import
java.util.ArrayList
;
import
java.util.List
;
import
org.videolan.vlc.android.AudioPlayer.AudioPlayerControl
;
import
org.videolan.vlc.android.widget.AudioMiniPlayer
;
import
org.videolan.vlc.android.widget.AudioMiniPlayer.AudioMiniPlayerControl
;
import
android.content.ComponentName
;
import
android.content.Context
;
...
...
@@ -15,7 +15,7 @@ import android.os.IBinder;
import
android.os.RemoteException
;
import
android.util.Log
;
public
class
AudioServiceController
implements
Audio
Mini
PlayerControl
{
public
class
AudioServiceController
implements
AudioPlayerControl
{
public
static
final
String
TAG
=
"VLC/AudioServiceContoller"
;
private
static
AudioServiceController
mInstance
;
...
...
@@ -55,8 +55,7 @@ public class AudioServiceController implements AudioMiniPlayerControl {
try
{
mAudioServiceBinder
.
addAudioCallback
(
mCallback
);
}
catch
(
RemoteException
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
Log
.
e
(
TAG
,
"remote procedure call failed: addAudioCallback()"
);
}
updateAudioPlayer
();
}
...
...
@@ -77,8 +76,7 @@ public class AudioServiceController implements AudioMiniPlayerControl {
try
{
mAudioServiceBinder
.
load
(
mediaPathList
,
position
);
}
catch
(
RemoteException
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
Log
.
e
(
TAG
,
"remote procedure call failed: load()"
);
}
}
...
...
@@ -96,8 +94,7 @@ public class AudioServiceController implements AudioMiniPlayerControl {
try
{
mAudioServiceBinder
.
addAudioCallback
(
mCallback
);
}
catch
(
RemoteException
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
Log
.
e
(
TAG
,
"remote procedure call failed: addAudioCallback()"
);
}
}
}
...
...
@@ -111,8 +108,7 @@ public class AudioServiceController implements AudioMiniPlayerControl {
mIsBound
=
false
;
}
}
catch
(
RemoteException
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
Log
.
e
(
TAG
,
"remote procedure call failed: removeAudioCallback()"
);
}
}
...
...
@@ -150,8 +146,7 @@ public class AudioServiceController implements AudioMiniPlayerControl {
try
{
mAudioServiceBinder
.
stop
();
}
catch
(
RemoteException
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
Log
.
e
(
TAG
,
"remote procedure call failed: stop()"
);
}
updateAudioPlayer
();
}
...
...
@@ -160,10 +155,9 @@ public class AudioServiceController implements AudioMiniPlayerControl {
public
String
getArtist
()
{
String
artist
=
null
;
try
{
artist
=
mAudioServiceBinder
.
get
Title
();
artist
=
mAudioServiceBinder
.
get
Artist
();
}
catch
(
RemoteException
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
Log
.
e
(
TAG
,
"remote procedure call failed: getArtist()"
);
}
return
artist
;
}
...
...
@@ -174,8 +168,7 @@ public class AudioServiceController implements AudioMiniPlayerControl {
try
{
title
=
mAudioServiceBinder
.
getTitle
();
}
catch
(
RemoteException
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
Log
.
e
(
TAG
,
"remote procedure call failed: getTitle()"
);
}
return
title
;
}
...
...
@@ -185,12 +178,10 @@ public class AudioServiceController implements AudioMiniPlayerControl {
boolean
playing
=
false
;
if
(
mAudioServiceBinder
!=
null
)
{
try
{
playing
=
(
mAudioServiceBinder
.
hasMedia
()
&&
mAudioServiceBinder
.
isPlaying
());
playing
=
(
hasMedia
()
&&
mAudioServiceBinder
.
isPlaying
());
}
catch
(
RemoteException
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
Log
.
e
(
TAG
,
"remote procedure call failed: isPlaying()"
);
}
}
return
playing
;
...
...
@@ -201,8 +192,7 @@ public class AudioServiceController implements AudioMiniPlayerControl {
try
{
mAudioServiceBinder
.
pause
();
}
catch
(
RemoteException
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
Log
.
e
(
TAG
,
"remote procedure call failed: pause()"
);
}
updateAudioPlayer
();
}
...
...
@@ -212,8 +202,7 @@ public class AudioServiceController implements AudioMiniPlayerControl {
try
{
mAudioServiceBinder
.
play
();
}
catch
(
RemoteException
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
Log
.
e
(
TAG
,
"remote procedure call failed: play()"
);
}
updateAudioPlayer
();
}
...
...
@@ -223,8 +212,7 @@ public class AudioServiceController implements AudioMiniPlayerControl {
try
{
return
mAudioServiceBinder
.
hasMedia
();
}
catch
(
RemoteException
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
Log
.
e
(
TAG
,
"remote procedure call failed: hasMedia()"
);
}
return
false
;
}
...
...
@@ -234,8 +222,7 @@ public class AudioServiceController implements AudioMiniPlayerControl {
try
{
return
mAudioServiceBinder
.
getLength
();
}
catch
(
RemoteException
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
Log
.
e
(
TAG
,
"remote procedure call failed: getLength()"
);
}
return
0
;
}
...
...
@@ -245,8 +232,7 @@ public class AudioServiceController implements AudioMiniPlayerControl {
try
{
return
mAudioServiceBinder
.
getTime
();
}
catch
(
RemoteException
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
Log
.
e
(
TAG
,
"remote procedure call failed: getTime()"
);
}
return
0
;
}
...
...
vlc-android/src/org/videolan/vlc/android/MainActivity.java
View file @
32c24877
...
...
@@ -3,17 +3,25 @@ package org.videolan.vlc.android;
import
org.videolan.vlc.android.widget.AudioMiniPlayer
;
import
android.app.
Activity
;
import
android.app.
Dialog
;
import
android.app.TabActivity
;
import
android.content.Intent
;
import
android.content.SharedPreferences
;
import
android.content.SharedPreferences.Editor
;
import
android.content.pm.PackageInfo
;
import
android.content.pm.PackageManager.NameNotFoundException
;
import
android.os.Bundle
;
import
android.os.Handler
;
import
android.os.Message
;
import
android.preference.PreferenceManager
;
import
android.util.Log
;
import
android.view.Menu
;
import
android.view.MenuInflater
;
import
android.view.MenuItem
;
import
android.view.View
;
import
android.view.View.OnClickListener
;
import
android.widget.Button
;
import
android.widget.CheckBox
;
import
android.widget.ImageButton
;
import
android.widget.ProgressBar
;
import
android.widget.TabHost
;
...
...
@@ -26,6 +34,7 @@ public class MainActivity extends TabActivity {
private
static
final
int
VIDEO_TAB
=
0
;
private
static
final
int
AUDIO_TAB
=
1
;
public
static
final
String
START_FROM_NOTIFICATION
=
"from_notification"
;
private
static
final
String
PREF_SHOW_INFO
=
"show_info"
;
private
VideoListActivity
mVideoListActivity
;
...
...
@@ -37,11 +46,18 @@ public class MainActivity extends TabActivity {
private
AudioMiniPlayer
mAudioPlayer
;
private
AudioServiceController
mAudioController
;
private
SharedPreferences
mSettings
;
private
int
mVersionNumber
=
-
1
;
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
setContentView
(
R
.
layout
.
main
);
super
.
onCreate
(
savedInstanceState
);
/* Get settings */
mSettings
=
PreferenceManager
.
getDefaultSharedPreferences
(
this
);
/* Initialize variables */
mInstance
=
this
;
...
...
@@ -76,6 +92,20 @@ public class MainActivity extends TabActivity {
showVideoTab
();
}
/* Show info/alpha/beta Warning */
PackageInfo
pinfo
=
null
;
try
{
pinfo
=
getPackageManager
().
getPackageInfo
(
getPackageName
(),
0
);
}
catch
(
NameNotFoundException
e
)
{
Log
.
e
(
TAG
,
"package info not found."
);
}
if
(
pinfo
!=
null
)
{
mVersionNumber
=
pinfo
.
versionCode
;
if
(
mSettings
.
getInt
(
PREF_SHOW_INFO
,
-
1
)
!=
mVersionNumber
)
showInfoDialog
();
}
/* Load media items from database and storage */
MediaLibrary
.
getInstance
().
loadMediaItems
();
}
...
...
@@ -163,6 +193,26 @@ public class MainActivity extends TabActivity {
mAudioPlayer
.
setVisibility
(
AudioMiniPlayer
.
VISIBLE
);
}
private
void
showInfoDialog
()
{
final
Dialog
infoDialog
=
new
Dialog
(
this
,
R
.
style
.
info_dialog
);
infoDialog
.
setContentView
(
R
.
layout
.
info_dialog
);
Button
okButton
=
(
Button
)
infoDialog
.
findViewById
(
R
.
id
.
ok
);
okButton
.
setOnClickListener
(
new
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
CheckBox
notShowAgain
=
(
CheckBox
)
infoDialog
.
findViewById
(
R
.
id
.
not_show_again
);
if
(
notShowAgain
.
isChecked
()
&&
mSettings
!=
null
)
{
Editor
editor
=
mSettings
.
edit
();
editor
.
putInt
(
PREF_SHOW_INFO
,
mVersionNumber
);
editor
.
commit
();
}
infoDialog
.
dismiss
();
}
});
infoDialog
.
show
();
}
/**
* onClick event from xml
...
...
vlc-android/src/org/videolan/vlc/android/widget/AudioMiniPlayer.java
View file @
32c24877
package
org.videolan.vlc.android.widget
;
import
org.videolan.vlc.android.AudioPlayer.AudioPlayerControl
;
import
org.videolan.vlc.android.MainActivity
;
import
org.videolan.vlc.android.R
;
import
org.videolan.vlc.android.Util
;
...
...
@@ -12,7 +13,6 @@ import android.view.LayoutInflater;
import
android.view.MenuInflater
;
import
android.view.MenuItem
;
import
android.view.View
;
import
android.widget.AdapterView.AdapterContextMenuInfo
;
import
android.widget.ImageButton
;
import
android.widget.ImageView
;
import
android.widget.LinearLayout
;
...
...
@@ -23,7 +23,7 @@ public class AudioMiniPlayer extends LinearLayout {
public
static
final
String
TAG
=
"VLC/AudioMiniPlayer"
;
private
Audio
Mini
PlayerControl
mAudioPlayerControl
;
private
AudioPlayerControl
mAudioPlayerControl
;
private
TextView
mTitle
;
private
TextView
mArtist
;
...
...
@@ -109,7 +109,7 @@ public class AudioMiniPlayer extends LinearLayout {
super
.
onCreateContextMenu
(
menu
);
}
public
void
setAudioPlayerControl
(
Audio
Mini
PlayerControl
control
)
{
public
void
setAudioPlayerControl
(
AudioPlayerControl
control
)
{
mAudioPlayerControl
=
control
;
}
...
...
@@ -149,15 +149,4 @@ public class AudioMiniPlayer extends LinearLayout {
}
public
interface
AudioMiniPlayerControl
{
String
getTitle
();
Bitmap
getCover
();
int
getLength
();
int
getTime
();
boolean
hasMedia
();
String
getArtist
();
void
play
();
void
pause
();
boolean
isPlaying
();
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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