Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
CyrilFind committed Dec 1, 2023
1 parent bc9419d commit ac91bb2
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 37 deletions.
Binary file added assets/android_elements.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed assets/views.png
Binary file not shown.
23 changes: 12 additions & 11 deletions src/1 - Introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Cyril Findeling 👋

## Kotlin

![bg left:30% 50%](../assets/kotlin.png)
![bg right:30% 80%](../assets/kotlin.png)

- Moderne
- Concis
Expand Down Expand Up @@ -301,7 +301,7 @@ button.setOnClickListener { view -> ... }

## Intro

![bg left:30% 50%](../assets/android.png)
![bg right:30% 50%](../assets/android.png)

- Nombreux utilisateurs
- Devices très différents
Expand All @@ -313,9 +313,10 @@ button.setOnClickListener { view -> ... }

## Android Studio

![bg left:30% 100%](../assets/android_studio.svg)
![bg right:50% 100%](../assets/android_studio.svg)

- IDE dédié développé par Jetbrains (IntelliJ)
- IDE dédié
- Développé par Jetbrains (IntelliJ)
- Navigation projet
- Terminal
- Logcat
Expand All @@ -327,7 +328,7 @@ button.setOnClickListener { view -> ... }

## Éléments d'une app Android

![bg left:30% 50%](../assets/android.png)
![bg right:40% 80%](../assets/android_elements.png)

- Scripts Gradle
- AndroidManifest.xml
Expand All @@ -338,7 +339,7 @@ button.setOnClickListener { view -> ... }

## App Components

![bg left:40% 160%](../assets/app_components.png)
![bg right:40% 160%](../assets/app_components.png)

- Activity / Fragments ➡ Screen Controller
- Service ➡ Headless Controller
Expand All @@ -347,7 +348,7 @@ button.setOnClickListener { view -> ... }

# iOS

![bg left:40% 80%](../assets/xcode.png)
![bg right:40% 80%](../assets/xcode.png)

- Beaucoup d'utilisateurs aux US
- Plus de 💰 dépensés
Expand All @@ -360,8 +361,8 @@ button.setOnClickListener { view -> ... }

# Cross-Platform

![bg left:30% 90%](../assets/react.png)
![bg left:30% 70%](../assets/flutter.svg)
![bg right:30% 90%](../assets/react.png)
![bg right:30% 70%](../assets/flutter.svg)

- Permet de coder une seule fois
- Souvent à base de "Components" (à la React)
Expand All @@ -371,8 +372,8 @@ button.setOnClickListener { view -> ... }

# Composants

![bg left:30% 90%](../assets/compose.png)
![bg left:30% 75%](../assets/swiftui.png)
![bg right:30% 90%](../assets/compose.png)
![bg right:30% 75%](../assets/swiftui.png)

- Swift: SwiftUI par Apple
- Kotlin: Jetpack Compose sur Android, Desktop, Web et même iOS par JetBrains et Google
28 changes: 14 additions & 14 deletions src/2 - Views.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,9 @@ Fichier XML décrivant un écran (ou une partie)
android:layout_height="wrap_content" // use only needed height
/>

