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

refactor(android): use material widgets/styles and default to DayNight theme #12353

Merged
merged 40 commits into from
Mar 5, 2021

Conversation

@build
Copy link
Contributor

build commented Dec 19, 2020

Fails
🚫 Tests have failed, see below for more information.
🚫

Test suite crashed on iOS simulator. Please see the crash log for more details.

Warnings
⚠️

Commit dc20e5d5d8af2da2ee5ce39e6cd11e8dcd9fe986 has a message "doc(ios): deprecate Ti.UI.iOS.SystemButtonStyle" giving 1 errors:

  • type must be one of [build, chore, ci, docs, feat, fix, perf, refactor, revert, style, test]
⚠️

Commit 35cf5618c9eba3da85c75b2aaf9631e906bbe478 has a message "feat(macOS): add checkbox style to Ti.UI.Switch

Fixes TIMOB-28302" giving 1 errors:

  • scope must be lower-case
⚠️ This PR has milestone set to 10.0.0, but the version defined in package.json is 10.1.0 Please either: - Update the milestone on the PR - Update the version in package.json - Hold the PR to be merged later after a release and version bump on this branch
Messages
📖

🚨 This PR has one or more commits with warnings/errors for commit messages not matching our configuration. You may want to squash merge this PR and edit the message to match our conventions, or ask the original developer to modify their history.

📖 ❌ 7 tests have failed There are 7 tests failing and 511 skipped out of 8223 total tests.

Tests:

ClassnameNameTimeError
android.emulator.Titanium.UI.NavigationWindowbasic open/close navigation (5.0.2)10.007
Error: Timeout of 10000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (app.js)
android.emulator.Titanium.UI.Windowwindow_navigation (5.0.2)30.028
Error: Timeout of 30000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (app.js)
android.emulator.Titanium.UI.TextArea.properties.focused (5.0.2)5.51
Error: Timeout of 5000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (app.js)
android.emulator.Titanium.UI.TextField.properties.focused (5.0.2)2.007
Error: Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (app.js)
android.emulator.Titanium.UI.View"after all" hook for "rgba fallback" (5.0.2)23.237
Error: Timeout of 10000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (app.js)
android.emulator.Titanium.UI.View"after each" hook for "getOrCreateView() should always return a View" (5.0.2)13.21
Error: Timeout of 10000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (app.js)
ios.macos.Titanium.Blobimage dimensions should be reported in pixels (10.15.7)0.063
Error: expected 6 to be 11
value@file:///node_modules/should/cjs/should.js:356:23
postlayout@file:///ti.blob.test.js:488:33

Generated by 🚫 dangerJS against ba83d74

@hansemannn
Copy link
Collaborator

hansemannn commented Feb 17, 2021

Feedback (to be continued):

  • General usability: GREAT! Really really impressed!
  • Text fields: Now always show a bottom line that indicates the active state. We'd like to be able to disable that if possible (probably easily possible via xml theme config)
  • Buttons: Have some kind of elevation now by default. This can likely be controlled via new properties that we need to look up
  • Alerts:
    • Alerts with 3+ buttons seem to have the wrong color applied, making them extremely hard to view
    • All buttons are upper case by default and the good-old trick to override them in the theme (allCaps: false) does not work anymore either
  • A warning log (multiple times): MaterialButton: MaterialButton manages its own background to control elevation, shape, color and states. Consider using backgroundTint, shapeAppearance and other attributes where available. A custom background will ignore these attributes and you should consider handling interaction states such as pressed, focused and disabled
  • An error log: ThemeUtils: View class com.google.maps.android.ui.SquareTextView is an AppCompat widget that can only be used with a Theme.AppCompat theme (or descendant). (fixed via ti.map)
  • V8 typing bugs (not related to this PR, but a general SDK 10 thing I assume). Caused by lossy arguments (5 vs 5 on a Number field), fixable by ourselves

Thats really it. Working very smoothly!

Update: All resolved! 🎉

@jquick-axway
Copy link
Contributor Author

jquick-axway commented Feb 17, 2021

Hey @hansemannn. Thanks for giving this a go. Here's my feedback...

Text fields: Now always show a bottom line that indicates the active state.

