Android Open Source - FirePhoneDemos Numeric Badge Activity






From Project

Back to project page FirePhoneDemos.

License

The source code is released under:

Apache License

If you think the Android project FirePhoneDemos listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.zappos.firephone.activity;
//  w w  w  . j a v  a 2 s. c  om
import android.os.Bundle;
import android.util.Log;

import com.zappos.firephone.R;

import butterknife.ButterKnife;
import butterknife.OnClick;

@SuppressWarnings("unused")
public class NumericBadgeActivity extends BaseActivity {

    private static final String TAG = NumericBadgeActivity.class.getSimpleName();

    // Integer to store current badge number.
    private static int mBadgeNumber = 0;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_numeric_badge);

        ButterKnife.inject(this);
    }

    /**
     * Click handler defined and set in the layout.
     * Increments the numeric badge on the app icon.
     */
    @OnClick(R.id.btn_increment_numeric_badge_number)
    public void onIncrementNumericBadge() {
        Log.v(TAG, "onIncreaseNumericBadge, incrementing mBadgeNumber to " + (mBadgeNumber + 1));
        mHomeManager.updateNumericBadge(++mBadgeNumber);
    }

    /**
     * Click handler defined and set in the layout.
     * Decreases the numeric badge on the app icon, does nothing if badge at 0.
     */
    @OnClick(R.id.btn_decrement_numeric_badge_number)
    public void onDecrementNumericBadge() {
        if (mBadgeNumber > 0) {
            Log.v(TAG, "onDecreaseNumericBadge, decrementing mBadgeNumber to " + (mBadgeNumber-1));
            mHomeManager.updateNumericBadge(--mBadgeNumber);
        }
    }
}




Java Source Code List

com.zappos.firephone.ApplicationTest.java
com.zappos.firephone.activity.BaseActivity.java
com.zappos.firephone.activity.GestureActivity.java
com.zappos.firephone.activity.HeadTrackingCircleActivity.java
com.zappos.firephone.activity.HomeActivity.java
com.zappos.firephone.activity.HomeWidgetActivity.java
com.zappos.firephone.activity.NumericBadgeActivity.java
com.zappos.firephone.firefly.FireFlyDigitalEntityUI.java
com.zappos.firephone.firefly.FireFlyPhoneActivity.java
com.zappos.firephone.firefly.FireFlyPlugin.java
com.zappos.firephone.firefly.FireFlyProductActivity.java
com.zappos.firephone.receiver.WidgetBroadcastReceiver.java
com.zappos.firephone.view.CircleView.java