List of usage examples for android.os Build DEVICE
String DEVICE
To view the source code for android.os Build DEVICE.
Click Source Link
From source file:com.framgia.android.emulator.EmulatorDetector.java
public static String getDeviceInfo() { return "Build.PRODUCT: " + Build.PRODUCT + "\n" + "Build.MANUFACTURER: " + Build.MANUFACTURER + "\n" + "Build.BRAND: " + Build.BRAND + "\n" + "Build.DEVICE: " + Build.DEVICE + "\n" + "Build.MODEL: " + Build.MODEL + "\n" + "Build.HARDWARE: " + Build.HARDWARE + "\n" + "Build.FINGERPRINT: " + Build.FINGERPRINT;//from w w w . ja v a 2 s .com }
From source file:com.lewa.crazychapter11.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { //set to full screen // getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); ///set to no title // requestWindowFeature(Window.FEATURE_NO_TITLE); // acionBar = getSupportActionBar(); // acionBar = getActionBar(); // acionBar.hide(); // Window win = getWindow(); // win.clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); // win.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS | WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION); // win.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); // win.setStatusBarColor(Color.TRANSPARENT); // win.setNavigationBarColor(Color.TRANSPARENT); /*//*from w ww. ja v a 2 s. c o m*/ win.clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); win.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS | WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION); win.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_STABLE); win.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); win.setStatusBarColor(Color.TRANSPARENT); win.setNavigationBarColor(Color.TRANSPARENT); //*/ super.onCreate(savedInstanceState); setContentView(R.layout.main); /* setTheme(R.style.CrazyTheme); */ AddGameBtn(); AddNoification(); LookupContact(); AddServiceBtn(); broadcastMain(); mediaPlayerMain(); mediaRecordSoundMain(); cameraMain(); recordvideoMain(); queMySql(); TestFragment(); justForTest(); LoadJson(); AddTestBtn(); AddUsageStatsBtn(); AddPeopleProvideBtn(); getInput(); ////just for test shutdown broadcast receiver IntentFilter mIntentFilter = new IntentFilter("android.intent.action.ACTION_SHUTDOWN"); mIntentFilter.addAction("com.lewa.alarm.test"); mIntentFilter.addAction("android.provider.Telephony.SECRET_CODE"); mIntentFilter.addAction("android.intent.action.SCREEN_ON"); mIntentFilter.addAction("android.intent.action.SCREEN_OFF"); mShoutdown = new shutdownReceiver(); registerReceiver(mShoutdown, mIntentFilter); ////test preferences = getSharedPreferences("crazyit", MODE_WORLD_WRITEABLE | MODE_WORLD_READABLE); editor = preferences.edit(); preferencestime = getSharedPreferences("RMS_Shutdown_time", MODE_WORLD_WRITEABLE | MODE_WORLD_READABLE); editortime = preferencestime.edit(); SharedShutdownTimeRead(); AddSharedPreBtn(); etNum = (EditText) findViewById(R.id.etNum); // // int maxLength = 4; InputFilter[] fArray = new InputFilter[1]; fArray[0] = new InputFilter.LengthFilter(maxLength); etNum.setFilters(fArray); // // calThread = new CalThread(); calThread.start(); Log.i("algerheMain", "MainActivity onCreate in!!"); String page = getString(R.string.str_page, "345", "24"); Log.i("algerheMain", "page=" + page); // /just for test here ComponentName comp = getIntent().getComponent(); show_txt = (EditText) findViewById(R.id.show_txt); show_txt.setText( "??" + comp.getPackageName() + " \n ??" + comp.getClassName()); ////MD5 check item ///1.IMEI TelephonyManager TelephonyMgr = (TelephonyManager) getSystemService(TELEPHONY_SERVICE); String szImei = TelephonyMgr.getDeviceId(); String m_szSIMSerialNm = TelephonyMgr.getSimSerialNumber(); CellLocation m_location = TelephonyMgr.getCellLocation(); String m_Line1Number = TelephonyMgr.getLine1Number(); String m_OperatorName = TelephonyMgr.getSimOperatorName(); Log.i("algerheTelephonyMgr", "szImei=" + szImei); Log.i("algerheTelephonyMgr", "m_szSIMSerialNm=" + m_szSIMSerialNm); Log.i("algerheTelephonyMgr", "m_location=" + m_location); Log.i("algerheTelephonyMgr", "m_Line1Number=" + m_Line1Number); Log.i("algerheTelephonyMgr", "m_OperatorName=" + m_OperatorName); Log.i("algerheMain01", "szImei=" + szImei); Log.i("algerheMain01", "m_szSIMSerialNm=" + m_szSIMSerialNm); ///2.Pseudo-Unique ID String m_szDevIDShort = "35" + //we make this look like a valid IMEI Build.BOARD.length() % 10 + Build.BRAND.length() % 10 + Build.CPU_ABI.length() % 10 + Build.DEVICE.length() % 10 + Build.DISPLAY.length() % 10 + Build.HOST.length() % 10 + Build.ID.length() % 10 + Build.MANUFACTURER.length() % 10 + Build.MODEL.length() % 10 + Build.PRODUCT.length() % 10 + Build.TAGS.length() % 10 + Build.TYPE.length() % 10 + Build.USER.length() % 10; //13 digits Log.i("algerheMain01", "m_szDevIDShort=" + m_szDevIDShort); ///3. Android ID String m_szAndroidID = Secure.getString(getContentResolver(), Secure.ANDROID_ID); Log.i("algerheMain01", "m_szAndroidID=" + m_szAndroidID); ///4.WLAN MAC Address string WifiManager wm = (WifiManager) getSystemService(Context.WIFI_SERVICE); String m_szWLANMAC = "unknow_wifi_mac"; if (wm != null && wm.getConnectionInfo() != null) { m_szWLANMAC = wm.getConnectionInfo().getMacAddress(); } Log.i("algerheMain01", "m_szWLANMAC=" + m_szWLANMAC); ///5.BT MAC Address string BluetoothAdapter m_BluetoothAdapter = null; // Local Bluetooth adapter m_BluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); String m_szBTMAC = m_BluetoothAdapter.getAddress(); Log.i("algerheMain01", "m_szBTMAC=" + m_szBTMAC); ///6.sim serial number .getSimSerialNumber() // / ///reflect test checkMethod(); // */ final Intent alarmIntent = new Intent(); Log.i("algerheMain00", "isLewaRom=" + isLewaRom(this, alarmIntent)); handler = new Handler() { @Override public void handleMessage(Message msg) { if (msg.what == 0x4567) { String languageStr = null; String countryStr = null; Locale[] locList = Locale.getAvailableLocales(); for (int i = 0; i < locList.length; i++) { languageStr += locList[i].getLanguage(); countryStr += locList[i].getCountry(); } // show_txt = (EditText) findViewById(R.id.show_txt); show_txt.setText("" + languageStr + " \n " + countryStr); } else if (msg.what == 0x2789) { Log.i("algerheAlarm", "send alarm message in time=" + System.currentTimeMillis() + "\n action=" + alarmIntent.getAction()); // sendBroadcast(alarmIntent); } } }; // String strApkPath = intent.getStringExtra("apkPath"); // String strCmd = "pm install -r " + strApkPath; // try { // Process install = Runtime.getRuntime().exec(strCmd); // Log.d(TAG, "install = " + install + ", strCmd =" + strCmd); // }catch (Exception ex){ // Log.d(TAG, ex.getMessage()); // } // */ }
From source file:com.aware.Aware.java
private void get_device_info() { Cursor awareContextDevice = awareContext.getContentResolver().query(Aware_Device.CONTENT_URI, null, null, null, null);/*from w w w.j a va 2 s . c o m*/ if (awareContextDevice == null || !awareContextDevice.moveToFirst()) { ContentValues rowData = new ContentValues(); rowData.put("timestamp", System.currentTimeMillis()); rowData.put("device_id", Aware.getSetting(awareContext, Aware_Preferences.DEVICE_ID)); rowData.put("board", Build.BOARD); rowData.put("brand", Build.BRAND); rowData.put("device", Build.DEVICE); rowData.put("build_id", Build.DISPLAY); rowData.put("hardware", Build.HARDWARE); rowData.put("manufacturer", Build.MANUFACTURER); rowData.put("model", Build.MODEL); rowData.put("product", Build.PRODUCT); rowData.put("serial", Build.SERIAL); rowData.put("release", Build.VERSION.RELEASE); rowData.put("release_type", Build.TYPE); rowData.put("sdk", Build.VERSION.SDK_INT); try { awareContext.getContentResolver().insert(Aware_Device.CONTENT_URI, rowData); Intent deviceData = new Intent(ACTION_AWARE_DEVICE_INFORMATION); sendBroadcast(deviceData); if (Aware.DEBUG) Log.d(TAG, "Device information:" + rowData.toString()); } catch (SQLiteException e) { if (Aware.DEBUG) Log.d(TAG, e.getMessage()); } catch (SQLException e) { if (Aware.DEBUG) Log.d(TAG, e.getMessage()); } } if (awareContextDevice != null && !awareContextDevice.isClosed()) awareContextDevice.close(); }
From source file:aws.apps.underthehood.Main.java
/** Retrieves and displays info */ @SuppressWarnings("deprecation") private void populateInfo() { //HashMap<Integer, Boolean> actionMap) { final Object data = getLastNonConfigurationInstance(); LayoutParams lp = new TableLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); if (data == null) { // We need to do everything from scratch! mTimeDate = uB.formatDateTime("yyyy-MM-dd-HHmmssZ", new Date()); lblTimeDate.setText(mTimeDate);//from w ww . j av a 2 s.com device_rooted = checkIfSu(); mDataTextSize = getResources().getDimension(R.dimen.terminal_data_font); //showSelectionDialogue(); executeCommands(); } else { final SavedData saved = (SavedData) data; mTimeDate = saved.getDateTime(); device_rooted = saved.getAreWeRooted(); lblTimeDate.setText(mTimeDate); mDataTextSize = saved.getTextSize(); listToTable(saved.gettIpConfig(), tableIpconfig, lp); listToTable(saved.gettIp(), tableIpRoute, lp); listToTable(saved.gettRoute(), tableProc, lp); listToTable(saved.gettDf(), tableOther, lp); listToTable(saved.gettPs(), tablePs, lp); listToTable(saved.gettNetlist(), tableNetstat, lp); listToTable(saved.gettSysProp(), tableSysProp, lp); } if (device_rooted) { device_rooted = true; lblRootStatus.setText(getString(R.string.root_status_ok)); } else { lblRootStatus.setText(getString(R.string.root_status_not_ok)); } lblDevice.setText(Build.PRODUCT + " " + Build.DEVICE); //String res = Build.HOST+ " " + Build.ID+ " " + Build.MODEL+ " " + Build.PRODUCT+ " " + Build.TAGS+ " " + Build.TIME+ " " + Build.TYPE+ " " + Build.USER; }
From source file:net.heroicefforts.viable.android.rep.jira.JIRARepository.java
public int postIssue(Issue issue) throws ServiceException { try {// w w w . jav a 2 s. c o m HttpPost post = new HttpPost(rootURL + "/issue.json"); List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(12); nameValuePairs.add(new BasicNameValuePair("issue_type", issue.getType())); nameValuePairs.add(new BasicNameValuePair("priority", issue.getPriority())); nameValuePairs.add(new BasicNameValuePair("app_name", issue.getAppName())); nameValuePairs.add(new BasicNameValuePair("summary", issue.getSummary())); nameValuePairs.add(new BasicNameValuePair("description", issue.getDescription())); for (String version : issue.getAffectedVersions()) nameValuePairs.add(new BasicNameValuePair("app_version_name", version)); if (issue.getStacktrace() != null) nameValuePairs.add(new BasicNameValuePair("stacktrace", issue.getStacktrace())); if (issue instanceof BugContext) { nameValuePairs.add(new BasicNameValuePair("phone_model", Build.MODEL)); nameValuePairs.add(new BasicNameValuePair("phone_device", Build.DEVICE)); nameValuePairs.add(new BasicNameValuePair("phone_version", String.valueOf(Build.VERSION.SDK_INT))); } if (Config.LOGD) Log.d(TAG, "post params: " + nameValuePairs.toString()); post.setEntity(new UrlEncodedFormEntity(nameValuePairs)); // Execute HTTP Post Request HttpResponse response = execute(post); int responseCode = response.getStatusLine().getStatusCode(); if (HttpStatus.SC_OK == responseCode || HttpStatus.SC_CREATED == responseCode) { JSONObject obj = readJSON(response); if (Config.LOGV) Log.v(TAG, "postIssue response: \n" + obj.toString(4)); //TODO pull dates from response Issue newIssue = new Issue(obj.getJSONObject("issue").toString(4)); issue.copy(newIssue); } else throw new ServiceException(MSG_REMOTE_ERROR + responseCode); if (Config.LOGD) Log.d(TAG, "postIssue code " + responseCode); return responseCode; } catch (UnsupportedEncodingException e) { throw new ServiceException("Encoding error occurred parsing JIRA response", e); } catch (IOException e) { throw new ServiceException(MSG_CONNECT_ERROR, e); } catch (JSONException e) { throw new ServiceException(MSG_PARSE_ERROR, e); } }
From source file:net.heroicefforts.viable.android.rep.jira.JIRARepository.java
public int postIssueComment(Issue issue, Comment comment) throws ServiceException { try {//from w w w .j av a2s.co m HttpPost post = new HttpPost(rootURL + "/issue/" + issue.getIssueId() + "/comments.json"); List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(12); nameValuePairs.add(new BasicNameValuePair("app_name", issue.getAppName())); nameValuePairs.add(new BasicNameValuePair("body", comment.getBody())); if (issue.getStacktrace() != null) { nameValuePairs.add(new BasicNameValuePair("phone_model", Build.MODEL)); nameValuePairs.add(new BasicNameValuePair("phone_device", Build.DEVICE)); nameValuePairs.add(new BasicNameValuePair("phone_version", String.valueOf(Build.VERSION.SDK_INT))); } if (Config.LOGD) Log.d(TAG, "post params: " + nameValuePairs.toString()); post.setEntity(new UrlEncodedFormEntity(nameValuePairs)); // Execute HTTP Post Request HttpResponse response = execute(post); int responseCode = response.getStatusLine().getStatusCode(); if (HttpStatus.SC_OK == responseCode || HttpStatus.SC_CREATED == responseCode) { JSONObject obj = readJSON(response); if (Config.LOGV) Log.v(TAG, "postIssueComment response: \n" + obj.toString(4)); //TODO pull dates from response Comment newComment = new Comment(obj); comment.copy(newComment); } else throw new ServiceException(MSG_REMOTE_ERROR + responseCode); if (Config.LOGD) Log.d(TAG, "postIssueComment code " + responseCode); return responseCode; } catch (UnsupportedEncodingException e) { throw new ServiceException("Encoding error occurred parsing JIRA response", e); } catch (IOException e) { throw new ServiceException(MSG_CONNECT_ERROR, e); } catch (JSONException e) { throw new ServiceException(MSG_PARSE_ERROR, e); } }
From source file:com.almalence.opencam.Fragment.java
@TargetApi(13) private void showCameraParameters() { AlertDialog.Builder alertDialog = new AlertDialog.Builder(getActivity()); alertDialog.setTitle(R.string.Pref_CameraParameters_Title); final StringBuilder about_string = new StringBuilder(); String version = "UNKNOWN_VERSION"; int version_code = -1; try {//w ww .j ava 2s. c o m PackageInfo pInfo = getActivity().getPackageManager().getPackageInfo(getActivity().getPackageName(), 0); version = pInfo.versionName; version_code = pInfo.versionCode; } catch (NameNotFoundException e) { e.printStackTrace(); } about_string.append("\nApplication name: "); about_string.append(MainScreen.getInstance().getResources().getString(R.string.Pref_About)); about_string.append("\nAndroid API version: "); about_string.append(Build.VERSION.SDK_INT); about_string.append("\nDevice manufacturer: "); about_string.append(Build.MANUFACTURER); about_string.append("\nDevice model: "); about_string.append(Build.MODEL); about_string.append("\nDevice code-name: "); about_string.append(Build.HARDWARE); about_string.append("\nDevice variant: "); about_string.append(Build.DEVICE); { ActivityManager activityManager = (ActivityManager) getActivity() .getSystemService(Activity.ACTIVITY_SERVICE); about_string.append("\nStandard max heap (MB): "); about_string.append(activityManager.getMemoryClass()); about_string.append("\nLarge max heap (MB): "); about_string.append(activityManager.getLargeMemoryClass()); } { Point display_size = new Point(); Display display = getActivity().getWindowManager().getDefaultDisplay(); display.getSize(display_size); about_string.append("\nDisplay size: "); about_string.append(display_size.x); about_string.append("x"); about_string.append(display_size.y); } //show camera 2 support level int level = CameraController.getCamera2Level(); about_string.append("\nCamera2 API: "); switch (level) { case 0://limited about_string.append("limited"); break; case 1://full about_string.append("full"); break; case 2://legacy about_string.append("legacy"); break; default: about_string.append("not supported"); } // about_string.append("\nSensor orientation, back camera: "); // about_string.append(CameraController.getSensorOrientation(0)); // about_string.append("\nSensor orientation, front camera: "); // about_string.append(CameraController.getSensorOrientation(1)); if (MainScreen.getInstance().preview_sizes != null) { about_string.append("\nPreview resolutions: "); for (int i = 0; i < MainScreen.getInstance().preview_sizes.size(); i++) { if (i > 0) { about_string.append(", "); } about_string.append(MainScreen.getInstance().preview_sizes.get(i).getWidth()); about_string.append("x"); about_string.append(MainScreen.getInstance().preview_sizes.get(i).getHeight()); } } about_string.append("\nCurrent camera ID: "); about_string.append(MainScreen.getInstance().cameraId); if (MainScreen.getInstance().picture_sizes != null) { about_string.append("\nPhoto resolutions: "); for (int i = 0; i < MainScreen.getInstance().picture_sizes.size(); i++) { if (i > 0) { about_string.append(", "); } about_string.append(MainScreen.getInstance().picture_sizes.get(i).getWidth()); about_string.append("x"); about_string.append(MainScreen.getInstance().picture_sizes.get(i).getHeight()); } } if (MainScreen.getInstance().video_sizes != null) { about_string.append("\nVideo resolutions: "); for (int i = 0; i < MainScreen.getInstance().video_sizes.size(); i++) { if (i > 0) { about_string.append(", "); } about_string.append(MainScreen.getInstance().video_sizes.get(i).getWidth()); about_string.append("x"); about_string.append(MainScreen.getInstance().video_sizes.get(i).getHeight()); } } about_string.append("\nVideo stabilization: "); about_string.append(MainScreen.getInstance().supports_video_stabilization ? "true" : "false"); about_string.append("\nFlash modes: "); if (MainScreen.getInstance().flash_values != null && MainScreen.getInstance().flash_values.size() > 0) { for (int i = 0; i < MainScreen.getInstance().flash_values.size(); i++) { if (i > 0) { about_string.append(", "); } about_string.append(MainScreen.getInstance().flash_values.get(i)); } } else { about_string.append("None"); } about_string.append("\nFocus modes: "); if (MainScreen.getInstance().focus_values != null && MainScreen.getInstance().focus_values.size() > 0) { for (int i = 0; i < MainScreen.getInstance().focus_values.size(); i++) { if (i > 0) { about_string.append(", "); } about_string.append(MainScreen.getInstance().focus_values.get(i)); } } else { about_string.append("None"); } about_string.append("\nScene modes: "); if (MainScreen.getInstance().scene_modes_values != null && MainScreen.getInstance().scene_modes_values.size() > 0) { for (int i = 0; i < MainScreen.getInstance().scene_modes_values.size(); i++) { if (i > 0) { about_string.append(", "); } about_string.append(MainScreen.getInstance().scene_modes_values.get(i)); } } else { about_string.append("None"); } about_string.append("\nWhite balances: "); if (MainScreen.getInstance().white_balances_values != null && MainScreen.getInstance().white_balances_values.size() > 0) { for (int i = 0; i < MainScreen.getInstance().white_balances_values.size(); i++) { if (i > 0) { about_string.append(", "); } about_string.append(MainScreen.getInstance().white_balances_values.get(i)); } } else { about_string.append("None"); } about_string.append("\nISOs: "); if (MainScreen.getInstance().isos != null && MainScreen.getInstance().isos.size() > 0) { for (int i = 0; i < MainScreen.getInstance().isos.size(); i++) { if (i > 0) { about_string.append(", "); } about_string.append(MainScreen.getInstance().isos.get(i)); } } else { about_string.append("None"); } String save_location = SavingService.getSaveToPath(); about_string.append("\nSave Location: " + save_location); if (MainScreen.getInstance().flattenParamteters != null && !MainScreen.getInstance().flattenParamteters.equals("")) { about_string.append("\nFULL INFO:\n"); about_string.append(MainScreen.getInstance().flattenParamteters); } alertDialog.setMessage(about_string); alertDialog.setPositiveButton(R.string.Pref_CameraParameters_Ok, null); alertDialog.setNegativeButton(R.string.Pref_CameraParameters_CopyToClipboard, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { ClipboardManager clipboard = (ClipboardManager) getActivity() .getSystemService(Activity.CLIPBOARD_SERVICE); ClipData clip = ClipData.newPlainText("OpenCamera About", about_string); clipboard.setPrimaryClip(clip); } }); alertDialog.show(); }
From source file:com.pimp.companionforband.activities.main.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); sContext = getApplicationContext();//from w w w . ja v a 2s . c o m sActivity = this; sharedPreferences = getApplicationContext().getSharedPreferences("MyPrefs", 0); editor = sharedPreferences.edit(); bandSensorData = new BandSensorData(); mDestinationUri = Uri.fromFile(new File(getCacheDir(), SAMPLE_CROPPED_IMAGE_NAME)); SectionsPagerAdapter mSectionsPagerAdapter; ViewPager mViewPager; if (!checkCameraPermission(true)) requestCameraPermission(true); if (!checkCameraPermission(false)) requestCameraPermission(false); FiveStarsDialog fiveStarsDialog = new FiveStarsDialog(this, "pimplay69@gmail.com"); fiveStarsDialog.setTitle(getString(R.string.rate_dialog_title)) .setRateText(getString(R.string.rate_dialog_text)).setForceMode(false).setUpperBound(4) .setNegativeReviewListener(this).showAfter(5); AnalyticsApplication application = (AnalyticsApplication) getApplication(); mTracker = application.getDefaultTracker(); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager()); mViewPager = (ViewPager) findViewById(R.id.container); mViewPager.setAdapter(mSectionsPagerAdapter); mViewPager.setOffscreenPageLimit(2); mViewPager.setPageTransformer(true, new ZoomOutPageTransformer()); mViewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { } @Override public void onPageSelected(int position) { String name; switch (position) { case 0: name = "THEME"; break; case 1: name = "SENSORS"; break; case 2: name = "EXTRAS"; break; default: name = "CfB"; } mTracker.setScreenName("Image~" + name); mTracker.send(new HitBuilders.ScreenViewBuilder().build()); logSwitch = (Switch) findViewById(R.id.log_switch); backgroundLogSwitch = (Switch) findViewById(R.id.backlog_switch); logStatus = (TextView) findViewById(R.id.logStatus); backgroundLogStatus = (TextView) findViewById(R.id.backlogStatus); } @Override public void onPageScrollStateChanged(int state) { } }); TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs); tabLayout.setupWithViewPager(mViewPager); Drawable headerBackground = null; String encoded = sharedPreferences.getString("me_tile_image", "null"); if (!encoded.equals("null")) { byte[] imageAsBytes = Base64.decode(encoded.getBytes(), Base64.DEFAULT); headerBackground = new BitmapDrawable( BitmapFactory.decodeByteArray(imageAsBytes, 0, imageAsBytes.length)); } AccountHeader accountHeader = new AccountHeaderBuilder().withActivity(this).withCompactStyle(true) .withHeaderBackground((headerBackground == null) ? getResources().getDrawable(R.drawable.pipboy) : headerBackground) .addProfiles(new ProfileDrawerItem() .withName(sharedPreferences.getString("device_name", "Companion For Band")) .withEmail(sharedPreferences.getString("device_mac", "pimplay69@gmail.com")) .withIcon(getResources().getDrawable(R.drawable.band))) .build(); result = new DrawerBuilder().withActivity(this).withToolbar(toolbar).withActionBarDrawerToggleAnimated(true) .withAccountHeader(accountHeader) .addDrawerItems( new PrimaryDrawerItem().withName(getString(R.string.drawer_cloud)) .withIcon(GoogleMaterial.Icon.gmd_cloud).withIdentifier(1), new DividerDrawerItem(), new PrimaryDrawerItem().withName(getString(R.string.rate)) .withIcon(GoogleMaterial.Icon.gmd_rate_review).withIdentifier(2), new PrimaryDrawerItem().withName(getString(R.string.feedback)) .withIcon(GoogleMaterial.Icon.gmd_feedback).withIdentifier(3), new DividerDrawerItem(), new PrimaryDrawerItem().withName(getString(R.string.share)) .withIcon(GoogleMaterial.Icon.gmd_share).withIdentifier(4), new PrimaryDrawerItem().withName(getString(R.string.other)) .withIcon(GoogleMaterial.Icon.gmd_apps).withIdentifier(5), new DividerDrawerItem(), new PrimaryDrawerItem().withName(getString(R.string.report)) .withIcon(GoogleMaterial.Icon.gmd_bug_report).withIdentifier(6), new PrimaryDrawerItem().withName(getString(R.string.translate)) .withIcon(GoogleMaterial.Icon.gmd_translate).withIdentifier(9), new DividerDrawerItem(), new PrimaryDrawerItem().withName(getString(R.string.support)) .withIcon(GoogleMaterial.Icon.gmd_attach_money).withIdentifier(7), new PrimaryDrawerItem().withName(getString(R.string.aboutLib)) .withIcon(GoogleMaterial.Icon.gmd_info).withIdentifier(8)) .withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() { @Override public boolean onItemClick(View view, int position, IDrawerItem drawerItem) { boolean flag; if (drawerItem != null) { flag = true; switch ((int) drawerItem.getIdentifier()) { case 1: mTracker.send(new HitBuilders.EventBuilder().setCategory("Action") .setAction("Cloud").build()); if (!sharedPreferences.getString("access_token", "hi").equals("hi")) startActivity(new Intent(getApplicationContext(), CloudActivity.class)); else startActivity(new Intent(getApplicationContext(), WebviewActivity.class)); break; case 2: mTracker.send(new HitBuilders.EventBuilder().setCategory("Action") .setAction("Rate and Review").build()); String MARKET_URL = "https://play.google.com/store/apps/details?id="; String PlayStoreListing = getPackageName(); Intent rate = new Intent(Intent.ACTION_VIEW, Uri.parse(MARKET_URL + PlayStoreListing)); startActivity(rate); break; case 3: mTracker.send(new HitBuilders.EventBuilder().setCategory("Action") .setAction("Feedback").build()); final StringBuilder emailBuilder = new StringBuilder(); Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("mailto:pimplay69@gmail.com")); intent.putExtra(Intent.EXTRA_SUBJECT, getResources().getString(R.string.app_name)); emailBuilder.append("\n \n \nOS Version: ").append(System.getProperty("os.version")) .append("(").append(Build.VERSION.INCREMENTAL).append(")"); emailBuilder.append("\nOS API Level: ").append(Build.VERSION.SDK_INT); emailBuilder.append("\nDevice: ").append(Build.DEVICE); emailBuilder.append("\nManufacturer: ").append(Build.MANUFACTURER); emailBuilder.append("\nModel (and Product): ").append(Build.MODEL).append(" (") .append(Build.PRODUCT).append(")"); PackageInfo appInfo = null; try { appInfo = getPackageManager().getPackageInfo(getPackageName(), 0); } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); } assert appInfo != null; emailBuilder.append("\nApp Version Name: ").append(appInfo.versionName); emailBuilder.append("\nApp Version Code: ").append(appInfo.versionCode); intent.putExtra(Intent.EXTRA_TEXT, emailBuilder.toString()); startActivity(Intent.createChooser(intent, "Send via")); break; case 4: mTracker.send(new HitBuilders.EventBuilder().setCategory("Action") .setAction("Share").build()); Intent i = new AppInviteInvitation.IntentBuilder( getString(R.string.invitation_title)) .setMessage(getString(R.string.invitation_message)) .setCallToActionText(getString(R.string.invitation_cta)).build(); startActivityForResult(i, REQUEST_INVITE); break; case 5: mTracker.send(new HitBuilders.EventBuilder().setCategory("Action") .setAction("Other Apps").build()); String PlayStoreDevAccount = "https://play.google.com/store/apps/developer?id=P.I.M.P."; Intent devPlay = new Intent(Intent.ACTION_VIEW, Uri.parse(PlayStoreDevAccount)); startActivity(devPlay); break; case 6: mTracker.send(new HitBuilders.EventBuilder().setCategory("Action") .setAction("Report Bugs").build()); startActivity(new Intent(MainActivity.this, GittyActivity.class)); break; case 7: mTracker.send(new HitBuilders.EventBuilder().setCategory("Action") .setAction("Donate").build()); String base64EncodedPublicKey = getString(R.string.base64); mHelper = new IabHelper(getApplicationContext(), base64EncodedPublicKey); mHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() { public void onIabSetupFinished(IabResult result) { if (!result.isSuccess()) { Toast.makeText(MainActivity.this, "Problem setting up In-app Billing: " + result, Toast.LENGTH_LONG).show(); } } }); final Dialog dialog = new Dialog(MainActivity.this); dialog.setContentView(R.layout.dialog_donate); dialog.setTitle("Donate"); String[] title = { "Coke", "Coffee", "Burger", "Pizza", "Meal" }; String[] price = { "Rs. 10.00", "Rs. 50.00", "Rs. 100.00", "Rs. 500.00", "Rs. 1,000.00" }; ListView listView = (ListView) dialog.findViewById(R.id.list); listView.setAdapter(new DonateListAdapter(MainActivity.this, title, price)); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { switch (position) { case 0: mHelper.launchPurchaseFlow(MainActivity.this, SKU_COKE, 1, mPurchaseFinishedListener, "payload"); break; case 1: mHelper.launchPurchaseFlow(MainActivity.this, SKU_COFFEE, 1, mPurchaseFinishedListener, "payload"); break; case 2: mHelper.launchPurchaseFlow(MainActivity.this, SKU_BURGER, 1, mPurchaseFinishedListener, "payload"); break; case 3: mHelper.launchPurchaseFlow(MainActivity.this, SKU_PIZZA, 1, mPurchaseFinishedListener, "payload"); break; case 4: mHelper.launchPurchaseFlow(MainActivity.this, SKU_MEAL, 1, mPurchaseFinishedListener, "payload"); break; } } }); dialog.show(); break; case 8: mTracker.send(new HitBuilders.EventBuilder().setCategory("Action") .setAction("About").build()); new LibsBuilder().withLicenseShown(true).withVersionShown(true) .withActivityStyle(Libs.ActivityStyle.DARK).withAboutVersionShown(true) .withActivityTitle(getString(R.string.app_name)).withAboutIconShown(true) .withListener(libsListener).start(MainActivity.this); break; case 9: mTracker.send(new HitBuilders.EventBuilder().setCategory("Action") .setAction("Translate").build()); Intent translate = new Intent(Intent.ACTION_VIEW, Uri.parse("https://poeditor.com/join/project/AZQxDV2440")); startActivity(translate); break; default: break; } } else { flag = false; } return flag; } }).withSavedInstance(savedInstanceState).build(); AppUpdater appUpdater = new AppUpdater(this); appUpdater.start(); final DirectoryChooserConfig config = DirectoryChooserConfig.builder() .allowNewDirectoryNameModification(true).newDirectoryName("CfBCamera") .initialDirectory( sharedPreferences.getString("pic_location", "/storage/emulated/0/CompanionForBand/Camera")) .build(); mDialog = DirectoryChooserFragment.newInstance(config); new BandUtils().execute(); CustomActivityOnCrash.install(this); }
From source file:com.ekumen.tangobot.application.MainActivity.java
/** * Chooses a device extrinsics configuration publisher according to the detected device * type. NOTE: you want to tailor this for your particular robot configuration. *//*from w w w . ja va2 s.c om*/ public Transform getDeviceTransform() { if (Build.DEVICE.equalsIgnoreCase("PB2PRO")) { mLog.info("Lenovo Phab2Pro detected. Using default Tangobot tutorial configuration."); return DefaultRobotTfPublisherNode.TRANSFORM_PHAB2PRO; } else if (Build.DEVICE.equalsIgnoreCase("yellowstone")) { mLog.info("Tango Development Kit detected. Using default Tangobot tutorial configuration."); return DefaultRobotTfPublisherNode.TRANSFORM_DEVKIT; } else { mLog.warn("Couldn't identify device automatically. Will publish an identity transform."); return DefaultRobotTfPublisherNode.TRANSFORM_IDENTITY; } }
From source file:com.chummy.jezebel.material.dark.activities.Main.java
@Override public boolean onOptionsItemSelected(MenuItem item) { super.onOptionsItemSelected(item); switch (item.getItemId()) { case R.id.share: Intent sharingIntent = new Intent(Intent.ACTION_SEND); sharingIntent.setType("text/plain"); String shareBody = "Check out " + getResources().getString(R.string.theme_name) + " by " + getResources().getString(R.string.nicholas_short) + "!\n\nDownload it here!: " + getResources().getString(R.string.play_store_link); sharingIntent.putExtra(Intent.EXTRA_TEXT, shareBody); startActivity(Intent.createChooser(sharingIntent, (getResources().getString(R.string.share_title)))); break;/* w w w .j a v a 2 s . com*/ case R.id.sendemail: StringBuilder emailBuilder = new StringBuilder(); Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("mailto:" + getResources().getString(R.string.email_id))); if (!isAppInstalled("org.cyanogenmod.theme.chooser")) { if (!isAppInstalled("com.cyngn.theme.chooser")) { if (!isAppInstalled("com.lovejoy777.rroandlayersmanager")) { intent.putExtra(Intent.EXTRA_SUBJECT, getResources().getString(R.string.email_subject)); } else { intent.putExtra(Intent.EXTRA_SUBJECT, getResources().getString(R.string.email_subject_rro)); } } else { intent.putExtra(Intent.EXTRA_SUBJECT, getResources().getString(R.string.email_subject_cos)); } } else { intent.putExtra(Intent.EXTRA_SUBJECT, getResources().getString(R.string.email_subject_cm)); } emailBuilder.append("\n \n \nOS Version: " + System.getProperty("os.version") + "(" + Build.VERSION.INCREMENTAL + ")"); emailBuilder.append("\nOS API Level: " + Build.VERSION.SDK_INT + " (" + Build.VERSION.RELEASE + ") " + "[" + Build.ID + "]"); emailBuilder.append("\nDevice: " + Build.DEVICE); emailBuilder.append("\nManufacturer: " + Build.MANUFACTURER); emailBuilder.append("\nModel (and Product): " + Build.MODEL + " (" + Build.PRODUCT + ")"); if (!isAppInstalled("org.cyanogenmod.theme.chooser")) { if (!isAppInstalled("com.cyngn.theme.chooser")) { if (!isAppInstalled("com.lovejoy777.rroandlayersmanager")) { emailBuilder.append("\nTheme Engine: Not Available"); } else { emailBuilder.append("\nTheme Engine: Layers Manager (RRO)"); } } else { emailBuilder.append("\nTheme Engine: Cyanogen OS Theme Engine"); } } else { emailBuilder.append("\nTheme Engine: CyanogenMod Theme Engine"); } PackageInfo appInfo = null; try { appInfo = getPackageManager().getPackageInfo(getPackageName(), 0); } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); } emailBuilder.append("\nApp Version Name: " + appInfo.versionName); emailBuilder.append("\nApp Version Code: " + appInfo.versionCode); intent.putExtra(Intent.EXTRA_TEXT, emailBuilder.toString()); startActivity(Intent.createChooser(intent, (getResources().getString(R.string.send_title)))); break; case R.id.changelog: changelog(); break; case R.id.hide_launcher: boolean checked = item.isChecked(); if (!checked) { new MaterialDialog.Builder(this).title(R.string.warning).content(R.string.hide_action) .positiveText(R.string.nice).show(); } item.setChecked(!checked); setLauncherIconEnabled(checked); return true; default: return super.onOptionsItemSelected(item); } return true; }