forked from com-lihaoyi/mill
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Final Code Updated and Docs Generated, Ready to Merge After Review; F…
…ixes: com-lihaoyi#3550
- Loading branch information
1 parent
d9d78b8
commit c81b905
Showing
7 changed files
with
220 additions
and
50 deletions.
There are no files selected for viewing
This file contains 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
34 changes: 34 additions & 0 deletions
34
example/kotlinlib/android/1-hello-world/app/src/main/java/com/helloworld/app/MainActivity.kt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.helloworld.app | ||
|
||
import android.app.Activity | ||
import android.os.Bundle | ||
import android.widget.TextView | ||
import android.view.Gravity | ||
import android.view.ViewGroup.LayoutParams | ||
|
||
class MainActivity : Activity() { | ||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
|
||
// Create a new TextView | ||
val textView = TextView(this) | ||
|
||
// Set the text to "Hello, World!" | ||
textView.text = "Hello, World Kotlin!" | ||
|
||
// Set text size | ||
textView.textSize = 32f | ||
|
||
// Center the text within the view | ||
textView.gravity = Gravity.CENTER | ||
|
||
// Set layout parameters (width and height) | ||
textView.layoutParams = LayoutParams( | ||
LayoutParams.MATCH_PARENT, | ||
LayoutParams.MATCH_PARENT | ||
) | ||
|
||
// Set the content view to display the TextView | ||
setContentView(textView) | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
...ndroid/2-jetpack-compose-hello-world/app/src/main/java/com/helloworld/app/MainActivity.kt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package com.helloworld.app | ||
|
||
import android.app.Activity | ||
import android.graphics.Color | ||
import android.os.Bundle | ||
import android.view.Gravity | ||
import android.view.ViewGroup.LayoutParams | ||
import android.widget.LinearLayout | ||
import android.widget.TextView | ||
import androidx.activity.ComponentActivity | ||
import androidx.activity.compose.setContent | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
|
||
class MainActivity : Activity() { | ||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
|
||
val linearLayout = LinearLayout(this).apply { | ||
orientation = LinearLayout.VERTICAL | ||
gravity = Gravity.CENTER | ||
setBackgroundColor(Color.parseColor("#FFFFFF")) | ||
layoutParams = LayoutParams( | ||
LayoutParams.MATCH_PARENT, | ||
LayoutParams.MATCH_PARENT | ||
) | ||
} | ||
|
||
val textView = TextView(this).apply { | ||
text = "Hello, World!\nJetpack Compose!" | ||
textSize = 32f | ||
setTextColor(Color.parseColor("#34A853")) | ||
gravity = Gravity.CENTER | ||
setPadding(16, 16, 16, 16) | ||
} | ||
|
||
linearLayout.addView(textView) | ||
|
||
setContentView(linearLayout) | ||
} | ||
} |
21 changes: 0 additions & 21 deletions
21
...roid/2-jetpack-compose-hello-world/app/src/main/kotlin/com/helloworld/app/MainActivity.kt
This file was deleted.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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