Toggle navigation
Toggle navigation
This project
Loading...
Sign in
open-source
/
warply_android_sdk_maven_plugin
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
Panagiotis Triantafyllou
2022-03-28 13:56:20 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
8adb6a35305cf2061a46c61ca9ef55921a419311
8adb6a35
1 parent
17fb06f9
login + profile
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
66 additions
and
4 deletions
app/src/main/java/warp/ly/android_sdk/activities/SplashActivity.java
warply_android_sdk/src/main/java/ly/warp/sdk/fragments/HomeFragment.java
warply_android_sdk/src/main/res/layout/fragment_home.xml
warply_android_sdk/src/main/res/values/strings.xml
app/src/main/java/warp/ly/android_sdk/activities/SplashActivity.java
View file @
8adb6a3
...
...
@@ -3,13 +3,19 @@ package warp.ly.android_sdk.activities;
import
android.content.Intent
;
import
android.os.Bundle
;
import
org.json.JSONObject
;
import
java.util.Timer
;
import
java.util.TimerTask
;
import
ly.warp.sdk.Warply
;
import
ly.warp.sdk.io.callbacks.CallbackReceiver
;
import
ly.warp.sdk.io.callbacks.SimpleCallbackReceiver
;
import
ly.warp.sdk.io.callbacks.WarplyReadyCallback
;
import
ly.warp.sdk.io.request.WarplyConsumerRequest
;
import
ly.warp.sdk.io.request.WarplyLoginRequest
;
import
ly.warp.sdk.utils.WarplyInitializer
;
import
ly.warp.sdk.utils.managers.WarplyManager
;
import
warp.ly.android_sdk.R
;
public
class
SplashActivity
extends
BaseActivity
{
...
...
@@ -24,7 +30,11 @@ public class SplashActivity extends BaseActivity {
mWarplyInitializer
=
Warply
.
getInitializer
(
this
,
new
WarplyReadyCallback
()
{
@Override
public
void
onWarplyReady
()
{
startNextActivity
();
WarplyManager
.
login
(
new
WarplyLoginRequest
()
.
setId
(
"6981234567"
)
.
setPassword
(
"123456"
),
mLoginReceiver
);
}
@Override
...
...
@@ -58,7 +68,7 @@ public class SplashActivity extends BaseActivity {
private
void
startNextActivity
()
{
if
(!
isFinishing
())
{
long
MIN_SPLASH_TIME
=
2
000
;
long
MIN_SPLASH_TIME
=
1
000
;
new
Timer
().
schedule
(
new
TimerTask
()
{
@Override
...
...
@@ -75,4 +85,18 @@ public class SplashActivity extends BaseActivity {
},
MIN_SPLASH_TIME
);
}
}
private
final
CallbackReceiver
<
JSONObject
>
mLoginReceiver
=
new
CallbackReceiver
<
JSONObject
>()
{
@Override
public
void
onSuccess
(
JSONObject
result
)
{
if
(
result
!=
null
&&
result
.
optInt
(
"status"
)
==
1
)
{
startNextActivity
();
}
}
@Override
public
void
onFailure
(
int
errorCode
)
{
startNextActivity
();
}
};
}
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/fragments/HomeFragment.java
View file @
8adb6a3
...
...
@@ -2,6 +2,8 @@ package ly.warp.sdk.fragments;
import
android.content.Intent
;
import
android.os.Bundle
;
import
android.os.Handler
;
import
android.os.Looper
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.ViewGroup
;
...
...
@@ -20,6 +22,11 @@ import org.json.JSONException;
import
ly.warp.sdk.R
;
import
ly.warp.sdk.activities.BillPaymentActivity
;
import
ly.warp.sdk.activities.CouponInfoActivity
;
import
ly.warp.sdk.io.callbacks.CallbackReceiver
;
import
ly.warp.sdk.io.models.Consumer
;
import
ly.warp.sdk.io.request.WarplyConsumerRequest
;
import
ly.warp.sdk.io.request.WarplyLoginRequest
;
import
ly.warp.sdk.utils.managers.WarplyManager
;
import
ly.warp.sdk.views.adapters.HomeCampaignAdapter
;
import
ly.warp.sdk.views.adapters.HomeCouponAdapter
;
import
ly.warp.sdk.activities.WarpViewActivity
;
...
...
@@ -35,6 +42,19 @@ public class HomeFragment extends Fragment implements View.OnClickListener {
private
HomeCouponAdapter
mAdapterCoupons
;
private
HomeCampaignAdapter
mAdapterCampaigns
;
private
LinearLayout
mLlBillPayment
;
private
TextView
mTvUsername
;
public
static
Consumer
mConsumer
;
@Override
public
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
new
Thread
(()
->
{
if
(!
Thread
.
currentThread
().
isInterrupted
())
{
WarplyManager
.
getConsumer
(
new
WarplyConsumerRequest
(),
mConsumerReceiver
);
}
}).
start
();
}
@Override
public
View
onCreateView
(
...
...
@@ -68,6 +88,8 @@ public class HomeFragment extends Fragment implements View.OnClickListener {
mLlBillPayment
=
view
.
findViewById
(
R
.
id
.
ll_bill_payment
);
mLlBillPayment
.
setOnClickListener
(
this
);
mTvUsername
=
view
.
findViewById
(
R
.
id
.
welcome_user_txt
);
/********* TEST CAMPAIGNS DATA **********/
CampaignList
clistCampaigns
=
new
CampaignList
();
try
{
...
...
@@ -134,4 +156,20 @@ public class HomeFragment extends Fragment implements View.OnClickListener {
HomeFragment
homeFragment
=
new
HomeFragment
();
return
homeFragment
;
}
private
final
CallbackReceiver
<
Consumer
>
mConsumerReceiver
=
new
CallbackReceiver
<
Consumer
>()
{
@Override
public
void
onSuccess
(
Consumer
result
)
{
mConsumer
=
result
;
new
Handler
(
Looper
.
getMainLooper
()).
post
(()
->
{
mTvUsername
.
setText
(
String
.
format
(
getResources
().
getString
(
R
.
string
.
welcome_user
),
mConsumer
.
getFirstName
()
+
" "
+
mConsumer
.
getLastName
()));
});
}
@Override
public
void
onFailure
(
int
errorCode
)
{
Thread
.
currentThread
().
interrupt
();
}
};
}
\ No newline at end of file
...
...
warply_android_sdk/src/main/res/layout/fragment_home.xml
View file @
8adb6a3
...
...
@@ -46,7 +46,7 @@
android:layout_marginBottom=
"8dp"
android:maxLines=
"1"
android:scrollHorizontally=
"true"
android
:text=
"@string/welcome_user"
tools
:text=
"@string/welcome_user"
android:textColor=
"#415564"
/>
<ImageView
...
...
warply_android_sdk/src/main/res/values/strings.xml
View file @
8adb6a3
...
...
@@ -6,7 +6,7 @@
<string
name=
"rate_dialog_negative"
>
No, Thanks
</string>
<string
name=
"cos_profile_tab"
>
Profile
</string>
<string
name=
"welcome_user"
>
Γεία σου
Γιώργος
!
</string>
<string
name=
"welcome_user"
>
Γεία σου
%1$s
!
</string>
<string
name=
"cos_profile_name"
>
Γιώργος
</string>
<string
name=
"cos_profile_type"
>
Traveller
</string>
<string
name=
"header_add"
>
Προσθήκη
</string>
...
...
Please
register
or
login
to post a comment