package org.abrantix.rockon.rockonnggl;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import javax.microedition.khronos.egl.EGL10;
import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.egl.EGLDisplay;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.ActivityNotFoundException;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.ServiceConnection;
import android.content.DialogInterface.OnCancelListener;
import android.content.SharedPreferences.Editor;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager.NameNotFoundException;
import android.database.Cursor;
import android.media.AudioManager;
import android.net.Uri;
import android.opengl.GLSurfaceView;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.os.Message;
import android.os.RemoteException;
import android.preference.PreferenceManager;
import android.provider.MediaStore;
import android.util.Log;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.view.View.OnClickListener;
import android.view.ViewGroup.LayoutParams;
import android.view.inputmethod.InputMethodManager;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.SimpleCursorAdapter;
import android.widget.TextView;
import android.widget.Toast;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.CompoundButton.OnCheckedChangeListener;
public class RockOnNextGenGL extends Activity {
private final String TAG = "RockOnNextGenGL";
/** Global Vars */
// Context mContext;
int mRendererMode;
int mTheme;
int mBrowseCatMode;
GLSurfaceView mGlSurfaceView;
// RockOnCubeRenderer mRockOnCubeRenderer;
RockOnRenderer mRockOnRenderer;
private RockOnNextGenDefaultExceptionHandler mDefaultExceptionHandler;
boolean mIsSdCardPresentAndHasMusic = true;
String mNewPlaylistName;
NavScrollerView mNavScroller;
/** Dialogs */
private AlertDialog.Builder mPlaylistDialog;
private AlertDialog.Builder mViewModeDialog;
private AlertDialog.Builder mThemeDialog;
private AlertDialog.Builder mSpecificThemeDialog;
private AlertDialog.Builder mInstallConcertAppDialog;
/** Initialized vars */
AlbumArtDownloadOkClickListener mAlbumArtDownloadOkClickListener = null;
ThemeChangeClickListener mThemeChangeClickListener = null;
private IRockOnNextGenService mService = null;
/** State Variables */
static int mState = Constants.STATE_INTRO;
static String mTrackName = null;
static String mArtistName = null;
static long mTrackDuration = -1;
static long mTrackProgress = -1;
static float mNavigatorPositionX = -1;
static float mNavigatorTargetPositionX = -1;
static float mNavigatorPositionY = -1;
static float mNavigatorTargetPositionY = -1;
static int mPlaylistId = Constants.PLAYLIST_UNKNOWN;
/*********************************************************
* *******************************************************
*
* USES REFLECTION
*
* Media Button registration for 2.2
*
* ******************************************************/
private static Method mRegisterMediaButtonEventReceiver;
private static Method mUnregisterMediaButtonEventReceiver;
private AudioManager mAudioManager;
private ComponentName mRemoteControlResponder;
private static void initializeRemoteControlRegistrationMethods() {
try {
if (mRegisterMediaButtonEventReceiver == null) {
mRegisterMediaButtonEventReceiver = AudioManager.class.getMethod(
"registerMediaButtonEventReceiver",
new Class[] { ComponentName.class } );
}
if (mUnregisterMediaButtonEventReceiver == null) {
mUnregisterMediaButtonEventReceiver = AudioManager.class.getMethod(
"unregisterMediaButtonEventReceiver",
new Class[] { ComponentName.class } );
}
/* success, this device will take advantage of better remote */
/* control event handling */
} catch (NoSuchMethodException nsme) {
/* failure, still using the legacy behavior, but this app */
/* is future-proof! */
}
}
static {
initializeRemoteControlRegistrationMethods();
}
private void registerRemoteControl() {
try {
if (mRegisterMediaButtonEventReceiver == null) {
return;
}
mRegisterMediaButtonEventReceiver.invoke(mAudioManager,
mRemoteControlResponder);
} catch (InvocationTargetException ite) {
/* unpack original exception when possible */
Throwable cause = ite.getCause();
if (cause instanceof RuntimeException) {
throw (RuntimeException) cause;
} else if (cause instanceof Error) {
throw (Error) cause;
} else {
/* unexpected checked exception; wrap and re-throw */
throw new RuntimeException(ite);
}
} catch (IllegalAccessException ie) {
Log.e("MyApp", "unexpected " + ie);
}
}
private void unregisterRemoteControl() {
try {
if (mUnregisterMediaButtonEventReceiver == null) {
return;
}
mUnregisterMediaButtonEventReceiver.invoke(
mAudioManager,
mRemoteControlResponder);
} catch (InvocationTargetException ite) {
/* unpack original exception when possible */
Throwable cause = ite.getCause();
if (cause instanceof RuntimeException) {
throw (RuntimeException) cause;
} else if (cause instanceof Error) {
throw (Error) cause;
} else {
/* unexpected checked exception; wrap and re-throw */
throw new RuntimeException(ite);
}
} catch (IllegalAccessException ie) {
System.err.println("unexpected " + ie);
}
}
/*********************************************************
*********************************************************/
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// /****************
// * DEBUG ONLY
// ****************/
// mAnalytics = GoogleAnalyticsTracker.getInstance();
//// mAnalytics.start("UA-20349033-2", 6*60 /* *60 */ /* every 6 hours */, this);
// mAnalytics.start("UA-20349033-2", this);
//
// mAnalytics.trackPageView("/RockOnNextGenGL");
// mAnalytics.dispatch();
// mAnalytics.stop();
/* set up our default exception handler */
mDefaultExceptionHandler =
new RockOnNextGenDefaultExceptionHandler(
RockOnNextGenGL.this);
/* media button reflection variables */
Java技术交流分享
- 粉丝: 659
- 资源: 264
最新资源
- 基于灰狼算法的路径规划算法matlab代码,求解常见的路径规划问题 内含算法的注释,模块化编程,新手小白可快速入门 GWO算法,路径规划算法
- 双馈风力发电机-900V直流混合储能并网系统MATLAB仿真 MATLAB2016b 主体模型: 双馈感应风机模块、采用真实风速数据 混合储能模块、逆变器模块、转子过电流保护模块、整流器控制模块、逆
- (Matlab)EMD-GRU、GRU时间序列预测对比 基于EMD-GRU的时间序列预测模型,提高功率预测精度,提出一种经验模态分解(EMD)和门控循环单元(GRU)相结合的功率预测模型 首先利用E
- 腾讯云AI代码助手编程挑战赛-图片转换工具示例视频
- 2025年新春新年祝福素材模板.pptx
- 考虑柔性负荷的综合能源系统日前优化调度模型 关键词:柔性负荷 需求响应 综合需求响应 日前优化调度 综合能源系统 参考文档:《考虑用户侧柔性负荷的社区综合能源系统日前优化调度》参考柔性负荷和基础模型
- 经典怀旧老学同聚会活动模板.pptx
- 中学老同学聚会活动策划方案模板素材怀旧版.pptx
- Products_Sale_System.zip
- 双馈风力发电系统matlab simulink仿真,附带详细分析资料,新能源发电系统仿真
- fabric.js v6.5.4 源码
- 并离网逆变器仿真模型 逆变器PQ控制,Vf控制,无功能量发生器SVG,有源电力滤波器APF仿真模型
- 前端vue学习资料+html+css
- 网络助手工具(亲测好用)
- 百度百科网页设计与制作html作业,纯静态html+css制作
- AHU2024年漏洞分析考试
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