|
|
@@ -1,36 +1,63 @@
|
|
|
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.app.Constants;
|
|
|
import com.core.base.BaseActivity;
|
|
|
import com.core.dao.UUHelperDao;
|
|
|
import com.core.model.UUHelperModel;
|
|
|
+import com.core.utils.CommonUtil;
|
|
|
+import com.core.utils.IntentUtils;
|
|
|
import com.modular.appmessages.R;
|
|
|
import com.modular.appmessages.adapter.UUHelperAdapter;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
|
|
|
-public class UUHelperActivity extends BaseActivity {
|
|
|
+public class UUHelperActivity extends BaseActivity implements View.OnClickListener {
|
|
|
|
|
|
private RecyclerView contentRV;
|
|
|
private UUHelperAdapter mAdapter;
|
|
|
|
|
|
+ private BroadcastReceiver updateReceiver = new BroadcastReceiver() {
|
|
|
+ @Override
|
|
|
+ public void onReceive(Context context, Intent intent) {
|
|
|
+ initData();
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
@Override
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
|
super.onCreate(savedInstanceState);
|
|
|
setContentView(R.layout.activity_uuhelper);
|
|
|
+ LocalBroadcastManager.getInstance(this).registerReceiver(updateReceiver, new IntentFilter(AppConstant.UPDATA_UUHELPER));
|
|
|
initView();
|
|
|
initData();
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ protected void onDestroy() {
|
|
|
+ LocalBroadcastManager.getInstance(this).unregisterReceiver(updateReceiver);
|
|
|
+ super.onDestroy();
|
|
|
+ }
|
|
|
+
|
|
|
private void initView() {
|
|
|
contentRV = (RecyclerView) findViewById(R.id.contentRV);
|
|
|
contentRV.setItemAnimator(new DefaultItemAnimator());
|
|
|
contentRV.setLayoutManager(new LinearLayoutManager(ct));
|
|
|
+ findViewById(R.id.successfulTV).setOnClickListener(this);
|
|
|
+ findViewById(R.id.experienceTV).setOnClickListener(this);
|
|
|
+ findViewById(R.id.serviceTV).setOnClickListener(this);
|
|
|
}
|
|
|
|
|
|
private void initData() {
|
|
|
@@ -68,5 +95,26 @@ public class UUHelperActivity extends BaseActivity {
|
|
|
mAdapter.setModels(models);
|
|
|
mAdapter.notifyDataSetChanged();
|
|
|
}
|
|
|
+ contentRV.scrollToPosition(models.size() - 1);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ int id = v.getId();
|
|
|
+ String url = null;
|
|
|
+ if (id == R.id.successfulTV) {
|
|
|
+ url = "http://113.105.74.140:8080/new/";
|
|
|
+ IntentUtils.webLinks(ct, url, "关于优软");
|
|
|
+ } else if (id == R.id.experienceTV) {
|
|
|
+ url = "http://113.105.74.140:8080/new/";
|
|
|
+ IntentUtils.webLinks(ct, url, "体验中心");
|
|
|
+ } else if (id == R.id.serviceTV) {
|
|
|
+ CommonUtil.setSharedPreferences(this, Constants.SET_CALL, true);
|
|
|
+ Intent intent = new Intent("com.modular.main.FeedbackActivity");
|
|
|
+ intent.putExtra("type", 1);
|
|
|
+ intent.putExtra(AppConstant.EXTRA_URL, mConfig.help_url);
|
|
|
+ intent.putExtra(AppConstant.EXTRA_TITLE, "客服中心");
|
|
|
+ startActivity(intent);
|
|
|
+ }
|
|
|
}
|
|
|
}
|