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
/* | |
* Copyright (C) 2014 The Android Open Source Project | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except | |
* in compliance with the License. You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software distributed under the License | |
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express |
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
widget = new Padding( | |
padding: new EdgeInsets.all(32.0), | |
child: new Column( | |
crossAxisAlignment: CrossAxisAlignment.center, | |
mainAxisSize: MainAxisSize.min, | |
children: <Widget>[ | |
new Text( | |
'Welcome to FlutterAuth,', | |
style: DefaultTextStyle.of(context).style.apply(fontSizeFactor: 1.5),), | |
new Text('Login to continue'), |
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 LoginPresenter { | |
LoginViewContract _view; | |
LoginPresenter(this._view); | |
void perform_login() { | |
assert(_view != null); | |
insta.getToken(<APP_ID>, | |
<APP_SECRET>).then((token) | |
{ | |
if (token != null) { |
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
Future<Token> getToken(String appId, String appSecret) async { | |
Stream<String> onCode = await _server(); | |
String url = | |
"https://api.instagram.com/oauth/authorize?client_id=$appId&redirect_uri=http://localhost:8585&response_type=code"; | |
final flutterWebviewPlugin = new FlutterWebviewPlugin(); | |
flutterWebviewPlugin.launch(url); | |
final String code = await onCode.first; | |
final http.Response response = await http.post( | |
"https://api.instagram.com/oauth/access_token", | |
body: {"client_id": appId, "redirect_uri": "http://localhost:8585", "client_secret": appSecret, |
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"?> | |
<merge xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content"> | |
<TextView | |
android:id="@+id/title_tv" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" |
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 CustomTitleView extends RelativeLayout implements TitleViewAdapter.Provider { | |
private final TextView mTitleView; | |
private final TitleViewAdapter mTitleViewAdapter = new TitleViewAdapter() { | |
@Override | |
public View getSearchAffordanceView() { | |
return null; | |
} | |
@Override |
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"?> | |
<your.package.CustomTitleView | |
xmlns:android="http://schemas.android.com/apk/res/android" | |
android:id="@+id/browse_title_group" | |
android:padding="16dp" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" /> |
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
<style name="AppTheme.Leanback.CustomTitle" parent="Theme.Leanback.Browse"> | |
<item name="browseTitleViewLayout">@layout/titleview</item> | |
<item name="browseRowsMarginTop">60dp</item> | |
</style> |
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
<activity | |
android:name="your.package.MyActivity" | |
android:label="@string/app_name" | |
android:theme="@style/AppTheme.Leanback.CustomTitle"/> |