|
@@ -24,10 +24,12 @@ import android.widget.LinearLayout;
|
|
|
import android.widget.TextView;
|
|
import android.widget.TextView;
|
|
|
import android.widget.Toast;
|
|
import android.widget.Toast;
|
|
|
|
|
|
|
|
|
|
+import com.bumptech.glide.Glide;
|
|
|
import com.google.gson.reflect.TypeToken;
|
|
import com.google.gson.reflect.TypeToken;
|
|
|
import com.jcodecraeer.xrecyclerview.XRecyclerView;
|
|
import com.jcodecraeer.xrecyclerview.XRecyclerView;
|
|
|
import com.jiuyan.sheep_children.BuildConfig;
|
|
import com.jiuyan.sheep_children.BuildConfig;
|
|
|
import com.jiuyan.sheep_children.R;
|
|
import com.jiuyan.sheep_children.R;
|
|
|
|
|
+import com.jiuyan.sheep_children.SheepApp;
|
|
|
import com.jiuyan.sheep_children.base.BaseActivity;
|
|
import com.jiuyan.sheep_children.base.BaseActivity;
|
|
|
import com.jiuyan.sheep_children.event.FloatMsg;
|
|
import com.jiuyan.sheep_children.event.FloatMsg;
|
|
|
import com.jiuyan.sheep_children.floatwindow.FloatService;
|
|
import com.jiuyan.sheep_children.floatwindow.FloatService;
|
|
@@ -41,6 +43,7 @@ import com.jiuyan.sheep_children.page.entry.TaskPublish;
|
|
|
import com.jiuyan.sheep_children.page.entry.User;
|
|
import com.jiuyan.sheep_children.page.entry.User;
|
|
|
import com.jiuyan.sheep_children.utils.DeviceInfo;
|
|
import com.jiuyan.sheep_children.utils.DeviceInfo;
|
|
|
import com.jiuyan.sheep_children.utils.GsonUtil;
|
|
import com.jiuyan.sheep_children.utils.GsonUtil;
|
|
|
|
|
+import com.jiuyan.sheep_children.utils.PackageUtil;
|
|
|
import com.jiuyan.sheep_children.utils.PremissUtils;
|
|
import com.jiuyan.sheep_children.utils.PremissUtils;
|
|
|
import com.jiuyan.sheep_children.utils.SpUtils;
|
|
import com.jiuyan.sheep_children.utils.SpUtils;
|
|
|
import com.readystatesoftware.chuck.Chuck;
|
|
import com.readystatesoftware.chuck.Chuck;
|
|
@@ -55,6 +58,7 @@ import java.util.ArrayList;
|
|
|
import java.util.HashMap;
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
+import de.hdodenhof.circleimageview.CircleImageView;
|
|
|
import okhttp3.Call;
|
|
import okhttp3.Call;
|
|
|
import okhttp3.Callback;
|
|
import okhttp3.Callback;
|
|
|
import okhttp3.Response;
|
|
import okhttp3.Response;
|
|
@@ -71,7 +75,14 @@ public class MainActivity extends BaseActivity implements View.OnClickListener {
|
|
|
private ImageView mDown;
|
|
private ImageView mDown;
|
|
|
private AlertDialog mDialog;
|
|
private AlertDialog mDialog;
|
|
|
private TaskPublish mClickItem;
|
|
private TaskPublish mClickItem;
|
|
|
-
|
|
|
|
|
|
|
+ private ImageView mImgIcon;
|
|
|
|
|
+ private CircleImageView mImgUser;
|
|
|
|
|
+ private TextView mTvTitle;
|
|
|
|
|
+ private TextView mTvTime;
|
|
|
|
|
+ private TextView mTvCount;
|
|
|
|
|
+ private TextView mTvMoney;
|
|
|
|
|
+ private TextView mTvGuide;
|
|
|
|
|
+ private LinearLayout mTlDoing;
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
@@ -90,7 +101,7 @@ public class MainActivity extends BaseActivity implements View.OnClickListener {
|
|
|
public void initListener() {
|
|
public void initListener() {
|
|
|
mTvWithdraw.setOnClickListener(this);
|
|
mTvWithdraw.setOnClickListener(this);
|
|
|
mDown.setOnClickListener(this);
|
|
mDown.setOnClickListener(this);
|
|
|
-
|
|
|
|
|
|
|
+ mImgUser.setOnClickListener(this);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -109,9 +120,46 @@ public class MainActivity extends BaseActivity implements View.OnClickListener {
|
|
|
@Override
|
|
@Override
|
|
|
public void success(User user) {
|
|
public void success(User user) {
|
|
|
mMoney.setText(user.getBalance());
|
|
mMoney.setText(user.getBalance());
|
|
|
|
|
+ Glide.with(MainActivity.this)
|
|
|
|
|
+ .load(user.getIcon())
|
|
|
|
|
+ .placeholder(R.drawable.icon)
|
|
|
|
|
+ .dontAnimate()
|
|
|
|
|
+ .into(mImgUser);
|
|
|
mToday.setText(String.format("今日收入:%s", user.getToday()));
|
|
mToday.setText(String.format("今日收入:%s", user.getToday()));
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
|
|
+ NetManager.get(Url.USER_PULL_TASK, map, getApplicationContext(), new SheepCallback<TaskPublish>(this) {
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void success(final TaskPublish taskPublish) {
|
|
|
|
|
+ if (taskPublish != null) {
|
|
|
|
|
+ mTlDoing.setVisibility(View.VISIBLE);
|
|
|
|
|
+ Glide.with(MainActivity.this)
|
|
|
|
|
+ .load(taskPublish.getTask().getIcon())
|
|
|
|
|
+ .placeholder(R.drawable.icon)
|
|
|
|
|
+ .dontAnimate()
|
|
|
|
|
+ .into(mImgIcon);
|
|
|
|
|
+ mTvTitle.setText(taskPublish.getTask().getTitle());
|
|
|
|
|
+ mTvTime.setText("截止日期:" + taskPublish.getOverTime());
|
|
|
|
|
+ mTvCount.setText(taskPublish.getSurplusCount() + "/" + taskPublish.getTotalCouont());
|
|
|
|
|
+ mTvMoney.setText(taskPublish.getTask().getPrice());
|
|
|
|
|
+ if (!TextUtils.isEmpty(taskPublish.getTask().getPkg())) {
|
|
|
|
|
+ mTlDoing.setOnClickListener(new View.OnClickListener() {
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onClick(View v) {
|
|
|
|
|
+ PackageUtil.startApp(SheepApp.mContext, taskPublish.getTask().getPkg());
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ mTlDoing.setVisibility(View.GONE);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void otherCode(int code, String string) {
|
|
|
|
|
+ mTlDoing.setVisibility(View.GONE);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -223,6 +271,16 @@ public class MainActivity extends BaseActivity implements View.OnClickListener {
|
|
|
mHostry = (TextView) head.findViewById(R.id.hostry);
|
|
mHostry = (TextView) head.findViewById(R.id.hostry);
|
|
|
mToday = (TextView) head.findViewById(R.id.today);
|
|
mToday = (TextView) head.findViewById(R.id.today);
|
|
|
mDown = head.findViewById(R.id.img_down);
|
|
mDown = head.findViewById(R.id.img_down);
|
|
|
|
|
+
|
|
|
|
|
+ mImgIcon = (ImageView) head.findViewById(R.id.img_icon);
|
|
|
|
|
+ mTvTitle = (TextView) head.findViewById(R.id.tv_title);
|
|
|
|
|
+ mTvTime = (TextView) head.findViewById(R.id.tv_time);
|
|
|
|
|
+ mTvCount = (TextView) head.findViewById(R.id.tv_count);
|
|
|
|
|
+ mTvMoney = (TextView) head.findViewById(R.id.tv_money);
|
|
|
|
|
+ mTvGuide = (TextView) head.findViewById(R.id.tv_guide);
|
|
|
|
|
+ mTlDoing = (LinearLayout) head.findViewById(R.id.ll_doing);
|
|
|
|
|
+ mImgUser = head.findViewById(R.id.img_user);
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private void findviews() {
|
|
private void findviews() {
|
|
@@ -231,9 +289,9 @@ public class MainActivity extends BaseActivity implements View.OnClickListener {
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
protected void onResume() {
|
|
protected void onResume() {
|
|
|
- FloatMsg floatMsg = new FloatMsg();
|
|
|
|
|
|
|
+ /* FloatMsg floatMsg = new FloatMsg();
|
|
|
floatMsg.shouldShow = false;
|
|
floatMsg.shouldShow = false;
|
|
|
- EventBus.getDefault().post(floatMsg);
|
|
|
|
|
|
|
+ EventBus.getDefault().post(floatMsg);*/
|
|
|
super.onResume();
|
|
super.onResume();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -245,9 +303,9 @@ public class MainActivity extends BaseActivity implements View.OnClickListener {
|
|
|
@Override
|
|
@Override
|
|
|
protected void onDestroy() {
|
|
protected void onDestroy() {
|
|
|
super.onDestroy();
|
|
super.onDestroy();
|
|
|
- FloatMsg floatMsg = new FloatMsg();
|
|
|
|
|
|
|
+ /* FloatMsg floatMsg = new FloatMsg();
|
|
|
floatMsg.shouldShow = true;
|
|
floatMsg.shouldShow = true;
|
|
|
- EventBus.getDefault().post(floatMsg);
|
|
|
|
|
|
|
+ EventBus.getDefault().post(floatMsg);*/
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -256,7 +314,7 @@ public class MainActivity extends BaseActivity implements View.OnClickListener {
|
|
|
switch (v.getId()) {
|
|
switch (v.getId()) {
|
|
|
case R.id.tv_withdraw:
|
|
case R.id.tv_withdraw:
|
|
|
if (SpUtils.isLogin(getApplicationContext())) {
|
|
if (SpUtils.isLogin(getApplicationContext())) {
|
|
|
- intent = new Intent(MainActivity.this, UserCenterActivity.class);
|
|
|
|
|
|
|
+ intent = new Intent(MainActivity.this, WithdrawActivity.class);
|
|
|
} else {
|
|
} else {
|
|
|
intent = new Intent(MainActivity.this, LoginActivity.class);
|
|
intent = new Intent(MainActivity.this, LoginActivity.class);
|
|
|
}
|
|
}
|
|
@@ -270,6 +328,14 @@ public class MainActivity extends BaseActivity implements View.OnClickListener {
|
|
|
}
|
|
}
|
|
|
startActivity(intent);
|
|
startActivity(intent);
|
|
|
break;
|
|
break;
|
|
|
|
|
+ case R.id.img_user:
|
|
|
|
|
+ if (SpUtils.isLogin(getApplicationContext())) {
|
|
|
|
|
+ intent = new Intent(MainActivity.this, UserCenterActivity.class);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ intent = new Intent(MainActivity.this, LoginActivity.class);
|
|
|
|
|
+ }
|
|
|
|
|
+ startActivity(intent);
|
|
|
|
|
+ break;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|