Skip to content

Instantly share code, notes, and snippets.

View BKinya's full-sized avatar

Beatrice Kinya BKinya

View GitHub Profile
/*
* Copyright 2022 DroidconKE
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
/*
* Copyright 2022 DroidconKE
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
interface TimeCapsule<S : MoviesViewState> {
fun addState(state: S)
fun selectState(position: Int)
fun getStates(): List<S>
}
class TimeTravelCapsule<S : MoviesViewState>(
private val onStateSelected: (S) -> Unit
) : TimeCapsule<S> {
private val states = mutableListOf<S>()
// 1. Add the Protobuf plugin
plugins {
id "com.google.protobuf" version "0.8.17"
}
// 2. Add the Protobuf and Proto DataStore dependencies
// DataStore
implementation "androidx.datastore:datastore-core:1.0.0"
// Protobuf
Implementation "com.google.protobuf:protobuf-javalite:3.18.0"
<?xml version="1.0" encoding="utf-8"?>
<MotionScene xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:motion="http://schemas.android.com/apk/res-auto">
<Transition
motion:constraintSetStart="@+id/start"
motion:constraintSetEnd="@+id/end"
motion:duration="1000">
<OnSwipe
motion:touchAnchorId="@+id/button"
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:kaptDebugKotlin'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.lambda$executeIfValid$1(ExecuteActionsTaskExecuter.java:200)
at org.gradle.internal.Try$Failure.ifSuccessfulOrElse(Try.java:263)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeIfValid(ExecuteActionsTaskExecuter.java:198)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:179)
at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:109)
at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46)
at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:62)
at org.gradle.api.internal.tasks.execution.SkipT
public class Second {
public static void main(String[] args) {
Math myObj = new Math(78.0, 56.4);
myObj.product();
double product = myObj.getResult();
System.out.println("Product is " + product);
myObj.sum();
double sum = myObj.getResult();
System.out.println("sum is " + sum);
}
class Math {
private double num1;
private double num2;
private double result;
public Math(double num1, double num2) {
this.num1 = num1;
this.num2 = num2;
body: Container(
padding: EdgeInsets.all(10.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
buildCard('I love Flutter'),
buildCard('Flutter is awesome'),
],
),
)
Widget buildCard(String message) {
return Card(
color: Colors.white70,
child: Container(
padding: EdgeInsets.all(10.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Text(message,