mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
Open license page in browser when tapping on license line
This commit is contained in:
parent
eac7fdb575
commit
5b761ea132
2 changed files with 20 additions and 1 deletions
|
|
@ -34,5 +34,5 @@
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/share_license_summary"
|
android:text="@string/share_license_summary"
|
||||||
android:id="@+id/textView" android:layout_gravity="center" android:layout_marginTop="16dp"/>
|
android:id="@+id/licenseLabel" android:layout_gravity="center" android:layout_marginTop="16dp"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
|
||||||
|
|
@ -8,10 +8,12 @@ import android.os.Bundle;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
import android.text.TextWatcher;
|
import android.text.TextWatcher;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.MotionEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.view.inputmethod.InputMethodManager;
|
import android.view.inputmethod.InputMethodManager;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
|
import android.widget.TextView;
|
||||||
import com.actionbarsherlock.app.SherlockFragment;
|
import com.actionbarsherlock.app.SherlockFragment;
|
||||||
import com.actionbarsherlock.view.Menu;
|
import com.actionbarsherlock.view.Menu;
|
||||||
import com.actionbarsherlock.view.MenuInflater;
|
import com.actionbarsherlock.view.MenuInflater;
|
||||||
|
|
@ -27,6 +29,7 @@ public class SingleUploadFragment extends SherlockFragment {
|
||||||
|
|
||||||
private EditText titleEdit;
|
private EditText titleEdit;
|
||||||
private EditText descEdit;
|
private EditText descEdit;
|
||||||
|
private TextView licenseLabel;
|
||||||
|
|
||||||
private OnUploadActionInitiated uploadActionInitiatedHandler;
|
private OnUploadActionInitiated uploadActionInitiatedHandler;
|
||||||
|
|
||||||
|
|
@ -55,6 +58,7 @@ public class SingleUploadFragment extends SherlockFragment {
|
||||||
|
|
||||||
titleEdit = (EditText)rootView.findViewById(R.id.titleEdit);
|
titleEdit = (EditText)rootView.findViewById(R.id.titleEdit);
|
||||||
descEdit = (EditText)rootView.findViewById(R.id.descEdit);
|
descEdit = (EditText)rootView.findViewById(R.id.descEdit);
|
||||||
|
licenseLabel = (TextView)rootView.findViewById(R.id.licenseLabel);
|
||||||
|
|
||||||
TextWatcher uploadEnabler = new TextWatcher() {
|
TextWatcher uploadEnabler = new TextWatcher() {
|
||||||
public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) { }
|
public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) { }
|
||||||
|
|
@ -70,6 +74,21 @@ public class SingleUploadFragment extends SherlockFragment {
|
||||||
|
|
||||||
titleEdit.addTextChangedListener(uploadEnabler);
|
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;
|
return rootView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue