This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Proccess: | |
# 1. Go into app directory | |
# 2. Get current versionCode and print it | |
# 3. Increment versionCode by one and print it | |
# 4. Get current versionName and print it | |
# 5. Ask user for new versionName and set it then print it | |
# 6. Stage changes to build.gradle | |
# 7. Go back one directory to project root | |
# 8. Commit version update with message Bumped up version | |
# 9. Tag with versionName |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
from bs4 import BeautifulSoup | |
import smtplib, ssl | |
URL = "https://www.zomato.com/bareilly/momo-hut-subhash-nagar-colony/order" | |
headers = { | |
'authority': 'www.zomato.com', | |
'sec-ch-ua': '"Chromium";v="92", " Not A;Brand";v="99", "Google Chrome";v="92"', | |
'sec-ch-ua-mobile': '?0', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private fun createCameraPreviewSessionFront() { | |
try { | |
val texture = textureViewFront.surfaceTexture | |
texture.setDefaultBufferSize(previewSizeFront.width, previewSizeFront.height) | |
val surface = Surface(texture) | |
previewRequestBuilderFront = cameraDeviceFront!!.createCaptureRequest(CameraDevice.TEMPLATE_PREVIEW) | |
previewRequestBuilderFront.addTarget(surface) | |
// Here, we create a CameraCaptureSession for camera preview. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private val stateCallbackFront = object : CameraDevice.StateCallback() { | |
override fun onOpened(cameraDevice: CameraDevice) { | |
this@CameraFragment.cameraDeviceFront = cameraDevie | |
createCameraPreviewSessionFront() | |
} | |
override fun onDisconnected(cameraDevice: CameraDevice) { | |
cameraDevice.close() | |
this@CameraFragment.cameraDeviceFront = null | |
} | |
override fun onError(cameraDevice: CameraDevice, error: Int) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private fun openCameraFront(width: Int, height: Int) { | |
setUpCameraOutputsFront(width, height) | |
configureTransformFront(width, height) | |
val manager = activity?.getSystemService(Context.CAMERA_SERVICE) as CameraManager | |
try { | |
manager.openCamera(cameraIdFront, stateCallbackFront, backgroundHandler) | |
} catch (e: CameraAccessException) { | |
Log.e(TAG, e.toString()) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Sets up member variables related to front camera. | |
* @param width The width of available size for camera preview | |
* @param height The height of available size for camera preview | |
*/ | |
private fun setUpCameraOutputsFront(width: Int, height: Int) { | |
val manager = activity?.getSystemService(Context.CAMERA_SERVICE) as CameraManager | |
try { | |
for (cameraId in manager.cameraIdList) { | |
val characteristics = manager.getCameraCharacteristics(cameraId) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private val surfaceTextureListenerFront = object : TextureView.SurfaceTextureListener { | |
override fun onSurfaceTextureAvailable(texture: SurfaceTexture, width: Int, height: Int) { | |
openCameraFront(width, height) | |
} | |
override fun onSurfaceTextureSizeChanged(texture: SurfaceTexture, width: Int, height: Int) { | |
configureTransformFront(width, height) | |
} | |
override fun onSurfaceTextureDestroyed(texture: SurfaceTexture) = true | |
override fun onSurfaceTextureUpdated(texture: SurfaceTexture) = Unit | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
android:orientation="vertical" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent"> | |
<!--This is a custom TextureView, generic TextureView can be used as well--> | |
<com.ananth.frontrearcamera.view.AutoFitTextureView | |
android:layout_weight="1" | |
android:id="@+id/texture1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* This function talks to server and helps logging a returning user in. Here we will not be | |
* doing any checks on username and password strings, as they have already been checked | |
* and tailored for this function. | |
* @param username the username entered by user | |
* @param password password as entered by user | |
*/ | |
private void login(String username ,String password) { | |
/* Get client with the help of helper function of your own */ |