Panagiotis Triantafyllou

new implementation for custom fonts

Showing 22 changed files with 48 additions and 28 deletions
......@@ -3,7 +3,20 @@
<component name="deploymentTargetDropDown">
<value>
<entry key="app">
<State />
<State>
<targetSelectedWithDropDown>
<Target>
<type value="QUICK_BOOT_TARGET" />
<deviceKey>
<Key>
<type value="VIRTUAL_DEVICE_PATH" />
<value value="$USER_HOME$/.android/avd/Pixel_7_v13.avd" />
</Key>
</deviceKey>
</Target>
</targetSelectedWithDropDown>
<timeTargetWasSelectedWithDropDown value="2024-07-09T11:41:15.263632Z" />
</State>
</entry>
</value>
</component>
......
......@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
ext {
PUBLISH_GROUP_ID = 'ly.warp'
PUBLISH_VERSION = '4.5.5.4r30'
PUBLISH_VERSION = '4.5.5.4r31'
PUBLISH_ARTIFACT_ID = 'warply-android-sdk'
}
......
......@@ -291,8 +291,8 @@
android:name="ly.warp.sdk.receivers.WarplyInAppNotificationReceiver"
android:exported="false" />
<provider
android:name=".utils.WarplyProvider"
android:authorities="ly.warp.sdk.utils.WarplyProvider" />
<!-- <provider-->
<!-- android:name=".utils.WarplyProvider"-->
<!-- android:authorities="ly.warp.sdk.utils.WarplyProvider" />-->
</application>
</manifest>
\ No newline at end of file
......
package ly.warp.sdk.activities;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
......@@ -16,16 +15,15 @@ import androidx.recyclerview.widget.RecyclerView;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import java.io.Serializable;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Collections;
import java.util.Date;
import io.github.inflationx.viewpump.ViewPumpContextWrapper;
import ly.warp.sdk.R;
import ly.warp.sdk.io.models.Coupon;
import ly.warp.sdk.io.models.CouponList;
import ly.warp.sdk.utils.WarpUtils;
import ly.warp.sdk.utils.WarplyManagerHelper;
import ly.warp.sdk.utils.managers.WarplyAnalyticsManager;
import ly.warp.sdk.utils.managers.WarplyEventBusManager;
......@@ -46,7 +44,7 @@ public class ActiveCouponsActivity extends Activity implements View.OnClickListe
private RecyclerView mRecyclerCoupons;
private ActiveCouponAdapter mAdapterCoupons;
private CouponList mCouponList = new CouponList();
private TextView mTvEmptyCoupons;
private TextView mTvEmptyCoupons, mFontHeader;
private boolean mCouponsPressed = false;
// ===========================================================
......@@ -61,6 +59,9 @@ public class ActiveCouponsActivity extends Activity implements View.OnClickListe
mIvBack = findViewById(R.id.iv_coupons_close);
mTvEmptyCoupons = findViewById(R.id.tv_no_coupons);
mRecyclerCoupons = findViewById(R.id.rv_active_coupons);
mFontHeader = findViewById(R.id.textView3);
WarpUtils.renderCustomFont(this, R.font.bt_cosmo_bold, mFontHeader);
WarpUtils.renderCustomFont(this, R.font.peridot_regular, mTvEmptyCoupons);
initViews();
}
......@@ -101,11 +102,6 @@ public class ActiveCouponsActivity extends Activity implements View.OnClickListe
}
}
@Override
protected void attachBaseContext(Context newBase) {
super.attachBaseContext(ViewPumpContextWrapper.wrap(newBase));
}
// ===========================================================
// Methods
// ===========================================================
......
......@@ -36,6 +36,7 @@ import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Typeface;
import android.graphics.drawable.ClipDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.LayerDrawable;
......@@ -48,7 +49,11 @@ import android.view.Gravity;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.ScaleAnimation;
import android.widget.TextView;
import androidx.annotation.FontRes;
import androidx.annotation.NonNull;
import androidx.core.content.res.ResourcesCompat;
import androidx.security.crypto.EncryptedSharedPreferences;
import androidx.security.crypto.MasterKey;
import androidx.work.OneTimeWorkRequest;
......@@ -70,6 +75,7 @@ import java.security.NoSuchAlgorithmException;
import java.util.concurrent.TimeUnit;
import java.util.zip.GZIPInputStream;
import ly.warp.sdk.R;
import ly.warp.sdk.services.EventRefreshDeviceTokenService;
import ly.warp.sdk.utils.constants.WarpConstants;
......@@ -994,4 +1000,11 @@ public class WarpUtils {
}
public static void renderCustomFont(@NonNull Context context, @FontRes int id, @NonNull TextView... textViews) {
Typeface customFont = ResourcesCompat.getFont(context, id);
for (TextView textView : textViews) {
textView.setTypeface(customFont);
}
}
}
......
......@@ -29,6 +29,7 @@ import ly.warp.sdk.R;
import ly.warp.sdk.io.models.Coupon;
import ly.warp.sdk.io.models.CouponList;
import ly.warp.sdk.io.models.Merchant;
import ly.warp.sdk.utils.WarpUtils;
import ly.warp.sdk.utils.WarplyManagerHelper;
public class ActiveCouponAdapter extends RecyclerView.Adapter<ActiveCouponAdapter.ActiveCouponViewHolder> {
......@@ -59,7 +60,7 @@ public class ActiveCouponAdapter extends RecyclerView.Adapter<ActiveCouponAdapte
public class ActiveCouponViewHolder extends RecyclerView.ViewHolder {
private ImageView ivCouponLogo, ivCouponBackground;
private TextView tvCouponTitle, tvCouponValue, tvCouponDate, tvDateLimit,
tvCouponDescription, tvCouponDateExpired;
tvCouponDescription, tvCouponDateExpired, tvDateLimitTitle;
private ConstraintLayout clCustomLayout;
private LinearLayout lLDateLimit;
......@@ -74,7 +75,14 @@ public class ActiveCouponAdapter extends RecyclerView.Adapter<ActiveCouponAdapte
clCustomLayout = view.findViewById(R.id.cl_custom_layout);
tvCouponDateExpired = view.findViewById(R.id.tv_active_coupons_date_expired);
tvDateLimit = view.findViewById(R.id.tv_active_coupons_date_limit);
tvDateLimitTitle = view.findViewById(R.id.tv_active_coupons_date_limit_title);
lLDateLimit = view.findViewById(R.id.ll_date_limit);
WarpUtils.renderCustomFont(mContext, R.font.bt_cosmo_bold, tvCouponTitle, tvCouponValue);
WarpUtils.renderCustomFont(mContext, R.font.peridot_regular, tvCouponDescription, tvCouponDate);
if (mIsCustom)
WarpUtils.renderCustomFont(mContext, R.font.peridot_semi_bold, tvCouponDateExpired, tvDateLimit, tvDateLimitTitle);
}
}
......
......@@ -55,7 +55,6 @@
<TextView
android:id="@+id/tv_active_coupons_title"
fontPath="fonts/BTCosmo-Bold.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
......@@ -77,7 +76,6 @@
<TextView
android:id="@+id/tv_active_coupons_value"
fontPath="fonts/BTCosmo-Bold.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/cos_light_black"
......@@ -89,7 +87,6 @@
<TextView
android:id="@+id/tv_active_coupons_description"
fontPath="fonts/PeridotPE-Regular.ttf"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:ellipsize="end"
......@@ -98,14 +95,15 @@
android:textSize="12sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/gl_vertical_62_percent_inner"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.545"
tools:text="Εκπτωση με ελάχιστες αγορές 100€" />
</androidx.constraintlayout.widget.ConstraintLayout>
<TextView
android:id="@+id/tv_active_coupons_date"
fontPath="fonts/PeridotPE-Regular.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/cos_light_black"
......
......@@ -26,7 +26,6 @@
<TextView
android:id="@+id/textView3"
fontPath="fonts/BTCosmo-Bold.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
......@@ -58,7 +57,6 @@
<TextView
android:id="@+id/tv_no_coupons"
fontPath="fonts/PeridotPE-Regular.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
......
......@@ -49,7 +49,6 @@
<TextView
android:id="@+id/tv_active_coupons_title"
fontPath="fonts/BTCosmo-Bold.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
......@@ -71,7 +70,6 @@
<TextView
android:id="@+id/tv_active_coupons_value"
fontPath="fonts/BTCosmo-Bold.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/cos_light_black"
......@@ -83,7 +81,6 @@
<TextView
android:id="@+id/tv_active_coupons_description"
fontPath="fonts/PeridotPE-Regular.ttf"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:maxLines="3"
......@@ -99,7 +96,6 @@
<TextView
android:id="@+id/tv_active_coupons_date"
fontPath="fonts/PeridotPE-Regular.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/cos_light_black"
......@@ -109,7 +105,6 @@
<TextView
android:id="@+id/tv_active_coupons_date_expired"
fontPath="fonts/PeridotPE-SemiBold.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/cos_light_black"
......@@ -137,7 +132,7 @@
android:src="@drawable/timer_blue" />
<TextView
fontPath="fonts/PeridotPE-SemiBold.ttf"
android:id="@+id/tv_active_coupons_date_limit_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/cos_coupon_date_limit"
......@@ -147,7 +142,6 @@
<TextView
android:id="@+id/tv_active_coupons_date_limit"
fontPath="fonts/PeridotPE-SemiBold.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/cos_coupon_date_limit"
......