(Bug 45453) Make Title required in Share dialog

This commit is contained in:
YuviPanda 2013-02-27 06:21:45 +05:30
parent 78ba373c80
commit 61ed62c6b3
3 changed files with 22 additions and 1 deletions

View file

@ -89,7 +89,8 @@
android:id="@+id/uploadButton"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Upload" />
android:enabled="false"
android:text="@string/share_upload_button" />
</LinearLayout>
</RelativeLayout>

View file

@ -45,6 +45,7 @@
</string>
<string name="login_failed_blocked">Sorry, this user has been blocked on Commons</string>
<string name="login_failed_generic">Login failed</string>
<string name="share_upload_button">Upload</string>
<plurals name="contributions_subtitle">
<item quantity="zero">No uploads yet</item>

View file

@ -6,6 +6,8 @@ import android.database.Cursor;
import android.os.AsyncTask;
import android.os.IBinder;
import android.provider.MediaStore;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.Log;
import org.wikimedia.commons.auth.AuthenticatedActivity;
import org.wikimedia.commons.auth.WikiAccountAuthenticator;
@ -181,6 +183,23 @@ public class ShareActivity extends AuthenticatedActivity {
descEdit = (EditText)findViewById(R.id.descEdit);
uploadButton = (Button)findViewById(R.id.uploadButton);
TextWatcher uploadEnabler = new TextWatcher() {
public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) { }
public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {}
public void afterTextChanged(Editable editable) {
if(titleEdit.getText().length() != 0) {
uploadButton.setEnabled(true);
} else {
uploadButton.setEnabled(false);
}
}
};
titleEdit.addTextChangedListener(uploadEnabler);
requestAuthToken();
}