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
protected BatchAnnotateImagesResponse doInBackground(Object... params) { | |
try { | |
GoogleCredential credential = new GoogleCredential().setAccessToken(accessToken); | |
HttpTransport httpTransport = AndroidHttp.newCompatibleTransport(); | |
JsonFactory jsonFactory = GsonFactory.getDefaultInstance(); | |
Vision.Builder builder = new Vision.Builder | |
(httpTransport, jsonFactory, credential); | |
Vision vision = builder.build(); | |
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 void performCloudVisionRequest(Uri uri) { | |
if (uri != null) { | |
try { | |
Bitmap bitmap = resizeBitmap( | |
MediaStore.Images.Media.getBitmap(getContentResolver(), uri)); | |
callCloudVision(bitmap); | |
selectedImage.setImageBitmap(bitmap); | |
} catch (IOException e) { | |
Log.e(TAG, e.getMessage()); | |
} |
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 showComponents(){ | |
val constraintSet = ConstraintSet() | |
constraintSet.clone(this, R.layout.circuit_detail) | |
val transition = ChangeBounds() | |
transition.interpolator = AnticipateOvershootInterpolator(1.0f) | |
transition.duration = 1200 | |
TransitionManager.beginDelayedTransition(constraint, transition) | |
constraintSet.applyTo(constraint) |
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 GetOAuthToken extends AsyncTask<Void, Void, Void> { | |
Activity mActivity; | |
Account mAccount; | |
int mRequestCode; | |
String mScope; | |
GetOAuthToken(Activity activity, Account account, String scope, int requestCode) { | |
this.mActivity = activity; | |
this.mScope = scope; | |
this.mAccount = account; |
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"?> | |
<RelativeLayout | |
xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:paddingBottom="16dp" | |
android:paddingLeft="16dp" | |
android:paddingRight="16dp" | |
android:paddingTop="16dp" |
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
dependencies { | |
implementation fileTree(dir: 'libs', include: ['*.jar']) | |
implementation"org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version" | |
implementation 'com.android.support:appcompat-v7:27.0.1' | |
implementation 'com.android.support.constraint:constraint-layout:1.0.2' | |
// Google Cloud Vision API | |
implementation 'com.google.android.gms:play-services-base:11.8.0' | |
implementation 'com.google.android.gms:play-services-auth:11.8.0' | |
implementation 'com.google.apis:google-api-services-vision:v1-rev16-1.22.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
override fun onClick() { | |
super.onClick() | |
val calendarIntent = Intent(Intent.ACTION_EDIT) | |
calendarIntent.type = "vnd.android.cursor.item/event" | |
startActivityAndCollapse(calendarIntent) | |
} |
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
override fun onStartListening() { | |
super.onStartListening() | |
val tile = qsTile // this is getQsTile() method form java, used in Kotlin as a property | |
tile.label = "New Label" | |
tile.state = Tile.STATE_ACTIVE | |
tile.icon = Icon.createWithResource(this, R.drawable.other_icon) | |
tile.updateTile() // you need to call this method to apply changes | |
} |
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
<service | |
android:name=".MyTileService" | |
android:icon="@drawable/ic_tile_calendar" | |
android:label="@string/calendar_tile_name" | |
android:permission="android.permission.BIND_QUICK_SETTINGS_TILE"> | |
<intent-filter> | |
<action android:name="android.service.quicksettings.action.QS_TILE"/> | |
</intent-filter> | |
</service> |
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
class MyTileService: TileService(){ | |
override fun onClick() { | |
super.onClick() | |
// Called when the user click the tile | |
} | |
override fun onTileRemoved() { | |
super.onTileRemoved() |
NewerOlder