Skip to content
This repository has been archived by the owner on Apr 17, 2019. It is now read-only.

Android. Edit candidate event. Send PATCH request. Vacancy Details #282

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
3 changes: 3 additions & 0 deletions Android/ZensoftHRCRM/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,6 @@ fastlane/Preview.html
fastlane/screenshots
fastlane/test_output
fastlane/readme.md

#Defaults file
app/src/main/java/com/erkprog/zensofthrcrm/data/Defaults.java
5 changes: 5 additions & 0 deletions Android/ZensoftHRCRM/.idea/codeStyles/codeStyleConfig.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions Android/ZensoftHRCRM/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,34 @@ dependencies {
//create fake responses from json files
implementation 'com.github.tientun:retrofit-mock-response:1.0.0'

implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'
implementation 'io.reactivex:rxjava:1.2.0'
implementation 'com.android.support:recyclerview-v7:27.1.1'

implementation 'io.reactivex.rxjava2:rxjava:2.1.16'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'

implementation 'com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0'

// butter knife
implementation "com.jakewharton:butterknife:8.8.1"
annotationProcessor "com.jakewharton:butterknife-compiler:8.8.1"


implementation 'com.thoughtbot:expandablerecyclerview:1.3'
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.firebase:firebase-messaging:17.1.0'

implementation 'com.google.android.gms:play-services-auth:15.0.1'

testImplementation 'junit:junit:4.12'
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'com.squareup.picasso:picasso:2.71828'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.support:cardview-v7:27.1.1'
}

apply plugin: 'com.google.gms.google-services'
32 changes: 25 additions & 7 deletions Android/ZensoftHRCRM/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,35 @@
android:name=".MainActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>

<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity android:name=".ui.candidates.candidateDetail.CandidateDetail"/>
<activity android:name=".ui.vacancies.vacancyDetail.VacancyDetail"/>
<activity
android:name=".ui.interviews.interviewDetail.InterviewDetail"/>
<activity
android:name=".ui.interviews.interviewDetail.InterviewDetail"
android:label="@string/interviews"/>
<activity android:name=".ui.interviews.createInterview.CreateInterview">
android:name=".ui.interviews.createInterview.CreateInterview">
</activity>

<service android:name=".firebase.MyFirebaseInstanceIdService">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
</intent-filter>
</service>
<service android:name=".firebase.MyMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
</intent-filter>
</service>

<activity
android:name=".ui.LoginActivity"
android:theme="@style/AppTheme.NoActionBar">

<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,26 @@
package com.erkprog.zensofthrcrm;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.Fragment;
import android.support.design.widget.NavigationView;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;

import com.erkprog.zensofthrcrm.ui.LoginActivity;
import com.erkprog.zensofthrcrm.ui.candidates.candidatesList.CandidatesFragment;
import com.erkprog.zensofthrcrm.ui.interviews.interviewsList.InterviewsFragment;
import com.google.android.gms.auth.api.signin.GoogleSignIn;
import com.google.android.gms.auth.api.signin.GoogleSignInAccount;
import com.google.android.gms.auth.api.signin.GoogleSignInClient;
import com.google.android.gms.auth.api.signin.GoogleSignInOptions;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.erkprog.zensofthrcrm.ui.requests.requestsList.RequestsFragment;
import com.erkprog.zensofthrcrm.ui.vacancies.vacanciesList.VacanciesFragment;

Expand All @@ -23,29 +31,33 @@

import de.hdodenhof.circleimageview.CircleImageView;


public class MainActivity extends AppCompatActivity
implements NavigationView.OnNavigationItemSelectedListener {

GoogleSignInClient mGoogleSignInClient;
CircleImageView userImage;
TextView userName;
TextView userEmail;


@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);

DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
DrawerLayout drawer = findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
drawer.addDrawerListener(toggle);
toggle.syncState();

NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
initNavigationView();
setUpGoogleAccount();
}

private void initNavigationView() {
NavigationView navigationView = findViewById(R.id.nav_view);
navigationView.setNavigationItemSelectedListener(this);

View navHeader = navigationView.getHeaderView(0);
Expand All @@ -54,41 +66,41 @@ protected void onCreate(Bundle savedInstanceState) {
userImage = navHeader.findViewById(R.id.user_profile_image);
}

@Override
public void onBackPressed() {
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
if (drawer.isDrawerOpen(GravityCompat.START)) {
drawer.closeDrawer(GravityCompat.START);
} else {
super.onBackPressed();
private void setUpGoogleAccount() {
GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestEmail()
.build();

mGoogleSignInClient = GoogleSignIn.getClient(this, gso);

GoogleSignInAccount account = GoogleSignIn.getLastSignedInAccount(this);
if (account != null) {
setUpNavHeader(account);
}
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
private void setUpNavHeader(GoogleSignInAccount account) {
userName.setText(account.getDisplayName());
userEmail.setText(account.getEmail());
Picasso.get()
.load(account.getPhotoUrl())
.placeholder(R.drawable.base_account)
.error(R.drawable.base_account)
.into(userImage);
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();

//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
public void onBackPressed() {
DrawerLayout drawer = findViewById(R.id.drawer_layout);
if (drawer.isDrawerOpen(GravityCompat.START)) {
drawer.closeDrawer(GravityCompat.START);
} else {
super.onBackPressed();
}

return super.onOptionsItemSelected(item);
}

@Override
public boolean onNavigationItemSelected(MenuItem item) {
// Handle navigation view item clicks here.
int id = item.getItemId();

if (id == R.id.nav_requests) {
Expand All @@ -102,33 +114,39 @@ public boolean onNavigationItemSelected(MenuItem item) {

} else if (id == R.id.nav_interviews) {
switchFragment(new InterviewsFragment());

} else if (id == R.id.nav_statistics) {

} else if (id == R.id.nav_sign_out) {
signOut();
}

DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
DrawerLayout drawer = findViewById(R.id.drawer_layout);
drawer.closeDrawer(GravityCompat.START);
return true;
}

private void signOut() {
mGoogleSignInClient.signOut()
.addOnCompleteListener(this, new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
onSignedOut();
}
});
}

private void onSignedOut() {
Intent intent = new Intent(this, LoginActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
startActivity(intent);
finish();
}

protected void switchFragment(Fragment fragment) {
getSupportFragmentManager()
.beginTransaction()
.replace(R.id.main_fragment_container, fragment)
.commit();
}


@Override
protected void onStart() {
super.onStart();
//TODO: set up navHeader with google account data here
userName.setText("Zensoft Hr");
userEmail.setText("[email protected]");
Picasso.get()
.load("https://www.codeproject.com/KB/GDI-plus/ImageProcessing2/img.jpg")
.placeholder(R.drawable.base_account)
.error(R.drawable.base_account)
.into(userImage);
}
}
Loading