Rename the package for TwoPaneLayout (#32)

* Rename the package

* Fix the warning
This commit is contained in:
Joy Liu 2021-06-22 12:04:04 -07:00 коммит произвёл GitHub
Родитель bbe9c28be0
Коммит a6b102499a
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
17 изменённых файлов: 49 добавлений и 37 удалений

13
CONTRIBUTING.md Normal file
Просмотреть файл

@ -0,0 +1,13 @@
# Contributing
This project welcomes contributions and suggestions. Most contributions require you to agree to a
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.
When you submit a pull request, a CLA bot will automatically determine whether you need to provide
a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions
provided by the bot. You will only need to do this once across all repos using our CLA.
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.

Просмотреть файл

@ -20,7 +20,7 @@
tools:replace="android:debuggable">
<activity
android:name="com.microsoft.device.display.twopanelayout.TestActivity">
android:name="com.microsoft.device.dualscreen.twopanelayout.TestActivity">
</activity>
</application>
</manifest>

Просмотреть файл

@ -14,7 +14,7 @@
* limitations under the License.
*/
package com.microsoft.device.display.twopanelayout
package com.microsoft.device.dualscreen.twopanelayout
import android.app.Activity
import android.graphics.Rect
@ -33,7 +33,7 @@ import androidx.compose.ui.platform.ViewRootForTest
import androidx.compose.ui.test.junit4.createAndroidComposeRule
import androidx.compose.ui.unit.Constraints
import androidx.compose.ui.unit.IntSize
import com.microsoft.device.display.twopanelayout.screenState.ScreenState
import com.microsoft.device.dualscreen.twopanelayout.screenState.ScreenState
import org.junit.Assert.assertEquals
import org.junit.Assert.assertNotNull
import org.junit.Assert.assertTrue

Просмотреть файл

@ -1,4 +1,4 @@
package com.microsoft.device.display.twopanelayout
package com.microsoft.device.dualscreen.twopanelayout
import androidx.activity.ComponentActivity
import java.util.concurrent.CountDownLatch

Просмотреть файл

@ -3,7 +3,7 @@
* Licensed under the MIT License.
*/
package com.microsoft.device.display.twopanelayout
package com.microsoft.device.dualscreen.twopanelayout
import android.graphics.Rect
import androidx.compose.ui.Modifier
@ -15,10 +15,10 @@ import androidx.compose.ui.platform.isDebugInspectorInfoEnabled
import androidx.compose.ui.unit.Constraints
import androidx.compose.ui.unit.IntSize
import androidx.test.ext.junit.runners.AndroidJUnit4
import com.microsoft.device.display.twopanelayout.screenState.DeviceType
import com.microsoft.device.display.twopanelayout.screenState.LayoutOrientation
import com.microsoft.device.display.twopanelayout.screenState.LayoutState
import com.microsoft.device.display.twopanelayout.screenState.ScreenState
import com.microsoft.device.dualscreen.twopanelayout.screenState.DeviceType
import com.microsoft.device.dualscreen.twopanelayout.screenState.LayoutOrientation
import com.microsoft.device.dualscreen.twopanelayout.screenState.LayoutState
import com.microsoft.device.dualscreen.twopanelayout.screenState.ScreenState
import org.junit.After
import org.junit.Assert.assertEquals
import org.junit.Assert.assertTrue

Просмотреть файл

@ -5,6 +5,6 @@
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.microsoft.device.display.twopanelayout">
package="com.microsoft.device.dualscreen.twopanelayout">
</manifest>

Просмотреть файл

@ -3,7 +3,7 @@
* Licensed under the MIT License.
*/
package com.microsoft.device.display.twopanelayout
package com.microsoft.device.dualscreen.twopanelayout
import android.graphics.Rect
import androidx.compose.foundation.layout.LayoutScopeMarker
@ -19,11 +19,11 @@ import androidx.compose.ui.geometry.Size
import androidx.compose.ui.layout.Layout
import androidx.compose.ui.platform.LocalView
import androidx.compose.ui.platform.debugInspectorInfo
import com.microsoft.device.display.twopanelayout.screenState.ConfigScreenState
import com.microsoft.device.display.twopanelayout.screenState.DeviceType
import com.microsoft.device.display.twopanelayout.screenState.LayoutOrientation
import com.microsoft.device.display.twopanelayout.screenState.LayoutState
import com.microsoft.device.display.twopanelayout.screenState.ScreenState
import com.microsoft.device.dualscreen.twopanelayout.screenState.ConfigScreenState
import com.microsoft.device.dualscreen.twopanelayout.screenState.DeviceType
import com.microsoft.device.dualscreen.twopanelayout.screenState.LayoutOrientation
import com.microsoft.device.dualscreen.twopanelayout.screenState.LayoutState
import com.microsoft.device.dualscreen.twopanelayout.screenState.ScreenState
/**
* A layout component that places its children in one or two panes vertically or horizontally to

Просмотреть файл

@ -3,7 +3,7 @@
* Licensed under the MIT License.
*/
package com.microsoft.device.display.twopanelayout
package com.microsoft.device.dualscreen.twopanelayout
import android.graphics.Rect
import androidx.compose.runtime.Composable
@ -17,8 +17,8 @@ import androidx.compose.ui.platform.InspectorInfo
import androidx.compose.ui.platform.InspectorValueInfo
import androidx.compose.ui.unit.Constraints
import androidx.compose.ui.unit.Density
import com.microsoft.device.display.twopanelayout.screenState.LayoutOrientation
import com.microsoft.device.display.twopanelayout.screenState.LayoutState
import com.microsoft.device.dualscreen.twopanelayout.screenState.LayoutOrientation
import com.microsoft.device.dualscreen.twopanelayout.screenState.LayoutState
import kotlin.math.roundToInt
@Composable
@ -145,16 +145,15 @@ private fun measureTwoPaneEqually(
paneSize: Size,
measurables: List<Measurable>
): List<Placeable> {
var paneWidth = paneSize.width.toInt()
var paneHeight = paneSize.height.toInt()
val paneWidth = paneSize.width.toInt()
val paneHeight = paneSize.height.toInt()
val childConstraints = Constraints(
minWidth = constraints.minWidth.coerceAtMost(paneWidth),
minHeight = constraints.minHeight.coerceAtMost(paneHeight),
maxWidth = constraints.maxWidth.coerceAtMost(paneWidth),
maxHeight = constraints.maxHeight.coerceAtMost(paneHeight)
)
var placeables = measurables.map { it.measure(childConstraints) }
return placeables
return measurables.map { it.measure(childConstraints) }
}
/*

Просмотреть файл

@ -3,7 +3,7 @@
* Licensed under the MIT License.
*/
package com.microsoft.device.display.twopanelayout.screenState
package com.microsoft.device.dualscreen.twopanelayout.screenState
import android.graphics.Rect
import androidx.compose.ui.geometry.Size
@ -31,8 +31,8 @@ enum class LayoutState {
/**
* DeviceType
* Single, // regular single-screen device, such as single-screen phone
* Multiple, // dual-screen/foldable/rollable device, such as Surface Duo device, Samsung Galaxy Fold 2
* Big // big-screen device, such as tablet
* Multiple, // dual-screen/foldable device, such as Surface Duo device, Samsung Galaxy Fold 2
* Big // large-screen device, such as tablet
*/
enum class DeviceType {
Single,
@ -47,7 +47,7 @@ class ScreenState(
var orientation: LayoutOrientation,
var layoutState: LayoutState
) {
var paneSize: Size = Size.Zero
val paneSize: Size
get() {
if (deviceType == DeviceType.Big) {
return if (orientation == LayoutOrientation.Vertical) {

Просмотреть файл

@ -3,7 +3,7 @@
* Licensed under the MIT License.
*/
package com.microsoft.device.display.twopanelayout.screenState
package com.microsoft.device.dualscreen.twopanelayout.screenState
import android.content.res.Configuration.ORIENTATION_PORTRAIT
import android.graphics.Rect

Просмотреть файл

@ -10,7 +10,7 @@ android {
compileSdkVersion rootProject.ext.compileSdkVersion
defaultConfig {
applicationId "com.microsoft.device.display.twopanelayout.sample"
applicationId "com.microsoft.device.dualscreen.twopanelayout.sample"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion

Просмотреть файл

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.microsoft.device.display.twopanelayout">
package="com.microsoft.device.dualscreen.twopanelayout">
<application
android:allowBackup="true"

Просмотреть файл

@ -1,4 +1,4 @@
package com.microsoft.device.display.twopanelayout
package com.microsoft.device.dualscreen.twopanelayout
import android.os.Bundle
import androidx.activity.ComponentActivity
@ -18,7 +18,7 @@ import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.sp
import com.microsoft.device.display.twopanelayout.sample.ui.theme.TwoPaneLayoutTheme
import com.microsoft.device.dualscreen.twopanelayout.ui.theme.TwoPaneLayoutTheme
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
@ -52,7 +52,7 @@ fun MainPage() {
)
},
content = {
TwoPaneLayout() {
TwoPaneLayout {
Text(
text = stringResource(R.string.first_pane_text),
modifier = Modifier.fillMaxSize().background(color = Color.Cyan) // .weight(.3f)

Просмотреть файл

@ -1,4 +1,4 @@
package com.microsoft.device.display.twopanelayout.sample.ui.theme
package com.microsoft.device.dualscreen.twopanelayout.ui.theme
import androidx.compose.ui.graphics.Color

Просмотреть файл

@ -1,4 +1,4 @@
package com.microsoft.device.display.twopanelayout.sample.ui.theme
package com.microsoft.device.dualscreen.twopanelayout.ui.theme
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.Shapes

Просмотреть файл

@ -1,4 +1,4 @@
package com.microsoft.device.display.twopanelayout.sample.ui.theme
package com.microsoft.device.dualscreen.twopanelayout.ui.theme
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.material.MaterialTheme

Просмотреть файл

@ -1,4 +1,4 @@
package com.microsoft.device.display.twopanelayout.sample.ui.theme
package com.microsoft.device.dualscreen.twopanelayout.ui.theme
import androidx.compose.material.Typography
import androidx.compose.ui.text.TextStyle