Skip to content

Instantly share code, notes, and snippets.

Sam.Mo shuanghua

Block or report user

Report or block shuanghua

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@shuanghua
shuanghua / build.gradle.kts
Last active Jul 29, 2019
一份包含签名、DataBinding 等配置的 Android 项目 build.gradle.kts
View build.gradle.kts
import org.jetbrains.kotlin.konan.properties.Properties
import org.jetbrains.kotlin.konan.properties.loadProperties
plugins {
id("com.android.application")
kotlin("android")
kotlin("android.extensions")
kotlin("kapt")
id("androidx.navigation.safeargs.kotlin")
}
View Android隐藏键盘.kt
val imm = getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
imm.hideSoftInputFromWindow(view.windowToken, 0)
@shuanghua
shuanghua / ss v2ray-plugin.md
Last active Jan 21, 2020
ss-libev + v2ray-plugin + tls + CentOS-7
View ss v2ray-plugin.md

v2ray-plugin CentOS-7

ss v2ray-plugin centos-7

购买域名 / 或申请免费域名

配置 cloudflare

  1. cloudflare DNS-> 添加一条 A 记录;name=域名,value=vpsIP, ttl=automatic, status=onlyDns
@shuanghua
shuanghua / IconView.kt
Created Mar 15, 2019 — forked from nickbutcher/IconView.kt
A prototype implementation of a shadow effect inspired by the Google Play Games app (https://play.google.com/store/apps/details?id=com.google.android.play.games).
View IconView.kt
/*
* Copyright 2017 Google Inc.
*
* 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
View Android 获取系统状态栏高度
方式1:
var resourceId = resources.getIdentifier("status_bar_height", "dimen", "android")
//修改高度
return resources.getDimensionPixelSize(resourceId)
方式2:
myView.setOnApplyWindwoInsetListener{view,insets ->
val statusBarSize = insets.systemWindowInsetTop
return insets
}
@shuanghua
shuanghua / shr_next_button_state_list_anim.xm
Created Jun 29, 2018
Copy From Google MaterialComponents
View shr_next_button_state_list_anim.xm
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<!-- Pressed state -->
<item
android:state_enabled="true"
android:state_pressed="true">
<set>
<objectAnimator
@shuanghua
shuanghua / AndroidManifest.xml
Last active Jun 27, 2018
调用相机拍照
View AndroidManifest.xml
<application
<!--适配7.0+拍照返回 Start-->
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="${applicationId}.fileProvider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_path" />
View KotlinClassWithJavaClass.kt
println("HomeFragment.javaClass.simpleName = ${HomeFragment.javaClass.simpleName}2")// = Companion
println("HomeFragment::class.java.simpleName = ${HomeFragment::class.java.simpleName}1")// = 类名
println("homeFragment.javaClass.simpleName = ${homeFragment.javaClass.simpleName}3")// = 类名
println("homeFragment::javaClass.simpleName = ${homeFragment::javaClass.simpleName}5")// = 类名
println("homeFragment.javaClass.Name = ${homeFragment.javaClass.name}4")// = 包名.类名
println("homeFragment::class.java.Name = ${homeFragment::class.java.name}6")// = 包名.类名
@shuanghua
shuanghua / ViewUtil.java
Last active Mar 23, 2018
Android pxTodp
View ViewUtil.java
public static int dpToPx(float dp, Context context) {
return dpToPx(dp, context.getResources());
}
public static int dpToPx(float dp, Resources resources) {
float px = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, resources.getDisplayMetrics());
return (int) px;
}
You can’t perform that action at this time.