Skip to content

Commit

Permalink
UI connection with application for updating userprofile, and getting …
Browse files Browse the repository at this point in the history
…all group of user. Changing setting page: removing night mode, implementing about us btn and feedback btn
  • Loading branch information
jiahuij committed Apr 18, 2019
1 parent c9f4758 commit cb64a19
Show file tree
Hide file tree
Showing 9 changed files with 334 additions and 63 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,15 @@
import android.util.Log;
import android.view.MenuItem;

import com.example.joiintheclub.BackEnd.Group;
import com.example.joiintheclub.FrontEnd.SearchGroup.SearchMain;
import com.example.joiintheclub.FrontEnd.Setting.SettingMain;
import com.example.joiintheclub.FrontEnd.UserProfile.UserProfileMain;
import com.example.joiintheclub.R;

import java.util.Arrays;
import java.util.List;

@SuppressLint("Registered")
public class GroupMain extends AppCompatActivity
implements NavigationView.OnNavigationItemSelectedListener, RecycleAdapter.OnNoteListener {
Expand All @@ -40,11 +44,29 @@ protected void onCreate(Bundle savedInstanceState) {
recyclerView.setLayoutManager(layoutManager);
recyclerView.setHasFixedSize(true);

adapter = new RecycleAdapter(this);

String[][] groupInfo = Group.Get();
String [] groupNameBuf = new String[groupInfo.length];
String [] groupDetailBuf = new String[groupInfo.length];

for(int a = 0; a < groupInfo.length; a++)
{
groupNameBuf[a]= groupInfo[a][1];
groupDetailBuf[a] = groupInfo[a][2];
}
List<String> groupNames = Arrays.asList(groupNameBuf);

List<String> groupDetail = Arrays.asList(groupDetailBuf);


adapter = new RecycleAdapter(this, groupNames, groupDetail);
recyclerView.setAdapter(adapter);






Toolbar toolbar = (Toolbar) findViewById(R.id.Gbar);
setSupportActionBar(toolbar);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,41 +10,20 @@

import com.example.joiintheclub.R;

import java.util.List;

public class RecycleAdapter extends RecyclerView.Adapter<RecycleAdapter.ViewHolder> {

private OnNoteListener mOnNoteListener;
private static List<String> groupNames;
private List<String> groupDetail;

public RecycleAdapter(OnNoteListener mOnNoteListener) {
public RecycleAdapter(OnNoteListener mOnNoteListener, List<String> groupNames, List<String> groupDetail) {
this.mOnNoteListener = mOnNoteListener;
RecycleAdapter.groupNames = groupNames;
this.groupDetail = groupDetail;
}


private String[] groupNames =
{
"Group one",
"Group two",
"Group three",
"Group four",
"Group five",
"Group six",
"Group seven",
"Group eight",
"Group nine",
};

private String[] details =
{
"Group one details",
"Group two details",
"Group three details",
"Group four details",
"Group five details",
"Group six details",
"Group seven details",
"Group eight details",
"Group nine details",
};

private int[] groupIcon =
{
R.drawable.profile_icon,
Expand All @@ -70,16 +49,16 @@ public ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
@Override
public void onBindViewHolder(@NonNull ViewHolder viewHolder, int i) {


viewHolder.groupName.setText(groupNames[i]);
viewHolder.groupDetail.setText(details[i]);
viewHolder.groupName.setText(groupNames.get(i));
viewHolder.groupDetail.setText(groupDetail.get(i));
viewHolder.groupIcon.setImageResource(groupIcon[i]);

}

@Override
public int getItemCount() {
return groupNames.length;

return groupNames.size();
}

public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,12 @@ public ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
View v = LayoutInflater.from(viewGroup.getContext())
.inflate(R.layout.activity_search_card_view,viewGroup,false);



return new ViewHolder(v);
}

@Override
public void onBindViewHolder(@NonNull ViewHolder viewHolder, int i) {


viewHolder.groupName.setText(groupNames.get(i));
viewHolder.groupDetail.setText(groupDetail.get(i));
viewHolder.groupIcon.setImageResource(groupIcon[i]);
Expand Down Expand Up @@ -106,8 +103,5 @@ public void onClick(View v) {
}
});
}


}

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.example.joiintheclub.FrontEnd.Setting;

import android.annotation.SuppressLint;
import android.app.Dialog;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
Expand All @@ -11,6 +12,11 @@
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.MenuItem;
import android.view.View;
import android.widget.AutoCompleteTextView;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.ImageView;

import com.example.joiintheclub.FrontEnd.Group.GroupMain;
import com.example.joiintheclub.FrontEnd.UserProfile.UserProfileMain;
Expand All @@ -20,12 +26,39 @@
public class SettingMain extends AppCompatActivity
implements NavigationView.OnNavigationItemSelectedListener {

Dialog mDialog;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_setting_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.Sbar);
setSupportActionBar(toolbar);
mDialog = new Dialog(this);

Button Feedbcak;
Button AboutUs;

Feedbcak = findViewById(R.id.FeedbackBtn);
AboutUs = findViewById(R.id.AboutUsBtn);


Feedbcak.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {

openFeedbackDlg();

}
});

