Skip to content

Uidarkmode #210

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 28
compileSdkVersion 29
defaultConfig {
applicationId "com.flutterwave.rave_android"
minSdkVersion 15
targetSdkVersion 28
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand Down
11 changes: 7 additions & 4 deletions app/src/main/java/com/flutterwave/rave_android/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatDelegate;
import androidx.appcompat.widget.SwitchCompat;

import com.flutterwave.raveandroid.RavePayActivity;
Expand Down Expand Up @@ -49,7 +50,7 @@ public class MainActivity
implements
FeeCheckListener, // Implement if you want to be able to check fees beforehand
SavedCardsListener, // Implement if you want to be able to save cards and charge saved cards
CardPaymentCallback {// Must be implemented to charge cards with custom UI or no-UI
CardPaymentCallback { // Must be implemented to charge cards with custom UI or no-UI

EditText emailEt;
EditText amountEt;
Expand Down Expand Up @@ -105,6 +106,8 @@ protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);

emailEt = findViewById(R.id.emailEt);
amountEt = findViewById(R.id.amountEt);
publicKeyEt = findViewById(R.id.publicKeyEt);
Expand Down Expand Up @@ -519,10 +522,10 @@ public void showProgressIndicator(boolean active) {
progressDialog = new ProgressDialog(this);
progressDialog.setCanceledOnTouchOutside(false);
progressDialog.setMessage("Please wait...");
}

if (active && !progressDialog.isShowing()) {
} else if (active && !progressDialog.isShowing()) {
progressDialog.show();
} else if (active && !progressDialog.isShowing()) {

} else {
progressDialog.dismiss();
}
Expand Down
9 changes: 9 additions & 0 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:hint="@string/email"
tools:text="[email protected]"
android:inputType="textEmailAddress"
android:textSize="14sp" />

Expand All @@ -305,6 +306,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
tools:text="1"
android:hint="@string/amount_to_charge_required"
android:inputType="number"
android:textSize="14sp" />
Expand Down Expand Up @@ -332,6 +334,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
tools:text="ref"
android:hint="@string/txref_required"
android:textSize="14sp" />

Expand All @@ -340,6 +343,7 @@
android:id="@+id/narrationTV"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:text="ravepay"
android:layout_marginBottom="10dp"
android:hint="@string/narration"
android:textSize="14sp" />
Expand All @@ -349,6 +353,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
tools:text="NGN"
android:hint="@string/currency_code_e_g_ngn"
android:textSize="14sp" />

Expand All @@ -357,6 +362,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
tools:text="NG"
android:hint="@string/country_code_e_g_ng"
android:textSize="14sp" />

Expand All @@ -366,6 +372,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
tools:text="taiwo"
android:hint="@string/first_name"
android:textSize="14sp" />

Expand All @@ -374,6 +381,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
tools:text="ade"
android:hint="@string/last_name"
android:textSize="14sp" />

Expand All @@ -383,6 +391,7 @@
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:inputType="phone"
tools:text="08132383284"
android:hint="@string/phone_number"
android:textSize="14sp" />

Expand Down
4 changes: 3 additions & 1 deletion app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@
<resources>
<color name="colorPrimary">#F99B37</color>
<color name="colorPrimaryDark">#c16c00</color>
<color name="colorAccent">#FF4081</color>
<color name="colorAccent">#c16c00</color>
<color name="blackgrey">#12122c</color>

</resources>
2 changes: 1 addition & 1 deletion app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<resources>

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<style name="AppTheme" parent="Theme.AppCompat.DayNight">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.0'
classpath 'com.android.tools.build:gradle:3.3.2'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
4 changes: 2 additions & 2 deletions rave_android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ apply plugin: 'com.github.dcendents.android-maven'
group = 'com.github.flutterwave'

android {
compileSdkVersion 28
compileSdkVersion 29

defaultConfig {
minSdkVersion 15
targetSdkVersion 28
targetSdkVersion 29
versionCode 1
versionName "2.0.5"

Expand Down
3 changes: 3 additions & 0 deletions rave_android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,17 @@
<application
android:allowBackup="true"
android:label="@string/app_name"
android:theme="@style/AppThemes"
android:supportsRtl="true">
<activity
android:name=".RavePayActivity"
android:label="@string/app_name"
android:theme="@style/AppThemes"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustPan" />
<activity
android:name=".card.savedcards.SavedCardsActivity"
android:theme="@style/AppThemes"
android:screenOrientation="portrait" />
</application>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -551,8 +551,8 @@ private void generatePaymentTiles() {
Collections.reverse(orderedPaymentTypesList);

tileCount = orderedPaymentTypesList.size();
if (tileCount > 8) paymentTilesTextSize = 18f;
else paymentTilesTextSize = 20f;
if (tileCount > 8) paymentTilesTextSize = 16f;
else paymentTilesTextSize = 18f;

for (int index = 0; index < orderedPaymentTypesList.size(); index++)
addPaymentType(orderedPaymentTypesList.get(index));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ public class CardFragment extends Fragment implements View.OnClickListener, Card
private static final String RAVEPAY = "ravepay";
private View v;
TextView useASavedCardTv;
TextView useAnotherCardTv;
private Button payButton;
private TextView pcidss_tv;
private AlertDialog dialog;
Expand Down Expand Up @@ -131,9 +130,13 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
if (savedInstanceState.containsKey(STATE_PRESENTER_SAVEDCARDS)) {
Type savedCardsListType = new TypeToken<List<SavedCard>>() {
}.getType();
presenter.savedCards = (new Gson()).fromJson(savedInstanceState.getString
(STATE_PRESENTER_SAVEDCARDS),
savedCardsListType);
try {
presenter.savedCards = (new Gson()).fromJson(savedInstanceState.getString
(STATE_PRESENTER_SAVEDCARDS),
savedCardsListType);
} catch (Exception ignore) {

}
}
}

Expand Down Expand Up @@ -216,15 +219,14 @@ private void initializeViews() {
emailEt = v.findViewById(R.id.rave_emailEt);
cvvTil = v.findViewById(R.id.rave_cvvTil);
cvvTv = v.findViewById(R.id.rave_cvvTv);
useAnotherCardTv = (TextView) v.findViewById(R.id.rave_use_new_card_tv);
useASavedCardTv = (TextView) v.findViewById(R.id.rave_use_saved_card_tv);
useASavedCardTv = v.findViewById(R.id.rave_use_saved_card_tv);
useASavedCardTv.setVisibility(GONE);
saveCardSwitch = (SwitchCompat) v.findViewById(R.id.rave_saveCardSwitch);
saveCardPhoneNoEt = (EditText) v.findViewById(R.id.save_card_phoneNoTV);
saveCardEmailEt = (EditText) v.findViewById(R.id.save_card_emailTv);
saveCardPhoneNoTil = (TextInputLayout) v.findViewById(R.id.save_card_phoneNoTil);
saveCardEmailTil = (TextInputLayout) v.findViewById(R.id.save_card_emailTil);
saveNewCardLayout = (LinearLayout) v.findViewById(R.id.rave_layout_for_saving_card);
saveCardSwitch = v.findViewById(R.id.rave_saveCardSwitch);
saveCardPhoneNoEt = v.findViewById(R.id.save_card_phoneNoTV);
saveCardEmailEt = v.findViewById(R.id.save_card_emailTv);
saveCardPhoneNoTil = v.findViewById(R.id.save_card_phoneNoTil);
saveCardEmailTil = v.findViewById(R.id.save_card_emailTil);
saveNewCardLayout = v.findViewById(R.id.rave_layout_for_saving_card);


}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public class CardUiPresenter extends CardPaymentHandler implements CardUiContrac
SharedPrefsRepo sharedManager;
@Inject
Gson gson;
List<SavedCard> savedCards;
List<SavedCard> savedCards = new ArrayList<>();
private CardUiContract.View mView;
private boolean cardSaveInProgress = false;
private String requeryInstruction = "Transaction is under processing, please use transaction requery to check status";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import android.text.TextWatcher;
import android.util.SparseArray;


import com.flutterwave.raveandroid.R;

import java.util.regex.Pattern;
Expand All @@ -18,28 +17,28 @@
class CreditCardTextWatcher implements TextWatcher {

private static final char space = ' ';
private final int mDefaultDrawableResId = R.drawable.creditcard;
private final int mDefaultDrawableResId = R.drawable.ic_credit_card;
private int mCurrentDrawableResId = 0;
private Drawable mCurrentDrawable;
String lastFormattedText;
private SparseArray<Pattern> mCCPatterns = null;

CreditCardTextWatcher(){
CreditCardTextWatcher() {
init();
}

private void init() {
if (mCCPatterns == null) {
mCCPatterns = new SparseArray<>();
// With spaces for credit card masking
mCCPatterns.put(R.drawable.visa_logo_new, Pattern.compile(
mCCPatterns.put(R.drawable.ic_visa, Pattern.compile(
"^4[0-9]{2,12}(?:[0-9]{3})?$"));
mCCPatterns.put(R.drawable.master_card_logo_svg, Pattern.compile(
mCCPatterns.put(R.drawable.ic_master_card, Pattern.compile(
"^5[1-5][0-9]{1,14}$"));
mCCPatterns.put(R.drawable.amex, Pattern.compile(
mCCPatterns.put(R.drawable.ic_american_express, Pattern.compile(
"^3[47][0-9]{1,13}$"));
///^([506]{3})([0-9]{1,16})$/
mCCPatterns.put(R.drawable.verve, Pattern.compile(
mCCPatterns.put(R.drawable.ic_verve_logo, Pattern.compile(
"^([506]{3})([0-9]{1,16})$"
));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import com.google.android.material.textfield.TextInputEditText;
import android.text.InputType;
import android.util.AttributeSet;
import android.util.Log;
import android.util.SparseArray;


import com.flutterwave.raveandroid.R;
import com.google.android.material.textfield.TextInputEditText;

import java.util.regex.Matcher;
import java.util.regex.Pattern;
Expand All @@ -24,7 +23,7 @@ public class CreditCardView extends TextInputEditText {

private SparseArray<Pattern> mCCPatterns = null;
//default credit card image
private final int mDefaultDrawableResId = R.drawable.creditcard;
private final int mDefaultDrawableResId = R.drawable.ic_credit_card;
private int mCurrentDrawableResId = 0;
private Drawable mCurrentDrawable;
String lastFormattedText;
Expand All @@ -50,20 +49,19 @@ private void init() {
if (mCCPatterns == null) {
mCCPatterns = new SparseArray<>();
// With spaces for credit card masking
mCCPatterns.put(R.drawable.visa_logo_new, Pattern.compile(
mCCPatterns.put(R.drawable.ic_visa, Pattern.compile(
"^4[0-9]{2,12}(?:[0-9]{3})?$"));
mCCPatterns.put(R.drawable.master_card_logo_svg, Pattern.compile(
mCCPatterns.put(R.drawable.ic_master_card, Pattern.compile(
"^5[1-5][0-9]{1,14}$"));
mCCPatterns.put(R.drawable.amex, Pattern.compile(
mCCPatterns.put(R.drawable.ic_american_express, Pattern.compile(
"^3[47][0-9]{1,13}$"));
///^([506]{3})([0-9]{1,16})$/
mCCPatterns.put(R.drawable.verve, Pattern.compile(
mCCPatterns.put(R.drawable.ic_verve_logo, Pattern.compile(
"^([506]{3})([0-9]{1,16})$"
));
}

setInputType(InputType.TYPE_CLASS_PHONE);

addTextChangedListener(new CreditCardTextWatcher());
}

Expand Down Expand Up @@ -127,7 +125,6 @@ protected void onTextChanged(CharSequence text, int start, int lengthBefore, int
mCurrentDrawable = getResources()
.getDrawable(mCurrentDrawableResId);


}

}
Loading