Bump hikage-core, hikage-extension, hikage-extension-betterandroid, hikage-extension-compose, hikage-compiler, hikage-widget-androidx, hikage-widget-material version to 1.0.0

This commit is contained in:
2025-04-20 05:32:06 +08:00
parent 794c535789
commit 99abe3cd18
218 changed files with 13256 additions and 627 deletions

View File

@@ -0,0 +1,51 @@
plugins {
autowire(libs.plugins.android.library)
autowire(libs.plugins.kotlin.android)
autowire(libs.plugins.kotlin.dokka)
autowire(libs.plugins.maven.publish)
}
group = property.project.groupName
version = property.project.hikage.extension.version
android {
namespace = property.project.hikage.extension.namespace
compileSdk = property.project.android.compileSdk
defaultConfig {
minSdk = property.project.android.minSdk
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles("consumer-rules.pro")
}
buildTypes {
release {
isMinifyEnabled = false
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = "17"
freeCompilerArgs = listOf(
"-Xno-param-assertions",
"-Xno-call-assertions",
"-Xno-receiver-assertions"
)
}
}
dependencies {
implementation(projects.hikageCore)
implementation(com.highcapable.yukireflection.api)
implementation(com.highcapable.betterandroid.ui.extension)
implementation(com.highcapable.betterandroid.system.extension)
implementation(androidx.core.core.ktx)
implementation(androidx.appcompat.appcompat)
implementation(androidx.constraintlayout.constraintlayout)
testImplementation(junit.junit)
androidTestImplementation(androidx.test.ext.junit)
androidTestImplementation(androidx.test.espresso.espresso.core)
}

View File

21
hikage-extension/proguard-rules.pro vendored Normal file
View File

@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

View File

@@ -0,0 +1,25 @@
package com.highcapable.hikage
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.Assert.*
/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.highcapable.hikage.test", appContext.packageName)
}
}

View File

@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />

View File

@@ -0,0 +1,56 @@
/*
* Hikage - An Android responsive UI building tool.
* Copyright (C) 2019 HighCapable
* https://github.com/BetterAndroid/Hikage
*
* Apache License Version 2.0
*
* 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
*
* https://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 or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* This file is created by fankes on 2025/2/27.
*/
@file:Suppress("unused")
@file:JvmName("ActivityUtils")
package com.highcapable.hikage.extension
import android.app.Activity
import android.widget.FrameLayout
import com.highcapable.hikage.core.Hikage
import com.highcapable.hikage.core.base.HikageFactoryBuilder
import com.highcapable.hikage.core.base.HikagePerformer
import com.highcapable.hikage.core.base.Hikageable
/**
* @see Activity.setContentView
* @see Hikageable
* @return [Hikage]
*/
inline fun Activity.setContentView(
factory: HikageFactoryBuilder.() -> Unit = {},
performer: HikagePerformer<FrameLayout.LayoutParams>
) = Hikageable(context = this, factory = factory, performer = performer).apply { setContentView(root) }
/**
* @see Activity.setContentView
* @see Hikage
*/
fun Activity.setContentView(hikage: Hikage) = setContentView(hikage.root)
/**
* @see Activity.setContentView
* @see Hikage.Delegate
* @return [Hikage]
*/
fun Activity.setContentView(delegate: Hikage.Delegate<*>) =
delegate.create(context = this).apply { setContentView(root) }

View File

