This file contains hidden or 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
// Call this instead of SoundExportMenuItem_Export | |
private void SoundExportMenuItem_ExportChannels(IList tracks, String baseFilename) | |
{ | |
// Assume common metadata, derive with first track | |
SoundDataTrack firstTrack = (SoundDataTrack)tracks[0]; | |
int channelCount = firstTrack.ChannelCount; | |
WAV.WAVFormatChunk fmt = new WAV.WAVFormatChunk(WAV.WAVFormatChunk.DataFormats.WAVE_FORMAT_PCM, 1, (uint)firstTrack.SampleRate, (uint)(2 * firstTrack.SampleRate), (ushort)2, 16); | |
FrostyTaskWindow.Show("Exporting Sound", "", task => | |
{ |
This file contains hidden or 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
// Define Joda-Time stub | |
val JODA_STUB = TestFiles.kotlin( | |
""" | |
package org.joda.time | |
class DateTime( | |
private val moment: Int, | |
private val zone: String | |
) { | |
companion object { |
This file contains hidden or 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
// Reference JAR kept in test-resources folder | |
val jodaTimeArtifact = TestFiles.bytes("libs/joda-time-2.10.14.jar", javaClass.getResourceAsStream("/joda-time-2.10.14.jar").readBytes()) | |
// Use Joda-Time binary | |
lint().files(jodaTimeArtifact, ...) |
This file contains hidden or 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
lint() | |
.files( | |
kotlin( | |
""" | |
package com.wealthfront.lint.test | |
import java.math.BigDecimal | |
class MyComparisonTester { |
This file contains hidden or 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
class WarnLocalDateConversion : Detector(), SourceCodeScanner { | |
override fun getApplicableMethodNames(): List<String> = listOf("toLocalDateTime", "toLocalDate") | |
override fun visitMethodCall(context: JavaContext, node: UCallExpression, method: PsiMethod) { | |
val receiverClassName = (node.receiverType as PsiClassReferenceType).reference.qualifiedName | |
if (receiverClassName == "org.joda.time.DateTime") { | |
context.report( | |
WARN_LOCAL_DATE_CONVERSION, | |
node, | |
context.getLocation(node), |
This file contains hidden or 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
/** Modified default root matcher at {@link androidx.test.espresso.matcher.RootMatchers.DEFAULT} */ | |
internal val activityRootMatcher: Matcher<Root> = allOf( | |
hasWindowLayoutParams(), | |
allOf( | |
IsSubwindowOfCurrentActivity(), | |
isFocusable() | |
) | |
) | |
/** Modified default root matcher at {@link androidx.test.espresso.matcher.RootMatchers.DEFAULT} */ |
This file contains hidden or 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
<queries> | |
<intent> | |
<action android:name="android.media.action.IMAGE_CAPTURE" /> | |
</intent> | |
</queries> |
This file contains hidden or 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 playStoreIntent = Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=com.wealthfront")).apply { | |
flags = Intent.FLAG_ACTIVITY_NEW_TASK | |
} | |
try { | |
context.startActivity(playStoreIntent) | |
} catch (ex: ActivityNotFoundException) { | |
goToPlayStoreUrl() | |
} |
This file contains hidden or 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
@Test | |
fun clickButtonInsideExpandedBottomSheet() { | |
val sheetBehavior = activity.getBottomSheetBehavior() | |
val expandedSheetIdlingResource = BottomSheetStateResource(sheetBehavior, STATE_EXPANDED) | |
val settledSheetIdlingResource = BottomSheetSettledResource(sheetBehavior) | |
// Wait for settled state | |
withBottomSheetResource(settledSheetIdlingResource) { | |
// Use BottomSheetSetStateAction to expand the Bottom Sheet | |
} |
This file contains hidden or 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
class BottomSheetStateResource( | |
bottomSheetBehavior: BottomSheetBehavior<View>, | |
@BottomSheetBehavior.State private val desiredState: Int | |
) : BottomSheetResource(bottomSheetBehavior) { | |
override fun getName(): String { | |
return "BottomSheet awaiting state: $desiredState" | |
} | |
override fun isDesiredState(@BottomSheetBehavior.State state: Int): Boolean { |
NewerOlder