Skip to content

Commit

Permalink
'完成播放界面动态效果'
Browse files Browse the repository at this point in the history
  • Loading branch information
DuanJiaNing committed Apr 6, 2019
1 parent 4f6b12c commit 969f2bf
Show file tree
Hide file tree
Showing 12 changed files with 106 additions and 15 deletions.
47 changes: 47 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
apply plugin: 'com.android.application'
//apply plugin: 'kotlin-android'

android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.duan.musicoco"
minSdkVersion 16
targetSdkVersion 25
versionCode 1
versionName "1.1.0"
testInstrumentationRunner "android.support.double_number_picker.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha9'
compile 'com.android.support:palette-v7:23.4.0'
compile 'com.android.support:appcompat-v7:26.0.0-alpha1'
compile 'com.android.support:cardview-v7:26.0.0-alpha1'
compile 'com.android.support:design:26.0.0-alpha1'
compile 'io.reactivex:rxjava:1.0.14'
compile 'io.reactivex:rxandroid:1.0.1'
compile 'com.victor:lib:1.0.4'
compile 'com.android.support:support-v4:26.0.0-alpha1'
compile 'jp.wasabeef:glide-transformations:2.0.2'
compile 'jp.co.cyberagent.android.gpuimage:gpuimage-library:1.4.1'
compile 'com.android.support:support-vector-drawable:25.3.1'
testCompile 'junit:junit:4.12'
compile files('src/main/libs/MiStats_SDK_Client_1_9_6.jar')
compile files('src/main/libs/AdSdk.jar')
}
repositories {
mavenCentral()
jcenter()
}
6 changes: 4 additions & 2 deletions app/src/main/java/com/duan/musicoco/play/PlayActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,11 @@ public void onFftCapture(float[] fft) {
});
}

playVisualizer.setVisualizerEnable(playPreference.getDotWaveEnable() &&
playVisualizer.setVisualizerEnable(settingPreference.getDotWaveEnable() &&
control.status() == PlayController.STATUS_PLAYING);

viewsController.updateBarWaveVisible(settingPreference.getDotWaveEnable());

} catch (RemoteException e) {
e.printStackTrace();
}
Expand Down Expand Up @@ -308,7 +310,7 @@ protected void onDestroy() {
super.onDestroy();
unbindService();
unregisterReceiver();
if (playPreference.getDotWaveEnable()) {
if (settingPreference.getDotWaveEnable()) {
playVisualizer.stopListen();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,10 @@ public void updateBarWaveHeight(float[] fft) {
barWavesView.setWaveHeight(fft);
}

public void updateBarWaveVisible(boolean dotWaveEnable) {
barWavesView.setVisibility(dotWaveEnable ? View.VISIBLE : View.GONE);
}

public class BarWaveColor {
int barColor;
int waveColor;
Expand Down
11 changes: 0 additions & 11 deletions app/src/main/java/com/duan/musicoco/preference/PlayPreference.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
public class PlayPreference extends BasePreference {

public static final String KEY_PLAY_MODE = "key_play_mode";
public static final String KEY_DOT_WAVE = "key_dot_wave";
public static final String KEY_THEME = "key_theme";
public static final String KEY_SHEET = "key_sheet";
public static final String KEY_PLAY_BG_MODE = "key_play_bg_mode";
Expand All @@ -29,16 +28,6 @@ public void updateTheme(ThemeEnum themeEnum) {
editor.apply();
}

public void toggleDotWave() {
editor = preferences.edit();
editor.putBoolean(KEY_DOT_WAVE, !getDotWaveEnable());
editor.apply();
}

public boolean getDotWaveEnable() {
return preferences.getBoolean(KEY_DOT_WAVE, true);
}

public void updatePlayBgMode(PlayBackgroundModeEnum mode) {
editor = preferences.edit();
editor.putString(KEY_PLAY_BG_MODE, mode.name());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,8 @@ public boolean preHeadphoneWire() {
return preferences.getBoolean("pre_headphone_wire", true);
}

public boolean getDotWaveEnable() {
return preferences.getBoolean("visual_control_dot_wave", true);
}

}
2 changes: 1 addition & 1 deletion app/src/main/res/layout/play_notify_big_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="3"
app:srcCompat="@drawable/ic_favorite" />
app:srcCompat="@drawable/ic_favorite_border" />

<ImageButton
android:id="@+id/play_notify_pre"
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/res/values-en/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,10 @@
<string name="setting_set_headphone_wire">Wire cut song</string>
<string name="setting_set_headphone_wire_enable">click: play / pause; double click: next one; three hit: previous one</string>

<string name="setting_visual_control">visual control</string>
<string name="setting_dot_wave">play panel visual effect</string>


<string name="setting_set_feedback">Feedback</string>
<string name="setting_set_about">Application information</string>

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/dimens.xml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,6 @@
<dimen name="me_social_item_height">100dp</dimen>

<!--设置界面 PreferenceFragment 的高度-->
<dimen name="setting_fragment_height">400dp</dimen>
<dimen name="setting_fragment_height">500dp</dimen>

</resources>
3 changes: 3 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,9 @@
<string name="setting_set_headphone_wire">线控切歌</string>
<string name="setting_set_headphone_wire_enable">单击:播放/暂停;双击:下一首;三击:上一首</string>

<string name="setting_visual_control">视效控制</string>
<string name="setting_dot_wave">播放面板视觉效果</string>

<string name="setting_set_feedback">反馈</string>
<string name="setting_set_about">应用信息</string>

Expand Down
11 changes: 11 additions & 0 deletions app/src/main/res/xml/pref_general.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,15 @@

</PreferenceCategory>

<PreferenceCategory android:title="@string/setting_visual_control">

<SwitchPreference
android:defaultValue="true"
android:key="visual_control_dot_wave"
android:summaryOff="@string/disable"
android:summaryOn="@string/enable"
android:title="@string/setting_dot_wave" />

</PreferenceCategory>

</PreferenceScreen>
26 changes: 26 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = '1.1.3'
repositories {
jcenter()
// google()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
// classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

allprojects {
repositories {
jcenter()
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}
1 change: 1 addition & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include ':app'

0 comments on commit 969f2bf

Please sign in to comment.