<Button
android:id="@+id/button_login"
<ImageView
android:id="@+id/imageView_login"
android:src="@drawable/ic_login"
android:layout_width="0dp" // match width to constraints
android:layout_height="200dp" // specify explicit height
app:layout_constraintEnd_toEndOf="@id/textView_login" // constraint start
Expand Down Expand Up @@ -95,19 +96,17 @@ class MainFragment : Fragment() {

## References to views

![bg left:40% 90%](../assets/views.png)

```kotlin
// traditional
val loginTextView: TextView = findViewById(R.id.textView_login)
val loginTextView = findViewById<TextView>(R.id.textView_login)
val loginImageView = findViewById<ImageView>(R.id.imageView_login)
```

// ButterKnife
@BindView(R.id.textView_login) val loginTextView: TextView
Problèmes:

// viewbinding / databinding
binding.textViewLogin
```
- Pas type safe
- Pas null-safe
- Tous les ids de tous les layouts sont disponibles
- Verbeux

## ViewBinding

Expand All @@ -128,8 +127,9 @@ Usage:
val binding = ActivityMainBinding.inflate(layoutInflater)
val rootView = binding.root

// pour manipuler les vues:
binding.textViewLogin.setOnCLickListener { ... }
// toutes les vues avec des ids sont accessibles
binding.textView.text = "hello world!"
binding.imageView.setOnCLickListener { ... }
```

[Documentation](https://developer.android.com/topic/libraries/view-binding#fragments)
Expand Down Expand Up @@ -198,7 +198,7 @@ override fun onCreate(savedInstanceState: Bundle?) {

# iOS

![bg left:30% 80%](../assets/xcode.png)
![bg right:30% 80%](../assets/xcode.png)

- UIViewController (Équivalent de Activity)
- Storyboards (Layout XML manipulé visuellement)
Expand Down
2 changes: 1 addition & 1 deletion src/3 - RecyclerView.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ class MyTableDataSource : UITableViewDataSource {
## Jetpack Compose
![bg left:30% 80%](../assets/compose.svg)
![bg right:30% 100%](../assets/compose.svg)
```kotlin
LazyColumn {
Expand Down
24 changes: 13 additions & 11 deletions src/5 - Intents.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,28 @@ Objet "lancé" par une app ou le système qui contient les infos pour démarrer

## Explicite

![bg right:30% 90%](../assets/intents_explicit_implicit.png)
![bg right:40% 90%](../assets/intents_explicit_implicit.png)

```kotlin
val explicitIntent = Intent(context, MyActivity::class.java)
val explicitIntent =
Intent(context, MyActivity::class.java)

startActivity(intent)
```

## Implicite

![bg right:30% 90%](../assets/intents_explicit_implicit.png)
![bg right:40% 90%](../assets/intents_explicit_implicit.png)

```kotlin
val urlIntent = Intent("http://www.google.com")
val callButtonIntent = Intent(ACTION_CALL_BUTTON)
val phoneIntent = Intent(ACTION_DIAL, "tel:8005551234")
val searchIntent = Intent(Intent.ACTION_WEB_SEARCH)
searchIntent.putExtra(SearchManager.QUERY, "cute cat pictures")
searchIntent.putExtra(SearchManager.QUERY, "cats")

val createPdfIntent = Intent(ACTION_CREATE_DOCUMENT)
createPdfIntent.type = "application/pdf" // set MIME type
createPdfIntent.type = "application/pdf" // MIME type
createPdfIntent.addCategory(CATEGORY_OPENABLE)
```

Expand Down Expand Up @@ -66,23 +67,24 @@ val food = intent.getStringArrayExtra("food_key")
```kotlin
// Check if that intent can be handled !
if (intent.resolveActivity(packageManager) != null) {
startActivity(intent) // if no result needed, otherwise: ↴
startActivity(intent)
}
```

![height:300px](../assets/disambiguation.png)
![bg right:30% 90%](../assets/disambiguation.png)

## Using Chooser Intent / Sharesheet

![height:300px](../assets/app_chooser.png)

```kotlin
// using Chooser Intent / Sharesheet
val intent = Intent(Intent.ACTION_SEND)
val chooserIntent = Intent.createChooser(intent, "Chooser Title")
startActivity(chooserIntent)
val chooserIntent = Intent.createChooser(intent, "Title")
startActivity(chooserIntent)
```

![bg right:30% 90%](../assets/app_chooser.png)

## Intent Filters

```xml
Expand Down Expand Up @@ -220,7 +222,7 @@ Les capabilities sont dans un fichierde configuration (plist):

## iOS: Permissions

![bg left:30% 90%](../assets/ios_permission.png)
![bg right:30% 90%](../assets/ios_permission.png)

Beaucoup plus simple: on définit quelques textes dans des fichiers de configuration, ils seront utilisés pour remplir la popup quand l'OS l'estime nécessaire

Expand Down

0 comments on commit ac91bb2

Please sign in to comment.