MDShopping/src/main/AndroidManifest.xml
@@ -15,7 +15,6 @@ <uses-permission android:name="android.permission.GET_TASKS" /> <!-- 允许一个程序获取信息有关当前或最近运行的任务 --> <uses-permission android:name="android.permission.BLUETOOTH" /> <!-- 蓝牙权限 --> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> <!-- 读取您的SD卡中的内容 --> <!--<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" /> <!– 允许一个程序打开窗口使用TYPE_SYSTEM_ALERT,显示在其他所有程序的顶层 –>--> <uses-permission android:name="com.huawei.android.launcher.permission.READ_SETTINGS" /> <uses-permission android:name="com.huawei.android.launcher.permission.WRITE_SETTINGS" /> <!-- 获取Activity任务栈 权限 --> <permission @@ -46,9 +45,9 @@ android:name="android.permission.INTERNAL_SYSTEM_WINDOW" tools:ignore="ProtectedPermissions" /> <!-- 显示系统窗口权限 --> <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" /> <!-- 在 屏幕最顶部显示addview--> <uses-permission android:name="android.permission.SYSTEM_OVERLAY_WINDOW" /> <!-- <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />--> <!-- <!– 在 屏幕最顶部显示addview–>--> <!-- <uses-permission android:name="android.permission.SYSTEM_OVERLAY_WINDOW" />--> <uses-permission android:name="com.coloros.mcs.permission.RECIEVE_MCS_MESSAGE" /><!-- oppo推送权限 --> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> @@ -468,7 +467,7 @@ android:value="597eb27c65b6d658af0019df" /> <meta-data android:name="UMENG_CHANNEL" android:value="huawei" /> <!-- 修改Glide默认的Bitmap格式,此处慎重修改路径 --> android:value="qq" /> <!-- 修改Glide默认的Bitmap格式,此处慎重修改路径 --> <activity android:name=".ui.mine.ActivationInviteCodeAcitvity" MDShopping/src/main/java/com/yeshi/ec/rebate/myapplication/ui/dialog/JumpTaoBaoDialog.java
@@ -55,23 +55,23 @@ // instantiate the dialog with the custom Theme final JumpTaoBaoDialog dialog = new JumpTaoBaoDialog(context, R.style.Dialog); View layout = inflater.inflate(R.layout.item_jump_taobao, null); ResizableImageView ic_jump_platform_top = layout.findViewById(R.id.ic_jump_platform_top); TextView tv_jump_platform_top = layout.findViewById(R.id.tv_platform_name); switch (platform) { case Constant.GOODS_TYPE_TB: ic_jump_platform_top.setImageResource( R.drawable.ic_jump_taobao_top); tv_jump_platform_top.setText("正在前往淘宝"); break; case Constant.GOODS_TYPE_JD: ic_jump_platform_top.setImageResource( R.drawable.ic_jump_jingdong_top); tv_jump_platform_top.setText("正在前往京东"); break; case Constant.GOODS_TYPE_PDD: ic_jump_platform_top.setImageResource( R.drawable.ic_jump_pinduoduo_top); tv_jump_platform_top.setText("正在前往拼多多"); break; case Constant.GOODS_TYPE_VIP: ic_jump_platform_top.setImageResource( R.drawable.ic_jump_vip_top); tv_jump_platform_top.setText("正在前往唯品会"); break; case Constant.GOODS_TYPE_SUNING: ic_jump_platform_top.setImageResource( R.drawable.ic_jump_suning_top); tv_jump_platform_top.setText("正在前往苏宁"); break; } MDShopping/src/main/java/com/yeshi/ec/rebate/myapplication/ui/mine/AddZhifuBaoAccountActivity.java
@@ -37,6 +37,7 @@ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setShowRecommend(false); setContentView(R.layout.activity_add_zhifubao_account); tv_top_left = findViewById(R.id.tv_top_bar_left); tv_top_middle = findViewById(R.id.tv_top_bar_middle); MDShopping/src/main/java/com/yeshi/ec/rebate/myapplication/ui/mine/LoginActivity.java
@@ -4,8 +4,11 @@ import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; import android.text.Editable; import android.text.TextWatcher; import android.util.Log; import android.view.View; import android.widget.EditText; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; @@ -18,6 +21,7 @@ import com.google.gson.GsonBuilder; import com.google.gson.reflect.TypeToken; import com.umeng.analytics.MobclickAgent; import com.wpc.library.util.GetManifestDataUtil; import com.wpc.library.util.common.StringUtils; import com.xiaomi.mipush.sdk.MiPushClient; import com.yeshi.ec.rebate.myapplication.BasicTextHttpResponseHandler; @@ -28,12 +32,16 @@ import com.yeshi.ec.rebate.myapplication.ui.dialog.ShapeLoadingDialog; import com.yeshi.ec.rebate.myapplication.ui.invite.ShareBrowserActivity; import com.yeshi.ec.rebate.myapplication.util.KeFuUtil; import com.yeshi.ec.rebate.myapplication.util.SystemParamsUtil; import com.yeshi.ec.rebate.myapplication.util.TopStatusSettings; import com.yeshi.ec.rebate.myapplication.util.umengCustomEvent.UserCustomEvent; import com.yeshi.ec.rebate.myapplication.util.user.UserUtil; import org.apache.http.Header; import org.json.JSONObject; import java.util.Timer; import java.util.TimerTask; import de.greenrobot.event.EventBus; @@ -47,7 +55,7 @@ public final static int TYPE_BIND = 2;//绑定 public final static int TYPE_BIND_WITHOUT_LOGINED = 3;//未登录绑定 private ImageView iv_close, iv_contact_kefu, iv_login_tb; private TextView tv_user_agreement, tv_privacy_policies; private TextView tv_user_agreement, tv_privacy_policies, tv_login; LinearLayout ll_user_agreement; ShapeLoadingDialog pd; String uid; @@ -56,20 +64,39 @@ String key;//微信登录尚未绑定手机时回传的标识 private static String TAG = "LoginSelectActivity"; private LinearLayout ll_phone; private TextView tv_send_code, tv_login_phone; private EditText et_phone, et_code; //设置视图 private void setView(boolean onlining) { if (onlining) { ll_phone.setVisibility(View.VISIBLE); tv_login.setVisibility(View.GONE); } else { ll_phone.setVisibility(View.GONE); tv_login.setVisibility(View.VISIBLE); } } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_login); pd = new ShapeLoadingDialog.Builder(this).build(); TopStatusSettings.setStatusViewAndDeepColorNoView(this); // tv_user_agreement.getPaint().setFlags(Paint.UNDERLINE_TEXT_FLAG); initData(getIntent()); String from = getIntent().getStringExtra("from"); UserCustomEvent.userLogin(this, StringUtils.isEmpty(from) ? "其它" : from); EventBus.getDefault().register(this); String onlining = ""; String channel = GetManifestDataUtil.getAppMetaData(this, "UMENG_CHANNEL"); if ("QQ".equalsIgnoreCase(channel)) { onlining = SystemParamsUtil.getParam(this, "onlining"); } setView("1".equalsIgnoreCase(onlining) ? true : false); } private void initData(Intent intent) { @@ -77,6 +104,8 @@ init(intent); addListener(); } Timer timer = null; @Override protected void onNewIntent(Intent intent) { @@ -89,6 +118,11 @@ 初始化控件 */ private void init(Intent intent) { ll_phone = findViewById(R.id.ll_phone); tv_send_code = findViewById(R.id.tv_send_code); tv_login_phone = findViewById(R.id.tv_login_phone); et_phone = findViewById(R.id.et_phone); et_code = findViewById(R.id.et_code); iv_close = findViewById(R.id.iv_close); iv_contact_kefu = findViewById(R.id.iv_contact_kefu); tv_user_agreement = findViewById(R.id.tv_user_agreement); @@ -96,14 +130,80 @@ tv_privacy_policies = findViewById(R.id.tv_privacy_policies); iv_login_tb = findViewById(R.id.iv_login_tb); ll_user_agreement = findViewById(R.id.ll_user_agreement); findViewById(R.id.tv_login).setOnClickListener(this); tv_login = findViewById(R.id.tv_login); tv_login.setOnClickListener(this); iv_login_tb.setOnClickListener(this); SharedPreferences sp = getSharedPreferences("user", MODE_PRIVATE); sp.edit().putBoolean("first", true).commit(); uid = intent.getStringExtra("uid"); key = intent.getStringExtra("key"); getUserConfig(); tv_login_phone.setOnClickListener(this); tv_send_code.setOnClickListener(this); et_code.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void afterTextChanged(Editable s) { setSetLoginPhoneState(); } }); et_phone.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void afterTextChanged(Editable s) { setSendCodeState(); setSetLoginPhoneState(); } }); setSendCodeState(); setSetLoginPhoneState(); } private void setSetLoginPhoneState() { //是手机号码 if (StringUtils.isMobileNumber(et_phone.getText() + "") && et_code.getText() != null && !StringUtils.isEmpty(et_code.getText() + "")) { tv_login_phone.setBackgroundResource(R.drawable.shape_mobile_login_light); tv_login_phone.setEnabled(true); } else { tv_login_phone.setBackgroundResource(R.drawable.shape_mobile_login); tv_login_phone.setEnabled(false); } } private void setSendCodeState() { if (StringUtils.isMobileNumber(et_phone.getText() + "") && lastTime == 0) { tv_send_code.setEnabled(true); tv_send_code.setTextColor(getResources().getColor(R.color.theme)); } else { tv_send_code.setEnabled(false); tv_send_code.setTextColor(getResources().getColor(R.color.gray)); } } int lastTime = 0; /* *添加监听 @@ -173,9 +273,94 @@ } }); break; case R.id.tv_send_code://发送验证码 if (timer != null) { timer.cancel(); timer = null; } Toast.makeText(this, "验证码已发送,请注意查收", Toast.LENGTH_SHORT); lastTime = 60; setSendCodeState(); timer = new Timer(); timer.schedule(new TimerTask() { @Override public void run() { tv_send_code.post(new Runnable() { @Override public void run() { if (lastTime > 0) { lastTime--; tv_send_code.setText(lastTime + "s重发"); if (lastTime <= 0) { lastTime = 0; setSendCodeState(); timer.cancel(); tv_send_code.setText("发送验证码"); } } } }); } }, 0, 1000); break; case R.id.tv_login_phone://登录 loginPhone(); break; } } private void loginPhone() { ShoppingApi.loginNew(getApplicationContext(), et_code.getText() + "", et_phone.getText() + "", "", "1", new BasicTextHttpResponseHandler() { @Override public void onStart() { super.onStart(); if (!pd.isShowing()) pd.show(); } @Override public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception { if (jsonObject.optString("code").equalsIgnoreCase("0")) { Gson gson = new GsonBuilder().serializeNulls().create(); JSONObject data = jsonObject.optJSONObject("data"); final UserInfo info = gson.fromJson(data.optJSONObject("userInfo").toString(), new TypeToken<UserInfo>() { }.getType()); SharedPreferences sp = getSharedPreferences("user", MODE_PRIVATE); SharedPreferences.Editor editor = sp.edit(); editor.putBoolean("isLogin", true); editor.putBoolean("isFirstInput", false); editor.putString("uid", info.getId()); editor.putString("openid", info.getOpenid()); editor.putString("portrait", info.getPortrait()); editor.commit(); MiPushClient.setAlias(getApplicationContext(), info.getId(), null); //保存邀请码 String inviteCode = data.optString("inviteCode"); UserUtil.setInviteCode(getApplicationContext(), inviteCode, info.getId()); Toast.makeText(getApplicationContext(), "恭喜你,登录成功", Toast.LENGTH_SHORT).show(); setResult(100); finish(); } else { Toast.makeText(getApplicationContext(), jsonObject.optString("msg"), Toast.LENGTH_SHORT).show(); } } @Override public void onFinish() { super.onFinish(); if (pd.isShowing()) pd.dismiss(); } }); } private void login(Session session) { String userData = new Gson().toJson(session); MDShopping/src/main/java/com/yeshi/ec/rebate/myapplication/ui/mine/WithdrawCashActivity.java
@@ -79,6 +79,7 @@ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setShowRecommend(false); setContentView(R.layout.activity_withdraw_cash); TopStatusSettings.setStatusViewAndDeepColor(this); tv_left = findViewById(R.id.tv_top_bar_left); MDShopping/src/main/java/com/yeshi/ec/rebate/myapplication/util/SystemParamsUtil.java
@@ -40,7 +40,7 @@ editor.putString("shareContent", obj.optString("value")); } else if (obj.optString("key").equalsIgnoreCase("sharePlateContent")) {// editor.putString("sharePlateContent", obj.optString("value")); }else if (obj.optString("key").equalsIgnoreCase("copy")) {// } else if (obj.optString("key").equalsIgnoreCase("copy")) {// editor.putString("copy", obj.optString("value")); } else if (obj.optString("key").equalsIgnoreCase("haoli")) {// editor.putString("haoli", obj.optString("value")); @@ -79,8 +79,10 @@ editor.putString("weixin_code_link", obj.optString("value")); } else if (obj.optString("key").equalsIgnoreCase("wx_kefu_link")) {//企业微信客服链接 editor.putString("wx_kefu_link", obj.optString("value")); }else if (obj.optString("key").equalsIgnoreCase("invite_code_apply")) {//企业微信客服链接 } else if (obj.optString("key").equalsIgnoreCase("invite_code_apply")) {//企业微信客服链接 editor.putString("invite_code_apply", obj.optString("value")); } else if (obj.optString("key").equalsIgnoreCase("onlining")) {//企业微信客服链接 editor.putString("onlining", obj.optString("value")); } } editor.commit(); MDShopping/src/main/res/drawable-xhdpi/ic_jump_jingdong_top.pngBinary files differ
MDShopping/src/main/res/drawable-xhdpi/ic_jump_pinduoduo_top.pngBinary files differ
MDShopping/src/main/res/drawable-xhdpi/ic_jump_suning_top.pngBinary files differ
MDShopping/src/main/res/drawable-xhdpi/ic_jump_taobao_top.pngBinary files differ
MDShopping/src/main/res/drawable-xhdpi/ic_jump_vip_top.pngBinary files differ
MDShopping/src/main/res/drawable/shape_jumptaobao_top.xml
New file @@ -0,0 +1,8 @@ <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android"> <corners android:topLeftRadius="15dp" android:topRightRadius="15dp" /> <solid android:color="@color/white" /> </shape> MDShopping/src/main/res/drawable/shape_mobile_login.xml
@@ -2,8 +2,8 @@ <shape xmlns:android="http://schemas.android.com/apk/res/android"> <corners android:radius="40dp" /> <solid android:color="@color/main_text_color_transport" /> <solid android:color="@color/theme_color_transport" /> <stroke android:width="1px" android:color="@color/main_text_color_transport" /> android:color="@color/theme_color_transport" /> </shape> MDShopping/src/main/res/drawable/shape_mobile_login_light.xml
@@ -2,8 +2,8 @@ <shape xmlns:android="http://schemas.android.com/apk/res/android"> <corners android:radius="40dp" /> <solid android:color="@color/main_text_color" /> <solid android:color="@color/theme" /> <stroke android:width="1px" android:color="@color/main_text_color" /> android:color="@color/theme" /> </shape> MDShopping/src/main/res/layout/activity_login.xml
@@ -42,6 +42,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="50dp" android:layout_marginBottom="118dp" android:focusable="true" android:focusableInTouchMode="true" android:gravity="center" @@ -49,37 +50,141 @@ android:textColor="@color/theme" android:textSize="25sp" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="118dp" android:text="第三方授权登录" android:textColor="#ff333333" android:textSize="18sp" /> <ImageView android:id="@+id/iv_login_tb" android:layout_width="55dp" android:layout_height="55dp" android:layout_marginTop="29dp" android:src="@drawable/icon_login_tb"> </ImageView> <TextView android:id="@+id/tv_login" <LinearLayout android:id="@+id/ll_phone" android:layout_width="match_parent" android:layout_height="45dp" android:layout_marginLeft="37.5dp" android:layout_marginTop="75dp" android:layout_marginRight="37.5dp" android:background="@drawable/shape_login_gain_sms" android:gravity="center" android:text="登录" android:textColor="#ffffffff" android:textSize="18sp" /> android:layout_height="wrap_content" android:layout_marginBottom="20dp" android:orientation="vertical" android:paddingLeft="40dp" android:paddingRight="40dp"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="10dp" android:orientation="horizontal"> <LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:orientation="vertical"> <EditText android:id="@+id/et_phone" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" android:background="@null" android:hint="请输入电话号码" android:inputType="number" android:textColor="#333333" android:textCursorDrawable="@drawable/shape_input_cursor"></EditText> <View android:layout_width="match_parent" android:layout_height="1dp" android:layout_marginTop="2dp" android:background="@color/theme"></View> </LinearLayout> <TextView android:id="@+id/tv_send_code" android:layout_width="80dp" android:layout_height="wrap_content" android:layout_marginLeft="5dp" android:gravity="center" android:paddingTop="5dp" android:paddingRight="5dp" android:text="发送验证码" android:textColor="@color/theme"></TextView> </LinearLayout> <LinearLayout android:layout_width="180dp" android:layout_height="wrap_content" android:layout_marginTop="5dp" android:layout_weight="1" android:orientation="vertical"> <EditText android:id="@+id/et_code" android:layout_width="180dp" android:layout_height="wrap_content" android:layout_marginTop="10dp" android:layout_weight="1" android:background="@null" android:hint="请输入验证码" android:textColor="#333333" android:textCursorDrawable="@drawable/shape_input_cursor"></EditText> <View android:layout_width="match_parent" android:layout_height="1dp" android:layout_marginTop="2dp" android:background="@color/theme"></View> </LinearLayout> <TextView android:id="@+id/tv_login_phone" android:layout_width="match_parent" android:layout_height="45dp" android:layout_marginLeft="37.5dp" android:layout_marginTop="30dp" android:layout_marginRight="37.5dp" android:background="@drawable/shape_mobile_login" android:gravity="center" android:text="登录" android:textColor="#ffffffff" android:textSize="18sp" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center_horizontal" android:orientation="vertical"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="第三方授权登录" android:textColor="#ff333333" android:textSize="18sp" /> <ImageView android:id="@+id/iv_login_tb" android:layout_width="55dp" android:layout_height="55dp" android:layout_marginTop="29dp" android:src="@drawable/icon_login_tb"> </ImageView> <TextView android:id="@+id/tv_login" android:layout_width="match_parent" android:layout_height="45dp" android:layout_marginLeft="37.5dp" android:layout_marginTop="75dp" android:layout_marginRight="37.5dp" android:background="@drawable/shape_login_gain_sms" android:gravity="center" android:text="登录" android:textColor="#ffffffff" android:textSize="18sp" /> </LinearLayout> <View android:layout_width="match_parent" MDShopping/src/main/res/layout/activity_revise_account.xml
@@ -83,13 +83,13 @@ android:gravity="center" android:inputType="number" android:maxLength="6" android:textColor="@color/main_text_color" /> android:textColor="@color/theme" /> <View android:layout_width="match_parent" android:layout_height="1dp" android:layout_gravity="bottom" android:background="@color/main_text_color" /> android:background="@color/theme" /> </FrameLayout> </LinearLayout> @@ -102,7 +102,7 @@ android:layout_marginTop="20dp" android:background="@null" android:text="60秒后重发" android:textColor="@color/main_text_color" android:textColor="@color/theme" android:textSize="18sp" android:visibility="gone" /> MDShopping/src/main/res/layout/item_jump_taobao.xml
@@ -4,11 +4,20 @@ android:layout_height="match_parent" android:orientation="vertical"> <com.wpc.library.widget.ResizableImageView android:id="@+id/ic_jump_platform_top" <TextView android:id="@+id/tv_platform_name" android:layout_width="match_parent" android:layout_height="wrap_content" android:src="@drawable/ic_jump_taobao_top" /> android:layout_height="100dp" android:textColor="@color/theme" android:textSize="22sp" android:background="@drawable/shape_jumptaobao_top" android:gravity="center" android:text="正在前往淘宝"> </TextView> <com.wpc.library.widget.ResizableImageView @@ -30,7 +39,7 @@ android:layout_marginTop="20dp" android:gravity="center" android:text="免费领券" android:textColor="@color/main_text_color" android:textColor="@color/theme" android:textSize="15sp" /> <TextView MDShopping/src/main/res/values/colors.xml
@@ -172,6 +172,7 @@ <color name="theme">#0EAD21</color> <color name="theme_color_transport">#110EAD21</color> <color name="theme_bg">#FBEE19</color> library-mine/src/com/wpc/library/util/common/StringUtils.java
@@ -149,9 +149,17 @@ // 判断字符串是否为手机号码 public static boolean isMobileNumber(String aTelNumber) { Pattern p = Pattern.compile("(^1((((3[5-9])|(47)|(5[0-2])|(5[7-9])|(82)|(8[7-8]))\\d{8})|((34[0-8])\\d{7}))$)|(^1((3[0-2])|(5[5-6])|(8[0-6]))\\d{8}$)|(^1((33[0-9])|(349)|(53[0-9])|(80[0-9])|(89[0-9]))\\d{7}$)"); String regex = "^((13[0-9])|(14[0-9])|(17[0-9])|(15[^4,\\D])|(18[0-9])|(19[0-9])|(16[0-9]))\\d{8}$"; Pattern p = Pattern.compile(regex); Matcher m = p.matcher(aTelNumber); return m.matches(); if (aTelNumber == null || aTelNumber.equals("") || aTelNumber.length() != 11) { return false; } else { return m.find(); } } // 格式化手机号码