AboutUs.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {

openAboutDlg();
}
});


DrawerLayout drawer = (DrawerLayout) findViewById(R.id.setting_drawer);
Expand Down Expand Up @@ -78,4 +111,57 @@ public boolean onNavigationItemSelected(@NonNull MenuItem item) {
drawer.closeDrawer(GravityCompat.START);
return true;
}

private void openFeedbackDlg() {

final AutoCompleteTextView title;
final AutoCompleteTextView event_content;
ImageButton close_btn;
ImageView event;


mDialog.setContentView(R.layout.activity_feedbcak);
mDialog.show();

title = mDialog.findViewById(R.id.Btitle);
event_content = mDialog.findViewById(R.id.Bcontent);
close_btn = mDialog.findViewById(R.id.Feedback_close_icon);
event = mDialog.findViewById(R.id.Feedback_publish);

close_btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mDialog.dismiss();
}
});

event.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {

String stitle = title.getText().toString();
String Content = event_content.getText().toString();
String n;
}
});

}

private void openAboutDlg() {

ImageButton close_btn;

mDialog.setContentView(R.layout.activity_about_us);
mDialog.show();

close_btn = mDialog.findViewById(R.id.Feedback_close_icon);

close_btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mDialog.dismiss();
}
});

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.MenuItem;
import android.widget.TextView;

import com.example.joiintheclub.BackEnd.User;
import com.example.joiintheclub.FrontEnd.Group.GroupMain;
import com.example.joiintheclub.FrontEnd.SearchGroup.SearchMain;
import com.example.joiintheclub.FrontEnd.Setting.SettingMain;
Expand All @@ -20,6 +22,11 @@
public class UserProfileMain extends AppCompatActivity
implements NavigationView.OnNavigationItemSelectedListener {

TextView profileEmail;
TextView profileFirstName;
TextView profileLastName;


@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Expand All @@ -28,6 +35,15 @@ protected void onCreate(Bundle savedInstanceState) {
setSupportActionBar(toolbar);


profileEmail = findViewById(R.id.profileEmail);
profileFirstName = findViewById(R.id.profileFirstName);
profileLastName = findViewById(R.id.profileLastName);


setProfileData();



DrawerLayout drawer = (DrawerLayout) findViewById(R.id.profile_drawer);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
Expand All @@ -38,6 +54,18 @@ protected void onCreate(Bundle savedInstanceState) {
navigationView.setNavigationItemSelectedListener(this);
}

private void setProfileData() {

String[] UserData = new String[6];

UserData = User.userInformation("12321");

profileEmail.setText(UserData[3]);
profileLastName.setText(UserData[2]);
profileFirstName.setText(UserData[1]);

}

@Override
public void onBackPressed() {
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.profile_drawer);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="300dp"
android:layout_gravity="center"
tools:context=".FrontEnd.Setting.SettingMain"
android:layout_height="400dp"
android:background="@color/gray">

<ImageButton
android:id="@+id/Feedback_close_icon"
android:layout_width="30dp"
android:layout_height="30dp"
android:clickable="true"
android:layout_marginTop="1dp"
android:layout_marginEnd="1dp"
android:layout_marginRight="1dp"
android:background="@drawable/close_icon"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:contentDescription="@string/close_icon"
android:focusable="true" />

<TextView
android:id="@+id/aboutContent"
android:layout_width="match_parent"
android:layout_height="221dp"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:layout_marginBottom="8dp"
android:gravity="center"
android:text="Stephen Styffe
Zachary Chester
Wesly Shiozaki
Hannah Kim
Jiahui Jiang"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />


</android.support.constraint.ConstraintLayout>
Loading

0 comments on commit cb64a19

Please sign in to comment.