@@ -0,0 +1,156 @@
/*
* Hikage - An Android responsive UI building tool.
* Copyright (C) 2019 HighCapable
* https://github.com/BetterAndroid/Hikage
*
* Apache License Version 2.0
*
* 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
*
* https://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 or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* This file is created by fankes on 2025/2/27.
*/
@file:Suppress("unused")
@file:JvmName("DialogUtils")
package com.highcapable.hikage.extension
import android.app.AlertDialog
import android.app.Dialog
import android.widget.FrameLayout
import com.highcapable.hikage.core.Hikage
import com.highcapable.hikage.core.base.HikageFactoryBuilder
import com.highcapable.hikage.core.base.HikagePerformer
import com.highcapable.hikage.core.base.Hikageable
import androidx.appcompat.app.AlertDialog as AndroidXAlertDialog
/**
* @see AlertDialog.setView
* @see Hikageable
* @return [Hikage]
*/
inline fun AlertDialog.setView(
factory: HikageFactoryBuilder.() -> Unit = {},
performer: HikagePerformer<FrameLayout.LayoutParams>
) = Hikageable(context = context, factory = factory, performer = performer).apply { setView(root) }
/**
* @see AlertDialog.setView
* @see Hikage
*/
fun AlertDialog.setView(hikage: Hikage) = setView(hikage.root)
/**
* @see AlertDialog.setView
* @see Hikage.Delegate
* @return [Hikage]
*/
fun AlertDialog.setView(delegate: Hikage.Delegate<*>) =
delegate.create(context).apply { setView(root) }
/**
* @see AlertDialog.Builder.setView
* @see Hikageable
* @return [AlertDialog.Builder]
*/
inline fun AlertDialog.Builder.setView(
factory: HikageFactoryBuilder.() -> Unit = {},
performer: HikagePerformer<FrameLayout.LayoutParams>
): AlertDialog.Builder = setView(Hikageable(context = context, factory = factory, performer = performer).root)
/**
* @see AlertDialog.Builder.setView
* @see Hikage
* @return [AlertDialog.Builder]
*/
fun AlertDialog.Builder.setView(hikage: Hikage): AlertDialog.Builder = setView(hikage.root)
/**
* @see AlertDialog.Builder.setView
* @see Hikage.Delegate
* @return [AlertDialog.Builder]
*/
fun AlertDialog.Builder.setView(delegate: Hikage.Delegate<*>): AlertDialog.Builder =
setView(delegate.create(context).root)
/**
* @see AndroidXAlertDialog.setView
* @see Hikageable
* @return [Hikage]
*/
inline fun AndroidXAlertDialog.setView(
factory: HikageFactoryBuilder.() -> Unit = {},
performer: HikagePerformer<FrameLayout.LayoutParams>
) = Hikageable(context = context, factory = factory, performer = performer).apply { setView(root) }
/**
* @see AndroidXAlertDialog.setView
* @see Hikage
*/
fun AndroidXAlertDialog.setView(hikage: Hikage) = setView(hikage.root)
/**
* @see AndroidXAlertDialog.setView
* @see Hikage.Delegate
* @return [Hikage]
*/
fun AndroidXAlertDialog.setView(delegate: Hikage.Delegate<*>) =
delegate.create(context).apply { setView(root) }
/**
* @see AndroidXAlertDialog.Builder.setView
* @see Hikageable
* @return [AndroidXAlertDialog.Builder]
*/
inline fun AndroidXAlertDialog.Builder.setView(
factory: HikageFactoryBuilder.() -> Unit = {},
performer: HikagePerformer<FrameLayout.LayoutParams>
): AndroidXAlertDialog.Builder = setView(Hikageable(context = context, factory = factory, performer = performer).root)
/**
* @see AndroidXAlertDialog.Builder.setView
* @see Hikage
* @return [AndroidXAlertDialog.Builder]
*/
fun AndroidXAlertDialog.Builder.setView(hikage: Hikage): AndroidXAlertDialog.Builder = setView(hikage.root)
/**
* @see AndroidXAlertDialog.Builder.setView
* @see Hikage.Delegate
* @return [AndroidXAlertDialog.Builder]
*/
fun AndroidXAlertDialog.Builder.setView(delegate: Hikage.Delegate<*>): AndroidXAlertDialog.Builder =
setView(delegate.create(context).root)
/**
* @see Dialog.setContentView
* @see Hikageable
* @return [Hikage]
*/
inline fun Dialog.setContentView(
factory: HikageFactoryBuilder.() -> Unit = {},
performer: HikagePerformer<FrameLayout.LayoutParams>
) = Hikageable(context = context, factory = factory, performer = performer).apply { setContentView(root) }
/**
* @see Dialog.setContentView
* @see Hikage
*/
fun Dialog.setContentView(hikage: Hikage) = setContentView(hikage.root)
/**
* @see Dialog.setContentView
* @see Hikage.Delegate
* @return [Hikage]
*/
fun Dialog.setContentView(delegate: Hikage.Delegate<*>) =
delegate.create(context).apply { setContentView(root) }

View File

@@ -0,0 +1,71 @@
/*
* Hikage - An Android responsive UI building tool.
* Copyright (C) 2019 HighCapable
* https://github.com/BetterAndroid/Hikage
*
* Apache License Version 2.0
*
* 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
*
* https://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 or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* This file is created by fankes on 2025/2/27.
*/
@file:Suppress("unused", "NON_PUBLIC_CALL_FROM_PUBLIC_INLINE")
@file:JvmName("PopupWindowUtils")
package com.highcapable.hikage.extension
import android.content.Context
import android.widget.FrameLayout
import android.widget.PopupWindow
import com.highcapable.hikage.core.Hikage
import com.highcapable.hikage.core.base.HikageFactoryBuilder
import com.highcapable.hikage.core.base.HikagePerformer
import com.highcapable.hikage.core.base.Hikageable
import com.highcapable.yukireflection.factory.current
/**
* @see PopupWindow.setContentView
* @see Hikageable
* @return [Hikage]
*/
inline fun PopupWindow.setContentView(
context: Context = requireContext(),
factory: HikageFactoryBuilder.() -> Unit = {},
performer: HikagePerformer<FrameLayout.LayoutParams>
) = Hikageable(context = context, factory = factory, performer = performer).apply { setContentView(root) }
/**
* @see PopupWindow.setContentView
* @see Hikage
*/
fun PopupWindow.setContentView(hikage: Hikage) {
contentView = hikage.root
}
/**
* @see PopupWindow.setContentView
* @see Hikage.Delegate
* @return [Hikage]
*/
fun PopupWindow.setContentView(
context: Context = requireContext(),
delegate: Hikage.Delegate<*>
) = delegate.create(context).apply { setContentView(root) }
/**
* Require a context from [PopupWindow].
* @return [Context]
*/
private fun PopupWindow.requireContext() =
current(ignored = true).field { name = "mContext" }.cast<Context?>()
?: error("Hikage need a Context to create PopupWindow content view.")

View File

@@ -0,0 +1,58 @@
/*
* Hikage - An Android responsive UI building tool.
* Copyright (C) 2019 HighCapable
* https://github.com/BetterAndroid/Hikage
*
* Apache License Version 2.0
*
* 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
*
* https://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 or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* This file is created by fankes on 2025/2/27.
*/
@file:Suppress("unused")
@file:JvmName("ViewGroupUtils")
package com.highcapable.hikage.extension
import android.view.ViewGroup
import com.highcapable.hikage.core.Hikage
import com.highcapable.hikage.core.base.HikageFactoryBuilder
import com.highcapable.hikage.core.base.HikagePerformer
import com.highcapable.hikage.core.base.Hikageable
/**
* @see ViewGroup.addView
* @see Hikageable
* @return [Hikage]
*/
inline fun ViewGroup.addView(
index: Int = -1,
factory: HikageFactoryBuilder.() -> Unit = {},
performer: HikagePerformer<ViewGroup.LayoutParams>
) = Hikageable(context = context, factory = factory, performer = performer).apply { addView(root, index) }
/**
* @see ViewGroup.addView
* @see Hikage
*/
@JvmOverloads
fun ViewGroup.addView(index: Int = -1, hikage: Hikage) = addView(hikage.root, index)
/**
* @see ViewGroup.addView
* @see Hikage.Delegate
* @return [Hikage]
*/
@JvmOverloads
fun ViewGroup.addView(index: Int = -1, delegate: Hikage.Delegate<*>) =
delegate.create(context).apply { addView(root, index) }

View File

@@ -0,0 +1,56 @@
/*
* Hikage - An Android responsive UI building tool.
* Copyright (C) 2019 HighCapable
* https://github.com/BetterAndroid/Hikage
*
* Apache License Version 2.0
*
* 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
*
* https://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 or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* This file is created by fankes on 2025/2/27.
*/
@file:Suppress("unused")
@file:JvmName("WindowUtils")
package com.highcapable.hikage.extension
import android.view.Window
import android.widget.FrameLayout
import com.highcapable.hikage.core.Hikage
import com.highcapable.hikage.core.base.HikageFactoryBuilder
import com.highcapable.hikage.core.base.HikagePerformer
import com.highcapable.hikage.core.base.Hikageable
/**
* @see Window.setContentView
* @see Hikageable
* @return [Hikage]
*/
inline fun Window.setContentView(
factory: HikageFactoryBuilder.() -> Unit = {},
performer: HikagePerformer<FrameLayout.LayoutParams>
) = Hikageable(context = context, factory = factory, performer = performer).apply { setContentView(root) }
/**
* @see Window.setContentView
* @see Hikage
*/
fun Window.setContentView(hikage: Hikage) = setContentView(hikage.root)
/**
* @see Window.setContentView
* @see Hikage.Delegate
* @return [Hikage]
*/
fun Window.setContentView(delegate: Hikage.Delegate<*>) =
delegate.create(context).apply { setContentView(root) }

View File

