/
Login.java
129 lines (97 loc) · 4.6 KB
/
Login.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
package com.dailydeals;
import com.adobe.mobile.Config;
import com.adobe.mobile.Target;
import com.dailydeals.target.MboxCaller;
import com.dailydeals.custom.CustomActivity;
import com.dailydeals.DailyDeal;
import android.content.Intent;
import android.os.Bundle;
import android.text.Html;
import android.view.View;
import android.widget.AbsoluteLayout;
import android.widget.Button;
import android.util.Log;
import android.widget.LinearLayout;
import android.widget.RadioGroup;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import static android.widget.GridLayout.*;
// TODO: Auto-generated Javadoc
/**
* The Class Login is an Activity class that shows the login screen to users.
* The current implementation simply start the MainActivity. You can write your
* own logic for actual login and for login using Facebook and Twitter.
*/
public class Login extends CustomActivity {
/** The signup. */
private Button signup;
/* (non-Javadoc)
* @see com.dailydeals.custom.CustomActivity#onCreate(android.os.Bundle)
*/
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
Config.setContext(this.getApplicationContext());
Config.setDebugLogging(true);
super.onCreate(savedInstanceState);
setContentView(R.layout.login);
signup = (Button)findViewById(R.id.signup);
setTouchNClick(R.id.btn_email);
setTouchNClick(R.id.btn_forgot);
setTouchNClick(R.id.btnfb);
setTouchNClick(R.id.btntw);
setTouchNClick(R.id.signup);
signup.setText("");
// Passing custom parameters for targeting. In this example, the parameters are
// hardcoded but typically variables should be used for sending custom profile information.
// Keys with the prefix profile (eg: profile.gender) are stored on the user's profile.
// These profile attributes can be used across different activities and channels.
// Keys that don't have any prefix (eg: userMiles) are mbox parameters.
// These parameters are available only during the session.
// Keys with the prefix entity (eg: entity.category.id) are used for product recommendations.
Map<String, Object> targetParams = new HashMap<String, Object>();
targetParams.put("male", "profile.gender");
targetParams.put("platinum", "profile.memberLevel");
targetParams.put("true", "loyaltyAccount");
targetParams.put("abcd1234", "mbox3rdPartyId"); // mbox3rdPartyId is a reserved key where you can pass your crm/internal user id
targetParams.put("android.dev", "env"); // The value (eg: ios.prod) needs to be dynamic based on the app environment.
// This is used for building audiences for testing
// Here 'welcome-message-rp' is the name of the location. This will show up in the content
// location dropdown in the UI.
// See the MboxCaller class or examples and methods in this page
// https://marketing.adobe.com/resources/help/en_US/mobile/android/c_target_methods.html
MboxCaller.makeMboxCall("welcome-message-rp",
"default.png", targetParams,
new Target.TargetCallback<String>() {
@Override
public void call(final String content) {
// It is typically a bad practice to run on the main thread! This is just for the demo.
// In your production app, get this content without blocking, typically before the view is rendered
// so that the end user won't see a flicker when new content is inserted or replaced.
runOnUiThread(new Runnable() {
@Override
public void run() {
Log.d("welcome-message-rp----", content);
if (!content.equals("Default Message")) {
signup.setText(content);
}
}
});
}
});
}
/* (non-Javadoc)
* @see com.dailydeals.custom.CustomActivity#onClick(android.view.View)
*/
@Override
public void onClick(View v)
{
if (v.getId() != R.id.signup)
{
startActivity(new Intent(this.getApplicationContext(), DailyDeal.class));
MboxCaller.makeMboxConfirm("user-signed-up", "12345", "90.50", "abcd, efgh", null, null);
finish();
}
}
}