Java Code Examples for com.socks.library.KLog#d()

The following examples show how to use com.socks.library.KLog#d() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CartFragment.java    From BitkyShop with MIT License 6 votes vote down vote up
/**
 * 更新全选复选框的状态
 */
private void updateCheckedAll() {
  Boolean isCheckedAll = true;
  if (commodityLocals == null || commodityLocals.size() == 0) {
    isCheckedAll = false;
  } else {
    for (CommodityLocal commodityLocal : commodityLocals) {
      if (!commodityLocal.getCartIsChecked()) {
        isCheckedAll = false;
        break;
      }
    }
  }
  KLog.d("isCheckedAll+" + isCheckedAll);
  checkBoxAll.setChecked(isCheckedAll);
}
 
Example 2
Source File: GreenDaoKyHelper.java    From BitkyShop with MIT License 6 votes vote down vote up
/**
 * 在[本地数据库]购物车中插入商品或增加其数量
 *
 * @param c 商品bean
 */
public static void insertOrIncrease(Commodity c) {
  CommodityLocalDao commodityLocalDao = GreenDaoKyHelper.getDaoSession().getCommodityLocalDao();
  QueryBuilder<CommodityLocal> queryBuilder = commodityLocalDao.queryBuilder();
  queryBuilder.where(CommodityLocalDao.Properties.ObjectId.eq(c.getObjectId()));
  List<CommodityLocal> localList = queryBuilder.list();
  KLog.d("查询到的结果数:" + localList.size());
  CommodityLocal commodityLocal =
      new CommodityLocal(null, c.getObjectId(), c.getCategory(), c.getName(), c.getDetails(), 1,
          c.getPrice(), c.getCoverPhotoUrl(), false);
  if (localList.size() >= 1) {
    commodityLocal.setId(localList.get(0).getId());
    commodityLocal.setCartCount(localList.get(0).getCartCount() + 1);
    commodityLocalDao.update(commodityLocal);
  } else {
    commodityLocalDao.insert(commodityLocal);
  }
}
 
Example 3
Source File: CartRecyclerAdapter.java    From BitkyShop with MIT License 5 votes vote down vote up
/**
 * 初始化 RecyclerView 适配器
 *
 * @param mDatas 绑定的数据
 */
public CartRecyclerAdapter(List<CommodityLocal> mDatas) {
  super(mDatas, R.layout.recycler_cartfragment_show);
  listener = new KyRecyclerViewItemOnClickListener<CommodityLocal>() {
    @Override public void Onclick(View v, int adapterPosition, CommodityLocal data) {
      KLog.d("点击:" + data.getName() + "位置:" + adapterPosition);
    }
  };
}
 
Example 4
Source File: MainActivity.java    From KLog with Apache License 2.0 5 votes vote down vote up
public void logWithParams(View view) {
    KLog.v(TAG, LOG_MSG, "params1", "params2", this);
    KLog.d(TAG, LOG_MSG, "params1", "params2", this);
    KLog.i(TAG, LOG_MSG, "params1", "params2", this);
    KLog.w(TAG, LOG_MSG, "params1", "params2", this);
    KLog.e(TAG, LOG_MSG, "params1", "params2", this);
    KLog.a(TAG, LOG_MSG, "params1", "params2", this);
}
 
Example 5
Source File: OrderManagerActivity.java    From BitkyShop with MIT License 5 votes vote down vote up
@Override protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_order_manager);
  mContext = this;
  toastUtil = new ToastUtil(mContext);
  presenter = new OrderManagerPresenter(this);
  KyToolBar kyToolBar = (KyToolBar) findViewById(R.id.orderManagerActivity_kyToolbar);
  kyToolBar.setNavigationOnClickListener(new View.OnClickListener() {
    @Override public void onClick(View v) {
      finish();
    }
  });
  initSwipeRefreshLayout();
  initRecyclerView(new ArrayList<Order>());

  //初始化本地User对象并获取远端Order
  String objectId = getIntent().getStringExtra("objectId");
  String username = getIntent().getStringExtra("userName");
  if (objectId != null && username != null) {
    this.objectId = objectId;
    this.username = username;
    presenter.queryOrderFormBmob(objectId, Order.NONE);
  } else {
    KLog.d("未知错误");
    toastUtil.show("未知错误");
    finish();
  }
}
 
