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"); |
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
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
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
// 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
//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
def koin_version = '2.1.5' | |
implementation "org.koin:koin-androidx-viewmodel:$koin_version" | |
implementation "org.koin:koin-androidx-fragment:$koin_version" | |
implementation "org.koin:koin-androidx-scope:$koin_version" |
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
//typically in a separate file | |
val appModule = module { } | |
//in a separate file as well | |
val viewModelsModule = module { } | |
//called in onCreate of your application class | |
startKoin { | |
androidLogger() | |
androidContext(applicationContext) |
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 appModule = module { | |
single<Gson> { GsonBuilder().setPrettyPrinting().create() } | |
} |
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
// declare view model | |
class MyViewModel(private val gson: Gson) : ViewModel() { | |
//... | |
} | |
// modify corresponding module | |
val viewModelsModule = module { | |
viewModel { MyViewModel(get()) } | |
} |
OlderNewer