List of usage examples for android.os PowerManager SCREEN_DIM_WAKE_LOCK
int SCREEN_DIM_WAKE_LOCK
To view the source code for android.os PowerManager SCREEN_DIM_WAKE_LOCK.
Click Source Link
From source file:com.cubic9.android.droidglove.Main.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // prevent sleep PowerManager powerManager = (PowerManager) getSystemService(Context.POWER_SERVICE); mWakeLock = powerManager.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK, "DroidGlove"); // vibrator/*from w w w. j a va 2 s . c o m*/ mVibrator = (Vibrator) getSystemService(VIBRATOR_SERVICE); // sensor mSensorManager = (SensorManager) getSystemService(SENSOR_SERVICE); // show error dialog if Wi-Fi off and Tethering off. WifiManager wifi = (WifiManager) getSystemService(WIFI_SERVICE); if ((!wifi.isWifiEnabled()) && (!isTethering(wifi))) { new AlertDialog.Builder(Main.this).setIcon(android.R.drawable.ic_dialog_alert) .setTitle(getString(R.string.dialog_error_title)) .setMessage(getString(R.string.dialog_error_wifi_off)) .setPositiveButton(R.string.dialog_error_ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { appEnd(); } }).create().show(); } // get IP address getPreferences(); // check IP address if (ip.equals("")) { showToast(R.string.toast_error_ip_null); Intent intent = new Intent(this, Settings.class); startActivityForResult(intent, 0); } else if (!ip.matches("^([0-9]{1,3}\\.){3}[0-9]{1,3}$")) { showToast(R.string.toast_error_ip_wrong); Intent intent = new Intent(this, Settings.class); startActivityForResult(intent, 0); } // init angle for (int i = 0; i < 3; i++) { for (int j = 0; j < AVERAGE_AMOUNT; j++) { mOrigAngles[i][j] = 0; } } // show screen setContentView(R.layout.main); // find views mTextViewMessage = (TextView) findViewById(R.id.textViewMessage); mTextViewIp = (TextView) findViewById(R.id.textViewIp); /* * textViewX = (TextView) findViewById(R.id.textViewX); textViewY = * (TextView) findViewById(R.id.textViewY); textViewZ = (TextView) * findViewById(R.id.textViewZ); textViewGrip = (TextView) * findViewById(R.id.textViewGrip); */ Button button = (Button) findViewById(R.id.buttonReset); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mInitirizedSensor = false; mTextViewMessage.setText(R.string.message_swipe_down); } }); }
From source file:net.olejon.spotcommander.WebViewActivity.java
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Google API client mGoogleApiClient = new GoogleApiClient.Builder(mContext).addApiIfAvailable(Wearable.API).build(); // Allow landscape? if (!mTools.allowLandscape()) setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); // Hide status bar? if (mTools.getDefaultSharedPreferencesBoolean("HIDE_STATUS_BAR")) getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); // Power manager final PowerManager powerManager = (PowerManager) getSystemService(Context.POWER_SERVICE); //noinspection deprecation mWakeLock = powerManager.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK, "wakeLock"); // Settings/*from w ww .j a va 2 s . c om*/ mTools.setSharedPreferencesBoolean("CAN_CLOSE_COVER", false); // Current network mCurrentNetwork = mTools.getCurrentNetwork(); // Computer final long computerId = mTools.getSharedPreferencesLong("LAST_COMPUTER_ID"); final String[] computer = mTools.getComputer(computerId); final String uri = computer[0]; final String username = computer[1]; final String password = computer[2]; // Layout setContentView(R.layout.activity_webview); // Status bar color if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { mStatusBarPrimaryColor = getWindow().getStatusBarColor(); mStatusBarCoverArtColor = mStatusBarPrimaryColor; } // Notification mPersistentNotificationIsSupported = (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN); if (mPersistentNotificationIsSupported) { final Intent launchActivityIntent = new Intent(mContext, MainActivity.class); launchActivityIntent.setAction("android.intent.action.MAIN"); launchActivityIntent.addCategory("android.intent.category.LAUNCHER"); mLaunchActivityPendingIntent = PendingIntent.getActivity(mContext, 0, launchActivityIntent, PendingIntent.FLAG_CANCEL_CURRENT); final Intent hideIntent = new Intent(mContext, RemoteControlIntentService.class); hideIntent.setAction("hide_notification"); hideIntent.putExtra(RemoteControlIntentService.REMOTE_CONTROL_INTENT_SERVICE_EXTRA, computerId); mHidePendingIntent = PendingIntent.getService(mContext, 0, hideIntent, PendingIntent.FLAG_CANCEL_CURRENT); final Intent previousIntent = new Intent(mContext, RemoteControlIntentService.class); previousIntent.setAction("previous"); previousIntent.putExtra(RemoteControlIntentService.REMOTE_CONTROL_INTENT_SERVICE_EXTRA, computerId); mPreviousPendingIntent = PendingIntent.getService(mContext, 0, previousIntent, PendingIntent.FLAG_CANCEL_CURRENT); final Intent playPauseIntent = new Intent(mContext, RemoteControlIntentService.class); playPauseIntent.setAction("play_pause"); playPauseIntent.putExtra(RemoteControlIntentService.REMOTE_CONTROL_INTENT_SERVICE_EXTRA, computerId); mPlayPausePendingIntent = PendingIntent.getService(mContext, 0, playPauseIntent, PendingIntent.FLAG_CANCEL_CURRENT); final Intent nextIntent = new Intent(mContext, RemoteControlIntentService.class); nextIntent.setAction("next"); nextIntent.putExtra(RemoteControlIntentService.REMOTE_CONTROL_INTENT_SERVICE_EXTRA, computerId); mNextPendingIntent = PendingIntent.getService(mContext, 0, nextIntent, PendingIntent.FLAG_CANCEL_CURRENT); final Intent volumeDownIntent = new Intent(mContext, RemoteControlIntentService.class); volumeDownIntent.setAction("adjust_spotify_volume_down"); volumeDownIntent.putExtra(RemoteControlIntentService.REMOTE_CONTROL_INTENT_SERVICE_EXTRA, computerId); mVolumeDownPendingIntent = PendingIntent.getService(mContext, 0, volumeDownIntent, PendingIntent.FLAG_CANCEL_CURRENT); final Intent volumeUpIntent = new Intent(mContext, RemoteControlIntentService.class); volumeUpIntent.setAction("adjust_spotify_volume_up"); volumeUpIntent.putExtra(RemoteControlIntentService.REMOTE_CONTROL_INTENT_SERVICE_EXTRA, computerId); mVolumeUpPendingIntent = PendingIntent.getService(mContext, 0, volumeUpIntent, PendingIntent.FLAG_CANCEL_CURRENT); mNotificationManager = NotificationManagerCompat.from(mContext); mNotificationBuilder = new NotificationCompat.Builder(mContext); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) mNotificationBuilder.setPriority(Notification.PRIORITY_MAX); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { mNotificationBuilder.setVisibility(Notification.VISIBILITY_PUBLIC); mNotificationBuilder.setCategory(Notification.CATEGORY_TRANSPORT); } } // Web view mWebView = (WebView) findViewById(R.id.webview_webview); mWebView.setBackgroundColor(ContextCompat.getColor(mContext, R.color.background)); mWebView.setScrollBarStyle(WebView.SCROLLBARS_INSIDE_OVERLAY); mWebView.setWebViewClient(new WebViewClient() { @SuppressWarnings("deprecation") @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { if (url != null && !url.contains(uri) && !url.contains("olejon.net/code/spotcommander/api/1/spotify/") && !url.contains("accounts.spotify.com/") && !url.contains("facebook.com/")) { view.getContext().startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url))); return true; } return false; } @Override public void onReceivedHttpAuthRequest(WebView view, @NonNull HttpAuthHandler handler, String host, String realm) { if (handler.useHttpAuthUsernamePassword()) { handler.proceed(username, password); } else { handler.cancel(); mWebView.stopLoading(); mTools.showToast(getString(R.string.webview_authentication_failed), 1); mTools.navigateUp(mActivity); } } @Override public void onReceivedError(WebView view, WebResourceRequest webResourceRequest, WebResourceError webResourceError) { mWebView.stopLoading(); mTools.showToast(getString(R.string.webview_error), 1); mTools.navigateUp(mActivity); } @Override public void onReceivedSslError(WebView view, @NonNull SslErrorHandler handler, SslError error) { handler.cancel(); mWebView.stopLoading(); new MaterialDialog.Builder(mContext).title(R.string.webview_dialog_ssl_error_title) .content(getString(R.string.webview_dialog_ssl_error_message)) .positiveText(R.string.webview_dialog_ssl_error_positive_button) .onPositive(new MaterialDialog.SingleButtonCallback() { @Override public void onClick(@NonNull MaterialDialog materialDialog, @NonNull DialogAction dialogAction) { finish(); } }).contentColorRes(R.color.black).show(); } }); // User agent mProjectVersionName = mTools.getProjectVersionName(); final String uaAppend1 = (!username.equals("") && !password.equals("")) ? "AUTHENTICATION_ENABLED " : ""; final String uaAppend2 = (mTools.getSharedPreferencesBoolean("WEAR_CONNECTED")) ? "WEAR_CONNECTED " : ""; final String uaAppend3 = (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT && !mTools.getDefaultSharedPreferencesBoolean("HARDWARE_ACCELERATED_ANIMATIONS")) ? "DISABLE_CSSTRANSITIONS DISABLE_CSSTRANSFORMS3D " : ""; // Web settings final WebSettings webSettings = mWebView.getSettings(); webSettings.setJavaScriptEnabled(true); webSettings.setSupportZoom(false); webSettings.setUserAgentString(getString(R.string.webview_user_agent, webSettings.getUserAgentString(), mProjectVersionName, uaAppend1, uaAppend2, uaAppend3)); // Load app if (savedInstanceState != null) { mWebView.restoreState(savedInstanceState); } else { mWebView.loadUrl(uri); } // JavaScript interface mWebView.addJavascriptInterface(new JavaScriptInterface(), "Android"); }
From source file:com.example.slidingmenuexample.ui.NXTRemoteControl.java
/** Called when the activity is first created. */ @SuppressWarnings("deprecation") @Override//from w ww .j ava 2s . c o m public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); readPreferences(prefs, null); prefs.registerOnSharedPreferenceChangeListener(this); if (savedInstanceState != null) { mNewLaunch = false; mDeviceAddress = savedInstanceState.getString("device_address"); if (mDeviceAddress != null) { mSavedState = NXTTalker.STATE_CONNECTED; } if (savedInstanceState.containsKey("power")) { mPower = savedInstanceState.getInt("power"); } if (savedInstanceState.containsKey("controls_mode")) { mControlsMode = savedInstanceState.getInt("controls_mode"); } } mPowerManager = (PowerManager) getSystemService(Context.POWER_SERVICE); mWakeLock = mPowerManager.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK | PowerManager.ON_AFTER_RELEASE, "NXT Remote Control"); if (!NO_BT) { mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); if (mBluetoothAdapter == null) { Toast.makeText(this, "Bluetooth is not available", Toast.LENGTH_LONG).show(); finish(); return; } } setupUI(); mNXTTalker = new NXTTalker(mHandler); pagelist = getSlidingMenu(); pagelist.setShadowDrawable(R.drawable.shadow); pagelist.setBehindOffset(600); pagelist.setShadowWidth(15); pagelist.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setIcon(R.drawable.ic_launcher); if (savedInstanceState != null) mContent = getSupportFragmentManager().getFragment(savedInstanceState, "mContent"); if (mContent == null) mContent = new NXTRemoteControlView(); setContentView(R.layout.content_frame); getSupportFragmentManager().beginTransaction().replace(R.id.content_frame, mContent).commit(); setBehindContentView(R.layout.menu_frame); getSupportFragmentManager().beginTransaction().replace(R.id.menu_frame, new MenuListPages()).commit(); setSlidingActionBarEnabled(true); }
From source file:csic.ceab.movelab.beepath.FixGet.java
/** * Creates a new FixGet service instance.<br> * Begins location recording process. Creates a location manager and two * location listeners. Begins requesting updates from both the GPS and * network services, with one location listener receiving updates from one * provider./*ww w .j a v a 2 s . com*/ * <p> * If either provider is unavailable, no updates will ever be returned to * the corresponding location listener. */ @Override public void onCreate() { Context context = getApplicationContext(); locationManager = (LocationManager) getSystemService(LOCATION_SERVICE); wifiLock = ((WifiManager) context.getSystemService(Context.WIFI_SERVICE)).createWifiLock( WifiManager.WIFI_MODE_SCAN_ONLY, context.getResources().getString(R.string.internal_message_id) + "WifiLock"); wakeLock = ((PowerManager) context.getSystemService(Context.POWER_SERVICE)).newWakeLock( PowerManager.SCREEN_DIM_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP, context.getResources().getString(R.string.internal_message_id) + "ScreenDimWakeLock"); minDist = Util.getMinDist(context); }
From source file:cm.aptoide.pt.Aptoide.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); PowerManager powerManager = (PowerManager) getSystemService(Context.POWER_SERVICE); keepScreenOn = powerManager.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK | PowerManager.ON_AFTER_RELEASE, "Full Power"); DownloadQueueServiceIntent = new Intent(getApplicationContext(), DownloadQueueService.class); startService(DownloadQueueServiceIntent); //@dsilveira #534 +10lines Check if Aptoide is already running to avoid wasting time and showing the splash ActivityManager activityManager = (ActivityManager) getApplicationContext() .getSystemService(Context.ACTIVITY_SERVICE); List<RunningTaskInfo> running = activityManager.getRunningTasks(Integer.MAX_VALUE); for (RunningTaskInfo runningTask : running) { if (runningTask.baseActivity.getClassName().equals("cm.aptoide.pt.RemoteInTab")) { //RemoteInTab is the real Aptoide Activity Message msg = new Message(); msg.what = LOAD_TABS;/*w ww . jav a 2 s . c o m*/ startHandler.sendMessage(msg); return; } } Log.d("Aptoide", "******* \n Downloads will be made to: " + Environment.getExternalStorageDirectory().getPath() + "\n ********"); sPref = getSharedPreferences("aptoide_prefs", MODE_PRIVATE); prefEdit = sPref.edit(); db = new DbHandler(this); PackageManager mPm = getPackageManager(); try { pkginfo = mPm.getPackageInfo("cm.aptoide.pt", 0); } catch (NameNotFoundException e) { } requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); try { if (pkginfo.versionCode < Integer.parseInt(getXmlElement("versionCode"))) { Log.d("Aptoide-VersionCode", "Using version " + pkginfo.versionCode + ", suggest update!"); requestUpdateSelf(); } else { proceed(); } } catch (Exception e) { e.printStackTrace(); proceed(); } }
From source file:org.zeroxlab.zeroxbenchmark.Benchmark.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); orientation = getResources().getConfiguration().orientation; PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE); mWakeLock = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK, TAG); mWakeLock.acquire();//from www . j a v a 2 s . co m setContentView(R.layout.main); mCases = new LinkedList<Case>(); Case arith = new CaseArithmetic(); Case javascript = new CaseJavascript(); Case scimark2 = new CaseScimark2(); Case canvas = new CaseCanvas(); Case glcube = new CaseGLCube(); Case circle = new CaseDrawCircle(); Case nehe08 = new CaseNeheLesson08(); Case nehe16 = new CaseNeheLesson16(); Case teapot = new CaseTeapot(); Case gc = new CaseGC(); Case libMicro = new NativeCaseMicro(); Case libUbench = new NativeCaseUbench(); Case dc2 = new CaseDrawCircle2(); Case dr = new CaseDrawRect(); Case da = new CaseDrawArc(); Case di = new CaseDrawImage(); Case dt = new CaseDrawText(); mCategory.put(D2, new HashSet<Case>()); mCategory.put(D3, new HashSet<Case>()); mCategory.put(MATH, new HashSet<Case>()); mCategory.put(VM, new HashSet<Case>()); mCategory.put(NATIVE, new HashSet<Case>()); mCategory.put(MISC, new HashSet<Case>()); // mflops mCases.add(arith); mCases.add(scimark2); mCases.add(javascript); mCategory.get(MATH).add(arith); mCategory.get(MATH).add(scimark2); mCategory.get(MISC).add(javascript); // 2d mCases.add(canvas); mCases.add(circle); mCases.add(dc2); mCases.add(dr); mCases.add(da); mCases.add(di); mCases.add(dt); mCategory.get(D2).add(canvas); mCategory.get(D2).add(circle); mCategory.get(D2).add(dc2); mCategory.get(D2).add(dr); mCategory.get(D2).add(da); mCategory.get(D2).add(di); mCategory.get(D2).add(dt); // 3d mCases.add(glcube); mCases.add(nehe08); mCases.add(nehe16); mCases.add(teapot); mCategory.get(D3).add(glcube); mCategory.get(D3).add(nehe08); mCategory.get(D3).add(nehe16); mCategory.get(D3).add(teapot); // vm mCases.add(gc); mCategory.get(VM).add(gc); // native mCases.add(libMicro); mCases.add(libUbench); mCategory.get(NATIVE).add(libMicro); mCategory.get(NATIVE).add(libUbench); initViews(); Intent intent = getIntent(); Bundle bundle = intent.getExtras(); if (bundle != null) { mAutoRun = bundle.getBoolean("autorun"); mCheckMath = bundle.getBoolean("math"); mCheck2D = bundle.getBoolean("2d"); mCheck3D = bundle.getBoolean("3d"); mCheckVM = bundle.getBoolean("vm"); mCheckNative = bundle.getBoolean("native"); mAutoUpload = bundle.getBoolean("autoupload"); } if (mCheckMath && !mathCheckBox.isChecked()) { mathCheckBox.performClick(); } if (mCheck2D && !d2CheckBox.isChecked()) { d2CheckBox.performClick(); } if (mCheck3D && !d3CheckBox.isChecked()) { d3CheckBox.performClick(); } if (mCheckVM && !vmCheckBox.isChecked()) { vmCheckBox.performClick(); } if (mCheckNative && !nativeCheckBox.isChecked()) { nativeCheckBox.performClick(); } if (mCheckMisc && !miscCheckBox.isChecked()) { miscCheckBox.performClick(); } /* if (intent.getBooleanExtra("AUTO", false)) { ImageView head = (ImageView)findViewById(R.id.banner_img); head.setImageResource(R.drawable.icon_auto); mTouchable = false; initAuto(); } */ if (mAutoRun) { onClick(mRun); } }
From source file:com.nekomeshi312.whiteboardcorrection.WhiteBoardCorrectionActivity.java
@Override public void onCreate(Bundle savedInstanceState) { setTheme(R.style.Theme_Sherlock);/*from w ww .jav a2 s .co m*/ super.onCreate(savedInstanceState); //action bar ???s??status bar? final android.view.Window wnd = getWindow(); wnd.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); wnd.addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN); requestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY); setContentView(R.layout.activity_white_board_correction); mCameraSetting = CameraAndParameters.newInstance(this); ActionBar actionBar = getSupportActionBar(); actionBar.setDisplayShowHomeEnabled(true); //actionbar????) actionBar.setBackgroundDrawable(getResources().getDrawable(R.drawable.actionbar_background)); PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE); mWakeLock = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK, "My Tag"); FragmentManager fm = getSupportFragmentManager(); mFragCameraView = (CameraViewFragment) fm.findFragmentByTag(FRAG_CAMERA_VIEW_TAG); mBoardCheckFragment = (WhiteBoardCheckFragment) fm.findFragmentByTag(FRAG_WB_CHECK_TAG); mBoardResultFragment = (WhiteBoardResultFragment) fm.findFragmentByTag(FRAG_WB_RESULT_TAG); Intent intent = (Intent) getIntent(); if (intent != null && Intent.ACTION_VIEW.equals(intent.getAction()) && intent.getType() != null) { if (!intent.getType().equals("image/jpeg") && !intent.getType().equals("image/jpg")) { Toast.makeText(this, R.string.error_msg_non_supported_image_format, Toast.LENGTH_SHORT).show(); Log.w(LOG_TAG, "Intent unsupported image format"); } else { int[] size = new int[2]; String fn = MyUtils.getImageInfoFromIntent(this, intent, size); if (fn != null) { //OpenCV?????? String[] newFn = new String[2]; if (copyImageToSD(fn, newFn) == true) { mWhiteBoardCheckInfo.mFilePath = newFn[0]; mWhiteBoardCheckInfo.mFileName = newFn[1]; mWhiteBoardCheckInfo.mPicWidth = size[0]; mWhiteBoardCheckInfo.mPicHeight = size[1]; mWhiteBoardCheckInfo.mIsCaptured = false; mWhiteBoardCheckInfo.mPrevWidth = 0; mWhiteBoardCheckInfo.mPrevHeight = 0; } } } } }
From source file:org.zeroxlab.benchmark.Benchmark.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); orientation = getResources().getConfiguration().orientation; PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE); mWakeLock = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK, TAG); mWakeLock.acquire();// w ww.ja v a2 s.co m sTexture = new BitmapShader(BitmapFactory.decodeResource(getResources(), R.drawable.crate), TileMode.REPEAT, TileMode.REPEAT); setContentView(R.layout.main); mCases = new LinkedList<Case>(); Case arith = new CaseArithmetic(); Case javascript = new CaseJavascript(); Case scimark2 = new CaseScimark2(); Case glcube = new CaseGLCube(); Case nehe08 = new CaseNeheLesson08(); Case nehe16 = new CaseNeheLesson16(); Case teapot = new CaseTeapot(); Case gc = new CaseGC(); Case libMicro = new NativeCaseMicro(); Case libUbench = new NativeCaseUbench(); Case canvas = new CaseCanvas(true, false, false); Case dc2 = new CaseDrawCircle2(); Case dr = new CaseDrawRect(); Case da = new CaseDrawArc(); Case di = new CaseDrawImage(); Case dt = new CaseDrawText(); mCategory.put(D2, new HashSet<Case>()); mCategory.put(D2HW, new HashSet<Case>()); mCategory.put(D2SW1, new HashSet<Case>()); mCategory.put(D2SW2, new HashSet<Case>()); mCategory.put(D3, new HashSet<Case>()); mCategory.put(MATH, new HashSet<Case>()); mCategory.put(VM, new HashSet<Case>()); mCategory.put(NATIVE, new HashSet<Case>()); mCategory.put(MISC, new HashSet<Case>()); // mflops mCases.add(arith); mCases.add(scimark2); mCases.add(javascript); mCategory.get(MATH).add(arith); mCategory.get(MATH).add(scimark2); mCategory.get(MISC).add(javascript); // 2d mCases.add(canvas); mCases.add(dc2); mCases.add(dr); mCases.add(da); mCases.add(di); mCases.add(dt); mCategory.get(D2).add(canvas); mCategory.get(D2).add(dc2); mCategory.get(D2).add(dr); mCategory.get(D2).add(da); mCategory.get(D2).add(di); mCategory.get(D2).add(dt); Case canvas2 = new CaseCanvas(false, false, false);//HW Case canvas3 = new CaseCanvas(false, true, false);//SW Window Case canvas4 = new CaseCanvas(false, false, true);//SW Layer Case circle = new CaseDrawCircle(false, false, false);//HW Case circle2 = new CaseDrawCircle(false, true, false);//SW Window Case circle3 = new CaseDrawCircle(false, false, true);//SW Layer Case dc22 = new CaseDrawCircle2(false, false, false);//HW Case dc23 = new CaseDrawCircle2(false, true, false);//SW Window Case dc24 = new CaseDrawCircle2(false, false, true);//SW Layer Case dr2 = new CaseDrawRect(false, false, false);//HW Case dr3 = new CaseDrawRect(false, true, false);//SW Window Case dr4 = new CaseDrawRect(false, false, true);//SW Layer Case da2 = new CaseDrawArc(false, false, false);//HW Case da3 = new CaseDrawArc(false, true, false);//SW Window Case da4 = new CaseDrawArc(false, false, true);//SW Layer Case di2 = new CaseDrawImage(false, false, false);//HW Case di3 = new CaseDrawImage(false, true, false);//SW Window Case di4 = new CaseDrawImage(false, false, true);//SW Layer Case dt2 = new CaseDrawText(false, false, false);//HW Case dt3 = new CaseDrawText(false, true, false);//SW Window Case dt4 = new CaseDrawText(false, false, true);//SW Layer mCases.add(canvas2); mCases.add(circle); mCases.add(dc22); mCases.add(dr2); mCases.add(da2); mCases.add(di2); mCases.add(dt2); mCases.add(canvas3); mCases.add(circle2); mCases.add(dc23); mCases.add(dr3); mCases.add(da3); mCases.add(di3); mCases.add(dt3); mCases.add(canvas4); mCases.add(circle3); mCases.add(dc24); mCases.add(dr4); mCases.add(da4); mCases.add(di4); mCases.add(dt4); //2d(HW) mCategory.get(D2HW).add(canvas2); mCategory.get(D2HW).add(circle); mCategory.get(D2HW).add(dc22); mCategory.get(D2HW).add(da2); mCategory.get(D2HW).add(dr2); mCategory.get(D2HW).add(di2); mCategory.get(D2HW).add(dt2); //2d(SW1) mCategory.get(D2SW1).add(canvas3); mCategory.get(D2SW1).add(circle2); mCategory.get(D2SW1).add(dc23); mCategory.get(D2SW1).add(da3); mCategory.get(D2SW1).add(dr3); mCategory.get(D2SW1).add(di3); mCategory.get(D2SW1).add(dt3); //2d(SW2) mCategory.get(D2SW2).add(canvas4); mCategory.get(D2SW2).add(circle3); mCategory.get(D2SW2).add(dc24); mCategory.get(D2SW2).add(da4); mCategory.get(D2SW2).add(dr4); mCategory.get(D2SW2).add(di4); mCategory.get(D2SW2).add(dt4); // 3d mCases.add(glcube); mCases.add(nehe08); mCases.add(nehe16); mCases.add(teapot); mCategory.get(D3).add(glcube); mCategory.get(D3).add(nehe08); mCategory.get(D3).add(nehe16); mCategory.get(D3).add(teapot); // vm mCases.add(gc); mCategory.get(VM).add(gc); // native mCases.add(libMicro); mCases.add(libUbench); mCategory.get(NATIVE).add(libMicro); mCategory.get(NATIVE).add(libUbench); initViews(); Intent intent = getIntent(); Bundle bundle = intent.getExtras(); if (bundle != null) { mAutoRun = bundle.getBoolean("autorun"); mCheckMath = bundle.getBoolean("math"); mCheck2D = bundle.getBoolean("2d"); mCheck3D = bundle.getBoolean("3d"); mCheckVM = bundle.getBoolean("vm"); mCheckNative = bundle.getBoolean("native"); mAutoUpload = bundle.getBoolean("autoupload"); } if (mCheckMath && !mathCheckBox.isChecked()) { mathCheckBox.performClick(); } if (mCheck2D && !d2CheckBox.isChecked()) { d2CheckBox.performClick(); } if (mCheck3D && !d3CheckBox.isChecked()) { d3CheckBox.performClick(); } if (mCheckVM && !vmCheckBox.isChecked()) { vmCheckBox.performClick(); } if (mCheckNative && !nativeCheckBox.isChecked()) { nativeCheckBox.performClick(); } if (mCheckMisc && !miscCheckBox.isChecked()) { miscCheckBox.performClick(); } /* if (intent.getBooleanExtra("AUTO", false)) { ImageView head = (ImageView)findViewById(R.id.banner_img); head.setImageResource(R.drawable.icon_auto); mTouchable = false; initAuto(); } */ if (mAutoRun) { onClick(mRun); } }
From source file:com.almarsoft.GroundhogReader.MessageListActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.messagelist); Context context = getApplicationContext(); // Config checker alert dialog mConfigAlert = new AlertDialog.Builder(this).create(); mConfigAlert.setButton(getString(R.string.ok), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dlg, int sumthin) { startActivity(new Intent(MessageListActivity.this, OptionsActivity.class)); }//from ww w.ja v a2s . co m }); mNumUnread = 0; // Loaded in OnResume || threadMessagesFromDB() mPrefs = PreferenceManager.getDefaultSharedPreferences(this); mOfflineMode = mPrefs.getBoolean("offlineMode", true); // Get the selected group from the GroupListActivity-passed bundle mTitleBar = (TextView) this.findViewById(R.id.topbar_text); mGroup = getIntent().getExtras().getString("selectedGroup"); mGroupID = DBUtils.getGroupIdFromName(mGroup, context); mGoGroups = (ImageButton) this.findViewById(R.id.btn_gogroups); mGoGroups.setOnClickListener(new OnClickListener() { public void onClick(View v) { MessageListActivity.this .startActivity(new Intent(MessageListActivity.this, GroupListActivity.class)); } }); mServerManager = new ServerManager(context); PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE); mWakeLock = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK | PowerManager.ON_AFTER_RELEASE, "GroundhogThreading"); mMsgList = (ListView) this.findViewById(R.id.list_msgs); mMsgList.setOnItemClickListener(mListItemClickListener); registerForContextMenu(mMsgList); Drawable dw = getResources().getDrawable(R.drawable.greyline2); mMsgList.setDivider(dw); // Show the progress dialog, get messages from server, write to DB // and call the loading of message from DB and threading when it ends mWakeLock.acquire(); threadMessagesFromDB(); }