<commit_before>var ldf = Ti.Platform.displayCaps.logicalDensityFactor || 1;
/* Deciding device class */
var maxwidth = Math.max(Ti.Platform.displayCaps.platformHeight / ldf, Ti.Platform.displayCaps.platformWidth / ldf);
const isTablet = Ti.Platform.osname === 'ipad' || (Ti.Platform.osname === 'android' && (maxwidth > 899 )),
    isHandheld = !isTablet;

var Module = function(args) {
	var self = Ti.UI.createView({
	});
	var position = args.navigation.position || 'top',
	    nav = args.navigation,
	    naviwidth = 0,
	    screenwidth = 0;
	var activeTab = nav.activeTab || 0;
	self.add(Ti.UI.createScrollableView({
		top : position == 'top' ? nav.height : undefined,
		bottom : position == 'bottom' ? nav.height : undefined,
		views : args.tabs.map(function(tab) {
			return tab.view;
		}),
		scrollingEnabled : false
	}));
	/*
	now we go separated ways for handheld and tablet 
	*/
	switch (true) {
	case args.tablet || isTablet :
		/* tablet */	
		self.add(Ti.UI.createScrollView({
			top : position == 'top' ? 0 : undefined,
			bottom : position == 'bottom' ? 0 : undefined,
			height : nav.height,
			scrollType : 'horizontal',
			contentWidth : Ti.UI.SIZE,
			backgroundColor : nav.backgroundColor,
		}));
		var handler = Ti.UI.createView({
			width : nav.tabWidth,
			touchEnabled : false,
			left : activeTab * nav.tabWidth,
			backgroundColor : nav.backgroundActiveColor
		});

		args.tabs.forEach(function(tab, ndx) {
			var color = ndx == nav.activeTab ? nav.activeColor : nav.color;
			console.log(color + ' ' + ndx + '   ' + nav.activeTab);
			self.children[0].add(Ti.UI.createLabel({
				width : nav.tabWidth,
				left : nav.tabWidth * ndx,
				textAlign : 'center',
				itemId : ndx,
				color : color,
				zIndex : 99,
				font : {
					fontSize : nav.fontSize,
					fontWeigth : 'bold'
				},
				text : tab.title.toUpperCase()
			}));
			naviwidth += nav.tabWidth;
		});
		self.children[0].add(handler);
		self.children[0].addEventListener('singletap', function(_e) {
			if (_e.source.itemId == undefined)
				return;
			var ndx = _e.source.itemId;
			self.children[0].children[activeTab].color = nav.color;
			self.children[0].children[ndx].color = nav.activeColor;
			handler.animate({
				left : nav.tabWidth * ndx
			}, function() {

			});
			self.children[1].scrollToView(ndx);
			console.log('Info: scrolled to ' + ndx);
			var ldf = Ti.Platform.displayCaps.logicalDensityFactor || 1;
			if (Ti.Platform.displayCaps.platformWidth / ldf < naviwidth) {
				console.log(ndx + '  ' + args.tabs.length);
				switch (true) {
				case (ndx==0) :
					var x = 0;
					break;
				case (ndx==args.tabs.length-1) :
					var x = naviwidth - nav.tabWidth;
					break;
				default:
					var x = nav.tabWidth * ndx - nav.tabWidth / 2;
					break;
				}
			}
			self.children[0].setContentOffset({
				x : x,
				y : 0
			});
			activeTab = ndx;
		});
		break;
	case  args.handheld || isHandheld:
		/* handheld :  burgermneu */
		/* aliase: sliding menu, burger menu, drawer men
		/* we cannot use native Drawer or Burger menus, because dont't use native navigation like actionbar/ nanigationgroup
		 * https://github.com/viezel/NappDrawer
		 */<commit_msg>Rolfs changes + Rainer chenges in tabgroup<commit_after>var ldf = Ti.Platform.displayCaps.logicalDensityFactor || 1;
/* Deciding device class */
var maxwidth = Math.max(Ti.Platform.displayCaps.platformHeight / ldf, Ti.Platform.displayCaps.platformWidth / ldf);
const isTablet = Ti.Platform.osname === 'ipad' || (Ti.Platform.osname === 'android' && (maxwidth > 899 )),
    isHandheld = !isTablet;

var Module = function(args) {
	var self = Ti.UI.createView({
	});
	var position = args.navigation.position || 'top',
	    nav = args.navigation,
	    naviwidth = 0,
	    screenwidth = 0;

	var activeTab = nav.activeTab || 0;
	self.add(Ti.UI.createScrollableView({
		top : position == 'top' ? nav.height : undefined,
		bottom : position == 'bottom' ? nav.height : undefined,
		views : args.tabs.map(function(tab) {
			return tab.view;
		}),
		scrollingEnabled : false
	}));
	/*
	 now we go separated ways for handheld and tablet
	 */
	switch (true) {
	case args.tablet || isTablet :
		self.add(Ti.UI.createScrollView({
			top : position == 'top' ? 0 : undefined,
			bottom : position == 'bottom' ? 0 : undefined,
			height : nav.height,
			scrollType : 'horizontal',
			contentWidth : Ti.UI.SIZE,
			backgroundColor : nav.backgroundColor,
		}));
		var handler = Ti.UI.createView({
			width : nav.tabWidth,
			touchEnabled : false,
			left : activeTab * nav.tabWidth,
			backgroundColor : nav.backgroundActiveColor
		});

		args.tabs.forEach(function(tab, ndx) {
			var color = ndx == nav.activeTab ? nav.activeColor : nav.color;
			var fontFamily = ndx == nav.activeTab ? nav.fontFamilyActive : nav.fontFamily;
			console.log(color + ' ' + ndx + '   ' + nav.activeTab);
			var navLabel = Ti.UI.createLabel({
				width : nav.tabWidth,
				height : Ti.UI.FILL,
				left : nav.tabWidth * ndx,
				textAlign : 'center',
				itemId : ndx,
				color : color,
				zIndex : 99,
				font : {
					fontFamily : fontFamily,
					fontSize : nav.fontSize,
				},
				text : tab.title.toUpperCase(),
			});
			if (ndx != 0) {
				navLabel.add(Ti.UI.createView({
					width : '1px',
					height : Ti.UI.FILL,
					left : 0,
					backgroundColor : nav.backgroundActiveColor,
				}));
			}
			self.children[0].add(navLabel);
			naviwidth += nav.tabWidth;
		});
		self.children[0].add(handler);
		self.children[0].addEventListener('singletap', function(_e) {
			if (_e.source.itemId == undefined)
				return;
			var ndx = _e.source.itemId;
			self.children[0].children[activeTab].color = nav.color;
			self.children[0].children[activeTab].setFont({
				fontFamily : nav.fontFamily
			});
			self.children[0].children[ndx].color = nav.activeColor;
			self.children[0].children[ndx].setFont({
				fontFamily : nav.fontFamilyActive
			});
			handler.animate({
				left : nav.tabWidth * ndx,
				//duration : 500
			}, function() {

			});
			self.children[1].scrollToView(ndx);
			console.log('Info: scrolled to ' + ndx);
			var ldf = Ti.Platform.displayCaps.logicalDensityFactor || 1;
			if (Ti.Platform.displayCaps.platformWidth / ldf < naviwidth) {
				console.log(ndx + '  ' + args.tabs.length);
				switch (true) {
				case (ndx==0) :
					var x = 0;
					break;
				case (ndx==args.tabs.length-1) :
					var x = naviwidth - nav.tabWidth;
					break;
				default:
					var x = nav.tabWidth * ndx - nav.tabWidth / 2;
					break;
				}
			}
			console.log(x);
			self.children[0].setContentOffset({
				x : x,
				y : 0
			});
			activeTab = ndx;
		});
		break;
	case args.handheld || isHandheld :
{'fraction_non_alphanumeric': 0.14885611077664057, 'fraction_numerical': 0.008428657435279952, 'mean_word_length': 2.993389423076923, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7124493', 'n_tokens_mistral': 2745, 'n_tokens_neox': 2279, 'n_words': 479}