Skip to content

Instantly share code, notes, and snippets.

View jixiaoyong's full-sized avatar
👨‍💻
Focusing

JI,XIAOYONG jixiaoyong

👨‍💻
Focusing
View GitHub Profile
@jixiaoyong
jixiaoyong / Dagger2_basic_guide_line_part1.kt
Last active January 26, 2019 10:58
介绍了Dagger 2 中的 @Inject@component 的使用
//Dagger2_basic_guide_line_part1
/**
* author: jixiaoyong
* email: jixiaoyong1995@gmail.com
* website: https://jixiaoyong.github.io
* date: 2019/1/25
* description: 介绍了Dagger 2 中的 @Inject 和 @Component 的使用
*/
class Service @Inject constructor()
//Dagger2_basic_guide_line_part2
/**
* author: jixiaoyong
* email: jixiaoyong1995@gmail.com
* website: https://jixiaoyong.github.io
* date: 2019/1/26
* description: 介绍了Dagger 2 中的 @Inject 、 @Component
@Module 和 @Provides 的使用
当 @Component 在搜索Service的构造方法时,会先从 @Module 中搜索;
如果搜索不到再到 @Inject 修饰的类中查找。
//Dagger2_basic_guide_line_part3
/**
* author: jixiaoyong
* email: jixiaoyong1995@gmail.com
* website: https://jixiaoyong.github.io
* date: 2019/1/26
* description: 介绍了Dagger 2 中的 @Inject 、 @Component 、
@Module 、 @Provides 、@Named 和 @Qualifier 的使用
并且实现了自己的注解 @Choose 支持有多个构造函数的Service类
这一点可以从
@jixiaoyong
jixiaoyong / Dagger2_with_android_part1_1.kt
Last active January 29, 2019 01:16
Dagger 2 在Android中的使用——Activity篇
/**
* author: jixiaoyong
* email: jixiaoyong1995@gmail.com
* website: https://jixiaoyong.github.io
* date: 2019/1/27
* description: todo
*/
class MainApplication : HasActivityInjector, Application() {
override fun onCreate() {
@jixiaoyong
jixiaoyong / Dagger2_with_android_part1_1.kt
Created January 27, 2019 14:20
Dagger 2 在Android中的使用——Activity篇
/**
* author: jixiaoyong
* email: jixiaoyong1995@gmail.com
* website: https://jixiaoyong.github.io
* date: 2019/1/27
* description: todo
*/
class MainApplication : HasActivityInjector, Application() {
override fun onCreate() {
@jixiaoyong
jixiaoyong / Dagger2_with_android_part2_1.kt
Created January 27, 2019 15:17
Dagger 2 在Android中的使用——Fragment篇
/**
* author: jixiaoyong
* email: jixiaoyong1995@gmail.com
* website: https://jixiaoyong.github.io
* date: 2019/1/27
* description: 这里演示的是将Fragment加入到AppComponent中;
将将Fragment加入到Activity中Dagger2官方文档有,不再赘述
详见:https://google.github.io/dagger/android
*/
@jixiaoyong
jixiaoyong / Dagger2_with_android_part3_1.kt
Created January 27, 2019 16:02
Dagger 2 在Android中的使用——将Dagger2相关逻辑抽离出来的小技巧
/*
* Copyright (C) 2017 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
@jixiaoyong
jixiaoyong / FileUtils.java
Created April 22, 2019 02:07
Git计算文件Hash值的Java实现代码
package io.github.jixiaoyong.sample;
/**
* Created by jixiaoyong1995@gmail.com
* Data: 2019/4/22.
* Description:拷贝自 https://sharewind.iteye.com/blog/1582869
*/
import java.io.BufferedInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
@jixiaoyong
jixiaoyong / item_layout.xml
Created October 25, 2019 06:25
解决LinearLayoutManager在RTL布局中不显示item的问题
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp">
<Button
android:layout_width="200px"
android:layout_height="200px"
@jixiaoyong
jixiaoyong / JetpackWorkManager.kt
Last active November 21, 2019 08:44
Jetpack-WorkManager
import android.content.Context
import androidx.lifecycle.LiveData
import androidx.lifecycle.Observer
import androidx.work.*
/**
* Created by jixiaoyong1995@gmail.com
* Data: 2019/11/21.
* Description: WorkManager使用示例
*