mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
chore: cleanup
This commit is contained in:
@@ -1,12 +1,15 @@
|
||||
import { TabView as TabViewDefinition, TabViewItem as TabViewItemDefinition, SelectedIndexChangedEventData } from ".";
|
||||
import {
|
||||
View, ViewBase, Style, Property, CssProperty, CoercibleProperty,
|
||||
Color, isIOS, AddArrayFromBuilder, AddChildFromBuilder, EventData, CSSType,
|
||||
traceWrite, traceCategories, traceMessageType, booleanConverter
|
||||
View, AddArrayFromBuilder, AddChildFromBuilder, CSSType
|
||||
} from "../core/view";
|
||||
|
||||
export * from "../core/view";
|
||||
import { ViewBase, booleanConverter } from "../core/view-base";
|
||||
import { Style } from "../styling/style";
|
||||
import { EventData } from "../../data/observable";
|
||||
import { Color } from "../../color";
|
||||
import { isIOS } from "../../platform";
|
||||
import { Property, CssProperty, CoercibleProperty } from "../core/properties";
|
||||
import { TextTransform } from "../text-base";
|
||||
import { Trace } from "../../trace";
|
||||
|
||||
export const traceCategory = "TabView";
|
||||
|
||||
@@ -208,7 +211,7 @@ export interface TabViewBase {
|
||||
}
|
||||
|
||||
export function traceMissingIcon(icon: string) {
|
||||
traceWrite("Could not load tab bar icon: " + icon, traceCategories.Error, traceMessageType.error);
|
||||
Trace.write("Could not load tab bar icon: " + icon, Trace.categories.Error, Trace.messageType.error);
|
||||
}
|
||||
|
||||
export const selectedIndexProperty = new CoercibleProperty<TabViewBase, number>({
|
||||
|
||||
@@ -4,13 +4,14 @@ import { Font } from "../styling/font";
|
||||
import {
|
||||
TabViewBase, TabViewItemBase, itemsProperty, selectedIndexProperty,
|
||||
tabTextColorProperty, tabBackgroundColorProperty, tabTextFontSizeProperty, selectedTabTextColorProperty,
|
||||
androidSelectedTabHighlightColorProperty, androidOffscreenTabLimitProperty,
|
||||
fontSizeProperty, fontInternalProperty, layout, traceCategory, traceEnabled,
|
||||
traceWrite, Color, traceMissingIcon
|
||||
androidSelectedTabHighlightColorProperty, androidOffscreenTabLimitProperty, traceCategory, traceMissingIcon
|
||||
} from "./tab-view-common";
|
||||
import { textTransformProperty, TextTransform, getTransformedText } from "../text-base";
|
||||
import { ImageSource } from "../../image-source";
|
||||
import { RESOURCE_PREFIX, ad } from "../../utils/utils";
|
||||
import { Trace } from "../../trace";
|
||||
import { Color } from "../../color";
|
||||
import { fontSizeProperty, fontInternalProperty } from "../styling/style-properties";
|
||||
import { RESOURCE_PREFIX, ad, layout } from "../../utils/utils";
|
||||
import { Frame } from "../frame";
|
||||
import * as application from "../../application";
|
||||
|
||||
@@ -375,8 +376,8 @@ export class TabViewItem extends TabViewItemBase {
|
||||
|
||||
// TODO: can happen in a modal tabview scenario when the modal dialog fragment is already removed
|
||||
if (!tabFragment) {
|
||||
if (traceEnabled()) {
|
||||
traceWrite(`Could not get child fragment manager for tab item with index ${this.index}`, traceCategory);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write(`Could not get child fragment manager for tab item with index ${this.index}`, traceCategory);
|
||||
}
|
||||
|
||||
return (<any>tabView)._getRootFragmentManager();
|
||||
@@ -468,8 +469,8 @@ export class TabView extends TabViewBase {
|
||||
|
||||
public createNativeView() {
|
||||
initializeNativeClasses();
|
||||
if (traceEnabled()) {
|
||||
traceWrite("TabView._createUI(" + this + ");", traceCategory);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write("TabView._createUI(" + this + ");", traceCategory);
|
||||
}
|
||||
|
||||
const context: android.content.Context = this._context;
|
||||
@@ -711,8 +712,8 @@ export class TabView extends TabViewBase {
|
||||
[selectedIndexProperty.setNative](value: number) {
|
||||
const smoothScroll = this.androidTabsPosition === "top";
|
||||
|
||||
if (traceEnabled()) {
|
||||
traceWrite("TabView this._viewPager.setCurrentItem(" + value + ", " + smoothScroll + ");", traceCategory);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write("TabView this._viewPager.setCurrentItem(" + value + ", " + smoothScroll + ");", traceCategory);
|
||||
}
|
||||
|
||||
this._viewPager.setCurrentItem(value, smoothScroll);
|
||||
|
||||
10
nativescript-core/ui/tab-view/tab-view.d.ts
vendored
10
nativescript-core/ui/tab-view/tab-view.d.ts
vendored
@@ -1,9 +1,13 @@
|
||||
/**
|
||||
* Contains the TabView class, which represents a standard content component with tabs.
|
||||
* @module "ui/tab-view"
|
||||
*/ /** */
|
||||
*/
|
||||
|
||||
import { View, ViewBase, Property, CssProperty, Style, EventData, Color } from "../core/view";
|
||||
import { View } from "../core/view";
|
||||
import { ViewBase } from "../core/view-base";
|
||||
import { Property, CssProperty } from "../core/properties";
|
||||
import { EventData } from "../../data/observable";
|
||||
import { Color } from "../../color";
|
||||
import { Style } from "../styling/style";
|
||||
import { TextTransform } from "../text-base";
|
||||
/**
|
||||
* Represents a tab view entry.
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
import { TabViewItem as TabViewItemDefinition } from ".";
|
||||
import { Font } from "../styling/font";
|
||||
|
||||
import { ios as iosView, ViewBase } from "../core/view";
|
||||
import { ios as iosView, View } from "../core/view";
|
||||
import { ViewBase } from "../core/view-base";
|
||||
import {
|
||||
TabViewBase, TabViewItemBase, itemsProperty, selectedIndexProperty,
|
||||
tabTextColorProperty, tabTextFontSizeProperty, tabBackgroundColorProperty, selectedTabTextColorProperty, iosIconRenderingModeProperty,
|
||||
View, fontInternalProperty, layout, traceEnabled, traceWrite, traceCategories, Color, traceMissingIcon
|
||||
tabTextColorProperty, tabTextFontSizeProperty, tabBackgroundColorProperty, selectedTabTextColorProperty, iosIconRenderingModeProperty, traceMissingIcon
|
||||
} from "./tab-view-common";
|
||||
import { layout } from '../../utils/utils';
|
||||
import { Color } from "../../color";
|
||||
import { Trace } from "../../trace";
|
||||
import { fontInternalProperty } from "../styling/style-properties";
|
||||
import { textTransformProperty, TextTransform, getTransformedText } from "../text-base";
|
||||
import { ImageSource } from "../../image-source";
|
||||
import { profile } from "../../profiling";
|
||||
@@ -99,8 +103,8 @@ class UITabBarControllerDelegateImpl extends NSObject implements UITabBarControl
|
||||
}
|
||||
|
||||
public tabBarControllerShouldSelectViewController(tabBarController: UITabBarController, viewController: UIViewController): boolean {
|
||||
if (traceEnabled()) {
|
||||
traceWrite("TabView.delegate.SHOULD_select(" + tabBarController + ", " + viewController + ");", traceCategories.Debug);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write("TabView.delegate.SHOULD_select(" + tabBarController + ", " + viewController + ");", Trace.categories.Debug);
|
||||
}
|
||||
|
||||
let owner = this._owner.get();
|
||||
@@ -120,8 +124,8 @@ class UITabBarControllerDelegateImpl extends NSObject implements UITabBarControl
|
||||
}
|
||||
|
||||
public tabBarControllerDidSelectViewController(tabBarController: UITabBarController, viewController: UIViewController): void {
|
||||
if (traceEnabled()) {
|
||||
traceWrite("TabView.delegate.DID_select(" + tabBarController + ", " + viewController + ");", traceCategories.Debug);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write("TabView.delegate.DID_select(" + tabBarController + ", " + viewController + ");", Trace.categories.Debug);
|
||||
}
|
||||
|
||||
const owner = this._owner.get();
|
||||
@@ -146,8 +150,8 @@ class UINavigationControllerDelegateImpl extends NSObject implements UINavigatio
|
||||
}
|
||||
|
||||
navigationControllerWillShowViewControllerAnimated(navigationController: UINavigationController, viewController: UIViewController, animated: boolean): void {
|
||||
if (traceEnabled()) {
|
||||
traceWrite("TabView.moreNavigationController.WILL_show(" + navigationController + ", " + viewController + ", " + animated + ");", traceCategories.Debug);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write("TabView.moreNavigationController.WILL_show(" + navigationController + ", " + viewController + ", " + animated + ");", Trace.categories.Debug);
|
||||
}
|
||||
|
||||
let owner = this._owner.get();
|
||||
@@ -160,8 +164,8 @@ class UINavigationControllerDelegateImpl extends NSObject implements UINavigatio
|
||||
}
|
||||
|
||||
navigationControllerDidShowViewControllerAnimated(navigationController: UINavigationController, viewController: UIViewController, animated: boolean): void {
|
||||
if (traceEnabled()) {
|
||||
traceWrite("TabView.moreNavigationController.DID_show(" + navigationController + ", " + viewController + ", " + animated + ");", traceCategories.Debug);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write("TabView.moreNavigationController.DID_show(" + navigationController + ", " + viewController + ", " + animated + ");", Trace.categories.Debug);
|
||||
}
|
||||
// We don't need Edit button in More screen.
|
||||
navigationController.navigationBar.topItem.rightBarButtonItem = null;
|
||||
@@ -352,22 +356,22 @@ export class TabView extends TabViewBase {
|
||||
|
||||
public _onViewControllerShown(viewController: UIViewController) {
|
||||
// This method could be called with the moreNavigationController or its list controller, so we have to check.
|
||||
if (traceEnabled()) {
|
||||
traceWrite("TabView._onViewControllerShown(" + viewController + ");", traceCategories.Debug);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write("TabView._onViewControllerShown(" + viewController + ");", Trace.categories.Debug);
|
||||
}
|
||||
if (this._ios.viewControllers && this._ios.viewControllers.containsObject(viewController)) {
|
||||
this.selectedIndex = this._ios.viewControllers.indexOfObject(viewController);
|
||||
} else {
|
||||
if (traceEnabled()) {
|
||||
traceWrite("TabView._onViewControllerShown: viewController is not one of our viewControllers", traceCategories.Debug);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write("TabView._onViewControllerShown: viewController is not one of our viewControllers", Trace.categories.Debug);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private _actionBarHiddenByTabView: boolean;
|
||||
public _handleTwoNavigationBars(backToMoreWillBeVisible: boolean) {
|
||||
if (traceEnabled()) {
|
||||
traceWrite(`TabView._handleTwoNavigationBars(backToMoreWillBeVisible: ${backToMoreWillBeVisible})`, traceCategories.Debug);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write(`TabView._handleTwoNavigationBars(backToMoreWillBeVisible: ${backToMoreWillBeVisible})`, Trace.categories.Debug);
|
||||
}
|
||||
|
||||
// The "< Back" and "< More" navigation bars should not be visible simultaneously.
|
||||
@@ -383,8 +387,8 @@ export class TabView extends TabViewBase {
|
||||
page.actionBarHidden = true;
|
||||
page.frame.ios._disableNavBarAnimation = false;
|
||||
this._actionBarHiddenByTabView = true;
|
||||
if (traceEnabled()) {
|
||||
traceWrite(`TabView hid action bar`, traceCategories.Debug);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write(`TabView hid action bar`, Trace.categories.Debug);
|
||||
}
|
||||
|
||||
return;
|
||||
@@ -395,8 +399,8 @@ export class TabView extends TabViewBase {
|
||||
page.actionBarHidden = false;
|
||||
page.frame.ios._disableNavBarAnimation = false;
|
||||
this._actionBarHiddenByTabView = undefined;
|
||||
if (traceEnabled()) {
|
||||
traceWrite(`TabView restored action bar`, traceCategories.Debug);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write(`TabView restored action bar`, Trace.categories.Debug);
|
||||
}
|
||||
|
||||
return;
|
||||
@@ -504,8 +508,8 @@ export class TabView extends TabViewBase {
|
||||
}
|
||||
|
||||
[selectedIndexProperty.setNative](value: number) {
|
||||
if (traceEnabled()) {
|
||||
traceWrite("TabView._onSelectedIndexPropertyChangedSetNativeValue(" + value + ")", traceCategories.Debug);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write("TabView._onSelectedIndexPropertyChangedSetNativeValue(" + value + ")", Trace.categories.Debug);
|
||||
}
|
||||
|
||||
if (value > -1) {
|
||||
|
||||
Reference in New Issue
Block a user