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
// You may have guessed this is body of suspend function as I'm using Kotlin coroutines. | |
// Service is com.google.api.services.gmail.Gmail. | |
try { | |
val executeResult: ListMessagesResponse? = | |
withContext(Dispatchers.IO) { | |
service.users().messages()?.list("me")?.setQ("to:me")?.execute() | |
} | |
// For the sake of test, let's get 1st message on the list |
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
val credential = GoogleAccountCredential.usingOAuth2( | |
applicationContext, listOf(GmailScopes.GMAIL_READONLY) | |
) | |
.setBackOff(ExponentialBackOff()) | |
.setSelectedAccount( | |
Account( | |
FirebaseAuth.getInstance().currentUser?.email, | |
BuildConfig.APPLICATION_ID | |
) | |
) |
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
if (FirebaseAuth.getInstance().currentUser == null) { | |
// user needs to authenticate | |
val providers = arrayListOf( | |
AuthUI.IdpConfig.GoogleBuilder().build() | |
) | |
startActivityForResult( | |
AuthUI.getInstance() | |
.createSignInIntentBuilder() | |
.setAvailableProviders(providers) |
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
//Firebase UI | |
implementation 'com.firebaseui:firebase-ui-auth:6.2.0' | |
//Google Auth | |
implementation group: 'com.google.api-client', name: 'google-api-client-android', version: '1.30.9' | |
//GMail api | |
implementation 'com.google.apis:google-api-services-gmail:v1-rev20200203-1.30.9' |
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" standalone="no"?> | |
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="ruleset" | |
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0" | |
xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd" | |
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 https://pmd.sourceforge.io/ruleset_2_0_0.xsd"> | |
<description>Android Rule Sets 1.0</description> | |
<exclude-pattern>.*/R.java</exclude-pattern> |
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
/** | |
* Quick and hacky way, tested under SDK19 and newer. | |
* How to use (key: in conjunction with CircleCrop): | |
* <code>transform(new CircleCrop(), new CircleShadowTransformation())</code> | |
*/ | |
public class CircleShadowTransformation extends BitmapTransformation { | |
private static final int SHADOW_RADIUS = 10; | |
private static final String ID = "a.b.c.transformations.CircleShadowTransformation"; | |
private static final byte[] ID_BYTES = ID.getBytes(Charset.forName(STRING_CHARSET_NAME)); |
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
public class BasicTests { | |
private static final String PACKAGE_NAME = "com.noname.pharma"; | |
private AndroidDriver<AndroidElement> driver; | |
@Before | |
public void setup() throws Exception { | |
DesiredCapabilities capabilities = new DesiredCapabilities(); | |
capabilities.setCapability("deviceName", "emulator-5554"); | |
capabilities.setCapability("platformVersion", "7.1.1"); |
NewerOlder