Merge pull request #20 from brion/license-summary

License summary
This commit is contained in:
Brion Vibber 2013-05-17 13:41:05 -07:00
commit 0f495b8e77
4 changed files with 27 additions and 0 deletions

View file

@ -30,4 +30,9 @@
android:hint="@string/share_description_hint"
android:imeOptions="flagNoExtractUi"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/share_license_summary"
android:id="@+id/licenseLabel" android:layout_gravity="center" android:layout_marginTop="16dp"/>
</LinearLayout>

View file

@ -73,4 +73,5 @@
<string name="no_uploads_yet">Message shown on contribution list during non-first sync if no uploads present.</string>
<string name="menu_retry">Menu item text prompting user to retry a failed upload.</string>
<string name="menu_abort">Menu item text prompting user to abort and delete a failed upload.</string>
<string name="share_license_summary">Text label briefly describing CC-BY-SA license.</string>
</resources>

View file

@ -87,4 +87,6 @@
<string name="menu_retry">Retry</string>
<string name="menu_abort">Abort</string>
<string name="share_license_summary">You agree to upload under the terms of the CC-BY-SA 3.0 license.</string>
</resources>

View file

@ -8,10 +8,12 @@ import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.TextView;
import com.actionbarsherlock.app.SherlockFragment;
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuInflater;
@ -27,6 +29,7 @@ public class SingleUploadFragment extends SherlockFragment {
private EditText titleEdit;
private EditText descEdit;
private TextView licenseLabel;
private OnUploadActionInitiated uploadActionInitiatedHandler;
@ -55,6 +58,7 @@ public class SingleUploadFragment extends SherlockFragment {
titleEdit = (EditText)rootView.findViewById(R.id.titleEdit);
descEdit = (EditText)rootView.findViewById(R.id.descEdit);
licenseLabel = (TextView)rootView.findViewById(R.id.licenseLabel);
TextWatcher uploadEnabler = new TextWatcher() {
public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) { }
@ -70,6 +74,21 @@ public class SingleUploadFragment extends SherlockFragment {
titleEdit.addTextChangedListener(uploadEnabler);
// Open license page on touch
licenseLabel.setOnTouchListener(new View.OnTouchListener() {
public boolean onTouch(View view, MotionEvent motionEvent) {
if (motionEvent.getActionMasked() == MotionEvent.ACTION_DOWN) {
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.setData(Uri.parse("https://creativecommons.org/licenses/by-sa/3.0/"));
startActivity(intent);
return true;
} else {
return false;
}
}
});
return rootView;
}