Przeglądaj źródła

Merge branch 'developer' of https://gitlab.com/Arisono/SkWeiChat-Baidu into developer

RaoMeng 9 lat temu
rodzic
commit
a1a7766b7a

+ 2 - 8
WeiChat/build.gradle

@@ -4,7 +4,7 @@ apply plugin: 'com.getkeepsafe.dexcount'
 android {
     signingConfigs {
         config {
-            storeFile file('C:/CompanyProject/applicationsignname[20150409]')
+            storeFile file('C:/Users/Arison/Desktop/applicationsignname[20150409]')
             storePassword '13237658359'
             keyAlias 'jie-20150409'
             keyPassword '13237658359'
@@ -22,11 +22,6 @@ android {
         }
         multiDexEnabled true
         signingConfig signingConfigs.config
-
-        ndk {
-            // 设置支持的SO库架构
-            abiFilters 'armeabi' //, 'x86', 'armeabi-v7a', 'x86_64', 'arm64-v8a'
-        }
     }
     packagingOptions {
         exclude 'META-INF/LICENSE.txt'
@@ -43,7 +38,6 @@ android {
     }
     productFlavors {
     }
-
 }
 
 buildscript {
@@ -100,5 +94,5 @@ dependencies {
     compile 'me.gujun.android.taggroup:library:1.4@aar'
     compile 'com.umeng.analytics:analytics:latest.integration'
     compile 'com.android.support:multidex:1.0.1'
-
+  
 }

BIN
WeiChat/libs/okhttp-3.4.1.jar


+ 5 - 5
WeiChat/src/main/AndroidManifest.xml

@@ -2,14 +2,14 @@
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:tools="http://schemas.android.com/tools"
     package="com.xzjmyk.pm.activity"
-    android:versionCode="46"
-    android:versionName="4.6">
+    android:versionCode="51"
+    android:versionName="5.1">
     <uses-sdk
         android:minSdkVersion="11"
-        android:targetSdkVersion="23" />
+        android:targetSdkVersion="22" 
+        />
     <!-- 拨打电话 -->
     <uses-permission android:name="android.permission.CALL_PHONE" />
-
     <uses-feature android:name="android.hardware.camera" />
     <uses-feature android:name="android.hardware.camera.autofocus" />
     <uses-feature android:name="android.hardware.microphone" />
@@ -63,6 +63,7 @@
     <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
 
     <application
+        android:largeHeap="true"
         android:name=".MyApplication"
         android:allowBackup="true"
         android:icon="@drawable/uuu"
@@ -74,7 +75,6 @@
         <meta-data
             android:name="UMENG_CHANNEL"
             android:value="baidu" />
-
         <!-- 启动页面 -->
         <activity
             android:name=".ui.SplashActivity"

+ 7 - 7
WeiChat/src/main/java/com/xzjmyk/pm/activity/BdLocationHelper.java

@@ -81,18 +81,18 @@ public class BdLocationHelper {
             if (location != null) {
                 resultCode = location.getLocType();
             }
-//            Log.i("gongpengming", StringUtils.isEmail(location.getLocationDescribe()) ? "空的" : location.getLocationDescribe());
-            /*if (location.getPoiList() == null || location.getPoiList().size() <= 0) {
-                Log.i("gongpengming", "location.getPoiList()不对劲");
+          // Log.i("gongpengming", StringUtils.isEmail(location.getLocationDescribe()) ? "空的" : location.getLocationDescribe());
+            if (location.getPoiList() == null || location.getPoiList().size() <= 0) {
+            //    Log.i("gongpengming", "location.getPoiList()不对劲");
             } else {
-                Log.i("gongpengming", "location.getPoiList()不对劲");
-            }*/
-//            setPois(location.getPoiList());
+           //    Log.i("gongpengming", "location.getPoiList()不对劲");
+            }
+            setPois(location.getPoiList());
             // 百度定位失败
             if (resultCode != BDLocation.TypeGpsLocation && resultCode != BDLocation.TypeCacheLocation
                     && resultCode != BDLocation.TypeOffLineLocation && resultCode != BDLocation.TypeNetWorkLocation) {
                 if (AppConfig.DEBUG) {
-                    Log.d(AppConfig.TAG, "百度定位失败");
+                //    Log.d(AppConfig.TAG, "百度定位失败");
                 }
                 mFaildCount++;
                 if (mFaildCount > 3) {// 停止定位

+ 7 - 5
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/erp/activity/ExtraLeaveActivity.java

@@ -355,15 +355,17 @@ public class ExtraLeaveActivity extends BaseActivity implements OnClickListener
 		et_extra_time.setKeyListener(null);
 		et_extra_resaon.setKeyListener(null);
 		et_extra_encode.setKeyListener(null);
-		
-		et_extra_encode.setText(CommonUtil.getSharedPreferences(this, "erp_emname"));
 		et_leader_no.setKeyListener(null);
 		et_extra_deparment.setKeyListener(null);
-		
+		et_extra_date.setFocusable(false);
+		et_extra_time.setFocusable(false);
+		et_extra_resaon.setFocusable(false);
+		et_extra_encode.setFocusable(false);
+		et_leader_no.setFocusable(false);
+		et_extra_deparment.setFocusable(false);
+		et_extra_encode.setText(CommonUtil.getSharedPreferences(this, "erp_emname"));
 		et_extra_encode.setOnClickListener(this);
-
 		et_leader_no.setOnClickListener(this);
-
 		et_extra_date.setOnClickListener(this);
 		et_extra_resaon.setOnClickListener(this);
 		et_extra_time.setOnClickListener(this);

+ 8 - 0
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/erp/activity/LeaveActivity.java

@@ -545,6 +545,14 @@ public class LeaveActivity extends BaseActivity implements OnClickListener {
         et_leave_category.setKeyListener(null);
         et_leave_man.setKeyListener(null);
         et_leave_mankind.setKeyListener(null);
+
+        tv_start_time.setFocusable(false);
+        tv_end_time.setFocusable(false);
+        et_leave_type.setFocusable(false);
+        et_leave_category.setFocusable(false);
+        et_leave_man.setFocusable(false);
+        et_leave_mankind.setFocusable(false);
+        
         et_leave_man.setText(CommonUtil.getSharedPreferences(this, "erp_emname"));
 
 

+ 12 - 8
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/erp/activity/TravelActivity.java

@@ -292,29 +292,33 @@ public class TravelActivity extends BaseActivity implements OnClickListener {
 		ct=this;
         progressDialog=CustomProgressDialog.createDialog(this);
 		getSupportActionBar().setTitle("出差申请");
-		et_trave_type.setOnClickListener(this);
-		et_extra_sign.setOnClickListener(this);
+	
 		et_trave_type.setKeyListener(null);
 		et_extra_sign.setKeyListener(null);
 		et_extra_deparment.setKeyListener(null);
-
+		et_trave_linkman.setKeyListener(null);
 		et_extra_endtime.setKeyListener(null);
 		et_extra_starttime.setKeyListener(null);
 
+		et_trave_type.setFocusable(false);
+		et_extra_sign.setFocusable(false);
+		et_extra_deparment.setFocusable(false);
+		et_trave_linkman.setFocusable(false);
+		et_extra_endtime.setFocusable(false);
+		et_extra_starttime.setFocusable(false);
+		
+
 		et_extra_endtime.setOnClickListener(this);
 		et_extra_starttime.setOnClickListener(this);
-		et_trave_linkman.setKeyListener(null);
 		et_trave_linkman.setOnClickListener(this);
-
 		bt_save.setOnClickListener(this);
 		bt_commit.setOnClickListener(this);
 		bt_add.setOnClickListener(this);
 		bt_update.setOnClickListener(this);
 		bt_uncommit.setOnClickListener(this);
-
-
+		et_trave_type.setOnClickListener(this);
+		et_extra_sign.setOnClickListener(this);
 		et_trave_linkman.setText(CommonUtil.getSharedPreferences(this, "erp_emname"));
-
 	}
 
 	protected void initDataFromServer(List<TravelEntity> leaveEntities,

+ 22 - 6
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/erp/activity/WorkExtraActivity.java

@@ -198,7 +198,8 @@ public class WorkExtraActivity extends BaseActivity implements OnClickListener {
                             bt_commit.setChecked(false);
                             bt_update.setTextColor(getResources().getColor(
                                     R.color.black));
-                            bt_update.setEnabled(true);          bt_update.setChecked(false);
+                            bt_update.setEnabled(true);
+                            bt_update.setChecked(false);
                             bt_uncommit.setTextColor(getResources().getColor(
                                     R.color.gray));
                             bt_uncommit.setEnabled(false);
@@ -359,6 +360,7 @@ public class WorkExtraActivity extends BaseActivity implements OnClickListener {
         setContentView(R.layout.act_extra_work);
         ViewUtils.inject(this);
         ct = this;
+        getSupportActionBar().setTitle("加班申请");
         progressDialog = new CustomProgressDialog(ct).createDialog(this);
         et_extra_type.setKeyListener(null);
         et_extra_no.setKeyListener(null);
@@ -367,6 +369,16 @@ public class WorkExtraActivity extends BaseActivity implements OnClickListener {
         et_extra_starttime.setKeyListener(null);
         et_extra_isallday.setKeyListener(null);
         et_extra_type.setKeyListener(null);
+        et_extra_mankind.setKeyListener(null);
+
+        et_extra_type.setFocusable(false);
+        et_extra_no.setFocusable(false);
+        et_extra_company.setFocusable(false);
+        et_extra_endtime.setFocusable(false);
+        et_extra_starttime.setFocusable(false);
+        et_extra_isallday.setFocusable(false);
+        et_extra_type.setFocusable(false);
+        et_extra_mankind.setFocusable(false);
 
         et_extra_company.setOnClickListener(this);
         et_extra_company.setText(CommonUtil.getSharedPreferences(this, "erp_emname"));
@@ -382,8 +394,8 @@ public class WorkExtraActivity extends BaseActivity implements OnClickListener {
         bt_uncommit.setOnClickListener(this);
         bt_update.setOnClickListener(this);
         et_extra_type.setOnClickListener(this);
-        getSupportActionBar().setTitle("加班申请");
-        et_extra_mankind.setOnKeyListener(null);
+
+
         et_extra_mankind.setOnClickListener(this);
     }
 
@@ -444,11 +456,11 @@ public class WorkExtraActivity extends BaseActivity implements OnClickListener {
                 break;
             case R.id.bt_add:   //新增
                 httpAdd();
-            if (bt_add.isEnabled()){
+                if (bt_add.isEnabled()) {
 
-            }else {
+                } else {
 
-            }
+                }
                 break;
             case R.id.bt_commit://提交
                 httpCommit();
@@ -760,6 +772,7 @@ public class WorkExtraActivity extends BaseActivity implements OnClickListener {
         bt_update.setEnabled(false);
         bt_update.setChecked(true);
     }
+
     public void editnoclik() {
         et_extra_company.setEnabled(false);
         et_extra_type.setEnabled(false);
@@ -770,6 +783,7 @@ public class WorkExtraActivity extends BaseActivity implements OnClickListener {
         et_extra_starttime.setEnabled(false);
         et_extra_remark.setEnabled(false);
     }
+
     public void editclik() {
         et_extra_company.setEnabled(true);
         et_extra_type.setEnabled(true);
@@ -780,6 +794,7 @@ public class WorkExtraActivity extends BaseActivity implements OnClickListener {
         et_extra_starttime.setEnabled(true);
         et_extra_remark.setEnabled(true);
     }
+
     @Override
     protected void onActivityResult(int requestCode, int resultCode, Intent data) {
         switch (requestCode) {
@@ -795,6 +810,7 @@ public class WorkExtraActivity extends BaseActivity implements OnClickListener {
         }
         super.onActivityResult(requestCode, resultCode, data);
     }
+
     public void loadDataForServer(String field, int what) {
         Log.i("leave", "what=" + what);
         String url = Constants.getAppBaseUrl(ct) + "mobile/common/getCombo.action";

+ 4 - 3
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/erp/activity/crm/BusinessDetailActivty.java

@@ -387,10 +387,11 @@ public class BusinessDetailActivty extends BaseActivity {
                 case BUSINESS_QIANG:
                     Log.i(TAG, "handleMessage:" + msg.getData().getString("result"));
                     progressDialog.dismiss();
-                    ToastMessage("抢商机成功!");
+                    Crouton.makeText(BusinessDetailActivty.this,45,"成功抢得此商机,\n" +
+                            "请到商机跟进中查看商机!\n",
+                            getResources().getColor(R.color.light_green),
+                            5000).show();
                     sendHttpResquest(Constants.HTTP_SUCCESS_INIT, page = 1);
-//                    startActivity(new Intent(ct, BusinessActivity.class));
-//                    finish();
                     break;
                 case BUSINESS_FENPEI:
                     progressDialog.dismiss();

+ 57 - 28
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/erp/activity/crm/BusinessDetailInfoActivity.java

@@ -22,6 +22,7 @@ import android.widget.TextView;
 import com.afollestad.materialdialogs.GravityEnum;
 import com.afollestad.materialdialogs.MaterialDialog;
 import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.lidroid.xutils.ViewUtils;
 import com.lidroid.xutils.view.annotation.ViewInject;
@@ -57,8 +58,8 @@ public class BusinessDetailInfoActivity extends BaseActivity implements View.OnC
     private Button bt_manage_date;
     @ViewInject(R.id.bt_zhuanyi)
     private Button bt_zhuanyi;
- 
-    
+
+
     @ViewInject(R.id.bt_manage_go)
     private Button bt_manage_go;
     @ViewInject(R.id.crm_ll_followup)
@@ -80,27 +81,27 @@ public class BusinessDetailInfoActivity extends BaseActivity implements View.OnC
     @ViewInject(R.id.bc_code)
     private TextView bc_code;
     @ViewInject(R.id.bc_description)
-    private TextView  bc_description;
+    private TextView bc_description;
     @ViewInject(R.id.bc_nichehouse)
     private TextView bc_nichehouse;
     @ViewInject(R.id.bc_type)
-    private TextView  bc_type;
+    private TextView bc_type;
     @ViewInject(R.id.bc_currentprocess)
-    private TextView  bc_currentprocess;
+    private TextView bc_currentprocess;
     @ViewInject(R.id.bc_lastdate)
-    private TextView  bc_lastdate;
+    private TextView bc_lastdate;
     @ViewInject(R.id.bc_doman)
-    private TextView  bc_doman;
+    private TextView bc_doman;
     @ViewInject(R.id.bc_custname)
-    private TextView  bc_custname;
+    private TextView bc_custname;
     @ViewInject(R.id.bc_address)
-    private TextView        bc_address;
+    private TextView bc_address;
     @ViewInject(R.id.bc_contact)
     private TextView bc_contact;
     @ViewInject(R.id.bc_position)
-    private TextView       bc_position;
+    private TextView bc_position;
     @ViewInject(R.id.bt_tel)
-    private TextView  bt_tel;
+    private TextView bt_tel;
 
     @Override
     protected void onCreate(Bundle savedInstanceState) {
@@ -168,16 +169,13 @@ public class BusinessDetailInfoActivity extends BaseActivity implements View.OnC
                 showPopupWindow(v.findViewById(R.id.bt_manage_go));
                 break;
             case R.id.bt_manage_date:
-                Intent intent = new Intent(ct, TaskAddActivity.class);
-                intent.putExtra("type", 1);
-                intent.putExtra("data", bt_code);
-                startActivityForResult(intent, 0x11);
+                isEnableClick(bt_code,5);
                 break;
             case R.id.bt_qiang:
                 progressDialog.show();
                 String url = Constants.getAppBaseUrl(ct) + "mobile/crm/ifoverrecv.action";
-                Map<String,Object> stringMap = new HashMap<String, Object>();
-                stringMap.put("emcode",CommonUtil.getSharedPreferences(ct, "erp_username"));
+                Map<String, Object> stringMap = new HashMap<String, Object>();
+                stringMap.put("emcode", CommonUtil.getSharedPreferences(ct, "erp_username"));
 
                 LinkedHashMap<String, Object> headers = new LinkedHashMap<>();
                 headers.put("Cookie", "JSESSIONID=" + CommonUtil.getSharedPreferences(ct, "sessionId"));
@@ -338,7 +336,7 @@ public class BusinessDetailInfoActivity extends BaseActivity implements View.OnC
                         bc_lastdate.setText(root.getString("bc_lastdate"));
                         bc_recorder.setText(root.getString("bc_recorder"));
                         bc_remark.setText(root.getString("bc_remark"));
-                        
+
                         bc_doman.setText(root.getString("bc_doman"));
                         bc_code.setText(root.getString("bc_code"));
                         bc_address.setText(root.getString("bc_address"));
@@ -348,7 +346,7 @@ public class BusinessDetailInfoActivity extends BaseActivity implements View.OnC
                         bc_description.setText(root.getString("bc_description"));
                         bc_currentprocess.setText(root.getString("bc_currentprocess"));
                         bc_type.setText(root.getString("bc_type"));
-                        
+
                         bt_doman = root.getString("bc_doman");
                         bt_code = root.getString("bc_code");
                         bt_process = root.getString("bc_currentprocess");
@@ -356,10 +354,17 @@ public class BusinessDetailInfoActivity extends BaseActivity implements View.OnC
                     break;
                 case BUSINESS_QIANG:
                     Log.i(TAG, "handleMessage:" + msg.getData().getString("result"));
-                    // ViewUtil.ToastMessage(ct, msg.getData().getString("result"));
                     progressDialog.dismiss();
-                    ToastMessage("抢商机成功!");
-                    finish();
+                    Crouton.makeText(activity,45,"成功抢得此商机,\n" +
+                                    "请到商机跟进中查看商机!\n",
+                            getResources().getColor(R.color.light_green),
+                            5000).show();
+                   new Handler().postDelayed(new Runnable() {
+                      @Override
+                      public void run() {
+                          finish();
+                      }
+                  },5000);
 //                    startActivity(new Intent(ct, BusinessDetailActivty.class).putExtra("bt_type",1));
                     break;
                 case BUSINESS_FENPEI:
@@ -377,15 +382,28 @@ public class BusinessDetailInfoActivity extends BaseActivity implements View.OnC
                 case CAN_QIANG_NOT:
                     JSONObject result = JSON.parseObject(msg.getData().getString("result"));
                     String isok = result.getString("isok");
-                    if ("0".equals(isok)){
+                    if ("0".equals(isok)) {
                         Log.i("qiang", isok);
                         sendHttpBusinessQiang(BUSINESS_QIANG, bt_code, bt_doman);
-                    }else if ("1".equals(isok)){
-                        Log.i("qiang",isok);
+                    } else if ("1".equals(isok)) {
+                        Log.i("qiang", isok);
                         progressDialog.dismiss();
                         Crouton.makeText(BusinessDetailInfoActivity.this, "您已超出最大获取商机数!", 0xffff4444, 2000).show();
                     }
-
+                case 5:
+                     result = JSON.parseObject(msg.getData().getString("result"));
+                    JSONArray items=result.getJSONArray("result");
+                    if (items!=null){
+                        if (items.size()>0){
+                            Crouton.makeText(BusinessDetailInfoActivity.this, "不能重复添加到日程!", 0xffff4444, 2000).show();
+                        }else{
+                            Intent intent = new Intent(ct, TaskAddActivity.class);
+                            intent.putExtra("type", 1);
+                            intent.putExtra("data", bt_code);
+                            startActivityForResult(intent, 0x11);
+                        }
+                    }
+                    break;
                 case Constants.APP_SOCKETIMEOUTEXCEPTION:
                     progressDialog.dismiss();
                     Log.i(TAG, "handleMessage:" + msg.getData().getString("result"));
@@ -397,7 +415,7 @@ public class BusinessDetailInfoActivity extends BaseActivity implements View.OnC
 
     private void jumpToStateActivity() {
         Intent intent = new Intent();
-        intent.setClass(BusinessDetailInfoActivity.this,BusinessStateActivity.class);
+        intent.setClass(BusinessDetailInfoActivity.this, BusinessStateActivity.class);
         startActivity(intent);
     }
 
@@ -406,7 +424,7 @@ public class BusinessDetailInfoActivity extends BaseActivity implements View.OnC
         String url = Constants.getAppBaseUrl(ct) + "mobile/common/getPanel.action";
         Map<String, Object> params = new HashMap<>();
         params.put("caller", "BusinessChance");
-        if (type==0)formCondition="bc_id"+formCondition;
+        if (type == 0) formCondition = "bc_id" + formCondition;
         params.put("formCondition", formCondition);
         params.put("gridCondition", gridCondition);
         LinkedHashMap<String, Object> headers = new LinkedHashMap<>();
@@ -442,6 +460,17 @@ public class BusinessDetailInfoActivity extends BaseActivity implements View.OnC
 
     }
 
+    public void isEnableClick(String bt_code,int what){
+        String url = Constants.getAppBaseUrl(ct) + "mobile/crm/getSchedule.action";
+        progressDialog.show();
+        Map<String, Object> params = new HashMap<>();
+        params.put("bccode", bt_code);
+        params.put("emname", MyApplication.getInstance().mLoginUser.getNickName());
+        LinkedHashMap<String, Object> headers = new LinkedHashMap<>();
+        headers.put("Cookie", "JSESSIONID=" + CommonUtil.getSharedPreferences(ct, "sessionId"));
+        ViewUtil.httpSendRequest(ct, url, params, mHandler, headers, what, null, null, "post");
+    }
+    
     @Override
     protected void onActivityResult(int requestCode, int resultCode, Intent data) {
         switch (requestCode) {

+ 8 - 3
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/erp/activity/crm/BusinessLessActivity.java

@@ -180,7 +180,7 @@ public class BusinessLessActivity extends BaseActivity implements View.OnClickLi
         ViewUtil.httpSendRequest(ct, url, params, mHandler, headers, what, null, null, "post");
     }
 
-    private void sendHttpResquest(int what, String type) {
+    private void sendHttpResquest(int what, String typeStr) {
         progressDialog.show();
         String remark = et_remark.getText().toString();
         String gridSore = "{\n" +
@@ -189,13 +189,18 @@ public class BusinessLessActivity extends BaseActivity implements View.OnClickLi
                 "\"bcd_leader\":\"" + tv_leader.getText().toString() + "\",\n" +
                 "\"bcd_date\":\"" + tv_date.getText().toString() + "\",\n" +
                 "\"bcd_bsname\":\"" + process + "\",\n" +
-                "\"bcd_type\":\"" + type + "\",\n" +
+                "\"bcd_type\":\"" + typeStr + "\",\n" +
                 "\"bcd_man\":\"" + MyApplication.getInstance().mLoginUser.getNickName()+ "\"" + (this.type == 1 ? ",\n\"bcd_code\":\"" + bcd_code + "\"\n" : "") +
                 "}";
         String url = Constants.getAppBaseUrl(ct) + "mobile/crm/updatebusinessChanceData.action";
         Map<String, Object> params = new HashMap<>();
         params.put("gridStore", gridSore);
-        params.put("caller", "BusinessChance");
+        if (type==1){
+            params.put("caller", "BusinessChanceData");//BusinessChance
+        }else{
+            params.put("caller", "BusinessChanceData");
+        }
+       
         LinkedHashMap<String, Object> headers = new LinkedHashMap<>();
         headers.put("Cookie", "JSESSIONID=" + CommonUtil.getSharedPreferences(ct, "sessionId"));
         ViewUtil.httpSendRequest(ct, url, params, mHandler, headers, what, null, null, "post");

+ 1 - 1
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/erp/db/DBManager.java

@@ -162,7 +162,7 @@ public class DBManager {
         for (int i = 0; i < employeesEntities.size(); i++) {
             EmployeesEntity entity = employeesEntities.get(i);
             sta.bindString(1, String.valueOf(entity.getEM_ID()));
-            sta.bindString(2, entity.getEM_CODE());
+            sta.bindString(2, entity.getEM_CODE()==null?"null":entity.getEM_CODE());
             sta.bindString(3, entity.getEM_NAME());
             sta.bindString(4, entity.getEM_POSITION());
             sta.bindString(5, entity.getEM_DEFAULTORNAME() == null ? "未填写" : entity.getEM_DEFAULTORNAME());

+ 19 - 0
WeiChat/src/main/java/com/xzjmyk/pm/activity/view/crouton/Crouton.java

@@ -208,6 +208,25 @@ public final class Crouton {
     Configuration customConfiguration = new Configuration.Builder().setDuration(time).build();
     return new Crouton(activity, text, customColor).setConfiguration(customConfiguration);
   }
+
+  /**
+   * 自定义设置背景色,延时时间
+   * @param activity
+   * @param text
+   * @param color
+   * @param time
+   * @return
+   */
+  public static Crouton makeText(Activity activity,int hight, CharSequence text, int color, int time){
+    Style customColor = new Style.Builder().setBackgroundColorValue(color)
+            .setHeight(
+                    (int)TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
+                            hight,
+                            activity.getResources().getDisplayMetrics())
+            ).build();
+    Configuration customConfiguration = new Configuration.Builder().setDuration(time).build();
+    return new Crouton(activity, text, customColor).setConfiguration(customConfiguration);
+  }
   /**
    * Creates a {@link Crouton} with provided text and style for a given
    * activity.

+ 536 - 478
WeiChat/src/main/java/com/xzjmyk/pm/activity/view/crouton/Style.java

@@ -15,6 +15,21 @@
  */
 
 package com.xzjmyk.pm.activity.view.crouton;
+/*
+ * Copyright 2012 - 2014 Benjamin Weiss
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 import android.graphics.drawable.Drawable;
 import android.view.Gravity;
@@ -22,544 +37,587 @@ import android.view.ViewGroup.LayoutParams;
 import android.widget.ImageView;
 
 
-/** The style for a {@link Crouton}. */
+/**
+ * The style for a {@link Crouton}.
+ */
 public class Style {
-  
-  public static final int NOT_SET = -1;
-
-  public static final int holoRedLight = 0xffff4444;
-  public static final int holoGreenLight = 0xff99cc00;
-  public static final int holoBlueLight = 0xff33b5e5;
-
-  /** Default style for alerting the user. */
-  public static final Style ALERT;
-  /** Default style for confirming an action. */
-  public static final Style CONFIRM;
-  /** Default style for general information. */
-  public static final Style INFO;
-
-  static {
-    ALERT = new Builder()
-      .setBackgroundColorValue(holoRedLight)
-      .build();
-    CONFIRM = new Builder()
-      .setBackgroundColorValue(holoGreenLight)
-      .build();
-    INFO = new Builder()
-      .setBackgroundColorValue(holoBlueLight)
-      .build();
-  }
-
-  /**
-   * The {@link Configuration} for this {@link Style}.
-   * It can be overridden via {@link Crouton#setConfiguration(Configuration)}.
-   */
-  final Configuration configuration;
-
-  /**
-   * The resource id of the backgroundResourceId.
-   * <p/>
-   * 0 for no backgroundResourceId.
-   */
-  final int backgroundColorResourceId;
-
-  /**
-   * The resource id of the backgroundDrawableResourceId.
-   * <p/>
-   * 0 for no backgroundDrawableResourceId.
-   */
-  final int backgroundDrawableResourceId;
-
-  /**
-   * The backgroundColorResourceValue's e.g. 0xffff4444;
-   * <p/>
-   * NOT_SET for no value.
-   */
-  final int backgroundColorValue;
-
-  /** Whether we should isTileEnabled the backgroundResourceId or not. */
-  final boolean isTileEnabled;
-
-  /**
-   * The text colorResourceId's resource id.
-   * <p/>
-   * 0 sets the text colorResourceId to the system theme default.
-   */
-  final int textColorResourceId;
-
-  /**
-   * The textColorResourceValue's e.g. 0xffff4444;
-   * <p/>
-   * NOT_SET for no value.
-   */
-  final int textColorValue;
-
-  /** The height of the {@link Crouton} in pixels. */
-  final int heightInPixels;
-
-  /** Resource ID for the height of the {@link Crouton}. */
-  final int heightDimensionResId;
-
-  /** The width of the {@link Crouton} in pixels. */
-  final int widthInPixels;
-
-  /** Resource ID for the width of the {@link Crouton}. */
-  final int widthDimensionResId;
-
-  /** The text's gravity as provided by {@link Gravity}. */
-  final int gravity;
-
-  /** An additional image to display in the {@link Crouton}. */
-  final Drawable imageDrawable;
-
-  /** An additional image to display in the {@link Crouton}. */
-  final int imageResId;
-
-  /** The {@link ImageView.ScaleType} for the image to display in the {@link Crouton}. */
-  final ImageView.ScaleType imageScaleType;
-
-  /**
-   * The text size in sp
-   * <p/>
-   * 0 sets the text size to the system theme default
-   */
-  final int textSize;
-
-  /** The text shadow color's resource id */
-  final int textShadowColorResId;
-
-  /** The text shadow radius */
-  final float textShadowRadius;
-
-  /** The text shadow vertical offset */
-  final float textShadowDy;
-
-  /** The text shadow horizontal offset */
-  final float textShadowDx;
-
-  /** The text appearance resource id for the text. */
-  final int textAppearanceResId;
-
-  /** The padding for the crouton view content in pixels */
-  final int paddingInPixels;
-
-  /** The resource id for the padding for the view content */
-  final int paddingDimensionResId;
-
-  /** The file path and font name for the view content */
-  final String fontName;
-
-  /** The file path and font name resource id for the view content */
-  final int fontNameResId;
-
-  private Style(final Builder builder) {
-    this.configuration = builder.configuration;
-    this.backgroundColorResourceId = builder.backgroundColorResourceId;
-    this.backgroundDrawableResourceId = builder.backgroundDrawableResourceId;
-    this.isTileEnabled = builder.isTileEnabled;
-    this.textColorResourceId = builder.textColorResourceId;
-    this.textColorValue = builder.textColorValue;
-    this.heightInPixels = builder.heightInPixels;
-    this.heightDimensionResId = builder.heightDimensionResId;
-    this.widthInPixels = builder.widthInPixels;
-    this.widthDimensionResId = builder.widthDimensionResId;
-    this.gravity = builder.gravity;
-    this.imageDrawable = builder.imageDrawable;
-    this.textSize = builder.textSize;
-    this.textShadowColorResId = builder.textShadowColorResId;
-    this.textShadowRadius = builder.textShadowRadius;
-    this.textShadowDx = builder.textShadowDx;
-    this.textShadowDy = builder.textShadowDy;
-    this.textAppearanceResId = builder.textAppearanceResId;
-    this.imageResId = builder.imageResId;
-    this.imageScaleType = builder.imageScaleType;
-    this.paddingInPixels = builder.paddingInPixels;
-    this.paddingDimensionResId = builder.paddingDimensionResId;
-    this.backgroundColorValue = builder.backgroundColorValue;
-    this.fontName = builder.fontName;
-    this.fontNameResId = builder.fontNameResId;
-  }
-
-  /** Builder for the {@link Style} object. */
-  public static class Builder {
-    private Configuration configuration;
-    private int backgroundColorValue;
-    private int backgroundColorResourceId;
-    private int backgroundDrawableResourceId;
-    private boolean isTileEnabled;
-    private int textColorResourceId;
-    private int textColorValue;
-    private int heightInPixels;
-    private int heightDimensionResId;
-    private int widthInPixels;
-    private int widthDimensionResId;
-    private int gravity;
-    private Drawable imageDrawable;
-    private int textSize;
-    private int textShadowColorResId;
-    private float textShadowRadius;
-    private float textShadowDx;
-    private float textShadowDy;
-    private int textAppearanceResId;
-    private int imageResId;
-    private ImageView.ScaleType imageScaleType;
-    private int paddingInPixels;
-    private int paddingDimensionResId;
-    private String fontName;
-    private int fontNameResId;
-
-    /** Creates a {@link Builder} to build a {@link Style} upon. */
-    public Builder() {
-      configuration = Configuration.DEFAULT;
-      paddingInPixels = 10;
-      backgroundColorResourceId = android.R.color.holo_blue_light;
-      backgroundDrawableResourceId = 0;
-      backgroundColorValue = NOT_SET;
-      isTileEnabled = false;
-      textColorResourceId = android.R.color.white;
-      textColorValue = NOT_SET;
-//      heightInPixels = LayoutParams.WRAP_CONTENT;
-      heightInPixels = 100;
-      widthInPixels = LayoutParams.MATCH_PARENT;
-      gravity = Gravity.CENTER;
-      imageDrawable = null;
-      imageResId = 0;
-      imageScaleType = ImageView.ScaleType.FIT_XY;
-      fontName = null;
-      fontNameResId = 0;
-    }
+
+    public static final int NOT_SET = -1;
+
+    public static final int holoRedLight = 0xffff4444;
+    public static final int holoGreenLight = 0xff99cc00;
+    public static final int holoBlueLight = 0xff33b5e5;
 
     /**
-     * Creates a {@link Builder} to build a {@link Style} upon.
-     *
-     * @param baseStyle
-     *   The base {@link Style} to use for this {@link Style}.
+     * Default style for alerting the user.
      */
-    public Builder(final Style baseStyle) {
-      configuration = baseStyle.configuration;
-      backgroundColorValue = baseStyle.backgroundColorValue;
-      backgroundColorResourceId = baseStyle.backgroundColorResourceId;
-      backgroundDrawableResourceId = baseStyle.backgroundDrawableResourceId;
-      isTileEnabled = baseStyle.isTileEnabled;
-      textColorResourceId = baseStyle.textColorResourceId;
-      textColorValue = baseStyle.textColorValue;
-      heightInPixels = baseStyle.heightInPixels;
-      heightDimensionResId = baseStyle.heightDimensionResId;
-      widthInPixels = baseStyle.widthInPixels;
-      widthDimensionResId = baseStyle.widthDimensionResId;
-      gravity = baseStyle.gravity;
-      imageDrawable = baseStyle.imageDrawable;
-      textSize = baseStyle.textSize;
-      textShadowColorResId = baseStyle.textShadowColorResId;
-      textShadowRadius = baseStyle.textShadowRadius;
-      textShadowDx = baseStyle.textShadowDx;
-      textShadowDy = baseStyle.textShadowDy;
-      textAppearanceResId = baseStyle.textAppearanceResId;
-      imageResId = baseStyle.imageResId;
-      imageScaleType = baseStyle.imageScaleType;
-      paddingInPixels = baseStyle.paddingInPixels;
-      paddingDimensionResId = baseStyle.paddingDimensionResId;
-      fontName = baseStyle.fontName;
-      fontNameResId = baseStyle.fontNameResId;
-    }
+    public static final Style ALERT;
     /**
-     * Set the {@link Configuration} option of the {@link Crouton}.
-     *
-     * @param configuration
-     *   The {@link Configuration}.
-     *
-     * @return the {@link Builder}.
+     * Default style for confirming an action.
      */
-    public Builder setConfiguration(Configuration configuration) {
-      this.configuration = configuration;
-      return this;
-    }
-
+    public static final Style CONFIRM;
     /**
-     * Set the backgroundColorResourceId option of the {@link Crouton}.
-     *
-     * @param backgroundColorResourceId
-     *   The backgroundColorResourceId's resource id.
-     *
-     * @return the {@link Builder}.
+     * Default style for general information.
      */
-    public Builder setBackgroundColor(int backgroundColorResourceId) {
-      this.backgroundColorResourceId = backgroundColorResourceId;
-
-      return this;
+    public static final Style INFO;
+
+    static {
+        ALERT = new Builder()
+                .setBackgroundColorValue(holoRedLight)
+                .build();
+        CONFIRM = new Builder()
+                .setBackgroundColorValue(holoGreenLight)
+                .build();
+        INFO = new Builder()
+                .setBackgroundColorValue(holoBlueLight)
+                .build();
     }
 
     /**
-     * Set the backgroundColorResourceValue option of the {@link Crouton}.
-     *
-     * @param backgroundColorValue
-     *   The backgroundColorResourceValue's e.g. 0xffff4444;
-     *
-     * @return the {@link Builder}.
+     * The {@link Configuration} for this {@link Style}.
+     * It can be overridden via {@link Crouton#setConfiguration(Configuration)}.
      */
-    public Builder setBackgroundColorValue(int backgroundColorValue) {
-      this.backgroundColorValue = backgroundColorValue;
-      return this;
-    }
+    final Configuration configuration;
 
     /**
-     * Set the backgroundDrawableResourceId option for the {@link Crouton}.
-     *
-     * @param backgroundDrawableResourceId
-     *   Resource ID of a backgroundDrawableResourceId image drawable.
-     *
-     * @return the {@link Builder}.
+     * The resource id of the backgroundResourceId.
+     * <p/>
+     * 0 for no backgroundResourceId.
      */
-    public Builder setBackgroundDrawable(int backgroundDrawableResourceId) {
-      this.backgroundDrawableResourceId = backgroundDrawableResourceId;
-
-      return this;
-    }
+    final int backgroundColorResourceId;
 
     /**
-     * Set the heightInPixels option for the {@link Crouton}.
-     *
-     * @param height
-     *   The height of the {@link Crouton} in pixel. Can also be
-     *   {@link LayoutParams#MATCH_PARENT} or
-     *   {@link LayoutParams#WRAP_CONTENT}.
-     *
-     * @return the {@link Builder}.
+     * The resource id of the backgroundDrawableResourceId.
+     * <p/>
+     * 0 for no backgroundDrawableResourceId.
      */
-    public Builder setHeight(int height) {
-      this.heightInPixels = height;
-
-      return this;
-    }
+    final int backgroundDrawableResourceId;
 
     /**
-     * Set the resource id for the height option for the {@link Crouton}.
-     *
-     * @param heightDimensionResId
-     *   Resource ID of a dimension for the height of the {@link Crouton}.
-     *
-     * @return the {@link Builder}.
+     * The backgroundColorResourceValue's e.g. 0xffff4444;
+     * <p/>
+     * NOT_SET for no value.
      */
-    public Builder setHeightDimensionResId(int heightDimensionResId) {
-      this.heightDimensionResId = heightDimensionResId;
-
-      return this;
-    }
+    final int backgroundColorValue;
 
     /**
-     * Set the widthInPixels option for the {@link Crouton}.
-     *
-     * @param width
-     *   The width of the {@link Crouton} in pixel. Can also be
-     *   {@link LayoutParams#MATCH_PARENT} or
-     *   {@link LayoutParams#WRAP_CONTENT}.
-     *
-     * @return the {@link Builder}.
+     * Whether we should isTileEnabled the backgroundResourceId or not.
      */
-    public Builder setWidth(int width) {
-      this.widthInPixels = width;
-
-      return this;
-    }
+    final boolean isTileEnabled;
 
     /**
-     * Set the resource id for the width option for the {@link Crouton}.
-     *
-     * @param widthDimensionResId
-     *   Resource ID of a dimension for the width of the {@link Crouton}.
-     *
-     * @return the {@link Builder}.
+     * The text colorResourceId's resource id.
+     * <p/>
+     * 0 sets the text colorResourceId to the system theme default.
      */
-    public Builder setWidthDimensionResId(int widthDimensionResId) {
-      this.widthDimensionResId = widthDimensionResId;
-
-      return this;
-    }
+    final int textColorResourceId;
 
     /**
-     * Set the isTileEnabled option for the {@link Crouton}.
-     *
-     * @param isTileEnabled
-     *   <code>true</code> if you want the backgroundResourceId to be
-     *   tiled, else <code>false</code>.
-     *
-     * @return the {@link Builder}.
+     * The textColorResourceValue's e.g. 0xffff4444;
+     * <p/>
+     * NOT_SET for no value.
      */
-    public Builder setTileEnabled(boolean isTileEnabled) {
-      this.isTileEnabled = isTileEnabled;
-
-      return this;
-    }
+    final int textColorValue;
 
     /**
-     * Set the textColorResourceId option for the {@link Crouton}.
-     *
-     * @param textColor
-     *   The resource id of the text colorResourceId.
-     *
-     * @return the {@link Builder}.
+     * The height of the {@link Crouton} in pixels.
      */
-    public Builder setTextColor(int textColor) {
-      this.textColorResourceId = textColor;
-
-      return this;
-    }
+    final int heightInPixels;
 
     /**
-     * Set the textColorResourceValue option of the {@link Crouton}.
-     *
-     * @param textColorValue
-     *   The textColorResourceValue's e.g. 0xffff4444;
-     *
-     * @return the {@link Builder}.
+     * Resource ID for the height of the {@link Crouton}.
      */
-    public Builder setTextColorValue(int textColorValue) {
-      this.textColorValue = textColorValue;
-      return this;
-    }
+    final int heightDimensionResId;
 
     /**
-     * Set the gravity option for the {@link Crouton}.
-     *
-     * @param gravity
-     *   The text's gravity as provided by {@link Gravity}.
-     *
-     * @return the {@link Builder}.
+     * The width of the {@link Crouton} in pixels.
      */
-    public Builder setGravity(int gravity) {
-      this.gravity = gravity;
+    final int widthInPixels;
 
-      return this;
-    }
+    /**
+     * Resource ID for the width of the {@link Crouton}.
+     */
+    final int widthDimensionResId;
 
     /**
-     * Set the image option for the {@link Crouton}.
-     *
-     * @param imageDrawable
-     *   An additional image to display in the {@link Crouton}.
-     *
-     * @return the {@link Builder}.
+     * The text's gravity as provided by {@link Gravity}.
      */
-    public Builder setImageDrawable(Drawable imageDrawable) {
-      this.imageDrawable = imageDrawable;
+    final int gravity;
 
-      return this;
-    }
+    /**
+     * An additional image to display in the {@link Crouton}.
+     */
+    final Drawable imageDrawable;
 
     /**
-     * Set the image resource option for the {@link Crouton}.
-     *
-     * @param imageResId
-     *   An additional image to display in the {@link Crouton}.
-     *
-     * @return the {@link Builder}.
+     * An additional image to display in the {@link Crouton}.
      */
-    public Builder setImageResource(int imageResId) {
-      this.imageResId = imageResId;
+    final int imageResId;
 
-      return this;
-    }
+    /**
+     * The {@link ImageView.ScaleType} for the image to display in the {@link Crouton}.
+     */
+    final ImageView.ScaleType imageScaleType;
 
-    /** The text size in sp. */
-    public Builder setTextSize(int textSize) {
-      this.textSize = textSize;
-      return this;
-    }
+    /**
+     * The text size in sp
+     * <p/>
+     * 0 sets the text size to the system theme default
+     */
+    final int textSize;
 
-    /** The text shadow color resource id. */
-    public Builder setTextShadowColor(int textShadowColorResId) {
-      this.textShadowColorResId = textShadowColorResId;
-      return this;
-    }
+    /**
+     * The text shadow color's resource id
+     */
+    final int textShadowColorResId;
 
-    /** The text shadow radius. */
-    public Builder setTextShadowRadius(float textShadowRadius) {
-      this.textShadowRadius = textShadowRadius;
-      return this;
-    }
+    /**
+     * The text shadow radius
+     */
+    final float textShadowRadius;
 
-    /** The text shadow horizontal offset. */
-    public Builder setTextShadowDx(float textShadowDx) {
-      this.textShadowDx = textShadowDx;
-      return this;
-    }
+    /**
+     * The text shadow vertical offset
+     */
+    final float textShadowDy;
 
-    /** The text shadow vertical offset. */
-    public Builder setTextShadowDy(float textShadowDy) {
-      this.textShadowDy = textShadowDy;
-      return this;
-    }
+    /**
+     * The text shadow horizontal offset
+     */
+    final float textShadowDx;
 
-    /** The text appearance resource id for the text. */
-    public Builder setTextAppearance(int textAppearanceResId) {
-      this.textAppearanceResId = textAppearanceResId;
-      return this;
-    }
+    /**
+     * The text appearance resource id for the text.
+     */
+    final int textAppearanceResId;
 
-    /** The {@link ImageView.ScaleType} for the image. */
-    public Builder setImageScaleType(ImageView.ScaleType imageScaleType) {
-      this.imageScaleType = imageScaleType;
-      return this;
-    }
+    /**
+     * The padding for the crouton view content in pixels
+     */
+    final int paddingInPixels;
 
-    /** The padding for the crouton view's content in pixels. */
-    public Builder setPaddingInPixels(int padding) {
-      this.paddingInPixels = padding;
-      return this;
-    }
+    /**
+     * The resource id for the padding for the view content
+     */
+    final int paddingDimensionResId;
 
-    /** The resource id for the padding for the crouton view's content. */
-    public Builder setPaddingDimensionResId(int paddingResId) {
-      this.paddingDimensionResId = paddingResId;
-      return this;
-    }
+    /**
+     * The file path and font name for the view content
+     */
+    final String fontName;
 
-    /** The file path and name of the font for the crouton view's content. */
-    public Builder setFontName(String fontName) {
-      this.fontName = fontName;
-      return this;
+    /**
+     * The file path and font name resource id for the view content
+     */
+    final int fontNameResId;
+
+    private Style(final Builder builder) {
+        this.configuration = builder.configuration;
+        this.backgroundColorResourceId = builder.backgroundColorResourceId;
+        this.backgroundDrawableResourceId = builder.backgroundDrawableResourceId;
+        this.isTileEnabled = builder.isTileEnabled;
+        this.textColorResourceId = builder.textColorResourceId;
+        this.textColorValue = builder.textColorValue;
+        this.heightInPixels = builder.heightInPixels;
+        this.heightDimensionResId = builder.heightDimensionResId;
+        this.widthInPixels = builder.widthInPixels;
+        this.widthDimensionResId = builder.widthDimensionResId;
+        this.gravity = builder.gravity;
+        this.imageDrawable = builder.imageDrawable;
+        this.textSize = builder.textSize;
+        this.textShadowColorResId = builder.textShadowColorResId;
+        this.textShadowRadius = builder.textShadowRadius;
+        this.textShadowDx = builder.textShadowDx;
+        this.textShadowDy = builder.textShadowDy;
+        this.textAppearanceResId = builder.textAppearanceResId;
+        this.imageResId = builder.imageResId;
+        this.imageScaleType = builder.imageScaleType;
+        this.paddingInPixels = builder.paddingInPixels;
+        this.paddingDimensionResId = builder.paddingDimensionResId;
+        this.backgroundColorValue = builder.backgroundColorValue;
+        this.fontName = builder.fontName;
+        this.fontNameResId = builder.fontNameResId;
     }
 
-    /** The resource id for the file path and name of the font for the crouton view's content. */
-    public Builder setFontNameResId(int fontNameResId) {
-      this.fontNameResId = fontNameResId;
-      return this;
+    /**
+     * Builder for the {@link Style} object.
+     */
+    public static class Builder {
+        private Configuration configuration;
+        private int backgroundColorValue;
+        private int backgroundColorResourceId;
+        private int backgroundDrawableResourceId;
+        private boolean isTileEnabled;
+        private int textColorResourceId;
+        private int textColorValue;
+        private int heightInPixels;
+        private int heightDimensionResId;
+        private int widthInPixels;
+        private int widthDimensionResId;
+        private int gravity;
+        private Drawable imageDrawable;
+        private int textSize;
+        private int textShadowColorResId;
+        private float textShadowRadius;
+        private float textShadowDx;
+        private float textShadowDy;
+        private int textAppearanceResId;
+        private int imageResId;
+        private ImageView.ScaleType imageScaleType;
+        private int paddingInPixels;
+        private int paddingDimensionResId;
+        private String fontName;
+        private int fontNameResId;
+
+        /**
+         * Creates a {@link Builder} to build a {@link Style} upon.
+         */
+        public Builder() {
+            configuration = Configuration.DEFAULT;
+            paddingInPixels = 10;
+            backgroundColorResourceId = android.R.color.holo_blue_light;
+            backgroundDrawableResourceId = 0;
+            backgroundColorValue = NOT_SET;
+            isTileEnabled = false;
+            textColorResourceId = android.R.color.white;
+            textColorValue = NOT_SET;
+            heightInPixels = LayoutParams.WRAP_CONTENT;
+            widthInPixels = LayoutParams.MATCH_PARENT;
+            gravity = Gravity.CENTER;
+            imageDrawable = null;
+            imageResId = 0;
+            imageScaleType = ImageView.ScaleType.FIT_XY;
+            fontName = null;
+            fontNameResId = 0;
+        }
+
+        /**
+         * Creates a {@link Builder} to build a {@link Style} upon.
+         *
+         * @param baseStyle The base {@link Style} to use for this {@link Style}.
+         */
+        public Builder(final Style baseStyle) {
+            configuration = baseStyle.configuration;
+            backgroundColorValue = baseStyle.backgroundColorValue;
+            backgroundColorResourceId = baseStyle.backgroundColorResourceId;
+            backgroundDrawableResourceId = baseStyle.backgroundDrawableResourceId;
+            isTileEnabled = baseStyle.isTileEnabled;
+            textColorResourceId = baseStyle.textColorResourceId;
+            textColorValue = baseStyle.textColorValue;
+            heightInPixels = baseStyle.heightInPixels;
+            heightDimensionResId = baseStyle.heightDimensionResId;
+            widthInPixels = baseStyle.widthInPixels;
+            widthDimensionResId = baseStyle.widthDimensionResId;
+            gravity = baseStyle.gravity;
+            imageDrawable = baseStyle.imageDrawable;
+            textSize = baseStyle.textSize;
+            textShadowColorResId = baseStyle.textShadowColorResId;
+            textShadowRadius = baseStyle.textShadowRadius;
+            textShadowDx = baseStyle.textShadowDx;
+            textShadowDy = baseStyle.textShadowDy;
+            textAppearanceResId = baseStyle.textAppearanceResId;
+            imageResId = baseStyle.imageResId;
+            imageScaleType = baseStyle.imageScaleType;
+            paddingInPixels = baseStyle.paddingInPixels;
+            paddingDimensionResId = baseStyle.paddingDimensionResId;
+            fontName = baseStyle.fontName;
+            fontNameResId = baseStyle.fontNameResId;
+        }
+
+        /**
+         * Set the {@link Configuration} option of the {@link Crouton}.
+         *
+         * @param configuration The {@link Configuration}.
+         * @return the {@link Builder}.
+         */
+        public Builder setConfiguration(Configuration configuration) {
+            this.configuration = configuration;
+            return this;
+        }
+
+        /**
+         * Set the backgroundColorResourceId option of the {@link Crouton}.
+         *
+         * @param backgroundColorResourceId The backgroundColorResourceId's resource id.
+         * @return the {@link Builder}.
+         */
+        public Builder setBackgroundColor(int backgroundColorResourceId) {
+            this.backgroundColorResourceId = backgroundColorResourceId;
+
+            return this;
+        }
+
+        /**
+         * Set the backgroundColorResourceValue option of the {@link Crouton}.
+         *
+         * @param backgroundColorValue The backgroundColorResourceValue's e.g. 0xffff4444;
+         * @return the {@link Builder}.
+         */
+        public Builder setBackgroundColorValue(int backgroundColorValue) {
+            this.backgroundColorValue = backgroundColorValue;
+            return this;
+        }
+
+        /**
+         * Set the backgroundDrawableResourceId option for the {@link Crouton}.
+         *
+         * @param backgroundDrawableResourceId Resource ID of a backgroundDrawableResourceId image drawable.
+         * @return the {@link Builder}.
+         */
+        public Builder setBackgroundDrawable(int backgroundDrawableResourceId) {
+            this.backgroundDrawableResourceId = backgroundDrawableResourceId;
+
+            return this;
+        }
+
+        /**
+         * Set the heightInPixels option for the {@link Crouton}.
+         *
+         * @param height The height of the {@link Crouton} in pixel. Can also be
+         *               {@link LayoutParams#MATCH_PARENT} or
+         *               {@link LayoutParams#WRAP_CONTENT}.
+         * @return the {@link Builder}.
+         */
+        public Builder setHeight(int height) {
+            this.heightInPixels = height;
+
+            return this;
+        }
+
+        /**
+         * Set the resource id for the height option for the {@link Crouton}.
+         *
+         * @param heightDimensionResId Resource ID of a dimension for the height of the {@link Crouton}.
+         * @return the {@link Builder}.
+         */
+        public Builder setHeightDimensionResId(int heightDimensionResId) {
+            this.heightDimensionResId = heightDimensionResId;
+
+            return this;
+        }
+
+        /**
+         * Set the widthInPixels option for the {@link Crouton}.
+         *
+         * @param width The width of the {@link Crouton} in pixel. Can also be
+         *              {@link LayoutParams#MATCH_PARENT} or
+         *              {@link LayoutParams#WRAP_CONTENT}.
+         * @return the {@link Builder}.
+         */
+        public Builder setWidth(int width) {
+            this.widthInPixels = width;
+
+            return this;
+        }
+
+        /**
+         * Set the resource id for the width option for the {@link Crouton}.
+         *
+         * @param widthDimensionResId Resource ID of a dimension for the width of the {@link Crouton}.
+         * @return the {@link Builder}.
+         */
+        public Builder setWidthDimensionResId(int widthDimensionResId) {
+            this.widthDimensionResId = widthDimensionResId;
+
+            return this;
+        }
+
+        /**
+         * Set the isTileEnabled option for the {@link Crouton}.
+         *
+         * @param isTileEnabled <code>true</code> if you want the backgroundResourceId to be
+         *                      tiled, else <code>false</code>.
+         * @return the {@link Builder}.
+         */
+        public Builder setTileEnabled(boolean isTileEnabled) {
+            this.isTileEnabled = isTileEnabled;
+
+            return this;
+        }
+
+        /**
+         * Set the textColorResourceId option for the {@link Crouton}.
+         *
+         * @param textColor The resource id of the text colorResourceId.
+         * @return the {@link Builder}.
+         */
+        public Builder setTextColor(int textColor) {
+            this.textColorResourceId = textColor;
+
+            return this;
+        }
+
+        /**
+         * Set the textColorResourceValue option of the {@link Crouton}.
+         *
+         * @param textColorValue The textColorResourceValue's e.g. 0xffff4444;
+         * @return the {@link Builder}.
+         */
+        public Builder setTextColorValue(int textColorValue) {
+            this.textColorValue = textColorValue;
+            return this;
+        }
+
+        /**
+         * Set the gravity option for the {@link Crouton}.
+         *
+         * @param gravity The text's gravity as provided by {@link Gravity}.
+         * @return the {@link Builder}.
+         */
+        public Builder setGravity(int gravity) {
+            this.gravity = gravity;
+
+            return this;
+        }
+
+        /**
+         * Set the image option for the {@link Crouton}.
+         *
+         * @param imageDrawable An additional image to display in the {@link Crouton}.
+         * @return the {@link Builder}.
+         */
+        public Builder setImageDrawable(Drawable imageDrawable) {
+            this.imageDrawable = imageDrawable;
+
+            return this;
+        }
+
+        /**
+         * Set the image resource option for the {@link Crouton}.
+         *
+         * @param imageResId An additional image to display in the {@link Crouton}.
+         * @return the {@link Builder}.
+         */
+        public Builder setImageResource(int imageResId) {
+            this.imageResId = imageResId;
+
+            return this;
+        }
+
+        /**
+         * The text size in sp.
+         */
+        public Builder setTextSize(int textSize) {
+            this.textSize = textSize;
+            return this;
+        }
+
+        /**
+         * The text shadow color resource id.
+         */
+        public Builder setTextShadowColor(int textShadowColorResId) {
+            this.textShadowColorResId = textShadowColorResId;
+            return this;
+        }
+
+        /**
+         * The text shadow radius.
+         */
+        public Builder setTextShadowRadius(float textShadowRadius) {
+            this.textShadowRadius = textShadowRadius;
+            return this;
+        }
+
+        /**
+         * The text shadow horizontal offset.
+         */
+        public Builder setTextShadowDx(float textShadowDx) {
+            this.textShadowDx = textShadowDx;
+            return this;
+        }
+
+        /**
+         * The text shadow vertical offset.
+         */
+        public Builder setTextShadowDy(float textShadowDy) {
+            this.textShadowDy = textShadowDy;
+            return this;
+        }
+
+        /**
+         * The text appearance resource id for the text.
+         */
+        public Builder setTextAppearance(int textAppearanceResId) {
+            this.textAppearanceResId = textAppearanceResId;
+            return this;
+        }
+
+        /**
+         * The {@link android.widget.ImageView.ScaleType} for the image.
+         */
+        public Builder setImageScaleType(ImageView.ScaleType imageScaleType) {
+            this.imageScaleType = imageScaleType;
+            return this;
+        }
+
+        /**
+         * The padding for the crouton view's content in pixels.
+         */
+        public Builder setPaddingInPixels(int padding) {
+            this.paddingInPixels = padding;
+            return this;
+        }
+
+        /**
+         * The resource id for the padding for the crouton view's content.
+         */
+        public Builder setPaddingDimensionResId(int paddingResId) {
+            this.paddingDimensionResId = paddingResId;
+            return this;
+        }
+
+        /**
+         * The file path and name of the font for the crouton view's content.
+         */
+        public Builder setFontName(String fontName) {
+            this.fontName = fontName;
+            return this;
+        }
+
+        /**
+         * The resource id for the file path and name of the font for the crouton view's content.
+         */
+        public Builder setFontNameResId(int fontNameResId) {
+            this.fontNameResId = fontNameResId;
+            return this;
+        }
+
+        /**
+         * @return a configured {@link Style} object.
+         */
+        public Style build() {
+            return new Style(this);
+        }
     }
 
-    /** @return a configured {@link Style} object. */
-    public Style build() {
-      return new Style(this);
+    @Override
+    public String toString() {
+        return "Style{" +
+                "configuration=" + configuration +
+                ", backgroundColorResourceId=" + backgroundColorResourceId +
+                ", backgroundDrawableResourceId=" + backgroundDrawableResourceId +
+                ", backgroundColorValue=" + backgroundColorValue +
+                ", isTileEnabled=" + isTileEnabled +
+                ", textColorResourceId=" + textColorResourceId +
+                ", textColorValue=" + textColorValue +
+                ", heightInPixels=" + heightInPixels +
+                ", heightDimensionResId=" + heightDimensionResId +
+                ", widthInPixels=" + widthInPixels +
+                ", widthDimensionResId=" + widthDimensionResId +
+                ", gravity=" + gravity +
+                ", imageDrawable=" + imageDrawable +
+                ", imageResId=" + imageResId +
+                ", imageScaleType=" + imageScaleType +
+                ", textSize=" + textSize +
+                ", textShadowColorResId=" + textShadowColorResId +
+                ", textShadowRadius=" + textShadowRadius +
+                ", textShadowDy=" + textShadowDy +
+                ", textShadowDx=" + textShadowDx +
+                ", textAppearanceResId=" + textAppearanceResId +
+                ", paddingInPixels=" + paddingInPixels +
+                ", paddingDimensionResId=" + paddingDimensionResId +
+                ", fontName=" + fontName +
+                ", fontNameResId=" + fontNameResId +
+                '}';
     }
-  }
-
-  @Override
-  public String toString() {
-    return "Style{" +
-      "configuration=" + configuration +
-      ", backgroundColorResourceId=" + backgroundColorResourceId +
-      ", backgroundDrawableResourceId=" + backgroundDrawableResourceId +
-      ", backgroundColorValue=" + backgroundColorValue +
-      ", isTileEnabled=" + isTileEnabled +
-      ", textColorResourceId=" + textColorResourceId +
-      ", textColorValue=" + textColorValue +
-      ", heightInPixels=" + heightInPixels +
-      ", heightDimensionResId=" + heightDimensionResId +
-      ", widthInPixels=" + widthInPixels +
-      ", widthDimensionResId=" + widthDimensionResId +
-      ", gravity=" + gravity +
-      ", imageDrawable=" + imageDrawable +
-      ", imageResId=" + imageResId +
-      ", imageScaleType=" + imageScaleType +
-      ", textSize=" + textSize +
-      ", textShadowColorResId=" + textShadowColorResId +
-      ", textShadowRadius=" + textShadowRadius +
-      ", textShadowDy=" + textShadowDy +
-      ", textShadowDx=" + textShadowDx +
-      ", textAppearanceResId=" + textAppearanceResId +
-      ", paddingInPixels=" + paddingInPixels +
-      ", paddingDimensionResId=" + paddingDimensionResId +
-      ", fontName=" + fontName +
-      ", fontNameResId=" + fontNameResId +
-      '}';
-  }
-}
+}