mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 04:43:54 +01:00
Added Basic Pic Of the Day App Widget (#1523)
* Added Basic Pic Of the Day App Widget * Added Java Lib for XML to JSON * Added missing json library from xml to json * Undone formatting * Consolidate the networking libraries - drop volley in favor of OkHttp * Extracted a few networking related items into a new Dagger module and finished the process of mocking the main component for tests. * Refactoring to extract GpsCategoryModel and ensure single-responsibility-principle is maintained in CategoryApi. * Updated PicOfDayAppWidget class to parse HTML * fixed featured image back bug * Localisation updates from https://translatewiki.net. * Javadocs added * Add option to set image as wallpaper (#1535) * Add option to set image as wallpaper * Added java docs * Toast message on setting the wallpaper successfully * Localisation updates from https://translatewiki.net. * Add dependencies to com.android.support.test.rules and runner Needed for ActivityTestRule used in SettingsActivityTest * Added Basic Pic Of the Day App Widget * Added Java Lib for XML to JSON * Added missing json library from xml to json * Undone formatting * Updated PicOfDayAppWidget class to parse HTML
This commit is contained in:
parent
a0fe8b0745
commit
2cfbb67f1c
10 changed files with 192 additions and 53 deletions
25
app/src/main/res/layout/pic_of_day_app_widget.xml
Normal file
25
app/src/main/res/layout/pic_of_day_app_widget.xml
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/black"
|
||||
android:padding="@dimen/widget_margin"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="20sp"
|
||||
android:gravity="center"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="@string/app_widget_heading"/>
|
||||
|
||||
<ImageView
|
||||
android:padding="15dp"
|
||||
android:id="@+id/appwidget_image"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:contentDescription="@string/appwidget_img" />
|
||||
|
||||
</LinearLayout>
|
||||
10
app/src/main/res/values-v14/dimens.xml
Normal file
10
app/src/main/res/values-v14/dimens.xml
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<!--
|
||||
Refer to App Widget Documentation for margin information
|
||||
http://developer.android.com/guide/topics/appwidgets/index.html#CreatingLayout
|
||||
-->
|
||||
<dimen name="widget_margin">0dp</dimen>
|
||||
|
||||
</resources>
|
||||
|
|
@ -52,4 +52,6 @@
|
|||
<color name="bottom_bar_dark">#424242</color>
|
||||
|
||||
<color name="opak_middle_grey">#757575</color>
|
||||
<color name="white">#FFFFFF</color>
|
||||
<color name="black">#000000</color>
|
||||
</resources>
|
||||
|
|
|
|||
|
|
@ -25,4 +25,10 @@
|
|||
<dimen name="description_text_size">14sp</dimen>
|
||||
<dimen name="first_fab">15dp</dimen>
|
||||
<dimen name="second_fab">25dp</dimen>
|
||||
|
||||
<!--
|
||||
Refer to App Widget Documentation for margin information
|
||||
http://developer.android.com/guide/topics/appwidgets/index.html#CreatingLayout
|
||||
-->
|
||||
<dimen name="widget_margin">8dp</dimen>
|
||||
</resources>
|
||||
|
|
|
|||
|
|
@ -241,47 +241,49 @@
|
|||
<string name="nominated_see_more"><u>See webpage for details</u></string>
|
||||
<string name="view_browser">View in Browser</string>
|
||||
|
||||
<string name="nearby_location_has_not_changed">Location has not changed.</string>
|
||||
<string name="nearby_location_not_available">Location not available.</string>
|
||||
<string name="location_permission_rationale_nearby">Permission required to display a list of nearby places</string>
|
||||
<string name="get_directions">GET DIRECTIONS</string>
|
||||
<string name="read_article">READ ARTICLE</string>
|
||||
<string name="nearby_location_has_not_changed">Location has not changed.</string>
|
||||
<string name="nearby_location_not_available">Location not available.</string>
|
||||
<string name="location_permission_rationale_nearby">Permission required to display a list of nearby places</string>
|
||||
<string name="get_directions">GET DIRECTIONS</string>
|
||||
<string name="read_article">READ ARTICLE</string>
|
||||
|
||||
<string name="notifications_welcome" formatted="false">Welcome to Wikimedia Commons, %1$s! We\'re glad you\'re here.</string>
|
||||
<string name="notifications_talk_page_message">%1$s left a message on your talk page</string>
|
||||
<string name="notifications_thank_you_edit">Thank you for making an edit</string>
|
||||
<string name="notifications_mention">%1$s mentioned you on %2$s.</string>
|
||||
<string name="toggle_view_button">Toggle view</string>
|
||||
<string name="nearby_directions">DIRECTIONS</string>
|
||||
<string name="nearby_wikidata">WIKIDATA</string>
|
||||
<string name="nearby_wikipedia">WIKIPEDIA</string>
|
||||
<string name="nearby_commons">COMMONS</string>
|
||||
<string name="about_rate_us"><![CDATA[<u>Rate us</u>]]></string>
|
||||
<string name="about_faq"><![CDATA[<u>FAQ</u>]]></string>
|
||||
<string name="welcome_skip_button">Skip Tutorial</string>
|
||||
<string name="no_internet">Internet unavailable</string>
|
||||
<string name="internet_established">Internet available</string>
|
||||
<string name="error_notifications">Error fetching notifications</string>
|
||||
<string name="no_notifications">No notifications found</string>
|
||||
<string name="about_translate"><![CDATA[<u>Translate</u>]]></string>
|
||||
<string name="about_translate_title">Languages</string>
|
||||
<string name="about_translate_message">Select the language that you would like to submit translations for</string>
|
||||
<string name="about_translate_proceed">Proceed</string>
|
||||
<string name="about_translate_cancel">Cancel</string>
|
||||
<string name="retry">Retry</string>
|
||||
<string name="notifications_welcome" formatted="false">Welcome to Wikimedia Commons, %1$s! We\'re glad you\'re here.</string>
|
||||
<string name="notifications_talk_page_message">%1$s left a message on your talk page</string>
|
||||
<string name="notifications_thank_you_edit">Thank you for making an edit</string>
|
||||
<string name="notifications_mention">%1$s mentioned you on %2$s.</string>
|
||||
<string name="toggle_view_button">Toggle view</string>
|
||||
<string name="nearby_directions">DIRECTIONS</string>
|
||||
<string name="nearby_wikidata">WIKIDATA</string>
|
||||
<string name="nearby_wikipedia">WIKIPEDIA</string>
|
||||
<string name="nearby_commons">COMMONS</string>
|
||||
<string name="about_rate_us"><![CDATA[<u>Rate us</u>]]></string>
|
||||
<string name="about_faq"><![CDATA[<u>FAQ</u>]]></string>
|
||||
<string name="welcome_skip_button">Skip Tutorial</string>
|
||||
<string name="no_internet">Internet unavailable</string>
|
||||
<string name="internet_established">Internet available</string>
|
||||
<string name="error_notifications">Error fetching notifications</string>
|
||||
<string name="no_notifications">No notifications found</string>
|
||||
<string name="about_translate"><![CDATA[<u>Translate</u>]]></string>
|
||||
<string name="about_translate_title">Languages</string>
|
||||
<string name="about_translate_message">Select the language that you would like to submit translations for</string>
|
||||
<string name="about_translate_proceed">Proceed</string>
|
||||
<string name="about_translate_cancel">Cancel</string>
|
||||
<string name="retry">Retry</string>
|
||||
|
||||
<string name="showcase_view_got_it_button">Got it!</string>
|
||||
<string name="showcase_view_whole_nearby_activity">These are the places near you that need pictures to illustrate their Wikipedia articles</string>
|
||||
<string name="showcase_view_list_icon">Tapping this button brings up a list of these places</string>
|
||||
<string name="showcase_view_plus_fab">You can upload a picture for any place from your gallery or camera</string>
|
||||
<string name="showcase_view_got_it_button">Got it!</string>
|
||||
<string name="showcase_view_whole_nearby_activity">These are the places near you that need pictures to illustrate their Wikipedia articles</string>
|
||||
<string name="showcase_view_list_icon">Tapping this button brings up a list of these places</string>
|
||||
<string name="showcase_view_plus_fab">You can upload a picture for any place from your gallery or camera</string>
|
||||
|
||||
<string name="no_images_found">No images found!</string>
|
||||
<string name="error_loading_images">Error occurred while loading images.</string>
|
||||
<string name="image_uploaded_by">Uploaded by: %1$s</string>
|
||||
<string name="no_images_found">No images found!</string>
|
||||
<string name="error_loading_images">Error occurred while loading images.</string>
|
||||
<string name="image_uploaded_by">Uploaded by: %1$s</string>
|
||||
|
||||
<string name="share_app_title">Share App</string>
|
||||
<string name="share_coordinates_not_present">Coordinates were not specified during image selection</string>
|
||||
<string name="error_fetching_nearby_places">Error fetching nearby places.</string>
|
||||
<string name="share_app_title">Share App</string>
|
||||
<string name="share_coordinates_not_present">Coordinates were not specified during image selection</string>
|
||||
<string name="error_fetching_nearby_places">Error fetching nearby places.</string>
|
||||
<string name="appwidget_img">Pic of the Day</string>
|
||||
<string name="app_widget_heading">Pic of the Day</string>
|
||||
|
||||
<string name="successful_wikidata_edit">Image successfully added to %1$s on Wikidata!</string>
|
||||
<string name="wikidata_edit_failure">Failed to update corresponding Wikidata entity!</string>
|
||||
|
|
|
|||
11
app/src/main/res/xml/pic_of_day_app_widget_info.xml
Normal file
11
app/src/main/res/xml/pic_of_day_app_widget_info.xml
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<appwidget-provider
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:initialKeyguardLayout="@layout/pic_of_day_app_widget"
|
||||
android:initialLayout="@layout/pic_of_day_app_widget"
|
||||
android:minHeight="250dp"
|
||||
android:minWidth="250dp"
|
||||
android:previewImage="@drawable/ic_launcher"
|
||||
android:resizeMode="horizontal|vertical"
|
||||
android:updatePeriodMillis="86400000"
|
||||
android:widgetCategory="home_screen"></appwidget-provider>
|
||||
Loading…
Add table
Add a link
Reference in a new issue