Example 6
Source File: AddressOptionActivity.java    From BitkyShop with MIT License 5 votes vote down vote up
/**
 * 从云端读入的数据
 *
 * @param receiveList 完全正确的数据
 */
public void initReceiveAddress(List<ReceiveAddress> receiveList) {
  if (receiveList != null && receiveList.size() > 0) {
    KLog.d("reloadData");
    recyclerAdapter.reloadData(receiveList);
  }
}
 
Example 7
Source File: HomeFragment.java    From BitkyShop with MIT License 5 votes vote down vote up
@Override
public void onSliderClick(BaseSliderView slider) {
    switch (slider.getBundle().getInt("msg", -1)) {
        case 0:
            KLog.d(TAG, "case 0");
            break;
        case 1:
            KLog.d(TAG, "case 1");
            break;
        case 2:
            KLog.d(TAG, "case 2");
            break;
    }
}
 
Example 8
Source File: DBManager.java    From ZZShow with Apache License 2.0 5 votes vote down vote up
/**
 *  根据 条件查询  频道列表
 * @param selection     where 语句
 * @param selectionArgs  值
 * @return  返回数据
 */
public List<NewsChannelTable> loadNewsChannelsByWhere(String selection, String[] selectionArgs) {
    List<NewsChannelTable> list = new ArrayList<>();
    db.beginTransaction();
    Cursor cursor = null;
    try{
        cursor = db.query(DBHelper.TABLE_NEWS_CHANNEL,null, selection ,selectionArgs ,null,null,"news_channel_index asc");
        if(cursor.moveToFirst()) {
            while (!cursor.isAfterLast()) {
                String channelName = cursor.getString(cursor.getColumnIndex("news_channel_name"));
                String channelId   = cursor.getString(cursor.getColumnIndex("news_channel_id"));
                String channelType = cursor.getString(cursor.getColumnIndex("news_channel_type"));
                boolean channelSelect = cursor.getInt(cursor.getColumnIndex("news_channel_select")) == 1;
                int channelIndex  = cursor.getInt(cursor.getColumnIndex("news_channel_index"));
                boolean channelFixed = cursor.getInt(cursor.getColumnIndex("news_channel_fixed")) == 1;
                NewsChannelTable channelTable = new NewsChannelTable(channelName,channelId,channelType,channelSelect,channelIndex,channelFixed);
                KLog.d("FIND--","loadNewsChannelsByWhere--"+channelTable.toString());
                list.add(channelTable);
                cursor.moveToNext();
            }
        }
        db.setTransactionSuccessful();
    }catch (Exception e){
        e.printStackTrace();
        KLog.e(e.getMessage());
    }finally {
        if(cursor != null){
            cursor.close();
        }
        db.endTransaction();
    }
    return list;
}
 
Example 9
Source File: DBManager.java    From ZZShow with Apache License 2.0 5 votes vote down vote up
public List<NewsChannelTable> loadNewsChannels(String isSelect){
    List<NewsChannelTable> list = new ArrayList<>();
    db.beginTransaction();
    Cursor cursor = null;
    try{
        cursor = db.query(DBHelper.TABLE_NEWS_CHANNEL,null,"news_channel_select = ? ",new String[]{isSelect},null,null,"news_channel_index asc");
        if(cursor.moveToFirst()) {
            while (!cursor.isAfterLast()) {
                String channelName = cursor.getString(cursor.getColumnIndex("news_channel_name"));
                String channelId   = cursor.getString(cursor.getColumnIndex("news_channel_id"));
                String channelType = cursor.getString(cursor.getColumnIndex("news_channel_type"));
                boolean channelSelect = cursor.getInt(cursor.getColumnIndex("news_channel_select")) == 1;
                int channelIndex  = cursor.getInt(cursor.getColumnIndex("news_channel_index"));
                boolean channelFixed = cursor.getInt(cursor.getColumnIndex("news_channel_fixed")) == 1;
                NewsChannelTable channelTable = new NewsChannelTable(channelName,channelId,channelType,channelSelect,channelIndex,channelFixed);
                KLog.d("FIND--","loadNewsChannels--"+channelTable.toString());
                list.add(channelTable);
                cursor.moveToNext();
            }
        }
        db.setTransactionSuccessful();
    }catch (Exception e){
        /**
         *  exception log
         */
        KLog.e(e.getMessage());
    }finally {
        if(cursor != null){
            cursor.close();
        }
        db.endTransaction();
    }
    return list;
}
 