This PR defaults the TextField/TextArea "borderStyle" to INPUT_BORDERSTYLE_FILLED, which has a gray background and an underline as can be seen in the link below. This is actually Google's default style for this material widget. Changing the underline behavior is probably best done via a style/theme.
https://material.io/components/text-fields

Side Note: I'm thinking about changing the default border style to INPUT_BORDERSTYLE_ROUNDED since that's what Google uses in all of their Android apps.

Buttons: Have some kind of elevation now by default.

Our old buttons have elevation by default too. That's how the button shadow is drawn. But perhaps you're running into the issue below

Alerts with 3+ buttons seem to have the wrong color applied, making them extremely hard to view

If your custom theme derives from a material "Bridge" theme, then material widgets such as "MaterialButton" will be rendered wrong (see link below). But if you change your parent theme to a non-bridge theme such as "Theme.MaterialComponents", "Theme.MaterialComponents.Light", "Theme.MaterialComponents.DayNight", etc. then the buttons will be rendered correctly.
material-components/material-components-android#1234

I know I was telling people to switch over to the material bridge theme in 9.3.0. I'm kind of bummed that the bridge theme has issues with some material widgets like this. But since this PR switches everything over to use material widgets, we don't need the bridge theme for backward compatibility anymore.

All buttons are upper case by default and the good-old trick to override them in the theme (allCaps: false) does not work anymore either.

You need to override the TextAppearance.MaterialComponents.Button style in your custom theme as shown below.

<!-- Override material button style -->
<style name="TextAppearance.MyTheme.Button" parent="TextAppearance.MaterialComponents.Button">
	<item name="android:textAllCaps">false</item>
</style>

<!-- Override old system button style. You should still do this. -->
<style name="Widget.MyTheme.Button" parent="Widget.AppCompat.Button">
	<item name="android:textAllCaps">false</item>
</style>

<!-- Apply above to your app/activity theme. -->
<style name="MyTheme" parent="Theme.MaterialComponents">
	<item name="textAppearanceButton">@style/TextAppearance.MyTheme.Button</item>
	<item name="android:buttonStyle">@style/Widget.MyTheme.Button</item>
	<item name="buttonStyle">@style/Widget.MyTheme.Button</item>
</style>

Note that I've changed Titanium's default theme to not make button text all caps either as can be seen in our values.xml. You can see proof of this working in our material date picker screenshot here.

warning log (multiple times)

