List of usage examples for android.util DisplayMetrics DisplayMetrics
public DisplayMetrics()
From source file:com.scooter1556.sms.androidtv.fragment.AudioDirectoryDetailsFragment.java
private void prepareBackgroundManager() { // Setup background manager backgroundManager = BackgroundManager.getInstance(getActivity()); backgroundManager.attach(getActivity().getWindow()); // Get default background defaultBackground = getResources().getDrawable(R.drawable.default_background, null); backgroundManager.setDrawable(defaultBackground); // Get screen size displayMetrics = new DisplayMetrics(); getActivity().getWindowManager().getDefaultDisplay().getMetrics(displayMetrics); }
From source file:net.evecom.android.web.Web2Activity.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. jav a2s .c om*/ * WebViewJavaScript */ webView.getSettings().setJavaScriptEnabled(true); /** * loadUrl() */ webView.setWebViewClient(new HelloWebViewClient()); dialog = ProgressDialog.show(Web2Activity.this, null, ".."); dialog.setCancelable(true); // http://localhost/gssms/mobile/loginController/dailyOfficeLogin?loginname=sysadmin&pwd=888888 String url = HttpUtil.BASE_PC_URL + "mobile/loginController/dailyOfficeLogin"; // 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:com.jelly.music.player.LauncherActivity.LauncherActivity.java
@SuppressLint("NewApi") @Override/*w w w.java 2 s . c om*/ public void onCreate(Bundle savedInstanceState) { Parse.initialize(this, "aZiGV1G02m1Mj3SaaD9riuyrucDclK7abpc2Ibz3", "eCPoMrWrFnnHPVmBbDDIAFAMTA5EJLgtHLS2U9St"); Map<String, String> dimensions = new HashMap<String, String>(); // What type of news is this? dimensions.put("category", "politics"); // Is it a weekday or the weekend? dimensions.put("dayType", "weekday"); // Send the dimensions to Parse along with the 'read' event ParseAnalytics.trackEvent("read", dimensions); setTheme(R.style.AppThemeNoActionBar); super.onCreate(savedInstanceState); setContentView(R.layout.activity_launcher); mContext = this; mActivity = this; mApp = (Common) mContext.getApplicationContext(); mHandler = new Handler(); //Increment the start count. This value will be used to determine when the library should be rescanned. int startCount = mApp.getSharedPreferences().getInt("START_COUNT", 1); mApp.getSharedPreferences().edit().putInt("START_COUNT", startCount + 1).commit(); //Save the dimensions of the layout for later use on KitKat devices. final RelativeLayout launcherRootView = (RelativeLayout) findViewById(R.id.launcher_root_view); launcherRootView.getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener() { @Override public void onGlobalLayout() { try { int screenDimens[] = new int[2]; int screenHeight = 0; int screenWidth = 0; if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) { //API levels 14, 15 and 16. screenDimens = getTrueDeviceResolution(); screenWidth = screenDimens[0]; screenHeight = screenDimens[1]; } else { //API levels 17+. Display display = getWindowManager().getDefaultDisplay(); DisplayMetrics metrics = new DisplayMetrics(); display.getRealMetrics(metrics); screenHeight = metrics.heightPixels; screenWidth = metrics.widthPixels; } int layoutHeight = launcherRootView.getHeight(); int layoutWidth = launcherRootView.getWidth(); int extraHeight = screenHeight - layoutHeight; int extraWidth = screenWidth = layoutWidth; mApp.getSharedPreferences().edit().putInt("KITKAT_HEIGHT", layoutHeight).commit(); mApp.getSharedPreferences().edit().putInt("KITKAT_WIDTH", layoutWidth).commit(); mApp.getSharedPreferences().edit().putInt("KITKAT_HEIGHT_LAND", layoutWidth - extraHeight) .commit(); mApp.getSharedPreferences().edit().putInt("KITKAT_WIDTH_LAND", screenHeight).commit(); } catch (Exception e) { e.printStackTrace(); } } }); //Build the music library based on the user's scan frequency preferences. int scanFrequency = mApp.getSharedPreferences().getInt("SCAN_FREQUENCY", 5); int updatedStartCount = mApp.getSharedPreferences().getInt("START_COUNT", 1); //Launch the appropriate activity based on the "FIRST RUN" flag. if (mApp.getSharedPreferences().getBoolean(Common.FIRST_RUN, true) == true) { //Create the default Playlists directory if it doesn't exist. File playlistsDirectory = new File(Environment.getExternalStorageDirectory() + "/Playlists/"); if (!playlistsDirectory.exists() || !playlistsDirectory.isDirectory()) { playlistsDirectory.mkdir(); } //Disable equalizer for HTC devices by default. if (mApp.getSharedPreferences().getBoolean(Common.FIRST_RUN, true) == true && Build.PRODUCT.contains("HTC")) { mApp.getSharedPreferences().edit().putBoolean("EQUALIZER_ENABLED", false).commit(); } //Send out a test broadcast to initialize the homescreen/lockscreen widgets. sendBroadcast(new Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_HOME)); Intent intent = new Intent(this, WelcomeActivity.class); startActivity(intent); overridePendingTransition(R.anim.fade_in, R.anim.fade_out); } else if (mApp.isBuildingLibrary()) { buildingLibraryMainText = (TextView) findViewById(R.id.building_music_library_text); buildingLibraryInfoText = (TextView) findViewById(R.id.building_music_library_info); buildingLibraryLayout = (RelativeLayout) findViewById(R.id.building_music_library_layout); buildingLibraryInfoText.setTypeface(TypefaceHelper.getTypeface(mContext, "RobotoCondensed-Light")); buildingLibraryInfoText.setPaintFlags( buildingLibraryInfoText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG); buildingLibraryMainText.setTypeface(TypefaceHelper.getTypeface(mContext, "RobotoCondensed-Light")); buildingLibraryMainText.setPaintFlags( buildingLibraryMainText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG); buildingLibraryMainText.setText(R.string.jams_is_building_library); buildingLibraryLayout.setVisibility(View.VISIBLE); //Initialize the runnable that will fire once the scan process is complete. mHandler.post(scanFinishedCheckerRunnable); } else if (mApp.getSharedPreferences().getBoolean("RESCAN_ALBUM_ART", false) == true) { buildingLibraryMainText = (TextView) findViewById(R.id.building_music_library_text); buildingLibraryInfoText = (TextView) findViewById(R.id.building_music_library_info); buildingLibraryLayout = (RelativeLayout) findViewById(R.id.building_music_library_layout); buildingLibraryInfoText.setTypeface(TypefaceHelper.getTypeface(mContext, "RobotoCondensed-Light")); buildingLibraryInfoText.setPaintFlags( buildingLibraryInfoText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG); buildingLibraryMainText.setTypeface(TypefaceHelper.getTypeface(mContext, "RobotoCondensed-Light")); buildingLibraryMainText.setPaintFlags( buildingLibraryMainText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG); buildingLibraryMainText.setText(R.string.jams_is_caching_artwork); initScanProcess(0); } else if ((mApp.getSharedPreferences().getBoolean("REBUILD_LIBRARY", false) == true) || (scanFrequency == 0 && mApp.isScanFinished() == false) || (scanFrequency == 1 && mApp.isScanFinished() == false && updatedStartCount % 3 == 0) || (scanFrequency == 2 && mApp.isScanFinished() == false && updatedStartCount % 5 == 0) || (scanFrequency == 3 && mApp.isScanFinished() == false && updatedStartCount % 10 == 0) || (scanFrequency == 4 && mApp.isScanFinished() == false && updatedStartCount % 20 == 0)) { buildingLibraryMainText = (TextView) findViewById(R.id.building_music_library_text); buildingLibraryInfoText = (TextView) findViewById(R.id.building_music_library_info); buildingLibraryLayout = (RelativeLayout) findViewById(R.id.building_music_library_layout); buildingLibraryInfoText.setTypeface(TypefaceHelper.getTypeface(mContext, "RobotoCondensed-Light")); buildingLibraryInfoText.setPaintFlags( buildingLibraryInfoText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG); buildingLibraryMainText.setTypeface(TypefaceHelper.getTypeface(mContext, "RobotoCondensed-Light")); buildingLibraryMainText.setPaintFlags( buildingLibraryMainText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG); initScanProcess(1); } else { //Check if this activity was called from Settings. if (getIntent().hasExtra("UPGRADE")) { if (getIntent().getExtras().getBoolean("UPGRADE") == true) { mExplicitShowTrialFragment = true; } else { mExplicitShowTrialFragment = false; } } //initInAppBilling(); launchMainActivity(); } //Fire away a report to Google Analytics. try { if (mApp.isGoogleAnalyticsEnabled() == true) { EasyTracker easyTracker = EasyTracker.getInstance(this); easyTracker.send(MapBuilder.createEvent("Jelly startup.", // Event category (required) "User started Jelly.", // Event action (required) "User started Jelly.", // Event label null) // Event value .build()); } } catch (Exception e) { e.printStackTrace(); } }
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 ww w.j a va2s . 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(); /**//from w w w . ja va2 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:com.sinelead.car.club.NewsFragment.java
private void initImages() { viewPager = (AutoScrollViewPager) bannerView.findViewById(R.id.view_pager); // //from www . j a va 2 s . com DisplayMetrics dm = new DisplayMetrics(); ((Activity) context).getWindowManager().getDefaultDisplay().getMetrics(dm); viewPager.setLayoutParams(new LayoutParams(dm.widthPixels, (int) (dm.widthPixels / 1.68))); bannerText = (TextView) bannerView.findViewById(R.id.text_banner); imagePagerAdapter = new ImagePagerAdapter(context, bannerList).setInfiniteLoop(false); viewPager.setAdapter(imagePagerAdapter); viewPager.setInterval(6000); // 6 viewPager.startAutoScroll(); viewPager.setCurrentItem(0); // viewPager.setSlideBorderMode(AutoScrollViewPager.SLIDE_BORDER_MODE_TO_PARENT); indicator = (CirclePageIndicator) bannerView.findViewById(R.id.indicator); indicator.setViewPager(viewPager); indicator.setOnPageChangeListener(new ImageOnPageChangeListener()); viewPager.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { ToastUtils.show(context, R.string.drop_down_tip); // activity,url Intent intent = new Intent(); intent.putExtra("url", currentImageUrl); /* intent */ intent.setClass(context, XinchepingActivity.class); /* Activity */ context.startActivity(intent); } }); }
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 ww.j a v a2 s. co m * 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(); /**//from w w w .ja v a 2 s. c o m * 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 w ww .j av a 2 s . c om * 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:app.sunstreak.yourpisd.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); toolbar = (Toolbar) findViewById(R.id.toolbar); if (toolbar != null) { setSupportActionBar(toolbar);/*w w w .jav a 2s .co m*/ } // Find the screen height/width DisplayMetrics displaymetrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(displaymetrics); SCREEN_HEIGHT = displaymetrics.heightPixels; SCREEN_WIDTH = displaymetrics.widthPixels; session = ((YPApplication) getApplication()).session; // Create the adapter that will return a fragment for each of the three // primary sections of the app. FragmentManager fm = getSupportFragmentManager(); mSectionsPagerAdapter = new SectionsPagerAdapter(fm); // Set up the ViewPager with the sections adapter. mViewPager = (ViewPager) findViewById(R.id.pager); /* Deprecated as of 1/13/2015. @Han Li */ // setUpTabs(); setUpNavigationDrawer(); AppRater.app_launched(this); mFragments = new YPMainFragment[NUM_FRAGMENTS]; // Opens Spring semester summary by default. currentSummaryFragment = 1; for (int position = 0; position < NUM_FRAGMENTS; position++) { if (position == SUMMARY_FRAGMENT_POSITION) { mFragments[position] = new PlaceholderFragment(); } // else if (position == ATTENDANCE_FRAGMENT_POSITION) { // mFragments[position] = new AttendanceFragment(); // } else { mFragments[position] = new MainActivityFragment(); Bundle args = new Bundle(); args.putInt(MainActivityFragment.ARG_OBJECT, position); mFragments[position].setArguments(args); } } mViewPager.setAdapter(mSectionsPagerAdapter); // setUpMaterialTabs(); // For parents with multiple students, show the profile cards first. // If we are coming back from ClassSwipeActivity, go to requested // section (should be section #1). if (session.MULTIPLE_STUDENTS) { if (getIntent().hasExtra("mainActivitySection")) mViewPager.setCurrentItem(getIntent().getExtras().getInt("mainActivitySection")); else mViewPager.setCurrentItem(0); } // Otherwise, show the current six weeks grades list. else mViewPager.setCurrentItem(1); isAttendanceLoaded = false; MyTextView.typeface = Typeface.createFromAsset(getAssets(), "Roboto-Light.ttf"); if (DateHelper.isAprilFools()) { setUpTroll(); } }