Skip to content

Commit 118741e

Browse files
committed
Merge pull request #4 from misaochan/signup-button
Added "sign up" button
2 parents 9b256d5 + 04ee167 commit 118741e

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

commons/res/layout/activity_login.xml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,14 @@
6363
android:layout_height="wrap_content"
6464
android:enabled="false"
6565
android:text="@string/login" />
66-
66+
<Button
67+
android:id="@+id/signupButton"
68+
android:layout_width="fill_parent"
69+
android:layout_height="wrap_content"
70+
android:text="@string/signup"
71+
android:layout_gravity="center_horizontal"/>
6772
</LinearLayout>
6873

74+
6975
</LinearLayout>
7076
</ScrollView>

commons/res/values/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<string name="username">Username</string>
66
<string name="password">Password</string>
77
<string name="login">Log in</string>
8+
<string name="signup">Sign up</string>
89
<string name="logging_in_title">Logging in</string>
910
<string name="logging_in_message">Please wait...</string>
1011
<string name="login_success">Login success!</string>

commons/src/main/java/fr/free/nrw/commons/auth/LoginActivity.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import java.io.IOException;
44

55
import android.content.*;
6+
import android.net.Uri;
67
import android.text.*;
78
import android.view.inputmethod.EditorInfo;
89
import de.keyboardsurfer.android.widget.crouton.*;
@@ -30,6 +31,7 @@ public class LoginActivity extends AccountAuthenticatorActivity {
3031
private CommonsApplication app;
3132

3233
Button loginButton;
34+
Button signupButton;
3335
EditText usernameEdit;
3436
EditText passwordEdit;
3537

@@ -131,6 +133,7 @@ public void onCreate(Bundle savedInstanceState) {
131133
app = (CommonsApplication) this.getApplicationContext();
132134
setContentView(R.layout.activity_login);
133135
loginButton = (Button) findViewById(R.id.loginButton);
136+
signupButton = (Button) findViewById(R.id.signupButton);
134137
usernameEdit = (EditText) findViewById(R.id.loginUsername);
135138
passwordEdit = (EditText) findViewById(R.id.loginPassword);
136139
final LoginActivity that = this;
@@ -166,8 +169,13 @@ public boolean onEditorAction(TextView textView, int actionId, KeyEvent keyEvent
166169
}
167170
});
168171

172+
signupButton.setOnClickListener(new View.OnClickListener() {
173+
public void onClick(View v) {
174+
startActivity(new Intent(Intent.ACTION_VIEW).setData(Uri.parse("https://commons.wikimedia.org/wiki/Special:UserLogin/signup")));
175+
}
176+
});
177+
169178
loginButton.setOnClickListener(new View.OnClickListener() {
170-
@Override
171179
public void onClick(View v) {
172180
that.performLogin();
173181
}

0 commit comments

Comments
 (0)