forked from element-hq/element-android
-
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.
- Loading branch information
Showing
10 changed files
with
215 additions
and
1 deletion.
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
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
21 changes: 21 additions & 0 deletions
21
vector/src/main/java/im/vector/app/features/roomprofile/polls/RoomPollsAction.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,21 @@ | ||
/* | ||
* Copyright (c) 2020 New Vector Ltd | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package im.vector.app.features.roomprofile.polls | ||
|
||
import im.vector.app.core.platform.VectorViewModelAction | ||
|
||
sealed class RoomPollsAction : VectorViewModelAction |
61 changes: 61 additions & 0 deletions
61
vector/src/main/java/im/vector/app/features/roomprofile/polls/RoomPollsFragment.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,61 @@ | ||
/* | ||
* Copyright (c) 2020 New Vector Ltd | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package im.vector.app.features.roomprofile.polls | ||
|
||
import android.os.Bundle | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import com.airbnb.mvrx.args | ||
import com.airbnb.mvrx.fragmentViewModel | ||
import com.airbnb.mvrx.withState | ||
import dagger.hilt.android.AndroidEntryPoint | ||
import im.vector.app.core.platform.VectorBaseFragment | ||
import im.vector.app.databinding.FragmentRoomPollsBinding | ||
import im.vector.app.features.roomprofile.RoomProfileArgs | ||
|
||
@AndroidEntryPoint | ||
class RoomPollsFragment : VectorBaseFragment<FragmentRoomPollsBinding>() { | ||
|
||
private val roomProfileArgs: RoomProfileArgs by args() | ||
|
||
private val viewModel: RoomPollsViewModel by fragmentViewModel() | ||
|
||
override fun getBinding(inflater: LayoutInflater, container: ViewGroup?): FragmentRoomPollsBinding { | ||
return FragmentRoomPollsBinding.inflate(inflater, container, false) | ||
} | ||
|
||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | ||
super.onViewCreated(view, savedInstanceState) | ||
|
||
setupToolbar() | ||
setupTabs() | ||
} | ||
|
||
private fun setupToolbar() { | ||
setupToolbar(views.roomPollsToolbar) | ||
.allowBack() | ||
} | ||
|
||
private fun setupTabs() { | ||
// TODO | ||
} | ||
|
||
override fun invalidate() = withState(viewModel) { | ||
// TODO | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
vector/src/main/java/im/vector/app/features/roomprofile/polls/RoomPollsViewEvent.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,21 @@ | ||
/* | ||
* Copyright (c) 2020 New Vector Ltd | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package im.vector.app.features.roomprofile.polls | ||
|
||
import im.vector.app.core.platform.VectorViewEvents | ||
|
||
sealed class RoomPollsViewEvent : VectorViewEvents |
41 changes: 41 additions & 0 deletions
41
vector/src/main/java/im/vector/app/features/roomprofile/polls/RoomPollsViewModel.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,41 @@ | ||
/* | ||
* Copyright (c) 2020 New Vector Ltd | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package im.vector.app.features.roomprofile.polls | ||
|
||
import com.airbnb.mvrx.MavericksViewModelFactory | ||
import dagger.assisted.Assisted | ||
import dagger.assisted.AssistedFactory | ||
import dagger.assisted.AssistedInject | ||
import im.vector.app.core.di.MavericksAssistedViewModelFactory | ||
import im.vector.app.core.di.hiltMavericksViewModelFactory | ||
import im.vector.app.core.platform.VectorViewModel | ||
|
||
class RoomPollsViewModel @AssistedInject constructor( | ||
@Assisted initialState: RoomPollsViewState, | ||
) : VectorViewModel<RoomPollsViewState, RoomPollsAction, RoomPollsViewEvent>(initialState) { | ||
|
||
@AssistedFactory | ||
interface Factory : MavericksAssistedViewModelFactory<RoomPollsViewModel, RoomPollsViewState> { | ||
override fun create(initialState: RoomPollsViewState): RoomPollsViewModel | ||
} | ||
|
||
companion object : MavericksViewModelFactory<RoomPollsViewModel, RoomPollsViewState> by hiltMavericksViewModelFactory() | ||
|
||
override fun handle(action: RoomPollsAction) { | ||
// do nothing for now | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
vector/src/main/java/im/vector/app/features/roomprofile/polls/RoomPollsViewState.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,27 @@ | ||
/* | ||
* Copyright (c) 2022 New Vector Ltd | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package im.vector.app.features.roomprofile.polls | ||
|
||
import com.airbnb.mvrx.MavericksState | ||
import im.vector.app.features.roomprofile.RoomProfileArgs | ||
|
||
data class RoomPollsViewState( | ||
val roomId: String, | ||
) : MavericksState { | ||
|
||
constructor(roomProfileArgs: RoomProfileArgs) : this(roomId = roomProfileArgs.roomId) | ||
} |
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,30 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
android:id="@+id/coordinatorLayout" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent"> | ||
|
||
<com.google.android.material.appbar.AppBarLayout | ||
android:id="@+id/appBarLayout" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toTopOf="parent"> | ||
|
||
<com.google.android.material.appbar.MaterialToolbar | ||
android:id="@+id/roomPollsToolbar" | ||
android:layout_width="match_parent" | ||
android:layout_height="?actionBarSize" | ||
app:title="@string/room_profile_section_more_polls" /> | ||
|
||
</com.google.android.material.appbar.AppBarLayout> | ||
|
||
<androidx.viewpager2.widget.ViewPager2 | ||
android:id="@+id/roomPollsViewPager" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
app:layout_behavior="@string/appbar_scrolling_view_behavior" /> | ||
|
||
</androidx.constraintlayout.widget.ConstraintLayout> |