-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from hexley21/release
Release 1.1.1
- Loading branch information
Showing
24 changed files
with
644 additions
and
94 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
app/src/main/java/com/hxl/arithmathics/presentation/fragment/info/InfoFragment.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package com.hxl.arithmathics.presentation.fragment.info | ||
|
||
import android.content.Intent | ||
import android.net.Uri | ||
import android.os.Bundle | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import androidx.fragment.app.Fragment | ||
import com.hxl.arithmathics.R | ||
import com.hxl.arithmathics.databinding.FragmentInfoBinding | ||
import com.hxl.arithmathics.presentation.activity.MainActivity | ||
import com.hxl.arithmathics.presentation.fragment.info.credits.CreditFragment | ||
import java.util.* | ||
|
||
|
||
class InfoFragment : Fragment() { | ||
lateinit var binding: FragmentInfoBinding | ||
|
||
override fun onCreateView( | ||
inflater: LayoutInflater, | ||
container: ViewGroup?, | ||
savedInstanceState: Bundle? | ||
): View { | ||
binding = FragmentInfoBinding.inflate(layoutInflater, container, false) | ||
|
||
binding.year = Calendar.getInstance().get(Calendar.YEAR).toString() | ||
return binding.root | ||
} | ||
|
||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | ||
super.onViewCreated(view, savedInstanceState) | ||
|
||
binding.tvEmail.setOnClickListener { openEmail() } | ||
binding.tvGithub.setOnClickListener { | ||
openWeb("https://" + requireContext().getString(R.string.github_page)) | ||
} | ||
binding.tvPrivacyPolicy.setOnClickListener { openWeb(requireContext().getString(R.string.privacy_policy)) } | ||
binding.tvCredits.setOnClickListener { (requireActivity() as MainActivity).replaceFragment(CreditFragment(), true) } | ||
|
||
} | ||
|
||
private fun openEmail() { | ||
startActivity( | ||
Intent( | ||
Intent.ACTION_SENDTO, | ||
Uri.parse("mailto:${requireContext().getString(R.string.developer)}") | ||
) | ||
) | ||
} | ||
|
||
private fun openWeb(url: String) { | ||
requireActivity().startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(url))) | ||
} | ||
|
||
} |
29 changes: 29 additions & 0 deletions
29
app/src/main/java/com/hxl/arithmathics/presentation/fragment/info/credits/CreditFragment.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.hxl.arithmathics.presentation.fragment.info.credits | ||
|
||
import android.os.Bundle | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import androidx.fragment.app.Fragment | ||
import androidx.recyclerview.widget.DividerItemDecoration | ||
import androidx.recyclerview.widget.LinearLayoutManager | ||
import com.hxl.arithmathics.databinding.FragmentCreditsBinding | ||
|
||
class CreditFragment: Fragment() { | ||
|
||
lateinit var binding: FragmentCreditsBinding | ||
override fun onCreateView( | ||
inflater: LayoutInflater, | ||
container: ViewGroup?, | ||
savedInstanceState: Bundle? | ||
): View { | ||
binding = FragmentCreditsBinding.inflate(inflater, container, false) | ||
|
||
binding.rvCredits.layoutManager = LinearLayoutManager(requireContext()) | ||
binding.rvCredits.adapter = CreditsAdapter() | ||
binding.rvCredits.addItemDecoration( | ||
DividerItemDecoration(requireContext() , DividerItemDecoration.VERTICAL) | ||
) | ||
return binding.root | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
app/src/main/java/com/hxl/arithmathics/presentation/fragment/info/credits/CreditsAdapter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package com.hxl.arithmathics.presentation.fragment.info.credits | ||
|
||
import android.content.Intent | ||
import android.net.Uri | ||
import android.view.LayoutInflater | ||
import android.view.ViewGroup | ||
import androidx.recyclerview.widget.RecyclerView | ||
import com.hxl.arithmathics.R | ||
import com.hxl.arithmathics.databinding.ItemCreditBinding | ||
|
||
class CreditsAdapter : RecyclerView.Adapter<CreditsAdapter.ViewHolder>() { | ||
class ViewHolder(internal val binding: ItemCreditBinding) : | ||
RecyclerView.ViewHolder(binding.root) { | ||
init { | ||
itemView.setOnClickListener { | ||
binding.root.context.startActivity( | ||
Intent(Intent.ACTION_VIEW , Uri.parse( | ||
binding.root.context.resources.getStringArray(R.array.credits_links)[adapterPosition] | ||
)) | ||
) | ||
} | ||
} | ||
} | ||
|
||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder { | ||
val binding = | ||
ItemCreditBinding.inflate(LayoutInflater.from(parent.context) , parent , false) | ||
return ViewHolder(binding) | ||
} | ||
|
||
override fun onBindViewHolder(holder: ViewHolder , position: Int) { | ||
val resources = holder.binding.root.context.resources | ||
val titleItem = resources.getStringArray(R.array.credits_title)[position] | ||
val descItem = resources.getStringArray(R.array.credits_desc)[position] | ||
holder.binding.tvCreditTitle.text = titleItem | ||
holder.binding.tvCreditDesc.text = descItem | ||
} | ||
|
||
override fun getItemCount(): Int { | ||
return 8 | ||
} | ||
|
||
} |
Oops, something went wrong.