1 /* 2 * Copyright 2020 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package androidx.compose.ui.text.input 18 19 import androidx.compose.runtime.Stable 20 21 /** 22 * Options to request software keyboard to capitalize the text. Applies to languages which has 23 * upper-case and lower-case letters. 24 */ 25 @kotlin.jvm.JvmInline 26 value class KeyboardCapitalization private constructor(private val value: Int) { 27 toStringnull28 override fun toString(): String { 29 return when (this) { 30 Unspecified -> "Unspecified" 31 None -> "None" 32 Characters -> "Characters" 33 Words -> "Words" 34 Sentences -> "Sentences" 35 else -> "Invalid" 36 } 37 } 38 39 companion object { 40 /** Capitalization behavior is not specified. */ 41 @Stable val Unspecified = KeyboardCapitalization(-1) 42 43 /** Do not auto-capitalize text. */ 44 @Stable val None = KeyboardCapitalization(0) 45 46 /** Capitalize all characters. */ 47 @Stable val Characters = KeyboardCapitalization(1) 48 49 /** Capitalize the first character of every word. */ 50 @Stable val Words = KeyboardCapitalization(2) 51 52 /** Capitalize the first character of each sentence. */ 53 @Stable val Sentences = KeyboardCapitalization(3) 54 } 55 } 56