`
java-mans
  • 浏览: 11427837 次
文章分类
社区版块
存档分类
最新评论

Android 字体+程序隐藏+菜单运用+soundpool

 
阅读更多

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);
}
}
}

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics