Repository navigation
dev -> main #670
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
Merged
dev -> main #670
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
0cc655e
enable `iconics-core` publishing again
mikepenz 1ce4bc9
IconicsMenuInflaterUtil: don't unset non-iconics menu item icons
PrOF-kk 44dd178
fix(sample): repair toolbar theming and do an edge-to-edge pass
mikepenz 4011316
Merge pull request #668 from mikepenz/fix/sample-edge-to-edge
mikepenz 8e6483c
Merge pull request #667 from PrOF-kk/menu_inflater_fix
mikepenz 2bdf50d
fix(core): don't overwrite existing icons when no ico_ attribute is set
mikepenz ae354b7
refactor(core): drop the ico_ prefix check in the menu inflater
mikepenz 5f3193c
Merge pull request #669 from mikepenz/fix/menu-inflater-keeps-existin…
mikepenz a5d26fa
- [release] v5.6.0
mikepenz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
app/src/main/java/com/mikepenz/iconics/sample/utils/Insets.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| /* | ||
| * Copyright (c) 2026 Mike Penz | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package com.mikepenz.iconics.sample.utils | ||
|
|
||
| import android.view.View | ||
| import androidx.core.view.ViewCompat | ||
| import androidx.core.view.WindowInsetsCompat | ||
| import androidx.core.view.updatePadding | ||
|
|
||
| /** | ||
| * Applies edge-to-edge insets: [topView] takes the status bar, [bottomView] the navigation bar, | ||
| * both take the horizontal cutout/bar insets. Listener is installed on [root] so it also survives | ||
| * `DrawerLayout` consuming the insets for its slider. | ||
| */ | ||
| fun applyEdgeToEdgeInsets(root: View, topView: View, bottomView: View) { | ||
| ViewCompat.setOnApplyWindowInsetsListener(root) { _, windowInsets -> | ||
| val insets = windowInsets.getInsets( | ||
| WindowInsetsCompat.Type.systemBars() or WindowInsetsCompat.Type.displayCutout() | ||
| ) | ||
| topView.updatePadding(left = insets.left, top = insets.top, right = insets.right) | ||
| bottomView.updatePadding(left = insets.left, right = insets.right, bottom = insets.bottom) | ||
| windowInsets | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -31,4 +31,10 @@ | |||
| app:ico_color="@android:color/holo_blue_bright" | ||||
| app:ico_icon="gmd_star" | ||||
| app:ico_size="24dp" /> | ||||
|
|
||||
| <!-- neither an `android:icon` nor any `ico_*` attribute: must stay without an icon --> | ||||
| <item | ||||
| android:id="@+id/menu_item_3" | ||||
| android:title="Item 3" | ||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||||
| app:showAsAction="always" /> | ||||
| </menu> | ||||
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
app/src/test/java/com/mikepenz/iconics/sample/IconicsMenuInflaterUtilTest.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| /* | ||
| * Copyright (c) 2026 Mike Penz | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package com.mikepenz.iconics.sample | ||
|
|
||
| import android.app.Activity | ||
| import android.view.Menu | ||
| import androidx.appcompat.view.menu.MenuBuilder | ||
| import com.mikepenz.iconics.IconicsDrawable | ||
| import com.mikepenz.iconics.utils.IconicsMenuInflaterUtil | ||
| import org.junit.Assert.assertNotNull | ||
| import org.junit.Assert.assertNull | ||
| import org.junit.Assert.assertSame | ||
| import org.junit.Assert.assertTrue | ||
| import org.junit.Before | ||
| import org.junit.Test | ||
| import org.junit.runner.RunWith | ||
| import org.robolectric.Robolectric | ||
| import org.robolectric.RobolectricTestRunner | ||
|
|
||
| /** | ||
| * `menu_playground` covers the three relevant cases: | ||
| * - `menu_item_1` has a plain `android:icon` and no `ico_*` attributes | ||
| * - `menu_item_2` is defined via `ico_*` attributes | ||
| * - `menu_item_3` has no icon at all | ||
| */ | ||
| @RunWith(RobolectricTestRunner::class) | ||
| class IconicsMenuInflaterUtilTest { | ||
|
|
||
| private lateinit var activity: Activity | ||
| private lateinit var menu: Menu | ||
|
|
||
| @Before fun setUp() { | ||
| activity = Robolectric.buildActivity(PlaygroundActivity::class.java).get() | ||
| menu = MenuBuilder(activity) | ||
| } | ||
|
|
||
| @Test fun `iconics item gets an IconicsDrawable`() { | ||
| IconicsMenuInflaterUtil.inflate(activity.menuInflater, activity, R.menu.menu_playground, menu) | ||
|
|
||
| assertTrue(menu.findItem(R.id.menu_item_2).icon is IconicsDrawable) | ||
| } | ||
|
|
||
| @Test fun `non-iconics item keeps its android icon`() { | ||
| activity.menuInflater.inflate(R.menu.menu_playground, menu) | ||
| val original = menu.findItem(R.id.menu_item_1).icon | ||
| assertNotNull("menu_item_1 is expected to declare an android:icon", original) | ||
|
|
||
| IconicsMenuInflaterUtil.parseXmlAndSetIconicsDrawables(activity, R.menu.menu_playground, menu) | ||
|
|
||
| assertSame( | ||
| "an item without ico_* attributes must keep the drawable of its android:icon", | ||
| original, | ||
| menu.findItem(R.id.menu_item_1).icon | ||
| ) | ||
| } | ||
|
|
||
| @Test fun `item without any icon stays without one`() { | ||
| IconicsMenuInflaterUtil.inflate(activity.menuInflater, activity, R.menu.menu_playground, menu) | ||
|
|
||
| assertNull(menu.findItem(R.id.menu_item_3).icon) | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.