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

[TIMOB-26354] Android: Refactor TabGroup and introduce new style #10358

Merged
merged 40 commits into from Dec 11, 2018
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
fcbeed2
Refactoring of TabGroup - getting rid of the deprecated ActionBar Tab…
ypbnv Sep 7, 2018
e0b9eae
Merge branch 'master' into TIMOB-26354
ypbnv Oct 3, 2018
386d0a1
Rename TiUIAbstractTab to not be Abstract anymore (it is not now).
ypbnv Oct 3, 2018
13596c9
Expose the shiftMode property.
ypbnv Oct 3, 2018
aabf34d
Merge branch 'master' into TIMOB-26354
ypbnv Oct 4, 2018
818984a
Docs - extend Ti.UI.Window instead of Ti.UI.View.
ypbnv Oct 4, 2018
39ae5c7
Merge branch 'master' into TIMOB-26354
ypbnv Oct 10, 2018
5816a44
Fix animation for opening TabGroup. Now works the same way as Window.
ypbnv Oct 11, 2018
72ac857
Remove some unused code.
ypbnv Oct 12, 2018
e137a79
Fix formatting for controllers.
ypbnv Oct 12, 2018
71d38c8
Merge branch 'master' into TIMOB-26354
ypbnv Oct 15, 2018
fec576d
Merge branch 'master' into TIMOB-26354
ypbnv Oct 16, 2018
5a8c5fc
Add constants for styles in Ti.UI.Android.
ypbnv Oct 17, 2018
e3c086f
Merge branch 'master' into TIMOB-26354
ypbnv Oct 17, 2018
5ab9060
Merge branch 'master' into TIMOB-26354
ssjsamir Oct 18, 2018
228d1f7
Remove unnecessary field. The value is the same as the default for th…
ypbnv Oct 19, 2018
74d3eb3
Merge branch 'master' into TIMOB-26354
lokeshchdhry Oct 19, 2018
5ee6b5f
Mimic the auto selection of the first tab added in TabLayou in Bottom…
ypbnv Oct 22, 2018
fcb1538
Merge branch 'master' into TIMOB-26354
lokeshchdhry Oct 22, 2018
f45bf77
Remove the null set of the tabs field.
ypbnv Oct 24, 2018
58c51c3
Merge branch 'master' into TIMOB-26354
ypbnv Oct 25, 2018
8abad8e
Allow overriding of the tabs max width property for bottom navigation…
ypbnv Oct 25, 2018
f190724
Merge branch 'master' into TIMOB-26354
ssjsamir Oct 25, 2018
9519b7e
Revert "Allow overriding of the tabs max width property for bottom na…
ypbnv Oct 26, 2018
7e36012
Replace property backgroundColor with tabsBackgroundColor.
ypbnv Oct 26, 2018
74c183f
Merge branch 'master' into TIMOB-26354
ypbnv Oct 26, 2018
9019c50
Clean up imports.
ypbnv Oct 26, 2018
b61166e
Merge branch 'master' into TIMOB-26354
jquick-axway Oct 27, 2018
ac75566
Merge branch 'master' into TIMOB-26354
sgtcoolguy Oct 30, 2018
4d903cd
Merge branch 'master' into TIMOB-26354
sgtcoolguy Oct 30, 2018
2ec2073
Fix icon loading for TiUITabLayoutTabGroup.
ypbnv Nov 1, 2018
05e8468
Merge branch 'master' into TIMOB-26354
ypbnv Nov 6, 2018
43b4ae8
Merge branch 'master' into TIMOB-26354
lokeshchdhry Nov 20, 2018
3951ed4
Merge branch 'master' into TIMOB-26354
lokeshchdhry Nov 29, 2018
188a980
Fix definition.
ypbnv Dec 5, 2018
6da4535
Fix indentation.
ypbnv Dec 5, 2018
96387d3
Merge branch 'master' into TIMOB-26354
ypbnv Dec 5, 2018
98d3b9e
Keep linting.
ypbnv Dec 5, 2018
43c40fb
Merge branch 'master' into TIMOB-26354
lokeshchdhry Dec 6, 2018
bfc6be2
Merge branch 'master' into TIMOB-26354
ssjsamir Dec 11, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 0 additions & 22 deletions android/modules/ui/res/layout/titanium_tabgroup.xml