Example 10
Source File: MainActivity.java    From KLog with Apache License 2.0 5 votes vote down vote up
public void logWithMsg(View view) {
    KLog.v(LOG_MSG);
    KLog.d(LOG_MSG);
    KLog.i(LOG_MSG);
    KLog.w(LOG_MSG);
    KLog.e(LOG_MSG);
    KLog.a(LOG_MSG);
}
 
Example 11
Source File: NewsListPresenterImpl.java    From ZZShow with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();
    KLog.d("NewsListFragment","NewsListPresenterImpl");
    if(mView != null){
        firstLoadData();
    }
}
 
Example 12
Source File: MainActivity.java    From KLog with Apache License 2.0 5 votes vote down vote up
public void log(View view) {
    KLog.v();
    KLog.d();
    KLog.i();
    KLog.w();
    KLog.e();
    KLog.a();
}
 
Example 13
Source File: NewsListFragment.java    From ZZShow with Apache License 2.0 5 votes vote down vote up
@Override
public void OnItemClickListener(View view, int position) {
    List<NewsSummary> mNewsSummaryList = mAdapter.getList();
    NewsSummary newsSummary = mNewsSummaryList.get(position);
    if(NewsListAdapter.TYPE_PHOTO_SET == mAdapter.getItemViewType(position)){
        NewsPhotoDetail mNewsPhotoDetail = setNewsPhotoDetail(newsSummary);
        startActivity(NewsPhotoDetailActivity.getNewsDetailIntent(getActivity(),mNewsPhotoDetail));
        KLog.d(TAG,"postId = " + newsSummary.getPostid() +"--- postSetId= "+ newsSummary.getPhotosetID());
    }else{
        Intent intent = NewsDetailActivity.getNewsDetailIntent(getActivity(),newsSummary.getPostid(),newsSummary.getImgsrc());
        if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            ImageView animationIv = (ImageView) view.findViewById(R.id.news_picture_iv);
            ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(
                    getActivity(),
                    animationIv,
                    Constants.TRANSITION_ANIMATION_NEWS_PHOTOS);
            startActivity(intent,options.toBundle());
        }else{
            ActivityOptionsCompat optionsCompat = ActivityOptionsCompat.makeScaleUpAnimation(
                    view,
                    view.getWidth() / 2,
                    view.getHeight() / 2,
                    0,
                    0);
            ActivityCompat.startActivity(getActivity(),intent,optionsCompat.toBundle());
        }
    }
}
 
Example 14
Source File: MainActivity.java    From KLog with Apache License 2.0 5 votes vote down vote up
public void logWithTag(View view) {
    KLog.v(TAG, LOG_MSG);
    KLog.d(TAG, LOG_MSG);
    KLog.i(TAG, LOG_MSG);
    KLog.w(TAG, LOG_MSG);
    KLog.e(TAG, LOG_MSG);
    KLog.a(TAG, LOG_MSG);
}
 
Example 15
Source File: NewsListFragment.java    From ZZShow with Apache License 2.0 4 votes vote down vote up
@Override
public void hideProgress() {
    KLog.d(TAG,"hideProgress");
    if(mProgressBar != null && mProgressBar.getVisibility() != View.GONE)
        mProgressBar.setVisibility(View.VISIBLE);
}
 
Example 16
Source File: AddressOptionActivity.java    From BitkyShop with MIT License 4 votes vote down vote up
@Override protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_address_option);
  presenter = new AddressOptionPresenter(this);
  toastUtil = new ToastUtil(this);

  //初始化Toolbar
  KyToolBar kyToolBar = (KyToolBar) findViewById(R.id.addressOptionActivity_kyToolbar);
  kyToolBar.setNavigationOnClickListener(this);
  kyToolBar.setRightButtonOnClickListener(this);

  initRecyclerView();

  //由订单确认页面进入时的初始化
  int requestCode = getIntent().getIntExtra("requestCode", -1);
  if (requestCode == KySet.CART_REQUEST_SELECT_RECEIVE_ADDRESS) {
    kyToolBar.setTitle("点击选择收货地址");
    recyclerAdapter.setOnClickListener(
        new KyBaseRecyclerAdapter.KyRecyclerViewItemOnClickListener<ReceiveAddress>() {
          @Override public void Onclick(View v, int adapterPosition, ReceiveAddress data) {
            Intent intent = getIntent();
            intent.putExtra("address", data);
            setResult(KySet.CART_RESULT_SELECT_RECEIVE_ADDRESS, intent);
            finish();
          }
        });
  }

  //初始化本地User对象并获取远端ReceivedAddress
  String objectId = getIntent().getStringExtra("objectId");
  String username = getIntent().getStringExtra("userName");
  if (objectId != null && username != null) {
    this.objectId = objectId;
    this.username = username;
    presenter.getCurrentUserAddress(objectId);
  } else {
    KLog.d("未知错误");
    toastUtil.show("未知错误");
    finish();
  }
}
 
