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 onCreate(savedInstanceState: Bundle?) { | |
//... | |
inputOutputOptions = FirebaseModelInputOutputOptions.Builder() | |
.setInputFormat(0, FirebaseModelDataType.FLOAT32, intArrayOf(1, 224, 224, 3)) | |
.setOutputFormat(0, FirebaseModelDataType.FLOAT32, intArrayOf(1, 149)) | |
.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
override fun onCreate(savedInstanceState: Bundle?) { | |
//... | |
//Load a cloud model using the FirebaseCloudModelSource Builder class | |
val cloudSource = FirebaseCloudModelSource.Builder("pokedex") //name of the model created in Firebase Console | |
.enableModelUpdates(true) | |
.build() | |
//Registering the cloud model loaded above with the ModelManager Singleton | |
FirebaseModelManager.getInstance().registerCloudModelSource(cloudSource) |
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 'com.google.firebase:firebase-ml-model-interpreter:16.0.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 getLandmarkFromCloud(bitmap: Bitmap) { | |
val image = FirebaseVisionImage.fromBitmap(bitmap) | |
val detector = FirebaseVision.getInstance() | |
.visionCloudLandmarkDetector | |
detector.detectInImage(image) | |
.addOnCompleteListener { | |
//The completion listener returns a list of detected landmarks | |
for (firebaseVisionLandmarks in it.result) { | |
//get the name of the landmark |
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 onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
//Check and request permission to write external storage | |
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) | |
== PackageManager.PERMISSION_DENIED) { | |
ActivityCompat.requestPermissions(this, Array<String>(1) { Manifest.permission.WRITE_EXTERNAL_STORAGE }, 12345) | |
//If there is no permission, disable the onClickListener on the FAB | |
fab_take_photo.setOnClickListener(null) | |
} else { | |
fab_take_photo.setOnClickListener(this) |
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 'dart:async'; | |
import 'dart:html'; | |
void main() { | |
final InputElement input = querySelector('input'); | |
final DivElement div = querySelector('div'); | |
div.innerHtml = "Enter a valid email"; | |
final emailValidator = |
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 showNotification(channelID: String) { | |
val stopSelf = Intent(this, CopieService::class.java) | |
stopSelf.putExtra(INTENT_EXTRA, true) | |
val startApp = Intent(this, MainActivity::class.java) | |
val stopPendingIntent = PendingIntent.getService(this, 0, stopSelf, FLAG_CANCEL_CURRENT) | |
val openAppPendingIntent = PendingIntent.getActivity(this, 0, startApp, FLAG_CANCEL_CURRENT) | |
startForeground(1995, NotificationCompat.Builder(this, channelID) | |
.setSmallIcon(R.drawable.ic_paste) | |
.setContentTitle("Copie is online") | |
.setContentText("Touch to open") |
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
package com.codingblocks.bottomnavigation; | |
import android.os.Bundle; | |
import android.support.annotation.NonNull; | |
import android.support.design.widget.BottomNavigationView; | |
import android.support.v7.app.AppCompatActivity; | |
import android.view.MenuItem; | |
import android.widget.TextView; | |
public class MainActivity extends AppCompatActivity { |
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 'package:flutter/material.dart'; | |
import 'package:http/http.dart' show post; | |
import 'package:login_stateful/src/mixins/validation_mixin.dart'; | |
class LoginScreen extends StatefulWidget { | |
@override | |
State<StatefulWidget> createState() { | |
return LoginScreenState(); | |
} | |
} |
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 getQRCodeDetails(bitmap: Bitmap) { | |
... | |
detector.detectInImage(image) | |
.addOnSuccessListener { | |
for (firebaseBarcode in it) { | |
... | |
when (firebaseBarcode.valueType) { | |
//Handle the URL here | |
FirebaseVisionBarcode.TYPE_URL -> firebaseBarcode.url | |
// Handle the contact info here, i.e. address, name, phone, etc. |