This file was deleted.

Expand Up @@ -3,11 +3,11 @@
import org.appcelerator.kroll.annotations.Kroll;
import org.appcelerator.titanium.proxy.ActivityProxy;

import ti.modules.titanium.ui.widget.tabgroup.TiUIAbstractTab;
import ti.modules.titanium.ui.widget.tabgroup.TiUITab;

/**
* A special view for the content of a tab.
* @see {@link TiUIAbstractTab#getContentView()}
* @see {@link TiUITab#getContentView()}
*/
@Kroll.proxy(parentModule = UIModule.class)
public class TabContentViewProxy extends ViewProxy
Expand Down
Expand Up @@ -26,7 +26,9 @@
import org.appcelerator.titanium.util.TiUIHelper;

import ti.modules.titanium.ui.widget.tabgroup.TiUIAbstractTabGroup;
import ti.modules.titanium.ui.widget.tabgroup.TiUIActionBarTabGroup;
import ti.modules.titanium.ui.widget.tabgroup.TiUIBottomNavigationTabGroup;
import ti.modules.titanium.ui.widget.tabgroup.TiUITabLayoutTabGroup;

import android.app.Activity;
import android.content.Intent;
import android.os.Message;
Expand Down Expand Up @@ -150,7 +152,7 @@ public void disableTabNavigation(boolean disable)

private void handleDisableTabNavigation(boolean disable)
{
TiUIActionBarTabGroup tabGroup = (TiUIActionBarTabGroup) view;
TiUIAbstractTabGroup tabGroup = (TiUIAbstractTabGroup) view;
if (tabGroup != null) {
tabGroup.disableTabNavigation(disable);
}
Expand Down Expand Up @@ -204,12 +206,18 @@ public void removeTab(TabProxy tab)

public void handleRemoveTab(TabProxy tab)
{
int indexToRemove = tabs.indexOf(tab);
// Guard for trying to remove a Tab that has not been added.
if (indexToRemove < 0) {
return;
}
tabs.remove(tab);

TiUIAbstractTabGroup tabGroup = (TiUIAbstractTabGroup) view;
if (tabGroup != null) {
tabGroup.removeTab(tab);
tabGroup.removeTabAt(indexToRemove);
}

tabs.remove(tab);
}

@Kroll.method
Expand Down Expand Up @@ -375,11 +383,10 @@ public void windowCreated(TiBaseActivity activity, Bundle savedInstanceState)
activity.setLayoutProxy(this);
setActivity(activity);

if (activity.getSupportActionBar() != null) {
view = new TiUIActionBarTabGroup(this, activity, savedInstanceState);
if (getProperty(TiC.PROPERTY_STYLE) == null || getProperty(TiC.PROPERTY_STYLE).toString().equals("default")) {
view = new TiUITabLayoutTabGroup(this, activity, savedInstanceState);
} else {
Log.e(TAG, "ActionBar not available for TabGroup");
return;
view = new TiUIBottomNavigationTabGroup(this, activity, savedInstanceState);
}

setModelListener(view);
Expand Down
Expand Up @@ -16,7 +16,7 @@
import org.appcelerator.titanium.util.TiUIHelper;
import org.appcelerator.titanium.view.TiUIView;

import ti.modules.titanium.ui.widget.tabgroup.TiUIAbstractTab;
import ti.modules.titanium.ui.widget.tabgroup.TiUITab;
import android.app.Activity;
// clang-format off
@Kroll.proxy(creatableInModule = UIModule.class,
Expand Down Expand Up @@ -255,7 +255,7 @@ void onSelectionChanged(boolean selected)
}
}

((TiUIAbstractTab) view).onSelectionChange(selected);
((TiUITab) view).onSelectionChange(selected);
}

@Override
Expand Down