Example 17
Source File: NewsListFragment.java    From ZZShow with Apache License 2.0 4 votes vote down vote up
@Override
public void showProgress() {
    KLog.d(TAG,"showProgress");
    if(mProgressBar != null && mProgressBar.getVisibility() != View.VISIBLE)
        mProgressBar.setVisibility(View.GONE);
}
 
Example 18
Source File: OrderActivity.java    From BitkyShop with MIT License 4 votes vote down vote up
@Override protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_order);
  mContext = this;
  presenter = new OrderActivityPresenter(this);
  toastUtil = new ToastUtil(mContext);

  historyOrderInfoLayout = findViewById(R.id.orderActivity_relativeLayout_historyOrderInfo);
  TextView orderId = (TextView) findViewById(R.id.orderActivity_historyOrderInfo_OrderId);
  TextView orderCreatedTime =
      (TextView) findViewById(R.id.orderActivity_historyOrderInfo_OrderCreatedTime);
  orderStatus = (TextView) findViewById(R.id.orderActivity_historyOrderInfo_orderStatus);

  addressLayout = findViewById(R.id.orderActivity_addressCardView);
  ImageView imageViewArrowRight =
      (ImageView) findViewById(R.id.orderActivity_addressCardView_ArrowRight);
  name = (TextView) findViewById(R.id.orderActivity_userName);
  phone = (TextView) findViewById(R.id.orderActivity_phone);
  address = (TextView) findViewById(R.id.orderActivity_address);

  recyclerView = (RecyclerView) findViewById(R.id.orderActivity_recycler_commodity);

  bottomNavigation = findViewById(R.id.orderActivity_bottomNavigation);
  tvPriceTotal = (TextView) findViewById(R.id.orderActivity_textview_total);
  btnOrderGeneration = (Button) findViewById(R.id.orderActivity_btn_orderGeneration);
  btnCompleted = (Button) findViewById(R.id.orderActivity_confirmCompleted);
  btncancel = (Button) findViewById(R.id.orderActivity_cancelOrder);

  KyToolBar kyToolBar = (KyToolBar) findViewById(R.id.orderActivity_kyToolbar);
  kyToolBar.setNavigationOnClickListener(this);
  btnOrderGeneration.setOnClickListener(this);
  btnCompleted.setOnClickListener(this);
  btncancel.setOnClickListener(this);

  switchOrderLocation(OrderLocation.local);
  initRecyclerView();

  int requestCode = getIntent().getIntExtra("requestCode", -1);
  KLog.d("requestCode" + requestCode);
  currentStatus = requestCode;
  switch (requestCode) {
    case KySet.CART_REQUEST_SUBMIT_ORDER:
      bottomNavigation.setVisibility(View.VISIBLE);
      btnOrderGeneration.setVisibility(View.VISIBLE);
      imageViewArrowRight.setVisibility(View.VISIBLE);
      addressLayout.setVisibility(View.VISIBLE);
      addressLayout.setOnClickListener(this);
      queryDefaultAddressFromBmob();
      break;
    case KySet.USER_REQUEST_HISTORY_ORDER:
      historyOrderInfoLayout.setVisibility(View.VISIBLE);
      bottomNavigation.setVisibility(View.VISIBLE);
      orderId.setText(order.getObjectId());
      orderCreatedTime.setText(order.getCreatedAt());
      changeOrderStatus(order);
      name.setText(order.getName());
      phone.setText(order.getPhone());
      address.setText(order.getAddress());
      break;
    default:
      finish();
      break;
  }
  initRecyclerOrderData(order.getCommodityList());
}
 
Example 19
Source File: OrderActivity.java    From BitkyShop with MIT License 4 votes vote down vote up
@Override public void onClick(View v) {
  switch (v.getId()) {

    //导航栏返回
    case R.id.kytoolbar_navigation:
      finish();
      break;

    //收货地址信息CardView,设置收货地址
    case R.id.orderActivity_addressCardView:
      KLog.d("激活");
      Intent intent = new Intent(mContext, AddressOptionActivity.class);
      intent.putExtra("requestCode", KySet.CART_REQUEST_SELECT_RECEIVE_ADDRESS);
      intent.putExtra("userName", order.getUsername());
      intent.putExtra("objectId", order.getUserObjectId());
      startActivityForResult(intent, KySet.CART_REQUEST_SELECT_RECEIVE_ADDRESS);
      break;

    //生成订单按钮
    case R.id.orderActivity_btn_orderGeneration:
      if (receiveAddress != null) {
        btnOrderGeneration.setEnabled(false);
        if (commodityOrderSubmitList.size() <= 0) {
          toastUtil.show("您选择的商品可能被抢光了, 请重新选择");
          return;
        }
        //生成用于提交服务器的新的Order对象
        Order orderSubmit = new Order(commodityOrderSubmitList);
        orderSubmit.setAddressAndUserInfo(receiveAddress);
        if (orderSubmit.isDone()) {
          KLog.d("已上传服务器:" + orderSubmit.getCommodityList().size());
          orderSubmit.save(new SaveListener<String>() {
            @Override public void done(String objectId, BmobException e) {
              if (e == null) {
                Intent intentResult = new Intent();
                Bundle bundle = new Bundle();
                order.setObjectId(objectId);
                bundle.putSerializable("order", order);
                intentResult.putExtra("bundle", bundle);
                setResult(KySet.CART_RESULT_SUBMIT_ORDER, intentResult);
                finish();
              } else {
                btnOrderGeneration.setEnabled(true);
                toastUtil.show("订单生成失败,请重试");
              }
            }
          });
        }
      } else {
        toastUtil.show("请先点击上方的标签添加收货地址");
      }
      break;
    case R.id.orderActivity_confirmCompleted:
      setResult(KySet.USER_RESULT_REFRESH_ORDER);
      presenter.updateOrderStatus(order, Order.COMPLETED);
      break;
    case R.id.orderActivity_cancelOrder:
      setResult(KySet.USER_RESULT_REFRESH_ORDER);
      presenter.updateOrderStatus(order, Order.CANCELLED);
      break;
  }
}
 
Example 20
Source File: CartFragment.java    From BitkyShop with MIT License 4 votes vote down vote up
/**
 * 从本地数据库中读取数据并初始化RecyclerView
 */
private void initRecyclerView() {
  commodityLocals = GreenDaoKyHelper.queryAll();
  KLog.d("本地数据库,commodityLocals:" + commodityLocals.size());
  if (recyclerAdapter != null) {
    recyclerAdapter.showItemDeleteButton(false);
    recyclerAdapter.reloadData(commodityLocals);
  } else {
    recyclerAdapter = new CartRecyclerAdapter(commodityLocals);
    recyclerAdapter.setOnCheckboxListener(new CartRecyclerAdapter.CheckboxListener() {
      @Override public void OnClick(CheckBox v) {
        countTotalPrices();
        updateCheckedAll();
      }
    });
    recyclerAdapter.setOnItemCounterListener(new CartRecyclerAdapter.ItemCounterListener() {
      @Override public void addOverflow() {
        KLog.d("addOverflow()");
      }

      @Override public void minusOverflow() {
        KLog.d("minusOverflow()");
      }

      @Override public void OnButtonClick(int currentCount, ItemCounter.ButtonType type) {
        countTotalPrices();
      }
    });
    recyclerAdapter.setOnDeleteItemListener(new CartRecyclerAdapter.DeleteItemListener() {
      @Override public void OnClick(CommodityLocal dataItem) {
        GreenDaoKyHelper.deleteItem(dataItem);
        countTotalPrices();
        updateCheckedAll();
      }
    });
  }
  RecyclerView recyclerViewCategray =
      (RecyclerView) view.findViewById(R.id.recyclerView_cartFragment);
  recyclerViewCategray.setAdapter(recyclerAdapter);
  recyclerViewCategray.setLayoutManager(new LinearLayoutManager(mContext));
  recyclerViewCategray.setItemAnimator(new DefaultItemAnimator());
  recyclerViewCategray.addItemDecoration(
      new DividerItemDecoration(mContext, DividerItemDecoration.VERTICAL_LIST));
}