mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-12 11:14:20 +00:00
Edit closed group activity layout refactoring.
This commit is contained in:
parent
f7923cd8a4
commit
3e05a616ce
@ -2,7 +2,9 @@
|
|||||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="@drawable/default_session_background">
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:background="@drawable/default_session_background"
|
||||||
|
tools:context="org.thoughtcrime.securesms.loki.activities.EditClosedGroupActivity">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/mainContentContainer"
|
android:id="@+id/mainContentContainer"
|
||||||
@ -18,66 +20,152 @@
|
|||||||
android:layout_marginTop="@dimen/small_spacing"
|
android:layout_marginTop="@dimen/small_spacing"
|
||||||
android:layout_marginRight="@dimen/large_spacing">
|
android:layout_marginRight="@dimen/large_spacing">
|
||||||
|
|
||||||
<ImageView
|
<LinearLayout
|
||||||
android:id="@+id/btnCancelGroupNameEdit"
|
android:id="@+id/cntGroupNameEdit"
|
||||||
android:layout_width="36dp"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="36dp"
|
|
||||||
android:layout_toLeftOf="@+id/edtGroupName"
|
|
||||||
android:layout_centerVertical="true"
|
|
||||||
android:src="@drawable/ic_close_white_24dp"
|
|
||||||
android:visibility="gone" />
|
|
||||||
|
|
||||||
<EditText
|
|
||||||
style="@style/SessionEditText"
|
|
||||||
android:id="@+id/edtGroupName"
|
|
||||||
android:layout_width="@dimen/album_total_width"
|
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_centerInParent="true"
|
android:layout_centerVertical="true"
|
||||||
android:textAlignment="center"
|
android:orientation="horizontal"
|
||||||
android:paddingTop="12dp"
|
|
||||||
android:paddingBottom="@dimen/large_spacing"
|
|
||||||
android:paddingHorizontal="@dimen/large_spacing"
|
|
||||||
android:visibility="invisible"
|
android:visibility="invisible"
|
||||||
android:hint="@string/activity_edit_closed_group_edit_text_hint" />
|
tools:visibility="visible">
|
||||||
|
|
||||||
<TextView
|
<ImageView
|
||||||
android:id="@+id/txvGroupNameDisplay"
|
android:id="@+id/btnCancelGroupNameEdit"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="36dp"
|
||||||
|
android:layout_height="36dp"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:src="@drawable/ic_close_white_24dp"/>
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
style="@style/SessionEditText"
|
||||||
|
android:id="@+id/edtGroupName"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_marginStart="4dp"
|
||||||
|
android:layout_marginEnd="4dp"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:inputType="text"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:imeOptions="actionDone"
|
||||||
|
android:hint="@string/activity_edit_closed_group_edit_text_hint" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/btnSaveGroupNameEdit"
|
||||||
|
android:layout_width="36dp"
|
||||||
|
android:layout_height="36dp"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:src="@drawable/ic_check_white_24dp"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/cntGroupNameDisplay"
|
||||||
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_centerInParent="true"
|
|
||||||
android:textColor="@color/text"
|
|
||||||
android:textSize="@dimen/very_large_font_size"
|
|
||||||
android:textStyle="bold"
|
|
||||||
android:drawableRight="@drawable/ic_edit_white_24dp"
|
|
||||||
android:drawablePadding="@dimen/small_spacing"/>
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/btnSaveGroupName"
|
|
||||||
android:layout_width="36dp"
|
|
||||||
android:layout_height="36dp"
|
|
||||||
android:src="@drawable/ic_check_white_24dp"
|
|
||||||
android:layout_toRightOf="@+id/edtGroupName"
|
|
||||||
android:layout_centerVertical="true"
|
android:layout_centerVertical="true"
|
||||||
android:visibility="gone" />
|
android:paddingVertical="@dimen/medium_spacing"
|
||||||
|
android:gravity="center"
|
||||||
|
android:visibility="visible"
|
||||||
|
tools:visibility="invisible">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/lblGroupNameDisplay"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:textColor="@color/text"
|
||||||
|
android:textSize="@dimen/very_large_font_size"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:paddingStart="24dp"
|
||||||
|
android:paddingEnd="0dp"
|
||||||
|
android:drawableEnd="@drawable/ic_edit_white_24dp"
|
||||||
|
android:drawablePadding="@dimen/small_spacing"
|
||||||
|
tools:text="SomeGroupName"/>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<!-- <RelativeLayout-->
|
||||||
android:layout_width="match_parent"
|
<!-- android:id="@+id/ctnGroupNameSection"-->
|
||||||
android:layout_height="wrap_content">
|
<!-- android:layout_width="match_parent"-->
|
||||||
<View
|
<!-- android:layout_height="wrap_content"-->
|
||||||
android:layout_weight="2"
|
<!-- android:layout_marginLeft="@dimen/large_spacing"-->
|
||||||
android:layout_height="0px"
|
<!-- android:layout_marginTop="@dimen/small_spacing"-->
|
||||||
android:layout_width="@dimen/large_spacing"/>
|
<!-- android:layout_marginRight="@dimen/large_spacing"-->
|
||||||
|
<!-- tools:visibility="gone">-->
|
||||||
|
|
||||||
<View
|
<!-- <ImageView-->
|
||||||
android:layout_weight="2"
|
<!-- android:id="@+id/btnCancelGroupNameEdit"-->
|
||||||
android:layout_height="0px"
|
<!-- android:layout_width="36dp"-->
|
||||||
android:layout_width="@dimen/large_spacing"
|
<!-- android:layout_height="36dp"-->
|
||||||
/>
|
<!-- android:layout_toLeftOf="@+id/edtGroupName"-->
|
||||||
|
<!-- android:layout_centerVertical="true"-->
|
||||||
|
<!-- android:src="@drawable/ic_close_white_24dp"-->
|
||||||
|
<!-- android:visibility="gone" />-->
|
||||||
|
|
||||||
|
<!-- <EditText-->
|
||||||
|
<!-- style="@style/SessionEditText"-->
|
||||||
|
<!-- android:id="@+id/edtGroupName"-->
|
||||||
|
<!-- android:layout_width="@dimen/album_total_width"-->
|
||||||
|
<!-- android:layout_height="wrap_content"-->
|
||||||
|
<!-- android:layout_centerInParent="true"-->
|
||||||
|
<!-- android:textAlignment="center"-->
|
||||||
|
<!-- android:visibility="invisible"-->
|
||||||
|
<!-- android:hint="@string/activity_edit_closed_group_edit_text_hint" />-->
|
||||||
|
<!--<!– android:layout_width="@dimen/album_total_width"–>-->
|
||||||
|
<!--<!– android:paddingTop="12dp"–>-->
|
||||||
|
<!--<!– android:paddingBottom="@dimen/large_spacing"–>-->
|
||||||
|
<!--<!– android:paddingHorizontal="@dimen/large_spacing"–>-->
|
||||||
|
|
||||||
</LinearLayout>
|
<!--<!– <EditText–>-->
|
||||||
|
<!--<!– style="@style/SessionEditText"–>-->
|
||||||
|
<!--<!– android:id="@+id/nameEditText"–>-->
|
||||||
|
<!--<!– android:layout_width="match_parent"–>-->
|
||||||
|
<!--<!– android:layout_height="wrap_content"–>-->
|
||||||
|
<!--<!– android:layout_marginLeft="@dimen/large_spacing"–>-->
|
||||||
|
<!--<!– android:layout_marginTop="@dimen/medium_spacing"–>-->
|
||||||
|
<!--<!– android:layout_marginRight="@dimen/large_spacing"–>-->
|
||||||
|
<!--<!– android:layout_marginBottom="@dimen/medium_spacing"–>-->
|
||||||
|
<!--<!– android:hint="@string/activity_create_closed_group_edit_text_hint" />–>-->
|
||||||
|
|
||||||
|
<!-- <TextView-->
|
||||||
|
<!-- android:id="@+id/btnGroupNameDisplay"-->
|
||||||
|
<!-- android:layout_width="wrap_content"-->
|
||||||
|
<!-- android:layout_height="wrap_content"-->
|
||||||
|
<!-- android:layout_centerInParent="true"-->
|
||||||
|
<!-- android:textColor="@color/text"-->
|
||||||
|
<!-- android:textSize="@dimen/very_large_font_size"-->
|
||||||
|
<!-- android:textStyle="bold"-->
|
||||||
|
<!-- android:drawableRight="@drawable/ic_edit_white_24dp"-->
|
||||||
|
<!-- android:drawablePadding="@dimen/small_spacing"/>-->
|
||||||
|
|
||||||
|
<!-- <ImageView-->
|
||||||
|
<!-- android:id="@+id/imgSaveGroupName"-->
|
||||||
|
<!-- android:layout_width="36dp"-->
|
||||||
|
<!-- android:layout_height="36dp"-->
|
||||||
|
<!-- android:src="@drawable/ic_check_white_24dp"-->
|
||||||
|
<!-- android:layout_toRightOf="@+id/edtGroupName"-->
|
||||||
|
<!-- android:layout_centerVertical="true"-->
|
||||||
|
<!-- android:visibility="gone" />-->
|
||||||
|
|
||||||
|
<!-- </RelativeLayout>-->
|
||||||
|
|
||||||
|
<!-- <!– TODO: WTF? –>-->
|
||||||
|
<!-- <LinearLayout-->
|
||||||
|
<!-- android:layout_width="match_parent"-->
|
||||||
|
<!-- android:layout_height="wrap_content">-->
|
||||||
|
<!-- <View-->
|
||||||
|
<!-- android:layout_weight="2"-->
|
||||||
|
<!-- android:layout_height="0px"-->
|
||||||
|
<!-- android:layout_width="@dimen/large_spacing"/>-->
|
||||||
|
<!-- <View-->
|
||||||
|
<!-- android:layout_weight="2"-->
|
||||||
|
<!-- android:layout_height="0px"-->
|
||||||
|
<!-- android:layout_width="@dimen/large_spacing"/>-->
|
||||||
|
<!-- </LinearLayout>-->
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@ -92,8 +180,6 @@
|
|||||||
android:textAlignment="center"
|
android:textAlignment="center"
|
||||||
android:text="@string/activity_edit_closed_group_explanation" />
|
android:text="@string/activity_edit_closed_group_explanation" />
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<View
|
<View
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="1px"
|
android:layout_height="1px"
|
||||||
@ -106,9 +192,9 @@
|
|||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="@dimen/large_spacing"
|
android:layout_marginStart="@dimen/large_spacing"
|
||||||
android:layout_marginTop="@dimen/small_spacing"
|
android:layout_marginTop="@dimen/small_spacing"
|
||||||
android:layout_marginRight="@dimen/massive_spacing"
|
android:layout_marginEnd="@dimen/massive_spacing"
|
||||||
android:layout_marginBottom="@dimen/small_spacing"
|
android:layout_marginBottom="@dimen/small_spacing"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:alpha="0.8"
|
android:alpha="0.8"
|
||||||
@ -133,7 +219,7 @@
|
|||||||
<android.support.v7.widget.RecyclerView
|
<android.support.v7.widget.RecyclerView
|
||||||
android:id="@+id/recyclerView"
|
android:id="@+id/recyclerView"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent" />
|
android:layout_height="match_parent"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@
|
|||||||
android:hint="@string/activity_settings_display_name_edit_text_hint" />
|
android:hint="@string/activity_settings_display_name_edit_text_hint" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/txvGroupNameDisplay"
|
android:id="@+id/btnGroupNameDisplay"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_centerInParent="true"
|
android:layout_centerInParent="true"
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
android:gravity="center_vertical">
|
android:gravity="center_vertical">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/txvGroupNameDisplay"
|
android:id="@+id/btnGroupNameDisplay"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/txvGroupNameDisplay"
|
android:id="@+id/btnGroupNameDisplay"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="@dimen/medium_spacing"
|
android:layout_marginStart="@dimen/medium_spacing"
|
||||||
|
@ -9,13 +9,12 @@ import android.support.v7.widget.LinearLayoutManager
|
|||||||
import android.view.Menu
|
import android.view.Menu
|
||||||
import android.view.MenuItem
|
import android.view.MenuItem
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
import android.view.inputmethod.EditorInfo
|
||||||
import android.view.inputmethod.InputMethodManager
|
import android.view.inputmethod.InputMethodManager
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import kotlinx.android.synthetic.main.activity_create_closed_group.emptyStateContainer
|
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_create_closed_group.mainContentContainer
|
||||||
import kotlinx.android.synthetic.main.activity_edit_closed_group.*
|
import kotlinx.android.synthetic.main.activity_edit_closed_group.*
|
||||||
import kotlinx.android.synthetic.main.activity_edit_closed_group.ctnGroupNameSection
|
|
||||||
import kotlinx.android.synthetic.main.activity_edit_closed_group.txvGroupNameDisplay
|
|
||||||
import kotlinx.android.synthetic.main.activity_linked_devices.recyclerView
|
import kotlinx.android.synthetic.main.activity_linked_devices.recyclerView
|
||||||
import network.loki.messenger.R
|
import network.loki.messenger.R
|
||||||
import org.thoughtcrime.securesms.PassphraseRequiredActionBarActivity
|
import org.thoughtcrime.securesms.PassphraseRequiredActionBarActivity
|
||||||
@ -45,7 +44,11 @@ class EditClosedGroupActivity : PassphraseRequiredActionBarActivity() {
|
|||||||
private var nameHasChanged = false
|
private var nameHasChanged = false
|
||||||
|
|
||||||
private var isEditingGroupName = false
|
private var isEditingGroupName = false
|
||||||
set(value) { field = value; handleIsEditingDisplayNameChanged() }
|
set(value) {
|
||||||
|
if (field == value) return
|
||||||
|
field = value
|
||||||
|
handleIsEditingDisplayNameChanged()
|
||||||
|
}
|
||||||
|
|
||||||
// region Lifecycle
|
// region Lifecycle
|
||||||
override fun onCreate(savedInstanceState: Bundle?, isReady: Boolean) {
|
override fun onCreate(savedInstanceState: Bundle?, isReady: Boolean) {
|
||||||
@ -54,14 +57,10 @@ class EditClosedGroupActivity : PassphraseRequiredActionBarActivity() {
|
|||||||
|
|
||||||
this.groupID = intent.getStringExtra(EXTRA_GROUP_ID)
|
this.groupID = intent.getStringExtra(EXTRA_GROUP_ID)
|
||||||
this.originalName = DatabaseFactory.getGroupDatabase(this).getGroup(groupID).get().title
|
this.originalName = DatabaseFactory.getGroupDatabase(this).getGroup(groupID).get().title
|
||||||
|
this.newGroupDisplayName = this.originalName
|
||||||
|
|
||||||
supportActionBar!!.title = resources.getString(R.string.activity_edit_closed_group_title)
|
supportActionBar!!.title = resources.getString(R.string.activity_edit_closed_group_title)
|
||||||
|
|
||||||
txvGroupNameDisplay.text = originalName
|
|
||||||
ctnGroupNameSection.setOnClickListener { showEditDisplayNameUI() }
|
|
||||||
btnCancelGroupNameEdit.setOnClickListener { cancelEditingDisplayName() }
|
|
||||||
btnSaveGroupName.setOnClickListener { saveDisplayName() }
|
|
||||||
|
|
||||||
addMembersClosedGroupButton.setOnClickListener { onAddMembersClick() }
|
addMembersClosedGroupButton.setOnClickListener { onAddMembersClick() }
|
||||||
|
|
||||||
this.memberListAdapter = EditClosedGroupMembersAdapter(
|
this.memberListAdapter = EditClosedGroupMembersAdapter(
|
||||||
@ -72,6 +71,21 @@ class EditClosedGroupActivity : PassphraseRequiredActionBarActivity() {
|
|||||||
recyclerView.adapter = this.memberListAdapter
|
recyclerView.adapter = this.memberListAdapter
|
||||||
recyclerView.layoutManager = LinearLayoutManager(this)
|
recyclerView.layoutManager = LinearLayoutManager(this)
|
||||||
|
|
||||||
|
lblGroupNameDisplay.text = this.originalName
|
||||||
|
cntGroupNameDisplay.setOnClickListener { isEditingGroupName = true }
|
||||||
|
btnCancelGroupNameEdit.setOnClickListener { isEditingGroupName = false }
|
||||||
|
btnSaveGroupNameEdit.setOnClickListener { saveDisplayName() }
|
||||||
|
edtGroupName.setImeActionLabel(getString(R.string.save), EditorInfo.IME_ACTION_DONE)
|
||||||
|
edtGroupName.setOnEditorActionListener { _, actionId, _ ->
|
||||||
|
when (actionId) {
|
||||||
|
EditorInfo.IME_ACTION_DONE -> {
|
||||||
|
saveDisplayName()
|
||||||
|
return@setOnEditorActionListener true
|
||||||
|
}
|
||||||
|
else -> return@setOnEditorActionListener false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Setup member list loader.
|
// Setup member list loader.
|
||||||
LoaderManager.getInstance(this).initLoader(LOADER_ID_MEMBERS, null, object : LoaderManager.LoaderCallbacks<List<String>> {
|
LoaderManager.getInstance(this).initLoader(LOADER_ID_MEMBERS, null, object : LoaderManager.LoaderCallbacks<List<String>> {
|
||||||
override fun onCreateLoader(id: Int, bundle: Bundle?): Loader<List<String>> {
|
override fun onCreateLoader(id: Int, bundle: Bundle?): Loader<List<String>> {
|
||||||
@ -101,8 +115,6 @@ class EditClosedGroupActivity : PassphraseRequiredActionBarActivity() {
|
|||||||
// endregion
|
// endregion
|
||||||
|
|
||||||
// region Updating
|
// region Updating
|
||||||
|
|
||||||
|
|
||||||
private fun updateMembers(members: Set<String>) {
|
private fun updateMembers(members: Set<String>) {
|
||||||
this.members.clear()
|
this.members.clear()
|
||||||
this.members.addAll(members)
|
this.members.addAll(members)
|
||||||
@ -121,13 +133,6 @@ class EditClosedGroupActivity : PassphraseRequiredActionBarActivity() {
|
|||||||
return super.onOptionsItemSelected(item)
|
return super.onOptionsItemSelected(item)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun showEditDisplayNameUI() {
|
|
||||||
isEditingGroupName = true
|
|
||||||
}
|
|
||||||
private fun cancelEditingDisplayName() {
|
|
||||||
isEditingGroupName = false
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun onMemberClick(member: String) {
|
private fun onMemberClick(member: String) {
|
||||||
val bottomSheet = GroupEditingOptionsBottomSheet()
|
val bottomSheet = GroupEditingOptionsBottomSheet()
|
||||||
bottomSheet.onRemoveTapped = {
|
bottomSheet.onRemoveTapped = {
|
||||||
@ -161,12 +166,12 @@ class EditClosedGroupActivity : PassphraseRequiredActionBarActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun handleIsEditingDisplayNameChanged() {
|
private fun handleIsEditingDisplayNameChanged() {
|
||||||
btnCancelGroupNameEdit.visibility = if (isEditingGroupName) View.VISIBLE else View.GONE
|
cntGroupNameEdit.visibility = if (isEditingGroupName) View.VISIBLE else View.INVISIBLE
|
||||||
btnSaveGroupName.visibility = if (isEditingGroupName) View.VISIBLE else View.GONE
|
cntGroupNameDisplay.visibility = if (isEditingGroupName) View.INVISIBLE else View.VISIBLE
|
||||||
txvGroupNameDisplay.visibility = if (isEditingGroupName) View.INVISIBLE else View.VISIBLE
|
|
||||||
edtGroupName.visibility = if (isEditingGroupName) View.VISIBLE else View.INVISIBLE
|
|
||||||
val inputMethodManager = getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
|
val inputMethodManager = getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
|
||||||
if (isEditingGroupName) {
|
if (isEditingGroupName) {
|
||||||
|
edtGroupName.setText(newGroupDisplayName)
|
||||||
|
edtGroupName.selectAll()
|
||||||
edtGroupName.requestFocus()
|
edtGroupName.requestFocus()
|
||||||
inputMethodManager.showSoftInput(edtGroupName, 0)
|
inputMethodManager.showSoftInput(edtGroupName, 0)
|
||||||
} else {
|
} else {
|
||||||
@ -186,7 +191,7 @@ class EditClosedGroupActivity : PassphraseRequiredActionBarActivity() {
|
|||||||
return Toast.makeText(this, R.string.activity_settings_display_name_too_long_error, Toast.LENGTH_SHORT).show()
|
return Toast.makeText(this, R.string.activity_settings_display_name_too_long_error, Toast.LENGTH_SHORT).show()
|
||||||
}
|
}
|
||||||
newGroupDisplayName = groupDisplayName
|
newGroupDisplayName = groupDisplayName
|
||||||
txvGroupNameDisplay.text = groupDisplayName
|
lblGroupNameDisplay.text = groupDisplayName
|
||||||
nameHasChanged = true
|
nameHasChanged = true
|
||||||
isEditingGroupName = false
|
isEditingGroupName = false
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ class SettingsActivity : PassphraseRequiredActionBarActivity() {
|
|||||||
profilePictureView.update()
|
profilePictureView.update()
|
||||||
profilePictureView.setOnClickListener { showEditProfilePictureUI() }
|
profilePictureView.setOnClickListener { showEditProfilePictureUI() }
|
||||||
ctnGroupNameSection.setOnClickListener { showEditDisplayNameUI() }
|
ctnGroupNameSection.setOnClickListener { showEditDisplayNameUI() }
|
||||||
txvGroupNameDisplay.text = DatabaseFactory.getLokiUserDatabase(this).getDisplayName(hexEncodedPublicKey)
|
btnGroupNameDisplay.text = DatabaseFactory.getLokiUserDatabase(this).getDisplayName(hexEncodedPublicKey)
|
||||||
publicKeyTextView.text = hexEncodedPublicKey
|
publicKeyTextView.text = hexEncodedPublicKey
|
||||||
copyButton.setOnClickListener { copyPublicKey() }
|
copyButton.setOnClickListener { copyPublicKey() }
|
||||||
shareButton.setOnClickListener { sharePublicKey() }
|
shareButton.setOnClickListener { sharePublicKey() }
|
||||||
@ -132,7 +132,7 @@ class SettingsActivity : PassphraseRequiredActionBarActivity() {
|
|||||||
cancelButton.visibility = if (isEditingDisplayName) View.VISIBLE else View.GONE
|
cancelButton.visibility = if (isEditingDisplayName) View.VISIBLE else View.GONE
|
||||||
showQRCodeButton.visibility = if (isEditingDisplayName) View.GONE else View.VISIBLE
|
showQRCodeButton.visibility = if (isEditingDisplayName) View.GONE else View.VISIBLE
|
||||||
saveButton.visibility = if (isEditingDisplayName) View.VISIBLE else View.GONE
|
saveButton.visibility = if (isEditingDisplayName) View.VISIBLE else View.GONE
|
||||||
txvGroupNameDisplay.visibility = if (isEditingDisplayName) View.INVISIBLE else View.VISIBLE
|
btnGroupNameDisplay.visibility = if (isEditingDisplayName) View.INVISIBLE else View.VISIBLE
|
||||||
displayNameEditText.visibility = if (isEditingDisplayName) View.VISIBLE else View.INVISIBLE
|
displayNameEditText.visibility = if (isEditingDisplayName) View.VISIBLE else View.INVISIBLE
|
||||||
val titleTextViewLayoutParams = titleTextView.layoutParams as LinearLayout.LayoutParams
|
val titleTextViewLayoutParams = titleTextView.layoutParams as LinearLayout.LayoutParams
|
||||||
titleTextViewLayoutParams.leftMargin = if (isEditingDisplayName) toPx(16, resources) else 0
|
titleTextViewLayoutParams.leftMargin = if (isEditingDisplayName) toPx(16, resources) else 0
|
||||||
@ -176,7 +176,7 @@ class SettingsActivity : PassphraseRequiredActionBarActivity() {
|
|||||||
}
|
}
|
||||||
all(promises).alwaysUi {
|
all(promises).alwaysUi {
|
||||||
if (displayName != null) {
|
if (displayName != null) {
|
||||||
txvGroupNameDisplay.text = displayName
|
btnGroupNameDisplay.text = displayName
|
||||||
}
|
}
|
||||||
displayNameToBeUploaded = null
|
displayNameToBeUploaded = null
|
||||||
if (isUpdatingProfilePicture && profilePicture != null) {
|
if (isUpdatingProfilePicture && profilePicture != null) {
|
||||||
|
@ -80,7 +80,7 @@ class ConversationView : LinearLayout {
|
|||||||
profilePictureView.glide = glide
|
profilePictureView.glide = glide
|
||||||
profilePictureView.update()
|
profilePictureView.update()
|
||||||
val senderDisplayName = if (thread.recipient.isLocalNumber) context.getString(R.string.note_to_self) else if (!thread.recipient.name.isNullOrEmpty()) thread.recipient.name else thread.recipient.address.toString()
|
val senderDisplayName = if (thread.recipient.isLocalNumber) context.getString(R.string.note_to_self) else if (!thread.recipient.name.isNullOrEmpty()) thread.recipient.name else thread.recipient.address.toString()
|
||||||
txvGroupNameDisplay.text = senderDisplayName
|
btnGroupNameDisplay.text = senderDisplayName
|
||||||
timestampTextView.text = DateUtils.getBriefRelativeTimeSpanString(context, Locale.getDefault(), thread.date)
|
timestampTextView.text = DateUtils.getBriefRelativeTimeSpanString(context, Locale.getDefault(), thread.date)
|
||||||
muteIndicatorImageView.visibility = if (thread.recipient.isMuted) VISIBLE else GONE
|
muteIndicatorImageView.visibility = if (thread.recipient.isMuted) VISIBLE else GONE
|
||||||
val rawSnippet = thread.getDisplayBody(context)
|
val rawSnippet = thread.getDisplayBody(context)
|
||||||
|
@ -30,7 +30,7 @@ class MentionCandidateView(context: Context, attrs: AttributeSet?, defStyleAttr:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun update() {
|
private fun update() {
|
||||||
txvGroupNameDisplay.text = mentionCandidate.displayName
|
btnGroupNameDisplay.text = mentionCandidate.displayName
|
||||||
profilePictureView.publicKey = mentionCandidate.publicKey
|
profilePictureView.publicKey = mentionCandidate.publicKey
|
||||||
profilePictureView.additionalPublicKey = null
|
profilePictureView.additionalPublicKey = null
|
||||||
profilePictureView.isRSSFeed = false
|
profilePictureView.isRSSFeed = false
|
||||||
|
Loading…
Reference in New Issue
Block a user