I'm aware of the warnings. I haven't addressed this yet. (And yes they're annoying.)

V8 typing bugs

Did this break recently? Do you think it was caused by PR #12449?

} else {
// await exec(`adb -e shell "run-as ${APP_ID} cat '${filepath}'" > ${dest}`);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • ⚠️ build/lib/test/test.js line 885 – Missing JSDoc parameter description for 'testResults'. (valid-jsdoc)

} else {
// await exec(`adb -e shell "run-as ${APP_ID} cat '${filepath}'" > ${dest}`);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • ⚠️ build/lib/test/test.js line 488 – 'stripped' is defined but never used. Allowed unused args must match /^_.+/u. (no-unused-vars)

@garymathews
Copy link
Contributor

It would be nice to have a Ti.App API to control DayNight mode from within the app. Possibly using setDefaultNightMode() on Android and overrideUserInterfaceStyle on iOS

@garymathews garymathews added the backport 10_2_X when applied, PRs with this label will get an auto-generated backport to 10_2_X branch on merge label Feb 25, 2021
Copy link
Contributor

@garymathews garymathews left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CR: PASS - Unless more additions are added that need reviewing.

TEST CASE
SHOW

const win = Ti.UI.createWindow();
const table = Ti.UI.createTableView();

function section_dayNight() {
    const row = Ti.UI.createTableViewRow();
    const section = Ti.UI.createTableViewSection();
    const view = Ti.UI.createView({
        layout: 'horizontal',
        width: Ti.UI.SIZE,
        height: Ti.UI.SIZE
    });
    const center = Ti.UI.createView({
        height: 60
    });
    const label = Ti.UI.createLabel({
        text: 'Toggle dark theme: '
    });
    const toggle = Ti.UI.createSwitch({
        value: false
    });

    toggle.addEventListener('change', e => {
        if (Ti.UI.overrideUserInterfaceStyle != Ti.UI.USER_INTERFACE_STYLE_DARK) {
            Ti.UI.overrideUserInterfaceStyle = Ti.UI.USER_INTERFACE_STYLE_DARK;
        } else {
            Ti.UI.overrideUserInterfaceStyle = Ti.UI.USER_INTERFACE_STYLE_UNSPECIFIED;
        }
    });

    view.add([label, toggle]);
    center.add(view);
    row.add(center);
    section.add(row);

    return section;
}

function section_buttons() {
    const title = Ti.UI.createLabel({
        text: 'Button',
        left: 10,
        font: {
            fontSize: 26
        }
    });
    const row = Ti.UI.createTableViewRow();
    const section = Ti.UI.createTableViewSection({
        headerView: title
    });
    const view = Ti.UI.createView({
        layout: 'vertical',
        width: Ti.UI.SIZE,
        height: Ti.UI.SIZE,
        bottom: 10
    });

    view.add([
        Ti.UI.createButton({
            top: 10,
            title: 'BUTTON_STYLE_OPTION_POSITIVE',
            style: Ti.UI.BUTTON_STYLE_OPTION_POSITIVE
        }),
        Ti.UI.createButton({
            top: 5,
            title: 'BUTTON_STYLE_OPTION_NEGATIVE',
            style: Ti.UI.BUTTON_STYLE_OPTION_NEGATIVE
        }),
        Ti.UI.createButton({
            top: 5,
            title: 'BUTTON_STYLE_OPTION_NEUTRAL',
            style: Ti.UI.BUTTON_STYLE_OPTION_NEUTRAL
        }),
        Ti.UI.createButton({
            top: 5,
            title: 'BUTTON_STYLE_OUTLINED',
            style: Ti.UI.BUTTON_STYLE_OUTLINED
        }),
        Ti.UI.createButton({
            top: 5,
            title: 'BUTTON_STYLE_TEXT',
            style: Ti.UI.BUTTON_STYLE_TEXT
        }),
        Ti.UI.createButton({
            top: 5,
            title: 'BUTTON_STYLE_FILLED',
            style: Ti.UI.BUTTON_STYLE_FILLED
        })
    ]);

    row.add(view);
    section.add(row);

    return section;
}

function section_textFields() {
    const title = Ti.UI.createLabel({
        text: 'TextField',
        left: 10,
        font: {
            fontSize: 26
        }
    });
    const row = Ti.UI.createTableViewRow();
    const section = Ti.UI.createTableViewSection({
        headerView: title
    });
    const view = Ti.UI.createView({
        layout: 'vertical',
        width: Ti.UI.SIZE,
        height: Ti.UI.SIZE,
        bottom: 10
    });

    view.add([
        Ti.UI.createTextField({
            top: 10,
            left: 10,
            right: 10,
            hintText: 'INPUT_BORDERSTYLE_FILLED',
            borderStyle: Ti.UI.INPUT_BORDERSTYLE_FILLED
        }),
        Ti.UI.createTextField({
            top: 10,
            left: 10,
            right: 10,
            hintText: 'INPUT_BORDERSTYLE_BEZEL',
            borderStyle: Ti.UI.INPUT_BORDERSTYLE_BEZEL
        }),
        Ti.UI.createTextField({
            top: 10,
            left: 10,
            right: 10,
            hintText: 'INPUT_BORDERSTYLE_LINE',
            borderStyle: Ti.UI.INPUT_BORDERSTYLE_LINE
        }),
        Ti.UI.createTextField({
            top: 10,
            left: 10,
            right: 10,
            hintText: 'INPUT_BORDERSTYLE_ROUNDED',
            borderStyle: Ti.UI.INPUT_BORDERSTYLE_ROUNDED
        }),
        Ti.UI.createTextField({
            top: 10,
            left: 10,
            right: 10,
            hintText: 'INPUT_BORDERSTYLE_NONE',
            borderStyle: Ti.UI.INPUT_BORDERSTYLE_NONE
        }),
        Ti.UI.createTextField({
            top: 10,
            left: 10,
            right: 10,
            hintText: 'INPUT_BORDERSTYLE_UNDERLINED',
            borderStyle: Ti.UI.INPUT_BORDERSTYLE_UNDERLINED
        })
    ]);

    row.add(view);
    section.add(row);

    return section;
}

function section_switch() {
    const title = Ti.UI.createLabel({
        text: 'Switch',
        left: 10,
        font: {
            fontSize: 26
        }
    });
    const row = Ti.UI.createTableViewRow();
    const section = Ti.UI.createTableViewSection({
        headerView: title
    });
    const view = Ti.UI.createView({
        layout: 'vertical',
        width: Ti.UI.SIZE,
        height: Ti.UI.SIZE,
        bottom: 10
    });

    view.add([
        Ti.UI.createSwitch({
            style: Ti.UI.SWITCH_STYLE_CHECKBOX,
            title: 'SWITCH_STYLE_CHECKBOX',
            top: 10
        }),
        Ti.UI.createSwitch({
            style: Ti.UI.SWITCH_STYLE_SLIDER,
            title: 'SWITCH_STYLE_SLIDER',
            top: 10
        }),
        Ti.UI.createSwitch({
            style: Ti.UI.SWITCH_STYLE_TOGGLE_BUTTON,
            title: 'SWITCH_STYLE_TOGGLE_BUTTON',
            top: 10
        }),
        Ti.UI.createSwitch({
            style: Ti.UI.SWITCH_STYLE_CHIP,
            title: 'SWITCH_STYLE_CHIP',
            top: 10
        })
    ]);

    row.add(view);
    section.add(row);

    return section;
}

function section_alert() {
    const title = Ti.UI.createLabel({
        text: 'Dialog',
        left: 10,
        font: {
            fontSize: 26
        }
    });
    const row = Ti.UI.createTableViewRow();
    const section = Ti.UI.createTableViewSection({
        headerView: title
    });
    const view = Ti.UI.createView({
        layout: 'vertical',
        width: Ti.UI.SIZE,
        height: Ti.UI.SIZE,
        bottom: 10
    });
    const button_alert = Ti.UI.createButton({
        top: 10,
        title: 'alert()'
    });
    const button_alertDialog = Ti.UI.createButton({
        top: 10,
        title: 'Ti.UI.AlertDialog'
    });
    const button_optionDialog = Ti.UI.createButton({
        top: 10,
        title: 'Ti.UI.OptionDialog'
    });

    button_alert.addEventListener('click', e => {
        alert('This is an alert.');
    });

    button_alertDialog.addEventListener('click', e => {
        Ti.UI.createAlertDialog({
            cancel: 1,
            buttonNames: ['Okay', 'Cancel'],
            message: 'This is an Ti.UI.AlertDialog.',
            title: 'Ti.UI.AlertDialog'
        }).show();
    });

    button_optionDialog.addEventListener('click', e => {
        Ti.UI.createOptionDialog({
            cancel: 1,
            options: ['Okay', 'Cancel'],
            selectedIndex: 0,
            destructive: 1,
            title: 'Ti.UI.OptionDialog'
        }).show();
    });

    view.add([
        button_alert,
        button_alertDialog,
        button_optionDialog
    ]);

    row.add(view);
    section.add(row);

    return section;
}

function section_cardView() {
    const title = Ti.UI.createLabel({
        text: 'CardView',
        left: 10,
        font: {
            fontSize: 26
        }
    });
    const row = Ti.UI.createTableViewRow();
    const section = Ti.UI.createTableViewSection({
        headerView: title
    });
    const view = Ti.UI.createView({
        layout: 'vertical',
        width: Ti.UI.SIZE,
        height: Ti.UI.SIZE,
        bottom: 10
    });

    if (Ti.Platform.osname === 'android') {
        const card = Ti.UI.Android.createCardView({
            layout: 'vertical',
            padding: 16,
            top: 10,
            left: 10,
            right: 10,
        });
        card.add(Ti.UI.createLabel({
            text: 'This is a Ti.UI.Android.CardView',
            maxLines: 1,
            width: Ti.UI.FILL
        }));

        view.add([card]);
    }

    row.add(view);
    section.add(row);

    return section;
}

function section_activityIndicator() {
    const title = Ti.UI.createLabel({
        text: 'ActivityIndicator',
        left: 10,
        font: {
            fontSize: 26
        }
    });
    const row = Ti.UI.createTableViewRow();
    const section = Ti.UI.createTableViewSection({
        headerView: title
    });
    const view = Ti.UI.createView({
        layout: 'vertical',
        width: Ti.UI.SIZE,
        height: Ti.UI.SIZE,
        bottom: 10
    });

    function createIndicator(message, style) {
        const indicator = Ti.UI.createActivityIndicator({
            message: message,
            style: style,
            top: 10
        });

        indicator.show();
        return indicator;
    }

    view.add([
        createIndicator('PLAIN', Ti.UI.ActivityIndicatorStyle.PLAIN),
        createIndicator('BIG', Ti.UI.ActivityIndicatorStyle.BIG),
        createIndicator('DARK', Ti.UI.ActivityIndicatorStyle.DARK),
        createIndicator('BIG_DARK', Ti.UI.ActivityIndicatorStyle.BIG_DARK),
    ]);

    row.add(view);
    section.add(row);

    return section;
}

function section_progressBar() {
    const title = Ti.UI.createLabel({
        text: 'ProgressBar',
        left: 10,
        font: {
            fontSize: 26
        }
    });
    const row = Ti.UI.createTableViewRow();
    const section = Ti.UI.createTableViewSection({
        headerView: title
    });
    const view = Ti.UI.createView({
        layout: 'vertical',
        width: Ti.UI.SIZE,
        height: Ti.UI.SIZE,
        bottom: 10
    });
    const progressBar = Ti.UI.createProgressBar({
        top: 10,
        min: 0,
        max: 100,
        width: '80%',
        animated: false
    });
    const progressBar_animated = Ti.UI.createProgressBar({
        top: 10,
        min: 0,
        max: 100,
        width: '80%'
    });

    setInterval(_ => {
        if (progressBar.value < progressBar.max) {
            progressBar.value++;
            progressBar.message = `${progressBar.value}%`;
        } else {
            progressBar.value = 0;
        }
        if (progressBar_animated.value < progressBar_animated.max) {
            progressBar_animated.value++;
            progressBar_animated.message = `${progressBar_animated.value}% (animated: true)`;
        } else {
            progressBar_animated.value = 0;
        }
    }, 50);

    view.add([
        progressBar,
        progressBar_animated
    ]);

    row.add(view);
    section.add(row);

    return section;
}

function section_picker() {
    const title = Ti.UI.createLabel({
        text: 'Picker',
        left: 10,
        font: {
            fontSize: 26
        }
    });
    const row = Ti.UI.createTableViewRow();
    const section = Ti.UI.createTableViewSection({
        headerView: title
    });
    const view = Ti.UI.createView({
        layout: 'vertical',
        width: Ti.UI.SIZE,
        height: Ti.UI.SIZE,
        bottom: 10
    });
    const button_date = Ti.UI.createButton({
        top: 10,
        title: 'Date'
    });
    const button_time = Ti.UI.createButton({
        top: 10,
        title: 'Time'
    });


    button_date.addEventListener('click', e => {
        const picker = Ti.UI.createPicker({
            type: Ti.UI.PICKER_TYPE_DATE,
            minDate: new Date(2020, 8, 10),
            maxDate: new Date(2021, 1, 24),
            value: new Date(2021, 0, 1)
        });
        picker.showDatePickerDialog({
            title: 'Date Picker'
        });
    });

    button_time.addEventListener('click', e => {
        const picker = Ti.UI.createPicker({
            type: Ti.UI.PICKER_TYPE_TIME,
            value: new Date(2021, 0, 1, 12)
        });
        picker.showTimePickerDialog({
            title: 'Time Picker'
        });
    });

    view.add([
        button_date,
        button_time
    ]);

    row.add(view);
    section.add(row);

    return section;
}

table.data = [
    section_dayNight(),
    section_buttons(),
    section_textFields(),
    section_alert(),
    section_cardView(),
    section_switch(),
    section_activityIndicator(),
    section_progressBar(),
    section_picker()
];

win.add(table);
win.open();

@hansemannn
Copy link
Collaborator

hansemannn commented Feb 26, 2021

@jquick-axway The following two bugs (only tracked internally until now) are remaining:

  • The button textAllCaps: false override does not work anymore and has to be adjusted in the theme. The hint from you unfortunately also didn't work and the button is still upper-case
  • Text fields with click containers (editable: false) still react to the click now, causing the user to tap twice to trigger the actual click container event (to be seen in the create-trip view for the travel date)

@jquick-axway
Copy link
Contributor Author

@hansemannn, regarding your textAllCaps issue, I doubt that's an issue on the Titanium side. When you use this PR's new Titanium themes (used by default), it proves that all buttons (including dialog buttons) are not all-caps. Even my kitchensink-v2 PR shows this (see: tidev/kitchensink-v2#56). I recommend that you change your custom theme's parent to Theme.Titanium.Light under "values" and Theme.Titanium.Dark under "values-night" in your project like how I did it in kitchensink-v2. Our themes already set textAllCaps to false. Also, our themes work-around a landscape ActionBar sizing bug on Google's end as can be seen in the link below.
material-components/material-components-android#779

Regarding your TextField click issue, that's always been the behavior. Even in 9.x.x. If the TextField does not have "focus", then the first tap will be stolen natively by Google to give it the focus. That is, you'll only receive click events from a TextField that has focus. But that said, it's an easy change on our end. I just updated this PR to do it.

@sgtcoolguy
Copy link
Contributor

To be able to merge this without squashing it down to one commit, I had to locally rebase and force push. Local testing indicates it passes all tests still - but I wanted to retain the tracking of this PR and the separate commits (hence why I didn't manually merge or open separate PR).

@sgtcoolguy sgtcoolguy merged commit 4ec4077 into tidev:master Mar 5, 2021
@build build removed the backport 10_2_X when applied, PRs with this label will get an auto-generated backport to 10_2_X branch on merge label Mar 5, 2021
Comment on lines +147 to +175
// Update indicator to use a big or small style.
int[] idArray = new int[] {
R.attr.trackThickness,
R.attr.indicatorSize,
R.attr.indicatorInset
};
int themeId = R.style.Widget_MaterialComponents_CircularProgressIndicator_ExtraSmall;
if ((styleId == BIG) || (styleId == BIG_DARK)) {
themeId = R.style.Widget_MaterialComponents_CircularProgressIndicator_Medium;
}
ContextThemeWrapper context = new ContextThemeWrapper(this.progress.getContext(), themeId);
TypedArray typedArray = context.obtainStyledAttributes(null, idArray, 0, 0);
int value = typedArray.getDimensionPixelSize(0, this.progress.getTrackThickness());
this.progress.setTrackThickness(typedArray.getDimensionPixelSize(0, this.progress.getTrackThickness()));
this.progress.setIndicatorSize(typedArray.getDimensionPixelSize(1, this.progress.getIndicatorSize()));
this.progress.setIndicatorInset(typedArray.getDimensionPixelSize(2, this.progress.getIndicatorInset()));
typedArray.recycle();

// Update indicator's color.
if (this.proxy.hasPropertyAndNotNull(TiC.PROPERTY_INDICATOR_COLOR)) {
int color = TiConvert.toColor(TiConvert.toString(this.proxy.getProperty(TiC.PROPERTY_INDICATOR_COLOR)));
this.progress.getIndeterminateDrawable().setColorFilter(
new PorterDuffColorFilter(color, PorterDuff.Mode.SRC_IN));
} else if ((styleId == DARK) || (styleId == BIG_DARK)) {
this.progress.getIndeterminateDrawable().setColorFilter(
new PorterDuffColorFilter(Color.DKGRAY, PorterDuff.Mode.SRC_IN));
} else {
this.progress.getIndeterminateDrawable().clearColorFilter();
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jquick-axway This is causing sizing issues in the current master/10_0_X branch. We used to do:

Ti.UI.createActivityIndicator(Object.assign({
    width: 80,
    height: 80,
    style: Ti.UI.ActivityIndicatorStyle.BIG,
    indicatorColor: 'textColor'
}, opts));

which used to resize the indicator properly but doesn't anymore

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The activity indicator was never resizable. Not in the old Android version. Nor on iOS. So, setting the width/height properties doesn't buy you anything.

That said, the "material" version of Ti.UI.ActivityIndicatorStyle.BIG is smaller than the old "holo" version. The R.style.Widget_MaterialComponents_CircularProgressIndicator_Medium style is the biggest version available to us.

My advise is to get rid of the "width" and "height" properties.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, I take it back. The old Android activity indicator supports scaling "down", but not scaling "up".
(iOS' activity indicator does not support scaling up or down at all.)

I can look into this, but I don't think the material version of this widget supports this at all without some customization. My advice is to stick to the native size and remove the width/height still.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants