This file contains hidden or 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
| /** | |
| * 裁剪文本 | |
| */ | |
| private static String cutText(float textSize, String title, float maxWidth) { | |
| final TextPaint textPaint = new TextPaint(); | |
| textPaint.setTextSize(textSize); | |
| if (textPaint.measureText(title) < maxWidth) | |
| return title; |
This file contains hidden or 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 LoadingView extends View { | |
| private CircularProgressDrawable mDrawable; | |
| public LoadingView(Context pContext) { | |
| super(pContext); | |
| init(); | |
| } | |
| public LoadingView(Context pContext, AttributeSet pAttributeSet) { |
This file contains hidden or 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
| import groovy.json.JsonOutput | |
| import com.google.common.io.Files | |
| android.applicationVariants.all { variant -> | |
| variant.assemble.doLast { | |
| variant.outputs.each { output -> | |
| def apkInfo = [ | |
| apk: output.outputFile.absolutePath, | |
| versionCode: variant.versionCode, | |
| versionName: variant.versionName |
This file contains hidden or 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
| project.afterEvaluate { | |
| android.productFlavors.all { flavor -> | |
| dependencies { | |
| if (flavor.applicationIdSuffix) { | |
| it."${flavor.name}Implementation" "cn.nekocode.lib:keys-alpha:${versions.keys}" | |
| } else { | |
| it."${flavor.name}Implementation" "cn.nekocode.lib:keys:${versions.keys}" | |
| } | |
| } | |
| } |
This file contains hidden or 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
| # Referenced from https://intellij-support.jetbrains.com/hc/en-us/community/posts/115000094584/comments/115000405564 | |
| # Get the certification of the google.com | |
| echo -n | openssl s_client -connect google.com:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > ~/google.cer | |
| # Navigate to the jre security directory insides the Android Studio | |
| cd "/Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/jre/lib/security" | |
| # Move the certification to current directory | |
| mv ~/google.cer . |
This file contains hidden or 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
| import org.gradle.util.NameMatcher | |
| def isTaskSelected(String... taskNames) { | |
| def matcher = new NameMatcher() | |
| def nameList = Arrays.asList(taskNames) | |
| def requestedTaskNames = gradle.startParameter.taskNames | |
| for (def requestedTaskName : requestedTaskNames) { | |
| if (matcher.find(requestedTaskName, nameList) != null) { | |
| return true | |
| } |
This file contains hidden or 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
| project.afterEvaluate { | |
| project.tasks["transformClassesWithDepanForDebug"] | |
| .outputs.upToDateWhen { false } | |
| } |
This file contains hidden or 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
| def classpathConfig = project.configurations.maybeCreate("gradleClasspath") | |
| project.dependencies { | |
| gradleClasspath "org.xerial:sqlite-jdbc:3.25.2" | |
| } | |
| def classloader = Thread.currentThread().contextClassLoader as URLClassLoader | |
| classpathConfig.each { | |
| classloader.addURL(it.toURI().toURL()) | |
| } | |
| project.configurations.remove(classpathConfig) |
This file contains hidden or 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
| import org.gradle.api.Project | |
| import org.gradle.api.artifacts.component.ComponentIdentifier | |
| import org.gradle.api.artifacts.component.ComponentSelector | |
| import org.gradle.api.artifacts.component.ModuleComponentIdentifier | |
| import org.gradle.api.artifacts.component.ModuleComponentSelector | |
| import org.gradle.api.artifacts.result.DependencyResult | |
| import org.gradle.api.artifacts.result.ResolvedDependencyResult | |
| import org.gradle.api.artifacts.result.UnresolvedDependencyResult | |
| import com.google.common.io.Files | |
| import groovy.json.JsonOutput |
This file contains hidden or 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
| import android.os.Parcelable | |
| import com.google.gson.JsonDeserializationContext | |
| import com.google.gson.JsonDeserializer | |
| import com.google.gson.JsonElement | |
| import java.lang.reflect.ParameterizedType | |
| import java.lang.reflect.Type | |
| sealed class ResponseWrapper<out T> { | |
| class Anomaly(val value: com.xxx.model.wrapper.Anomaly) : ResponseWrapper<Nothing>() | |
| class Single<T : Parcelable>(val value: T) : ResponseWrapper<T>() |
OlderNewer