- activities _ ProductImageView.java
์ด๋ฏธ์ง์ Url, File ๊ฒฝ๋ก๋ฅผ ์ ์ฅํ๊ณ , ํด๋น ๊ฐ๋ค์ ๊ฐ์ ธ์ค๊ฑฐ๋ ์ค์ ํ ์ ์๋ ๊ฐ๋จํ ๋ฐ์ดํฐ ๋ชจ๋ธ ํด๋์ค, ์ด๋ฏธ์ง์ ๊ด๋ จ๋ ๋ฐ์ดํฐ๋ฅผ ํจ์จ์ ์ผ๋ก ๊ด๋ฆฌํ๋๋ฐ ์ฌ์ฉ
package com.example.stylerent.activities;
import android.net.Uri;
import java.io.File;
public class ProductImageView {
Uri uri;
File imagePath;
public ProductImageView(Uri uri, File imagePath) {
this.uri = uri;
this.imagePath = imagePath;
}
public Uri getUri() { /*์ ์ฅ๋ Uri ๊ฐ์ฒด๋ฅผ ๋ฐํํ๋ ๋ฉ์๋*/
return uri;
}
public File getImagePath() { /*์ ์ฅ๋ File ๊ฒฝ๋ก๋ฅผ ๋ฐํํ๋ ๋ฉ์๋*/
return imagePath;
}
public void setUri(Uri uri) { /*Uri ๊ฐ์ฒด๋ฅผ ์ค์ ํ๋ ๋ฉ์๋, ์ฃผ์ด์ง Uri๋ฅผ ๋ฉค๋ฒ ๋ณ์์ ์ ์ฅ*/
this.uri = uri;
}
public void setImagePath(File imagePath) { /*File ๊ฒฝ๋ก๋ฅผ ์ค์ ํ๋ ๋ฉ์๋, ์ฃผ์ด์ง File ๊ฒฝ๋ก๋ฅผ ๋ฉค๋ฒ ๋ณ์์ ์ ์ฅ*/
this.imagePath = imagePath;
}
}
Uri uri : ๋ฆฌ์์ค๋ฅผ ๋ํ๋ด๋ ๋ฐ ์ฌ์ฉ๋๋ ์๋ณ์, ์ด๋ฏธ์ง Uri๋ฅผ ์ ์ฅํ๋๋ฐ ์ฌ์ฉ
File imagePath : ํ์ผ์ด๋ ๋๋ ํ ๋ฆฌ ๊ฒฝ๋ก๋ ๋ํ๋ด๋ ๋ฐ ์ฌ์ฉ, ์ด๋ฏธ์ง ํ์ผ์ ๊ฒฝ๋ก๋ฅผ ์ ์ฅํ๋ ๋ฐ ์ฌ์ฉ
public ProductImageView(Uri uri, File imagePath): ProductImageView ****: ํด๋์ค์ ์์ฑ์, ์์ฑ์ Uri์ File ๊ฒฝ๋ก๋ฅผ ๋งค๊ฐ๋ณ์๋ก ๋ฐ์ ๋ฉค๋ฒ ๋ณ์์ ์ ์ฅ
- ProductModels_CustomFavModel.java
์ฌ์ฉ์์ ์ฆ๊ฒจ์ฐพ๊ธฐ์ ์๋ ์ํ ์ ๋ณด๋ฅผ ์ ์ฅํ๋๋ฐ ์ฌ์ฉ, ์ฌ์ฉ์๊ฐ ์ฆ๊ฒจ์ฐพ๊ธฐํ ์ํ๋ค์ ์ ๋ณด๋ฅผ ํจ์จ์ ์ผ๋ก ๊ด๋ฆฌํ๊ณ ํ์ฉํ ์ ์๋ค.
package com.example.stylerent.auth;
public class CustomFavModel {
private String productImage;
private Integer productId;
private String productName;
private String productPrice;
}
private String prodcutImage : ์ํ ์ด๋ฏธ์ง๋ฅผ ๋ํ๋ด๋ ๋ฌธ์์ด ๋ณ์, ์ด ๋ณ์๋ ์ํ์ ์ด๋ฏธ์ง URL์ด๋ ์ด๋ฏธ์ง ํ์ผ ๊ฒฝ๋ก ์ ์ฅ
private Integer productId : ์ํ ID๋ฅผ ๋ํ๋ด๋ ์ ์ํ ๋ณ์, ๊ฐ ์ํ์ ๊ณ ์ ํ ID ๊ฐ ์ ์ฅ
private String productName : ์ํ ์ด๋ฆ์ ๋ํ๋ด๋ ๋ฌธ์์ด ๋ณ์, ์ํ์ ์ด๋ฆ ์ ์ฅ
private String productPrice : ์ํ ๊ฐ๊ฒฉ์ ๋ํ๋ด๋ ๋ฌธ์์ด ๋ณ์, ์ํ ๊ฐ๊ฒฉ ์ ๋ณด ์ ์ฅ
- ProductModels_FavAdapterModel.java
์ฆ๊ฒจ์ฐพ๊ธฐ ๋ชฉ๋ก์ ํ์๋๋ ์ํ์ ์ ๋ณด๋ฅผ ๊ฐ๋จํ๊ฒ ์ ์ฅ, ์ฆ๊ฒจ์ฐพ๊ธฐ ๋ชฉ๋ก์ ํ์ํ๋ ์ด๋ํฐ์์ ๊ฐ ์์ดํ
์ ๋ํ ์ ๋ณด๋ฅผ ํจ์จ์ ์ผ๋ก ๊ด๋ฆฌํ๊ณ ํ์ฉ
package com.example.stylerent.auth;
import android.graphics.Bitmap;
public class FavAdapterModel {
private Integer productId;
private String productName;
private String productPrice;
private Bitmap imageBitmap; /*์ํ ์ด๋ฏธ์ง๋ฅผ ๋ํ๋ด๋ Bitmap ๊ฐ์ฒด*/
public FavAdapterModel(Integer productId, String productName, String productPrice, Bitmap imageBitmap) {
this.productId = productId;
this.productName = productName;
this.productPrice = productPrice;
this.imageBitmap = imageBitmap;
}
public Integer getProductId() { /*์ ์ฅ๋ ์ํ ID๋ฅผ ๋ฐํ*/
return productId;
}
public void setProductId(Integer productId) { /*์ํ ID ์ค์ , ์ฃผ์ด์ง ID๋ฅผ ๋ฉค๋ฒ ๋ณ์์ ์ ์ฅ*/
this.productId = productId;
}
public String getProductName() {
return productName;
}
public void setProductName(String productName) {
this.productName = productName;
}
public String getProductPrice() {
return productPrice;
}
public void setProductPrice(String productPrice) {
this.productPrice = productPrice;
}
public Bitmap getImageBitmap() { /*์ ์ฅ๋ ์ด๋ฏธ์ง ๋นํธ๋งต์ ๋ฐํํ๋ ๋ฉ์๋*/
return imageBitmap;
}
public void setImageBitmap(Bitmap imageBitmap) { /*์ด๋ฏธ์ง ๋นํธ๋งต์ ์ค์ ํ๋ ๋ฉ์๋, ์ฃผ์ด์ง ๋นํธ๋งต์ ๋ฉค๋ฒ ๋ณ์์ ์ ์ฅ */
this.imageBitmap = imageBitmap;
}
}
- ProductModels_FavModel.java
์ฆ๊ฒจ์ฐพ๊ธฐ์ ์๋ ์ํ ์ ๋ณด ์ ์ฅ, ์ฆ๊ฒจ์ฐพ๊ธฐ ๋ชฉ๋ก์ ํ์ํ๊ฑฐ๋ ์์ธ ์ ๋ณด๋ฅผ ํ์ํ๋ ๋ฑ์ ์์
์ ์ํํ ๋ ์ฌ์ฉ
package com.example.stylerent.auth;
import android.graphics.Bitmap;
public class FavModel {
private String productImage;
private Integer productId;
private String productName;
private String productPrice;
private Bitmap imageBitmap;
public FavModel(String productImage, Integer productId, String productName, String productPrice, Bitmap imageBitmap) {
this.productImage = productImage;
this.productId = productId;
this.productName = productName;
this.productPrice = productPrice;
this.imageBitmap = imageBitmap;
}
public Bitmap getImageBitmap() {
return imageBitmap;
}
public void setImageBitmap(Bitmap imageBitmap) {
this.imageBitmap = imageBitmap;
}
public String getProductName() {
return productName;
}
public void setProductName(String productName) {
this.productName = productName;
}
public String getProductImage() {
return productImage;
}
public void setProductImage(String productImage) {
this.productImage = productImage;
}
public Integer getProductId() {
return productId;
}
public void setProductId(Integer productId) {
this.productId = productId;
}
public String getProductPrice() {
return productPrice;
}
public void setProductPrice(String productPrice) {
this.productPrice = productPrice;
}
}
- ProductModels_lmagePathRequest.java
์ด๋ฏธ์ง ๊ฒฝ๋ก๋ฅผ ์๋ฒ์ ์ ๋ฌํ๊ธฐ ์ํ ์์ฒญ ๊ฐ์ฒด๋ฅผ ์ ์ํ๋๋ฐ ์ฌ์ฉ, ์๋ฅผ ๋ค์ด ์ด๋ฏธ์ง๋ฅผ ์
๋ก๋ํ๊ฑฐ๋ ์ด๋ฏธ์ง๋ฅผ ์์ฒญํ๊ธฐ ์ํ API์์ ์ฌ์ฉ
์ด๋ฏธ์ง ๊ฒฝ๋ก๋ฅผ ์บก์ํํ๊ณ ์ ๋ฌํ ์ ์๋ค.
package com.example.stylerent.auth;
public class ImagePathRequest {
private String imagePath;
public String getImagePath() {
return imagePath;
}
public void setImagePath(String imagePath) {
this.imagePath = imagePath;
}
public ImagePathRequest(String imagePath) {
this.imagePath = imagePath;
}
}
private String imagePath : ์ด๋ฏธ์ง ํ์ผ์ ๊ฒฝ๋ก ๋ํ๋ด๋ ๋ฌธ์์ด, ์ด๋ฏธ์ง ํ์ผ์ ๋ก์ปฌ ๊ฒฝ๋ก๋ ์๊ฒฉ ๊ฒฝ๋ก ์ ์ฅ
private String getImagePatr() : ์ ์ฅ๋ ์ด๋ฏธ์ง ๊ฒฝ๋ก๋ฅผ ๋ฐํํ๋ ๋ฉ์๋
public void setImagePath(String imagePath) : ์ด๋ฏธ์ง ๊ฒฝ๋ก๋ฅผ ์ค์ ํ๋ ๋ฉ์๋, ์ฃผ์ด์ง ๊ฒฝ๋ก๋ฅผ ๋ฉค๋ฒ ๋ณ์์ ์ ์ฅ
public ImagePathRequest(String imagePath) : ImagePathRequest ํด๋์ค ์์ฑ์, ์์ฑ์๋ ์ด๋ฏธ์ง ๊ฒฝ๋ก๋ฅผ ๋งค๊ฐ๋ณ์๋ก ๋ฐ์ ๋ฉค๋ฒ ๋ณ์์ ์ง์
์ด๋ฏธ์ง์ Url, File ๊ฒฝ๋ก๋ฅผ ์ ์ฅํ๊ณ , ํด๋น ๊ฐ๋ค์ ๊ฐ์ ธ์ค๊ฑฐ๋ ์ค์ ํ ์ ์๋ ๊ฐ๋จํ ๋ฐ์ดํฐ ๋ชจ๋ธ ํด๋์ค, ์ด๋ฏธ์ง์ ๊ด๋ จ๋ ๋ฐ์ดํฐ๋ฅผ ํจ์จ์ ์ผ๋ก ๊ด๋ฆฌํ๋๋ฐ ์ฌ์ฉ
Uri uri: ๋ฆฌ์์ค๋ฅผ ๋ํ๋ด๋ ๋ฐ ์ฌ์ฉ๋๋ ์๋ณ์, ์ด๋ฏธ์ง Uri๋ฅผ ์ ์ฅํ๋๋ฐ ์ฌ์ฉFile imagePath: ํ์ผ์ด๋ ๋๋ ํ ๋ฆฌ ๊ฒฝ๋ก๋ ๋ํ๋ด๋ ๋ฐ ์ฌ์ฉ, ์ด๋ฏธ์ง ํ์ผ์ ๊ฒฝ๋ก๋ฅผ ์ ์ฅํ๋ ๋ฐ ์ฌ์ฉpublic ProductImageView(Uri uri, File imagePath): ProductImageView****: ํด๋์ค์ ์์ฑ์, ์์ฑ์ Uri์ File ๊ฒฝ๋ก๋ฅผ ๋งค๊ฐ๋ณ์๋ก ๋ฐ์ ๋ฉค๋ฒ ๋ณ์์ ์ ์ฅ์ฌ์ฉ์์ ์ฆ๊ฒจ์ฐพ๊ธฐ์ ์๋ ์ํ ์ ๋ณด๋ฅผ ์ ์ฅํ๋๋ฐ ์ฌ์ฉ, ์ฌ์ฉ์๊ฐ ์ฆ๊ฒจ์ฐพ๊ธฐํ ์ํ๋ค์ ์ ๋ณด๋ฅผ ํจ์จ์ ์ผ๋ก ๊ด๋ฆฌํ๊ณ ํ์ฉํ ์ ์๋ค.
private String prodcutImage: ์ํ ์ด๋ฏธ์ง๋ฅผ ๋ํ๋ด๋ ๋ฌธ์์ด ๋ณ์, ์ด ๋ณ์๋ ์ํ์ ์ด๋ฏธ์ง URL์ด๋ ์ด๋ฏธ์ง ํ์ผ ๊ฒฝ๋ก ์ ์ฅprivate Integer productId: ์ํ ID๋ฅผ ๋ํ๋ด๋ ์ ์ํ ๋ณ์, ๊ฐ ์ํ์ ๊ณ ์ ํ ID ๊ฐ ์ ์ฅprivate String productName: ์ํ ์ด๋ฆ์ ๋ํ๋ด๋ ๋ฌธ์์ด ๋ณ์, ์ํ์ ์ด๋ฆ ์ ์ฅprivate String productPrice: ์ํ ๊ฐ๊ฒฉ์ ๋ํ๋ด๋ ๋ฌธ์์ด ๋ณ์, ์ํ ๊ฐ๊ฒฉ ์ ๋ณด ์ ์ฅ์ฆ๊ฒจ์ฐพ๊ธฐ ๋ชฉ๋ก์ ํ์๋๋ ์ํ์ ์ ๋ณด๋ฅผ ๊ฐ๋จํ๊ฒ ์ ์ฅ, ์ฆ๊ฒจ์ฐพ๊ธฐ ๋ชฉ๋ก์ ํ์ํ๋ ์ด๋ํฐ์์ ๊ฐ ์์ดํ ์ ๋ํ ์ ๋ณด๋ฅผ ํจ์จ์ ์ผ๋ก ๊ด๋ฆฌํ๊ณ ํ์ฉ
์ฆ๊ฒจ์ฐพ๊ธฐ์ ์๋ ์ํ ์ ๋ณด ์ ์ฅ, ์ฆ๊ฒจ์ฐพ๊ธฐ ๋ชฉ๋ก์ ํ์ํ๊ฑฐ๋ ์์ธ ์ ๋ณด๋ฅผ ํ์ํ๋ ๋ฑ์ ์์ ์ ์ํํ ๋ ์ฌ์ฉ
์ด๋ฏธ์ง ๊ฒฝ๋ก๋ฅผ ์๋ฒ์ ์ ๋ฌํ๊ธฐ ์ํ ์์ฒญ ๊ฐ์ฒด๋ฅผ ์ ์ํ๋๋ฐ ์ฌ์ฉ, ์๋ฅผ ๋ค์ด ์ด๋ฏธ์ง๋ฅผ ์ ๋ก๋ํ๊ฑฐ๋ ์ด๋ฏธ์ง๋ฅผ ์์ฒญํ๊ธฐ ์ํ API์์ ์ฌ์ฉ
์ด๋ฏธ์ง ๊ฒฝ๋ก๋ฅผ ์บก์ํํ๊ณ ์ ๋ฌํ ์ ์๋ค.
private String imagePath: ์ด๋ฏธ์ง ํ์ผ์ ๊ฒฝ๋ก ๋ํ๋ด๋ ๋ฌธ์์ด, ์ด๋ฏธ์ง ํ์ผ์ ๋ก์ปฌ ๊ฒฝ๋ก๋ ์๊ฒฉ ๊ฒฝ๋ก ์ ์ฅprivate String getImagePatr(): ์ ์ฅ๋ ์ด๋ฏธ์ง ๊ฒฝ๋ก๋ฅผ ๋ฐํํ๋ ๋ฉ์๋public void setImagePath(String imagePath): ์ด๋ฏธ์ง ๊ฒฝ๋ก๋ฅผ ์ค์ ํ๋ ๋ฉ์๋, ์ฃผ์ด์ง ๊ฒฝ๋ก๋ฅผ ๋ฉค๋ฒ ๋ณ์์ ์ ์ฅpublic ImagePathRequest(String imagePath) : ImagePathRequest ํด๋์ค ์์ฑ์, ์์ฑ์๋ ์ด๋ฏธ์ง ๊ฒฝ๋ก๋ฅผ ๋งค๊ฐ๋ณ์๋ก ๋ฐ์ ๋ฉค๋ฒ ๋ณ์์ ์ง์