Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@bansalayush
bansalayush / AndroidTouch
Created May 15, 2020 11:39
Check if the current focus in within a given view or outside of a view
View v = getCurrentFocus(); // get current view in focus
//get x,y coordinates of view
int[] scrcoords = new int[2];
v.getLocationOnScreen(scrcoords);
float x = ev.getRawX() + v.getLeft() - scrcoords[0];
float y = ev.getRawY() + v.getTop() - scrcoords[1];
//check if the touch was outside the current view
if (x < v.getLeft() || x > v.getRight() || y < v.getTop() || y > v.getBottom()) {
@bansalayush
bansalayush / HostingOnFirebase.txt
Last active August 25, 2021 18:08
Hosting a website on firebase
Hosting a website on firebase
Go to project dir
- <b>npm install -g firebase-tools</b>
- <b>firebase login</b>
- Login successfully before executing any other command
- <b>firebase init</b>
- Select hosting feature and github deploy actions
- Procceed
- Select a Project where this will be deployed
- Test website on local machine with firebase serve
@bansalayush
bansalayush / gist:fa6f28235438592d713ce600fe49c305
Created September 12, 2018 04:38
Install and debug react-native init app without USB!!!!!
1) Connect your mobile device via usb (just this once)
2) Establish a port with your mobile device using 'adb tcpip <port number>'.
eg. adb tcpip 5555
3) Remove USB and 'adb connect <mobile device ip><above mentioned port number>' .
Eg . adb connect 192.160.0.124:5555
4) 'React-native run-android' in your project folder