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
class MainActivity : AppCompactActivity() { | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
MpesaSdk.pay( | |
amount = "20.0", | |
transactionReference = "transactin_reference", | |
activity = this, // Actvity | |
onPaymentComplete = { | |
if(it == null) { |
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
import androidx.fragment.app.Fragment | |
import androidx.fragment.app.FragmentActivity | |
import androidx.lifecycle.ViewModel | |
import androidx.lifecycle.ViewModelProvider | |
fun <T : ViewModel> provideViewModel(scope: FragmentActivity, initializer: () -> T): T { | |
val vm = initializer() | |
return ViewModelProvider(scope, vm.factory()).get(vm.javaClass) | |
} |
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
class DeviceRegistrationWorker(appContext: Context, workerParams: WorkerParameters) : Worker(appContext, workerParams) { | |
companion object { | |
const val TOKEN = "token" | |
const val PROFILE_ID = "profile_id" | |
const val DEVICE_NAME = "device_name" | |
private val LOG_TAG = DeviceRegistrationWorker::class.java.simpleName | |
} |
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
package mz.co.moovi.mpesalib.config | |
import android.util.Base64 | |
import java.security.KeyFactory | |
import java.security.spec.X509EncodedKeySpec | |
import javax.crypto.Cipher | |
internal class KeyGenerator(config: MpesaConfig) { | |
val bearerToken = generateBearerToken(config) |
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
toolbar.setNavigationOnClickListener { | |
val upIntent: Intent? = NavUtils.getParentActivityIntent(activity!!) | |
when { | |
upIntent == null -> throw IllegalStateException("No Parent Activity Intent") | |
NavUtils.shouldUpRecreateTask(activity!!, upIntent) -> { | |
TaskStackBuilder.create(activity!!) | |
.addNextIntentWithParentStack(upIntent) | |
.startActivities() | |
} |
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
navController.navigate(R.id.activity_checkout_flow, CheckoutFlowActivity.bundleArgs(eventId)) |
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
fun getArgs() { | |
val eventId = EventDetailsArgs.fromBundle(arguments).event_id | |
} |
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
dependencies { | |
//Other Dependencies... | |
implementation "android.arch.navigation:navigation-fragment:1.0.0-alpha01" | |
implementation "android.arch.navigation:navigation-ui:1.0.0-alpha01" | |
} |
NewerOlder