Skip to content

Commit

Permalink
code optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
samwelnyandoro committed Jul 4, 2024
1 parent 6239fb5 commit 18eb7a0
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
1 change: 1 addition & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ dependencies {
implementation libs.butterknife
implementation libs.firebase.messaging
annotationProcessor libs.butterknife.compiler
implementation libs.core
//Networking
implementation libs.retrofit
implementation libs.converter.gson
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,22 @@

import androidx.appcompat.app.AppCompatActivity;

import android.app.ProgressDialog;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

import com.mpesaandroidintegration.mpesa.Mpesa;
import com.mpesaandroidintegration.mpesa.interfaces.AuthListener;
import com.mpesaandroidintegration.mpesa.interfaces.MpesaListener;
import com.mpesaandroidintegration.mpesa.models.STKPush;
import com.mpesaandroidintegration.mpesa.utils.Pair;

public class MainActivity extends AppCompatActivity implements AuthListener, MpesaListener {
//TODO: Replace these values from
Expand Down Expand Up @@ -35,7 +50,7 @@ protected void onCreate(Bundle savedInstanceState) {
dialog.setMessage("Processing");
dialog.setIndeterminate(true);

pay.setOnClickListener(new OnClickListener() {
pay.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String p = phone.getText().toString();
Expand Down Expand Up @@ -75,7 +90,7 @@ public void onAuthSuccess() {
}
private void pay(String phone, int amount){
dialog.show();
STKPush.Builder builder = new Builder(BUSINESS_SHORT_CODE, PASSKEY, amount,BUSINESS_SHORT_CODE, phone);
STKPush.Builder builder = new STKPush.Builder(BUSINESS_SHORT_CODE, PASSKEY, amount,BUSINESS_SHORT_CODE, phone);

SharedPreferences sharedPreferences = getSharedPreferences(SHARED_PREFERENCES, MODE_PRIVATE);
String token = sharedPreferences.getString("InstanceID", "");
Expand Down
2 changes: 2 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
appcompat = "1.7.0"
butterknife = "10.2.3"
constraintlayout = "2.1.4"
core = "0.9.5.0"
espressoCore = "3.6.1"
gson = "2.10.1"
junit = "4.13.2"
Expand All @@ -18,6 +19,7 @@ butterknife = { module = "com.jakewharton:butterknife", version.ref = "butterkni
butterknife-compiler = { module = "com.jakewharton:butterknife-compiler", version.ref = "butterknife" }
constraintlayout = { module = "androidx.constraintlayout:constraintlayout", version.ref = "constraintlayout" }
converter-gson = { module = "com.squareup.retrofit2:converter-gson", version.ref = "retrofit" }
core = { module = "com.afollestad.material-dialogs:core", version.ref = "core" }
espresso-core = { module = "androidx.test.espresso:espresso-core", version.ref = "espressoCore" }
ext-junit = { module = "androidx.test.ext:junit", version.ref = "junitVersion" }
gson = { module = "com.google.code.gson:gson", version.ref = "gson" }
Expand Down

0 comments on commit 18eb7a0

Please sign in to comment.