Open the application by means of a launcher activity
This allows the history to be better handled when the song selector is opened on launch. Pressing back will leave the application, etc.
This commit is contained in:
parent
fe2ec0f975
commit
58c53567bf
@ -24,16 +24,20 @@
|
||||
android:label="@string/app_name"
|
||||
android:name="ContextApplication">
|
||||
<activity
|
||||
android:name="FullPlaybackActivity"
|
||||
android:theme="@style/NoBackground"
|
||||
android:launchMode="singleTop" >
|
||||
android:name="LaunchActivity"
|
||||
android:theme="@style/NoBackground">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name="FullPlaybackActivity"
|
||||
android:theme="@style/NoBackground"
|
||||
android:launchMode="singleTop" />
|
||||
<activity
|
||||
android:name="SongSelector"
|
||||
android:launchMode="singleTop"
|
||||
android:theme="@android:style/Theme.Black.NoTitleBar" />
|
||||
<activity
|
||||
android:name="MiniPlaybackActivity"
|
||||
@ -65,4 +69,4 @@
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
||||
<supports-screens android:smallScreens="true" />
|
||||
</manifest>
|
||||
</manifest>
|
||||
|
@ -54,15 +54,13 @@ public class FullPlaybackActivity extends PlaybackActivity implements SeekBar.On
|
||||
{
|
||||
super.onCreate(icicle);
|
||||
|
||||
SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
if (icicle == null && settings.getBoolean("selector_on_startup", false))
|
||||
startActivity(new Intent(this, SongSelector.class));
|
||||
|
||||
setContentView(R.layout.full_playback);
|
||||
|
||||
mCoverView = (CoverView)findViewById(R.id.cover_view);
|
||||
mCoverView.mHandler = mHandler;
|
||||
mCoverView.setOnClickListener(this);
|
||||
|
||||
SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
mCoverView.mSeparateInfo = settings.getBoolean("separate_info", false);
|
||||
|
||||
mControlsTop = findViewById(R.id.controls_top);
|
||||
@ -260,7 +258,7 @@ public class FullPlaybackActivity extends PlaybackActivity implements SeekBar.On
|
||||
{
|
||||
switch (message.what) {
|
||||
case MSG_SAVE_DISPLAY_MODE:
|
||||
SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(FullPlaybackActivity.this);
|
||||
SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
SharedPreferences.Editor editor = settings.edit();
|
||||
editor.putBoolean("separate_info", mCoverView.mSeparateInfo);
|
||||
editor.commit();
|
||||
|
46
src/org/kreed/vanilla/LaunchActivity.java
Normal file
46
src/org/kreed/vanilla/LaunchActivity.java
Normal file
@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright (C) 2010 Christopher Eby <kreed@kreed.org>
|
||||
*
|
||||
* This file is part of Vanilla Music Player.
|
||||
*
|
||||
* Vanilla Music Player is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* Vanilla Music Player is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.kreed.vanilla;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
|
||||
/**
|
||||
* Very simple activity that simply launches the appropriate Activity based on
|
||||
* user preferences.
|
||||
*/
|
||||
public class LaunchActivity extends Activity {
|
||||
/**
|
||||
* Launch either the PlaybackActivity or SongSelector, depending on user
|
||||
* settings.
|
||||
*/
|
||||
@Override
|
||||
public void onCreate(Bundle state)
|
||||
{
|
||||
super.onCreate(state);
|
||||
|
||||
SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
boolean selector = settings.getBoolean("selector_on_startup", false);
|
||||
startActivity(new Intent(this, selector ? SongSelector.class : FullPlaybackActivity.class));
|
||||
finish();
|
||||
}
|
||||
}
|
@ -42,7 +42,7 @@ public class SongNotification extends Notification {
|
||||
contentView = views;
|
||||
icon = statusIcon;
|
||||
flags |= Notification.FLAG_ONGOING_EVENT;
|
||||
Intent intent = new Intent(context, remoteView ? MiniPlaybackActivity.class : FullPlaybackActivity.class);
|
||||
Intent intent = new Intent(context, remoteView ? MiniPlaybackActivity.class : LaunchActivity.class);
|
||||
contentIntent = PendingIntent.getActivity(context, 0, intent, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user