-
Notifications
You must be signed in to change notification settings - Fork 220
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dd6c926
commit ed6f06e
Showing
17 changed files
with
370 additions
and
24 deletions.
There are no files selected for viewing
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
9 changes: 9 additions & 0 deletions
9
app/src/main/java/org/fossasia/badgemagic/extensions/ActivityExtensions.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,9 @@ | ||
package org.fossasia.badgemagic.extensions | ||
|
||
import android.app.Activity | ||
import androidx.annotation.Keep | ||
|
||
@Keep | ||
fun <A : Activity> A.setRotation(rotation: Int) { | ||
this.requestedOrientation = rotation | ||
} |
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
53 changes: 53 additions & 0 deletions
53
app/src/main/java/org/fossasia/badgemagic/ui/fragments/DrawFragment.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,53 @@ | ||
package org.fossasia.badgemagic.ui.fragments | ||
|
||
import android.os.Bundle | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import android.widget.Toast | ||
import androidx.databinding.DataBindingUtil | ||
import androidx.lifecycle.Observer | ||
import kotlinx.android.synthetic.main.fragment_draw.* | ||
import org.fossasia.badgemagic.R | ||
import org.fossasia.badgemagic.databinding.FragmentDrawBinding | ||
import org.fossasia.badgemagic.ui.base.BaseFragment | ||
import org.fossasia.badgemagic.util.Converters | ||
import org.fossasia.badgemagic.util.StorageUtils | ||
import org.fossasia.badgemagic.viewmodels.DrawViewModel | ||
import org.koin.androidx.viewmodel.ext.android.viewModel | ||
|
||
class DrawFragment : BaseFragment() { | ||
|
||
companion object { | ||
@JvmStatic | ||
fun newInstance() = | ||
DrawFragment() | ||
} | ||
|
||
private val viewModel by viewModel<DrawViewModel>() | ||
|
||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { | ||
val binding = DataBindingUtil.inflate<FragmentDrawBinding>(inflater, R.layout.fragment_draw, container, false) | ||
binding.viewModel = viewModel | ||
return binding.root | ||
} | ||
|
||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | ||
super.onViewCreated(view, savedInstanceState) | ||
|
||
viewModel.savedButton.observe(this, Observer { | ||
if (it) { | ||
if (StorageUtils.saveClipArt(Converters.convertStringsToLEDHex(draw_layout.getCheckedList()))) | ||
Toast.makeText(requireContext(), R.string.clipart_saved_success, Toast.LENGTH_LONG).show() | ||
else | ||
Toast.makeText(requireContext(), R.string.clipart_saved_error, Toast.LENGTH_LONG).show() | ||
} | ||
}) | ||
|
||
viewModel.resetButton.observe(this, Observer { | ||
if (it) { | ||
draw_layout.resetCheckListWithDummyData() | ||
} | ||
}) | ||
} | ||
} |
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
Oops, something went wrong.