@@ -0,0 +1,96 @@
/*
* Hikage - An Android responsive UI building tool.
* Copyright (C) 2019 HighCapable
* https://github.com/BetterAndroid/Hikage
*
* Apache License Version 2.0
*
* 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
*
* https://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 or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* This file is created by fankes on 2025/3/13.
*/
@file:Suppress("unused")
@file:JvmName("ConstraintLayoutUtils")
package com.highcapable.hikage.extension.widget
import androidx.constraintlayout.widget.ConstraintLayout
/**
* @see ConstraintLayout.LayoutParams.leftToLeft
*/
fun ConstraintLayout.LayoutParams.leftToParent() {
leftToLeft = ConstraintLayout.LayoutParams.PARENT_ID
}
/**
* @see ConstraintLayout.LayoutParams.rightToRight
*/
fun ConstraintLayout.LayoutParams.rightToParent() {
rightToRight = ConstraintLayout.LayoutParams.PARENT_ID
}
/**
* @see ConstraintLayout.LayoutParams.startToStart
*/
fun ConstraintLayout.LayoutParams.startToParent() {
startToStart = ConstraintLayout.LayoutParams.PARENT_ID
}
/**
* @see ConstraintLayout.LayoutParams.endToEnd
*/
fun ConstraintLayout.LayoutParams.endToParent() {
endToEnd = ConstraintLayout.LayoutParams.PARENT_ID
}
/**
* @see ConstraintLayout.LayoutParams.topToTop
*/
fun ConstraintLayout.LayoutParams.topToParent() {
topToTop = ConstraintLayout.LayoutParams.PARENT_ID
}
/**
* @see ConstraintLayout.LayoutParams.bottomToBottom
*/
fun ConstraintLayout.LayoutParams.bottomToParent() {
bottomToBottom = ConstraintLayout.LayoutParams.PARENT_ID
}
/**
* @see ConstraintLayout.LayoutParams.startToParent
* @see ConstraintLayout.LayoutParams.endToParent
*/
fun ConstraintLayout.LayoutParams.centerHorizontally() {
startToParent()
endToParent()
}
/**
* @see ConstraintLayout.LayoutParams.topToParent
* @see ConstraintLayout.LayoutParams.bottomToParent
*/
fun ConstraintLayout.LayoutParams.centerVertically() {
topToParent()
bottomToParent()
}
/**
* @see ConstraintLayout.LayoutParams.centerHorizontally
* @see ConstraintLayout.LayoutParams.centerVertically
*/
fun ConstraintLayout.LayoutParams.centerInParent() {
centerHorizontally()
centerVertically()
}

View File

