Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use sitemap labels instead of name in the sitemap selection dialog #597

Merged
merged 3 commits into from
Jan 8, 2018

Conversation

mueller-ma
Copy link
Member

Fix #595

The sitemap name is also shown in the settings. @FlorianSW Whats the best way to show the label there?

@FlorianSW
Copy link
Member

You would need to save the label of the sitemap in another preference and make the "real" sitemap preference (with the name of the sitemap) hidden. Then, when the user clicks the "Clear sitemap" preference, both preferences need to be cleared.

@@ -821,13 +821,15 @@ public void onSuccess(Call call, int statusCode, Headers headers, byte[] respons
private void showSitemapSelectionDialog(final List<OpenHABSitemap> sitemapList) {
Log.d(TAG, "Opening sitemap selection dialog");
final List<String> sitemapNameList = new ArrayList<String>();
final List<String> sitemapLabelList = new ArrayList<String>();
for (int i = 0; i < sitemapList.size(); i++) {
sitemapNameList.add(sitemapList.get(i).getName());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it really needed to have two lists here? Wouldn't it be possible to get rid of sitemapNameList? When accessing the sitemapNameList in the dialog, you could access sitemapList, get the element at the position of "item" and execute getName on that.

If we would've API Level 24 as the minimum supported, we could even use streams and wouldn't need any additional list here (at least not as a local variable).

@mueller-ma mueller-ma changed the title WIP: Use sitemap labels instead of name in the sitemap selection dialog Use sitemap labels instead of name in the sitemap selection dialog Jan 3, 2018
@FlorianSW
Copy link
Member

LGTM, however, there're merge conflicts.

Copy link
Member

@FlorianSW FlorianSW left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You also need to change the text for the instrumented tests when a sitemap should be selected, right? Currently, the tests are looking for a sitemap with the text "demo", which is now "Main Menu", so they'll fail because demo is not visible to the user.

@mueller-ma
Copy link
Member Author

Going to wait for #526 before I merge, so I can be sure it doesnt brake #526

Signed-off-by: mueller-ma <[email protected]>
@codecov-io
Copy link

Codecov Report

Merging #597 into master will decrease coverage by 0.14%.
The diff coverage is 53.84%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #597      +/-   ##
==========================================
- Coverage   31.73%   31.59%   -0.15%     
==========================================
  Files          64       64              
  Lines        4852     4855       +3     
  Branches      655      655              
==========================================
- Hits         1540     1534       -6     
- Misses       3093     3101       +8     
- Partials      219      220       +1
Impacted Files Coverage Δ
...main/java/org/openhab/habdroid/util/Constants.java 0% <ø> (ø) ⬆️
...penhab/habdroid/ui/OpenHABPreferencesActivity.java 0% <0%> (ø) ⬆️
...a/org/openhab/habdroid/ui/OpenHABMainActivity.java 35.52% <77.77%> (+0.09%) ⬆️
...hab/habdroid/ui/widget/SegmentedControlButton.java 50.61% <0%> (-6.18%) ⬇️
.../org/openhab/habdroid/ui/OpenHABWidgetAdapter.java 40.91% <0%> (-0.37%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0f05993...ef1558e. Read the comment docs.

@mueller-ma mueller-ma merged commit 57168b6 into openhab:master Jan 8, 2018
@mueller-ma mueller-ma deleted the 595-sitemap-selection branch January 8, 2018 17:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants