List of usage examples for android.util DisplayMetrics DENSITY_HIGH
int DENSITY_HIGH
To view the source code for android.util DisplayMetrics DENSITY_HIGH.
Click Source Link
From source file:net.evecom.android.web.Web5Activity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mContext = this; temp = HttpUtil.getPageSize(this); setContentView(R.layout.message_post_web); imageView = (ImageView) findViewById(R.id.image_view_at_web); webView = (WebView) this.findViewById(R.id.wv_oauth_message); CookieSyncManager.createInstance(this); CookieSyncManager.getInstance().startSync(); CookieManager.getInstance().removeSessionCookie(); /**/*from www . j av a 2s . c o m*/ * WebViewJavaScript */ webView.getSettings().setJavaScriptEnabled(true); /** * loadUrl() */ webView.setWebViewClient(new HelloWebViewClient()); dialog = ProgressDialog.show(Web5Activity.this, null, ".."); dialog.setCancelable(true); // http://harlan-pc/fzaj/emergency/mobileWebApp/publicInfo/login.do?userName=zf1&userPwd=1 // webView.loadUrl("http://www.baidu.com"); // String url = HttpUtil.BASE_PC_URL // + "/buildingController/login"; http://harlan-pc/gssms/mobile/ // String url =HttpUtil.BASE_PC_URL+"/loginController/countLogin"; String url = HttpUtil.BASE_PC_URL + "mobile/loginController/countLogin"; // post // String postDate = "loginname=sysadmin&pwd=888888"; String postDate = "loginname=" + ShareUtil.getString(getApplicationContext(), "SESSION", "USERNAME", "") + "&pwd=" + ShareUtil.getString(getApplicationContext(), "SESSION", "PASSWORD", "") + "&pageSize=" + temp; // EncodingUtils.getBytes(data, charset) webView.postUrl(url, EncodingUtils.getBytes(postDate, "BASE64")); // webView.setDownloadListener(new MyWebViewDownLoadListener()); WebSettings webSettings = webView.getSettings(); webSettings.setSupportZoom(true); webSettings.setJavaScriptEnabled(true); webSettings.setJavaScriptCanOpenWindowsAutomatically(true); webSettings.setBuiltInZoomControls(true);// support zoom // webSettings.setPluginsEnabled(true);//support flash webSettings.setUseWideViewPort(true); webSettings.setLoadWithOverviewMode(true); // webSettings.setPluginsEnabled(true); //(flash) /** */ // // webSettings.setDatabaseEnabled(true); String dir = this.getApplicationContext().getDir("database", Context.MODE_PRIVATE).getPath(); // webSettings.setGeolocationEnabled(true); // webSettings.setGeolocationDatabasePath(dir); // webSettings.setDomStorageEnabled(true); DisplayMetrics metrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(metrics); int mDensity = metrics.densityDpi; // DebugLog.d(TAG, "densityDpi = " + mDensity); if (mDensity == 240) { webSettings.setDefaultZoom(ZoomDensity.FAR); } else if (mDensity == 160) { webSettings.setDefaultZoom(ZoomDensity.MEDIUM); } else if (mDensity == 120) { webSettings.setDefaultZoom(ZoomDensity.CLOSE); // }else if(mDensity == DisplayMetrics..DENSITY_XHIGH){ // webSettings.setDefaultZoom(ZoomDensity.FAR); } else if (mDensity == DisplayMetrics.DENSITY_HIGH) { webSettings.setDefaultZoom(ZoomDensity.FAR); } webView.setWebChromeClient(m_chromeClient);// (flash) dialogPress = new AlertDialog.Builder(this).setTitle("").setMessage(":0/0") .setPositiveButton("", new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }).create(); }
From source file:net.evecom.android.web.Web0Activity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mContext = this; temp = HttpUtil.getPageSize(this); setContentView(R.layout.message_post_web); imageView = (ImageView) findViewById(R.id.image_view_at_web); webView = (WebView) this.findViewById(R.id.wv_oauth_message); CookieSyncManager.createInstance(this); CookieSyncManager.getInstance().startSync(); CookieManager.getInstance().removeSessionCookie(); /**// ww w.j av a 2 s .c om * WebViewJavaScript */ webView.getSettings().setJavaScriptEnabled(true); /** * loadUrl() */ webView.setWebViewClient(new HelloWebViewClient()); dialog = ProgressDialog.show(Web0Activity.this, null, ".."); dialog.setCancelable(true); // http://harlan-pc/fzaj/emergency/mobileWebApp/publicInfo/login.do?userName=zf1&userPwd=1 // webView.loadUrl("http://www.baidu.com"); // String url = HttpUtil.BASE_PC_URL // String url =HttpUtil.BASE_PC_URL+"loginController/messageLogin"; String url = HttpUtil.BASE_PC_URL + "mobile/loginController/messageLogin"; // post String postDate = "loginname=" + ShareUtil.getString(getApplicationContext(), "SESSION", "USERNAME", "") + "&pwd=" + ShareUtil.getString(getApplicationContext(), "SESSION", "PASSWORD", "") + "&pageSize=" + temp; // webView.postUrl(url, postData) postDatabyte[] // EncodingUtils.getBytes(data, charset) webView.postUrl(url, EncodingUtils.getBytes(postDate, "BASE64")); // webView.setDownloadListener(new MyWebViewDownLoadListener()); WebSettings webSettings = webView.getSettings(); webSettings.setSupportZoom(true); webSettings.setJavaScriptEnabled(true); webSettings.setJavaScriptCanOpenWindowsAutomatically(true); webSettings.setBuiltInZoomControls(true);// support zoom // webSettings.setPluginsEnabled(true);//support flash webSettings.setUseWideViewPort(true); webSettings.setLoadWithOverviewMode(true); /** */ // // webSettings.setDatabaseEnabled(true); String dir = this.getApplicationContext().getDir("database", Context.MODE_PRIVATE).getPath(); // webSettings.setGeolocationEnabled(true); // webSettings.setGeolocationDatabasePath(dir); // webSettings.setDomStorageEnabled(true); // webSettings.setPluginsEnabled(true); //(flash) DisplayMetrics metrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(metrics); int mDensity = metrics.densityDpi; // DebugLog.d(TAG, "densityDpi = " + mDensity); if (mDensity == 240) { webSettings.setDefaultZoom(ZoomDensity.FAR); } else if (mDensity == 160) { webSettings.setDefaultZoom(ZoomDensity.MEDIUM); } else if (mDensity == 120) { webSettings.setDefaultZoom(ZoomDensity.CLOSE); // }else if(mDensity == DisplayMetrics..DENSITY_XHIGH){ // webSettings.setDefaultZoom(ZoomDensity.FAR); } else if (mDensity == DisplayMetrics.DENSITY_HIGH) { webSettings.setDefaultZoom(ZoomDensity.FAR); } webView.setWebChromeClient(m_chromeClient);// (flash) dialogPress = new AlertDialog.Builder(this).setTitle("").setMessage(":0/0") .setPositiveButton("", new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }).create(); }
From source file:net.evecom.android.web.Web4Activity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mContext = this; temp = HttpUtil.getPageSize(this); setContentView(R.layout.message_post_web); imageView = (ImageView) findViewById(R.id.image_view_at_web); webView = (WebView) this.findViewById(R.id.wv_oauth_message); CookieSyncManager.createInstance(this); CookieSyncManager.getInstance().startSync(); CookieManager.getInstance().removeSessionCookie(); /**/*from w w w .j ava 2s . c om*/ * WebViewJavaScript */ webView.getSettings().setJavaScriptEnabled(true); /** * loadUrl() */ webView.setWebViewClient(new HelloWebViewClient()); dialog = ProgressDialog.show(Web4Activity.this, null, ".."); dialog.setCancelable(true); // http://harlan-pc/fzaj/emergency/mobileWebApp/publicInfo/login.do?userName=zf1&userPwd=1 // webView.loadUrl("http://www.baidu.com"); // String url = HttpUtil.BASE_PC_URL // + "/buildingController/login"; http://harlan-pc/gssms/mobile/ // String url // =HttpUtil.BASE_PC_URL+"loginController/professionalJobLogin"; String url = HttpUtil.BASE_PC_URL + "mobile/loginController/professionalJobLogin"; // post // String postDate = "loginname=sysadmin&pwd=888888"; String postDate = "loginname=" + ShareUtil.getString(getApplicationContext(), "SESSION", "USERNAME", "") + "&pwd=" + ShareUtil.getString(getApplicationContext(), "SESSION", "PASSWORD", "") + "&pageSize=" + temp; // webView.postUrl(url, postData) postDatabyte[] // EncodingUtils.getBytes(data, charset) webView.postUrl(url, EncodingUtils.getBytes(postDate, "BASE64")); // webView.setDownloadListener(new MyWebViewDownLoadListener()); WebSettings webSettings = webView.getSettings(); webSettings.setSupportZoom(true); webSettings.setJavaScriptEnabled(true); webSettings.setJavaScriptCanOpenWindowsAutomatically(true); webSettings.setBuiltInZoomControls(true);// support zoom // webSettings.setPluginsEnabled(true);//support flash webSettings.setUseWideViewPort(true); webSettings.setLoadWithOverviewMode(true); // webSettings.setPluginsEnabled(true); //(flash) /** */ // // webSettings.setDatabaseEnabled(true); String dir = this.getApplicationContext().getDir("database", Context.MODE_PRIVATE).getPath(); // webSettings.setGeolocationEnabled(true); // webSettings.setGeolocationDatabasePath(dir); // webSettings.setDomStorageEnabled(true); DisplayMetrics metrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(metrics); int mDensity = metrics.densityDpi; // DebugLog.d(TAG, "densityDpi = " + mDensity); if (mDensity == 240) { webSettings.setDefaultZoom(ZoomDensity.FAR); } else if (mDensity == 160) { webSettings.setDefaultZoom(ZoomDensity.MEDIUM); } else if (mDensity == 120) { webSettings.setDefaultZoom(ZoomDensity.CLOSE); // }else if(mDensity == DisplayMetrics..DENSITY_XHIGH){ // webSettings.setDefaultZoom(ZoomDensity.FAR); } else if (mDensity == DisplayMetrics.DENSITY_HIGH) { webSettings.setDefaultZoom(ZoomDensity.FAR); } webView.setWebChromeClient(m_chromeClient);// (flash) dialogPress = new AlertDialog.Builder(this).setTitle("").setMessage(":0/0") .setPositiveButton("", new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }).create(); }
From source file:net.evecom.android.web.Web3Activity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mContext = this; temp = HttpUtil.getPageSize(this); setContentView(R.layout.message_post_web); imageView = (ImageView) findViewById(R.id.image_view_at_web); webView = (WebView) this.findViewById(R.id.wv_oauth_message); CookieSyncManager.createInstance(this); CookieSyncManager.getInstance().startSync(); CookieManager.getInstance().removeSessionCookie(); /**// ww w. j a v a 2 s. c om * WebViewJavaScript */ webView.getSettings().setJavaScriptEnabled(true); /** * loadUrl() */ webView.setWebViewClient(new HelloWebViewClient()); dialog = ProgressDialog.show(Web3Activity.this, null, ".."); dialog.setCancelable(true); // http://harlan-pc/fzaj/emergency/mobileWebApp/publicInfo/login.do?userName=zf1&userPwd=1 // http://localhost/gssms/mobile/base/loginController/login?loginname=sysadmin&pwd=888888 // String url = HttpUtil.BASE_PC_URL // + "/base/loginController/login"; // http://localhost/gssms/mobile/loginController/baseLogin?loginname=sysadmin&pwd=888888 String url = HttpUtil.BASE_PC_URL + "mobile/loginController/baseLogin"; // post // String postDate = "loginname=sysadmin&pwd=888888"; String postDate = "loginname=" + ShareUtil.getString(getApplicationContext(), "SESSION", "USERNAME", "") + "&pwd=" + ShareUtil.getString(getApplicationContext(), "SESSION", "PASSWORD", "") + "&pageSize=" + temp; // webView.postUrl(url, postData) postDatabyte[] // EncodingUtils.getBytes(data, charset) webView.postUrl(url, EncodingUtils.getBytes(postDate, "BASE64")); // webView.setDownloadListener(new MyWebViewDownLoadListener()); WebSettings webSettings = webView.getSettings(); webSettings.setSupportZoom(true); webSettings.setJavaScriptEnabled(true); webSettings.setJavaScriptCanOpenWindowsAutomatically(true); webSettings.setBuiltInZoomControls(true);// support zoom // webSettings.setPluginsEnabled(true);//support flash webSettings.setUseWideViewPort(true); webSettings.setLoadWithOverviewMode(true); // webSettings.setPluginsEnabled(true); //(flash) /** */ // // webSettings.setDatabaseEnabled(true); String dir = this.getApplicationContext().getDir("database", Context.MODE_PRIVATE).getPath(); // webSettings.setGeolocationEnabled(true); // webSettings.setGeolocationDatabasePath(dir); // webSettings.setDomStorageEnabled(true); DisplayMetrics metrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(metrics); int mDensity = metrics.densityDpi; // DebugLog.d(TAG, "densityDpi = " + mDensity); if (mDensity == 240) { webSettings.setDefaultZoom(ZoomDensity.FAR); } else if (mDensity == 160) { webSettings.setDefaultZoom(ZoomDensity.MEDIUM); } else if (mDensity == 120) { webSettings.setDefaultZoom(ZoomDensity.CLOSE); // }else if(mDensity == DisplayMetrics..DENSITY_XHIGH){ // webSettings.setDefaultZoom(ZoomDensity.FAR); } else if (mDensity == DisplayMetrics.DENSITY_HIGH) { webSettings.setDefaultZoom(ZoomDensity.FAR); } webView.setWebChromeClient(m_chromeClient);// (flash) dialogPress = new AlertDialog.Builder(this).setTitle("").setMessage(":0/0") .setPositiveButton("", new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }).create(); }
From source file:net.evecom.android.web.WebdbActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mContext = this; temp = HttpUtil.getPageSize(this); setContentView(R.layout.message_post_web); imageView = (ImageView) findViewById(R.id.image_view_at_web); webView = (WebView) this.findViewById(R.id.wv_oauth_message); CookieSyncManager.createInstance(this); CookieSyncManager.getInstance().startSync(); CookieManager.getInstance().removeSessionCookie(); /**/*from ww w .j a va 2s . co m*/ * WebViewJavaScript */ webView.getSettings().setJavaScriptEnabled(true); /** * loadUrl() */ HelloWebViewClient client = new HelloWebViewClient(); webView.setWebViewClient(client); dialog = ProgressDialog.show(WebdbActivity.this, null, ".."); dialog.setCancelable(true); // http://harlan-pc/fzaj/emergency/mobileWebApp/publicInfo/login.do?userName=zf1&userPwd=1 // webView.loadUrl("http://www.baidu.com"); // String url = HttpUtil.BASE_PC_URL // String url =HttpUtil.BASE_PC_URL+"loginController/messageLogin"; String url = HttpUtil.BASE_PC_URL + "mobile/loginController/eventlistLogin"; // post // http://wangzy:8081/gssms/mobile/loginController/eventlistLogin?loginname=sysadmin&pwd=888888 // String postDate = "loginname=sysadmin&pwd=888888"; String postDate = "loginname=" + ShareUtil.getString(getApplicationContext(), "SESSION", "USERNAME", "") + "&pwd=" + ShareUtil.getString(getApplicationContext(), "SESSION", "PASSWORD", "") + "&pageSize=" + temp; // webView.postUrl(url, postData) postDatabyte[] // EncodingUtils.getBytes(data, charset) webView.postUrl(url, EncodingUtils.getBytes(postDate, "BASE64")); // webView.setDownloadListener(new MyWebViewDownLoadListener()); WebSettings webSettings = webView.getSettings(); webSettings.setSupportZoom(true); webSettings.setJavaScriptEnabled(true); webSettings.setJavaScriptCanOpenWindowsAutomatically(true); webSettings.setBuiltInZoomControls(true);// support zoom // webSettings.setPluginsEnabled(true);//support flash webSettings.setUseWideViewPort(true); webSettings.setLoadWithOverviewMode(true); // webSettings.setPluginsEnabled(true); //(flash) /** */ // // webSettings.setDatabaseEnabled(true); String dir = this.getApplicationContext().getDir("database", Context.MODE_PRIVATE).getPath(); // webSettings.setGeolocationEnabled(true); // webSettings.setGeolocationDatabasePath(dir); // webSettings.setDomStorageEnabled(true); DisplayMetrics metrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(metrics); int mDensity = metrics.densityDpi; // DebugLog.d(TAG, "densityDpi = " + mDensity); if (mDensity == 240) { webSettings.setDefaultZoom(ZoomDensity.FAR); } else if (mDensity == 160) { webSettings.setDefaultZoom(ZoomDensity.MEDIUM); } else if (mDensity == 120) { webSettings.setDefaultZoom(ZoomDensity.CLOSE); // }else if(mDensity == DisplayMetrics..DENSITY_XHIGH){ // webSettings.setDefaultZoom(ZoomDensity.FAR); } else if (mDensity == DisplayMetrics.DENSITY_HIGH) { webSettings.setDefaultZoom(ZoomDensity.FAR); } webView.setWebChromeClient(m_chromeClient);// (flash) dialogPress = new AlertDialog.Builder(this).setTitle("").setMessage(":0/0") .setPositiveButton("", new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }).create(); }
From source file:org.ounl.lifelonglearninghub.learntracker.gis.ou.db.charts.PieChartActivity.java
private void applySize() { switch (getResources().getDisplayMetrics().densityDpi) { case Constants.DENSITY_XXHIGH: renderer.setMargins(new int[] { 50, 130, 30, 10 }); // renderer.setAxisTitleTextSize(Constants.TEXT_SIZE_XXHDPI); renderer.setChartTitleTextSize(Constants.TEXT_SIZE_XXXHDPI); renderer.setLabelsTextSize(Constants.TEXT_SIZE_XXHDPI); renderer.setLegendTextSize(Constants.TEXT_SIZE_XXHDPI); break;/* w ww . jav a2 s .c o m*/ case DisplayMetrics.DENSITY_XHIGH: renderer.setMargins(new int[] { 40, 90, 25, 10 }); // renderer.setAxisTitleTextSize(Constants.TEXT_SIZE_XHDPI); renderer.setChartTitleTextSize(Constants.TEXT_SIZE_XHDPI); renderer.setLabelsTextSize(Constants.TEXT_SIZE_XHDPI); renderer.setLegendTextSize(Constants.TEXT_SIZE_XHDPI); break; case DisplayMetrics.DENSITY_HIGH: renderer.setMargins(new int[] { 30, 50, 20, 10 }); // renderer.setAxisTitleTextSize(Constants.TEXT_SIZE_HDPI); renderer.setChartTitleTextSize(Constants.TEXT_SIZE_HDPI); renderer.setLabelsTextSize(Constants.TEXT_SIZE_HDPI); renderer.setLegendTextSize(Constants.TEXT_SIZE_HDPI); break; default: renderer.setMargins(new int[] { 30, 50, 20, 10 }); // renderer.setAxisTitleTextSize(Constants.TEXT_SIZE_LDPI); renderer.setChartTitleTextSize(Constants.TEXT_SIZE_LDPI); renderer.setLabelsTextSize(Constants.TEXT_SIZE_LDPI); renderer.setLegendTextSize(Constants.TEXT_SIZE_LDPI); break; } }
From source file:com.landenlabs.all_devtool.ScreenFragment.java
void updateView() { m_displayMetrics = Utils.getDisplayMetrics(m_context); m_layout = Ui.viewById(m_rootView, R.id.screen_layout); m_screenDevice = Ui.viewById(m_rootView, R.id.screen_device); TextView screenSizeText = Ui.viewById(m_rootView, R.id.screen_size); TextView screenDensityText = Ui.viewById(m_rootView, R.id.screen_density); m_screenDevice.setText(Build.MODEL); int widthPx = m_displayMetrics.widthPixels; int heightPx = m_displayMetrics.heightPixels; String sizeStr = String.format(Locale.getDefault(), "%.0f dp x %.0f dp\n%d px x %d px\n%.1f in x %.1f in", Utils.pxToDp(widthPx), Utils.pxToDp(heightPx), widthPx, heightPx, (float) widthPx / m_displayMetrics.densityDpi, (float) heightPx / m_displayMetrics.densityDpi); screenSizeText.setText(sizeStr);/*from ww w . j av a2 s. c o m*/ String densityStr = "Low"; if (m_displayMetrics.densityDpi <= DisplayMetrics.DENSITY_MEDIUM) densityStr = "Medium"; else if (m_displayMetrics.densityDpi <= DisplayMetrics.DENSITY_HIGH) densityStr = "High"; else if (m_displayMetrics.densityDpi <= DisplayMetrics.DENSITY_XHIGH) densityStr = "x-High"; else if (m_displayMetrics.densityDpi <= DisplayMetrics.DENSITY_XXHIGH) densityStr = "xx-High"; else if (m_displayMetrics.densityDpi > DisplayMetrics.DENSITY_XXHIGH) densityStr = "xxx-High"; screenDensityText.setText(String.format("Density %s(%d) px/dp=%.2f", densityStr, m_displayMetrics.densityDpi, m_displayMetrics.density)); m_horzWindowArrow = Ui.viewById(m_rootView, R.id.horz_arrow); m_vertPanelArrow = Ui.viewById(m_rootView, R.id.vert_panel_arrow); m_horzWindowText = Ui.viewById(m_rootView, R.id.horz_arrow_text); m_vertPanelText = Ui.viewById(m_rootView, R.id.vert_panel_text); TextView themeTv = Ui.viewById(m_rootView, R.id.theme); // themeTv.setRotation(-90); String themeName = GlobalInfo.s_globalInfo.themeName; if (!themeName.equals("Theme.Holo")) themeName = themeName + "\nBest with Theme.Halo"; themeTv.setText(themeName); /* * Dynamically get theme - always returns 'AppTheme' which is set in style try { PackageInfo packageInfo = getActivity().getPackageManager().getPackageInfo(GlobalInfo.s_globalInfo.pkgName, 0); int themeResId = packageInfo.applicationInfo.theme; String themeName = getResources().getResourceEntryName(themeResId); themeTv.setText(themeName); } catch (Exception ex) { themeTv.setVisibility(View.GONE); } */ Message msgObj = m_handler.obtainMessage(MSG_GET_UI_SIZE); m_handler.sendMessageDelayed(msgObj, 1000); final TextView touchPos = Ui.viewById(m_rootView, R.id.touch_pos); m_drawPoints = Ui.viewById(m_rootView, R.id.drawPoints); m_drawPoints.setOnTouchInfo(new DrawView.TouchInfo() { public void onTouchInfo(MotionEvent event) { touchPos.setText(String.format("%.0f,%.0f", event.getX(), event.getY())); } }); }
From source file:ca.mymenuapp.ui.debug.DebugAppContainer.java
private static String getDensityString(DisplayMetrics displayMetrics) { switch (displayMetrics.densityDpi) { case DisplayMetrics.DENSITY_LOW: return "ldpi"; case DisplayMetrics.DENSITY_MEDIUM: return "mdpi"; case DisplayMetrics.DENSITY_HIGH: return "hdpi"; case DisplayMetrics.DENSITY_XHIGH: return "xhdpi"; case DisplayMetrics.DENSITY_XXHIGH: return "xxhdpi"; case DisplayMetrics.DENSITY_XXXHIGH: return "xxxhdpi"; case DisplayMetrics.DENSITY_TV: return "tvdpi"; default:/*from w w w . j a va2s . co m*/ return "unknown"; } }
From source file:com.photon.phresco.nativeapp.eshop.activity.PhrescoActivity.java
/** * The screen density expressed as dpi//w w w . jav a2s.c om * * @return int * * @return May be either DENSITY_LOW, DENSITY_MEDIUM, or DENSITY_HIGH. */ protected int getScreenDensity() { int screenDensity = 0; try { getWindowManager().getDefaultDisplay().getMetrics(metrics); switch (metrics.densityDpi) { case DisplayMetrics.DENSITY_LOW: PhrescoLogger.info(TAG + "DENSITY_LOW"); break; case DisplayMetrics.DENSITY_MEDIUM: PhrescoLogger.info(TAG + "DENSITY_MEDIUM"); break; case DisplayMetrics.DENSITY_HIGH: PhrescoLogger.info(TAG + "DENSITY_HIGH"); break; case DisplayMetrics.DENSITY_XHIGH: PhrescoLogger.info(TAG + "DENSITY_EXTRA_HIGH"); break; } PhrescoLogger.info(TAG + "densityDpi: " + metrics.densityDpi); PhrescoLogger.info(TAG + "density: " + metrics.density); PhrescoLogger.info(TAG + "heightPixels: " + metrics.heightPixels); PhrescoLogger.info(TAG + "widthPixels: " + metrics.widthPixels); screenDensity = metrics.densityDpi; } catch (Exception ex) { PhrescoLogger.info(TAG + "getScreenDensity: Exception: " + ex.toString()); PhrescoLogger.warning(ex); } return screenDensity; }
From source file:dentex.youtube.downloader.YTD.java
private double detectScreenDensity() { DisplayMetrics displayMetrics = new DisplayMetrics(); ((WindowManager) getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay().getMetrics(displayMetrics); double rf = 1; int density = displayMetrics.densityDpi; switch (density) { case DisplayMetrics.DENSITY_HIGH: rf = 1.44;//from w w w. j a v a2 s . c o m break; case DisplayMetrics.DENSITY_MEDIUM: rf = 2; break; case DisplayMetrics.DENSITY_LOW: rf = 3; } Log.d(DEBUG_TAG, "DispalyDensity: " + density + " - storing a REDUCE_FACTOR of " + rf + " into prefs"); settings.edit().putString("REDUCE_FACTOR", String.valueOf(rf)).apply(); ; return rf; }