@@ -0,0 +1,160 @@
/*
* Hikage - An Android responsive UI building tool.
* Copyright (C) 2019 HighCapable
* https://github.com/BetterAndroid/Hikage
*
* Apache License Version 2.0
*
* 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
*
* https://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 or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* This file is created by fankes on 2025/3/13.
*/
@file:Suppress("unused")
@file:JvmName("RelativeLayoutUtils")
package com.highcapable.hikage.extension.widget
import android.widget.RelativeLayout
import androidx.annotation.IdRes
/**
* @see RelativeLayout.LayoutParams.addRule
* @see RelativeLayout.LEFT_OF
*/
fun RelativeLayout.LayoutParams.leftOf(@IdRes id: Int) = addRule(RelativeLayout.LEFT_OF, id)
/**
* @see RelativeLayout.LayoutParams.addRule
* @see RelativeLayout.RIGHT_OF
*/
fun RelativeLayout.LayoutParams.rightOf(@IdRes id: Int) = addRule(RelativeLayout.RIGHT_OF, id)
/**
* @see RelativeLayout.LayoutParams.addRule
* @see RelativeLayout.ABOVE
*/
fun RelativeLayout.LayoutParams.above(@IdRes id: Int) = addRule(RelativeLayout.ABOVE, id)
/**
* @see RelativeLayout.LayoutParams.addRule
* @see RelativeLayout.BELOW
*/
fun RelativeLayout.LayoutParams.below(@IdRes id: Int) = addRule(RelativeLayout.BELOW, id)
/**
* @see RelativeLayout.LayoutParams.addRule
* @see RelativeLayout.ALIGN_BASELINE
*/
fun RelativeLayout.LayoutParams.alignBaseline(@IdRes id: Int) = addRule(RelativeLayout.ALIGN_BASELINE, id)
/**
* @see RelativeLayout.LayoutParams.addRule
* @see RelativeLayout.ALIGN_LEFT
*/
fun RelativeLayout.LayoutParams.alignLeft(@IdRes id: Int) = addRule(RelativeLayout.ALIGN_LEFT, id)
/**
* @see RelativeLayout.LayoutParams.addRule
* @see RelativeLayout.ALIGN_TOP
*/
fun RelativeLayout.LayoutParams.alignTop(@IdRes id: Int) = addRule(RelativeLayout.ALIGN_TOP, id)
/**
* @see RelativeLayout.LayoutParams.addRule
* @see RelativeLayout.ALIGN_RIGHT
*/
fun RelativeLayout.LayoutParams.alignRight(@IdRes id: Int) = addRule(RelativeLayout.ALIGN_RIGHT, id)
/**
* @see RelativeLayout.LayoutParams.addRule
* @see RelativeLayout.ALIGN_BOTTOM
*/
fun RelativeLayout.LayoutParams.alignBottom(@IdRes id: Int) = addRule(RelativeLayout.ALIGN_BOTTOM, id)
/**
* @see RelativeLayout.LayoutParams.addRule
* @see RelativeLayout.ALIGN_PARENT_LEFT
*/
fun RelativeLayout.LayoutParams.alignParentLeft() = addRule(RelativeLayout.ALIGN_PARENT_LEFT)
/**
* @see RelativeLayout.LayoutParams.addRule
* @see RelativeLayout.ALIGN_PARENT_TOP
*/
fun RelativeLayout.LayoutParams.alignParentTop() = addRule(RelativeLayout.ALIGN_PARENT_TOP)
/**
* @see RelativeLayout.LayoutParams.addRule
* @see RelativeLayout.ALIGN_PARENT_RIGHT
*/
fun RelativeLayout.LayoutParams.alignParentRight() = addRule(RelativeLayout.ALIGN_PARENT_RIGHT)
/**
* @see RelativeLayout.LayoutParams.addRule
* @see RelativeLayout.ALIGN_PARENT_BOTTOM
*/
fun RelativeLayout.LayoutParams.alignParentBottom() = addRule(RelativeLayout.ALIGN_PARENT_BOTTOM)
/**
* @see RelativeLayout.LayoutParams.addRule
* @see RelativeLayout.CENTER_IN_PARENT
*/
fun RelativeLayout.LayoutParams.centerInParent() = addRule(RelativeLayout.CENTER_IN_PARENT)
/**
* @see RelativeLayout.LayoutParams.addRule
* @see RelativeLayout.CENTER_HORIZONTAL
*/
fun RelativeLayout.LayoutParams.centerHorizontally() = addRule(RelativeLayout.CENTER_HORIZONTAL)
/**
* @see RelativeLayout.LayoutParams.addRule
* @see RelativeLayout.CENTER_VERTICAL
*/
fun RelativeLayout.LayoutParams.centerVertically() = addRule(RelativeLayout.CENTER_VERTICAL)
/**
* @see RelativeLayout.LayoutParams.addRule
* @see RelativeLayout.START_OF
*/
fun RelativeLayout.LayoutParams.startOf(@IdRes id: Int) = addRule(RelativeLayout.START_OF, id)
/**
* @see RelativeLayout.LayoutParams.addRule
* @see RelativeLayout.END_OF
*/
fun RelativeLayout.LayoutParams.endOf(@IdRes id: Int) = addRule(RelativeLayout.END_OF, id)
/**
* @see RelativeLayout.LayoutParams.addRule
* @see RelativeLayout.ALIGN_START
*/
fun RelativeLayout.LayoutParams.alignStart(@IdRes id: Int) = addRule(RelativeLayout.ALIGN_START, id)
/**
* @see RelativeLayout.LayoutParams.addRule
* @see RelativeLayout.ALIGN_END
*/
fun RelativeLayout.LayoutParams.alignEnd(@IdRes id: Int) = addRule(RelativeLayout.ALIGN_END, id)
/**
* @see RelativeLayout.LayoutParams.addRule
* @see RelativeLayout.ALIGN_PARENT_START
*/
fun RelativeLayout.LayoutParams.alignParentStart() = addRule(RelativeLayout.ALIGN_PARENT_START)
/**
* @see RelativeLayout.LayoutParams.addRule
* @see RelativeLayout.ALIGN_PARENT_END
*/
fun RelativeLayout.LayoutParams.alignParentEnd() = addRule(RelativeLayout.ALIGN_PARENT_END)

View File

@@ -0,0 +1,18 @@
package com.highcapable.hikage
import org.junit.Test
import org.junit.Assert.*
/**
* Example local unit test, which will execute on the development machine (host).
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
class ExampleUnitTest {
@Test
fun addition_isCorrect() {
assertEquals(4, 2 + 2)
}
}