diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2b75303 --- /dev/null +++ b/.gitignore @@ -0,0 +1,13 @@ +*.iml +.gradle +/local.properties +/.idea/caches +/.idea/libraries +/.idea/modules.xml +/.idea/workspace.xml +/.idea/navEditor.xml +/.idea/assetWizardSettings.xml +.DS_Store +/build +/captures +.externalNativeBuild diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml new file mode 100644 index 0000000..681f41a --- /dev/null +++ b/.idea/codeStyles/Project.xml @@ -0,0 +1,116 @@ + + + + + + + +
+ + + + xmlns:android + + ^$ + + + +
+
+ + + + xmlns:.* + + ^$ + + + BY_NAME + +
+
+ + + + .*:id + + http://schemas.android.com/apk/res/android + + + +
+
+ + + + .*:name + + http://schemas.android.com/apk/res/android + + + +
+
+ + + + name + + ^$ + + + +
+
+ + + + style + + ^$ + + + +
+
+ + + + .* + + ^$ + + + BY_NAME + +
+
+ + + + .* + + http://schemas.android.com/apk/res/android + + + ANDROID_ATTRIBUTE_ORDER + +
+
+ + + + .* + + .* + + + BY_NAME + +
+
+
+
+
+
\ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..fb7f4a8 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/deploymentTargetDropDown.xml b/.idea/deploymentTargetDropDown.xml new file mode 100644 index 0000000..cdab414 --- /dev/null +++ b/.idea/deploymentTargetDropDown.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..15a15b2 --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml new file mode 100644 index 0000000..ce86a83 --- /dev/null +++ b/.idea/gradle.xml @@ -0,0 +1,20 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml new file mode 100644 index 0000000..a5f05cd --- /dev/null +++ b/.idea/jarRepositories.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..ef61796 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,9 @@ + + + + + + + + \ No newline at end of file diff --git a/app/.gitignore b/app/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/app/build.gradle b/app/build.gradle new file mode 100644 index 0000000..f1d3593 --- /dev/null +++ b/app/build.gradle @@ -0,0 +1,39 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 29 + buildToolsVersion "29.0.2" + defaultConfig { + applicationId "com.example.myapplication10" + minSdkVersion 14 + targetSdkVersion 29 + versionCode 1 + versionName "1.0" + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } +} + +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar']) + implementation 'androidx.appcompat:appcompat:1.1.0' + implementation 'androidx.constraintlayout:constraintlayout:1.1.3' + testImplementation 'junit:junit:4.12' + androidTestImplementation 'androidx.test:runner:1.2.0' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' + implementation 'androidx.recyclerview:recyclerview:1.1.0' + //noinspection GradleCompatible + implementation 'com.android.support:support-compat:25.1.1' + implementation 'com.daimajia.easing:library:2.0@aar' + implementation 'com.daimajia.androidanimations:library:2.3@aar' + implementation 'de.hdodenhof:circleimageview:3.0.1' + implementation 'com.astuetz:pagerslidingtabstrip:1.0.1' + implementation files('libs/xutils-2.6.14.jar') + //noinspection GradleCompatible + implementation 'com.android.support:design:28.0.0' +} diff --git a/app/libs/xutils-2.6.14.jar b/app/libs/xutils-2.6.14.jar new file mode 100644 index 0000000..ee6bcd7 Binary files /dev/null and b/app/libs/xutils-2.6.14.jar differ diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro new file mode 100644 index 0000000..f1b4245 --- /dev/null +++ b/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile diff --git a/app/src/androidTest/java/com/example/myapplication10/ExampleInstrumentedTest.java b/app/src/androidTest/java/com/example/myapplication10/ExampleInstrumentedTest.java new file mode 100644 index 0000000..1200c37 --- /dev/null +++ b/app/src/androidTest/java/com/example/myapplication10/ExampleInstrumentedTest.java @@ -0,0 +1,27 @@ +package com.example.myapplication10; + +import android.content.Context; + +import androidx.test.InstrumentationRegistry; +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.*; + +/** + * Instrumented test, which will execute on an Android device. + * + * @see Testing documentation + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getTargetContext(); + + assertEquals("com.example.myapplication10", appContext.getPackageName()); + } +} diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..d9174a5 --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/ic_launcher-playstore.png b/app/src/main/ic_launcher-playstore.png new file mode 100644 index 0000000..563b3da Binary files /dev/null and b/app/src/main/ic_launcher-playstore.png differ diff --git a/app/src/main/java/com/example/musicPlayer/MainActivity.java b/app/src/main/java/com/example/musicPlayer/MainActivity.java new file mode 100644 index 0000000..d532b14 --- /dev/null +++ b/app/src/main/java/com/example/musicPlayer/MainActivity.java @@ -0,0 +1,250 @@ +package com.example.musicPlayer; + +import android.content.ClipData; +import android.content.ComponentName; +import android.content.Context; +import android.content.DialogInterface; +import android.content.Intent; +import android.content.ServiceConnection; + +import android.content.ComponentName; +import android.content.Context; +import android.content.Intent; +import android.content.ServiceConnection; +import android.content.SharedPreferences; +import android.os.Bundle; +import android.os.IBinder; +import android.view.KeyEvent; +import android.view.Menu; +import android.view.MenuItem; +import android.view.View; + +import androidx.appcompat.app.ActionBar; +import androidx.appcompat.app.AlertDialog; +import androidx.appcompat.view.menu.MenuView; +import androidx.core.view.GravityCompat; +import androidx.appcompat.app.ActionBarDrawerToggle; + +import android.widget.ImageButton; +import android.widget.LinearLayout; +import android.widget.ListView; +import android.widget.TextView; + +import androidx.appcompat.app.AppCompatActivity; +import androidx.drawerlayout.widget.DrawerLayout; +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentPagerAdapter; +import androidx.viewpager.widget.ViewPager; + + +import com.google.android.material.navigation.NavigationView; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + + + +public class MainActivity extends AppCompatActivity + implements NavigationView.OnNavigationItemSelectedListener{ + private com.example.musicPlayer.MusicService musicService; + private ListView news_list; + private List>mData; + private ViewPager mViewPager; + private FragmentPagerAdapter mAdapter; + private List mFragment; + + private LinearLayout mTabWechat; + private LinearLayout mTabFriend; + private LinearLayout mTabContact; + + private TextView a; + private TextView b; + private ImageButton mImgWechat; + private ImageButton mImgFriend; + private ImageButton mImgContact; + + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.abc); + NavigationView navigationView = findViewById(R.id.nav_view); + navigationView.setNavigationItemSelectedListener(this); + + initViews(); + initEvents(); + initDatas(); + + + View headerView=navigationView.getHeaderView(0);//设置抽屉的用户名 + TextView b=(TextView)headerView.findViewById(R.id.b); + SharedPreferences sp=getSharedPreferences("loginInfo", MODE_PRIVATE); + String userName=sp.getString("loginUserName",null); + b.setText(userName); + + Intent mintent=new Intent(this,MusicService.class); + this.startService(mintent); + this.bindService(mintent,mSerConn, Context.BIND_AUTO_CREATE); + + } + + private void initViews(){ //初始化控件 + mViewPager=(ViewPager)findViewById(R.id.id_viewpager); + mTabWechat=(LinearLayout)findViewById(R.id.id_tab_wechat); + mTabFriend=(LinearLayout)findViewById(R.id.id_tab_friend); + mTabContact=(LinearLayout)findViewById(R.id.id_tab_contact); + + + mImgWechat=(ImageButton)findViewById(R.id.id_tab_wechat_img); + mImgFriend=(ImageButton)findViewById(R.id.id_tab_friend_img); + mImgContact=(ImageButton)findViewById(R.id.id_tab_contact_img); + + + } + + private void initEvents(){ + mTabWechat.setOnClickListener(onClickListener); + mTabFriend.setOnClickListener(onClickListener); + mTabContact.setOnClickListener(onClickListener); + + } + + private void initDatas(){ + mFragment=new ArrayList<>(); + mFragment.add(new findFragment()); + mFragment.add(new playingFragment()); + mFragment.add(new loveFragment()); + + + mAdapter=new FragmentPagerAdapter(getSupportFragmentManager()){ //viewPager的适配器 + @Override + public Fragment getItem(int position) { + return mFragment.get(position); + } + + @Override + public int getCount() { + return mFragment.size(); + } + }; + mViewPager.setAdapter(mAdapter); + mViewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() { + @Override + public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { + + } + + @Override + public void onPageSelected(int position) { + mViewPager.setCurrentItem(position); + resetImgs(); + selectTab(position); + } + + @Override + public void onPageScrollStateChanged(int state) { + + } + }); + } + private void selectTab(int i){ + switch (i){ + case 0: + mImgWechat.setImageResource(R.drawable.findon); + break; + case 1: + mImgFriend.setImageResource(R.drawable.playing); + break; + case 2: + mImgContact.setImageResource(R.drawable.into); + break; + + } + mViewPager.setCurrentItem(i); + } + + private void resetImgs(){ + mImgWechat.setImageResource(R.drawable.findoff); + mImgFriend.setImageResource(R.drawable.pause); + mImgContact.setImageResource(R.drawable.leave); + + } + + private ServiceConnection mSerConn=new ServiceConnection() { + @Override + public void onServiceConnected(ComponentName name, IBinder service) { + musicService = ((MusicService.MyBinder)service).getService(); + } + + @Override + public void onServiceDisconnected(ComponentName name) { + musicService = null; + } + }; + View.OnClickListener onClickListener=new View.OnClickListener(){ + @Override + public void onClick(View v) { + resetImgs(); + switch(v.getId()){ + case R.id.id_tab_wechat: + selectTab(0); + break; + case R.id.id_tab_friend: + selectTab(1); + break; + case R.id.id_tab_contact: + selectTab(2); + break; + + + } + } + }; + + @Override + public boolean onKeyDown(int keyCode, KeyEvent event) { + if (keyCode == KeyEvent.KEYCODE_BACK) { + moveTaskToBack(true); + return true; + } + return super.onKeyDown(keyCode, event); + } + + @SuppressWarnings("StatementWithEmptyBody") + @Override + public boolean onNavigationItemSelected(MenuItem item) { + // Handle navigation view item clicks here. + int id = item.getItemId(); + final AlertDialog.Builder builder=new AlertDialog.Builder(this); + + if (id == R.id.nav_zhuxiao) { + Intent intent1=new Intent(MainActivity.this,login.class); + finish(); + + startActivity(intent1); + // Handle the camera action + } else if (id == R.id.nav_tuichu) { + finish(); + }else if (id == R.id.nav_find) { + selectTab(0); + } + else if (id == R.id.nav_playing) { + selectTab(1); + }else if (id == R.id.nav_mygedan) { + selectTab(2); + } + else if (id == R.id.nav_qiandao) { + builder.setTitle("消息提示").setMessage("您签到成功").setPositiveButton("确定",new DialogInterface.OnClickListener(){ + @Override + public void onClick(DialogInterface dialog,int which){ + + } + }).show(); + + } + DrawerLayout drawer = findViewById(R.id.drawer_layout); + drawer.closeDrawer(GravityCompat.START); + return true; + } +} diff --git a/app/src/main/java/com/example/musicPlayer/MusicService.java b/app/src/main/java/com/example/musicPlayer/MusicService.java new file mode 100644 index 0000000..f5af780 --- /dev/null +++ b/app/src/main/java/com/example/musicPlayer/MusicService.java @@ -0,0 +1,139 @@ +package com.example.musicPlayer; + +import android.app.Service; +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.content.IntentFilter; +import android.media.MediaPlayer; +import android.net.Uri; +import android.os.Binder; +import android.os.Environment; +import android.os.IBinder; +import android.util.Log; + +import com.example.musicPlayer.R; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; +import java.util.Timer; +import java.util.TimerTask; + +public class MusicService extends Service { + private MyBinder iBinder; + public MediaPlayer musicPlayer=new MediaPlayer(); + public static int musicPosition; + public Uri uri; + private Timer timer; + public MusicService() { + } + public class MyBinder extends Binder { + MusicService getService(){ + return MusicService.this; + } + } + @Override + public void onCreate() { + super.onCreate(); + timer = new Timer(); + } + //更新进度条 + public void refreshSeekBar() { + timer.cancel();//timer定时给播放界面发送当前播放时间和进度 + timer = new Timer(); + timer.scheduleAtFixedRate(new TimerTask() { + @Override + public void run() { + if (musicPlayer != null && musicPlayer.isPlaying()) { + int playedTime = musicPlayer.getCurrentPosition(); + int duration = musicPlayer.getDuration(); + Intent updateIntent = new Intent(); + updateIntent.putExtra("playedTime", playedTime); + updateIntent.putExtra("duration", duration); + updateIntent.putExtra("progress", playedTime/duration); + updateIntent.setAction("action.updateplayedtime"); + MusicService.this.sendBroadcast(updateIntent); + } + } + }, 0, 1000); + } + //从头开始播放一首歌 + public void play(int uri) { + try { + if(musicPlayer.isPlaying()){ + musicPlayer.stop(); + } + else{ + musicPosition = 0; + musicPlayer.reset(); + musicPlayer=MediaPlayer.create(getApplicationContext(),uri); + musicPlayer.start();//开启音乐 + musicPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() { + @Override + //播放完成发送播放下一首的广播请求 + public void onCompletion(MediaPlayer arg0) { + Intent completeIntent = new Intent(); + completeIntent.setAction("action.nextsong"); + sendBroadcast(completeIntent); + Log.d("MusicService", "sendBroadcast"); + } + }); + } + }catch (NullPointerException e){ + e.printStackTrace(); + } + + } + //暂停播放 + public void pause() { + Log.d("MusicService", "pause"); + musicPlayer.pause(); + musicPosition = musicPlayer.getCurrentPosition(); + timer.cancel(); + } + + // 获取当前进度 + public int getCurrentProgress() { + if (musicPlayer != null & musicPlayer.isPlaying()) { + return musicPlayer.getCurrentPosition(); + } else if (musicPlayer != null & (!musicPlayer.isPlaying())) { + return musicPlayer.getCurrentPosition(); + } + return 0; + } + + public void setPosition (int position) { + musicPlayer.seekTo(position);//重新设定播放进度 + } + + //继续播放 + public void goPlay(){ + int position = getCurrentProgress(); + musicPlayer.seekTo(position);//设置当前MediaPlayer的播放位置,单位是毫秒。 + musicPlayer.start(); + } + @Override + public IBinder onBind(Intent intent) { + // TODO: Return the communication channel to the service. + MyBinder ibinder=new MyBinder(); + return ibinder; + } + @Override + public boolean onUnbind(Intent intent) { + return super.onUnbind(intent); + } + @Override + public void onDestroy() { + super.onDestroy(); + if (musicPlayer != null) { + if (musicPlayer.isPlaying()) timer.cancel(); + musicPlayer.stop(); + musicPlayer.release(); + } + } + +} + diff --git a/app/src/main/java/com/example/musicPlayer/SplashScreen.java b/app/src/main/java/com/example/musicPlayer/SplashScreen.java new file mode 100644 index 0000000..4c6e93e --- /dev/null +++ b/app/src/main/java/com/example/musicPlayer/SplashScreen.java @@ -0,0 +1,24 @@ +package com.example.musicPlayer; + +import androidx.appcompat.app.AppCompatActivity; + +import android.content.Intent; +import android.os.Bundle; +import android.os.Handler; + +public class SplashScreen extends AppCompatActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_splash_screen); + new Handler().postDelayed(new Runnable() { + @Override + public void run() { + Intent mainIntent=new Intent(SplashScreen.this,login.class); + startActivity(mainIntent); + finish(); + } + },3000); + } +} diff --git a/app/src/main/java/com/example/musicPlayer/SubFragment1.java b/app/src/main/java/com/example/musicPlayer/SubFragment1.java new file mode 100644 index 0000000..9d45d32 --- /dev/null +++ b/app/src/main/java/com/example/musicPlayer/SubFragment1.java @@ -0,0 +1,282 @@ +package com.example.musicPlayer; + + +import android.app.AlertDialog; +import android.content.ComponentName; +import android.content.Context; +import android.content.DialogInterface; +import android.content.Intent; +import android.content.ServiceConnection; +import android.net.Uri; +import android.os.Bundle; + +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentManager; +import androidx.fragment.app.FragmentTransaction; + +import android.os.IBinder; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.BaseAdapter; +import android.widget.ImageButton; +import android.widget.ImageView; +import android.widget.ListView; +import android.widget.TextView; +import android.widget.Toast; + +import com.example.musicPlayer.R; +import com.lidroid.xutils.DbUtils; +import com.lidroid.xutils.db.sqlite.Selector; +import com.lidroid.xutils.exception.DbException; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * A simple {@link Fragment} subclass. + */ +public class SubFragment1 extends Fragment { + private ListView news_list; + private List> mData; + private TextView sname, info; + + private MusicService musicService; + + private List results; + private int id = 0; + DbUtils db; + + public SubFragment1() { + // Required empty public constructor + } + private ServiceConnection mSerConn=new ServiceConnection() { + @Override + public void onServiceConnected(ComponentName name, IBinder service) { + musicService = ((MusicService.MyBinder)service).getService(); + } + + @Override + public void onServiceDisconnected(ComponentName name) { + musicService = null; + } + }; + private List> getData() { + List> list = new ArrayList>(); + Map map = new HashMap(); + map.put("news_title", "在希望的田野上"); + map.put("news_info", "中国广播合唱团、杨淑清 - 中华人民共和国国歌 珍藏版"); + map.put("news_thumb", R.drawable.zaixiwangdetianyeshang); + map.put("url",R.raw.zaixiwangdetianyeshang); + list.add(map); + + map = new HashMap(); + map.put("news_title", "天耀中华"); + map.put("news_info", "姚贝娜 - 2014年中央电视台春节联欢晚会"); + map.put("news_thumb", R.drawable.tianyaozhonghua); + map.put("url",R.raw.tianyaozhonghua); + list.add(map); + + map = new HashMap(); + map.put("news_title", "我的战鹰绕着宝岛飞"); + map.put("news_info", "韩召 - 我的战鹰绕着宝岛飞"); + map.put("news_thumb", R.drawable.wodezhanyingraozhebaodaofei); + map.put("url",R.raw.wodezhanyingraozhebaodaofei); + list.add(map); + + map = new HashMap(); + map.put("news_title", "Die Internationale"); + map.put("news_info", "Arbeit - Marx"); + map.put("news_thumb", R.drawable.dieinternationale); + map.put("url",R.raw.dieinternationale); + list.add(map); + + map = new HashMap(); + map.put("news_title", "Песня о тревожной молодости"); + map.put("news_info", "Стас Пьеха、Хор \"Пересвет\" - Песня о тревожной молодости"); + map.put("news_thumb", R.drawable.gechangdongdangdeqingchun); + map.put("url",R.raw.gechangdongdangdeqingchun); + list.add(map); + + return list; + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + // Inflate the layout for this fragment + View view = inflater.inflate(R.layout.fragment_sub_fragment1, container, false); + news_list = (ListView) view.findViewById(R.id.news_list); + mData = getData(); + DbUtils.DaoConfig config = new DbUtils.DaoConfig(getActivity()); + config.setDbName("music"); + config.setDbVersion(1); + db = DbUtils.create(config); + MyAdapter adapter = new MyAdapter(getActivity(), mData,results,db); + news_list.setAdapter(adapter); + try { + db.createTableIfNotExist(musicList.class); + }catch (Exception e){} + + Intent mintent=new Intent(getActivity(),MusicService.class); + getActivity().getApplicationContext().bindService(mintent,mSerConn,Context.BIND_AUTO_CREATE); + return view; + } + + @Override + public void onResume() { + try { + List results = db.findAll(Selector.from(musicInfo.class)); + MyAdapter adapter = new MyAdapter(getActivity(), mData, results, db); + news_list.setAdapter(adapter); + }catch (DbException e){ + + } + super.onResume(); + } + + public final class ViewHolder { + public ImageView news_thumb; + public TextView news_title; + public TextView news_info; + public ImageButton news_btn; + public ImageButton like; + } + + public class MyAdapter extends BaseAdapter { + private LayoutInflater mInflater; + private Context context; + private List> data; + private List results; + private Fragment fragment;//用于接收传递过来的Context对象 + DbUtils db; + public MyAdapter(Context contaxt, List> data,List results,DbUtils db ){ + this.context = contaxt; + this.data = data; + this.results=results; + this.db=db; + this.mInflater = LayoutInflater.from(context); + } + + @Override + public int getCount() { + return mData.size(); + } + + @Override + public Object getItem(int position) { + return position; + } + + @Override + public long getItemId(int position) { + return position; + } + + @Override + public View getView(final int position, View convertView, ViewGroup parent) { + ViewHolder holder = null; + if (convertView == null) { + holder = new ViewHolder(); + convertView = mInflater.inflate(R.layout.listview1, null); + holder.news_thumb = (ImageView) convertView.findViewById(R.id.news_thumb); + holder.news_title = (TextView) convertView.findViewById(R.id.news_title); + holder.news_info = (TextView) convertView.findViewById(R.id.news_info); + holder.news_btn = (ImageButton) convertView.findViewById(R.id.news_btn); + holder.like = (ImageButton) convertView.findViewById(R.id.like); + convertView.setTag(holder); + } else { + holder = (SubFragment1.ViewHolder) convertView.getTag(); + } + holder.news_thumb.setBackgroundResource((Integer) mData.get(position).get("news_thumb")); + holder.news_title.setText((String) mData.get(position).get("news_title")); + holder.news_info.setText((String) mData.get(position).get("news_info")); + holder.news_btn.setTag(position); + holder.like.setTag(position); + + final ImageButton storeMusic = holder.like; + final TextView sname = holder.news_title; + final TextView info = holder.news_info; + + //将歌曲列表存入表musicList + String gm=sname.getText().toString(); + String gs=info.getText().toString(); + Integer songuri=(Integer)mData.get(position).get("url"); + Integer imguri=(Integer) mData.get(position).get("news_thumb"); + try { + if(db.findAll(Selector.from(musicList.class).where("songname", "=", gm)).isEmpty()) { + musicList l = new musicList(gm, gs, songuri, imguri); + db.save(l); + } + }catch (Exception e){} + + + + try { + List musicstored = db.findAll(Selector.from(musicInfo.class).where("songname", "=", sname.getText().toString())); + if(musicstored.isEmpty()){ + holder.like.setImageResource(R.drawable.unlike); + }else { + holder.like.setImageResource(R.drawable.like); + } + }catch (Exception e){ + + } + holder.news_btn.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + switchToPlay((Integer) mData.get(position).get("url")); + playMusic(position); + } + }); + + holder.like.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + + storeMusic.setImageResource(R.drawable.like); + + try{ + + String songname=sname.getText().toString(); + String singer=info.getText().toString(); + Integer uri=(Integer) mData.get(position).get("url"); + Integer imguri=(Integer) mData.get(position).get("news_thumb"); + Log.e("======",songname); + Log.e("======",singer); + if(db.findAll(Selector.from(musicInfo.class).where("songname", "=", songname)).isEmpty()){ + musicInfo m=new musicInfo(songname,singer,uri,imguri); + db.save(m); + Log.e("======",songname); + Log.e("======",singer); + Toast.makeText(getActivity(),"收藏成功!",Toast.LENGTH_SHORT).show(); + } + + }catch (Exception e){ + + } + } + }); + return convertView; + } + + public void playMusic(int position) { + if(musicService.musicPlayer.isPlaying()){ + musicService.musicPlayer.stop(); + } + musicService.play((Integer) mData.get(position).get("url")); + Log.e("________",mData.get(position).get("url").toString()); + } + public void switchToPlay(Integer uri) { + Log.e("puturi",uri.toString()); + Intent intent = new Intent(); + intent.putExtra("uri", uri); + intent.setAction("updateSong"); + getActivity().sendBroadcast(intent); + + } + } +} diff --git a/app/src/main/java/com/example/musicPlayer/SubFragment2.java b/app/src/main/java/com/example/musicPlayer/SubFragment2.java new file mode 100644 index 0000000..9b15c96 --- /dev/null +++ b/app/src/main/java/com/example/musicPlayer/SubFragment2.java @@ -0,0 +1,260 @@ +package com.example.musicPlayer; + + +import android.app.AlertDialog; +import android.content.ComponentName; +import android.content.Context; +import android.content.DialogInterface; +import android.content.Intent; +import android.content.ServiceConnection; +import android.os.Bundle; + +import androidx.fragment.app.Fragment; + +import android.os.IBinder; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.BaseAdapter; +import android.widget.ImageButton; +import android.widget.ImageView; +import android.widget.ListView; +import android.widget.TextView; +import android.widget.Toast; + +import com.example.musicPlayer.R; +import com.lidroid.xutils.DbUtils; +import com.lidroid.xutils.db.sqlite.Selector; +import com.lidroid.xutils.exception.DbException; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * A simple {@link Fragment} subclass. + */ +public class SubFragment2 extends Fragment { + private ListView news_list; + private List> mData; + private MusicService musicService; + private List results; + private int id = 0; + DbUtils db; + public SubFragment2() { + // Required empty public constructor + } + private ServiceConnection mSerConn=new ServiceConnection() { + @Override + public void onServiceConnected(ComponentName name, IBinder service) { + musicService = ((MusicService.MyBinder)service).getService(); + } + + @Override + public void onServiceDisconnected(ComponentName name) { + musicService = null; + } + }; + private List>getData(){ + List>list=new ArrayList>(); + Mapmap=new HashMap(); + map.put("news_title","夏恋Ver2"); + map.put("news_info","Delos - 夏恋Ver"); + map.put("news_thumb", R.drawable.xialianver2); + map.put("url",R.raw.xialianver2); + list.add(map); + + map=new HashMap(); + map.put("news_title","Ringtone (MetroGnome Remix)"); + map.put("news_info","MetroGnome - Ringtone (MetroGnome Remix)"); + map.put("news_thumb",R.drawable.ringtone); + map.put("url",R.raw.ringtone); + list.add(map); + + map=new HashMap(); + map.put("news_title","Takeoff"); + map.put("news_info","Adam Young - The Spirit of St. Louis"); + map.put("news_thumb",R.drawable.takeoff); + map.put("url",R.raw.takeoff); + list.add(map); + + map=new HashMap(); + map.put("news_title","武侯祠"); + map.put("news_info","闫东炜、陸二胡 - 【现代民乐】天朝元素project-2016"); + map.put("news_thumb",R.drawable.wuhouci); + map.put("url",R.raw.wuhouci); + list.add(map); + + return list; + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + // Inflate the layout for this fragment + View view = inflater.inflate(R.layout.fragment_sub_fragment2,container,false); + news_list=(ListView)view.findViewById(R.id.news_list); + mData=getData(); + DbUtils.DaoConfig config = new DbUtils.DaoConfig(getActivity()); + config.setDbName("music"); + config.setDbVersion(1); + db = DbUtils.create(config); + MyAdapter adapter = new MyAdapter(getActivity(), mData,results,db); + news_list.setAdapter(adapter); + try { + db.createTableIfNotExist(musicList.class); + }catch (Exception e){} + + Intent mintent=new Intent(getActivity(),MusicService.class); + getActivity().getApplicationContext().bindService(mintent,mSerConn,Context.BIND_AUTO_CREATE); + return view; + } + + @Override + public void onResume() { + try { + List results = db.findAll(Selector.from(musicInfo.class)); + MyAdapter adapter = new MyAdapter(getActivity(), mData, results, db); + news_list.setAdapter(adapter); + }catch (DbException e){ + + } + super.onResume(); + } + public final class ViewHolder{ + public ImageView news_thumb; + public TextView news_title; + public TextView news_info; + public ImageButton news_btn; + public ImageButton like; + } + public class MyAdapter extends BaseAdapter { + private LayoutInflater mInflater; + private Context context; + private List> data; + private List results; + DbUtils db; + private Fragment fragment;//用于接收传递过来的Context对象 + public MyAdapter(Context contaxt, List> data,List results,DbUtils db ){ + this.context = contaxt; + this.data = data; + this.results=results; + this.db=db; + this.mInflater = LayoutInflater.from(context); + } + @Override + public int getCount() { + return mData.size(); + } + @Override + public Object getItem(int position) { + return position; + } + @Override + public long getItemId(int position) { + return position; + } + @Override + public View getView(final int position, View convertView, ViewGroup parent) { + SubFragment2.ViewHolder holder=null; + if(convertView==null){ + holder=new SubFragment2.ViewHolder(); + convertView=mInflater.inflate(R.layout.listview1,null); + holder.news_thumb=(ImageView)convertView.findViewById(R.id.news_thumb); + holder.news_title=(TextView)convertView.findViewById(R.id.news_title); + holder.news_info=(TextView)convertView.findViewById(R.id.news_info); + holder.news_btn=(ImageButton)convertView.findViewById(R.id.news_btn); + holder.like=(ImageButton)convertView.findViewById(R.id.like); + convertView.setTag(holder); + } + else { + holder=(SubFragment2.ViewHolder)convertView.getTag(); + } + holder.news_thumb.setBackgroundResource((Integer)mData.get(position).get("news_thumb")); + holder.news_title.setText((String)mData.get(position).get("news_title")); + holder.news_info.setText((String)mData.get(position).get("news_info")); + holder.news_btn.setTag(position); + holder.like.setTag(position); + final ImageButton storeMusic = holder.like; + final TextView sname = holder.news_title; + final TextView info = holder.news_info; + //将歌曲列表存入表musicList + String gm=sname.getText().toString(); + String gs=info.getText().toString(); + Integer songuri=(Integer)mData.get(position).get("url"); + Integer imguri=(Integer) mData.get(position).get("news_thumb"); + try { + if(db.findAll(Selector.from(musicList.class).where("songname", "=", gm)).isEmpty()) { + musicList l = new musicList(gm, gs, songuri, imguri); + db.save(l); + } + }catch (Exception e){} + + try { + List musicstored = db.findAll(Selector.from(musicInfo.class).where("songname", "=", sname.getText().toString())); + if(musicstored.isEmpty()){ + holder.like.setImageResource(R.drawable.unlike); + }else { + holder.like.setImageResource(R.drawable.like); + } + }catch (Exception e){ + + } + holder.news_btn.setOnClickListener(new View.OnClickListener(){ + @Override + public void onClick(View v) { + playMusic(position); + switchToPlayActivity((Integer) mData.get(position).get("url")); + } + }); + holder.like.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + + storeMusic.setImageResource(R.drawable.like); + Intent intent=new Intent(getActivity(),loveFragment.class); + + try{ + + String songname=sname.getText().toString(); + String singer=info.getText().toString(); + Integer uri=(Integer) mData.get(position).get("url"); + Integer imguri=(Integer) mData.get(position).get("news_thumb"); + Log.e("======",songname); + Log.e("======",singer); + if(db.findAll(Selector.from(musicInfo.class).where("songname", "=", songname)).isEmpty()){ + musicInfo m=new musicInfo(songname,singer,uri,imguri); + db.save(m); + Log.e("======",songname); + Log.e("======",singer); + Toast.makeText(getActivity(),"收藏成功!",Toast.LENGTH_SHORT).show(); + } + + }catch (Exception e){ + + } + } + }); + return convertView; + } + } + + public void playMusic(int position) { + if(musicService.musicPlayer.isPlaying()){ + musicService.musicPlayer.stop(); + } + musicService.play((Integer) mData.get(position).get("url")); + Log.e("________",mData.get(position).get("url").toString()); + } + public void switchToPlayActivity(Integer uri) { + Log.e("puturi",uri.toString()); + playingFragment fragment=new playingFragment(); + Intent intent = new Intent(); + intent.putExtra("uri", uri); + intent.setAction("updateSong"); + getActivity().sendBroadcast(intent); + + } +} diff --git a/app/src/main/java/com/example/musicPlayer/SubFragment3.java b/app/src/main/java/com/example/musicPlayer/SubFragment3.java new file mode 100644 index 0000000..2483e6b --- /dev/null +++ b/app/src/main/java/com/example/musicPlayer/SubFragment3.java @@ -0,0 +1,244 @@ +package com.example.musicPlayer; + + +import android.app.AlertDialog; +import android.content.ComponentName; +import android.content.Context; +import android.content.DialogInterface; +import android.content.Intent; +import android.content.ServiceConnection; +import android.os.Bundle; + +import androidx.fragment.app.Fragment; + +import android.os.IBinder; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.BaseAdapter; +import android.widget.ImageButton; +import android.widget.ImageView; +import android.widget.ListView; +import android.widget.TextView; +import android.widget.Toast; + +import com.example.musicPlayer.R; +import com.lidroid.xutils.DbUtils; +import com.lidroid.xutils.db.sqlite.Selector; +import com.lidroid.xutils.exception.DbException; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * A simple {@link Fragment} subclass. + */ +public class SubFragment3 extends Fragment { + private ListView news_list; + private List> mData; + private List results; + private MusicService musicService; + private int id = 0; + DbUtils db; + public SubFragment3() { + // Required empty public constructor + } + private ServiceConnection mSerConn=new ServiceConnection() { + @Override + public void onServiceConnected(ComponentName name, IBinder service) { + musicService = ((MusicService.MyBinder)service).getService(); + } + + @Override + public void onServiceDisconnected(ComponentName name) { + musicService = null; + } + }; + private List>getData(){ + List>list=new ArrayList>(); + Mapmap=new HashMap(); + map.put("news_title","白鸟朝凤"); + map.put("news_info","复州鼓乐团 - 国乐大典 第二季第九期"); + map.put("news_thumb",R.drawable.bainiaochaofeng); + map.put("url",R.raw.bainiaochaofeng); + list.add(map); + + map=new HashMap(); + map.put("news_title","敦煌"); + map.put("news_info","女子十二乐坊 - 敦煌"); + map.put("news_thumb",R.drawable.dunhuang); + map.put("url",R.raw.dunhuang); + list.add(map); + + return list; + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + // Inflate the layout for this fragment + View view = inflater.inflate(R.layout.fragment_sub_fragment3,container,false); + news_list=(ListView)view.findViewById(R.id.news_list); + mData = getData(); + DbUtils.DaoConfig config = new DbUtils.DaoConfig(getActivity()); + config.setDbName("music"); + config.setDbVersion(1); + db = DbUtils.create(config); + MyAdapter adapter = new MyAdapter(getActivity(), mData,results,db); + news_list.setAdapter(adapter); + try { + db.createTableIfNotExist(musicList.class); + }catch (Exception e){} + Intent mintent=new Intent(getActivity(),MusicService.class); + getActivity().getApplicationContext().bindService(mintent,mSerConn,Context.BIND_AUTO_CREATE); + return view; + } + @Override + public void onResume() { + try { + List results = db.findAll(Selector.from(musicInfo.class)); + MyAdapter adapter = new MyAdapter(getActivity(), mData, results, db); + news_list.setAdapter(adapter); + }catch (DbException e){ + + } + super.onResume(); + } + public final class ViewHolder{ + public ImageView news_thumb; + public TextView news_title; + public TextView news_info; + public ImageButton news_btn; + public ImageButton like; + } + public class MyAdapter extends BaseAdapter { + private LayoutInflater mInflater; + private Context context; + private List results; + private List> data; + DbUtils db; + private Fragment fragment;//用于接收传递过来的Context对象 + public MyAdapter(Context contaxt, List> data,List results,DbUtils db ){ + this.context = contaxt; + this.data = data; + this.results=results; + this.db=db; + this.mInflater = LayoutInflater.from(context); + } + @Override + public int getCount() { + return mData.size(); + } + @Override + public Object getItem(int position) { + return position; + } + @Override + public long getItemId(int position) { + return position; + } + @Override + public View getView(final int position, View convertView, ViewGroup parent) { + SubFragment3.ViewHolder holder=null; + if(convertView==null){ + holder=new SubFragment3.ViewHolder(); + convertView=mInflater.inflate(R.layout.listview1,null); + holder.news_thumb=(ImageView)convertView.findViewById(R.id.news_thumb); + holder.news_title=(TextView)convertView.findViewById(R.id.news_title); + holder.news_info=(TextView)convertView.findViewById(R.id.news_info); + holder.news_btn=(ImageButton)convertView.findViewById(R.id.news_btn); + holder.like=(ImageButton)convertView.findViewById(R.id.like); + convertView.setTag(holder); + } + else { + holder=(SubFragment3.ViewHolder)convertView.getTag(); + } + holder.news_thumb.setBackgroundResource((Integer)mData.get(position).get("news_thumb")); + holder.news_title.setText((String)mData.get(position).get("news_title")); + holder.news_info.setText((String)mData.get(position).get("news_info")); + holder.news_btn.setTag(position); + holder.like.setTag(position); + final ImageButton storeMusic = holder.like; + final TextView sname = holder.news_title; + final TextView info = holder.news_info; + + //将歌曲列表存入表musicList + String gm=sname.getText().toString(); + String gs=info.getText().toString(); + Integer songuri=(Integer)mData.get(position).get("url"); + Integer imguri=(Integer) mData.get(position).get("news_thumb"); + try { + if(db.findAll(Selector.from(musicList.class).where("songname", "=", gm)).isEmpty()) { + musicList l = new musicList(gm, gs, songuri, imguri); + db.save(l); + } + }catch (Exception e){} + + try { + List musicstored = db.findAll(Selector.from(musicInfo.class).where("songname", "=", sname.getText().toString())); + if(musicstored.isEmpty()){ + holder.like.setImageResource(R.drawable.unlike); + }else { + holder.like.setImageResource(R.drawable.like); + } + }catch (Exception e){ + + } + holder.news_btn.setOnClickListener(new View.OnClickListener(){ + @Override + public void onClick(View v) { + playMusic(position); + switchToPlayActivity((Integer) mData.get(position).get("url")); + } + }); + holder.like.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + + storeMusic.setImageResource(R.drawable.like); + Intent intent=new Intent(getActivity(),loveFragment.class); + + try{ + + String songname=sname.getText().toString(); + String singer=info.getText().toString(); + Integer uri=(Integer) mData.get(position).get("url"); + Integer imguri=(Integer) mData.get(position).get("news_thumb"); + Log.e("======",songname); + Log.e("======",singer); + if(db.findAll(Selector.from(musicInfo.class).where("songname", "=", songname)).isEmpty()){ + musicInfo m=new musicInfo(songname,singer,uri,imguri); + db.save(m); + Log.e("======",songname); + Log.e("======",singer); + Toast.makeText(getActivity(),"收藏成功!",Toast.LENGTH_SHORT).show(); + } + + }catch (Exception e){ + + } + } + }); + return convertView; + } + } + public void playMusic(int position) { + if(musicService.musicPlayer.isPlaying()){ + musicService.musicPlayer.stop(); + } + musicService.play((Integer) mData.get(position).get("url")); + Log.e("________",mData.get(position).get("url").toString()); + } + public void switchToPlayActivity(Integer uri) { + Log.e("puturi",uri.toString()); + playingFragment fragment=new playingFragment(); + Intent intent = new Intent(); + intent.putExtra("uri", uri); + intent.setAction("updateSong"); + getActivity().sendBroadcast(intent); + + } +} diff --git a/app/src/main/java/com/example/musicPlayer/SubFragment4.java b/app/src/main/java/com/example/musicPlayer/SubFragment4.java new file mode 100644 index 0000000..5f45cd0 --- /dev/null +++ b/app/src/main/java/com/example/musicPlayer/SubFragment4.java @@ -0,0 +1,251 @@ +package com.example.musicPlayer; + + +import android.app.AlertDialog; +import android.content.ComponentName; +import android.content.Context; +import android.content.DialogInterface; +import android.content.Intent; +import android.content.ServiceConnection; +import android.os.Bundle; + +import androidx.fragment.app.Fragment; + +import android.os.IBinder; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.BaseAdapter; +import android.widget.ImageButton; +import android.widget.ImageView; +import android.widget.ListView; +import android.widget.TextView; +import android.widget.Toast; + +import com.lidroid.xutils.DbUtils; +import com.lidroid.xutils.db.sqlite.Selector; +import com.lidroid.xutils.exception.DbException; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +/** + * A simple {@link Fragment} subclass. + */ +public class SubFragment4 extends Fragment { + private ListView news_list; + private List> mData; + private List results; + private MusicService musicService; + private int id = 0; + DbUtils db; + public SubFragment4() { + // Required empty public constructor + } + private ServiceConnection mSerConn=new ServiceConnection() { + @Override + public void onServiceConnected(ComponentName name, IBinder service) { + musicService = ((MusicService.MyBinder)service).getService(); + } + + @Override + public void onServiceDisconnected(ComponentName name) { + musicService = null; + } + }; + private List>getData(){ + List>list=new ArrayList>(); + Mapmap=new HashMap(); + + map=new HashMap(); + map.put("news_title","Cheers"); + map.put("news_info","MAISONdes、Tani Yuuki、菅原圭 - Cheers"); + map.put("news_thumb",R.drawable.cheers); + map.put("url",R.raw.cheers); + list.add(map); + + map=new HashMap(); + map.put("news_title","LET'S START WW3"); + map.put("news_info","World Order - WW3"); + map.put("news_thumb",R.drawable.letsstartww3); + map.put("url",R.raw.letsstartww3); + list.add(map); + + map=new HashMap(); + map.put("news_title","深夜诗人"); + map.put("news_info","洛天依、言和、liem - 2:3"); + map.put("news_thumb",R.drawable.shenyeshiren); + map.put("url",R.raw.shenyeshiren); + list.add(map); + + return list; + } + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + // Inflate the layout for this fragment + View view = inflater.inflate(R.layout.fragment_sub_fragment4,container,false); + news_list=(ListView)view.findViewById(R.id.news_list); + mData=getData(); + DbUtils.DaoConfig config = new DbUtils.DaoConfig(getActivity()); + config.setDbName("music"); + config.setDbVersion(1); + db = DbUtils.create(config); + try { + db.createTableIfNotExist(musicList.class); + }catch (Exception e){} + MyAdapter adapter = new MyAdapter(getActivity(), mData,results,db); + news_list.setAdapter(adapter); + Intent mintent=new Intent(getActivity(),MusicService.class); + getActivity().getApplicationContext().bindService(mintent,mSerConn,Context.BIND_AUTO_CREATE); + return view; + } + + @Override + public void onResume() { + try { + List results = db.findAll(Selector.from(musicInfo.class)); + MyAdapter adapter = new MyAdapter(getActivity(), mData, results, db); + news_list.setAdapter(adapter); + }catch (DbException e){ + + } + super.onResume(); + } + public final class ViewHolder{ + public ImageView news_thumb; + public TextView news_title; + public TextView news_info; + public ImageButton news_btn; + public ImageButton like; + } + public class MyAdapter extends BaseAdapter { + private LayoutInflater mInflater; + private Context context; + private List> data; + private List results; + private Fragment fragment;//用于接收传递过来的Context对象 + DbUtils db; + public MyAdapter(Context contaxt, List> data,List results,DbUtils db ){ + this.context = contaxt; + this.data = data; + this.results=results; + this.db=db; + this.mInflater = LayoutInflater.from(context); + } + @Override + public int getCount() { + return mData.size(); + } + @Override + public Object getItem(int position) { + return position; + } + @Override + public long getItemId(int position) { + return position; + } + @Override + public View getView(final int position, View convertView, ViewGroup parent) { + SubFragment4.ViewHolder holder=null; + if(convertView==null){ + holder=new SubFragment4.ViewHolder(); + convertView=mInflater.inflate(R.layout.listview1,null); + holder.news_thumb=(ImageView)convertView.findViewById(R.id.news_thumb); + holder.news_title=(TextView)convertView.findViewById(R.id.news_title); + holder.news_info=(TextView)convertView.findViewById(R.id.news_info); + holder.news_btn=(ImageButton)convertView.findViewById(R.id.news_btn); + holder.like=(ImageButton)convertView.findViewById(R.id.like); + convertView.setTag(holder); + } + else { + holder=(SubFragment4.ViewHolder)convertView.getTag(); + } + holder.news_thumb.setBackgroundResource((Integer)mData.get(position).get("news_thumb")); + holder.news_title.setText((String)mData.get(position).get("news_title")); + holder.news_info.setText((String)mData.get(position).get("news_info")); + holder.news_btn.setTag(position); + holder.like.setTag(position); + final ImageButton storeMusic = holder.like; + final TextView sname = holder.news_title; + final TextView info = holder.news_info; + //将歌曲列表存入表musicList + String gm=sname.getText().toString(); + String gs=info.getText().toString(); + Integer songuri=(Integer)mData.get(position).get("url"); + Integer imguri=(Integer) mData.get(position).get("news_thumb"); + try { + if(db.findAll(Selector.from(musicList.class).where("songname", "=", gm)).isEmpty()) { + musicList l = new musicList(gm, gs, songuri, imguri); + db.save(l); + } + }catch (Exception e){} + try { + List musicstored = db.findAll(Selector.from(musicInfo.class).where("songname", "=", sname.getText().toString())); + if(musicstored.isEmpty()){ + holder.like.setImageResource(R.drawable.unlike); + }else { + holder.like.setImageResource(R.drawable.like); + } + }catch (Exception e){ + + } + holder.news_btn.setOnClickListener(new View.OnClickListener(){ + @Override + public void onClick(View v) { + playMusic(position); + switchToPlayActivity((Integer) mData.get(position).get("url")); + } + }); + holder.like.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + + storeMusic.setImageResource(R.drawable.like); + Intent intent=new Intent(getActivity(),loveFragment.class); + + try{ + + String songname=sname.getText().toString(); + String singer=info.getText().toString(); + Integer uri=(Integer) mData.get(position).get("url"); + Integer imguri=(Integer) mData.get(position).get("news_thumb"); + Log.e("======",songname); + Log.e("======",singer); + if(db.findAll(Selector.from(musicInfo.class).where("songname", "=", songname)).isEmpty()){ + musicInfo m=new musicInfo(songname,singer,uri,imguri); + db.save(m); + Log.e("======",songname); + Log.e("======",singer); + Toast.makeText(getActivity(),"收藏成功!",Toast.LENGTH_SHORT).show(); + } + + }catch (Exception e){ + + } + } + }); + return convertView; + } + } + public void playMusic(int position) { + if(musicService.musicPlayer.isPlaying()){ + musicService.musicPlayer.stop(); + } + musicService.play((Integer) mData.get(position).get("url")); + Log.e("________",mData.get(position).get("url").toString()); + } + public void switchToPlayActivity(Integer uri) { + Log.e("puturi",uri.toString()); + playingFragment fragment=new playingFragment(); + Intent intent = new Intent(); + intent.putExtra("uri", uri); + intent.setAction("updateSong"); + getActivity().sendBroadcast(intent); + + } +} diff --git a/app/src/main/java/com/example/musicPlayer/SubFragment5.java b/app/src/main/java/com/example/musicPlayer/SubFragment5.java new file mode 100644 index 0000000..e1b41ea --- /dev/null +++ b/app/src/main/java/com/example/musicPlayer/SubFragment5.java @@ -0,0 +1,250 @@ +package com.example.musicPlayer; + + +import android.app.AlertDialog; +import android.content.ComponentName; +import android.content.Context; +import android.content.DialogInterface; +import android.content.Intent; +import android.content.ServiceConnection; +import android.os.Bundle; + +import androidx.fragment.app.Fragment; + +import android.os.IBinder; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.BaseAdapter; +import android.widget.ImageButton; +import android.widget.ImageView; +import android.widget.ListView; +import android.widget.TextView; +import android.widget.Toast; + +import com.lidroid.xutils.DbUtils; +import com.lidroid.xutils.db.sqlite.Selector; +import com.lidroid.xutils.exception.DbException; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +/** + * A simple {@link Fragment} subclass. + */ +public class SubFragment5 extends Fragment { + private ListView news_list; + private List> mData; + private List results; + private MusicService musicService; + private int id = 0; + DbUtils db; + public SubFragment5() { + // Required empty public constructor + } + private ServiceConnection mSerConn=new ServiceConnection() { + @Override + public void onServiceConnected(ComponentName name, IBinder service) { + musicService = ((MusicService.MyBinder)service).getService(); + } + + @Override + public void onServiceDisconnected(ComponentName name) { + musicService = null; + } + }; + private List>getData(){ + List>list=new ArrayList>(); + Mapmap=new HashMap(); + map.put("news_title","カッシーワのテーマ"); + map.put("news_info","岩田恭明 - ゼルダの伝説 ブレス オブ ザ ワイルド SOUND SELECTION"); + map.put("news_thumb", R.drawable.kaxiwa); + map.put("url",R.raw.kaxiwa); + list.add(map); + + map=new HashMap(); + map.put("news_title","Eastward"); + map.put("news_info","Joel Corelitz - Eastward (Original Soundtrack)"); + map.put("news_thumb",R.drawable.eastward); + map.put("url",R.raw.eastward); + list.add(map); + + map=new HashMap(); + map.put("news_title","Sealed Vessel"); + map.put("news_info","Christopher Larkin - Hollow Knight (Original Soundtrack)"); + map.put("news_thumb",R.drawable.sealedvessel); + map.put("url",R.raw.sealedvessel); + list.add(map); + return list; + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + // Inflate the layout for this fragment + View view = inflater.inflate(R.layout.fragment_sub_fragment5,container,false); + news_list=(ListView)view.findViewById(R.id.news_list); + mData=getData(); + DbUtils.DaoConfig config = new DbUtils.DaoConfig(getActivity()); + config.setDbName("music"); + config.setDbVersion(1); + db = DbUtils.create(config); + try { + db.createTableIfNotExist(musicList.class); + }catch (Exception e){} + MyAdapter adapter = new MyAdapter(getActivity(), mData,results,db); news_list.setAdapter(adapter); + Intent mintent=new Intent(getActivity(),MusicService.class); + getActivity().getApplicationContext().bindService(mintent,mSerConn,Context.BIND_AUTO_CREATE); + return view; + } + + @Override + public void onResume() { + try { + List results = db.findAll(Selector.from(musicInfo.class)); + MyAdapter adapter = new MyAdapter(getActivity(), mData, results, db); + news_list.setAdapter(adapter); + }catch (DbException e){ + + } + super.onResume(); + } + public final class ViewHolder{ + public ImageView news_thumb; + public TextView news_title; + public TextView news_info; + public ImageButton news_btn; + public ImageButton like; + } + public class MyAdapter extends BaseAdapter { + private LayoutInflater mInflater; + private Context context; + private List> data; + private List results; + DbUtils db; + private Fragment fragment;//用于接收传递过来的Context对象 + public MyAdapter(Context contaxt, List> data,List results,DbUtils db ) { + this.context=contaxt; + this.data=data; + this.results=results; + this.db=db; + this.mInflater=LayoutInflater.from(context); + } + @Override + public int getCount() { + return mData.size(); + } + @Override + public Object getItem(int position) { + return position; + } + @Override + public long getItemId(int position) { + return position; + } + @Override + public View getView(final int position, View convertView, ViewGroup parent) { + SubFragment5.ViewHolder holder=null; + if(convertView==null){ + holder=new SubFragment5.ViewHolder(); + convertView=mInflater.inflate(R.layout.listview1,null); + holder.news_thumb=(ImageView)convertView.findViewById(R.id.news_thumb); + holder.news_title=(TextView)convertView.findViewById(R.id.news_title); + holder.news_info=(TextView)convertView.findViewById(R.id.news_info); + holder.news_btn=(ImageButton)convertView.findViewById(R.id.news_btn); + holder.like=(ImageButton)convertView.findViewById(R.id.like); + convertView.setTag(holder); + } + else { + holder=(SubFragment5.ViewHolder)convertView.getTag(); + } + holder.news_thumb.setBackgroundResource((Integer)mData.get(position).get("news_thumb")); + holder.news_title.setText((String)mData.get(position).get("news_title")); + holder.news_info.setText((String)mData.get(position).get("news_info")); + holder.news_btn.setTag(position); + holder.like.setTag(position); + final ImageButton storeMusic = holder.like; + final TextView sname = holder.news_title; + final TextView info = holder.news_info; + + //将歌曲列表存入表musicList + String gm=sname.getText().toString(); + String gs=info.getText().toString(); + Integer songuri=(Integer)mData.get(position).get("url"); + Integer imguri=(Integer) mData.get(position).get("news_thumb"); + try { + if(db.findAll(Selector.from(musicList.class).where("songname", "=", gm)).isEmpty()) { + musicList l = new musicList(gm, gs, songuri, imguri); + db.save(l); + } + }catch (Exception e){} + + try { + List musicstored = db.findAll(Selector.from(musicInfo.class).where("songname", "=", sname.getText().toString())); + if(musicstored.isEmpty()){ + holder.like.setImageResource(R.drawable.unlike); + }else { + holder.like.setImageResource(R.drawable.like); + } + }catch (Exception e){ + + } + holder.news_btn.setOnClickListener(new View.OnClickListener(){ + @Override + public void onClick(View v) { + playMusic(position); + switchToPlayActivity((Integer) mData.get(position).get("url")); + } + }); + holder.like.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + + storeMusic.setImageResource(R.drawable.like); + Intent intent=new Intent(getActivity(),loveFragment.class); + + try{ + + String songname=sname.getText().toString(); + String singer=info.getText().toString(); + Integer uri=(Integer) mData.get(position).get("url"); + Integer imguri=(Integer) mData.get(position).get("news_thumb"); + Log.e("======",songname); + Log.e("======",singer); + if(db.findAll(Selector.from(musicInfo.class).where("songname", "=", songname)).isEmpty()){ + musicInfo m=new musicInfo(songname,singer,uri,imguri); + db.save(m); + Log.e("======",songname); + Log.e("======",singer); + Toast.makeText(getActivity(),"收藏成功!",Toast.LENGTH_SHORT).show(); + } + + }catch (Exception e){ + + } + } + }); + return convertView; + } + } + public void playMusic(int position) { + if(musicService.musicPlayer.isPlaying()){ + musicService.musicPlayer.stop(); + } + musicService.play((Integer) mData.get(position).get("url")); + Log.e("________",mData.get(position).get("url").toString()); + } + public void switchToPlayActivity(Integer uri) { + Log.e("puturi",uri.toString()); + playingFragment fragment=new playingFragment(); + Intent intent = new Intent(); + intent.putExtra("uri", uri); + intent.setAction("updateSong"); + getActivity().sendBroadcast(intent); + + } +} diff --git a/app/src/main/java/com/example/musicPlayer/findFragment.java b/app/src/main/java/com/example/musicPlayer/findFragment.java new file mode 100644 index 0000000..b56a7ce --- /dev/null +++ b/app/src/main/java/com/example/musicPlayer/findFragment.java @@ -0,0 +1,148 @@ +package com.example.musicPlayer; + + +import android.app.AlertDialog; +import android.content.Context; +import android.content.DialogInterface; +import android.graphics.Color; +import android.os.Bundle; + +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentManager; +import androidx.fragment.app.FragmentStatePagerAdapter; +import androidx.viewpager.widget.ViewPager; + +import android.provider.CalendarContract; +import android.util.DisplayMetrics; +import android.util.TypedValue; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.BaseAdapter; +import android.widget.ImageButton; +import android.widget.ImageView; +import android.widget.ListView; +import android.widget.TextView; + + +import com.astuetz.PagerSlidingTabStrip; +import com.lidroid.xutils.DbUtils; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +/** + * A simple {@link Fragment} subclass. + */ +public class findFragment extends Fragment { + //private ListView news_list; + //private List> mData; + private SubFragment1 subFragment1; + private SubFragment2 subFragment2; + private SubFragment3 subFragment3; + private SubFragment4 subFragment4; + private SubFragment5 subFragment5; + private PagerSlidingTabStrip tabs; + private DisplayMetrics dm; //获取当前屏幕的密度 + DbUtils db; + public findFragment() { + // Required empty public constructor + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + //创建界面Fragment + View view = inflater.inflate(R.layout.find,container,false); + initView(view); + + DbUtils.DaoConfig config=new DbUtils.DaoConfig(getActivity()); + config.setDbName("music"); + config.setDbVersion(1); + db=DbUtils.create(config); + + return view; + } + private void initView(View view) { + dm = getResources().getDisplayMetrics(); + ViewPager pager = (ViewPager) view.findViewById(R.id.pager); + tabs = (PagerSlidingTabStrip) view.findViewById(R.id.tabs); + pager.setAdapter(new MyPagerAdapter(getChildFragmentManager())); + tabs.setViewPager(pager); + setTabsValue(); + } + + private void setTabsValue() { + // 设置Tab是自动填充满屏幕的 + tabs.setShouldExpand(true); + // 设置Tab的分割线是透明的 + tabs.setDividerColor(Color.TRANSPARENT); + // tabs.setDividerColor(Color.BLACK); + // 设置Tab底部线的高度 + tabs.setUnderlineHeight((int) TypedValue.applyDimension( + TypedValue.COMPLEX_UNIT_DIP, 1, dm)); + // 设置Tab Indicator的高度 + tabs.setIndicatorHeight((int) TypedValue.applyDimension( + TypedValue.COMPLEX_UNIT_DIP, 4, dm));// 4 + // 设置Tab标题文字的大小 + tabs.setTextSize((int) TypedValue.applyDimension( + TypedValue.COMPLEX_UNIT_SP, 16, dm)); // 16 + // 设置Tab Indicator的颜色 + tabs.setIndicatorColor(Color.parseColor("#be8dbd")); + // 设置选中Tab文字的颜色 (这是自定义的一个方法) + //tabs.setSelectedTextColor(Color.parseColor("#45c01a"));// #45c01a + // 取消单击Tab时的背景色 + tabs.setTabBackground(0); + } + public class MyPagerAdapter extends FragmentStatePagerAdapter { + public MyPagerAdapter(FragmentManager fm) { + super(fm); + // TODO Auto-generated constructor stub + } + private final String[] titles = { "红色", "电子", "民乐", "流行", "游戏原声" }; + @Override + public CharSequence getPageTitle(int position) { + return titles[position]; + } + @Override + public int getCount() { + return titles.length; + } + @Override + public Fragment getItem(int position) { + switch (position) { + case 0: + if (null == subFragment1) { + subFragment1 = new SubFragment1(); + } + return subFragment1; + case 1: + if (null == subFragment2) { + subFragment2 = new SubFragment2(); + } + return subFragment2; + case 2: + if (null == subFragment3) { + subFragment3 = new SubFragment3(); + } + return subFragment3; + case 3: + if (null == subFragment4) { + subFragment4 = new SubFragment4(); + } + return subFragment4; + case 4: + if (null == subFragment5) { + subFragment5 = new SubFragment5(); + } + subFragment1 = new SubFragment1(); + return subFragment5; + default: + return null; + } + } + } +} diff --git a/app/src/main/java/com/example/musicPlayer/login.java b/app/src/main/java/com/example/musicPlayer/login.java new file mode 100644 index 0000000..4245d4f --- /dev/null +++ b/app/src/main/java/com/example/musicPlayer/login.java @@ -0,0 +1,163 @@ +package com.example.musicPlayer; + +import androidx.appcompat.app.AlertDialog; +import androidx.appcompat.app.AppCompatActivity; +import androidx.core.app.NotificationCompat; + +import android.app.Notification; +import android.app.NotificationManager; +import android.app.PendingIntent; +import android.content.Context; +import android.content.DialogInterface; +import android.content.Intent; +import android.content.SharedPreferences; +import android.os.Bundle; +import android.text.TextUtils; +import android.view.View; +import android.widget.CheckBox; +import android.widget.EditText; +import android.widget.ImageButton; +import android.widget.Toast; + +public class login extends AppCompatActivity { + private EditText ed_username; + private EditText ed_password; + private ImageButton btn_zhuCe,btn_dengLu; + private String userName,password;//获取EditText中输入的用户名和密码 + private String spPassword;//spPassword 为 根据从SharedPreferences中用户名读取密码 + private CheckBox cb_remember; + + private Context mContext; + private NotificationManager mManager; + private NotificationCompat.Builder mbuilder; + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_login); + init(); + } + + private void init(){ + final AlertDialog.Builder builder=new AlertDialog.Builder(this); + ed_username=(EditText)findViewById(R.id.ed_username1); + ed_password=(EditText)findViewById(R.id.ed_password1) ; + btn_zhuCe=(ImageButton)findViewById(R.id.btn_zhuCe1); + btn_dengLu=(ImageButton)findViewById(R.id.btn_dengLu); + cb_remember=(CheckBox)findViewById(R.id.cb_remember); + mManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); + mContext=login.this; + + btn_zhuCe.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) {//跳转到注册页面 + Intent intent1=new Intent(login.this,zuceActivity.class); + finish(); + startActivity(intent1); + } + }); + + //登录按钮 + btn_dengLu.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + userName=ed_username.getText().toString().trim(); + password=ed_password.getText().toString().trim(); + spPassword=readPassword(userName);//根据从SharedPreferences中用户名读取密码 + if(TextUtils.isEmpty(userName)){//用户名为空 + builder.setTitle("消息提示").setMessage("请输入用户名").setPositiveButton("确定",new DialogInterface.OnClickListener(){ + @Override + public void onClick(DialogInterface dialog,int which){ + + } + }).show(); + }else if (TextUtils.isEmpty(password)){//密码为空 + builder.setTitle("消息提示").setMessage("请输入密码").setPositiveButton("确定",new DialogInterface.OnClickListener(){ + @Override + public void onClick(DialogInterface dialog,int which){ + + } + }).show(); + }else if(password.equals(spPassword)){//注册时的密码与登录的密码一样 + Intent intent = new Intent(mContext,MainActivity.class); + PendingIntent pendingIntent = PendingIntent.getActivity(mContext, 0, intent, 0); //设置图片,通知标题,发送时间,提示方式等属性 + mbuilder =new NotificationCompat.Builder(mContext); + mbuilder.setContentTitle("通知") //标题 + .setContentIntent(pendingIntent).setContentText("您正在登录账号"+userName) //内容 + .setTicker("收到来自音乐播放器的的消息~").setWhen(System.currentTimeMillis()).setDefaults(Notification.DEFAULT_LIGHTS | Notification.DEFAULT_VIBRATE) + .setSmallIcon(R.mipmap.musicnote).setDefaults(Notification.DEFAULT_SOUND).setAutoCancel(true); //设置点击后取消Notification + mManager.notify(1,mbuilder.build()); + + builder.setTitle("消息提示").setMessage("登录成功,欢迎您").setPositiveButton("确定",new DialogInterface.OnClickListener(){ + @Override + public void onClick(DialogInterface dialog,int which){ + saveLoginStatus(true,userName); + finish(); + startActivity(new Intent(login.this, MainActivity.class)); + } + }).show(); + }else if((spPassword!=null&&!TextUtils.isEmpty(spPassword)&&!password.equals(spPassword))){ + builder.setTitle("消息提示").setMessage("输入的用户名和密码不一致").setPositiveButton("确定",new DialogInterface.OnClickListener(){ + @Override + public void onClick(DialogInterface dialog,int which){ + + } + }).show(); + }else { + builder.setTitle("消息提示").setMessage("此用户名不存在").setPositiveButton("确定",new DialogInterface.OnClickListener(){ + @Override + public void onClick(DialogInterface dialog,int which){ + + } + }).show(); + } + } + }); + } + + private String readPassword(String userName){ + SharedPreferences sp=getSharedPreferences("loginInfo", MODE_PRIVATE); + return sp.getString(userName , null); + } + + + private void saveLoginStatus(boolean status,String userName){ + SharedPreferences sp=getSharedPreferences("loginInfo",MODE_PRIVATE); + SharedPreferences.Editor editor=sp.edit(); + editor.putBoolean("isLogin",status);//存入账号的登录状态 + editor.putString("loginUserName",userName);//存入登录状态时的用户名 + editor.commit(); + } + + public void rememberMe(String userName,String password){ + SharedPreferences sp=getSharedPreferences("loginInfo",MODE_PRIVATE); + SharedPreferences.Editor editor=sp.edit(); + editor.putString("password",password);//存入账号的登录状态 + editor.putString("username",userName);//存入登录状态时的用户名 + editor.commit(); + } + + @Override + protected void onStop(){ + super.onStop(); + if(cb_remember.isChecked()) { + this.rememberMe(ed_username.getText().toString(),ed_password.getText().toString()); + } + } + + public void checkIfRemember() { + SharedPreferences sp = getSharedPreferences("loginInfo", MODE_PRIVATE); + String username = sp.getString("username", null); + String password = sp.getString("password", null); + if (username != null && password != null) { + ed_username.setText(username); + ed_password.setText(password); + cb_remember.setChecked(true); + } + } + @Override + public void onStart(){ + super.onStart(); + checkIfRemember(); + } + } + diff --git a/app/src/main/java/com/example/musicPlayer/loveFragment.java b/app/src/main/java/com/example/musicPlayer/loveFragment.java new file mode 100644 index 0000000..1ccf84a --- /dev/null +++ b/app/src/main/java/com/example/musicPlayer/loveFragment.java @@ -0,0 +1,181 @@ +package com.example.musicPlayer; + + +import android.app.AlertDialog; +import android.content.ComponentName; +import android.content.Context; +import android.content.DialogInterface; +import android.content.Intent; +import android.content.ServiceConnection; +import android.database.Cursor; +import android.os.Bundle; + +import androidx.fragment.app.Fragment; + +import android.os.IBinder; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.BaseAdapter; +import android.widget.ImageButton; +import android.widget.ImageView; +import android.widget.ListView; +import android.widget.TextView; +import android.widget.Toast; + +import com.example.musicPlayer.R; +import com.lidroid.xutils.DbUtils; +import com.lidroid.xutils.db.sqlite.Selector; +import com.lidroid.xutils.exception.DbException; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +/** + * A simple {@link Fragment} subclass. + */ +public class loveFragment extends Fragment { + private ListView news_list; + private MusicService musicService; + public loveFragment() { + // Required empty public constructor + } + private ServiceConnection mSerConn=new ServiceConnection() { + @Override + public void onServiceConnected(ComponentName name, IBinder service) { + musicService = ((MusicService.MyBinder)service).getService(); + } + + @Override + public void onServiceDisconnected(ComponentName name) { + musicService = null; + } + }; + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + + View view = inflater.inflate(R.layout.love,container,false); + news_list=(ListView)view.findViewById(R.id.news_list); + Intent mintent=new Intent(getActivity(),MusicService.class); + getActivity().getApplicationContext().bindService(mintent,mSerConn,Context.BIND_AUTO_CREATE); + //数据库 + DbUtils.DaoConfig config=new DbUtils.DaoConfig(getActivity()); + config.setDbName("music"); + config.setDbVersion(1); + DbUtils db=DbUtils.create(config); + try { + db.createTableIfNotExist(musicInfo.class); + List results=db.findAll(Selector.from(musicInfo.class)); + MyAdapter adapter=new MyAdapter(getActivity(),results,db); + news_list.setAdapter(adapter); + }catch (DbException e){ + e.printStackTrace(); + } + return view; + } + + public final class ViewHolder{ + public TextView songname; + public TextView singer; + public ImageButton news_btn; + public ImageButton like; + } + + public class MyAdapter extends BaseAdapter{ + private LayoutInflater mInflater; + private Context context; + private List results; + private Fragment fragment;//用于接收传递过来的Context对象 + DbUtils db; + public MyAdapter(Context context,List results,DbUtils db) { + this.context=context; + this.results=results; + this.db=db; + mInflater=LayoutInflater.from(context); + } + @Override + public int getCount() { + return results.size(); + } + @Override + public Object getItem(int position) { + return results.get(position); + } + @Override + public long getItemId(int position) { + return position; + } + @Override + public View getView(final int position, View convertView, ViewGroup parent) { + ViewHolder holder=null; + if(convertView==null){ + holder=new ViewHolder(); + convertView=mInflater.inflate(R.layout.listview_love,null); + holder.songname=(TextView) convertView.findViewById(R.id.songname); + holder.singer=(TextView)convertView.findViewById(R.id.singer); + holder.news_btn=(ImageButton)convertView.findViewById(R.id.news_btn); + holder.like=(ImageButton)convertView.findViewById(R.id.like); + convertView.setTag(holder); + } + else { + holder=(ViewHolder)convertView.getTag(); + } + holder.songname.setText(results.get(position).getSongname()); + holder.singer.setText(results.get(position).getSinger()); + //播放、删除收藏功能 + holder.news_btn.setTag(position); + holder.like.setTag(position); + final ImageButton storeMusic = holder.like; + final int id=results.get(position).getId(); + holder.like.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + storeMusic.setImageResource(R.drawable.unlike); + try { + db.deleteById(musicInfo.class,id); + List results=db.findAll(Selector.from(musicInfo.class)); + MyAdapter adapter=new MyAdapter(getActivity(),results,db); + news_list.setAdapter(adapter); + }catch (DbException e) + { + + } + Toast.makeText(getContext(),"取消收藏!",Toast.LENGTH_SHORT).show(); + } + }); + + holder.news_btn.setOnClickListener(new View.OnClickListener(){ + @Override + public void onClick(View v) { + playMusic(position); + switchToPlayActivity((Integer) results.get(position).getSonguri()); + } + }); + + return convertView; + } + public void playMusic(int position) { + if(musicService.musicPlayer.isPlaying()){ + musicService.musicPlayer.stop(); + } + Integer uri=results.get(position).getSonguri(); + musicService.play(uri); + Log.d("________",uri.toString()); + } + public void switchToPlayActivity(Integer uri) { + Log.e("puturi",uri.toString()); + playingFragment fragment=new playingFragment(); + Intent intent = new Intent(); + intent.putExtra("uri", uri); + intent.setAction("updateSong"); + getActivity().sendBroadcast(intent); + + } + } + +} diff --git a/app/src/main/java/com/example/musicPlayer/musicInfo.java b/app/src/main/java/com/example/musicPlayer/musicInfo.java new file mode 100644 index 0000000..d65c066 --- /dev/null +++ b/app/src/main/java/com/example/musicPlayer/musicInfo.java @@ -0,0 +1,71 @@ +package com.example.musicPlayer; + +import android.media.Image; + +import com.lidroid.xutils.db.annotation.Column; +import com.lidroid.xutils.db.annotation.Id; +import com.lidroid.xutils.db.annotation.Table; + +@Table(name = "musicInfo") +public class musicInfo { + @Id + @Column(column = "id") + public int id; + @Column(column = "songname") + public String songname; + @Column(column = "singer") + public String singer; + @Column(column = "songuri") + public int songuri; + @Column(column = "imguri") + public int imguri; + public musicInfo(){ + + } + public musicInfo(String songname,String singer,int songuri,int imguri){ + this.songname=songname; + this.singer=singer; + this.songuri=songuri; + this.imguri=imguri; + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getSongname() { + return songname; + } + + public void setSongname(String songname) { + this.songname = songname; + } + + public String getSinger() { + return singer; + } + + public void setSinger(String singer) { + this.singer = singer; + } + + public int getSonguri() { + return songuri; + } + + public void setSonguri(int songuri) { + this.songuri = songuri; + } + + public int getImguri() { + return imguri; + } + + public void setImguri(int imguri) { + this.imguri = imguri; + } +} diff --git a/app/src/main/java/com/example/musicPlayer/musicList.java b/app/src/main/java/com/example/musicPlayer/musicList.java new file mode 100644 index 0000000..28c48da --- /dev/null +++ b/app/src/main/java/com/example/musicPlayer/musicList.java @@ -0,0 +1,68 @@ +package com.example.musicPlayer; + +import com.lidroid.xutils.db.annotation.Column; +import com.lidroid.xutils.db.annotation.Id; +import com.lidroid.xutils.db.annotation.Table; + +@Table(name="musicList") +public class musicList { + @Id + @Column(column = "id") + public int id; + @Column(column = "songname") + public String songname; + @Column(column = "singer") + public String singer; + @Column(column = "songuri") + public int songuri; + @Column(column = "imguri") + public int imguri; + public musicList(){ + + } + public musicList(String songname,String singer,int songuri,int imguri){ + this.songname=songname; + this.singer=singer; + this.songuri=songuri; + this.imguri=imguri; + } + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getSongname() { + return songname; + } + + public void setSongname(String songname) { + this.songname = songname; + } + + public String getSinger() { + return singer; + } + + public void setSinger(String singer) { + this.singer = singer; + } + + public int getSonguri() { + return songuri; + } + + public void setSonguri(int songuri) { + this.songuri = songuri; + } + + public int getImguri() { + return imguri; + } + + public void setImguri(int imguri) { + this.imguri = imguri; + } +} diff --git a/app/src/main/java/com/example/musicPlayer/playingFragment.java b/app/src/main/java/com/example/musicPlayer/playingFragment.java new file mode 100644 index 0000000..923a533 --- /dev/null +++ b/app/src/main/java/com/example/musicPlayer/playingFragment.java @@ -0,0 +1,262 @@ +package com.example.musicPlayer; + + +import android.content.BroadcastReceiver; +import android.content.ComponentName; +import android.content.Context; +import android.content.Intent; +import android.content.IntentFilter; +import android.content.ServiceConnection; +import android.os.Bundle; + +import androidx.annotation.Nullable; +import androidx.fragment.app.Fragment; + +import android.os.IBinder; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.view.animation.Animation; +import android.view.animation.AnimationUtils; +import android.view.animation.LinearInterpolator; +import android.widget.Button; +import android.widget.ImageButton; +import android.widget.ImageView; +import android.widget.SeekBar; +import android.widget.TextView; +import android.widget.Toast; + +import com.example.musicPlayer.R; +import com.lidroid.xutils.DbUtils; +import com.lidroid.xutils.db.sqlite.Selector; +import com.lidroid.xutils.view.annotation.event.OnClick; + +import java.io.IOException; +import java.util.List; + + +/** + * A simple {@link Fragment} subclass. + */ +public class playingFragment extends Fragment { + private MusicService musicService; + DbUtils db; + private boolean isplaying; + private SeekBar mSeekBar; + private ImageButton playingPre,playingNext,playingPlay; + private TextView songtitle,singerinfo,stime,etime; + private de.hdodenhof.circleimageview.CircleImageView disc; + private IntentFilter intentFilter; + private int currentsongid,currentsonguri; + public playingFragment() { + // Required empty public constructor + } + private ServiceConnection mSerConn=new ServiceConnection() { + @Override + public void onServiceConnected(ComponentName name, IBinder service) { + musicService = ((MusicService.MyBinder)service).getService(); + } + + @Override + public void onServiceDisconnected(ComponentName name) { + musicService = null; + } + }; + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + // Inflate the layout for this fragment + View view = inflater.inflate(R.layout.playing,container,false); + + Intent intent=new Intent(getActivity(),MusicService.class); + getActivity().getApplicationContext().bindService(intent,mSerConn,Context.BIND_AUTO_CREATE); + + intentFilter = new IntentFilter(); + intentFilter.addAction("updateSong"); + intentFilter.addAction("action.updateplayedtime"); + getContext().registerReceiver(updateReceiver, intentFilter); + + + mSeekBar=view.findViewById(R.id.seekBar); + mSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { + @Override + public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { + + } + + @Override + public void onStartTrackingTouch(SeekBar seekBar) { + + } + + @Override + public void onStopTrackingTouch(SeekBar seekBar) { + int progress = seekBar.getProgress(); + Log.i("TAG:", "" + progress + ""); + int musicMax = musicService.musicPlayer.getDuration(); //得到该首歌曲最长秒数 + int seekBarMax = seekBar.getMax(); + musicService.musicPlayer.seekTo(musicMax * progress / seekBarMax);//跳到该曲该秒 + } + }); + playingPre = view.findViewById(R.id.premusic); + playingPlay = view.findViewById(R.id.bf); + playingNext = view.findViewById(R.id.nextmusic); + songtitle=view.findViewById(R.id.songName); + singerinfo=view.findViewById(R.id.singer); + disc = view.findViewById(R.id.songImg); + stime=view.findViewById(R.id.stime); + etime=view.findViewById(R.id.etime); + stime.setText("00:00"); + + //数据库保存歌曲列表 + DbUtils.DaoConfig config = new DbUtils.DaoConfig(getActivity()); + config.setDbName("music"); + config.setDbVersion(1); + db = DbUtils.create(config); + setEvent(); + return view; + } + @Override + public void onDestroyView() { + super.onDestroyView(); + getContext().unregisterReceiver(updateReceiver); + } + + public void playmusic(final Integer songuri) { + try { + + final List musicplayed = db.findAll(Selector.from(musicList.class).where("songuri", "=", songuri)); + //SubFragment点击播放传参,设置 + currentsonguri=songuri; + Integer songimg = musicplayed.get(0).getImguri(); + currentsongid=musicplayed.get(0).getId(); + Log.e("imguri", songimg.toString()); + isplaying=true; + playingPlay.setImageResource(R.drawable.zt); + disc.setImageResource(songimg); + songtitle.setText(musicplayed.get(0).getSongname()); + singerinfo.setText(musicplayed.get(0).getSinger()); + etime.setText(formatDuration(musicService.musicPlayer.getDuration())); + + setanim(); + + musicService.refreshSeekBar(); + }catch (Exception e){} + } + + public void setEvent(){ + //设置按钮单击事件 + try { + final List musicList=db.findAll(Selector.from(musicList.class)); + //设置动画 + setanim(); + playingPlay.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + musicService.refreshSeekBar(); + if(musicService.musicPlayer.isPlaying()){ + musicService.pause(); + playingPlay.setImageResource(R.drawable.bf); + disc.clearAnimation(); + //isplaying=false; + }else { + playingPlay.setImageResource(R.drawable.zt); + musicService.goPlay(); + setanim(); + //isplaying=true; + } + } + }); + playingPre.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + mSeekBar.setProgress(0); + try{ + if(musicService.musicPlayer.isPlaying()){ + musicService.musicPlayer.stop(); + } + if(currentsongid==0){ + currentsongid=musicList.size()-1; + }else { + currentsongid--; + } + setInfo(currentsongid); + playingPlay.setImageResource(R.drawable.zt); + isplaying=true; + }catch (Exception e){} + } + }); + playingNext.setOnClickListener(new View.OnClickListener() { + + @Override + public void onClick(View v) { + mSeekBar.setProgress(0); + try{ + if(musicService.musicPlayer.isPlaying()){ + musicService.musicPlayer.stop(); + } + if(currentsongid==musicList.size()-1){ + currentsongid=0; + }else { + currentsongid++; + } + setInfo(currentsongid); + playingPlay.setImageResource(R.drawable.zt); + isplaying=true; + }catch (Exception e){} + } + }); + }catch (Exception e){} + } + public void setInfo(int id){//设置图片歌名信息 + try { + List musicplayed = db.findAll(Selector.from(musicList.class).where("id", "=", id)); + Integer songimg = musicplayed.get(0).getImguri(); + currentsonguri=musicplayed.get(0).getSonguri(); + Log.e("imguri", songimg.toString()); + disc.setImageResource(songimg); + songtitle.setText(musicplayed.get(0).getSongname()); + singerinfo.setText(musicplayed.get(0).getSinger()); + musicService.play(currentsonguri); + etime.setText(formatDuration(musicService.musicPlayer.getDuration())); + setanim(); + musicService.refreshSeekBar(); + }catch (Exception e){} + } + public void setanim(){//动画旋转 + Animation operatingAnim = AnimationUtils.loadAnimation(getContext(), R.anim.animation); + LinearInterpolator lin = new LinearInterpolator();//LinearInterpolator为匀速效果 + operatingAnim.setInterpolator(lin);//setInterpolator表示设置旋转速率。 + disc.startAnimation(operatingAnim);//开始旋转 + } + //将毫秒形式的音乐时长信息转化为00:00形式 + public static String formatDuration(long dur) { + long totalSecond = dur / 1000; + String minute = totalSecond / 60 + ""; + if (minute.length() < 2) minute = "0" + minute ; + String second = totalSecond % 60 + ""; + if (second.length() < 2) second = "0" + second; + return minute + ":" + second; + } + private BroadcastReceiver updateReceiver = new BroadcastReceiver() { + @Override + public void onReceive(Context context, Intent intent) { + if(intentFilter.hasAction("updateSong")) { + Integer uri = intent.getIntExtra("uri", 0); + playmusic(uri); + } + if(intentFilter.hasAction("action.updateplayedtime")) { + long newtime = (long)intent.getIntExtra("playedTime", 0); + stime.setText(formatDuration(newtime)); + int durationMusic = musicService.musicPlayer.getDuration(); + long progress = newtime*100/durationMusic; + mSeekBar.setProgress((int)progress); + } + } + }; + + +} + diff --git a/app/src/main/java/com/example/musicPlayer/zuceActivity.java b/app/src/main/java/com/example/musicPlayer/zuceActivity.java new file mode 100644 index 0000000..e2cae41 --- /dev/null +++ b/app/src/main/java/com/example/musicPlayer/zuceActivity.java @@ -0,0 +1,139 @@ +package com.example.musicPlayer; + +import android.content.DialogInterface; +import android.content.Intent; +import android.content.SharedPreferences; +import android.os.Bundle; +import android.text.TextUtils; +import android.view.View; +import android.widget.CheckBox; +import android.widget.EditText; +import android.widget.ImageButton; + +import androidx.appcompat.app.AlertDialog; +import androidx.appcompat.app.AppCompatActivity; + +public class zuceActivity extends AppCompatActivity { + private EditText ed_username; + private EditText ed_password; + private EditText ed_password_again; + private ImageButton btn_zhuCe1; + private ImageButton btn_back; + private CheckBox cb_protocol; + private String userName;//保存用户名 + private String passord;//保存密码 + private String password_again;//保存确认密码 + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_zuce); + init(); + } + + + private void init() { + final AlertDialog.Builder builder = new AlertDialog.Builder(this); + ed_username = findViewById(R.id.ed_username1); + ed_password = findViewById(R.id.ed_password1); + ed_password_again = findViewById(R.id.ed_password_again); + btn_zhuCe1 = findViewById(R.id.btn_zhuCe1); + btn_back = findViewById(R.id.btn_back);//返回按钮 + cb_protocol=findViewById(R.id.cb_protocol); + btn_back.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + //返回按钮 + Intent intent2 = new Intent(zuceActivity.this, login.class); + finish(); + startActivity(intent2); + } + }); + + btn_zhuCe1.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) {//注册按钮 + //获取输入在相应控件中的字符串 + getEditString(); + //判断输入框内容 + if (TextUtils.isEmpty(userName)) { + builder.setTitle("消息提示").setMessage("请输入用户名").setPositiveButton("确定", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + + } + }).show(); + } else if (TextUtils.isEmpty(passord)) { + builder.setTitle("消息提示").setMessage("请输入密码").setPositiveButton("确定", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + + } + }).show(); + } else if (TextUtils.isEmpty(password_again)) { + builder.setTitle("消息提示").setMessage("请输入再次输入密码").setPositiveButton("确定", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + + } + }).show(); + } else if (!passord.equals(password_again)) { + builder.setTitle("消息提示").setMessage("两次输入的密码不一样,请重新输入").setPositiveButton("确定", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + + } + }).show(); + } else if (isExistUserName(userName)) {//从SharedPreferences中读取输入的用户名,判断SharedPreferences中是否有此用户名 + builder.setTitle("消息提示").setMessage("此账户名已经存在").setPositiveButton("确定", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + + } + }).show(); + } else { + if(cb_protocol.isChecked()){ + builder.setTitle("消息提示").setMessage("注册成功").setPositiveButton("确定", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) {//保存账号和密码到SharedPreferences中 + savaLoginInfo(userName, passord); + Intent intent1 = new Intent(zuceActivity.this, login.class); + finish(); + startActivity(intent1); + } + }).show();}else{ + builder.setTitle("消息提示").setMessage("请同意软件用户协议").setPositiveButton("确定", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + + } + }).show(); + } + } + } + }); + } + + private void getEditString() { + userName = ed_username.getText().toString().trim();//trim()作用为去除字符串头尾空格 + passord = ed_password.getText().toString().trim(); + password_again = ed_password_again.getText().toString().trim(); + } + + private boolean isExistUserName(String userName) { + boolean has_userName = false; + SharedPreferences sp = getSharedPreferences("loginInfo", MODE_PRIVATE); + String spPassword = sp.getString(userName, null); + if (!TextUtils.isEmpty(spPassword)) { + has_userName = true; + } + return has_userName; + } + + private void savaLoginInfo(String userName, String passord) { + SharedPreferences sp = getSharedPreferences("loginInfo", MODE_PRIVATE);//文件名:loginInfo + SharedPreferences.Editor editor = sp.edit(); + editor.putString(userName, passord); + editor.commit(); + } +} diff --git a/app/src/main/res/anim/animation.xml b/app/src/main/res/anim/animation.xml new file mode 100644 index 0000000..f989d6e --- /dev/null +++ b/app/src/main/res/anim/animation.xml @@ -0,0 +1,12 @@ + + + + diff --git a/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 0000000..1f6bb29 --- /dev/null +++ b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + diff --git a/app/src/main/res/drawable/audio.png b/app/src/main/res/drawable/audio.png new file mode 100644 index 0000000..ee6cfed Binary files /dev/null and b/app/src/main/res/drawable/audio.png differ diff --git a/app/src/main/res/drawable/background4.jpg b/app/src/main/res/drawable/background4.jpg new file mode 100644 index 0000000..20680b2 Binary files /dev/null and b/app/src/main/res/drawable/background4.jpg differ diff --git a/app/src/main/res/drawable/background5.jpg b/app/src/main/res/drawable/background5.jpg new file mode 100644 index 0000000..e80b2be Binary files /dev/null and b/app/src/main/res/drawable/background5.jpg differ diff --git a/app/src/main/res/drawable/bainiaochaofeng.jpg b/app/src/main/res/drawable/bainiaochaofeng.jpg new file mode 100644 index 0000000..a43971b Binary files /dev/null and b/app/src/main/res/drawable/bainiaochaofeng.jpg differ diff --git a/app/src/main/res/drawable/bf.png b/app/src/main/res/drawable/bf.png new file mode 100644 index 0000000..77c5570 Binary files /dev/null and b/app/src/main/res/drawable/bf.png differ diff --git a/app/src/main/res/drawable/bg.xml b/app/src/main/res/drawable/bg.xml new file mode 100644 index 0000000..17d42b2 --- /dev/null +++ b/app/src/main/res/drawable/bg.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/cheers.jpg b/app/src/main/res/drawable/cheers.jpg new file mode 100644 index 0000000..07d4fe4 Binary files /dev/null and b/app/src/main/res/drawable/cheers.jpg differ diff --git a/app/src/main/res/drawable/close.png b/app/src/main/res/drawable/close.png new file mode 100644 index 0000000..61324c3 Binary files /dev/null and b/app/src/main/res/drawable/close.png differ diff --git a/app/src/main/res/drawable/denglu.png b/app/src/main/res/drawable/denglu.png new file mode 100644 index 0000000..01a5722 Binary files /dev/null and b/app/src/main/res/drawable/denglu.png differ diff --git a/app/src/main/res/drawable/dieinternationale.jpg b/app/src/main/res/drawable/dieinternationale.jpg new file mode 100644 index 0000000..ee341aa Binary files /dev/null and b/app/src/main/res/drawable/dieinternationale.jpg differ diff --git a/app/src/main/res/drawable/dunhuang.jpg b/app/src/main/res/drawable/dunhuang.jpg new file mode 100644 index 0000000..a7084fd Binary files /dev/null and b/app/src/main/res/drawable/dunhuang.jpg differ diff --git a/app/src/main/res/drawable/eastward.jpg b/app/src/main/res/drawable/eastward.jpg new file mode 100644 index 0000000..4f61c49 Binary files /dev/null and b/app/src/main/res/drawable/eastward.jpg differ diff --git a/app/src/main/res/drawable/fanhui.png b/app/src/main/res/drawable/fanhui.png new file mode 100644 index 0000000..9d1b231 Binary files /dev/null and b/app/src/main/res/drawable/fanhui.png differ diff --git a/app/src/main/res/drawable/findoff.png b/app/src/main/res/drawable/findoff.png new file mode 100644 index 0000000..0ea4b53 Binary files /dev/null and b/app/src/main/res/drawable/findoff.png differ diff --git a/app/src/main/res/drawable/findon.png b/app/src/main/res/drawable/findon.png new file mode 100644 index 0000000..03d1144 Binary files /dev/null and b/app/src/main/res/drawable/findon.png differ diff --git a/app/src/main/res/drawable/fx.png b/app/src/main/res/drawable/fx.png new file mode 100644 index 0000000..2aba288 Binary files /dev/null and b/app/src/main/res/drawable/fx.png differ diff --git a/app/src/main/res/drawable/fx1.png b/app/src/main/res/drawable/fx1.png new file mode 100644 index 0000000..3601f9a Binary files /dev/null and b/app/src/main/res/drawable/fx1.png differ diff --git a/app/src/main/res/drawable/gechangdongdangdeqingchun.png b/app/src/main/res/drawable/gechangdongdangdeqingchun.png new file mode 100644 index 0000000..a391d5d Binary files /dev/null and b/app/src/main/res/drawable/gechangdongdangdeqingchun.png differ diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..0d025f9 --- /dev/null +++ b/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/icon192.jpg b/app/src/main/res/drawable/icon192.jpg new file mode 100644 index 0000000..4398c82 Binary files /dev/null and b/app/src/main/res/drawable/icon192.jpg differ diff --git a/app/src/main/res/drawable/icon255.jpg b/app/src/main/res/drawable/icon255.jpg new file mode 100644 index 0000000..3e6626b Binary files /dev/null and b/app/src/main/res/drawable/icon255.jpg differ diff --git a/app/src/main/res/drawable/iconback255.png b/app/src/main/res/drawable/iconback255.png new file mode 100644 index 0000000..304cbd8 Binary files /dev/null and b/app/src/main/res/drawable/iconback255.png differ diff --git a/app/src/main/res/drawable/iconfore255.png b/app/src/main/res/drawable/iconfore255.png new file mode 100644 index 0000000..eac2e79 Binary files /dev/null and b/app/src/main/res/drawable/iconfore255.png differ diff --git a/app/src/main/res/drawable/into.png b/app/src/main/res/drawable/into.png new file mode 100644 index 0000000..cc183c5 Binary files /dev/null and b/app/src/main/res/drawable/into.png differ diff --git a/app/src/main/res/drawable/kaxiwa.jpg b/app/src/main/res/drawable/kaxiwa.jpg new file mode 100644 index 0000000..7d3514b Binary files /dev/null and b/app/src/main/res/drawable/kaxiwa.jpg differ diff --git a/app/src/main/res/drawable/leave.png b/app/src/main/res/drawable/leave.png new file mode 100644 index 0000000..89d8fc7 Binary files /dev/null and b/app/src/main/res/drawable/leave.png differ diff --git a/app/src/main/res/drawable/letsstartww3.jpg b/app/src/main/res/drawable/letsstartww3.jpg new file mode 100644 index 0000000..bf41bca Binary files /dev/null and b/app/src/main/res/drawable/letsstartww3.jpg differ diff --git a/app/src/main/res/drawable/like.png b/app/src/main/res/drawable/like.png new file mode 100644 index 0000000..c41950d Binary files /dev/null and b/app/src/main/res/drawable/like.png differ diff --git a/app/src/main/res/drawable/login.png b/app/src/main/res/drawable/login.png new file mode 100644 index 0000000..03954c6 Binary files /dev/null and b/app/src/main/res/drawable/login.png differ diff --git a/app/src/main/res/drawable/login1.png b/app/src/main/res/drawable/login1.png new file mode 100644 index 0000000..658ef37 Binary files /dev/null and b/app/src/main/res/drawable/login1.png differ diff --git a/app/src/main/res/drawable/login_user.png b/app/src/main/res/drawable/login_user.png new file mode 100644 index 0000000..4954095 Binary files /dev/null and b/app/src/main/res/drawable/login_user.png differ diff --git a/app/src/main/res/drawable/loginbackground.png b/app/src/main/res/drawable/loginbackground.png new file mode 100644 index 0000000..6d1d833 Binary files /dev/null and b/app/src/main/res/drawable/loginbackground.png differ diff --git a/app/src/main/res/drawable/mappinknight.png b/app/src/main/res/drawable/mappinknight.png new file mode 100644 index 0000000..3bb0e9f Binary files /dev/null and b/app/src/main/res/drawable/mappinknight.png differ diff --git a/app/src/main/res/drawable/menubackground.png b/app/src/main/res/drawable/menubackground.png new file mode 100644 index 0000000..9845f60 Binary files /dev/null and b/app/src/main/res/drawable/menubackground.png differ diff --git a/app/src/main/res/drawable/music.png b/app/src/main/res/drawable/music.png new file mode 100644 index 0000000..944067c Binary files /dev/null and b/app/src/main/res/drawable/music.png differ diff --git a/app/src/main/res/drawable/mygedan.png b/app/src/main/res/drawable/mygedan.png new file mode 100644 index 0000000..81b1a15 Binary files /dev/null and b/app/src/main/res/drawable/mygedan.png differ diff --git a/app/src/main/res/drawable/mygedan1.png b/app/src/main/res/drawable/mygedan1.png new file mode 100644 index 0000000..cf34456 Binary files /dev/null and b/app/src/main/res/drawable/mygedan1.png differ diff --git a/app/src/main/res/drawable/next.png b/app/src/main/res/drawable/next.png new file mode 100644 index 0000000..eeb6ea2 Binary files /dev/null and b/app/src/main/res/drawable/next.png differ diff --git a/app/src/main/res/drawable/pause.png b/app/src/main/res/drawable/pause.png new file mode 100644 index 0000000..ecd45a0 Binary files /dev/null and b/app/src/main/res/drawable/pause.png differ diff --git a/app/src/main/res/drawable/play_page_default_cover.png b/app/src/main/res/drawable/play_page_default_cover.png new file mode 100644 index 0000000..d448637 Binary files /dev/null and b/app/src/main/res/drawable/play_page_default_cover.png differ diff --git a/app/src/main/res/drawable/play_page_disc.png b/app/src/main/res/drawable/play_page_disc.png new file mode 100644 index 0000000..0a678bc Binary files /dev/null and b/app/src/main/res/drawable/play_page_disc.png differ diff --git a/app/src/main/res/drawable/playing.png b/app/src/main/res/drawable/playing.png new file mode 100644 index 0000000..33587f2 Binary files /dev/null and b/app/src/main/res/drawable/playing.png differ diff --git a/app/src/main/res/drawable/pre.png b/app/src/main/res/drawable/pre.png new file mode 100644 index 0000000..290b522 Binary files /dev/null and b/app/src/main/res/drawable/pre.png differ diff --git a/app/src/main/res/drawable/qiandao.png b/app/src/main/res/drawable/qiandao.png new file mode 100644 index 0000000..fd8c0b1 Binary files /dev/null and b/app/src/main/res/drawable/qiandao.png differ diff --git a/app/src/main/res/drawable/qidong.png b/app/src/main/res/drawable/qidong.png new file mode 100644 index 0000000..b449bba Binary files /dev/null and b/app/src/main/res/drawable/qidong.png differ diff --git a/app/src/main/res/drawable/quit.png b/app/src/main/res/drawable/quit.png new file mode 100644 index 0000000..ce5bafe Binary files /dev/null and b/app/src/main/res/drawable/quit.png differ diff --git a/app/src/main/res/drawable/registerbackground.png b/app/src/main/res/drawable/registerbackground.png new file mode 100644 index 0000000..c3799c1 Binary files /dev/null and b/app/src/main/res/drawable/registerbackground.png differ diff --git a/app/src/main/res/drawable/ringtone.jpg b/app/src/main/res/drawable/ringtone.jpg new file mode 100644 index 0000000..5b91142 Binary files /dev/null and b/app/src/main/res/drawable/ringtone.jpg differ diff --git a/app/src/main/res/drawable/sealedvessel.jpg b/app/src/main/res/drawable/sealedvessel.jpg new file mode 100644 index 0000000..f9f3aaa Binary files /dev/null and b/app/src/main/res/drawable/sealedvessel.jpg differ diff --git a/app/src/main/res/drawable/shenyeshiren.jpg b/app/src/main/res/drawable/shenyeshiren.jpg new file mode 100644 index 0000000..0014429 Binary files /dev/null and b/app/src/main/res/drawable/shenyeshiren.jpg differ diff --git a/app/src/main/res/drawable/signin.png b/app/src/main/res/drawable/signin.png new file mode 100644 index 0000000..3511bae Binary files /dev/null and b/app/src/main/res/drawable/signin.png differ diff --git a/app/src/main/res/drawable/start.jpg b/app/src/main/res/drawable/start.jpg new file mode 100644 index 0000000..67d9e6c Binary files /dev/null and b/app/src/main/res/drawable/start.jpg differ diff --git a/app/src/main/res/drawable/takeoff.jpg b/app/src/main/res/drawable/takeoff.jpg new file mode 100644 index 0000000..8746104 Binary files /dev/null and b/app/src/main/res/drawable/takeoff.jpg differ diff --git a/app/src/main/res/drawable/tianyaozhonghua.jpg b/app/src/main/res/drawable/tianyaozhonghua.jpg new file mode 100644 index 0000000..f0a6f65 Binary files /dev/null and b/app/src/main/res/drawable/tianyaozhonghua.jpg differ diff --git a/app/src/main/res/drawable/tuichu.png b/app/src/main/res/drawable/tuichu.png new file mode 100644 index 0000000..fbd887b Binary files /dev/null and b/app/src/main/res/drawable/tuichu.png differ diff --git a/app/src/main/res/drawable/unlike.png b/app/src/main/res/drawable/unlike.png new file mode 100644 index 0000000..d7d873b Binary files /dev/null and b/app/src/main/res/drawable/unlike.png differ diff --git a/app/src/main/res/drawable/wodezhanyingraozhebaodaofei.jpg b/app/src/main/res/drawable/wodezhanyingraozhebaodaofei.jpg new file mode 100644 index 0000000..35e3aa8 Binary files /dev/null and b/app/src/main/res/drawable/wodezhanyingraozhebaodaofei.jpg differ diff --git a/app/src/main/res/drawable/wuhouci.jpg b/app/src/main/res/drawable/wuhouci.jpg new file mode 100644 index 0000000..0eabb80 Binary files /dev/null and b/app/src/main/res/drawable/wuhouci.jpg differ diff --git a/app/src/main/res/drawable/xialianver2.jpg b/app/src/main/res/drawable/xialianver2.jpg new file mode 100644 index 0000000..b1e1a11 Binary files /dev/null and b/app/src/main/res/drawable/xialianver2.jpg differ diff --git a/app/src/main/res/drawable/yinfu.png b/app/src/main/res/drawable/yinfu.png new file mode 100644 index 0000000..5a3c9ff Binary files /dev/null and b/app/src/main/res/drawable/yinfu.png differ diff --git a/app/src/main/res/drawable/yonghu.png b/app/src/main/res/drawable/yonghu.png new file mode 100644 index 0000000..fc1d7e1 Binary files /dev/null and b/app/src/main/res/drawable/yonghu.png differ diff --git a/app/src/main/res/drawable/zaixiwangdetianyeshang.jpg b/app/src/main/res/drawable/zaixiwangdetianyeshang.jpg new file mode 100644 index 0000000..569930a Binary files /dev/null and b/app/src/main/res/drawable/zaixiwangdetianyeshang.jpg differ diff --git a/app/src/main/res/drawable/zhuce.png b/app/src/main/res/drawable/zhuce.png new file mode 100644 index 0000000..afa206e Binary files /dev/null and b/app/src/main/res/drawable/zhuce.png differ diff --git a/app/src/main/res/drawable/zhuxiaodenglu.png b/app/src/main/res/drawable/zhuxiaodenglu.png new file mode 100644 index 0000000..620ef1c Binary files /dev/null and b/app/src/main/res/drawable/zhuxiaodenglu.png differ diff --git a/app/src/main/res/drawable/zt.png b/app/src/main/res/drawable/zt.png new file mode 100644 index 0000000..3d11621 Binary files /dev/null and b/app/src/main/res/drawable/zt.png differ diff --git a/app/src/main/res/layout/abc.xml b/app/src/main/res/layout/abc.xml new file mode 100644 index 0000000..4f10b51 --- /dev/null +++ b/app/src/main/res/layout/abc.xml @@ -0,0 +1,25 @@ + + + + + + + + diff --git a/app/src/main/res/layout/activity_login.xml b/app/src/main/res/layout/activity_login.xml new file mode 100644 index 0000000..edfcd2e --- /dev/null +++ b/app/src/main/res/layout/activity_login.xml @@ -0,0 +1,153 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..deb62e6 --- /dev/null +++ b/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,20 @@ + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_splash_screen.xml b/app/src/main/res/layout/activity_splash_screen.xml new file mode 100644 index 0000000..690a9d4 --- /dev/null +++ b/app/src/main/res/layout/activity_splash_screen.xml @@ -0,0 +1,10 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_zuce.xml b/app/src/main/res/layout/activity_zuce.xml new file mode 100644 index 0000000..5e8c219 --- /dev/null +++ b/app/src/main/res/layout/activity_zuce.xml @@ -0,0 +1,185 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/bottom.xml b/app/src/main/res/layout/bottom.xml new file mode 100644 index 0000000..59144a5 --- /dev/null +++ b/app/src/main/res/layout/bottom.xml @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/find.xml b/app/src/main/res/layout/find.xml new file mode 100644 index 0000000..3ce5f31 --- /dev/null +++ b/app/src/main/res/layout/find.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_sub_fragment1.xml b/app/src/main/res/layout/fragment_sub_fragment1.xml new file mode 100644 index 0000000..3bd77b7 --- /dev/null +++ b/app/src/main/res/layout/fragment_sub_fragment1.xml @@ -0,0 +1,16 @@ + + + + + + + diff --git a/app/src/main/res/layout/fragment_sub_fragment2.xml b/app/src/main/res/layout/fragment_sub_fragment2.xml new file mode 100644 index 0000000..e791e79 --- /dev/null +++ b/app/src/main/res/layout/fragment_sub_fragment2.xml @@ -0,0 +1,15 @@ + + + + + + + diff --git a/app/src/main/res/layout/fragment_sub_fragment3.xml b/app/src/main/res/layout/fragment_sub_fragment3.xml new file mode 100644 index 0000000..30f49a7 --- /dev/null +++ b/app/src/main/res/layout/fragment_sub_fragment3.xml @@ -0,0 +1,15 @@ + + + + + + + diff --git a/app/src/main/res/layout/fragment_sub_fragment4.xml b/app/src/main/res/layout/fragment_sub_fragment4.xml new file mode 100644 index 0000000..f73edf8 --- /dev/null +++ b/app/src/main/res/layout/fragment_sub_fragment4.xml @@ -0,0 +1,15 @@ + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_sub_fragment5.xml b/app/src/main/res/layout/fragment_sub_fragment5.xml new file mode 100644 index 0000000..f20f33c --- /dev/null +++ b/app/src/main/res/layout/fragment_sub_fragment5.xml @@ -0,0 +1,15 @@ + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/listview1.xml b/app/src/main/res/layout/listview1.xml new file mode 100644 index 0000000..9209b44 --- /dev/null +++ b/app/src/main/res/layout/listview1.xml @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/listview_love.xml b/app/src/main/res/layout/listview_love.xml new file mode 100644 index 0000000..a5398fc --- /dev/null +++ b/app/src/main/res/layout/listview_love.xml @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/love.xml b/app/src/main/res/layout/love.xml new file mode 100644 index 0000000..0e7284e --- /dev/null +++ b/app/src/main/res/layout/love.xml @@ -0,0 +1,18 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/nav_header_music.xml b/app/src/main/res/layout/nav_header_music.xml new file mode 100644 index 0000000..8db5c16 --- /dev/null +++ b/app/src/main/res/layout/nav_header_music.xml @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/playing.xml b/app/src/main/res/layout/playing.xml new file mode 100644 index 0000000..a6f5fad --- /dev/null +++ b/app/src/main/res/layout/playing.xml @@ -0,0 +1,194 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/menu/activity_music2_drawer.xml b/app/src/main/res/menu/activity_music2_drawer.xml new file mode 100644 index 0000000..81b253b --- /dev/null +++ b/app/src/main/res/menu/activity_music2_drawer.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 0000000..4ae7d12 --- /dev/null +++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 0000000..4ae7d12 --- /dev/null +++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000..c2b64ce Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_background.png b/app/src/main/res/mipmap-hdpi/ic_launcher_background.png new file mode 100644 index 0000000..69c36ed Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher_background.png differ diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png b/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png new file mode 100644 index 0000000..cbc8c5c Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png differ diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/app/src/main/res/mipmap-hdpi/ic_launcher_round.png new file mode 100644 index 0000000..9244862 Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-hdpi/musicnote.png b/app/src/main/res/mipmap-hdpi/musicnote.png new file mode 100644 index 0000000..0bf13c7 Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/musicnote.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000..cfaae8d Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_background.png b/app/src/main/res/mipmap-mdpi/ic_launcher_background.png new file mode 100644 index 0000000..5b60ab8 Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher_background.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png b/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png new file mode 100644 index 0000000..31b90dd Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/app/src/main/res/mipmap-mdpi/ic_launcher_round.png new file mode 100644 index 0000000..4d9b369 Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000..d490c9e Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_background.png b/app/src/main/res/mipmap-xhdpi/ic_launcher_background.png new file mode 100644 index 0000000..73f849b Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher_background.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png b/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png new file mode 100644 index 0000000..a3f3d7b Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png new file mode 100644 index 0000000..38e4a8a Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..3d33143 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_background.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher_background.png new file mode 100644 index 0000000..e89606c Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher_background.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png new file mode 100644 index 0000000..2aa435f Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png new file mode 100644 index 0000000..77796e4 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000..99a2b77 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_background.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_background.png new file mode 100644 index 0000000..b44504d Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_background.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png new file mode 100644 index 0000000..89b7db9 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png new file mode 100644 index 0000000..f6c8520 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/raw/bainiaochaofeng.mp3 b/app/src/main/res/raw/bainiaochaofeng.mp3 new file mode 100644 index 0000000..9682541 Binary files /dev/null and b/app/src/main/res/raw/bainiaochaofeng.mp3 differ diff --git a/app/src/main/res/raw/cheers.mp3 b/app/src/main/res/raw/cheers.mp3 new file mode 100644 index 0000000..0d74e06 Binary files /dev/null and b/app/src/main/res/raw/cheers.mp3 differ diff --git a/app/src/main/res/raw/dieinternationale.mp3 b/app/src/main/res/raw/dieinternationale.mp3 new file mode 100644 index 0000000..728a992 Binary files /dev/null and b/app/src/main/res/raw/dieinternationale.mp3 differ diff --git a/app/src/main/res/raw/dunhuang.mp3 b/app/src/main/res/raw/dunhuang.mp3 new file mode 100644 index 0000000..3c1f92b Binary files /dev/null and b/app/src/main/res/raw/dunhuang.mp3 differ diff --git a/app/src/main/res/raw/eastward.mp3 b/app/src/main/res/raw/eastward.mp3 new file mode 100644 index 0000000..02e2dfb Binary files /dev/null and b/app/src/main/res/raw/eastward.mp3 differ diff --git a/app/src/main/res/raw/gechangdongdangdeqingchun.mp3 b/app/src/main/res/raw/gechangdongdangdeqingchun.mp3 new file mode 100644 index 0000000..7416b4f Binary files /dev/null and b/app/src/main/res/raw/gechangdongdangdeqingchun.mp3 differ diff --git a/app/src/main/res/raw/kaxiwa.mp3 b/app/src/main/res/raw/kaxiwa.mp3 new file mode 100644 index 0000000..2eab3cd Binary files /dev/null and b/app/src/main/res/raw/kaxiwa.mp3 differ diff --git a/app/src/main/res/raw/letsstartww3.mp3 b/app/src/main/res/raw/letsstartww3.mp3 new file mode 100644 index 0000000..ee167a7 Binary files /dev/null and b/app/src/main/res/raw/letsstartww3.mp3 differ diff --git a/app/src/main/res/raw/ringtone.mp3 b/app/src/main/res/raw/ringtone.mp3 new file mode 100644 index 0000000..02a7388 Binary files /dev/null and b/app/src/main/res/raw/ringtone.mp3 differ diff --git a/app/src/main/res/raw/sealedvessel.mp3 b/app/src/main/res/raw/sealedvessel.mp3 new file mode 100644 index 0000000..1a82667 Binary files /dev/null and b/app/src/main/res/raw/sealedvessel.mp3 differ diff --git a/app/src/main/res/raw/shenyeshiren.mp3 b/app/src/main/res/raw/shenyeshiren.mp3 new file mode 100644 index 0000000..d24990b Binary files /dev/null and b/app/src/main/res/raw/shenyeshiren.mp3 differ diff --git a/app/src/main/res/raw/takeoff.mp3 b/app/src/main/res/raw/takeoff.mp3 new file mode 100644 index 0000000..8533fcc Binary files /dev/null and b/app/src/main/res/raw/takeoff.mp3 differ diff --git a/app/src/main/res/raw/tianyaozhonghua.mp3 b/app/src/main/res/raw/tianyaozhonghua.mp3 new file mode 100644 index 0000000..24dca1b Binary files /dev/null and b/app/src/main/res/raw/tianyaozhonghua.mp3 differ diff --git a/app/src/main/res/raw/wodezhanyingraozhebaodaofei.mp3 b/app/src/main/res/raw/wodezhanyingraozhebaodaofei.mp3 new file mode 100644 index 0000000..a7c4edd Binary files /dev/null and b/app/src/main/res/raw/wodezhanyingraozhebaodaofei.mp3 differ diff --git a/app/src/main/res/raw/wuhouci.mp3 b/app/src/main/res/raw/wuhouci.mp3 new file mode 100644 index 0000000..ab5679a Binary files /dev/null and b/app/src/main/res/raw/wuhouci.mp3 differ diff --git a/app/src/main/res/raw/xialianver2.mp3 b/app/src/main/res/raw/xialianver2.mp3 new file mode 100644 index 0000000..4b5af01 Binary files /dev/null and b/app/src/main/res/raw/xialianver2.mp3 differ diff --git a/app/src/main/res/raw/zaixiwangdetianyeshang.mp3 b/app/src/main/res/raw/zaixiwangdetianyeshang.mp3 new file mode 100644 index 0000000..7f12a36 Binary files /dev/null and b/app/src/main/res/raw/zaixiwangdetianyeshang.mp3 differ diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml new file mode 100644 index 0000000..674b608 --- /dev/null +++ b/app/src/main/res/values/colors.xml @@ -0,0 +1,11 @@ + + + #008577 + #00008b + #D81B60 + #FFFFFF + #FFFFE0 + #FFD700 + #FF0000 + + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml new file mode 100644 index 0000000..f12e33a --- /dev/null +++ b/app/src/main/res/values/strings.xml @@ -0,0 +1,21 @@ + + musicPlayer + + + Hello blank fragment + 我已阅读并同意软件用户协议 + + + + + + + + + + + + + + + diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml new file mode 100644 index 0000000..0eb88fe --- /dev/null +++ b/app/src/main/res/values/styles.xml @@ -0,0 +1,11 @@ + + + + + + diff --git a/app/src/test/java/com/example/myapplication10/ExampleUnitTest.java b/app/src/test/java/com/example/myapplication10/ExampleUnitTest.java new file mode 100644 index 0000000..13c7985 --- /dev/null +++ b/app/src/test/java/com/example/myapplication10/ExampleUnitTest.java @@ -0,0 +1,17 @@ +package com.example.myapplication10; + +import org.junit.Test; + +import static org.junit.Assert.*; + +/** + * Example local unit test, which will execute on the development machine (host). + * + * @see Testing documentation + */ +public class ExampleUnitTest { + @Test + public void addition_isCorrect() { + assertEquals(4, 2 + 2); + } +} \ No newline at end of file diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..02199bb --- /dev/null +++ b/build.gradle @@ -0,0 +1,27 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. + +buildscript { + repositories { + google() + jcenter() + + } + dependencies { + classpath 'com.android.tools.build:gradle:3.4.1' + + // NOTE: Do not place your application dependencies here; they belong + // in the individual module build.gradle files + } +} + +allprojects { + repositories { + google() + jcenter() + + } +} + +task clean(type: Delete) { + delete rootProject.buildDir +} diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..199d16e --- /dev/null +++ b/gradle.properties @@ -0,0 +1,20 @@ +# Project-wide Gradle settings. +# IDE (e.g. Android Studio) users: +# Gradle settings configured through the IDE *will override* +# any settings specified in this file. +# For more details on how to configure your build environment visit +# http://www.gradle.org/docs/current/userguide/build_environment.html +# Specifies the JVM arguments used for the daemon process. +# The setting is particularly useful for tweaking memory settings. +org.gradle.jvmargs=-Xmx1536m +# When configured, Gradle will run in incubating parallel mode. +# This option should only be used with decoupled projects. More details, visit +# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects +# org.gradle.parallel=true +# AndroidX package structure to make it clearer which packages are bundled with the +# Android operating system, and which are packaged with your app's APK +# https://developer.android.com/topic/libraries/support-library/androidx-rn +android.useAndroidX=true +# Automatically convert third-party libraries to use AndroidX +android.enableJetifier=true + diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..f6b961f Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..42bd305 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Fri Dec 13 16:01:14 CST 2019 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip diff --git a/gradlew b/gradlew new file mode 100644 index 0000000..cccdd3d --- /dev/null +++ b/gradlew @@ -0,0 +1,172 @@ +#!/usr/bin/env sh + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 0000000..f955316 --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,84 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000..e7b4def --- /dev/null +++ b/settings.gradle @@ -0,0 +1 @@ +include ':app'