|
@@ -21,24 +21,20 @@ import android.widget.TextView;
|
|
|
import android.widget.Toast;
|
|
import android.widget.Toast;
|
|
|
|
|
|
|
|
import com.bumptech.glide.Glide;
|
|
import com.bumptech.glide.Glide;
|
|
|
-import com.mylhyl.acp.Acp;
|
|
|
|
|
-import com.mylhyl.acp.AcpListener;
|
|
|
|
|
-import com.mylhyl.acp.AcpOptions;
|
|
|
|
|
import com.sheep.jiuyan.samllsheep.R;
|
|
import com.sheep.jiuyan.samllsheep.R;
|
|
|
import com.sheep.jiuyan.samllsheep.base.BaseActivity;
|
|
import com.sheep.jiuyan.samllsheep.base.BaseActivity;
|
|
|
-import com.sheep.jiuyan.samllsheep.floatwindow.FloatWindow;
|
|
|
|
|
|
|
+import com.sheep.jiuyan.samllsheep.event.NewUserDialog;
|
|
|
import com.sheep.jiuyan.samllsheep.page.adapter.AdpMainPageViewPager;
|
|
import com.sheep.jiuyan.samllsheep.page.adapter.AdpMainPageViewPager;
|
|
|
import com.sheep.jiuyan.samllsheep.page.fragment.FgtMainPageOffline;
|
|
import com.sheep.jiuyan.samllsheep.page.fragment.FgtMainPageOffline;
|
|
|
import com.sheep.jiuyan.samllsheep.page.fragment.FgtMainPageTask;
|
|
import com.sheep.jiuyan.samllsheep.page.fragment.FgtMainPageTask;
|
|
|
import com.sheep.jiuyan.samllsheep.page.view.RappTabLayout;
|
|
import com.sheep.jiuyan.samllsheep.page.view.RappTabLayout;
|
|
|
import com.sheep.jiuyan.samllsheep.utils.G;
|
|
import com.sheep.jiuyan.samllsheep.utils.G;
|
|
|
import com.sheep.jiuyan.samllsheep.utils.SpUtils;
|
|
import com.sheep.jiuyan.samllsheep.utils.SpUtils;
|
|
|
-import com.sheep.jiuyan.samllsheep.utils.TitleBarUtils;
|
|
|
|
|
|
|
|
|
|
import org.greenrobot.eventbus.EventBus;
|
|
import org.greenrobot.eventbus.EventBus;
|
|
|
|
|
+import org.greenrobot.eventbus.Subscribe;
|
|
|
|
|
+import org.greenrobot.eventbus.ThreadMode;
|
|
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
|
|
-import java.util.List;
|
|
|
|
|
|
|
|
|
|
import de.hdodenhof.circleimageview.CircleImageView;
|
|
import de.hdodenhof.circleimageview.CircleImageView;
|
|
|
|
|
|
|
@@ -63,14 +59,17 @@ public class MainActivity extends BaseActivity {
|
|
|
private AppBarLayout mAppBarLayout;
|
|
private AppBarLayout mAppBarLayout;
|
|
|
private boolean mIsTopest = true;//下滑是否在最顶端
|
|
private boolean mIsTopest = true;//下滑是否在最顶端
|
|
|
private boolean mIsLeftest = true;//右滑时是否在最左端
|
|
private boolean mIsLeftest = true;//右滑时是否在最左端
|
|
|
|
|
+ private ImageView mImgBag;
|
|
|
|
|
+ private AlertDialog mDialog;
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
|
showNewDialog();
|
|
showNewDialog();
|
|
|
super.onCreate(savedInstanceState);
|
|
super.onCreate(savedInstanceState);
|
|
|
- Intent intent = new Intent(this, FloatWindow.class);
|
|
|
|
|
- startActivity(intent);
|
|
|
|
|
|
|
+ EventBus.getDefault().register(this);
|
|
|
|
|
+ /* Intent intent = new Intent(this, FloatWindow.class);
|
|
|
|
|
+ startActivity(intent);*/
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -169,6 +168,13 @@ public class MainActivity extends BaseActivity {
|
|
|
} else if (mSwipeRefreshLayout.isEnabled() && (!mIsLeftest || !mIsTopest)) {
|
|
} else if (mSwipeRefreshLayout.isEnabled() && (!mIsLeftest || !mIsTopest)) {
|
|
|
mSwipeRefreshLayout.setEnabled(false);
|
|
mSwipeRefreshLayout.setEnabled(false);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ mImgBag.setOnClickListener(new View.OnClickListener() {
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onClick(View v) {
|
|
|
|
|
+ showNewDialog();
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -185,27 +191,33 @@ public class MainActivity extends BaseActivity {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private void showNewDialog() {
|
|
private void showNewDialog() {
|
|
|
- Intent intent = getIntent();
|
|
|
|
|
- String tag = intent.getStringExtra("tag");
|
|
|
|
|
- // if (TextUtils.equals(tag, "once")) {
|
|
|
|
|
- AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this, R.style.Theme_Transparent);
|
|
|
|
|
- View view = View.inflate(this, R.layout.new_user_dialog, null);
|
|
|
|
|
- builder.setView(view);
|
|
|
|
|
- final AlertDialog dialog = builder.create();
|
|
|
|
|
- view.findViewById(R.id.img_close).setOnClickListener(new View.OnClickListener() {
|
|
|
|
|
- @Override
|
|
|
|
|
- public void onClick(View v) {
|
|
|
|
|
- dialog.dismiss();
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- view.findViewById(R.id.img_begin_new).setOnClickListener(new View.OnClickListener() {
|
|
|
|
|
- @Override
|
|
|
|
|
- public void onClick(View v) {
|
|
|
|
|
- startActivity(new Intent(MainActivity.this, WebActivity.class));
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- dialog.setCanceledOnTouchOutside(false);
|
|
|
|
|
- dialog.show();
|
|
|
|
|
|
|
+ if (mDialog == null) {
|
|
|
|
|
+ Intent intent = getIntent();
|
|
|
|
|
+ String tag = intent.getStringExtra("tag");
|
|
|
|
|
+ // if (TextUtils.equals(tag, "once")) {
|
|
|
|
|
+ AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this, R.style.Theme_Transparent);
|
|
|
|
|
+ View view = View.inflate(this, R.layout.new_user_dialog, null);
|
|
|
|
|
+ builder.setView(view);
|
|
|
|
|
+ mDialog = builder.create();
|
|
|
|
|
+ view.findViewById(R.id.img_close).setOnClickListener(new View.OnClickListener() {
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onClick(View v) {
|
|
|
|
|
+ mDialog.dismiss();
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ view.findViewById(R.id.img_begin_new).setOnClickListener(new View.OnClickListener() {
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onClick(View v) {
|
|
|
|
|
+ Intent intent = new Intent(MainActivity.this, WebActivity.class);
|
|
|
|
|
+ intent.putExtra(WebActivity.INTENT_URL, "http://10.8.210.190:8080/index.html?count=3");
|
|
|
|
|
+ intent.putExtra(WebActivity.INTENT_TITLE, "新手引导");
|
|
|
|
|
+ intent.putExtra(WebActivity.INTENT_NEW_USER, "1");
|
|
|
|
|
+ startActivity(intent);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ mDialog.setCanceledOnTouchOutside(false);
|
|
|
|
|
+ }
|
|
|
|
|
+ mDialog.show();
|
|
|
// }
|
|
// }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -225,7 +237,8 @@ public class MainActivity extends BaseActivity {
|
|
|
});
|
|
});
|
|
|
btn.setVisibility(View.VISIBLE);
|
|
btn.setVisibility(View.VISIBLE);
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
+ mImgBag = (ImageView) findViewById(R.id.img_baseactivity_title);
|
|
|
|
|
+ mImgBag.setImageResource(R.drawable.hongbao);
|
|
|
mRappTabLayout = (RappTabLayout) findViewById(R.id.tab_main_activity);
|
|
mRappTabLayout = (RappTabLayout) findViewById(R.id.tab_main_activity);
|
|
|
mViewPager = (ViewPager) findViewById(R.id.viewpager_main_activity);
|
|
mViewPager = (ViewPager) findViewById(R.id.viewpager_main_activity);
|
|
|
mSwipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipe_main_activity);
|
|
mSwipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipe_main_activity);
|
|
@@ -244,7 +257,7 @@ public class MainActivity extends BaseActivity {
|
|
|
.setLineMargin(0, G.getRealPix(2), 0, 0)
|
|
.setLineMargin(0, G.getRealPix(2), 0, 0)
|
|
|
.setLineColor(getResources().getColor(R.color.black_text_deep))
|
|
.setLineColor(getResources().getColor(R.color.black_text_deep))
|
|
|
.setupWithViewPager(mViewPager, R.layout.tab_ripple);
|
|
.setupWithViewPager(mViewPager, R.layout.tab_ripple);
|
|
|
- TitleBarUtils.getInstance().setTitleFinish(this);
|
|
|
|
|
|
|
+ // TitleBarUtils.getInstance().setTitleFinish(this);
|
|
|
// .setRightImgBotton(this, R.drawable.set, new View.OnClickListener() {
|
|
// .setRightImgBotton(this, R.drawable.set, new View.OnClickListener() {
|
|
|
// @Override
|
|
// @Override
|
|
|
// public void onClick(View view) {
|
|
// public void onClick(View view) {
|
|
@@ -274,4 +287,15 @@ public class MainActivity extends BaseActivity {
|
|
|
EventBus.getDefault().post(floatMsg);*/
|
|
EventBus.getDefault().post(floatMsg);*/
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Subscribe(threadMode = ThreadMode.MAIN)
|
|
|
|
|
+ public void onMessageEvent(NewUserDialog done) {
|
|
|
|
|
+ if (done.isDoneNewTask) {
|
|
|
|
|
+ showRedbagDialog();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private void showRedbagDialog() {
|
|
|
|
|
+ Toast.makeText(this, "抽奖!!!", Toast.LENGTH_SHORT).show();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|