Skip to content

Commit

Permalink
Update readme, dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
EricKuck committed Mar 22, 2023
1 parent f1ae2ed commit f5c8f8d
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 44 deletions.
59 changes: 34 additions & 25 deletions README.md
Expand Up @@ -19,6 +19,10 @@ Conductor is architecture-agnostic and does not try to force any design decision

## Installation

Conductor 4.0 is coming soon. It is already being used in production with many, many millions of users. It is, however, not guaranteed to be API stable. As such, it is being released as a preview rather than a standard release. Preview in this context is _not_ a commentary on stability. It is considered to be up to the same quality standards as the current 3.x stable release.
Changes in Conductor 4 are available in the [GitHub releases](https://github.com/bluelinelabs/Conductor/releases/). In preparation for the release of the next version, there are currently 3 installation options:

### Latest Stable 3.x
```gradle
def conductorVersion = '3.2.0'
Expand All @@ -40,9 +44,11 @@ implementation "com.bluelinelabs:conductor-autodispose:$conductorVersion"
implementation "com.bluelinelabs:conductor-archlifecycle:$conductorVersion"
```

**SNAPSHOT**
### 4.0 Preview
Use `4.0.0-preview-1` as your version number in any of the dependencies above.

Just use `3.2.1-SNAPSHOT` as your version number in any of the dependencies above and add the url to the snapshot repository:
### SNAPSHOT
Use `4.0.0-SNAPSHOT` as your version number in any of the dependencies above and add the url to the snapshot repository:

```gradle
allprojects {
Expand All @@ -65,40 +71,43 @@ __RouterTransaction__ | Transactions are used to define data about adding Contro

### Minimal Activity implementation

```java
public class MainActivity extends Activity {
```kotlin
class MainActivity : AppCompatActivity() {

private lateinit var router: Router

private Router router;
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main)

setContentView(R.layout.activity_main);
val container = findViewById<ViewGroup>(R.id.controller_container)

ViewGroup container = (ViewGroup) findViewById(R.id.controller_container);
router = Conductor.attachRouter(this, binding.controllerContainer, savedInstanceState)
.setPopRootControllerMode(PopRootControllerMode.NEVER)
.setOnBackPressedDispatcherEnabled(true)

router = Conductor.attachRouter(this, container, savedInstanceState)
.setPopRootControllerMode(PopRootControllerMode.NEVER);
if (!router.hasRootController()) {
router.setRoot(RouterTransaction.with(new HomeController()));
}
if (!router.hasRootController()) {
router.setRoot(RouterTransaction.with(HomeController()))
}
}
}
```

### Minimal Controller implementation

```java
public class HomeController extends Controller {

@Override
protected View onCreateView(@NonNull LayoutInflater inflater, @NonNull ViewGroup container, @Nullable Bundle savedViewState) {
View view = inflater.inflate(R.layout.controller_home, container, false);
((TextView) view.findViewById(R.id.tv_title)).setText("Hello World");
return view;
}

```kotlin
class HomeController : Controller() {

override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup,
savedViewState: Bundle?
): View {
val view = inflater.inflate(R.layout.controller_home, container, false)
view.findViewById<TextView>(R.id.tv_title).text = "Hello World"
return view
}
}
```

Expand Down
Expand Up @@ -25,6 +25,7 @@ object Conductor {
*/
@UiThread
@JvmStatic
@JvmOverloads
fun attachRouter(
activity: Activity,
container: ViewGroup,
Expand Down
Expand Up @@ -25,24 +25,12 @@ class MainActivity : AppCompatActivity(), ToolbarProvider {

router = Conductor.attachRouter(this, binding.controllerContainer, savedInstanceState)
.setPopRootControllerMode(PopRootControllerMode.NEVER)
.setOnBackPressedDispatcherEnabled(UseOnBackPressedDispatcher)
.setOnBackPressedDispatcherEnabled(true)

if (!router.hasRootController()) {
router.setRoot(RouterTransaction.with(HomeController()))
}
}

override fun onBackPressed() {
// This method shouldn't be overridden at all if we're using the OnBackPressedDispatcher
if (UseOnBackPressedDispatcher) {
super.onBackPressed()
return
}

if (!router.handleBack()) {
super.onBackPressed()
}
}
}

private const val UseOnBackPressedDispatcher = true
10 changes: 5 additions & 5 deletions gradle/libs.versions.toml
Expand Up @@ -3,7 +3,7 @@ minsdk = "16"
compilesdk = "33"
targetsdk = "28"

agp = "7.2.2" # Note: update lint version whenever this is updated
agp = "7.4.2" # Note: update lint version whenever this is updated
androidx-activity = "1.6.1"
androidx-annotation = "1.1.0"
androidx-appcompat = "1.4.2"
Expand All @@ -15,13 +15,13 @@ androidx-transition = "1.3.1"
androidx-viewpager2 = "1.0.0"
autodispose = "1.0.0"
compose = "1.3.1"
compose-compiler = "1.4.1"
dokka = "1.4.32"
compose-compiler = "1.4.3"
dokka = "1.8.10"
junit = "4.13"
kotest = "4.6.0"
kotlin = "1.8.0"
kotlin = "1.8.10"
leakCanary = "2.7"
lint = "30.2.2" # Should always be agp + 23
lint = "30.4.2" # Should always be agp + 23
material = "1.2.1"
mvnpublish = "0.23.2"
picasso = "2.5.2"
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

0 comments on commit f5c8f8d

Please sign in to comment.