|
|
@@ -0,0 +1,79 @@
|
|
|
+package com.modular.appmessages.activity;
|
|
|
+
|
|
|
+import android.content.BroadcastReceiver;
|
|
|
+import android.content.Context;
|
|
|
+import android.content.Intent;
|
|
|
+import android.content.IntentFilter;
|
|
|
+import android.os.Bundle;
|
|
|
+import android.support.v4.content.LocalBroadcastManager;
|
|
|
+import android.support.v7.widget.DefaultItemAnimator;
|
|
|
+import android.support.v7.widget.LinearLayoutManager;
|
|
|
+import android.support.v7.widget.RecyclerView;
|
|
|
+import android.view.View;
|
|
|
+
|
|
|
+import com.core.app.AppConstant;
|
|
|
+import com.core.base.BaseActivity;
|
|
|
+import com.core.model.UUSportModel;
|
|
|
+import com.modular.appmessages.R;
|
|
|
+import com.modular.appmessages.adapter.UUSportAdapter;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * Created by FANGlh on 2017/9/27.
|
|
|
+ * function:
|
|
|
+ */
|
|
|
+
|
|
|
+public class UUSportActivity extends BaseActivity implements View.OnClickListener {
|
|
|
+ private RecyclerView contentRV;
|
|
|
+ private UUSportAdapter mAdapter;
|
|
|
+ private BroadcastReceiver updateReceiver = new BroadcastReceiver() {
|
|
|
+ @Override
|
|
|
+ public void onReceive(Context context, Intent intent) {
|
|
|
+ initData();
|
|
|
+ }
|
|
|
+ };
|
|
|
+ private LinearLayoutManager manager;
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected void onCreate(Bundle savedInstanceState) {
|
|
|
+ super.onCreate(savedInstanceState);
|
|
|
+ setContentView(R.layout.activity_uusport);
|
|
|
+ LocalBroadcastManager.getInstance(this).registerReceiver(updateReceiver, new IntentFilter(AppConstant.UUSPORT_PUSH));
|
|
|
+ initView();
|
|
|
+ initData();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void initData() {
|
|
|
+// List<UUSportModel> models = UUSportDao.getInstance().getAllModels();
|
|
|
+ List<UUSportModel> models = null;
|
|
|
+ showModel(models);
|
|
|
+ }
|
|
|
+ private void showModel(final List<UUSportModel> models) {
|
|
|
+ if (mAdapter == null) {
|
|
|
+ mAdapter = new UUSportAdapter(ct, models);
|
|
|
+ contentRV.setAdapter(mAdapter);
|
|
|
+ } else {
|
|
|
+ mAdapter.setModels(models);
|
|
|
+ mAdapter.notifyDataSetChanged();
|
|
|
+ }
|
|
|
+// ViewUtils.move2Position(manager, contentRV, ListUtils.getSize(models) - 1);
|
|
|
+ }
|
|
|
+ private void initView() {
|
|
|
+ contentRV = (RecyclerView) findViewById(R.id.contentRV);
|
|
|
+ contentRV.setItemAnimator(new DefaultItemAnimator());
|
|
|
+ manager = new LinearLayoutManager(ct);
|
|
|
+ contentRV.setLayoutManager(manager);
|
|
|
+
|
|
|
+ findViewById(R.id.step_rank_ll).setOnClickListener(this);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ if (v.getId() == R.id.step_rank_ll){
|
|
|
+ startActivity(new Intent("com.modular.appme.UURanking"));
|
|
|
+ ToastMessage("step_rank_ll");
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|