Skip to content

Commit

Permalink
Merge branch 'master' into matching-ui
Browse files Browse the repository at this point in the history
  • Loading branch information
ShivinDass committed Oct 27, 2019
2 parents ad57766 + 1e4aab3 commit e45b4ec
Show file tree
Hide file tree
Showing 28 changed files with 967 additions and 334 deletions.
3 changes: 3 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,7 @@ dependencies {
implementation 'com.google.firebase:firebase-auth:19.1.0'
implementation 'com.google.firebase:firebase-firestore:21.1.1'
implementation "com.google.android.material:material:1.1.0-alpha06"
implementation 'com.google.firebase:firebase-database:19.2.0'
implementation 'com.code-troopers.betterpickers:library:3.1.0'

}
5 changes: 4 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.mobilecomputing.sahayak">

<application
android:allowBackup="true"
tools:replace="android:allowBackup"
android:allowBackup="false"
android:fullBackupContent="false"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,28 +1,43 @@
package com.mobilecomputing.sahayak.Activities;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.WindowManager;

import androidx.appcompat.app.AppCompatActivity;

import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.mobilecomputing.sahayak.R;


public class MainActivity extends AppCompatActivity {

private static int TIME_OUT = 3000;
private FirebaseUser mUser;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getSupportActionBar().hide();
setContentView(R.layout.activity_main);

getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);

new Handler().postDelayed(new Runnable() {
@Override
public void run() {
Intent i = new Intent(MainActivity.this, OnboardingActivity.class);
mUser = FirebaseAuth.getInstance().getCurrentUser();

Intent i;
if(mUser != null){
i = new Intent(MainActivity.this, UserDashboard.class);
}
else{
i = new Intent(MainActivity.this, OnboardingActivity.class);
}
startActivity(i);
overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
finish();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
package com.mobilecomputing.sahayak.Activities;

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Toast;

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.mobilecomputing.sahayak.Adapters.ProposalAdapter;
import com.mobilecomputing.sahayak.JavaClasses.Proposal;
Expand Down Expand Up @@ -35,9 +34,9 @@ protected void onCreate(Bundle savedInstanceState) {
mAdapter.setClickListener(new ProposalAdapter.ItemClickListener() {
@Override
public void onItemClick(View view, int position) {
Proposal p=mAdapter.getItem(position);
Intent intent=new Intent(MenteeOptionsActivity.this,ProposalInformationActivity.class);
intent.putExtra("PROPOSAL_INFO",p);
Proposal p = mAdapter.getItem(position);
Intent intent = new Intent(MenteeOptionsActivity.this, ProposalInformationActivity.class);
intent.putExtra("PROPOSAL_INFO", p);
startActivity(intent);
}
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,43 @@
package com.mobilecomputing.sahayak.Activities;

import android.icu.util.Calendar;
import android.os.Bundle;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Debug;

import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.Spinner;
import android.widget.TextView;

import com.codetroopers.betterpickers.calendardatepicker.CalendarDatePickerDialogFragment;
import com.codetroopers.betterpickers.radialtimepicker.RadialTimePickerDialogFragment;
import androidx.appcompat.app.AppCompatActivity;

import com.mobilecomputing.sahayak.JavaClasses.Proposal;
import com.mobilecomputing.sahayak.JavaClasses.ProposalLab;
import com.mobilecomputing.sahayak.R;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import android.widget.Toast;

public class MentorOptionsActivity extends AppCompatActivity {
public class MentorOptionsActivity extends AppCompatActivity implements CalendarDatePickerDialogFragment.OnDateSetListener,
RadialTimePickerDialogFragment.OnTimeSetListener {
CalendarDatePickerDialogFragment calDatePicker;
private static final String FRAG_TAG_DATE_PICKER = "fragment_date_picker_name";
private static final String FRAG_TAG_TIME_PICKER = "timePickerDialogFragment";
private int year;
private int monthOfYear;
private int dayOfMonth;
private int hourOfDay;
private int minute;
private int flagDate;
private int flagTime;

@Override
protected void onCreate(Bundle savedInstanceState) {
Expand All @@ -30,25 +50,104 @@ protected void onCreate(Bundle savedInstanceState) {
categories.add("Information Technology");
categories.add("Sports");
categories.add("Health");
ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, categories);
Button addButton = (Button) findViewById(R.id.addButton);
final TextView skillsMentor = (TextView) findViewById(R.id.skillsMentor);
final TextView timeCapMentor = (TextView) findViewById(R.id.timeCapMentor);


final ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, categories);
spinner.setAdapter(dataAdapter);

final TextView skillsMentor = (TextView) findViewById(R.id.skillsMentor);
final ProposalLab proposalLab = ProposalLab.get(getApplicationContext());
// Button setDate = (Button) findViewById(R.id.setDate);
Button setTime = (Button) findViewById(R.id.setTime);
final Date date = new Date();
// setDate.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View v) {
// CalendarDatePickerDialogFragment cdp = new CalendarDatePickerDialogFragment()
// .setOnDateSetListener(MentorOptionsActivity.this)
// .setFirstDayOfWeek(Calendar.MONDAY)
// .setDoneText("Done")
// .setCancelText("Cancel");
// cdp.show(getSupportFragmentManager(), FRAG_TAG_DATE_PICKER);
// }
// });
setTime.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
RadialTimePickerDialogFragment rtpd = new RadialTimePickerDialogFragment()
.setOnTimeSetListener(MentorOptionsActivity.this)
.setDoneText("Done")
.setCancelText("Cancel");
rtpd.show(getSupportFragmentManager(), FRAG_TAG_TIME_PICKER);
}
});

final Spinner spinnerMinutes = (Spinner) findViewById(R.id.selectMinutes2);
List<String> minutes = new ArrayList<String>();
minutes.add("15");
minutes.add("30");
minutes.add("45");
minutes.add("60");
minutes.add("75");

final ArrayAdapter<String> minutesadapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, minutes);
spinnerMinutes.setAdapter(minutesadapter);

final Spinner spinnerMinutes2 = (Spinner) findViewById(R.id.selectMinutes);
List<String> minutes2 = new ArrayList<String>();
minutes2.add("15");
minutes2.add("30");
minutes2.add("45");
minutes2.add("60");
minutes2.add("75");

final ArrayAdapter<String> minutesadapter2 = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, minutes2);
spinnerMinutes2.setAdapter(minutesadapter);

Button addButton = (Button) findViewById(R.id.addButton);
addButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String sSkillsMentor = skillsMentor.getText().toString();
String sCategoryMentor = spinner.getSelectedItem().toString();
Integer ntimeCapMentor = Integer.parseInt(timeCapMentor.getText().toString());
Proposal proposal = new Proposal(999999,sSkillsMentor);
proposalLab.AddProposal(proposal);
skillsMentor.setText("");
timeCapMentor.setText("");

// if(flagDate*flagTime==1) {
if(flagTime==1) {
String sSkillsMentor = skillsMentor.getText().toString();
String sCategoryMentor = spinner.getSelectedItem().toString();
Integer endtime = Integer.parseInt(spinnerMinutes.getSelectedItem().toString());
Integer timeCap = Integer.parseInt(spinnerMinutes2.getSelectedItem().toString());
Integer endtimeHour = hourOfDay + endtime/60+ (minute + endtime)/60;
Integer endtimeMinute = (minute + endtime)%60;
Proposal proposal = new Proposal(proposalLab.getProposals().size(), sSkillsMentor);
proposal.setCategory(sCategoryMentor);
proposal.setDurationCap(timeCap);
proposal.setTimeWindow(hourOfDay,minute,endtimeHour,endtimeMinute);
proposalLab.AddProposal(proposal);
skillsMentor.setText("");
Toast.makeText(getApplicationContext(), "Succesfully added", Toast.LENGTH_LONG).show();
flagTime=0;
}
else {
Toast.makeText(getApplicationContext(), "Please Select Time", Toast.LENGTH_LONG).show();
}
}
});

}

