Panagiotis Triantafyllou

cosmote branch for demo app

Showing 73 changed files with 509 additions and 101 deletions
...@@ -18,7 +18,8 @@ ...@@ -18,7 +18,8 @@
18 android:extractNativeLibs="true" 18 android:extractNativeLibs="true"
19 android:fullBackupContent="false" 19 android:fullBackupContent="false"
20 android:hardwareAccelerated="true" 20 android:hardwareAccelerated="true"
21 - android:icon="@drawable/ic_notification_logo" 21 + android:icon="@mipmap/ic_launcher"
22 + android:roundIcon="@mipmap/ic_launcher_round"
22 android:installLocation="internalOnly" 23 android:installLocation="internalOnly"
23 android:label="@string/app_name" 24 android:label="@string/app_name"
24 android:largeHeap="true" 25 android:largeHeap="true"
......
1 # {@link ly.warp.sdk.utils.WarplyProperty} 1 # {@link ly.warp.sdk.utils.WarplyProperty}
2 2
3 # The app uuid the warply sdk need to connect to the engage server 3 # The app uuid the warply sdk need to connect to the engage server
4 -Uuid= 4 +# cosmote demo app f83dfde1145e4c2da69793abb2f579af
5 +Uuid=f83dfde1145e4c2da69793abb2f579af
5 6
6 # If we need to see logs in Logcat 7 # If we need to see logs in Logcat
7 -Debug=false 8 +Debug=true
8 9
9 # Production or Development environment of the engage server 10 # Production or Development environment of the engage server
10 # Production: https://engage.warp.ly 11 # Production: https://engage.warp.ly
...@@ -41,7 +42,7 @@ MerchantId=20113 ...@@ -41,7 +42,7 @@ MerchantId=20113
41 42
42 # The login type must be one of the below: 43 # The login type must be one of the below:
43 # email, msisdn, username 44 # email, msisdn, username
44 -LoginType=email 45 +LoginType=msisdn
45 46
46 # The deeplink url scheme for react native campaigns: 47 # The deeplink url scheme for react native campaigns:
47 # Example visit.greece.gr 48 # Example visit.greece.gr
......
1 package warp.ly.android_sdk.activities; 1 package warp.ly.android_sdk.activities;
2 2
3 import android.os.Bundle; 3 import android.os.Bundle;
4 +
4 import androidx.fragment.app.FragmentActivity; 5 import androidx.fragment.app.FragmentActivity;
6 +
5 import android.widget.Toast; 7 import android.widget.Toast;
6 8
7 -import ly.warp.sdk.io.request.WarplyInboxRequest;
8 import ly.warp.sdk.utils.managers.WarplySessionManager; 9 import ly.warp.sdk.utils.managers.WarplySessionManager;
9 10
10 public abstract class BaseActivity extends FragmentActivity { 11 public abstract class BaseActivity extends FragmentActivity {
...@@ -13,8 +14,6 @@ public abstract class BaseActivity extends FragmentActivity { ...@@ -13,8 +14,6 @@ public abstract class BaseActivity extends FragmentActivity {
13 // Constants 14 // Constants
14 // =========================================================== 15 // ===========================================================
15 16
16 - protected final WarplyInboxRequest mInboxRequest = new WarplyInboxRequest().setUseCache(true);
17 -
18 // =========================================================== 17 // ===========================================================
19 // Fields 18 // Fields
20 // =========================================================== 19 // ===========================================================
...@@ -48,7 +47,6 @@ public abstract class BaseActivity extends FragmentActivity { ...@@ -48,7 +47,6 @@ public abstract class BaseActivity extends FragmentActivity {
48 // =========================================================== 47 // ===========================================================
49 48
50 protected void showToast(String message) { 49 protected void showToast(String message) {
51 -
52 if (mToast != null) { 50 if (mToast != null) {
53 mToast.cancel(); 51 mToast.cancel();
54 } 52 }
......
1 package warp.ly.android_sdk.activities; 1 package warp.ly.android_sdk.activities;
2 2
3 import android.os.Bundle; 3 import android.os.Bundle;
4 +import android.view.MenuItem;
4 5
5 -import androidx.fragment.app.FragmentTabHost; 6 +import androidx.annotation.NonNull;
7 +import androidx.fragment.app.Fragment;
6 8
9 +import com.google.android.material.bottomnavigation.BottomNavigationView;
10 +import com.google.android.material.navigation.NavigationBarView;
11 +
12 +import ly.warp.sdk.fragments.LoyaltyFragment;
7 import warp.ly.android_sdk.R; 13 import warp.ly.android_sdk.R;
8 -import warp.ly.android_sdk.fragments.InfoFragment;
9 14
10 -public class MainActivity extends BaseActivity { 15 +public class MainActivity extends BaseActivity implements NavigationBarView.OnItemSelectedListener {
11 16
12 // =========================================================== 17 // ===========================================================
13 // Constants 18 // Constants
...@@ -17,6 +22,9 @@ public class MainActivity extends BaseActivity { ...@@ -17,6 +22,9 @@ public class MainActivity extends BaseActivity {
17 // Fields 22 // Fields
18 // =========================================================== 23 // ===========================================================
19 24
25 + private BottomNavigationView mBottomNavigationView;
26 + Fragment mFragmentToSet = null;
27 +
20 // =========================================================== 28 // ===========================================================
21 // Methods for/from SuperClass/Interfaces 29 // Methods for/from SuperClass/Interfaces
22 // =========================================================== 30 // ===========================================================
...@@ -25,6 +33,8 @@ public class MainActivity extends BaseActivity { ...@@ -25,6 +33,8 @@ public class MainActivity extends BaseActivity {
25 public void onCreate(Bundle savedInstanceState) { 33 public void onCreate(Bundle savedInstanceState) {
26 super.onCreate(savedInstanceState); 34 super.onCreate(savedInstanceState);
27 setContentView(R.layout.activity_main); 35 setContentView(R.layout.activity_main);
36 +
37 + mBottomNavigationView = findViewById(R.id.bt_tabs);
28 initViews(); 38 initViews();
29 } 39 }
30 40
...@@ -33,19 +43,26 @@ public class MainActivity extends BaseActivity { ...@@ -33,19 +43,26 @@ public class MainActivity extends BaseActivity {
33 super.onResume(); 43 super.onResume();
34 } 44 }
35 45
36 - protected void initViews() { 46 + @Override
37 - FragmentTabHost tabHost = (FragmentTabHost) findViewById(android.R.id.tabhost); 47 + public boolean onNavigationItemSelected(@NonNull MenuItem item) {
38 - tabHost.setup(this, getSupportFragmentManager(), android.R.id.tabcontent); 48 + switch (item.getItemId()) {
39 - tabHost.addTab( 49 + case R.id.menu_loyalty:
40 - tabHost.newTabSpec("info").setIndicator("info", null), 50 + mFragmentToSet = LoyaltyFragment.newInstance();
41 - InfoFragment.class, null); 51 + getSupportFragmentManager().beginTransaction().replace(R.id.fl_fragment, mFragmentToSet).commit();
42 - 52 + return true;
53 + }
54 + return false;
43 } 55 }
44 56
45 // =========================================================== 57 // ===========================================================
46 // Methods 58 // Methods
47 // =========================================================== 59 // ===========================================================
48 60
61 + private void initViews() {
62 + mBottomNavigationView.setOnItemSelectedListener(this);
63 + mBottomNavigationView.setSelectedItemId(R.id.menu_home);
64 + }
65 +
49 // =========================================================== 66 // ===========================================================
50 // Inner and Anonymous Classes 67 // Inner and Anonymous Classes
51 // =========================================================== 68 // ===========================================================
......
...@@ -12,8 +12,6 @@ import ly.warp.sdk.io.callbacks.WarplyReadyCallback; ...@@ -12,8 +12,6 @@ import ly.warp.sdk.io.callbacks.WarplyReadyCallback;
12 import ly.warp.sdk.utils.WarplyInitializer; 12 import ly.warp.sdk.utils.WarplyInitializer;
13 import warp.ly.android_sdk.R; 13 import warp.ly.android_sdk.R;
14 14
15 -import static warp.ly.android_sdk.utils.Constants.SENDER_ID;
16 -
17 public class SplashActivity extends BaseActivity { 15 public class SplashActivity extends BaseActivity {
18 16
19 private WarplyInitializer mWarplyInitializer; 17 private WarplyInitializer mWarplyInitializer;
...@@ -26,19 +24,17 @@ public class SplashActivity extends BaseActivity { ...@@ -26,19 +24,17 @@ public class SplashActivity extends BaseActivity {
26 mWarplyInitializer = Warply.getInitializer(this, new WarplyReadyCallback() { 24 mWarplyInitializer = Warply.getInitializer(this, new WarplyReadyCallback() {
27 @Override 25 @Override
28 public void onWarplyReady() { 26 public void onWarplyReady() {
29 - checkForAppUpdate(); 27 + startNextActivity();
30 } 28 }
31 29
32 @Override 30 @Override
33 public void onWarplyInitTimeOut() { 31 public void onWarplyInitTimeOut() {
34 - showToast("Warply initialization timeout!"); 32 + showToast("Warply timeout!");
35 - checkForAppUpdate();
36 } 33 }
37 34
38 @Override 35 @Override
39 public void onWarplyPermissionsDenied() { 36 public void onWarplyPermissionsDenied() {
40 showToast("Warply permissions denied!"); 37 showToast("Warply permissions denied!");
41 - checkForAppUpdate();
42 } 38 }
43 }); 39 });
44 } 40 }
...@@ -49,14 +45,7 @@ public class SplashActivity extends BaseActivity { ...@@ -49,14 +45,7 @@ public class SplashActivity extends BaseActivity {
49 mWarplyInitializer.initWithPermissions(this); 45 mWarplyInitializer.initWithPermissions(this);
50 } 46 }
51 47
52 -// @Override
53 -// public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
54 -// mWarplyInitializer.onRequestPermissionsResult(requestCode, permissions, grantResults);
55 -// super.onRequestPermissionsResult(requestCode, permissions, grantResults);
56 -// }
57 -
58 private void checkForAppUpdate() { 48 private void checkForAppUpdate() {
59 -
60 Warply.checkForAppUpdate(SplashActivity.this, new SimpleCallbackReceiver<Boolean>() { 49 Warply.checkForAppUpdate(SplashActivity.this, new SimpleCallbackReceiver<Boolean>() {
61 @Override 50 @Override
62 public void onResult(Boolean updateAccepted, int errorCode) { 51 public void onResult(Boolean updateAccepted, int errorCode) {
...@@ -68,20 +57,16 @@ public class SplashActivity extends BaseActivity { ...@@ -68,20 +57,16 @@ public class SplashActivity extends BaseActivity {
68 } 57 }
69 58
70 private void startNextActivity() { 59 private void startNextActivity() {
71 -
72 if (!isFinishing()) { 60 if (!isFinishing()) {
73 long MIN_SPLASH_TIME = 2000; 61 long MIN_SPLASH_TIME = 2000;
74 new Timer().schedule(new TimerTask() { 62 new Timer().schedule(new TimerTask() {
75 63
76 @Override 64 @Override
77 public void run() { 65 public void run() {
78 -
79 runOnUiThread(new Runnable() { 66 runOnUiThread(new Runnable() {
80 public void run() { 67 public void run() {
81 if (!isFinishing()) { 68 if (!isFinishing()) {
82 - Warply.registerGCM(SENDER_ID); 69 + startActivity(new Intent(SplashActivity.this, MainActivity.class));
83 - startActivity(new Intent(SplashActivity.this,
84 - MainActivity.class));
85 finish(); 70 finish();
86 } 71 }
87 } 72 }
......
1 -package warp.ly.android_sdk.utils;
2 -
3 -/**
4 - * Created by Panagiotis Triantafyllou on 14-Feb-19.
5 - */
6 -
7 -public class Constants {
8 -
9 - public static final String SENDER_ID = "791605800998";
10 -
11 -}
1 -<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 1 +<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
2 + xmlns:app="http://schemas.android.com/apk/res-auto"
2 android:layout_width="match_parent" 3 android:layout_width="match_parent"
3 - android:layout_height="match_parent" 4 + android:layout_height="match_parent">
4 - android:background="#363F45">
5 - <androidx.fragment.app.FragmentTabHost
6 - android:id="@android:id/tabhost"
7 - android:layout_width="match_parent"
8 - android:layout_height="match_parent">
9 -
10 - <LinearLayout
11 - android:layout_width="match_parent"
12 - android:layout_height="match_parent"
13 - android:gravity="center"
14 - android:orientation="vertical">
15 -
16 - <HorizontalScrollView
17 - android:id="@+id/horizontalScrollView"
18 - android:layout_width="wrap_content"
19 - android:layout_height="wrap_content"
20 - android:layout_gravity="bottom"
21 - android:background="@android:color/white"
22 - android:scrollbars="none">
23 5
24 - <TabWidget 6 + <FrameLayout
25 - android:id="@android:id/tabs" 7 + android:id="@+id/fl_fragment"
26 - android:layout_width="wrap_content" 8 + android:layout_width="match_parent"
27 - android:layout_height="wrap_content" 9 + android:layout_height="0dp"
28 - android:layout_gravity="bottom" 10 + app:layout_constraintBottom_toTopOf="@+id/bt_tabs"
29 - android:background="@android:color/white" /> 11 + app:layout_constraintEnd_toEndOf="parent"
30 - </HorizontalScrollView> 12 + app:layout_constraintStart_toStartOf="parent"
31 - 13 + app:layout_constraintTop_toTopOf="parent" />
32 - <FrameLayout
33 - android:id="@android:id/tabcontent"
34 - android:layout_width="match_parent"
35 - android:layout_height="0dp"
36 - android:layout_weight="1" />
37 - </LinearLayout>
38 14
39 - </androidx.fragment.app.FragmentTabHost> 15 + <com.google.android.material.bottomnavigation.BottomNavigationView
16 + android:id="@+id/bt_tabs"
17 + android:layout_width="match_parent"
18 + android:layout_height="64dp"
19 + style="@style/BottomNavigationView"
20 + android:background="@android:color/white"
21 + app:itemTextColor="@drawable/selector_tab_title_color"
22 + app:itemRippleColor="@color/cos_cyan"
23 + app:labelVisibilityMode="labeled"
24 + app:layout_constraintBottom_toBottomOf="parent"
25 + app:layout_constraintEnd_toEndOf="parent"
26 + app:layout_constraintStart_toStartOf="parent"
27 + app:menu="@menu/menu_bottom_nav" />
40 28
41 -</RelativeLayout> 29 +</androidx.constraintlayout.widget.ConstraintLayout>
......
...@@ -2,22 +2,14 @@ ...@@ -2,22 +2,14 @@
2 xmlns:tools="http://schemas.android.com/tools" 2 xmlns:tools="http://schemas.android.com/tools"
3 android:layout_width="match_parent" 3 android:layout_width="match_parent"
4 android:layout_height="match_parent" 4 android:layout_height="match_parent"
5 - tools:context=".SplashActivity" 5 + android:background="@android:color/white"
6 - android:background="#363F45"> 6 + android:gravity="center">
7 -
8 - <ProgressBar
9 - android:id="@+id/progressBar"
10 - style="?android:attr/progressBarStyleLarge"
11 - android:layout_width="wrap_content"
12 - android:layout_height="wrap_content"
13 - android:layout_centerVertical="true"
14 - android:layout_centerHorizontal="true" />
15 7
16 <ImageView 8 <ImageView
17 - android:layout_width="wrap_content" 9 + android:id="@+id/iv_splash"
10 + android:layout_width="match_parent"
18 android:layout_height="wrap_content" 11 android:layout_height="wrap_content"
19 - android:id="@+id/imageView"
20 - android:layout_above="@+id/progressBar"
21 android:layout_centerHorizontal="true" 12 android:layout_centerHorizontal="true"
22 - android:src="@drawable/warply_logo_white" /> 13 + android:scaleType="centerCrop"
14 + android:src="@drawable/ic_cosmote_logo_horizontal_white" />
23 </RelativeLayout> 15 </RelativeLayout>
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
19 android:layout_height="wrap_content" 19 android:layout_height="wrap_content"
20 android:layout_weight="1" 20 android:layout_weight="1"
21 android:scaleType="center" 21 android:scaleType="center"
22 - android:src="@drawable/ic_launcher" /> 22 + android:src="@mipmap/ic_launcher" />
23 23
24 <TextView 24 <TextView
25 android:id="@+id/tv_campaign_title" 25 android:id="@+id/tv_campaign_title"
......
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
3 + <background android:drawable="@color/ic_launcher_background"/>
4 + <foreground android:drawable="@mipmap/ic_launcher_foreground"/>
5 +</adaptive-icon>
...\ No newline at end of file ...\ No newline at end of file
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
3 + <background android:drawable="@color/ic_launcher_background"/>
4 + <foreground android:drawable="@mipmap/ic_launcher_foreground"/>
5 +</adaptive-icon>
...\ No newline at end of file ...\ No newline at end of file
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<resources>
3 + <color name="ic_launcher_background">#FFFFFF</color>
4 +</resources>
...\ No newline at end of file ...\ No newline at end of file
1 <?xml version="1.0" encoding="utf-8"?> 1 <?xml version="1.0" encoding="utf-8"?>
2 <resources> 2 <resources>
3 3
4 - <string name="app_name">Warply Android SDK Maven Plugin</string> 4 + <string name="app_name">Cosmote demo</string>
5 <string name="hello_world">Hello world!</string> 5 <string name="hello_world">Hello world!</string>
6 <string name="action_settings">Settings</string> 6 <string name="action_settings">Settings</string>
7 <string name="title_activity_main">MainActivity</string> 7 <string name="title_activity_main">MainActivity</string>
......
1 <resources> 1 <resources>
2 2
3 <!-- Base application theme. --> 3 <!-- Base application theme. -->
4 - <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> 4 + <style name="AppTheme" parent="Theme.AppCompat.Light">
5 <!-- Customize your theme here. --> 5 <!-- Customize your theme here. -->
6 + <item name="android:windowLightStatusBar">true</item>
7 + <item name="android:statusBarColor">@android:color/white</item>
6 </style> 8 </style>
7 9
8 </resources> 10 </resources>
......
...@@ -41,6 +41,9 @@ dependencies { ...@@ -41,6 +41,9 @@ dependencies {
41 api 'org.altbeacon:android-beacon-library:2.19.3' 41 api 'org.altbeacon:android-beacon-library:2.19.3'
42 api 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2' 42 api 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'
43 api "commons-logging:commons-logging:1.2" 43 api "commons-logging:commons-logging:1.2"
44 + api 'de.hdodenhof:circleimageview:3.1.0'
45 + api group: 'io.reactivex.rxjava2', name: 'rxjava', version: '2.2.21'
46 + api 'com.google.android.material:material:1.5.0'
44 47
45 //------------------------------ Firebase -----------------------------// 48 //------------------------------ Firebase -----------------------------//
46 api platform('com.google.firebase:firebase-bom:29.0.3') 49 api platform('com.google.firebase:firebase-bom:29.0.3')
......
1 +package ly.warp.sdk.fragments;
2 +
3 +import android.os.Bundle;
4 +import android.view.LayoutInflater;
5 +import android.view.View;
6 +import android.view.ViewGroup;
7 +import android.widget.LinearLayout;
8 +
9 +import androidx.annotation.Nullable;
10 +import androidx.fragment.app.Fragment;
11 +import androidx.recyclerview.widget.LinearLayoutManager;
12 +import androidx.recyclerview.widget.RecyclerView;
13 +
14 +import org.json.JSONException;
15 +
16 +import ly.warp.sdk.R;
17 +import ly.warp.sdk.io.models.Campaign;
18 +import ly.warp.sdk.io.models.CampaignList;
19 +import ly.warp.sdk.views.adapters.ProfileCampaignAdapter;
20 +
21 +public class LoyaltyFragment extends Fragment implements View.OnClickListener {
22 +
23 + // ===========================================================
24 + // Constants
25 + // ===========================================================
26 +
27 + // ===========================================================
28 + // Fields
29 + // ===========================================================
30 +
31 + private RecyclerView mRecyclerDeals, mRecyclerGifts, mRecyclerMore;
32 + private ProfileCampaignAdapter mAdapterDeals, mAdapterGifts, mAdapterMore;
33 + private LinearLayout mLlMoreDeals, mLlMoreGifts, mLlMore;
34 +
35 + // ===========================================================
36 + // Methods for/from SuperClass/Interfaces
37 + // ===========================================================
38 +
39 + @Override
40 + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
41 + return inflater.inflate(R.layout.fragment_loyalty, container, false);
42 + }
43 +
44 + @Override
45 + public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
46 + super.onViewCreated(view, savedInstanceState);
47 +
48 + /********* TEST DATA **********/
49 + CampaignList clist = new CampaignList();
50 + try {
51 + clist.add(new Campaign("{\"session_uuid\": \"a724e911a71a42408b6ba50ae6c08dbb\", \"title\": \"\\u039a\\u03ac\\u03bd\\u03b5 strike\", \"subtitle\": \"\\u03ba\\u03b1\\u03b9 \\u03ba\\u03ad\\u03c1\\u03b4\\u03b9\\u03c3\\u03b5!\", \"offer_message\": null, \"message\": null, \"index_url\": \"https://warply.s3.amazonaws.com/artworks/034fba10ceac4e0f9338bd8e60086292/index.html\", \"logo_url\": \"https://warply.s3.amazonaws.com/temp/96322898cc824981aece923d8b5afc88/drggtdr.jpg\", \"starts\": 1644494400, \"expires\": 1881522000, \"delivered\": 1644607293, \"action\": 0, \"opened\": 1, \"offer_category\": \"standard-offer\", \"sorting\": 0, \"is_new\": true, \"session_metadata\": \"\\\"\\\"\", \"display_type\": null, \"delivery_method\": 2, \"extra_fields\": \"{}\", \"campaign_type\": null, \"campaign_type_settings\": null, \"actions\": null, \"show\": true, \"expired\": false, \"audience\": \"all\"}"));
52 + clist.add(new Campaign("{\"session_uuid\": \"a724e911a71a42408b6ba50ae6c08dbb\", \"title\": \"\\u039a\\u03ac\\u03bd\\u03b5 strike\", \"subtitle\": \"\\u03ba\\u03b1\\u03b9 \\u03ba\\u03ad\\u03c1\\u03b4\\u03b9\\u03c3\\u03b5!\", \"offer_message\": null, \"message\": null, \"index_url\": \"https://warply.s3.amazonaws.com/artworks/034fba10ceac4e0f9338bd8e60086292/index.html\", \"logo_url\": \"https://warply.s3.amazonaws.com/temp/96322898cc824981aece923d8b5afc88/drggtdr.jpg\", \"starts\": 1644494400, \"expires\": 1881522000, \"delivered\": 1644607293, \"action\": 0, \"opened\": 1, \"offer_category\": \"standard-offer\", \"sorting\": 0, \"is_new\": true, \"session_metadata\": \"\\\"\\\"\", \"display_type\": null, \"delivery_method\": 2, \"extra_fields\": \"{}\", \"campaign_type\": null, \"campaign_type_settings\": null, \"actions\": null, \"show\": true, \"expired\": false, \"audience\": \"all\"}"));
53 + } catch (JSONException e) {
54 + e.printStackTrace();
55 + }
56 + /********* TEST DATA **********/
57 +
58 + mLlMoreDeals = view.findViewById(R.id.ll_more);
59 + mLlMoreDeals.setOnClickListener(this);
60 + mLlMoreGifts = view.findViewById(R.id.ll_more2);
61 + mLlMoreGifts.setOnClickListener(this);
62 + mLlMore = view.findViewById(R.id.ll_more3);
63 + mLlMore.setOnClickListener(this);
64 +
65 + mRecyclerDeals = view.findViewById(R.id.rv_deals);
66 + mRecyclerDeals.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL, false));
67 + mAdapterDeals = new ProfileCampaignAdapter(getContext(), clist);
68 + mRecyclerDeals.setAdapter(mAdapterDeals);
69 + mAdapterDeals.getPositionClicks()
70 + .doOnNext(campaign -> {
71 +
72 + })
73 + .doOnError(error -> {
74 + })
75 + .subscribe();
76 +
77 + mRecyclerGifts = view.findViewById(R.id.rv_gifts);
78 + mRecyclerGifts.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL, false));
79 + mAdapterGifts = new ProfileCampaignAdapter(getContext(), clist);
80 + mRecyclerGifts.setAdapter(mAdapterGifts);
81 + mAdapterGifts.getPositionClicks()
82 + .doOnNext(campaign -> {
83 +
84 + })
85 + .doOnError(error -> {
86 + })
87 + .subscribe();
88 +
89 + mRecyclerMore = view.findViewById(R.id.rv_more);
90 + mRecyclerMore.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL, false));
91 + mAdapterMore = new ProfileCampaignAdapter(getContext(), clist);
92 + mRecyclerMore.setAdapter(mAdapterMore);
93 + mAdapterMore.getPositionClicks()
94 + .doOnNext(campaign -> {
95 +
96 + })
97 + .doOnError(error -> {
98 + })
99 + .subscribe();
100 + }
101 +
102 + @Override
103 + public void onClick(View view) {
104 +// if(view.getId() == R.id.tv_info){
105 +// Intent sendIntent = new Intent();
106 +// sendIntent.setAction(Intent.ACTION_SEND);
107 +// sendIntent.putExtra(Intent.EXTRA_TEXT, tvInfo.getText().toString());
108 +// sendIntent.setType("text/plain");
109 +// startActivity(Intent.createChooser(sendIntent,"Share"));
110 +// }
111 + }
112 +
113 + // ===========================================================
114 + // Methods
115 + // ===========================================================
116 +
117 + public static Fragment newInstance() {
118 + LoyaltyFragment loyaltyFragment = new LoyaltyFragment();
119 + return loyaltyFragment;
120 + }
121 +
122 + // ===========================================================
123 + // Inner and Anonymous Classes
124 + // ===========================================================
125 +
126 +}
1 +package ly.warp.sdk.views.adapters;
2 +
3 +import android.content.Context;
4 +import android.text.TextUtils;
5 +import android.view.LayoutInflater;
6 +import android.view.View;
7 +import android.view.ViewGroup;
8 +import android.widget.ImageView;
9 +import android.widget.TextView;
10 +
11 +import androidx.recyclerview.widget.RecyclerView;
12 +
13 +import com.bumptech.glide.Glide;
14 +import com.bumptech.glide.load.engine.DiskCacheStrategy;
15 +
16 +import io.reactivex.Observable;
17 +import io.reactivex.subjects.PublishSubject;
18 +import ly.warp.sdk.R;
19 +import ly.warp.sdk.io.models.Campaign;
20 +import ly.warp.sdk.io.models.CampaignList;
21 +
22 +
23 +public class ProfileCampaignAdapter extends RecyclerView.Adapter<ProfileCampaignAdapter.ProfileCampaignViewHolder> {
24 +
25 + private Context mContext;
26 + private CampaignList mCampaigns;
27 + private final PublishSubject<Campaign> onClickSubject = PublishSubject.create();
28 +
29 + public ProfileCampaignAdapter(Context mContext, CampaignList campaignList) {
30 + this.mContext = mContext;
31 + this.mCampaigns = campaignList;
32 + }
33 +
34 + public class ProfileCampaignViewHolder extends RecyclerView.ViewHolder {
35 + private ImageView ivCampaignTitle;
36 + private TextView tvCampaignTitle;
37 +
38 + public ProfileCampaignViewHolder(View view) {
39 + super(view);
40 + ivCampaignTitle = view.findViewById(R.id.iv_campaign_logo);
41 + tvCampaignTitle = view.findViewById(R.id.tv_campaign_title);
42 + }
43 + }
44 +
45 + @Override
46 + public int getItemCount() {
47 + if (mCampaigns == null)
48 + return 0;
49 + else
50 + return mCampaigns.size();
51 + }
52 +
53 +
54 + public Campaign getItem(int id) {
55 + return mCampaigns.get(id);
56 + }
57 +
58 + public void updateData(CampaignList campaignList) {
59 + mCampaigns.clear();
60 + mCampaigns.addAll(campaignList);
61 + notifyDataSetChanged();
62 + }
63 +
64 +
65 + @Override
66 + public ProfileCampaignViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
67 + View itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_profile_recycler, parent, false);
68 + return new ProfileCampaignViewHolder(itemView);
69 + }
70 +
71 + @Override
72 + public void onBindViewHolder(final ProfileCampaignViewHolder holder, int position) {
73 + Campaign campaignItem = mCampaigns.get(position);
74 +
75 + if (campaignItem != null) {
76 + if (!TextUtils.isEmpty(campaignItem.getLogoUrl())) {
77 + Glide.with(mContext)
78 +// .setDefaultRequestOptions(
79 +// RequestOptions
80 +// .placeholderOf(R.drawable.ic_default_contact_photo)
81 +// .error(R.drawable.ic_default_contact_photo))
82 + .load(/*campaignItem.getLogoUrl()*/ R.drawable.ic_cosmote_logo_horizontal_grey)
83 + .diskCacheStrategy(DiskCacheStrategy.DATA)
84 + .into(holder.ivCampaignTitle);
85 + } /*else {
86 + Glide.with(mContext)
87 + .load(R.drawable.ic_default_contact_photo)
88 + .into(holder.ivCampaignTitle);
89 + }*/
90 +
91 + holder.tvCampaignTitle.setText(campaignItem.getTitle());
92 +
93 + holder.itemView.setOnClickListener(v -> onClickSubject.onNext(campaignItem));
94 + }
95 + }
96 +
97 + public Observable<Campaign> getPositionClicks() {
98 + return onClickSubject.cache();
99 + }
100 +
101 +}
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<selector xmlns:android="http://schemas.android.com/apk/res/android">
3 + <item
4 + android:state_pressed="false"
5 + android:drawable="@drawable/shape_cos_campaign_white" />
6 + <item
7 + android:state_pressed="true"
8 + android:drawable="@drawable/shape_cos_campaign_white_tr" />
9 +</selector>
...\ No newline at end of file ...\ No newline at end of file
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<selector xmlns:android="http://schemas.android.com/apk/res/android">
3 + <item
4 + android:state_pressed="false"
5 + android:drawable="@drawable/shape_cos_white" />
6 + <item
7 + android:state_pressed="true"
8 + android:drawable="@drawable/shape_cos_white_tr" />
9 +</selector>
...\ No newline at end of file ...\ No newline at end of file
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<selector xmlns:android="http://schemas.android.com/apk/res/android">
3 + <item android:drawable="@drawable/ic_explore" android:state_checked="false"/>
4 + <item android:drawable="@drawable/ic_explore_pressed" android:state_checked="true"/>
5 +</selector>
...\ No newline at end of file ...\ No newline at end of file
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<selector xmlns:android="http://schemas.android.com/apk/res/android">
3 + <item android:drawable="@drawable/ic_home_pressed" android:state_checked="false"/>
4 + <item android:drawable="@drawable/ic_home_pressed" android:state_checked="true"/>
5 +</selector>
...\ No newline at end of file ...\ No newline at end of file
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<selector xmlns:android="http://schemas.android.com/apk/res/android">
3 + <item android:drawable="@drawable/ic_loyalty" android:state_checked="false"/>
4 + <item android:drawable="@drawable/ic_loyalty" android:state_selected="true"/>
5 +</selector>
...\ No newline at end of file ...\ No newline at end of file
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<selector xmlns:android="http://schemas.android.com/apk/res/android">
3 + <item android:drawable="@drawable/ic_profile" android:state_checked="false"/>
4 + <item android:drawable="@drawable/ic_profile" android:state_checked="true"/>
5 +</selector>
...\ No newline at end of file ...\ No newline at end of file
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<selector xmlns:android="http://schemas.android.com/apk/res/android">
3 + <item android:drawable="@drawable/ic_shop" android:state_checked="false"/>
4 + <item android:drawable="@drawable/ic_shop" android:state_checked="true"/>
5 +</selector>
...\ No newline at end of file ...\ No newline at end of file
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<selector xmlns:android="http://schemas.android.com/apk/res/android">
3 + <item android:state_checked="true" android:color="@color/cos_cyan" />
4 + <item android:color="@color/cos_grey_dark" />
5 +</selector>
...\ No newline at end of file ...\ No newline at end of file
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<shape xmlns:android="http://schemas.android.com/apk/res/android"
3 + android:shape="rectangle">
4 + <corners android:radius="4dp" />
5 +
6 + <solid android:color="@android:color/white" />
7 +</shape>
...\ No newline at end of file ...\ No newline at end of file
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<shape xmlns:android="http://schemas.android.com/apk/res/android"
3 + android:shape="rectangle">
4 + <corners android:radius="4dp" />
5 +
6 + <solid android:color="@color/white_tr" />
7 +</shape>
...\ No newline at end of file ...\ No newline at end of file
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<shape xmlns:android="http://schemas.android.com/apk/res/android"
3 + android:shape="rectangle">
4 + <gradient
5 + android:startColor="@color/cos_green"
6 + android:endColor="@color/cos_blue"
7 + android:type="linear"/>
8 + <corners
9 + android:radius="4dp"/>
10 +</shape>
...\ No newline at end of file ...\ No newline at end of file
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<shape xmlns:android="http://schemas.android.com/apk/res/android"
3 + android:shape="rectangle">
4 + <corners android:topLeftRadius="30dp" />
5 +
6 + <solid android:color="@color/cos_grey" />
7 +
8 +<!-- <stroke-->
9 +<!-- android:width="1dp"-->
10 +<!-- android:color="@color/cos_green" />-->
11 +</shape>
...\ No newline at end of file ...\ No newline at end of file
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<shape xmlns:android="http://schemas.android.com/apk/res/android"
3 + android:shape="rectangle">
4 + <corners android:radius="8dp" />
5 +
6 + <solid android:color="@android:color/white" />
7 +</shape>
...\ No newline at end of file ...\ No newline at end of file
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<shape xmlns:android="http://schemas.android.com/apk/res/android"
3 + android:shape="rectangle">
4 + <corners android:radius="8dp" />
5 +
6 + <solid android:color="@color/white_tr" />
7 +</shape>
...\ No newline at end of file ...\ No newline at end of file
This diff is collapsed. Click to expand it.
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 + xmlns:app="http://schemas.android.com/apk/res-auto"
4 + xmlns:tools="http://schemas.android.com/tools"
5 + android:layout_width="360dp"
6 + android:layout_height="150dp"
7 + android:layout_marginStart="10dp"
8 + android:background="@drawable/selector_cos_campaign">
9 +
10 + <androidx.constraintlayout.widget.Guideline
11 + android:id="@+id/gl_vertical_60_percent"
12 + android:layout_width="wrap_content"
13 + android:layout_height="wrap_content"
14 + android:orientation="vertical"
15 + app:layout_constraintGuide_percent="0.6" />
16 +
17 + <ImageView
18 + android:id="@+id/iv_campaign_logo"
19 + android:layout_width="0dp"
20 + android:layout_height="0dp"
21 + android:scaleType="centerCrop"
22 + app:layout_constraintBottom_toBottomOf="parent"
23 + app:layout_constraintHorizontal_bias="0.0"
24 + app:layout_constraintLeft_toLeftOf="parent"
25 + tools:src="@drawable/ic_cosmote_logo_horizontal_grey"
26 + app:layout_constraintRight_toLeftOf="@+id/gl_vertical_60_percent"
27 + app:layout_constraintTop_toTopOf="parent"
28 + app:layout_constraintVertical_bias="0.0" />
29 +
30 + <TextView
31 + android:id="@+id/tv_campaign_title"
32 + android:layout_width="0dp"
33 + android:layout_height="wrap_content"
34 + android:layout_marginHorizontal="12dp"
35 + android:gravity="center"
36 + android:maxLines="4"
37 + android:textColor="@color/grey"
38 + app:layout_constraintBottom_toBottomOf="parent"
39 + app:layout_constraintLeft_toRightOf="@+id/gl_vertical_60_percent"
40 + app:layout_constraintRight_toRightOf="parent"
41 + app:layout_constraintTop_toTopOf="parent"
42 + tools:text="-10% in all products from IKEA" />
43 +
44 +</androidx.constraintlayout.widget.ConstraintLayout>
...\ No newline at end of file ...\ No newline at end of file
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<menu xmlns:android="http://schemas.android.com/apk/res/android">
3 + <item
4 + android:id="@+id/menu_home"
5 + android:icon="@drawable/selector_menu_home"
6 + android:title="@string/menu_home" />
7 + <item
8 + android:id="@+id/menu_explore"
9 + android:icon="@drawable/selector_menu_explore"
10 + android:title="@string/menu_explore" />
11 + <item
12 + android:id="@+id/menu_shop"
13 + android:icon="@drawable/selector_menu_shop"
14 + android:title="@string/menu_shop" />
15 + <item
16 + android:id="@+id/menu_loyalty"
17 + android:icon="@drawable/selector_menu_loyalty"
18 + android:title="@string/menu_loyalty" />
19 + <item
20 + android:id="@+id/menu_profile"
21 + android:icon="@drawable/selector_menu_profile"
22 + android:title="@string/menu_profile" />
23 +</menu>
...\ No newline at end of file ...\ No newline at end of file
...@@ -3,4 +3,11 @@ ...@@ -3,4 +3,11 @@
3 <color name="colorPrimary">#0a1a50</color> 3 <color name="colorPrimary">#0a1a50</color>
4 <color name="colorAccent">#044C86</color> 4 <color name="colorAccent">#044C86</color>
5 <color name="colorPrimaryDark">#0a1a50</color> 5 <color name="colorPrimaryDark">#0a1a50</color>
6 + <color name="grey">#415564</color>
7 + <color name="cos_green">#65DD6B</color>
8 + <color name="cos_blue">#0377C1</color>
9 + <color name="cos_grey">#3D5265</color>
10 + <color name="white_tr">#32FFFFFF</color>
11 + <color name="cos_grey_dark">#787878</color>
12 + <color name="cos_cyan">#A3F2DA</color>
6 </resources> 13 </resources>
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -4,4 +4,20 @@ ...@@ -4,4 +4,20 @@
4 <string name="rate_dialog_positive">Rate Now</string> 4 <string name="rate_dialog_positive">Rate Now</string>
5 <string name="rate_diloag_neutral">Remind Me Later</string> 5 <string name="rate_diloag_neutral">Remind Me Later</string>
6 <string name="rate_dialog_negative">No, Thanks</string> 6 <string name="rate_dialog_negative">No, Thanks</string>
7 +
8 + <string name="cos_profile_tab">Profile</string>
9 + <string name="welcome_user">Γεία σου Γιώργος !</string>
10 + <string name="cos_profile_name">Γιώργος</string>
11 + <string name="cos_profile_type">Traveller</string>
12 + <string name="header_add">Προσθήκη</string>
13 + <string name="cos_profile_reward">My reward wallet</string>
14 + <string name="cos_deals_title">Deals for You</string>
15 + <string name="cos_profile_more">Δες περισσότερα</string>
16 + <string name="cos_gifts_title">Gifts for You</string>
17 + <string name="cos_more_title">More for You</string>
18 + <string name="menu_home">Αρχική</string>
19 + <string name="menu_explore">Ανακάλυψε</string>
20 + <string name="menu_shop">Shop</string>
21 + <string name="menu_loyalty">Loyalty</string>
22 + <string name="menu_profile">Προφίλ</string>
7 </resources> 23 </resources>
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -24,4 +24,8 @@ ...@@ -24,4 +24,8 @@
24 <item name="android:textStyle">bold</item> 24 <item name="android:textStyle">bold</item>
25 </style> 25 </style>
26 26
27 + <style name="BottomNavigationView" parent="Widget.Design.BottomNavigationView">
28 + <item name="android:textSize">14sp</item>
29 + </style>
30 +
27 </resources> 31 </resources>
...\ No newline at end of file ...\ No newline at end of file
......