diff --git a/app/src/main/java/com/example/cosmosclient/views/GroupListActivity.java b/app/src/main/java/com/example/cosmosclient/views/GroupListActivity.java index 35d2ad3..386045f 100644 --- a/app/src/main/java/com/example/cosmosclient/views/GroupListActivity.java +++ b/app/src/main/java/com/example/cosmosclient/views/GroupListActivity.java @@ -59,6 +59,75 @@ Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); + + + + +// ArrayList GroupList = new ArrayList<>(); +// for (int i = 0; i < result.getGroupCount(); i++) { +// GroupList.add(result.getGroup(i).getName()); +// } + gridView = (DynamicGridView) findViewById(R.id.dynamic_grid); + + gridView.setOnDragListener(new DynamicGridView.OnDragListener() { + @Override + public void onDragStarted(int position) { + Log.d(TAG, "drag started at position" + position); + } + + @Override + public void onDragPositionsChanged(int oldPosition, int newPosition) { + Log.d(TAG, String.format("drag item position changed from %d to %d", oldPosition, newPosition)); + } + + }); + + gridView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() { + @Override + public boolean onItemLongClick(AdapterView parent, View view, int position, long id) { + gridView.startEditMode(position); + return true; + } + }); + + // グループの中にはいる(リクエスト一覧画面へ) + gridView.setOnItemClickListener(new AdapterView.OnItemClickListener() { + @Override + public void onItemClick(AdapterView parent, View view, int position, long id) { +// Toast.makeText(GroupListActivity.this, parent.getAdapter().getItem(position).toString(), +// Toast.LENGTH_SHORT).show(); + GroupJson group = result.getGroups().get(position); +// app.setCurrentGroup(new Group(group)); + + Intent intent=new Intent(GroupListActivity.this, com.example.cosmosclient.views.RequestListActivity.class); + startActivity(intent); + } + }); + + /* とりあえずの画面遷移なので変更するかも */ +// TextView group1 = findViewById(R.id.group1); +// group1.setOnClickListener(new View.OnClickListener() { +// @Override +// public void onClick(View view) { +// gridView.stopEditMode(); +// Intent intent=new Intent(GroupListActivity.this, com.example.cosmosclient.views.RequestListActivity.class); +// startActivity(intent); +// } +// }); + + + DrawerLayout drawer = findViewById(R.id.drawer_layout); + NavigationView navigationView = findViewById(R.id.nav_view); + ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( + this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); + drawer.addDrawerListener(toggle); + toggle.syncState(); + navigationView.setNavigationItemSelectedListener(this); + } + + @Override + protected void onStart() { + super.onStart(); final String uId,token; final Cosmos app = (Cosmos) getApplication(); uId = app.getuId(); @@ -74,7 +143,6 @@ userNameTextView.setText("ユーザ名:"+uName); userIDTextView.setText("ユーザID:"+uId); final ArrayList groupList = new ArrayList<>(); - //retrofitの処理 final Retrofit retrofit = new Retrofit.Builder() .baseUrl("http://nitta-lab-www.is.konan-u.ac.jp/cosmos/") @@ -149,67 +217,6 @@ "グループ情報取得失敗", Toast.LENGTH_SHORT).show(); } }); - -// ArrayList GroupList = new ArrayList<>(); -// for (int i = 0; i < result.getGroupCount(); i++) { -// GroupList.add(result.getGroup(i).getName()); -// } - gridView = (DynamicGridView) findViewById(R.id.dynamic_grid); - - gridView.setOnDragListener(new DynamicGridView.OnDragListener() { - @Override - public void onDragStarted(int position) { - Log.d(TAG, "drag started at position" + position); - } - - @Override - public void onDragPositionsChanged(int oldPosition, int newPosition) { - Log.d(TAG, String.format("drag item position changed from %d to %d", oldPosition, newPosition)); - } - - }); - - gridView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() { - @Override - public boolean onItemLongClick(AdapterView parent, View view, int position, long id) { - gridView.startEditMode(position); - return true; - } - }); - - // グループの中にはいる(リクエスト一覧画面へ) - gridView.setOnItemClickListener(new AdapterView.OnItemClickListener() { - @Override - public void onItemClick(AdapterView parent, View view, int position, long id) { -// Toast.makeText(GroupListActivity.this, parent.getAdapter().getItem(position).toString(), -// Toast.LENGTH_SHORT).show(); - GroupJson group = result.getGroups().get(position); - app.setCurrentGroup(new Group(group)); - - Intent intent=new Intent(GroupListActivity.this, com.example.cosmosclient.views.RequestListActivity.class); - startActivity(intent); - } - }); - - /* とりあえずの画面遷移なので変更するかも */ -// TextView group1 = findViewById(R.id.group1); -// group1.setOnClickListener(new View.OnClickListener() { -// @Override -// public void onClick(View view) { -// gridView.stopEditMode(); -// Intent intent=new Intent(GroupListActivity.this, com.example.cosmosclient.views.RequestListActivity.class); -// startActivity(intent); -// } -// }); - - - DrawerLayout drawer = findViewById(R.id.drawer_layout); - NavigationView navigationView = findViewById(R.id.nav_view); - ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( - this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); - drawer.addDrawerListener(toggle); - toggle.syncState(); - navigationView.setNavigationItemSelectedListener(this); } @Override