Skip to content

Commit

Permalink
Main in subletting!!
Browse files Browse the repository at this point in the history
  • Loading branch information
vavali08 committed Oct 25, 2024
1 parent 2fa7856 commit 0360ff1
Show file tree
Hide file tree
Showing 6 changed files with 91 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import com.pennapps.labs.pennmobile.adapters.SubletDetailsPagerAdapter
import com.pennapps.labs.pennmobile.api.StudentLife
import com.pennapps.labs.pennmobile.classes.SublettingViewModel
import com.pennapps.labs.pennmobile.components.collapsingtoolbar.ToolbarBehavior
import kotlinx.android.synthetic.main.fragment_dining_holder.view.appbar_home_holder

//Pulls existing datamodel from previous
class SubletDetailsHolderFragment(private val dataModel: SublettingViewModel, private val subletNumber: Int) : Fragment() {
Expand Down Expand Up @@ -57,8 +56,4 @@ class SubletDetailsHolderFragment(private val dataModel: SublettingViewModel, pr

}


private fun initAppBar(view: View) {
(view.appbar_home_holder.layoutParams as CoordinatorLayout.LayoutParams).behavior = ToolbarBehavior()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import com.pennapps.labs.pennmobile.adapters.SubletterPagerAdapter
import com.pennapps.labs.pennmobile.api.StudentLife
import com.pennapps.labs.pennmobile.classes.SublettingViewModel
import com.pennapps.labs.pennmobile.components.collapsingtoolbar.ToolbarBehavior
import kotlinx.android.synthetic.main.fragment_dining_holder.view.appbar_home_holder

class SubletterHolderFragment : Fragment() {
lateinit var subletterPagerAdapter: SubletterPagerAdapter
Expand Down Expand Up @@ -46,8 +45,8 @@ class SubletterHolderFragment : Fragment() {

}


private fun initAppBar(view: View) {
(view.appbar_home_holder.layoutParams as CoordinatorLayout.LayoutParams).behavior = ToolbarBehavior()
}
//
// private fun initAppBar(view: View) {
// (view.appbar_home_holder.layoutParams as CoordinatorLayout.LayoutParams).behavior = ToolbarBehavior()
// }
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import com.pennapps.labs.pennmobile.DiningHolderFragment
import com.pennapps.labs.pennmobile.GsrTabbedFragment
import com.pennapps.labs.pennmobile.HomeFragment
import com.pennapps.labs.pennmobile.LaundryFragment
import com.pennapps.labs.pennmobile.Subletting.SublettingFragment
import com.pennapps.labs.pennmobile.morefragments.MoreFragment

class MainPagerAdapter(
Expand All @@ -19,7 +20,7 @@ class MainPagerAdapter(
HOME_POSITION -> HomeFragment()
DINING_POSITION -> DiningHolderFragment()
GSR_POSITION -> GsrTabbedFragment()
LAUNDRY_POSITION -> LaundryFragment()
LAUNDRY_POSITION -> SublettingFragment()
MORE_POSITION -> MoreFragment()
else -> HomeFragment()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ import com.bumptech.glide.Glide
import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions
import com.pennapps.labs.pennmobile.MainActivity
import com.pennapps.labs.pennmobile.R
import com.pennapps.labs.pennmobile.SublesseeDetailsFragment
import com.pennapps.labs.pennmobile.Subletting.SublesseeDetailsFragment
import com.pennapps.labs.pennmobile.Subletting.SubletDetailsFragment
import com.pennapps.labs.pennmobile.Subletting.SubletDetailsHolderFragment
import com.pennapps.labs.pennmobile.classes.Sublet
import com.pennapps.labs.pennmobile.classes.SublettingModel
import com.pennapps.labs.pennmobile.classes.SublettingViewModel
import kotlinx.android.synthetic.main.include_main.expandable_bottom_bar
import kotlinx.android.synthetic.main.include_main.toolbar
//import kotlinx.android.synthetic.main.include_main.expandable_bottom_bar
//import kotlinx.android.synthetic.main.include_main.toolbar

class PostedSubletsListAdapter(private val dataModel: SublettingViewModel):
RecyclerView.Adapter<PostedSubletsListAdapter.SublettingCardViewHolder>() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,30 @@
import com.pennapps.labs.pennmobile.classes.GSRLocation;
import com.pennapps.labs.pennmobile.classes.GSRReservation;
import com.pennapps.labs.pennmobile.classes.LaundryRoom;
import com.pennapps.labs.pennmobile.classes.Offer;
import com.pennapps.labs.pennmobile.classes.Poll;
import com.pennapps.labs.pennmobile.classes.Post;
import com.pennapps.labs.pennmobile.classes.SaveAccountResponse;
import com.pennapps.labs.pennmobile.classes.Sublet;
import com.pennapps.labs.pennmobile.classes.Venue;
import com.pennapps.labs.pennmobile.classes.WhartonStatus;

import java.util.ArrayList;
import java.util.List;

import okhttp3.MultipartBody;
import retrofit.Callback;
import retrofit.client.Response;
import retrofit.http.Body;
import retrofit.http.DELETE;
import retrofit.http.Field;
import retrofit.http.FormUrlEncoded;
import retrofit.http.GET;
import retrofit.http.Header;
import retrofit.http.Headers;
import retrofit.http.POST;
import retrofit.http.PUT;
import retrofit.http.Part;
import retrofit.http.Path;
import retrofit.http.Query;
import rx.Observable;
Expand Down Expand Up @@ -190,4 +196,78 @@ void sendFitnessPref(
@Header("Authorization") String bearerToken,
@Body FitnessRequest rooms,
Callback<Response> callback);


@Headers({"Content-Type: application/json"})
@POST("/sublet/properties/")
void createSublet(
@Header("Authorization") String bearerToken,
@Body Sublet sublet,
Callback<Sublet> callback);

@Headers({"Content-Type: application/json"})
@POST("/sublet/properties/{sublet_id}/images/")
void createImage(
@Header("Authorization") String bearerToken,
@Path("sublet_id") int id,
@Part("sublet") MultipartBody.Part sublet,
@Part("image") MultipartBody.Part partFile,
Callback<Sublet> callback
);

@Headers({"Content-Type: application/json"})
@GET("/sublet/properties/")
Observable<List<Sublet>> getPostedSublets(
@Header("Authorization") String bearerToken,
@Query("subletter") boolean subletter);

@Headers({"Content-Type: application/json"})
@GET("/sublet/properties/{sublet_id}/offers/")
Observable<List<Offer>> getSubletOffers(
@Header("Authorization") String bearerToken,
@Path("sublet_id") int id
);

@Headers({"Content-Type: application/json"})
@DELETE("/sublet/properties/{sublet_id}")
void deleteSublet(
@Header("Authorization") String bearerToken,
@Path("sublet_id") int id,
Callback<Sublet> callback);

@Headers({"Content-Type: application/json"})
@PUT("/sublet/properties/{sublet_id}")
void editSublet(
@Header("Authorization") String bearerToken,
@Path("sublet_id") int id,
@Body Sublet sublet,
Callback<Sublet> callback
);

@Headers({"Content-Type: application/json"})
@GET("/sublet/properties/")
Observable<List<Sublet>> getSublets(
@Header("Authorization") String bearerToken);

@Headers({"Content-Type: application/json"})
@POST("/sublet/properties/{sublet_id}/favorites/")
void addFavoriteSublet(
@Header("Authorization") String bearerToken,
@Path("sublet_id") int id,
@Body Sublet sublet,
Callback<Sublet> callback);

@Headers({"Content-Type: application/json"})
@GET("/sublet/favorites/")
Observable<List<Sublet>> getSubletFavorites(
@Header("Authorization") String bearerToken);

@Headers({"Content-Type: application/json"})
@POST("/sublet/properties/{sublet_id}/offers/")
void createOffer(
@Header("Authorization") String bearerToken,
@Path("sublet_id") int id,
@Body Offer offer,
Callback<Offer> callback);
}

4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '8.6.1' apply false
id 'com.android.library' version '8.6.1' apply false
id 'com.android.application' version '8.0.2' apply false
id 'com.android.library' version '8.0.2' apply false
id 'org.jetbrains.kotlin.android' version '1.9.24' apply false
id 'com.google.gms.google-services' version "4.4.0" apply false
id("com.google.firebase.crashlytics") version "2.9.9" apply false
Expand Down

0 comments on commit 0360ff1

Please sign in to comment.