Coder Social home page Coder Social logo

rborn / actionbarextras Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ricardoalcocer/actionbarextras

0.0 2.0 0.0 9.18 MB

Titanium Android Native Module that exposes the Title and Subtitle properties of the ActionBar

License: MIT License

actionbarextras's Introduction

ActionBarExtras

This module provides some extra functionality to configure the ActionBar that Titanium doesn't offer. It lets you set a subtitle to the ActionBar title, it forces to show the Overflow menu button on devices with hardware menu buttons and gives you the opportunity to change the ActionBar font (of both, title and subtitle or separately).

example

Features

  • Title and Subtitle
  • Sharing Action Provider
  • force overflow
  • backgroundColor
  • custom fonts
  • font color
  • disable icon

Get it gitTio

Download the latest distribution ZIP-file and consult the Titanium Documentation on how install it, or simply use the gitTio CLI:

$ gittio install com.alcoapps.actionbarextras

Using it

First require it:

var abextras = require('com.alcoapps.actionbarextras');

At this point the feature for forcing the "menu overflow" has been attached to your Activity, so if that's the only thing you were looking for, you're set.

To set the ActionBar custom features, simply call the setExtras method:

// setting extras
abextras.setExtras({
    title:'This is the title',
    subtitle:'This is the subtitle',
    font: 'my_custom_font.otf',
    backgroundColor:'#ff4f00',
    color: 'red'
});

To add a sharing action to the ActionBar call addSharingAction:

// this should be done within the onCreateOptionsMenu
// because we need to pass a reference to the menu

activity.onCreateOptionsMenu = function(e){

    // at first, create a basic share intent
    var intent = Ti.Android.createIntent({
       action: Ti.Android.ACTION_SEND,
       type: 'text/plain'
    });
    intent.putExtra(Ti.Android.EXTRA_TEXT, 'Hello world!');

    // now pass over the menu and the intent like this
    abextras.addShareAction({
        menu: e.menu,
        intent: intent
    });
};

Contribuitors

License

MIT License - http://alco.mit-license.org

actionbarextras's People

Contributors

manumaticx avatar ricardoalcocer avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.