Merge branch 'bugfix/tab_list' into 'develop'

tab list fix

See merge request BPHV_MIPS/mvm_core_ui!542
This commit is contained in:
Suresh, Kamlesh Jain 2020-07-20 15:37:47 -04:00
commit eaba34f51f
3 changed files with 13 additions and 4 deletions

View File

@ -41,6 +41,11 @@ import Foundation
stack.restack() stack.restack()
} }
open override func updateView(_ size: CGFloat) {
super.updateView(size)
stack.updateView(size)
}
//---------------------------------------------------- //----------------------------------------------------
// MARK: - Molecule // MARK: - Molecule
//------------------------------------------------------ //------------------------------------------------------
@ -59,6 +64,7 @@ import Foundation
open override func reset() { open override func reset() {
super.reset() super.reset()
stack.reset()
headline.setFontStyle(.Title2XLarge) headline.setFontStyle(.Title2XLarge)
subHeadline.setFontStyle(.RegularTitleLarge) subHeadline.setFontStyle(.RegularTitleLarge)
body.setFontStyle(.RegularBodySmall) body.setFontStyle(.RegularBodySmall)

View File

@ -133,11 +133,13 @@ import UIKit
public func selectIndex(_ index: Int, animated: Bool) { public func selectIndex(_ index: Int, animated: Bool) {
guard let _ = collectionView, tabsModel?.tabs.count ?? 0 > 0 else { guard let _ = collectionView, tabsModel?.tabs.count ?? 0 > 0 else {
selectedIndex = index selectedIndex = index
tabsModel?.selectedIndex = index
return return
} }
MVMCoreDispatchUtility.performBlock(onMainThread: { MVMCoreDispatchUtility.performBlock(onMainThread: {
let currentIndex = self.selectedIndex let currentIndex = self.selectedIndex
self.selectedIndex = index self.selectedIndex = index
self.tabsModel?.selectedIndex = index
self.deselect(indexPath: IndexPath(row: currentIndex, section: 0)) self.deselect(indexPath: IndexPath(row: currentIndex, section: 0))
self.selectItem(atIndexPath: IndexPath(row: index, section: 0), animated: animated) self.selectItem(atIndexPath: IndexPath(row: index, section: 0), animated: animated)
}) })

View File

@ -45,8 +45,7 @@ import UIKit
public override func reset() { public override func reset() {
super.reset() super.reset()
// TODO: Uncomment when finished with Ryan Tab pr. tabs.reset()
//tabs.reset()
} }
public override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { public override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
@ -66,9 +65,11 @@ extension TabsTableViewCell: TabsDelegate {
public func didSelectItem(_ indexPath: IndexPath, tabs: Tabs) { public func didSelectItem(_ indexPath: IndexPath, tabs: Tabs) {
let index = indexPath.row let index = indexPath.row
if let model = tabsListItemModel, index < model.molecules.count { if let model = tabsListItemModel,
index < model.molecules.count,
let cellIndexPath = delegateObject?.moleculeDelegate?.getIndexPath(for: model) {
let molecules = model.molecules[index] let molecules = model.molecules[index]
delegateObject?.moleculeDelegate?.addMolecules(molecules, indexPath: indexPath, animation: index < previousTabIndex ? .left : .right) delegateObject?.moleculeDelegate?.addMolecules(molecules, indexPath: cellIndexPath, animation: index < previousTabIndex ? .left : .right)
} }
} }
} }