Skip to content

Commit

Permalink
优化代码
Browse files Browse the repository at this point in the history
  • Loading branch information
sunfusheng committed Nov 22, 2016
1 parent 0492be8 commit 667f612
Show file tree
Hide file tree
Showing 15 changed files with 64 additions and 60 deletions.
4 changes: 3 additions & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
apply plugin: 'com.android.application'
apply plugin: 'com.jakewharton.butterknife'

android {
compileSdkVersion 24
Expand Down Expand Up @@ -26,7 +27,8 @@ dependencies {
compile 'com.android.support:design:24.2.1'

// ButterKnife
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.jakewharton:butterknife:8.4.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0'

// Glide
compile 'com.github.bumptech.glide:glide:3.7.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

import java.util.List;

import butterknife.Bind;
import butterknife.BindView;
import butterknife.ButterKnife;

/**
Expand Down Expand Up @@ -64,10 +64,10 @@ public View getView(int position, View convertView, ViewGroup parent) {
}

static class ViewHolder {
@Bind(R.id.ll_root_view)
LinearLayout llRootView;
@Bind(R.id.tv_title)
@BindView(R.id.tv_title)
TextView tvTitle;
@BindView(R.id.ll_root_view)
LinearLayout llRootView;

ViewHolder(View view) {
ButterKnife.bind(this, view);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

import java.util.List;

import butterknife.Bind;
import butterknife.BindView;
import butterknife.ButterKnife;

/**
Expand Down Expand Up @@ -62,9 +62,9 @@ public View getView(int position, View convertView, ViewGroup parent) {
}

static class ViewHolder {
@Bind(R.id.iv_image)
@BindView(R.id.iv_image)
ImageView ivImage;
@Bind(R.id.tv_title)
@BindView(R.id.tv_title)
TextView tvTitle;

ViewHolder(View view) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

import java.util.List;

import butterknife.Bind;
import butterknife.BindView;
import butterknife.ButterKnife;

/**
Expand Down Expand Up @@ -62,9 +62,9 @@ public View getView(int position, View convertView, ViewGroup parent) {
}

static class ViewHolder {
@Bind(R.id.iv_image)
@BindView(R.id.iv_image)
ImageView ivImage;
@Bind(R.id.tv_title)
@BindView(R.id.tv_title)
TextView tvTitle;

ViewHolder(View view) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

import java.util.List;

import butterknife.Bind;
import butterknife.BindView;
import butterknife.ButterKnife;

/**
Expand Down Expand Up @@ -51,11 +51,11 @@ public View getView(int position, View convertView, ViewGroup parent) {
}

static class ViewHolder {
@Bind(R.id.iv_image)
@BindView(R.id.iv_image)
ImageView ivImage;
@Bind(R.id.tv_title)
@BindView(R.id.tv_title)
TextView tvTitle;
@Bind(R.id.tv_tips)
@BindView(R.id.tv_tips)
TextView tvTips;

ViewHolder(View view) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

import java.util.List;

import butterknife.Bind;
import butterknife.BindView;
import butterknife.ButterKnife;

/**
Expand Down Expand Up @@ -55,11 +55,11 @@ public View getView(int position, View convertView, ViewGroup parent) {
}

static class ViewHolder {
@Bind(R.id.iv_image)
@BindView(R.id.iv_image)
ImageView ivImage;
@Bind(R.id.tv_title)
@BindView(R.id.tv_title)
TextView tvTitle;
@Bind(R.id.tv_subtitle)
@BindView(R.id.tv_subtitle)
TextView tvSubtitle;

ViewHolder(View view) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import java.util.ArrayList;
import java.util.List;

import butterknife.Bind;
import butterknife.BindView;
import butterknife.ButterKnife;

/**
Expand Down Expand Up @@ -103,13 +103,13 @@ public View getView(int position, View convertView, ViewGroup parent) {
}

static class ViewHolder {
@Bind(R.id.ll_root_view)
@BindView(R.id.ll_root_view)
LinearLayout llRootView;
@Bind(R.id.iv_image)
@BindView(R.id.iv_image)
ImageView ivImage;
@Bind(R.id.tv_title)
@BindView(R.id.tv_title)
TextView tvTitle;
@Bind(R.id.tv_rank)
@BindView(R.id.tv_rank)
TextView tvRank;

ViewHolder(View view) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@

import com.sunfusheng.StickyHeaderListView.R;

import butterknife.Bind;
import butterknife.BindView;
import butterknife.ButterKnife;

/**
* Created by sunfusheng on 16/4/24.
*/
public class AboutActivity extends AppCompatActivity {

@Bind(R.id.toolbar)
@BindView(R.id.toolbar)
Toolbar toolbar;
@Bind(R.id.webView)
@BindView(R.id.webView)
WebView webView;

private WebSettings settings;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
import java.util.ArrayList;
import java.util.List;

import butterknife.Bind;
import butterknife.BindView;
import butterknife.ButterKnife;

/**
Expand All @@ -45,19 +45,19 @@
*/
public class MainActivity extends AppCompatActivity implements SmoothListView.ISmoothListViewListener {

@Bind(R.id.listView)
@BindView(R.id.listView)
SmoothListView smoothListView;
@Bind(R.id.fv_top_filter)
@BindView(R.id.fv_top_filter)
FilterView fvTopFilter;
@Bind(R.id.rl_bar)
@BindView(R.id.rl_bar)
RelativeLayout rlBar;
@Bind(R.id.tv_title)
@BindView(R.id.tv_title)
TextView tvTitle;
@Bind(R.id.view_title_bg)
@BindView(R.id.view_title_bg)
View viewTitleBg;
@Bind(R.id.view_action_more_bg)
@BindView(R.id.view_action_more_bg)
View viewActionMoreBg;
@Bind(R.id.fl_action_more)
@BindView(R.id.fl_action_more)
FrameLayout flActionMore;

private Context mContext;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,41 +22,41 @@
import com.sunfusheng.StickyHeaderListView.model.FilterEntity;
import com.sunfusheng.StickyHeaderListView.model.FilterTwoEntity;

import butterknife.Bind;
import butterknife.BindView;
import butterknife.ButterKnife;

/**
* Created by sunfusheng on 16/4/20.
*/
public class FilterView extends LinearLayout implements View.OnClickListener {

@Bind(R.id.tv_category)
@BindView(R.id.tv_category)
TextView tvCategory;
@Bind(R.id.iv_category_arrow)
@BindView(R.id.iv_category_arrow)
ImageView ivCategoryArrow;
@Bind(R.id.tv_sort)
@BindView(R.id.tv_sort)
TextView tvSort;
@Bind(R.id.iv_sort_arrow)
@BindView(R.id.iv_sort_arrow)
ImageView ivSortArrow;
@Bind(R.id.tv_filter)
@BindView(R.id.tv_filter)
TextView tvFilter;
@Bind(R.id.iv_filter_arrow)
@BindView(R.id.iv_filter_arrow)
ImageView ivFilterArrow;
@Bind(R.id.ll_category)
@BindView(R.id.ll_category)
LinearLayout llCategory;
@Bind(R.id.ll_sort)
@BindView(R.id.ll_sort)
LinearLayout llSort;
@Bind(R.id.ll_filter)
@BindView(R.id.ll_filter)
LinearLayout llFilter;
@Bind(R.id.lv_left)
@BindView(R.id.lv_left)
ListView lvLeft;
@Bind(R.id.lv_right)
@BindView(R.id.lv_right)
ListView lvRight;
@Bind(R.id.ll_head_layout)
@BindView(R.id.ll_head_layout)
LinearLayout llHeadLayout;
@Bind(R.id.ll_content_list_view)
@BindView(R.id.ll_content_list_view)
LinearLayout llContentListView;
@Bind(R.id.view_mask_bg)
@BindView(R.id.view_mask_bg)
View viewMaskBg;

private Context mContext;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@
import java.util.ArrayList;
import java.util.List;

import butterknife.Bind;
import butterknife.BindView;
import butterknife.ButterKnife;

public class HeaderBannerView extends HeaderViewInterface<List<String>> {

@Bind(R.id.vp_banner)
@BindView(R.id.vp_banner)
ViewPager vpBanner;
@Bind(R.id.ll_index_container)
@BindView(R.id.ll_index_container)
LinearLayout llIndexContainer;
@Bind(R.id.rl_banner)
@BindView(R.id.rl_banner)
RelativeLayout rlBanner;

private static final int BANNER_TYPE = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@

import java.util.List;

import butterknife.Bind;
import butterknife.BindView;
import butterknife.ButterKnife;

/**
* Created by sunfusheng on 16/4/20.
*/
public class HeaderChannelView extends HeaderViewInterface<List<ChannelEntity>> {

@Bind(R.id.gv_channel)
@BindView(R.id.gv_channel)
FixedGridView gvChannel;

public HeaderChannelView(Activity context) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@

import com.sunfusheng.StickyHeaderListView.R;

import butterknife.Bind;
import butterknife.BindView;
import butterknife.ButterKnife;

/**
* Created by sunfusheng on 16/4/20.
*/
public class HeaderFilterView extends HeaderViewInterface<Object> implements FilterView.OnFilterClickListener {

@Bind(R.id.fv_filter)
@BindView(R.id.fv_filter)
FilterView fvFilter;

public HeaderFilterView(Activity context) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@

import java.util.List;

import butterknife.Bind;
import butterknife.BindView;
import butterknife.ButterKnife;

/**
* Created by sunfusheng on 16/4/20.
*/
public class HeaderOperationView extends HeaderViewInterface<List<OperationEntity>> {

@Bind(R.id.gv_operation)
@BindView(R.id.gv_operation)
FixedGridView gvOperation;

public HeaderOperationView(Activity context) {
Expand Down
2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@

buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.0'
classpath 'com.jakewharton:butterknife-gradle-plugin:8.4.0'
}
}

Expand Down

0 comments on commit 667f612

Please sign in to comment.