create account

Implemented Home Screen widget Feature to Travel Mate Android app by hiremani

View this thread on: hive.blogpeakd.comecency.com
· @hiremani ·
$54.69
Implemented Home Screen widget Feature to Travel Mate Android app
#### Repository
https://github.com/project-travel-mate/Travel-Mate

#### Travel Mate
https://project-travel-mate.github.io/Travel-Mate/

<blockquote>
<p>A must-have app for those interested in travel. The app provides users with various features from choosing the correct destination to making all the bookings and to easily organizing the trip. The platform basically uses a mash-up technology. The app provides solutions for every possible problem a traveller might face during the course of his or her entire journey.</p>
	<p>While travelling from one place to another, there are a lot of factors to be considered to make the trip a memorable one. Our platform helps the traveller with anything and everything that he or she might need, from the moment he or she plans the journey till the time he or she is back home happy and content. The platform includes a wide variety of options - from selection of Mode of Transport, to finding out about the destination city, to provision of best music, novels, depending on the mood of the traveller.</p>	
</blockquote>

### New Features
- What feature(s) did you add?
The App has travel related checklist feature and the new feature was to create home screen widget to show the selcted checklist items on it.

    [Link to Feature Request](https://github.com/project-travel-mate/Travel-Mate/issues/118)

- How did you implement it/them?
**References**
https://medium.com/android-bits/android-widgets-ad3d166458d3
https://developer.android.com/guide/topics/appwidgets/

![](https://ipfs.busy.org/ipfs/QmRLiH8kdascgBcyccMKisNkzKxWse3Fw2jSxJZare9MaC)!

Added local database using room persistence library and created utility [WidgetCheckListDao](https://github.com/project-travel-mate/Travel-Mate/blob/master/Android/app/src/main/java/dao/WidgetCheckListDao.java) make CRUD operation even in detached fragments at home screen. 

Next, to create home screen widget used below XML layout structure which is responsible for widget creation. As you can see  the code `android:updatePeriodMillis="1800000"` is for updating the widget. 

```
<?xml version="1.0" encoding="utf-8"?>
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
    android:initialKeyguardLayout="@layout/checklist_widget"
    android:initialLayout="@layout/checklist_widget"
    android:minHeight="150dp"
    android:minWidth="110dp"
    android:resizeMode="horizontal|vertical"
    android:updatePeriodMillis="1800000"
    android:widgetCategory="home_screen|keyguard" /> 
```

Created another two layouts to add checklist items inside the widget listview. 
[checklist_widget](https://github.com/project-travel-mate/Travel-Mate/blob/master/Android/app/src/main/res/layout/checklist_widget.xml)
[checklist_widget_item](https://github.com/project-travel-mate/Travel-Mate/blob/master/Android/app/src/main/res/layout/checklist_widget_item.xml)

Here the final step is to bind UI elements on home screen widget and update it frequently. The following two class are reaponsible to do that.

[CheckListWidgetProvider](https://github.com/project-travel-mate/Travel-Mate/blob/master/Android/app/src/main/java/widget/CheckListWidgetProvider.java)
[CheckListWidgetService](https://github.com/project-travel-mate/Travel-Mate/blob/master/Android/app/src/main/java/widget/CheckListWidgetService.java)

and included these in `Menifest.xml` in `reciever` and `service` tag respectively. 

```
<receiver android:name="widget.CheckListWidgetProvider" >
            <intent-filter>
                 <!-- This widget provider receives broadcast with following action name or simply onUpdate of AppWidgetProvider is called -->
                <action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
            </intent-filter>
            <!-- linking up xml file of appwidget-provider to AppWidgetProvider -->
            <meta-data
                android:name="android.appwidget.provider"
                android:resource="@xml/checklist_widget_info" />
        </receiver>
         <service
            android:name="widget.CheckListWidgetService"
            android:permission="android.permission.BIND_REMOTEVIEWS" />
```



[**Pull Requests**](https://github.com/project-travel-mate/Travel-Mate/pull/462)

### Github Account
https://github.com/santoshhiremani
πŸ‘  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 20 others
properties (23)
authorhiremani
permlinkimplemented-home-screen-widget-feature-to-travel-mate-android-app-1537778418325
categoryutopian-io
json_metadata{"app":"steeditor/0.1.2","format":"markdown","image":["https://ipfs.busy.org/ipfs/QmeiDgYVENXJu3UYqfv1rm31LU9FxeXFYbkmut1xourozt","https://ipfs.busy.org/ipfs/QmRLiH8kdascgBcyccMKisNkzKxWse3Fw2jSxJZare9MaC"],"tags":["utopian-io","development"],"users":["layout","xml"],"links":["https://github.com/project-travel-mate/Travel-Mate","https://project-travel-mate.github.io/Travel-Mate/","https://github.com/project-travel-mate/Travel-Mate/issues/118","https://medium.com/android-bits/android-widgets-ad3d166458d3","https://developer.android.com/guide/topics/appwidgets/","https://github.com/project-travel-mate/Travel-Mate/blob/master/Android/app/src/main/java/dao/WidgetCheckListDao.java","http://schemas.android.com/apk/res/android","https://github.com/project-travel-mate/Travel-Mate/blob/master/Android/app/src/main/res/layout/checklist_widget.xml","https://github.com/project-travel-mate/Travel-Mate/blob/master/Android/app/src/main/res/layout/checklist_widget_item.xml","https://github.com/project-travel-mate/Travel-Mate/blob/master/Android/app/src/main/java/widget/CheckListWidgetProvider.java","https://github.com/project-travel-mate/Travel-Mate/blob/master/Android/app/src/main/java/widget/CheckListWidgetService.java","https://github.com/project-travel-mate/Travel-Mate/pull/462","https://github.com/santoshhiremani"]}
created2018-09-24 08:40:21
last_update2018-09-24 08:40:21
depth0
children7
last_payout2018-10-01 08:40:21
cashout_time1969-12-31 23:59:59
total_payout_value40.716 HBD
curator_payout_value13.978 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length4,297
author_reputation7,035,336,488,338
root_title"Implemented Home Screen widget Feature to Travel Mate Android app"
beneficiaries
0.
accountutopian.pay
weight500
max_accepted_payout100,000.000 HBD
percent_hbd10,000
post_id72,105,884
net_rshares40,941,797,101,227
author_curate_reward""
vote details (84)
@amosbastian ·
$14.02
Thanks for the contribution, @hiremani! The widget looks nice and useful for people who use Travel Mate, great work!

I would recommend you lead your comments with space, because otherwise it looks like commented out code (in my opinion). Also, was wondering something about the pull request itself: in the section "Type of change" they ask you to put an X for everything that is valid. You selected all three, but it seems to me like the last two contradict each other, haha:

* New feature (**non-breaking** change which adds functionality)
* **Breaking change** (fix or feature that would cause existing functionality to not work as expected)

Looking forward to seeing more of your contributions!

---

Your contribution has been evaluated according to [Utopian policies and guidelines](https://join.utopian.io/guidelines), as well as a predefined set of questions pertaining to the category.

To view those questions and the relevant answers related to your post, [click here](https://review.utopian.io/result/3/2331212).

---- 
Need help? Write a ticket on https://support.utopian.io/. 
Chat with us on [Discord](https://discord.gg/uTyJkNm). 
[[utopian-moderator]](https://join.utopian.io/)
πŸ‘  , , , , , , , , , , ,
properties (23)
authoramosbastian
permlinkre-hiremani-implemented-home-screen-widget-feature-to-travel-mate-android-app-1537778418325-20180930t000734527z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"users":["hiremani"],"links":["https://join.utopian.io/guidelines","https://review.utopian.io/result/3/2331212","https://support.utopian.io/","https://discord.gg/uTyJkNm","https://join.utopian.io/"],"app":"steemit/0.1"}
created2018-09-30 00:07:33
last_update2018-09-30 00:07:33
depth1
children2
last_payout2018-10-07 00:07:33
cashout_time1969-12-31 23:59:59
total_payout_value10.560 HBD
curator_payout_value3.463 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length1,196
author_reputation174,473,586,900,705
root_title"Implemented Home Screen widget Feature to Travel Mate Android app"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id72,333,708
net_rshares7,092,095,061,186
author_curate_reward""
vote details (12)
@hiremani ·
Thank you for the review... Yes i will consider your suggestion in my next contribution, Even i had same confusion in selection so checked all 3.... :)
properties (22)
authorhiremani
permlinkre-amosbastian-re-hiremani-implemented-home-screen-widget-feature-to-travel-mate-android-app-1537778418325-20180930t174648768z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"app":"steemit/0.1"}
created2018-09-30 17:46:48
last_update2018-09-30 17:46:48
depth2
children0
last_payout2018-10-07 17:46:48
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length151
author_reputation7,035,336,488,338
root_title"Implemented Home Screen widget Feature to Travel Mate Android app"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id72,367,571
net_rshares0
@utopian-io ·
Thank you for your review, @amosbastian!

So far this week you've reviewed 6 contributions. Keep up the good work!
properties (22)
authorutopian-io
permlinkre-re-hiremani-implemented-home-screen-widget-feature-to-travel-mate-android-app-1537778418325-20180930t000734527z-20181002t145041z
categoryutopian-io
json_metadata"{"app": "beem/0.20.1"}"
created2018-10-02 14:50:42
last_update2018-10-02 14:50:42
depth2
children0
last_payout2018-10-09 14:50:42
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length114
author_reputation152,955,367,999,756
root_title"Implemented Home Screen widget Feature to Travel Mate Android app"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id72,485,394
net_rshares0
@hiremani ·
@ibar !price steem
properties (22)
authorhiremani
permlinkre-hiremani-implemented-home-screen-widget-feature-to-travel-mate-android-app-1537778418325-20181001t145709663z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"users":["ibar"],"app":"steemit/0.1"}
created2018-10-01 14:57:09
last_update2018-10-01 14:57:09
depth1
children1
last_payout2018-10-08 14:57:09
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length18
author_reputation7,035,336,488,338
root_title"Implemented Home Screen widget Feature to Travel Mate Android app"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id72,418,766
net_rshares0
@ibar ·
`$0.8391709757679103`
 Upvote ibar's comment to Support! 
 Get list of coin [ids here](https://api.coingecko.com/api/v3/coins/list) and you will use `id` names with commands to make it work.
properties (22)
authoribar
permlinkre-hiremani-implemented-home-screen-widget-feature-to-travel-mate-android-app-1537778418325-20181001t145709663z-ibar-crypto-seeker
categoryutopian-io
json_metadata""
created2018-10-01 14:57:18
last_update2018-10-01 14:57:18
depth2
children0
last_payout2018-10-08 14:57:18
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length190
author_reputation364,171,302
root_title"Implemented Home Screen widget Feature to Travel Mate Android app"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id72,418,771
net_rshares0
@hiremani ·
@hiremani !price steem
properties (22)
authorhiremani
permlinkre-hiremani-implemented-home-screen-widget-feature-to-travel-mate-android-app-1537778418325-20181001t150408676z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"users":["hiremani"],"app":"steemit/0.1"}
created2018-10-01 15:04:09
last_update2018-10-01 15:04:09
depth1
children0
last_payout2018-10-08 15:04:09
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length22
author_reputation7,035,336,488,338
root_title"Implemented Home Screen widget Feature to Travel Mate Android app"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id72,419,249
net_rshares0
@utopian-io ·
Hey, @hiremani!

**Thanks for contributing on Utopian**.
We’re already looking forward to your next contribution!

**Get higher incentives and support Utopian.io!**
 Simply set @utopian.pay as a 5% (or higher) payout beneficiary on your contribution post (via [SteemPlus](https://chrome.google.com/webstore/detail/steemplus/mjbkjgcplmaneajhcbegoffkedeankaj?hl=en) or [Steeditor](https://steeditor.app)).

**Want to chat? Join us on Discord https://discord.gg/h52nFrV.**

<a href='https://steemconnect.com/sign/account-witness-vote?witness=utopian-io&approve=1'>Vote for Utopian Witness!</a>
properties (22)
authorutopian-io
permlinkre-implemented-home-screen-widget-feature-to-travel-mate-android-app-1537778418325-20180930t142631z
categoryutopian-io
json_metadata"{"app": "beem/0.20.1"}"
created2018-09-30 14:26:33
last_update2018-09-30 14:26:33
depth1
children0
last_payout2018-10-07 14:26:33
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length590
author_reputation152,955,367,999,756
root_title"Implemented Home Screen widget Feature to Travel Mate Android app"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id72,358,039
net_rshares0