Skip to content

Commit e660ce6

Browse files
committed
Add isTablet() and inLandscape() functions
1 parent 3d517d4 commit e660ce6

File tree

7 files changed

+65
-6
lines changed

7 files changed

+65
-6
lines changed

.idea/gradle.xml

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/inspectionProfiles/Project_Default.xml

Lines changed: 41 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/src/main/java/com/lighttigerxiv/layoutscaffold/MainActivity.kt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,8 @@ import androidx.compose.foundation.layout.fillMaxWidth
1212
import androidx.compose.foundation.layout.height
1313
import androidx.compose.foundation.layout.padding
1414
import androidx.compose.material3.MaterialTheme
15-
import androidx.compose.material3.Surface
1615
import androidx.compose.material3.Text
17-
import androidx.compose.runtime.Composable
1816
import androidx.compose.ui.Modifier
19-
import androidx.compose.ui.graphics.Color
20-
import androidx.compose.ui.tooling.preview.Preview
2117
import androidx.compose.ui.unit.dp
2218
import com.lighttigerxiv.layout_scaffold.LayoutScaffold
2319
import com.lighttigerxiv.layoutscaffold.ui.theme.LayoutScaffoldTheme

layout-scaffold/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ afterEvaluate {
5252

5353
groupId = 'com.github.lighttigerxiv'
5454
artifactId = 'layout-scaffold'
55-
version = '1.0.2'
55+
version = '1.1.0'
5656
}
5757
}
5858
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package com.lighttigerxiv.layout_scaffold
2+
3+
import android.content.res.Configuration
4+
import androidx.compose.runtime.Composable
5+
import androidx.compose.ui.platform.LocalConfiguration
6+
7+
@Composable
8+
fun inLandscape(): Boolean{
9+
return LocalConfiguration.current.orientation == Configuration.ORIENTATION_LANDSCAPE
10+
}
11+
12+
@Composable
13+
fun isTablet(): Boolean{
14+
val configuration = LocalConfiguration.current
15+
16+
return if(inLandscape()){
17+
configuration.screenWidthDp > 1000
18+
}else{
19+
configuration.screenWidthDp > 750
20+
}
21+
}

settings.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ dependencyResolutionManagement {
1010
repositories {
1111
google()
1212
mavenCentral()
13+
maven { url 'https://jitpack.io' }
1314
}
1415
}
1516

0 commit comments

Comments
 (0)