@Override
public void onDateSet(CalendarDatePickerDialogFragment dialog, int year, int monthOfYear, int dayOfMonth) {
this.year=year;
this.monthOfYear=monthOfYear;
this.dayOfMonth=dayOfMonth;
flagDate=1;


}
@Override
public void onTimeSet(RadialTimePickerDialogFragment dialog, int hourOfDay, int minute) {
this.hourOfDay=hourOfDay;
this.minute=minute;
flagTime=1;

}

}
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
package com.mobilecomputing.sahayak.Activities;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

import androidx.appcompat.app.AppCompatActivity;

import com.google.android.gms.auth.api.signin.GoogleSignIn;
import com.google.android.gms.auth.api.signin.GoogleSignInAccount;
import com.google.android.gms.common.api.ApiException;
import com.google.android.gms.tasks.Task;
import com.mobilecomputing.sahayak.R;

public class OnboardingActivity extends AppCompatActivity {

public static final int RC_ONBOARDING_BACK = 12;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Expand All @@ -24,8 +32,17 @@ protected void onCreate(Bundle savedInstanceState) {
public void onClick(View view) {
Intent intent = new Intent(OnboardingActivity.this, SignInActivity.class);
//Intent intent = new Intent(OnboardingActivity.this, SignInActivity.class);
startActivity(intent);
startActivityForResult(intent, RC_ONBOARDING_BACK);
}
});
}

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);

if (requestCode == RC_ONBOARDING_BACK && resultCode==RESULT_OK) {
finish();
}
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package com.mobilecomputing.sahayak.Activities;

import android.os.Bundle;
import android.util.Log;

import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;

import android.os.Bundle;
import android.util.Log;

import com.mobilecomputing.sahayak.Fragments.proposalShowFragment;
import com.mobilecomputing.sahayak.JavaClasses.Proposal;
import com.mobilecomputing.sahayak.R;
Expand All @@ -18,15 +18,15 @@ protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_proposal_information);

FragmentManager fm=getSupportFragmentManager();
FragmentManager fm = getSupportFragmentManager();

Proposal mProposal = (Proposal) getIntent().getSerializableExtra("PROPOSAL_INFO");
Log.d("MYCODE",mProposal.getSkill()+"uno");
Log.d("MYCODE", mProposal.getSkill() + "uno");
Bundle bundle = new Bundle();
bundle.putSerializable("PROPOSAL_INFO",mProposal);
bundle.putSerializable("PROPOSAL_INFO", mProposal);

Fragment fragObj=new proposalShowFragment();
Fragment fragObj = new proposalShowFragment();
fragObj.setArguments(bundle);
fm.beginTransaction().replace(R.id.fragment,fragObj).commit();
fm.beginTransaction().replace(R.id.fragment, fragObj).commit();
}
}
Loading

0 comments on commit e45b4ec

Please sign in to comment.