|
|
@@ -2,6 +2,8 @@ package com.ht.gate;
|
|
|
|
|
|
import androidx.appcompat.app.AppCompatActivity;
|
|
|
import androidx.core.content.ContextCompat;
|
|
|
+import androidx.recyclerview.widget.LinearLayoutManager;
|
|
|
+import androidx.recyclerview.widget.RecyclerView;
|
|
|
|
|
|
import android.annotation.SuppressLint;
|
|
|
import android.content.ComponentName;
|
|
|
@@ -13,14 +15,20 @@ import android.os.IBinder;
|
|
|
import android.util.Log;
|
|
|
import android.view.Gravity;
|
|
|
import android.view.View;
|
|
|
+import android.widget.RelativeLayout;
|
|
|
import android.widget.TextView;
|
|
|
import android.widget.Toast;
|
|
|
|
|
|
|
|
|
+import com.ht.gate.domain.Meeting;
|
|
|
+
|
|
|
import org.greenrobot.eventbus.EventBus;
|
|
|
import org.greenrobot.eventbus.Subscribe;
|
|
|
import org.greenrobot.eventbus.ThreadMode;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
import butterknife.BindView;
|
|
|
import butterknife.ButterKnife;
|
|
|
import butterknife.OnClick;
|
|
|
@@ -35,7 +43,11 @@ public class MainActivity extends AppCompatActivity {
|
|
|
TextView tvSpaceName;
|
|
|
@BindView(R.id.tv_room_no)
|
|
|
TextView tvRoomNo;
|
|
|
-
|
|
|
+ @BindView(R.id.rl_meetings)
|
|
|
+ RelativeLayout rlMeetings;
|
|
|
+ @BindView(R.id.rv_meetings)
|
|
|
+ RecyclerView rvMeetings;
|
|
|
+ private MeetingAdapter adapter;
|
|
|
private SharedPreferences sharedPreferences;
|
|
|
private DoorService.DoorBinder mDoorBinder;
|
|
|
|
|
|
@@ -84,6 +96,9 @@ public class MainActivity extends AppCompatActivity {
|
|
|
passwordDialog.show();
|
|
|
});
|
|
|
bindService(new Intent(this, DoorService.class), connection, BIND_AUTO_CREATE);
|
|
|
+ adapter = new MeetingAdapter(this);
|
|
|
+ rvMeetings.setLayoutManager(new LinearLayoutManager(this));
|
|
|
+ rvMeetings.setAdapter(adapter);
|
|
|
}
|
|
|
|
|
|
@OnClick(R.id.btn_settings)
|
|
|
@@ -94,6 +109,14 @@ public class MainActivity extends AppCompatActivity {
|
|
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
|
|
public void onMessageEvent(String msg) {
|
|
|
updateStatus();
|
|
|
+ if ("meetings".equals(msg)) {
|
|
|
+ if (MyApplication.todayMeetings.isEmpty()) {
|
|
|
+ rlMeetings.setVisibility(View.GONE);
|
|
|
+ } else {
|
|
|
+ rlMeetings.setVisibility(View.VISIBLE);
|
|
|
+ }
|
|
|
+ adapter.notify();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
private void updateStatus() {
|