SignUpFormFragment.java
5.64 KB
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
package com.bitstrips.imoji.ui.fragments;
import android.accounts.Account;
import android.accounts.AccountManager;
import android.app.Activity;
import android.app.Fragment;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.support.v4.app.ActivityCompat;
import android.text.Html;
import android.text.TextUtils;
import android.text.method.LinkMovementMethod;
import android.util.Patterns;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.Button;
import android.widget.TextView;
import com.bitstrips.imoji.models.BSUser;
import com.bitstrips.imoji.ui.views.Form;
import com.bitstrips.imoji.ui.views.Form.EmailValidator;
import com.bitstrips.imoji.ui.views.Form.PasswordValidator;
import com.bitstrips.imoji.ui.views.Form.RequiredFieldValidator;
import com.bitstrips.imoji.ui.views.FormField;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class SignUpFormFragment
extends Fragment
{
FragmentWithValidationContainer a;
private FormField b;
private FormField c;
private FormField d;
private FormField e;
private void a()
{
FragmentWithValidationContainer localFragmentWithValidationContainer = this.a;
BSUser localBSUser = new BSUser();
localBSUser.setFirstName(this.b.getText().toString());
localBSUser.setLastName(this.c.getText().toString());
localBSUser.setEmail(this.d.getText().toString());
localBSUser.setPassword(this.e.getText().toString());
localBSUser.setAppName(getString(2131231162));
localFragmentWithValidationContainer.doSignUp(localBSUser);
}
public void onAttach(Activity paramActivity)
{
super.onAttach(paramActivity);
try
{
this.a = ((FragmentWithValidationContainer)paramActivity);
return;
}
catch (ClassCastException localClassCastException)
{
throw new ClassCastException(paramActivity.toString() + " must implement FragmentWithValidationContainer");
}
}
public void onCreate(Bundle paramBundle)
{
super.onCreate(paramBundle);
setHasOptionsMenu(true);
}
public void onCreateOptionsMenu(Menu paramMenu, MenuInflater paramMenuInflater)
{
paramMenuInflater.inflate(2131755011, paramMenu);
paramMenu.getItem(0).setEnabled(false);
paramMenu.getItem(0).getIcon().setAlpha(125);
super.onCreateOptionsMenu(paramMenu, paramMenuInflater);
}
public View onCreateView(LayoutInflater paramLayoutInflater, ViewGroup paramViewGroup, Bundle paramBundle)
{
paramViewGroup = paramLayoutInflater.inflate(2130903114, paramViewGroup, false);
this.b = ((FormField)paramViewGroup.findViewById(2131689738));
this.c = ((FormField)paramViewGroup.findViewById(2131689739));
this.d = ((FormField)paramViewGroup.findViewById(2131689539));
this.e = ((FormField)paramViewGroup.findViewById(2131689656));
paramBundle = (Button)paramViewGroup.findViewById(2131689741);
this.a.setMainButton(paramBundle);
this.a.setTitleBasedOnExtras();
paramLayoutInflater = new Form(getActivity());
paramLayoutInflater.addField(this.b, new Form.RequiredFieldValidator(this.b, paramLayoutInflater));
paramLayoutInflater.addField(this.c, new Form.RequiredFieldValidator(this.c, paramLayoutInflater));
paramLayoutInflater.addField(this.d, new Form.EmailValidator(this.d, paramLayoutInflater));
paramLayoutInflater.addField(this.e, new Form.PasswordValidator(this.e, paramLayoutInflater));
FormField localFormField = (FormField)paramViewGroup.findViewById(2131689539);
paramLayoutInflater = "";
if (ActivityCompat.checkSelfPermission(getActivity(), "android.permission.GET_ACCOUNTS") == 0)
{
Account[] arrayOfAccount = AccountManager.get(getActivity()).getAccounts();
int j = arrayOfAccount.length;
int i = 0;
while (i < j)
{
Account localAccount = arrayOfAccount[i];
if (Patterns.EMAIL_ADDRESS.matcher(localAccount.name).matches()) {
paramLayoutInflater = localAccount.name;
}
i += 1;
}
if (!TextUtils.isEmpty(paramLayoutInflater)) {
localFormField.setText(paramLayoutInflater);
}
}
paramLayoutInflater = (TextView)paramViewGroup.findViewById(2131689740);
paramLayoutInflater.setText(Html.fromHtml(String.format(getString(2131231034), new Object[] { getString(2131231072), getString(2131231306) })));
paramLayoutInflater.setLinkTextColor(getResources().getColor(2131624039));
paramLayoutInflater.setMovementMethod(LinkMovementMethod.getInstance());
paramBundle.setOnClickListener(new View.OnClickListener()
{
public final void onClick(View paramAnonymousView)
{
SignUpFormFragment.a(SignUpFormFragment.this);
}
});
getActivity().getWindow().setSoftInputMode(16);
this.b.requestFocus();
return paramViewGroup;
}
public boolean onOptionsItemSelected(MenuItem paramMenuItem)
{
if (paramMenuItem.getItemId() == 2131689979)
{
a();
return true;
}
return super.onOptionsItemSelected(paramMenuItem);
}
public static abstract interface FragmentWithValidationContainer
{
public abstract void doSignUp(BSUser paramBSUser);
public abstract void setMainButton(Button paramButton);
public abstract void setTitleBasedOnExtras();
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/com/bitstrips/imoji/ui/fragments/SignUpFormFragment.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/