List of usage examples for android.view Display getSize
public void getSize(Point outSize)
From source file:com.openatk.planting.MainActivity.java
private void SliderGrow() { Display display = getWindowManager().getDefaultDisplay(); Point size = new Point(); display.getSize(size); int oneThirdHeight = size.y / 3; int actionBarHeight = 10; TypedValue tv = new TypedValue(); if (getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true)) { actionBarHeight = TypedValue.complexToDimensionPixelSize(tv.data, getResources().getDisplayMetrics()); }/*from w ww . ja va 2 s .com*/ if (fragmentEditField != null) { RelativeLayout relAdd = (RelativeLayout) fragmentEditField.getView().findViewById(R.id.slider_layMenu); RelativeLayout relBottomBar = (RelativeLayout) fragmentEditField.getView() .findViewById(R.id.edit_field_layInfo3); Log.d("layMenu:", Integer.toString(relAdd.getHeight())); ScrollView sv = (ScrollView) fragmentEditField.getView().findViewById(R.id.slider_scrollView); RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) sv.getLayoutParams(); if (sliderPosition == 0) { //Small -> Middle DropDownAnim an = new DropDownAnim(sv, params.height, oneThirdHeight); an.setDuration(300); sv.startAnimation(an); sliderPosition = 1; } else if (sliderPosition == 1) { //Middle -> Fullscreen DropDownAnim an = new DropDownAnim(sv, params.height, (fragMap.getView().getHeight() - relAdd.getHeight() - relBottomBar.getHeight())); Log.d("fullslider", "Full slider" + Integer.toString(relBottomBar.getHeight())); an.setDuration(300); sv.startAnimation(an); sliderPosition = 2; } sv.setLayoutParams(params); } }
From source file:com.aimfire.gallery.GalleryActivity.java
@SuppressWarnings("deprecation") private void initViewPager() { if (BuildConfig.DEBUG) if (VERBOSE) Log.d(TAG, "initViewPager"); Display display = getWindowManager().getDefaultDisplay(); Point size = new Point(); display.getSize(size); mViewPager = (ViewPager) findViewById(R.id.view_pager); mViewPager.setAdapter(new MediaPagerAdapter(this, size.x, size.y)); mViewPager.setOnTouchListener(otl);// w w w . j a v a 2 s . c om mViewPager.setOnPageChangeListener(opcl); mViewPager.setOffscreenPageLimit(MAX_PAGE); }
From source file:es.javocsoft.android.lib.toolbox.ToolBox.java
/** * Gets the device screen size in pixels. * /*from www .java2s . c o m*/ * @param context * @return */ @SuppressWarnings("deprecation") @SuppressLint("NewApi") public static Point device_screenSize(Context context) { Display display = ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay(); final Point size = new Point(); try { display.getSize(size); } catch (NoSuchMethodError ignore) { // Older device size.x = display.getWidth(); size.y = display.getHeight(); } return size; }
From source file:com.ezac.gliderlogs.FlightOverviewActivity.java
public void DoInfo() { try {/*from ww w.ja va 2s .c om*/ /* First, get the Display from the WindowManager */ Display display = ((WindowManager) getSystemService(WINDOW_SERVICE)).getDefaultDisplay(); /* Now we can retrieve all display-related infos */ Point size = new Point(); display.getSize(size); PackageManager manager = this.getPackageManager(); PackageInfo info = manager.getPackageInfo(this.getPackageName(), 0); makeToast("PackageName = " + info.packageName + "\nVersionName = " + info.versionName + "\nAndroid version " + Build.VERSION.RELEASE + "\nScreen size = " + size.x + "x" + size.y + "\nDevelopment: (2013-2016)" + "\n Android - P. van der Wielen (Ezac)" + "\n Web Site - E. Fekkes (Ezac)", 0); Log.d(TAG, "Name " + info.versionName + ", Code " + info.versionCode); } catch (NameNotFoundException pkg) { Log.d(TAG, "unable to get app version info !" + pkg.getMessage()); } finally { ; } }
From source file:com.gigabytedevelopersinc.app.calculator.Calculator.java
public void showFirstRunSimpleCling(boolean animate) { // Enable the clings only if they have not been dismissed before if (isClingsEnabled() && !CalculatorSettings.isDismissed(getContext(), Cling.SIMPLE_CLING_DISMISSED_KEY)) { Display display = getWindowManager().getDefaultDisplay(); Point size = new Point(); display.getSize(size); int[] location = new int[3]; location[0] = 0;/*from w w w.j a v a 2 s . c o m*/ location[1] = size.y / 2; location[2] = 10; initCling(R.id.simple_cling, location, 0, true, animate); } else { removeCling(R.id.simple_cling); } }
From source file:com.android.leanlauncher.Workspace.java
/** * Initializes various states for this workspace. *///from ww w. j a v a2 s .c o m protected void initWorkspace() { LauncherAppState app = LauncherAppState.getInstance(); mIconCache = app.getIconCache(); setWillNotDraw(false); setClipChildren(true); setClipToPadding(false); setChildrenDrawnWithCacheEnabled(true); setupLayoutTransition(); Display display = mLauncher.getWindowManager().getDefaultDisplay(); display.getSize(mDisplaySize); }
From source file:com.homeworkreminder.Main.java
@Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); registerReceiver(dateReceiver, intentFilter); setContentView(R.layout.home);/*from w w w . j av a2s . c o m*/ inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); context = this; prefs = PreferenceManager.getDefaultSharedPreferences(context); theme = new ThemeManager(this) { @Override public void setColor(ColorScheme scheme) { // TODO Auto-generated method stub mDrawerList.setBackgroundColor(scheme.getUltraDarkColor()); mDrawerList.setSelector(new ColorDrawable(scheme.getNormalColor())); actionBar.setBackgroundDrawable(new ColorDrawable(scheme.getSuperDarkColor())); actionBarExtension.setBackgroundColor(scheme.getSuperDarkColor()); actionBarExtension.getChildAt(0).setBackgroundColor(scheme.getSuperDarkColor()); setColorComboForActionBar(scheme.getColorName()); if (Build.VERSION.SDK_INT >= 11) { VersionHelper.refreshActionBarMenu(activity); } } }; main_content = (RelativeLayout) findViewById(R.id.main_content_screen); actionBarExtension = (RelativeLayout) findViewById(R.id.actionbar_extension); main_container = (RelativeLayout) findViewById(R.id.main_container); notask_notify = (RelativeLayout) findViewById(R.id.notask_notify); notask = (TextView) findViewById(R.id.tv_notask); actionBarExtension.setVisibility(View.VISIBLE); caldroidFragment = new CaldroidFragment(); if (savedInstanceState != null) { caldroidFragment.restoreStatesFromKey(savedInstanceState, "CALDROID_SAVED_STATE"); } else { Bundle args = new Bundle(); Calendar cal = Calendar.getInstance(); args.putInt(CaldroidFragment.MONTH, cal.get(Calendar.MONTH) + 1); args.putInt(CaldroidFragment.YEAR, cal.get(Calendar.YEAR)); args.putBoolean(CaldroidFragment.ENABLE_SWIPE, true); args.putBoolean(CaldroidFragment.SIX_WEEKS_IN_CALENDAR, true); caldroidFragment.setArguments(args); } actionBar = getActionBar(); getActionBar().setHomeButtonEnabled(true); getActionBar().setIcon(R.drawable.ic_drawer); prevScreen = 0; firstStart = true; drawerAdapter = new DrawerListAdapter(this); DrawerItems = getResources().getStringArray(R.array.home_drawer); mDrawerLayout = (DrawerLayout) findViewById(R.id.home_drawer); mDrawerList = (ListView) findViewById(R.id.nav_drawer); mDrawerList.setAdapter(drawerAdapter); SharedPreferences getPrefs = PreferenceManager.getDefaultSharedPreferences(this); int startupscreen = Integer.parseInt(getPrefs.getString("Startup_screen", "0")); UpcomingDate = Integer.parseInt(getPrefs.getString("Upcoming_date", "7")); mDrawerList.setOnItemClickListener(new DrawerItemClickListener()); mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.drawable.home, R.string.drawer_open, R.string.drawer_close) { /** Called when a drawer has settled in a completely closed state. */ public void onDrawerClosed(View view) { super.onDrawerClosed(view); getActionBar().setTitle(mTitle); invalidateOptionsMenu(); } /** Called when a drawer has settled in a completely open state. */ public void onDrawerOpened(View drawerView) { super.onDrawerOpened(drawerView); getActionBar().setTitle(mDrawerTitle); invalidateOptionsMenu(); } }; mDrawerLayout.setDrawerListener(mDrawerToggle); Database = new CoreDatabase(this); swipelistview = (SwipeListView) findViewById(R.id.example_swipe_lv_list); swipelistview.setVisibility(View.GONE); subjectlistview = (ExpandableListView) findViewById(R.id.subject_listview); // add_subject_btn = (ImageButton) findViewById(R.id.add_subject_btn); subjectlistview.setVisibility(View.GONE); // add_subject_btn.setVisibility(View.GONE); notask.setText("Loading"); TaskHolder = Database.getAllTask("Pending"); Collections.sort(TaskHolder, new Comparator<Task>() { public int compare(Task o1, Task o2) { return o1.getDue().compareTo(o2.getDue()); } }); generateTaskMap(TaskHolder); // get subjects subjectArray = Database.querySubjectList(); subjectArray.add(0, DEFAULT_SUBJECT); generateSubjectMap(); Completed = Database.getAllTask("Completed"); adapter = new ItemAdapter(this, R.layout.custom_row, TaskHolder, swipelistview, prefs.getString("Color_scheme", "Default")); subject_adapter = new SubjectListAdapter(this, subjectArray, SubjectMap, subjectlistview); swipelistview.setSwipeListViewListener(new BaseSwipeListViewListener() { @Override public void onOpened(int position, boolean toRight) { } @Override public void onClosed(int position, boolean fromRight) { } @Override public void onListChanged() { } @Override public void onMove(int position, float x) { } @Override public void onStartOpen(int position, int action, boolean right) { } @Override public void onStartClose(int position, boolean right) { } @Override public void onClickFrontView(int position) { if (swipelistview.isOpen(position)) { swipelistview.openAnimate(position); } } @Override public void onClickBackView(int position) { } @Override public void onDismiss(int[] reverseSortedPositions) { } }); // These are the swipe listview settings. you can change these // setting as your requirement Display display = getWindowManager().getDefaultDisplay(); Point size = new Point(); display.getSize(size); DisplayMetrics outMetrics = new DisplayMetrics(); display.getMetrics(outMetrics); float density = getResources().getDisplayMetrics().density; dpWidth = outMetrics.widthPixels / density; swipelistview.setSwipeMode(SwipeListView.SWIPE_MODE_LEFT); // modes swipelistview.setSwipeActionLeft(SwipeListView.SWIPE_ACTION_REVEAL); swipelistview.setOffsetLeft(Util.convertDpToPixel(dpWidth - 180 + 10, this)); // left side offset swipelistview.setOffsetRight(0); // right side offset swipelistview.setAnimationTime(300); // animation time swipelistview.setSwipeOpenOnLongPress(false); swipelistview.setAdapter(adapter); main_container.setBackgroundColor(context.getResources().getColor(R.color.pure_white)); if (startupscreen == 0) { mDrawerList.performItemClick(mDrawerList.getChildAt(0), 0, mDrawerList.getItemIdAtPosition(0)); } else if (startupscreen == 1) { mDrawerList.performItemClick(mDrawerList.getChildAt(1), 1, mDrawerList.getItemIdAtPosition(1)); } else if (startupscreen == 2) { mDrawerList.performItemClick(mDrawerList.getChildAt(2), 2, mDrawerList.getItemIdAtPosition(2)); } else if (startupscreen == 3) { mDrawerList.performItemClick(mDrawerList.getChildAt(3), 3, mDrawerList.getItemIdAtPosition(3)); } else if (startupscreen == 4) { mDrawerList.performItemClick(mDrawerList.getChildAt(4), 4, mDrawerList.getItemIdAtPosition(4)); } else { mDrawerList.performItemClick(mDrawerList.getChildAt(0), 0, mDrawerList.getItemIdAtPosition(0)); } firstStart = false; alarmHandler = new AlarmHandler(this); scheduleClient = new ScheduleClient(this.getApplicationContext()); scheduleClient.doBindService(); this.initActionBarExtension(); theme.loadColorScheme(PreferenceManager.getDefaultSharedPreferences(this)); }
From source file:com.bookkos.bircle.CaptureActivity.java
@Override public void onCreate(Bundle icicle) { super.onCreate(icicle); _context = getApplicationContext();//from ww w. j a v a 2s. c o m _activity = this; currentTime = new Time("Asia/Tokyo"); // exceptionHandler = new ExceptionHandler(_context); // Thread.setDefaultUncaughtExceptionHandler(exceptionHandler); // sharedPreference???, user_id?group_id?registration_id?? getUserData(); Window window = getWindow(); window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); // ?? WindowManager window_manager = getWindowManager(); Display display = window_manager.getDefaultDisplay(); Point point = new Point(); display.getSize(point); displayWidth = point.x; displayHeight = point.y; displayInch = getInch(); // ??4??????? textSize = 17 * (displayInch / 4); actionBar = getActionBar(); actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE, ActionBar.DISPLAY_USE_LOGO); actionBar.setDisplayShowTitleEnabled(true); actionBar.setDisplayUseLogoEnabled(false); actionBar.setDisplayShowHomeEnabled(false); actionBar.setDisplayHomeAsUpEnabled(false); String title_text = ""; subGroupText = ""; groupText = groupName; if (displayInch < 4.7) { title_text = "<small><small><small>??: </small></small></small>"; resizeTitleSizeTooSmall(); } else if (displayInch >= 4.7 && displayInch < 5.5) { title_text = "<small><small>??: </small></small>"; resizeTitleSizeSmall(); } else if (displayInch >= 5.5 && displayInch < 6.5) { title_text = "<small>??: </small>"; resizeTitleSizeMiddle(); } else if (displayInch >= 6.5 && displayInch < 8) { title_text = "<small>??: </small>"; resizeTitleSizeLarge(); } else { title_text = "??: "; } String modify_group_text = title_text + "<font color=#FF0000>" + groupName + "</font>"; actionBar.setTitle(Html.fromHtml(modify_group_text)); Resources resources = _context.getResources(); int resourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android"); titleBarHeight = resources.getDimensionPixelSize(resourceId); setContentView(R.layout.capture); returnBorrowHelpView = (ImageView) findViewById(R.id.return_borrow_help_view); returnBorrowHelpView.setImageResource(R.drawable.return_borrow_help); returnBorrowHelpView.setTranslationY(displayHeight / 5 + titleBarHeight); returnBorrowHelpView.setLayoutParams(new FrameLayout.LayoutParams(displayWidth, displayHeight / 5 + titleBarHeight, Gravity.BOTTOM | Gravity.CENTER)); registHelpView = (ImageView) findViewById(R.id.regist_help_view); registHelpView.setImageResource(R.drawable.regist_help); registHelpView.setTranslationY(displayHeight / 5 + titleBarHeight); registHelpView.setLayoutParams(new FrameLayout.LayoutParams(displayWidth, displayHeight / 5 + titleBarHeight, Gravity.BOTTOM | Gravity.CENTER)); registHelpView.setVisibility(View.GONE); leftDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); leftDrawer = (ListView) findViewById(R.id.left_drawer); textView = (TextView) findViewById(R.id.textView); modeText = (TextView) findViewById(R.id.mode_text); modeText.setTextColor(Color.rgb(56, 234, 123)); modeText.setTextSize(textSize); modeText.setTypeface(Typeface.SERIF.MONOSPACE, Typeface.BOLD); strokeColor = Color.rgb(56, 234, 123); borrowReturnButton = (Button) findViewById(R.id.borrowReturnButton); registButton = (Button) findViewById(R.id.registButton); returnHistoryButton = (Button) findViewById(R.id.return_history_button); helpViewButton = (Button) findViewById(R.id.help_view_button); registSelectShelfRelativeLayout = (RelativeLayout) findViewById(R.id.regist_select_shelf_relative_layout); textViewLinearLayout = (LinearLayout) findViewById(R.id.text_view_linear_layout); buttonLinearLayout = (LinearLayout) findViewById(R.id.button_linear_layout); listViewLinearLayout = (LinearLayout) findViewById(R.id.list_view_linear_layout); decisionButton = (Button) findViewById(R.id.decision_button); cancelButton = (Button) findViewById(R.id.cancel_button); shelfListView = (ListView) findViewById(R.id.shelf_list_view); tempTextView = (TextView) findViewById(R.id.temp_text_view); // bookListViewAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1); bookListViewAdapter = new BookListViewAdapter(_context, R.layout.book_list_row, this); bookRegistRelativeLayout = (RelativeLayout) findViewById(R.id.book_regist_relative_layout); bookRegistLinearLayout = (LinearLayout) findViewById(R.id.book_regist_linear_layout); bookRegistListViewLinearLayout = (LinearLayout) findViewById(R.id.book_regist_list_view_linear_layout); bookRegistListView = (ListView) findViewById(R.id.book_regist_list_view); bookRegistTextView = (TextView) findViewById(R.id.book_regist_text_view); bookRegistCancelButton = (Button) findViewById(R.id.book_regist_cancel_button); registFlag = 0; int borrowReturnButton_width = displayWidth / 5 * 2; int borrowReturnButton_height = displayHeight / 10; int borrowReturnButton_x = ((displayWidth / 2) - borrowReturnButton_width) / 2; int borrowReturnButton_y = displayHeight / 2 + titleBarHeight; borrowReturnButton.setTranslationX(borrowReturnButton_x); borrowReturnButton.setTranslationY(borrowReturnButton_y); borrowReturnButton .setLayoutParams(new FrameLayout.LayoutParams(borrowReturnButton_width, borrowReturnButton_height)); borrowReturnButton.setBackgroundColor(Color.rgb(56, 234, 123)); borrowReturnButton.setText("??\n"); borrowReturnButton.setTextSize(textSize * 7 / 10); borrowReturnButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { arrayList.clear(); registFlag = 0; borrowReturnButton.setText("??\n"); borrowReturnButton.setEnabled(false); borrowReturnButton.setTextColor(Color.WHITE); borrowReturnButton.setBackgroundColor(Color.rgb(56, 234, 123)); registButton.setText("?\n??"); registButton.setEnabled(true); registButton.setTextColor(Color.GRAY); registButton.setBackgroundColor(Color.argb(170, 21, 38, 45)); modeText.setText("??"); modeText.setTextColor(Color.rgb(56, 234, 123)); returnBorrowHelpView.setVisibility(View.VISIBLE); registHelpView.setVisibility(View.GONE); strokeColor = Color.rgb(56, 234, 123); } }); int registButton_width = displayWidth / 5 * 2; int registButton_height = displayHeight / 10; int registButton_x = (displayWidth / 2) + ((displayWidth / 2) - registButton_width) / 2; int registButton_y = displayHeight / 2 + titleBarHeight; registButton.setTranslationX(registButton_x); registButton.setTranslationY(registButton_y); registButton.setLayoutParams(new FrameLayout.LayoutParams(registButton_width, registButton_height)); registButton.setBackgroundColor(Color.argb(170, 21, 38, 45)); registButton.setTextColor(Color.GRAY); registButton.setTextSize(textSize * 7 / 10); registButton.setText("?\n??"); registButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { arrayList.clear(); registFlag = 1; borrowReturnButton.setText("??\n??"); borrowReturnButton.setEnabled(true); borrowReturnButton.setTextColor(Color.GRAY); borrowReturnButton.setBackgroundColor(Color.argb(170, 9, 54, 16)); registButton.setText("?\n"); registButton.setEnabled(false); registButton.setTextColor(Color.WHITE); registButton.setBackgroundColor(Color.rgb(62, 162, 229)); modeText.setText("?"); modeText.setTextColor(Color.rgb(62, 162, 229)); returnBorrowHelpView.setVisibility(View.GONE); registHelpView.setVisibility(View.VISIBLE); strokeColor = Color.rgb(62, 162, 229); } }); returnHistoryButton.setText("????"); returnHistoryButton.setTextSize(textSize * 7 / 10); returnHistoryButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { leftDrawerLayout.openDrawer(Gravity.RIGHT); // animateTranslationY(bookRegistRelativeLayout, displayHeight, displayHeight - displayHeight / 4 - titleBarHeight); } }); getReturnHistory(); getCurrentTime(); setHelpView(); setScanUnregisterBookView(); setBookRegistView(); arrayList = new ArrayList<String>(); tempRegistIsbn = ""; initBookRegistUrl = book_register_url + "?user_id=" + userId + "&group_id=" + groupId; initLendRegistUrl = lend_register_url + "?user_id=" + userId + "&group_id=" + groupId; initTemporaryLendRegistUrl = temporary_lend_register_url + "?user_id=" + userId + "&group_id=" + groupId; initCatalogRegistUrl = catalog_register_url + "?group_id=" + groupId + "&book_code="; initManuallyCatalogRegistUrl = manually_catalog_register_url + "?group_id=" + groupId + "&book_code="; getStatusUrl = get_status_url + "?group_id=" + groupId + "&user_id=" + userId; hasSurface = false; inactivityTimer = new InactivityTimer(this); bircleBeepManager = new BircleBeepManager(this); ambientLightManager = new AmbientLightManager(this); PreferenceManager.setDefaultValues(this, R.xml.preferences, false); toastText = ""; }
From source file:com.aliyun.homeshell.Folder.java
/** * Used to inflate the Workspace from XML. * * @param context The application's context. * @param attrs The attribtues set containing the Workspace's customization values. */// w ww . ja v a2 s . c o m public Folder(Context context, AttributeSet attrs) { super(context, attrs); setAlwaysDrawnWithCacheEnabled(false); mInflater = LayoutInflater.from(context); /* YUNOS BEGIN */ //##date:2014/04/16 ##author:nater.wg ##BugID:110407 // Enhance ConfigManager. /* Resources res = getResources(); mMaxCountX = res.getInteger(R.integer.folder_max_count_x); mMaxCountY = res.getInteger(R.integer.folder_max_count_y); mMaxNumItems = res.getInteger(R.integer.folder_max_num_items); if (mMaxCountX < 0 || mMaxCountY < 0 || mMaxNumItems < 0) { mMaxCountX = LauncherModel.getCellCountX(); mMaxCountY = LauncherModel.getCellCountY(); mMaxNumItems = mMaxCountX * mMaxCountY; } */ mLauncher = (Launcher) context; mIconManager = mLauncher.getIconManager(); mMaxCountX = ConfigManager.getFolderMaxCountX(); mMaxCountY = mIconManager.supprtCardIcon() ? ConfigManager.getCardFolderMaxCountY() : ConfigManager.getFolderMaxCountY(); mMaxNumItems = mMaxCountX * mMaxCountY; /* YUNOS END */ Resources res = getResources(); mInputMethodManager = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE); mExpandDuration = res.getInteger(R.integer.config_folderAnimDuration); if (sDefaultFolderName == null) { sDefaultFolderName = res.getString(R.string.folder_name); } /* * if (sHintText == null) { sHintText = * res.getString(R.string.folder_hint_text); } */ // We need this view to be focusable in touch mode so that when text editing of the folder // name is complete, we have something to focus on, thus hiding the cursor and giving // reliable behvior when clicking the text field (since it will always gain focus on click). setFocusableInTouchMode(true); mShortcutInfoCache = new ShortcutInfo(); mIconManager = mLauncher.getIconManager(); /* YUNOS BEGIN */ //##date:2014/09/23 ##author:andy.zx ##BugID:5244732 Display display = mLauncher.getWindowManager().getDefaultDisplay(); display.getSize(mDisplaySize); /* YUNOS END */ }
From source file:dcheungaa.procal.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { mainActivities.add(this); try {//from www. j a v a2 s. c om fx50Parser = new Fx50ParserCallable(); } catch (Exception e) { System.out.println("Fx50 Parser failed to initiate: " + e.getMessage()); } this.requestWindowFeature(Window.FEATURE_NO_TITLE); super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); context = this; InputHandler.setContext(this); views.put("drawer", (DrawerLayout) findViewById(R.id.drawer_layout)); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, ((DrawerLayout) views.get("drawer")), R.string.navigation_drawer_open, R.string.navigation_drawer_close); ((DrawerLayout) views.get("drawer")).setDrawerListener(toggle); toggle.syncState(); // //DrawerLayout.LayoutParams lp =(android.support.v4.widget.DrawerLayout.LayoutParams) drawer.getLayoutParams(); //lp.setMargins(0,200,0,200); //drawer.setLayoutParams(lp); NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); views.put("resultDisplay", findViewById(R.id.resultDisplay)); //Set font TextView inquiryDisplay = (TextView) findViewById(R.id.inquiryDisplay); TextView matrixDisplay = (TextView) findViewById(R.id.matrixDisplay); views.put("matrixDisplay", matrixDisplay); views.put("inquiryDisplay", inquiryDisplay); final Typeface FONT_FX50 = Typeface.createFromAsset(getAssets(), "fonts/Fx50.otf"); matrixDisplay.setTypeface(FONT_FX50); TextView cursor = (TextView) findViewById(R.id.tv_cursor); views.put("cursor", (TextView) findViewById(R.id.tv_cursor)); cursor.setTypeface(FONT_FX50); //keypad gen final InputStream inSKey = getResources().openRawResource(R.raw.keypad); Display display = getWindowManager().getDefaultDisplay(); RelativeLayout cm = (RelativeLayout) findViewById(R.id.content_main); LinearLayout lls = (LinearLayout) findViewById(R.id.llScreen); llKeyPad = (LinearLayout) findViewById(R.id.llKeyPad); Resources resources = getResources(); keyPad = new KeyPad_init(this, resources, inSKey, display, cm, lls, llKeyPad); call_load = true; horizontalScrollView = (HorizontalScrollView) findViewById(R.id.llHoriScrollView); matrixDisplay.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { System.out.print("Pressed Boss\n"); if (event.getAction() == MotionEvent.ACTION_UP) { if (!CursorHandler.cursorVisible && DisplayModeHandler.displayMode) { CursorHandler.cursorVisible = true; CursorHandler.blinkCursor(); DisplayModeHandler.displayMode = false; InputHandler.updateMatrixDisplay(); } if (!InputHandler.error) CursorHandler.locateCursorPos((int) event.getX()); InputHandler.error = false; } return true; } }); CursorHandler.blinkCursor(); if (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) { if (!ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.WRITE_EXTERNAL_STORAGE)) { System.out.println("Requesting writing permission"); ActivityCompat.requestPermissions(this, new String[] { Manifest.permission.WRITE_EXTERNAL_STORAGE }, 1234); } } if (ContextCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) { if (!ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.READ_EXTERNAL_STORAGE)) { System.out.println("Requesting reading permission"); ActivityCompat.requestPermissions(this, new String[] { Manifest.permission.READ_EXTERNAL_STORAGE }, 1235); } } Point size = new Point(); display.getSize(size); screenWidth = size.x; screenHeight = size.y; //hide VAR keypad svVar = (ScrollView) findViewById(R.id.svVar); svVar.setVisibility(View.INVISIBLE); svVar.setPadding(0, 0, 0, 0); svVar.setBackgroundResource(R.drawable.popup_container); svVar.setElevation(16f); LinearLayout llVar = (LinearLayout) findViewById(R.id.llVarPad); llVar.setElevation(32f); llVar.setBackgroundColor(context.getResources().getColor(R.color.colorPrimaryDarker)); varPad = new KeyPad_init(this, resources, display, llVar); final InputStream inSCmd = getResources().openRawResource(R.raw.programming_keys); svCmd = (ScrollView) findViewById(R.id.svCmd); svCmd.setVisibility(View.INVISIBLE); svCmd.setPadding(0, 0, 0, 0); svCmd.setBackgroundResource(R.drawable.popup_container); svCmd.setElevation(16f); LinearLayout llCmd = (LinearLayout) findViewById(R.id.llCmdPad); llCmd.setElevation(32f); llCmd.setBackgroundColor(context.getResources().getColor(R.color.colorAccentDarker)); cmdPad = new KeyPad_init(this, resources, inSCmd, display, llCmd, "", "COMMAND"); final InputStream inSConst = getResources().openRawResource(R.raw.constant_keypad); svConst = (ScrollView) findViewById(R.id.svConst); svConst.setVisibility(View.INVISIBLE); svConst.setPadding(0, 0, 0, 0); svConst.setBackgroundResource(R.drawable.popup_container); svConst.setElevation(16f); LinearLayout llConst = (LinearLayout) findViewById(R.id.llConstPad); llConst.setElevation(32f); llConst.setBackgroundColor(context.getResources().getColor(R.color.colorSecondaryDarker)); constPad = new KeyPad_init(this, resources, inSConst, display, llConst, "&", "CONSTANT"); // ATTENTION: This was auto-generated to implement the App Indexing API. // See https://g.co/AppIndexing/AndroidStudio for more information. client = new GoogleApiClient.Builder(this).addApi(AppIndex.API).build(); }