mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-24 02:25:19 +00:00
Fix various minor UI issues
This commit is contained in:
parent
29f988d45c
commit
9b40a2c0b8
@ -5,10 +5,14 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<ScrollView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content" >
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/mainContentContainer"
|
android:id="@+id/mainContentContainer"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
@ -34,6 +38,8 @@
|
|||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
</ScrollView>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/emptyStateContainer"
|
android:id="@+id/emptyStateContainer"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
android:layout_centerInParent="true">
|
android:layout_centerInParent="true">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
android:id="@+id/emptyStateMessageTextView"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textSize="@dimen/medium_font_size"
|
android:textSize="@dimen/medium_font_size"
|
||||||
|
@ -8,9 +8,7 @@ import android.os.Bundle
|
|||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import androidx.fragment.app.FragmentPagerAdapter
|
import androidx.fragment.app.FragmentPagerAdapter
|
||||||
import android.text.InputType
|
import android.text.InputType
|
||||||
import android.view.LayoutInflater
|
import android.view.*
|
||||||
import android.view.View
|
|
||||||
import android.view.ViewGroup
|
|
||||||
import android.view.inputmethod.EditorInfo
|
import android.view.inputmethod.EditorInfo
|
||||||
import android.view.inputmethod.InputMethodManager
|
import android.view.inputmethod.InputMethodManager
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
@ -43,9 +41,21 @@ class CreatePrivateChatActivity : PassphraseRequiredActionBarActivity(), ScanQRC
|
|||||||
viewPager.adapter = adapter
|
viewPager.adapter = adapter
|
||||||
tabLayout.setupWithViewPager(viewPager)
|
tabLayout.setupWithViewPager(viewPager)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onCreateOptionsMenu(menu: Menu?): Boolean {
|
||||||
|
menuInflater.inflate(R.menu.menu_done, menu)
|
||||||
|
return true
|
||||||
|
}
|
||||||
// endregion
|
// endregion
|
||||||
|
|
||||||
// region Interaction
|
// region Interaction
|
||||||
|
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||||
|
when(item.itemId) {
|
||||||
|
R.id.doneButton -> adapter.enterPublicKeyFragment.createPrivateChatIfPossible()
|
||||||
|
}
|
||||||
|
return super.onOptionsItemSelected(item)
|
||||||
|
}
|
||||||
|
|
||||||
override fun handleQRCodeScanned(hexEncodedPublicKey: String) {
|
override fun handleQRCodeScanned(hexEncodedPublicKey: String) {
|
||||||
createPrivateChatIfPossible(hexEncodedPublicKey)
|
createPrivateChatIfPossible(hexEncodedPublicKey)
|
||||||
}
|
}
|
||||||
@ -71,6 +81,7 @@ class CreatePrivateChatActivity : PassphraseRequiredActionBarActivity(), ScanQRC
|
|||||||
|
|
||||||
// region Adapter
|
// region Adapter
|
||||||
private class CreatePrivateChatActivityAdapter(val activity: CreatePrivateChatActivity) : FragmentPagerAdapter(activity.supportFragmentManager) {
|
private class CreatePrivateChatActivityAdapter(val activity: CreatePrivateChatActivity) : FragmentPagerAdapter(activity.supportFragmentManager) {
|
||||||
|
val enterPublicKeyFragment = EnterPublicKeyFragment()
|
||||||
|
|
||||||
override fun getCount(): Int {
|
override fun getCount(): Int {
|
||||||
return 2
|
return 2
|
||||||
@ -78,7 +89,7 @@ private class CreatePrivateChatActivityAdapter(val activity: CreatePrivateChatAc
|
|||||||
|
|
||||||
override fun getItem(index: Int): Fragment {
|
override fun getItem(index: Int): Fragment {
|
||||||
return when (index) {
|
return when (index) {
|
||||||
0 -> EnterPublicKeyFragment()
|
0 -> enterPublicKeyFragment
|
||||||
1 -> {
|
1 -> {
|
||||||
val result = ScanQRCodeWrapperFragment()
|
val result = ScanQRCodeWrapperFragment()
|
||||||
result.delegate = activity
|
result.delegate = activity
|
||||||
@ -104,8 +115,8 @@ class EnterPublicKeyFragment : Fragment() {
|
|||||||
|
|
||||||
private val hexEncodedPublicKey: String
|
private val hexEncodedPublicKey: String
|
||||||
get() {
|
get() {
|
||||||
val masterHexEncodedPublicKey = TextSecurePreferences.getMasterHexEncodedPublicKey(context!!)
|
val masterHexEncodedPublicKey = TextSecurePreferences.getMasterHexEncodedPublicKey(requireContext())
|
||||||
val userHexEncodedPublicKey = TextSecurePreferences.getLocalNumber(context!!)
|
val userHexEncodedPublicKey = TextSecurePreferences.getLocalNumber(requireContext())
|
||||||
return masterHexEncodedPublicKey ?: userHexEncodedPublicKey
|
return masterHexEncodedPublicKey ?: userHexEncodedPublicKey
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -148,7 +159,7 @@ class EnterPublicKeyFragment : Fragment() {
|
|||||||
startActivity(intent)
|
startActivity(intent)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun createPrivateChatIfPossible() {
|
fun createPrivateChatIfPossible() {
|
||||||
val hexEncodedPublicKey = publicKeyEditText.text?.trim().toString() ?: ""
|
val hexEncodedPublicKey = publicKeyEditText.text?.trim().toString() ?: ""
|
||||||
(requireActivity() as CreatePrivateChatActivity).createPrivateChatIfPossible(hexEncodedPublicKey)
|
(requireActivity() as CreatePrivateChatActivity).createPrivateChatIfPossible(hexEncodedPublicKey)
|
||||||
}
|
}
|
||||||
|
@ -184,6 +184,7 @@ class EditClosedGroupActivity : PassphraseRequiredActionBarActivity() {
|
|||||||
private fun onAddMembersClick() {
|
private fun onAddMembersClick() {
|
||||||
val intent = Intent(this@EditClosedGroupActivity, SelectContactsActivity::class.java)
|
val intent = Intent(this@EditClosedGroupActivity, SelectContactsActivity::class.java)
|
||||||
intent.putExtra(SelectContactsActivity.usersToExcludeKey, members.toTypedArray())
|
intent.putExtra(SelectContactsActivity.usersToExcludeKey, members.toTypedArray())
|
||||||
|
intent.putExtra(SelectContactsActivity.emptyStateTextKey, "No contacts to add")
|
||||||
startActivityForResult(intent, addUsersRequestCode)
|
startActivityForResult(intent, addUsersRequestCode)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,7 +10,10 @@ import android.view.Menu
|
|||||||
import android.view.MenuItem
|
import android.view.MenuItem
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import kotlinx.android.synthetic.main.activity_create_closed_group.*
|
import kotlinx.android.synthetic.main.activity_create_closed_group.*
|
||||||
|
import kotlinx.android.synthetic.main.activity_create_closed_group.emptyStateContainer
|
||||||
|
import kotlinx.android.synthetic.main.activity_create_closed_group.mainContentContainer
|
||||||
import kotlinx.android.synthetic.main.activity_linked_devices.recyclerView
|
import kotlinx.android.synthetic.main.activity_linked_devices.recyclerView
|
||||||
|
import kotlinx.android.synthetic.main.activity_select_contacts.*
|
||||||
import network.loki.messenger.R
|
import network.loki.messenger.R
|
||||||
import org.thoughtcrime.securesms.PassphraseRequiredActionBarActivity
|
import org.thoughtcrime.securesms.PassphraseRequiredActionBarActivity
|
||||||
import org.thoughtcrime.securesms.mms.GlideApp
|
import org.thoughtcrime.securesms.mms.GlideApp
|
||||||
@ -26,6 +29,7 @@ class SelectContactsActivity : PassphraseRequiredActionBarActivity(), LoaderMana
|
|||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
val usersToExcludeKey = "usersToExcludeKey"
|
val usersToExcludeKey = "usersToExcludeKey"
|
||||||
|
val emptyStateTextKey = "emptyStateTextKey"
|
||||||
val selectedContactsKey = "selectedContactsKey"
|
val selectedContactsKey = "selectedContactsKey"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -37,6 +41,10 @@ class SelectContactsActivity : PassphraseRequiredActionBarActivity(), LoaderMana
|
|||||||
supportActionBar!!.title = resources.getString(R.string.activity_select_contacts_title)
|
supportActionBar!!.title = resources.getString(R.string.activity_select_contacts_title)
|
||||||
|
|
||||||
usersToExclude = intent.getStringArrayExtra(Companion.usersToExcludeKey)?.toSet() ?: setOf()
|
usersToExclude = intent.getStringArrayExtra(Companion.usersToExcludeKey)?.toSet() ?: setOf()
|
||||||
|
val emptyStateText = intent.getStringExtra(Companion.emptyStateTextKey)
|
||||||
|
if (emptyStateText != null) {
|
||||||
|
emptyStateMessageTextView.text = emptyStateText
|
||||||
|
}
|
||||||
|
|
||||||
recyclerView.adapter = selectContactsAdapter
|
recyclerView.adapter = selectContactsAdapter
|
||||||
recyclerView.layoutManager = LinearLayoutManager(this)
|
recyclerView.layoutManager = LinearLayoutManager(this)
|
||||||
|
Loading…
Reference in New Issue
Block a user