Skip to content

Instantly share code, notes, and snippets.

View r-julien-bataille's full-sized avatar

Julien Bataillé r-julien-bataille

  • Rakuten, Inc.
  • Tokyo, Japan
View GitHub Profile
package com.firebaseapp.twademo;
import android.content.ComponentName;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.customtabs.CustomTabsClient;
import android.support.customtabs.CustomTabsIntent;
import android.support.customtabs.CustomTabsServiceConnection;
private class TwaCustomTabsServiceConnection extends CustomTabsServiceConnection {
@Override
public void onCustomTabsServiceConnected(ComponentName componentName, CustomTabsClient client) {
// Creates a CustomTabsSession with a constant session id.
CustomTabsSession session = client.newSession(null, SESSION_ID);
// Creates a CustomTabsIntent to launch the Trusted Web Activity.
mCustomTabsIntent = new CustomTabsIntent.Builder(session).build();
}
CustomTabsIntent.Builderbuilder=new CustomTabsIntent.Builder();
CustomTabsIntentcustomTabsIntent=builder.build();
TrustedWebUtils.launchAsTrustedWebActivity(
MainActivity.this,
customTabsIntent,
Uri.parse("https://twa-demo.firebaseapp.com/"));
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:28.0.0'
implementation 'com.github.GoogleChrome:custom-tabs-client:7ab7178ae0c4858d15b1918bded4dd5cac758870'
testImplementation 'junit:junit:4.12'
@r-julien-bataille
r-julien-bataille / build.gradle
Last active February 19, 2019 16:17
TWA Demo
allprojects {
repositories {
google()
jcenter()
maven { url "https://jitpack.io" }
}
}
java -jar swagger-codegen-cli-2.2.1.jar generate \
-i https://raw.githubusercontent.com/Microsoft/BotBuilder/master/CSharp/Library/Microsoft.Bot.Connector/Swagger/ConnectorAPI.json \
-l java --library=retrofit2 \
--api-package com.microsoft.bot.connector.connectorapi \
--model-package com.microsoft.bot.connector.connectorapi.model \
--group-id com.microsoft.bot \
--artifact-id connectorapi \
--artifact-version 1.0.0 \
-o /var/tmp/java/okhttp-gson/
[Serializable]
public class HotelSearch
{
[Prompt("Where would like to stay?")]
public string Location { get; set; }
[Prompt("When is your check-in date?")]
public DateTime CheckinDate { get; set; }
<iframe src="https://webchat.botframework.com/embed/TravelJapan?s=YOUR_SECRET_HERE" style="height: 502px; max-height: 502px;">
</iframe>
@r-julien-bataille
r-julien-bataille / Main.java
Created February 7, 2016 09:47
Show dependencies in a gradle project
package org.gradle.sample;
import org.gradle.tooling.*;
import org.gradle.tooling.model.*;
import org.gradle.tooling.model.eclipse.*;
import java.io.File;
import java.lang.Object;
public class Main {
public sealed partial class MainPage
{
public MainPage()
{
InitializeComponent();
}
private void AutoSuggestBox_TextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args)
{
// Only get results when it was a user typing,