Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix]作品投稿画面のHTTP通信できるようにする #120

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .idea/vcs.xml

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

Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,22 @@ package com.example.funcy_portfolio_android.model.data
data class WorkData(
val title: String,
val description: String,
val thumbnail: String,
val user_icon: String,
val user_name: String,
val userID: String,
val images: List<ImageData>,
val URL: String,
val work_url: String,
val movie_url: String,
val tags: List<TagData>,
val group: String?,
val group: String,
val security: Int,
)

data class ImageData(
val Image: String
val image: String
)

data class TagData(
val Tag: String
val tag: String
)
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class WorkDetailFragment : Fragment() {
})

viewModel.images.observe(viewLifecycleOwner, Observer {
Glide.with(this).load(it[0].Image).error(R.drawable.img_work_detail_thumbnail).into(binding.imgThumbnail)
Glide.with(this).load(it[0].image).error(R.drawable.img_work_detail_thumbnail).into(binding.imgThumbnail)
})

viewModel.workDetailStatus.observe(viewLifecycleOwner, Observer { status ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class WorkDetailViewModel : ViewModel() {
chipGroup.removeAllViews()
_tagList.value?.forEach { tag ->
val chip = Chip(context)
chip.text = tag.Tag
chip.text = tag.tag
chipGroup.addView(chip)
}
}
Expand All @@ -91,7 +91,7 @@ class WorkDetailViewModel : ViewModel() {
_explanation.value = workValue.description
_tagList.value = workValue.tags
_youtubeUrl.value = workValue.movie_url
_githubUrl.value = workValue.URL
_githubUrl.value = workValue.work_url
}

//Web遷移系の処理//////////////////////////////////
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.example.funcy_portfolio_android.ui.workRegister
import android.app.AlertDialog
import android.content.Context
import android.content.DialogInterface
import android.content.SharedPreferences
import android.os.Bundle
import android.util.Log
import android.view.KeyEvent
Expand All @@ -21,10 +22,14 @@ import androidx.recyclerview.widget.LinearLayoutManager
import com.example.funcy_portfolio_android.R
import com.example.funcy_portfolio_android.databinding.FragmentWorkRegisterBinding
import com.example.funcy_portfolio_android.databinding.ItemTagBinding
import com.example.funcy_portfolio_android.model.localDataSource.SharedPref
import com.example.funcy_portfolio_android.ui.mypage.MypageViewModel

class WorkRegisterFragment : Fragment() {
private val viewModel: WorkRegisterViewModel by activityViewModels()
private lateinit var binding: FragmentWorkRegisterBinding
private val sharePreference = SharedPref(requireActivity())


//画像選択
private var image_launchar = registerForActivityResult(ActivityResultContracts.OpenMultipleDocuments()) {
Expand Down Expand Up @@ -102,7 +107,11 @@ class WorkRegisterFragment : Fragment() {
binding.etWorkDescription.text.toString(),
1,
binding.etGitHubLink.text.toString(),
binding.etYoutubeLink.text.toString()
binding.etYoutubeLink.text.toString(),
"no group",
"no icon",
MypageViewModel().userName.toString(),
sharePreference.readSharedPref(SharedPref.KEY_USER_DATA).toString()
)

findNavController().navigate(R.id.action_WorkRegisterFragment_to_MainFragment)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,19 +80,27 @@ class WorkRegisterViewModel : ViewModel() {
description: String,
security: Int,
work_url: String,
youtube_url: String
youtube_url: String,
group: String,
user_icon: String,
user_name: String,
userID: String
): String? {
viewModelScope.launch {
val postTagList = stringTagListToTagList(tags)
res = workRepository.registerWork(
WorkData(
title,
description,
thumbnail.toString(),
user_icon,
user_name,
userID,
listOf(ImageData("")),
work_url,
youtube_url,
postTagList,
null,
group,
security
)
)
Expand Down