mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 12:53:55 +01:00
Merge remote-tracking branch 'refs/remotes/commons-app/master'
This commit is contained in:
commit
8acf6ad1c6
9 changed files with 91 additions and 83 deletions
|
|
@ -7,8 +7,10 @@ public class Prefs {
|
||||||
public static final String DEFAULT_LICENSE = "defaultLicense";
|
public static final String DEFAULT_LICENSE = "defaultLicense";
|
||||||
|
|
||||||
public static class Licenses {
|
public static class Licenses {
|
||||||
public static final String CC_BY_SA = "CC BY-SA";
|
public static final String CC_BY_SA_3 = "CC BY-SA";
|
||||||
public static final String CC_BY = "CC BY";
|
public static final String CC_BY_3 = "CC BY";
|
||||||
|
public static final String CC_BY_SA_4 = "CC BY-SA 4.0";
|
||||||
|
public static final String CC_BY_4 = "CC BY 4.0";
|
||||||
public static final String CC0 = "CC0";
|
public static final String CC0 = "CC0";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,12 +28,16 @@ public class SettingsActivity extends PreferenceActivity implements SharedPrefer
|
||||||
licensePreference.setEntries(new String[]{
|
licensePreference.setEntries(new String[]{
|
||||||
getString(R.string.license_name_cc0),
|
getString(R.string.license_name_cc0),
|
||||||
getString(R.string.license_name_cc_by),
|
getString(R.string.license_name_cc_by),
|
||||||
getString(R.string.license_name_cc_by_sa)
|
getString(R.string.license_name_cc_by_four),
|
||||||
|
getString(R.string.license_name_cc_by_sa),
|
||||||
|
getString(R.string.license_name_cc_by_sa_four)
|
||||||
});
|
});
|
||||||
licensePreference.setEntryValues(new String[]{
|
licensePreference.setEntryValues(new String[]{
|
||||||
Prefs.Licenses.CC0,
|
Prefs.Licenses.CC0,
|
||||||
Prefs.Licenses.CC_BY,
|
Prefs.Licenses.CC_BY_3,
|
||||||
Prefs.Licenses.CC_BY_SA
|
Prefs.Licenses.CC_BY_4,
|
||||||
|
Prefs.Licenses.CC_BY_SA_3,
|
||||||
|
Prefs.Licenses.CC_BY_SA_4
|
||||||
});
|
});
|
||||||
|
|
||||||
licensePreference.setSummary(getString(Utils.licenseNameFor(licensePreference.getValue())));
|
licensePreference.setSummary(getString(Utils.licenseNameFor(licensePreference.getValue())));
|
||||||
|
|
|
||||||
|
|
@ -205,10 +205,14 @@ public class Utils {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String licenseTemplateFor(String license) {
|
public static String licenseTemplateFor(String license) {
|
||||||
if(license.equals(Prefs.Licenses.CC_BY)) {
|
if(license.equals(Prefs.Licenses.CC_BY_3)) {
|
||||||
return "{{self|cc-by-3.0}}";
|
return "{{self|cc-by-3.0}}";
|
||||||
} else if(license.equals(Prefs.Licenses.CC_BY_SA)) {
|
} else if(license.equals(Prefs.Licenses.CC_BY_4)) {
|
||||||
|
return "{{self|cc-by-4.0}}";
|
||||||
|
} else if(license.equals(Prefs.Licenses.CC_BY_SA_3)) {
|
||||||
return "{{self|cc-by-sa-3.0}}";
|
return "{{self|cc-by-sa-3.0}}";
|
||||||
|
} else if(license.equals(Prefs.Licenses.CC_BY_SA_4)) {
|
||||||
|
return "{{self|cc-by-sa-4.0}}";
|
||||||
} else if(license.equals(Prefs.Licenses.CC0)) {
|
} else if(license.equals(Prefs.Licenses.CC0)) {
|
||||||
return "{{self|cc-zero}}";
|
return "{{self|cc-zero}}";
|
||||||
}
|
}
|
||||||
|
|
@ -216,10 +220,14 @@ public class Utils {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int licenseNameFor(String license) {
|
public static int licenseNameFor(String license) {
|
||||||
if(license.equals(Prefs.Licenses.CC_BY)) {
|
if(license.equals(Prefs.Licenses.CC_BY_3)) {
|
||||||
return R.string.license_name_cc_by;
|
return R.string.license_name_cc_by;
|
||||||
} else if(license.equals(Prefs.Licenses.CC_BY_SA)) {
|
} else if(license.equals(Prefs.Licenses.CC_BY_4)) {
|
||||||
|
return R.string.license_name_cc_by_four;
|
||||||
|
} else if(license.equals(Prefs.Licenses.CC_BY_SA_3)) {
|
||||||
return R.string.license_name_cc_by_sa;
|
return R.string.license_name_cc_by_sa;
|
||||||
|
} else if(license.equals(Prefs.Licenses.CC_BY_SA_4)) {
|
||||||
|
return R.string.license_name_cc_by_sa_four;
|
||||||
} else if(license.equals(Prefs.Licenses.CC0)) {
|
} else if(license.equals(Prefs.Licenses.CC0)) {
|
||||||
return R.string.license_name_cc0;
|
return R.string.license_name_cc0;
|
||||||
}
|
}
|
||||||
|
|
@ -227,11 +235,16 @@ public class Utils {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String licenseUrlFor(String license) {
|
public static String licenseUrlFor(String license) {
|
||||||
if(license.equals(Prefs.Licenses.CC_BY)) {
|
if(license.equals(Prefs.Licenses.CC_BY_3)) {
|
||||||
return "https://creativecommons.org/licenses/by/3.0/";
|
return "https://creativecommons.org/licenses/by/3.0/";
|
||||||
} else if(license.equals(Prefs.Licenses.CC_BY_SA)) {
|
} else if(license.equals(Prefs.Licenses.CC_BY_4)) {
|
||||||
|
return "https://creativecommons.org/licenses/by/4.0/";
|
||||||
|
} else if(license.equals(Prefs.Licenses.CC_BY_SA_3)) {
|
||||||
return "https://creativecommons.org/licenses/by-sa/3.0/";
|
return "https://creativecommons.org/licenses/by-sa/3.0/";
|
||||||
} else if(license.equals(Prefs.Licenses.CC0)) {
|
} else if(license.equals(Prefs.Licenses.CC_BY_SA_4)) {
|
||||||
|
return "https://creativecommons.org/licenses/by-sa/4.0/";
|
||||||
|
}
|
||||||
|
else if(license.equals(Prefs.Licenses.CC0)) {
|
||||||
return "https://creativecommons.org/publicdomain/zero/1.0/";
|
return "https://creativecommons.org/publicdomain/zero/1.0/";
|
||||||
}
|
}
|
||||||
throw new RuntimeException("Unrecognized license value");
|
throw new RuntimeException("Unrecognized license value");
|
||||||
|
|
|
||||||
|
|
@ -369,7 +369,7 @@ public class Contribution extends Media {
|
||||||
db.execSQL("ALTER TABLE " + TABLE_NAME + " ADD COLUMN height INTEGER;");
|
db.execSQL("ALTER TABLE " + TABLE_NAME + " ADD COLUMN height INTEGER;");
|
||||||
db.execSQL("UPDATE " + TABLE_NAME + " SET height = 0");
|
db.execSQL("UPDATE " + TABLE_NAME + " SET height = 0");
|
||||||
db.execSQL("ALTER TABLE " + TABLE_NAME + " ADD COLUMN license STRING;");
|
db.execSQL("ALTER TABLE " + TABLE_NAME + " ADD COLUMN license STRING;");
|
||||||
db.execSQL("UPDATE " + TABLE_NAME + " SET license='" + Prefs.Licenses.CC_BY_SA + "';");
|
db.execSQL("UPDATE " + TABLE_NAME + " SET license='" + Prefs.Licenses.CC_BY_SA_3 + "';");
|
||||||
from++;
|
from++;
|
||||||
onUpdate(db, from, to);
|
onUpdate(db, from, to);
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -116,7 +116,7 @@ public class SingleUploadFragment extends Fragment {
|
||||||
titleEdit.addTextChangedListener(uploadEnabler);
|
titleEdit.addTextChangedListener(uploadEnabler);
|
||||||
|
|
||||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
|
||||||
final String license = prefs.getString(Prefs.DEFAULT_LICENSE, Prefs.Licenses.CC_BY_SA);
|
final String license = prefs.getString(Prefs.DEFAULT_LICENSE, Prefs.Licenses.CC_BY_SA_3);
|
||||||
licenseSummaryView.setText(getString(R.string.share_license_summary, getString(Utils.licenseNameFor(license))));
|
licenseSummaryView.setText(getString(R.string.share_license_summary, getString(Utils.licenseNameFor(license))));
|
||||||
|
|
||||||
// Open license page on touch
|
// Open license page on touch
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,7 @@ public class UploadController {
|
||||||
contribution.setDescription("");
|
contribution.setDescription("");
|
||||||
}
|
}
|
||||||
|
|
||||||
String license = prefs.getString(Prefs.DEFAULT_LICENSE, Prefs.Licenses.CC_BY_SA);
|
String license = prefs.getString(Prefs.DEFAULT_LICENSE, Prefs.Licenses.CC_BY_SA_3);
|
||||||
contribution.setLicense(license);
|
contribution.setLicense(license);
|
||||||
|
|
||||||
//FIXME: Add permission request here. Only executeAsyncTask if permission has been granted
|
//FIXME: Add permission request here. Only executeAsyncTask if permission has been granted
|
||||||
|
|
|
||||||
|
|
@ -8,95 +8,76 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
|
android:layout_margin="16dp"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
>
|
>
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/commonsLogo"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="16dp"
|
|
||||||
android:src="@drawable/commons_logo_large"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/loginSubtitle"
|
android:id="@+id/loginSubtitle"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="8dp"
|
android:layout_marginBottom="48dp"
|
||||||
|
android:drawablePadding="8dp"
|
||||||
|
android:drawableTop="@drawable/commons_logo_large"
|
||||||
|
android:gravity="center_horizontal"
|
||||||
android:text="@string/app_name"
|
android:text="@string/app_name"
|
||||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<LinearLayout
|
<android.support.design.widget.TextInputLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="wrap_content"
|
||||||
android:layout_margin="16dip"
|
|
||||||
android:gravity="center"
|
|
||||||
android:orientation="vertical"
|
|
||||||
>
|
>
|
||||||
|
|
||||||
<FrameLayout
|
<android.support.design.widget.TextInputEditText
|
||||||
android:id="@+id/loginErrors"
|
android:id="@+id/loginUsername"
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="48dp"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<android.support.design.widget.TextInputLayout
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:hint="@string/username"
|
||||||
|
android:imeOptions="flagNoExtractUi"
|
||||||
|
android:inputType="textNoSuggestions"
|
||||||
>
|
>
|
||||||
|
|
||||||
<android.support.design.widget.TextInputEditText
|
<requestFocus/>
|
||||||
android:id="@+id/loginUsername"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:hint="@string/username"
|
|
||||||
android:imeOptions="flagNoExtractUi"
|
|
||||||
android:inputType="textNoSuggestions"
|
|
||||||
>
|
|
||||||
|
|
||||||
<requestFocus/>
|
</android.support.design.widget.TextInputEditText>
|
||||||
|
|
||||||
</android.support.design.widget.TextInputEditText>
|
</android.support.design.widget.TextInputLayout>
|
||||||
|
|
||||||
</android.support.design.widget.TextInputLayout>
|
<android.support.design.widget.TextInputLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:passwordToggleEnabled="false"
|
||||||
|
>
|
||||||
|
|
||||||
<android.support.design.widget.TextInputLayout
|
<android.support.design.widget.TextInputEditText
|
||||||
|
android:id="@+id/loginPassword"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:passwordToggleEnabled="false"
|
android:hint="@string/password"
|
||||||
>
|
android:imeOptions="flagNoExtractUi"
|
||||||
|
android:inputType="textPassword"
|
||||||
<android.support.design.widget.TextInputEditText
|
|
||||||
android:id="@+id/loginPassword"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:hint="@string/password"
|
|
||||||
android:imeOptions="flagNoExtractUi"
|
|
||||||
android:inputType="textPassword"
|
|
||||||
/>
|
|
||||||
|
|
||||||
</android.support.design.widget.TextInputLayout>
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/loginButton"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:enabled="false"
|
|
||||||
android:text="@string/login"
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Button
|
</android.support.design.widget.TextInputLayout>
|
||||||
android:id="@+id/signupButton"
|
|
||||||
android:layout_width="match_parent"
|
<Button
|
||||||
android:layout_height="wrap_content"
|
android:id="@+id/loginButton"
|
||||||
android:text="@string/signup"
|
android:layout_width="match_parent"
|
||||||
android:layout_gravity="center_horizontal"
|
android:layout_height="wrap_content"
|
||||||
android:onClick="signUp"
|
android:enabled="false"
|
||||||
/>
|
android:text="@string/login"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/signupButton"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_horizontal"
|
||||||
|
android:onClick="signUp"
|
||||||
|
android:text="@string/signup"
|
||||||
|
/>
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
|
|
||||||
|
|
@ -7,27 +7,33 @@
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
>
|
>
|
||||||
|
|
||||||
<!-- Sorry about the hardcoded sizes here. They're image-related. -->
|
<RelativeLayout
|
||||||
<LinearLayout
|
android:gravity="center"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="180dp"
|
android:layout_height="180dp"
|
||||||
android:gravity="center_horizontal"
|
android:layout_marginLeft="10dp"
|
||||||
|
android:layout_marginRight="10dp"
|
||||||
>
|
>
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
|
android:src="@drawable/welcome_wikipedia"
|
||||||
|
android:id="@+id/welcome_wikipedia"
|
||||||
android:layout_width="150dp"
|
android:layout_width="150dp"
|
||||||
android:layout_height="180dp"
|
android:layout_height="180dp"
|
||||||
android:src="@drawable/welcome_wikipedia"
|
android:layout_marginLeft="30dp"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
|
android:src="@drawable/welcome_copyright"
|
||||||
android:layout_width="160dp"
|
android:layout_width="160dp"
|
||||||
android:layout_height="120dp"
|
android:layout_height="120dp"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:src="@drawable/welcome_copyright"
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_marginLeft="10dp"
|
||||||
|
android:layout_toRightOf="@+id/welcome_wikipedia"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
</LinearLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
|
|
||||||
|
|
@ -90,6 +90,8 @@ Tap this message (or hit back) to skip this step.</string>
|
||||||
<string name="use_previous">Use previous title/description</string>
|
<string name="use_previous">Use previous title/description</string>
|
||||||
<string name="allow_gps">Automatically get current location</string>
|
<string name="allow_gps">Automatically get current location</string>
|
||||||
<string name="allow_gps_summary">Retrieve current location to offer category suggestions if image is not geotagged</string>
|
<string name="allow_gps_summary">Retrieve current location to offer category suggestions if image is not geotagged</string>
|
||||||
|
<string name="license_name_cc_by_sa_four"> Attribution-ShareAlike 4.0</string>
|
||||||
|
<string name="license_name_cc_by_four"> Attribution 4.0</string>
|
||||||
<string name="license_name_cc_by_sa"> Attribution-ShareAlike 3.0</string>
|
<string name="license_name_cc_by_sa"> Attribution-ShareAlike 3.0</string>
|
||||||
<string name="license_name_cc_by"> Attribution 3.0</string>
|
<string name="license_name_cc_by"> Attribution 3.0</string>
|
||||||
<string name="license_name_cc0">CC0</string>
|
<string name="license_name_cc0">CC0</string>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue