package com.camnter.newlife.ui.activity;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ProgressBar;
import android.widget.TextView;
import com.camnter.newlife.R;
import com.camnter.newlife.core.activity.BaseAppCompatActivity;
import com.camnter.newlife.utils.asynctask.ProgressBarAsyncTask;

/**
 * Description：AsyncTaskActivity
 * Created by：CaMnter
 * Time：2015-09-17 14:12
 */
public class AsyncTaskActivity extends BaseAppCompatActivity implements View.OnClickListener {

    private ProgressBar progressBar;
    private TextView textview;
    private Button start;


    /**
     * Fill in layout id
     *
     * @return layout id
     */
    @Override protected int getLayoutId() {
        return R.layout.activity_asynctask;
    }


    /**
     * Initialize the view in the layout
     *
     * @param savedInstanceState savedInstanceState
     */
    @Override protected void initViews(Bundle savedInstanceState) {
        this.textview = (TextView) this.findViewById(R.id.textview);
        this.progressBar = (ProgressBar) this.findViewById(R.id.progressBar);
        this.start = (Button) this.findViewById(R.id.start);
    }


    /**
     * Initialize the View of the listener
     */
    @Override protected void initListeners() {
        this.start.setOnClickListener(this);
    }


    /**
     * Initialize the Activity data
     */
    @Override protected void initData() {

    }


    /**
     * Called when a view has been clicked.
     *
     * @param v The view that was clicked.
     */
    @Override public void onClick(View v) {
        switch (v.getId()) {
            case R.id.start: {
                ProgressBarAsyncTask asyncTask = new ProgressBarAsyncTask(this.progressBar,
                    this.textview);
                asyncTask.execute("%");
                break;
            }
        }
    }

}

@@ -95,39 +95,8 @@
 w;%0D%0A
-import android.widget.Button;%0D%0A
 impo
@@ -156,24 +156,181 @@
 .TextView;%0D%0A
+import android.widget.Toast;%0D%0Aimport com.camnter.annotation.processor.annotation.SaveOnClick;%0D%0Aimport com.camnter.annotation.processor.annotation.SaveView;%0D%0A
 import com.c
@@ -478,16 +478,110 @@
 ncTask;%0D
+%0Aimport com.camnter.smartsave.SmartSave;%0D%0Aimport com.camnter.utils.wrapper.SmartToastWrapper;%0D
 %0A%0D%0A/**%0D%0A
@@ -733,56 +733,103 @@
 ity 
-implements View.OnClickListener %7B%0D%0A%0D%0A    private
+%7B%0D%0A%0D%0A    @SaveView(R.id.textview)%0D%0A    TextView textview;%0D%0A    @SaveView(R.id.progressBar)%0D%0A   
  Pro
@@ -851,16 +851,18 @@
 ssBar;%0D%0A
+%0D%0A
     priv
@@ -869,52 +869,43 @@
 ate 
-TextView textview;%0D%0A    private Button start
+SmartToastWrapper smartToastWrapper
 ;%0D%0A%0D
@@ -990,32 +990,37 @@
 /%0D%0A    @Override
+%0D%0A   
  protected int g
@@ -1217,32 +1217,37 @@
 /%0D%0A    @Override
+%0D%0A   
  protected void 
@@ -1298,208 +1298,267 @@
     
-this.textview = (TextView) this.findViewById(R.id.textview);%0D%0A        this.progressBar = (ProgressBar) this.findViewById(R.id.progressBar);%0D%0A        this.start = (Button) this.findViewById(R.id.start)
+SmartSave.save(this);%0D%0A        this.smartToastWrapper = new SmartToastWrapper() %7B%0D%0A            @Override%0D%0A            protected Toast getToast() %7B%0D%0A                return Toast.makeText(AsyncTaskActivity.this, %22%22, Toast.LENGTH_LONG);%0D%0A            %7D%0D%0A        %7D
 ;%0D%0A 
@@ -1634,32 +1634,37 @@
 /%0D%0A    @Override
+%0D%0A   
  protected void 
@@ -1686,54 +1686,8 @@
  %7B%0D%0A
-        this.start.setOnClickListener(this);%0D%0A
     
@@ -1761,16 +1761,21 @@
 Override
+%0D%0A   
  protect
@@ -1817,132 +1817,59 @@
     
-/**%0D%0A     * Called when a view has been clicked.%0D%0A     *%0D%0A     * @param v The view that was clicked.%0D%0A     */%0D%0A    @Override
+@SaveOnClick(%7B R.id.start, R.id.progressBar %7D)%0D%0A   
  pub
@@ -1879,16 +1879,21 @@
  void on
+Smart
 Click(Vi
@@ -1959,18 +1959,16 @@
 d.start:
- %7B
 %0D%0A      
@@ -2160,33 +2160,162 @@
 k;%0D%0A            
-%7D
+case R.id.progressBar:%0D%0A                this.smartToastWrapper.show(this.progressBar.getProgress() + %22%25%22);%0D%0A                break;
 %0D%0A        %7D%0D%0A   

use the SaveView and SaveOnClick annotation in app module