GithubHelp home page GithubHelp logo

codelab-slices-basic-codelab's Introduction

Creating Android Slices

Slices are a new way to embed your app content in other surfaces. Slices are supported via a flexible templating system

Their templated content allow slices to feel at home in whatever surface hosts them, but their dynamic nature aims to be much more rich and updatable than existing APIs.

This codelab will guide you through creating a simple app that supports slices.

codelab-slices-basic-codelab's People

Contributors

codingjeremy avatar dh-- avatar

Stargazers

 avatar Mortezasun avatar houzhi avatar Kvar Izunia avatar Sungyong An avatar Edric Chan avatar Will Chen avatar  avatar S1ahs3r avatar Tom avatar averson avatar Drakeet avatar Harish Ramanbhai Patel avatar Levente Jónás avatar Kҽʋιɳ Sҽɾɾαɳσ avatar Paul avatar  avatar  avatar Tony avatar Alfian Yusuf Abdullah avatar Jiajun Wang avatar Mocoven avatar  avatar Sudipta K Paik avatar Imran avatar Joshua McWilliams avatar Nabe avatar Ronald Daugherty avatar Kenji Tomita avatar

Watchers

Sean McQuillan avatar Marc avatar Murat Yener avatar Patrick Fuentes avatar James Cloos avatar Wojtek Kaliciński avatar Hoi Lam avatar Fung Lam avatar Lyla Fujiwara avatar  avatar Keith Smyth avatar  avatar  avatar Harish Ramanbhai Patel avatar Gerry avatar Kenneth Lau avatar  avatar  avatar

codelab-slices-basic-codelab's Issues

Question: why increase `sReqCode` for each call to `getChangeTempIntent` ?

This code:

private PendingIntent getChangeTempIntent(int value) {
    Intent intent = new Intent(ACTION_CHANGE_TEMP);
    intent.setClass(context, MyBroadcastReceiver.class);
    intent.putExtra(EXTRA_TEMP_VALUE, value);
    return PendingIntent.getBroadcast(getContext(), sReqCode++, intent,
            PendingIntent.FLAG_UPDATE_CURRENT);
}

I think it's not really needed to increase it all the time, as the request might interfere with other kinds of codes.

I think it's easier to split it to inc&dec. For example:

private PendingIntent getChangeTempIntent(int value, boolean hasIncreased) {
    Intent intent = new Intent(ACTION_CHANGE_TEMP);
    intent.setClass(context, MyBroadcastReceiver.class);
    intent.putExtra(EXTRA_TEMP_VALUE, value);
    return PendingIntent.getBroadcast(getContext(), hasIncreased ? 0 : 1, intent,
            PendingIntent.FLAG_UPDATE_CURRENT);
}

And the usage:

    SliceAction tempUp = new SliceAction(getChangeTempIntent(sTemperature + 1, true),
            IconCompat.createWithResource(context, R.drawable.ic_temp_up).toIcon(),
            "Increase temperature");
    SliceAction tempDown = new SliceAction(getChangeTempIntent(sTemperature - 1, false),
            IconCompat.createWithResource(context, R.drawable.ic_temp_down).toIcon(),
            "Decrease temperature");

Seems to work fine...

Bug: notifyChange doesnt' work on SliceProvider

In updateTemperature the call context.getContentResolver().notifyChange(uri, null); doesn't fire chain on onBindSlice in MySliceProvider.

I see TODO on parent class, however, is there any workarounds?

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.