Skip to content

Instantly share code, notes, and snippets.

@shanmugasanthosh7
shanmugasanthosh7 / .travis.yml
Last active May 29, 2020 05:45
Android library using Travis CI
language: android
jdk: oraclejdk8
sudo: false
before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
@shanmugasanthosh7
shanmugasanthosh7 / build.gradle
Last active May 29, 2020 05:36
Root project gradle file
dependencies {
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4'
}
@shanmugasanthosh7
shanmugasanthosh7 / build.gradle
Last active May 29, 2020 05:44
Library module gradle file
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'com.jfrog.bintray'
apply plugin: 'maven-publish'
publishing {
publications {
Production(MavenPublication) {
artifact("$buildDir/outputs/aar/droidils-release.aar")
public class MainActivity : AppCompatActivity
{
protected override async void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
SetContentView(Resource.Layout.activity_main)
var textview = FindViewById<TextView>(Resource.Id.textView);
var apiService = NetworkService.GetApiService();
await apiService.GetPost()
.ContinueWith(post =>
@shanmugasanthosh7
shanmugasanthosh7 / NetworkService.cs
Created May 12, 2018 18:45
RestService Class implementaion
public static class NetworkService
{
public static IApiService apiService;
string static baseUrl = "https://jsonplaceholder.typicode.com"
public static IApiService GetApiService()
{
apiService = RestService.For<IApiService>(baseUrl);
return apiService;
}
}
public interface IApiService
{
[Get("/posts/1")]
Task<Post> GetPost();
[Get("/todos/1")]
Task<ToDo> GetToDo();
}
@shanmugasanthosh7
shanmugasanthosh7 / MainActivity.cs
Last active May 12, 2018 19:20
Combine two API call
public class MainActivity : AppCompatActivity
{
private Post post;
private ToDo toDo;
protected override async void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
SetContentView(Resource.Layout.activity_main)
@shanmugasanthosh7
shanmugasanthosh7 / build.gradle
Last active March 25, 2020 04:32
Navigation download setup
dependencies {
implementation 'android.arch.navigation:navigation-fragment:2.3.0-alpha04'
}
@shanmugasanthosh7
shanmugasanthosh7 / nav_graph.xml
Created May 15, 2018 17:19
Navigation Xml file
<?xml version="1.0" encoding="utf-8"?>
<navigation xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
app:startDestination="@id/navigationFragment">
<fragment
android:id="@+id/navigationFragment"
android:name="com.aptus.navigatioarchitecture.NavigationFragment"
android:label="fragment_navigation"
@shanmugasanthosh7
shanmugasanthosh7 / nav_graph.xml
Created May 15, 2018 17:51
Navigation file with actions
<?xml version="1.0" encoding="utf-8"?>
<navigation xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
app:startDestination="@id/navigationFragment">
<fragment
android:id="@+id/navigationFragment"
android:name="com.aptus.navigatioarchitecture.NavigationFragment"
android:label="fragment_navigation"