Android Open Source - dejalist Category






From Project

Back to project page dejalist.

License

The source code is released under:

Apache License

If you think the Android project dejalist 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.luboganev.dejalist.data.entities;
//  ww  w  .  j av a  2  s .  c  o  m
import android.os.Parcel;
import android.os.Parcelable;

public class Category implements Parcelable {
  // The db columns
  public Long _id;
  public String name;
  public int color;
  
  // Variables for the parcable
  transient private static final int FLAG_SET_ID = 0x01;
  transient private static final int FLAG_SET_NAME = 0x02;
  
    public int describeContents() {
        return 0;
    }

    public void writeToParcel(Parcel out, int flags) {
      // set the field set flags
      int fieldsSetFlags = 0;
      if(_id != null) fieldsSetFlags = fieldsSetFlags | FLAG_SET_ID;
      if(name != null) fieldsSetFlags = fieldsSetFlags | FLAG_SET_NAME;
      out.writeInt(fieldsSetFlags);
      
      if((fieldsSetFlags & FLAG_SET_ID) != 0) out.writeLong(_id);
      if((fieldsSetFlags & FLAG_SET_NAME) != 0) out.writeString(name);
      out.writeInt(color);
    }
    
//    12414 in binary is:
//    Binary number: 1  1  0  0  0  0  0  1  1  1  1  1  1  0
//    -------------------------------------------------------
//    Bit positions: 13 12 11 10 9  8  7  6  5  4  3  2  1  0
//    bitmask = TRADEABLE | SELLABLE | STORABLE | STORABLE_IN_WH | STORABLE_IN_LEGION_WH | BREAKABLE | BLACK_CLOUD_TRADERS | CAN_SPLIT;
//    if(bitmask & TRADEABLE != 0) {
//        // This item can be traded
//    } else {
//        // This item cannot be traded
//    }
//    bitmask |= TRADEABLE; // Sets the flag using bitwise OR
//    bitmask &= ~TRADEABLE; // Clears the flag using bitwise AND and NOT
//    bitmask ^= TRADEABLE; // Toggles the flag using bitwise XOR 

    public static final Parcelable.Creator<Category> CREATOR
            = new Parcelable.Creator<Category>() {
        public Category createFromParcel(Parcel in) {
            return new Category(in);
        }

        public Category[] newArray(int size) {
            return new Category[size];
        }
    };
    
    private Category(Parcel in) {
      int fieldsSetFlags = in.readInt();
      _id = ((fieldsSetFlags & FLAG_SET_ID) != 0) ? in.readLong() : null;
      name = ((fieldsSetFlags & FLAG_SET_NAME) != 0) ? in.readString() : null;
      color = in.readInt();
    }
    
    public Category() {
      _id = null;
      name = null;
      color = -1;
    }
}




Java Source Code List

com.larswerkman.colorpicker.ColorPicker.java
com.larswerkman.colorpicker.OpacityBar.java
com.larswerkman.colorpicker.SVBar.java
com.larswerkman.colorpicker.SaturationBar.java
com.larswerkman.colorpicker.ValueBar.java
com.luboganev.dejalist.Utils.java
com.luboganev.dejalist.crop.CropActivity.java
com.luboganev.dejalist.crop.CropDialogSave.java
com.luboganev.dejalist.crop.CropHighlightView.java
com.luboganev.dejalist.crop.CropUtils.java
com.luboganev.dejalist.crop.CropView.java
com.luboganev.dejalist.crop.ImageViewTouchBase.java
com.luboganev.dejalist.crop.RotateBitmap.java
com.luboganev.dejalist.data.BackupIntentService.java
com.luboganev.dejalist.data.CacheManager.java
com.luboganev.dejalist.data.DejalistContract.java
com.luboganev.dejalist.data.DejalistDatabase.java
com.luboganev.dejalist.data.DejalistProvider.java
com.luboganev.dejalist.data.ProductImageFileHelper.java
com.luboganev.dejalist.data.SelectionBuilder.java
com.luboganev.dejalist.data.entities.Category.java
com.luboganev.dejalist.data.entities.Product.java
com.luboganev.dejalist.ui.AboutActivity.java
com.luboganev.dejalist.ui.CategoriesListCursorAdapter$ViewHolder$$ViewInjector.java
com.luboganev.dejalist.ui.CategoriesListCursorAdapter.java
com.luboganev.dejalist.ui.CategoryDialogFragment$$ViewInjector.java
com.luboganev.dejalist.ui.CategoryDialogFragment.java
com.luboganev.dejalist.ui.CheckableRelativeLayout.java
com.luboganev.dejalist.ui.ChecklistActionTaker.java
com.luboganev.dejalist.ui.ChecklistController.java
com.luboganev.dejalist.ui.ChecklistCursorAdapter$ViewHolder$$ViewInjector.java
com.luboganev.dejalist.ui.ChecklistCursorAdapter.java
com.luboganev.dejalist.ui.ChecklistFragment$$ViewInjector.java
com.luboganev.dejalist.ui.ChecklistFragment.java
com.luboganev.dejalist.ui.ConfirmBackResDialogFragment.java
com.luboganev.dejalist.ui.MainActivity$$ViewInjector.java
com.luboganev.dejalist.ui.MainActivity.java
com.luboganev.dejalist.ui.NavigationCursorAdapter$ViewHolder$$ViewInjector.java
com.luboganev.dejalist.ui.NavigationCursorAdapter.java
com.luboganev.dejalist.ui.ProductActivity$$ViewInjector.java
com.luboganev.dejalist.ui.ProductActivity.java
com.luboganev.dejalist.ui.ProductsGalleryActionTaker.java
com.luboganev.dejalist.ui.ProductsGalleryController.java
com.luboganev.dejalist.ui.ProductsGalleryCursorAdapter$ViewHolder$$ViewInjector.java
com.luboganev.dejalist.ui.ProductsGalleryCursorAdapter.java
com.luboganev.dejalist.ui.ProductsGalleryFragment$$ViewInjector.java
com.luboganev.dejalist.ui.ProductsGalleryFragment.java
com.luboganev.dejalist.ui.SetProductsCategoryDialogFragment.java
com.luboganev.dejalist.ui.UndoBarController.java