package xiyangyang.co.cc;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.HashMap;
import java.util.Timer;
import java.util.TimerTask;
import android.app.Activity;
import android.app.AlertDialog.Builder;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.graphics.Typeface;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.media.SoundPool;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.SubMenu;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.ScrollView;
import android.widget.TextView;
import cn.mapplayer.engine.IAuxiliaryNotifier;
import cn.mapplayer.engine.IOffersNotifier;
import cn.mapplayer.engine.MiidiCredit;
public class XiyangyangActivity extends Activity implements IOffersNotifier,
IAuxiliaryNotifier {
SoundPool mSoundPool;
HashMap<Integer, Integer> soundHashMap = new HashMap<Integer, Integer>();
MediaPlayer mediaPlayer;
ScrollView scrollview;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
MiidiCredit.init(XiyangyangActivity.this, "4934", "2y04padlxi6isehb",
false);
setContentView(R.layout.main);
mediaPlayer = MediaPlayer.create(XiyangyangActivity.this, R.raw.back);
mediaPlayer.start();
scrollview = (ScrollView) findViewById(R.id.scrollview);
final TextView mTextView111 = (TextView) findViewById(R.id.textView11);
final TextView mTextView0 = (TextView) findViewById(R.id.t1);
final TextView mTextView1 = (TextView) findViewById(R.id.t2);
final TextView mTextView2 = (TextView) findViewById(R.id.t3);
final TextView mTextView3 = (TextView) findViewById(R.id.t4);
final TextView mTextView4 = (TextView) findViewById(R.id.t5);
final TextView mTextView5 = (TextView) findViewById(R.id.t6);
final TextView mTextView6 = (TextView) findViewById(R.id.t7);
final TextView mTextView7 = (TextView) findViewById(R.id.t8);
final TextView mTextView8 = (TextView) findViewById(R.id.t9);
final TextView mTextView9 = (TextView) findViewById(R.id.t10);
final TextView mTextView10 = (TextView) findViewById(R.id.t11);
final TextView mTextView11 = (TextView) findViewById(R.id.t12);
final TextView mTextView12 = (TextView) findViewById(R.id.t13);
final TextView mTextView13 = (TextView) findViewById(R.id.t14);
final TextView mTextView14 = (TextView) findViewById(R.id.t15);
final TextView mTextView15 = (TextView) findViewById(R.id.t16);
final TextView mTextView16 = (TextView) findViewById(R.id.t17);
final TextView mTextView17 = (TextView) findViewById(R.id.t18);
final TextView mTextView18 = (TextView) findViewById(R.id.t19);
final TextView mTextView19 = (TextView) findViewById(R.id.t20);
final TextView mTextView20 = (TextView) findViewById(R.id.t21);
final TextView mTextView21 = (TextView) findViewById(R.id.t22);
final TextView mTextView22 = (TextView) findViewById(R.id.t23);
final TextView mTextView23 = (TextView) findViewById(R.id.t24);
final TextView mTextView24 = (TextView) findViewById(R.id.t25);
final ImageView mImageViewr2 = (ImageView) findViewById(R.id.r2);
mImageViewr2.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
MiidiCredit.showAppOffers();
}
});
Typeface typeFace = Typeface.createFromAsset(getAssets(),
"fonts/mini.ttf");
mTextView0.setTypeface(typeFace);
mTextView1.setTypeface(typeFace);
mTextView2.setTypeface(typeFace);
mTextView3.setTypeface(typeFace);
mTextView4.setTypeface(typeFace);
mTextView5.setTypeface(typeFace);
mTextView6.setTypeface(typeFace);
mTextView7.setTypeface(typeFace);
mTextView8.setTypeface(typeFace);
mTextView9.setTypeface(typeFace);
mTextView10.setTypeface(typeFace);
mTextView11.setTypeface(typeFace);
mTextView12.setTypeface(typeFace);
mTextView13.setTypeface(typeFace);
mTextView14.setTypeface(typeFace);
mTextView15.setTypeface(typeFace);
mTextView16.setTypeface(typeFace);
mTextView17.setTypeface(typeFace);
mTextView18.setTypeface(typeFace);
mTextView19.setTypeface(typeFace);
mTextView20.setTypeface(typeFace);
mTextView21.setTypeface(typeFace);
mTextView22.setTypeface(typeFace);
mTextView23.setTypeface(typeFace);
mTextView24.setTypeface(typeFace);
mSoundPool = new SoundPool(50, AudioManager.STREAM_SYSTEM, 5);
soundHashMap.put(1, mSoundPool.load(this, R.raw.a1, 1));
soundHashMap.put(2, mSoundPool.load(this, R.raw.a2, 1));
soundHashMap.put(3, mSoundPool.load(this, R.raw.a3, 1));
soundHashMap.put(4, mSoundPool.load(this, R.raw.a4, 1));
soundHashMap.put(5, mSoundPool.load(this, R.raw.a5, 1));
soundHashMap.put(6, mSoundPool.load(this, R.raw.a6, 1));
soundHashMap.put(7, mSoundPool.load(this, R.raw.a7, 1));
soundHashMap.put(8, mSoundPool.load(this, R.raw.a8, 1));
soundHashMap.put(9, mSoundPool.load(this, R.raw.a9, 1));
soundHashMap.put(10, mSoundPool.load(this, R.raw.a10, 1));
soundHashMap.put(11, mSoundPool.load(this, R.raw.a11, 1));
soundHashMap.put(12, mSoundPool.load(this, R.raw.a12, 1));
soundHashMap.put(13, mSoundPool.load(this, R.raw.a13, 1));
soundHashMap.put(14, mSoundPool.load(this, R.raw.a14, 1));
soundHashMap.put(15, mSoundPool.load(this, R.raw.a15, 1));
soundHashMap.put(16, mSoundPool.load(this, R.raw.a16, 1));
soundHashMap.put(17, mSoundPool.load(this, R.raw.a17, 1));
soundHashMap.put(18, mSoundPool.load(this, R.raw.a18, 1));
soundHashMap.put(19, mSoundPool.load(this, R.raw.a19, 1));
soundHashMap.put(20, mSoundPool.load(this, R.raw.a20, 1));
soundHashMap.put(21, mSoundPool.load(this, R.raw.a21, 1));
soundHashMap.put(22, mSoundPool.load(this, R.raw.b1, 1));
soundHashMap.put(23, mSoundPool.load(this, R.raw.b2, 1));
soundHashMap.put(24, mSoundPool.load(this, R.raw.b3, 1));
soundHashMap.put(25, mSoundPool.load(this, R.raw.b4, 1));
soundHashMap.put(26, mSoundPool.load(this, R.raw.b5, 1));
soundHashMap.put(27, mSoundPool.load(this, R.raw.b6, 1));
soundHashMap.put(28, mSoundPool.load(this, R.raw.b7, 1));
soundHashMap.put(29, mSoundPool.load(this, R.raw.b8, 1));
soundHashMap.put(30, mSoundPool.load(this, R.raw.b9, 1));
soundHashMap.put(31, mSoundPool.load(this, R.raw.b10, 1));
String s1 = "2012-6-8 12:00:00";
SimpleDateFormat sDateFormat = new SimpleDateFormat(
"yyyy-MM-dd hh:mm:ss");
String date = sDateFormat.format(new java.util.Date());
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Calendar c1 = Calendar.getInstance();
Calendar str = Calendar.getInstance();
try {
c1.setTime(df.parse(s1));
str.setTime(df.parse(date));
} catch (Exception e) {
// TODO: handle exception
}
int result = c1.compareTo(str);
// if (result == 0)
// System.out.println("当前时间等于系统时间");
if (result < 0) {
System.out.println("当前时间小于系统时间");
mImageViewr2.setVisibility(View.VISIBLE);
mTextView111.setVisibility(View.VISIBLE);
} else {
System.out.println("当前时间大于系统时间");
mImageViewr2.setVisibility(View.INVISIBLE);
mTextView111.setVisibility(View.INVISIBLE);
}
}
// public void onClick(View v) {
// // TODO Auto-generated method stub
// switch (v.getId()) {
// case R.id.a1:
// mSoundPool.play(soundHashMap.get(1), 1, 1, 0, 0, 1);
//
// break;
// case R.id.a2:
// mSoundPool.play(soundHashMap.get(2), 1, 1, 0, 0, 1);
//
// break;
// case R.id.a3:
// mSoundPool.play(soundHashMap.get(3), 1, 1, 0, 0, 1);
//
// break;
//
// default:
// break;
// }
public void aa1(View v) {
mSoundPool.play(soundHashMap.get(1), 1, 1, 0, 0, 1);
}
public void aa2(View view) {
mSoundPool.play(soundHashMap.get(2), 1, 1, 0, 0, 1);
}
public void aa3(View view) {
mSoundPool.play(soundHashMap.get(3), 1, 1, 0, 0, 1);
}
public void aa4(View view) {
mSoundPool.play(soundHashMap.get(4), 1, 1, 0, 0, 1);
}
public void aa5(View view) {
mSoundPool.play(soundHashMap.get(5), 1, 1, 0, 0, 1);
}
public void aa6(View view) {
mSoundPool.play(soundHashMap.get(6), 1, 1, 0, 0, 1);
}
public void aa7(View view) {
mSoundPool.play(soundHashMap.get(7), 1, 1, 0, 0, 1);
}
public void aa8(View view) {
mSoundPool.play(soundHashMap.get(8), 1, 1, 0, 0, 1);
}
public void aa9(View view) {
mSoundPool.play(soundHashMap.get(9), 1, 1, 0, 0, 1);
}
public void aa10(View view) {
mSoundPool.play(soundHashMap.get(10), 1, 1, 0, 0, 1);
}
public void aa11(View view) {
mSoundPool.play(soundHashMap.get(11), 1, 1, 0, 0, 1);
}
public void aa12(View view) {
mSoundPool.play(soundHashMap.get(12), 1, 1, 0, 0, 1);
}
public void aa13(View view) {
mSoundPool.play(soundHashMap.get(13), 1, 1, 0, 0, 1);
}
public void aa14(View view) {
mSoundPool.play(soundHashMap.get(14), 1, 1, 0, 0, 1);
}
public void aa15(View view) {
mSoundPool.play(soundHashMap.get(15), 1, 1, 0, 0, 1);
}
public void aa16(View view) {
mSoundPool.play(soundHashMap.get(16), 1, 1, 0, 0, 1);
}
public void aa17(View view) {
mSoundPool.play(soundHashMap.get(17), 1, 1, 0, 0, 1);
}
public void aa18(View view) {
mSoundPool.play(soundHashMap.get(18), 1, 1, 0, 0, 1);
}
public void aa19(View view) {
mSoundPool.play(soundHashMap.get(19), 1, 1, 0, 0, 1);
}
public void aa20(View view) {
mSoundPool.play(soundHashMap.get(20), 1, 1, 0, 0, 1);
}
public void aa21(View view) {
mSoundPool.play(soundHashMap.get(21), 1, 1, 0, 0, 1);
}
public void b1(View view) {
mSoundPool.play(soundHashMap.get(22), 1, 1, 0, 0, 1);
}
public void b2(View view) {
mSoundPool.play(soundHashMap.get(23), 1, 1, 0, 0, 1);
}
public void b3(View view) {
mSoundPool.play(soundHashMap.get(24), 1, 1, 0, 0, 1);
}
public void b4(View view) {
mSoundPool.play(soundHashMap.get(25), 1, 1, 0, 0, 1);
}
public void b5(View view) {
mSoundPool.play(soundHashMap.get(26), 1, 1, 0, 0, 1);
}
public void b6(View view) {
mSoundPool.play(soundHashMap.get(27), 1, 1, 0, 0, 1);
}
public void b7(View view) {
mSoundPool.play(soundHashMap.get(28), 1, 1, 0, 0, 1);
}
public void b8(View view) {
mSoundPool.play(soundHashMap.get(29), 1, 1, 0, 0, 1);
}
public void b9(View view) {
mSoundPool.play(soundHashMap.get(30), 1, 1, 0, 0, 1);
}
public void b10(View view) {
mSoundPool.play(soundHashMap.get(31), 1, 1, 0, 0, 1);
}
protected void onPause() {
// TODO Auto-generated method stub
super.onPause();
mediaPlayer.release();
}
@Override
public void onBackPressed() {
// TODO Auto-generated method stub
super.onBackPressed();
Intent i = new
Intent(Intent.ACTION_MAIN);
i.setFlags
(Intent.FLAG_ACTIVITY_NEW_TASK);
i.addCategory
(Intent.CATEGORY_HOME);
startActivity(i);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// TODO Auto-generated method stub
SubMenu subMenu = menu.addSubMenu(0, 1, 0, "关于");
SubMenu subMenu2 = menu.addSubMenu(0, 2, 0, "退出");
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// TODO Auto-generated method stub
if (item.getItemId() == 1) {
Builder builder = new Builder(XiyangyangActivity.this);
builder.setTitle("软件信息");
builder.setMessage(R.string.about_cont1);
builder.show();
} else {
scrollview.startAnimation(new TV());
new Timer().schedule(new TimerTask() {
@Override
public void run() {
android.os.Process.killProcess(android.os.Process.myPid());
}
}, 1000);
}
return super.onOptionsItemSelected(item);
}
@Override
public void onChannelIdCb(int arg0) {
// TODO Auto-generated method stub
}
@Override
public void onSdkVersionCb(String arg0) {
// TODO Auto-generated method stub
}
@Override
public void onShowAppsFinishCb() {
// TODO Auto-generated method stub
}
@Override
public void onUpdatePointsCb(String arg0, int arg1) {
// TODO Auto-generated method stub
}
@Override
protected void onResume() {
// TODO Auto-generated method stub
super.onResume();
if (getRequestedOrientation() != ActivityInfo.SCREEN_ORIENTATION_PORTRAIT) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
}
}
分享到:
相关推荐
Android中的SoundPool一般用于游戏中的多个音频文件中,以后有意向做游戏开发,或对多个音频播放有要求的可以研究下SoundPool。
Android下使用SoundPool的示例,详细参见博客:http://www.cnblogs.com/plokmju/p/android_SoundPool.html
android soundpool播放音乐,使用soundpool播放音乐。
使用 SoundPool 播放音效,SoundPool 还支持自行设置声音的品质、音量、 播放比率等参数
Android SoundPool使用案例及源码分析
Android设备的一些较短的声音可以用SoundPool来做,如消息提醒等,此例子介绍了SoundPool的用法。
Android的SoundPool类使用与利弊
资源为一个专门处理短音效soundPool的工具类,使用起来很方便,封装的很好!使用方法: 1、你只需要在需要的地方调用这个方法进行类初始化 private void initSound() { soundPlay = new SoundPlay(); soundPlay....
MediaPlayer SoundPool 游戏点击声 背景音乐,程序员,这种代码不需要解释
Android SoundPool音效使用Demo源码.rar
一个简单的sample , 用来理解及测试SoundPool的相关功能 https://blog.csdn.net/qq_28261343
soundPool在Android5.0后Api有了改变,这个Demo就是为解决这种变化的,它可以在Android4.+----7.+系统正常播放音频文件!
即时音效, 通过android.media.SoundPool实现 具体请参见 http://blog.csdn.net/aduovip/article/details/9026567
android 的摄像头 和soundPool播放声音实例
Android soundpool播放音乐声音池应用举例,基础的例子,使用SoundPool进行简单的音乐播放功能,由此可扩展成一个音乐播放器,编写音频处理相关的应用时,可用上的基础代码。
这种简单的音乐的播放就运用到了我们的SoundPool,它使用音效池的概念来管理短促的音效,例如它可以开始就加载20 个音效,通过他们的id进行管理与播放。SoundPool的优势在于占用的CPU资源少,反应延迟降低。另外它还...
soundPool在Android5.0后Api有了改变,这个Demo就是为解决这种变化的,它可以在Android4.+----7.+系统正常播放音频文件!
一个简单的sample , 用来理解及测试SoundPool的相关功能 相关博客 https://blog.csdn.net/qq_28261343/article/details/82818868
android安卓app音频播放方式 MediaPlayer与SoundPool的区别.zip
主要为大家详细介绍了Android使用SoundPool实现播放音频,具有一定的参考价值,感兴趣的小伙伴们可以参考一下