From 27bc56bc7f94cb674e93b3186baa3d47633b50fb Mon Sep 17 00:00:00 2001 From: Mary Tran Date: Mon, 22 Oct 2018 23:09:55 -0400 Subject: [PATCH] Changed ListView to GridView for admin welcome page --- .../olympus/olympusservices/AdminWelcome.java | 18 ++++++++---------- .../main/res/layout/activity_admin_welcome.xml | 11 +++-------- 2 files changed, 11 insertions(+), 18 deletions(-) diff --git a/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/AdminWelcome.java b/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/AdminWelcome.java index 18cbdd2..4500309 100644 --- a/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/AdminWelcome.java +++ b/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/AdminWelcome.java @@ -2,7 +2,9 @@ package com.uottawa.olympus.olympusservices; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; +import android.view.View; import android.widget.ArrayAdapter; +import android.widget.GridView; import android.widget.ListView; import android.widget.TextView; @@ -18,22 +20,18 @@ public class AdminWelcome extends AppCompatActivity { DBHelper dbHelper = new DBHelper(this); List users = dbHelper.getAllUsers(); - String[] usernames = new String[users.size()+1]; - String[] usertypes = new String[users.size()+1]; + String[] usernames = new String[(users.size()+1)*2]; usernames[0] = "Username"; - usertypes[0] = "User Type"; + usernames[1] = "User Type"; Iterator iter = users.iterator(); for (int i=0; i(this, android.R.layout.simple_list_item_1, usernames); - ListView listView = (ListView) findViewById(R.id.Users); - listView.setAdapter(adapter); - ArrayAdapter adapter2 = new ArrayAdapter(this, android.R.layout.simple_list_item_1, usertypes); - ListView listView2 = (ListView) findViewById(R.id.Types); - listView2.setAdapter(adapter2); + GridView gridView = (GridView) findViewById(R.id.Users); + gridView.setAdapter(adapter); } } diff --git a/OlympusServices/app/src/main/res/layout/activity_admin_welcome.xml b/OlympusServices/app/src/main/res/layout/activity_admin_welcome.xml index 6f6890c..88468cf 100644 --- a/OlympusServices/app/src/main/res/layout/activity_admin_welcome.xml +++ b/OlympusServices/app/src/main/res/layout/activity_admin_welcome.xml @@ -30,20 +30,15 @@ android:layout_height="match_parent" android:orientation="horizontal"> - - + \ No newline at end of file