Not implemented toast or Snackbar

This commit is contained in:
Benoit Marty 2019-04-03 12:30:09 +02:00
parent d9c8867c0b
commit c188bb290f
8 changed files with 88 additions and 11 deletions

View File

@ -23,11 +23,13 @@ import android.view.MenuItem
import android.view.View import android.view.View
import androidx.annotation.* import androidx.annotation.*
import androidx.appcompat.widget.Toolbar import androidx.appcompat.widget.Toolbar
import androidx.coordinatorlayout.widget.CoordinatorLayout
import butterknife.BindView import butterknife.BindView
import butterknife.ButterKnife import butterknife.ButterKnife
import butterknife.Unbinder import butterknife.Unbinder
import com.airbnb.mvrx.BaseMvRxActivity import com.airbnb.mvrx.BaseMvRxActivity
import com.bumptech.glide.util.Util import com.bumptech.glide.util.Util
import com.google.android.material.snackbar.Snackbar
import im.vector.riotredesign.BuildConfig import im.vector.riotredesign.BuildConfig
import im.vector.riotredesign.R import im.vector.riotredesign.R
import im.vector.riotredesign.features.rageshake.BugReportActivity import im.vector.riotredesign.features.rageshake.BugReportActivity
@ -47,8 +49,14 @@ abstract class RiotActivity : BaseMvRxActivity() {
* ========================================================================================== */ * ========================================================================================== */


@Nullable @Nullable
@JvmField
@BindView(R.id.toolbar) @BindView(R.id.toolbar)
protected lateinit var toolbar: Toolbar var toolbar: Toolbar? = null

@Nullable
@JvmField
@BindView(R.id.vector_coordinator_layout)
var coordinatorLayout: CoordinatorLayout? = null


/* ========================================================================================== /* ==========================================================================================
* DATA * DATA
@ -269,4 +277,23 @@ abstract class RiotActivity : BaseMvRxActivity() {
* Return a object containing other themes for this activity * Return a object containing other themes for this activity
*/ */
open fun getOtherThemes(): ActivityOtherThemes = ActivityOtherThemes.Default open fun getOtherThemes(): ActivityOtherThemes = ActivityOtherThemes.Default

/* ==========================================================================================
* PUBLIC METHODS
* ========================================================================================== */

protected fun showSnackbar(message: String) {
coordinatorLayout?.let {
Snackbar.make(it, message, Snackbar.LENGTH_SHORT)
}
}

/* ==========================================================================================
* Temporary method
* ========================================================================================== */

protected fun notImplemented() {
showSnackbar(getString(R.string.not_implemented))
}

} }

View File

@ -18,6 +18,8 @@ package im.vector.riotredesign.core.platform


import androidx.annotation.CallSuper import androidx.annotation.CallSuper
import androidx.preference.PreferenceFragmentCompat import androidx.preference.PreferenceFragmentCompat
import im.vector.riotredesign.R
import im.vector.riotredesign.core.utils.toast
import timber.log.Timber import timber.log.Timber


abstract class VectorPreferenceFragment : PreferenceFragmentCompat() { abstract class VectorPreferenceFragment : PreferenceFragmentCompat() {
@ -37,4 +39,14 @@ abstract class VectorPreferenceFragment : PreferenceFragmentCompat() {
Timber.d("onResume Fragment ${this.javaClass.simpleName}") Timber.d("onResume Fragment ${this.javaClass.simpleName}")
} }


/* ==========================================================================================
* Protected
* ========================================================================================== */

protected fun notImplemented() {
// Snackbar cannot be display on PreferenceFragment
// Snackbar.make(view!!, R.string.not_implemented, Snackbar.LENGTH_SHORT)
activity?.toast(R.string.not_implemented)
}

} }

View File

@ -305,6 +305,7 @@ class VectorSettingsPreferencesFragment : VectorPreferenceFragment(), SharedPref
} }


it.setOnPreferenceClickListener { it.setOnPreferenceClickListener {
notImplemented()
// TODO val intent = PhoneNumberAdditionActivity.getIntent(activity, mSession.credentials.userId) // TODO val intent = PhoneNumberAdditionActivity.getIntent(activity, mSession.credentials.userId)
// startActivityForResult(intent, REQUEST_NEW_PHONE_NUMBER) // startActivityForResult(intent, REQUEST_NEW_PHONE_NUMBER)
true true
@ -382,6 +383,7 @@ class VectorSettingsPreferencesFragment : VectorPreferenceFragment(), SharedPref


// Notification privacy // Notification privacy
mNotificationPrivacyPreference.onPreferenceClickListener = Preference.OnPreferenceClickListener { mNotificationPrivacyPreference.onPreferenceClickListener = Preference.OnPreferenceClickListener {
notImplemented()
// TODO startActivity(NotificationPrivacyActivity.getIntent(activity)) // TODO startActivity(NotificationPrivacyActivity.getIntent(activity))
true true
} }
@ -475,6 +477,7 @@ class VectorSettingsPreferencesFragment : VectorPreferenceFragment(), SharedPref
AlertDialog.Builder(activity) AlertDialog.Builder(activity)
.setMessage(R.string.room_settings_labs_end_to_end_warnings) .setMessage(R.string.room_settings_labs_end_to_end_warnings)
.setPositiveButton(R.string.logout) { _, _ -> .setPositiveButton(R.string.logout) { _, _ ->
notImplemented()
// TODO CommonActivityUtils.logout(activity) // TODO CommonActivityUtils.logout(activity)
} }
.setNegativeButton(R.string.cancel) { _, _ -> .setNegativeButton(R.string.cancel) { _, _ ->
@ -489,6 +492,7 @@ class VectorSettingsPreferencesFragment : VectorPreferenceFragment(), SharedPref
val newValue = newValueAsVoid as Boolean val newValue = newValueAsVoid as Boolean


if (mSession.isCryptoEnabled() != newValue) { if (mSession.isCryptoEnabled() != newValue) {
notImplemented()
/* TODO /* TODO
displayLoadingView() displayLoadingView()


@ -533,6 +537,7 @@ class VectorSettingsPreferencesFragment : VectorPreferenceFragment(), SharedPref
// SaveMode Management // SaveMode Management
findPreference(PreferencesManager.SETTINGS_DATA_SAVE_MODE_PREFERENCE_KEY) findPreference(PreferencesManager.SETTINGS_DATA_SAVE_MODE_PREFERENCE_KEY)
.onPreferenceChangeListener = Preference.OnPreferenceChangeListener { _, newValue -> .onPreferenceChangeListener = Preference.OnPreferenceChangeListener { _, newValue ->
notImplemented()
/* TODO /* TODO
val sessions = Matrix.getMXSessions(activity) val sessions = Matrix.getMXSessions(activity)
for (session in sessions) { for (session in sessions) {
@ -621,6 +626,7 @@ class VectorSettingsPreferencesFragment : VectorPreferenceFragment(), SharedPref
// copyright // copyright
findPreference(PreferencesManager.SETTINGS_COPYRIGHT_PREFERENCE_KEY) findPreference(PreferencesManager.SETTINGS_COPYRIGHT_PREFERENCE_KEY)
.onPreferenceClickListener = Preference.OnPreferenceClickListener { .onPreferenceClickListener = Preference.OnPreferenceClickListener {
notImplemented()
// TODO VectorUtils.displayAppCopyright() // TODO VectorUtils.displayAppCopyright()
false false
} }
@ -628,6 +634,7 @@ class VectorSettingsPreferencesFragment : VectorPreferenceFragment(), SharedPref
// terms & conditions // terms & conditions
findPreference(PreferencesManager.SETTINGS_APP_TERM_CONDITIONS_PREFERENCE_KEY) findPreference(PreferencesManager.SETTINGS_APP_TERM_CONDITIONS_PREFERENCE_KEY)
.onPreferenceClickListener = Preference.OnPreferenceClickListener { .onPreferenceClickListener = Preference.OnPreferenceClickListener {
notImplemented()
// TODO VectorUtils.displayAppTac() // TODO VectorUtils.displayAppTac()
false false
} }
@ -635,6 +642,7 @@ class VectorSettingsPreferencesFragment : VectorPreferenceFragment(), SharedPref
// privacy policy // privacy policy
findPreference(PreferencesManager.SETTINGS_PRIVACY_POLICY_PREFERENCE_KEY) findPreference(PreferencesManager.SETTINGS_PRIVACY_POLICY_PREFERENCE_KEY)
.onPreferenceClickListener = Preference.OnPreferenceClickListener { .onPreferenceClickListener = Preference.OnPreferenceClickListener {
notImplemented()
// TODO VectorUtils.displayAppPrivacyPolicy() // TODO VectorUtils.displayAppPrivacyPolicy()
false false
} }
@ -642,6 +650,7 @@ class VectorSettingsPreferencesFragment : VectorPreferenceFragment(), SharedPref
// third party notice // third party notice
findPreference(PreferencesManager.SETTINGS_THIRD_PARTY_NOTICES_PREFERENCE_KEY) findPreference(PreferencesManager.SETTINGS_THIRD_PARTY_NOTICES_PREFERENCE_KEY)
.onPreferenceClickListener = Preference.OnPreferenceClickListener { .onPreferenceClickListener = Preference.OnPreferenceClickListener {
notImplemented()
// TODO VectorUtils.displayThirdPartyLicenses() // TODO VectorUtils.displayThirdPartyLicenses()
false false
} }
@ -678,8 +687,11 @@ class VectorSettingsPreferencesFragment : VectorPreferenceFragment(), SharedPref
} }
} }
}) })
*/


it.onPreferenceClickListener = Preference.OnPreferenceClickListener { it.onPreferenceClickListener = Preference.OnPreferenceClickListener {
notImplemented()
/* TODO
displayLoadingView() displayLoadingView()


val task = ClearMediaCacheAsyncTask( val task = ClearMediaCacheAsyncTask(
@ -705,10 +717,10 @@ class VectorSettingsPreferencesFragment : VectorPreferenceFragment(), SharedPref
task.cancel(true) task.cancel(true)
hideLoadingView() hideLoadingView()
} }
*/


false false
} }
*/
} }


// Incoming call sounds // Incoming call sounds
@ -739,7 +751,8 @@ class VectorSettingsPreferencesFragment : VectorPreferenceFragment(), SharedPref
*/ */


it.onPreferenceClickListener = Preference.OnPreferenceClickListener { it.onPreferenceClickListener = Preference.OnPreferenceClickListener {
displayLoadingView() notImplemented()
// displayLoadingView()
// TODO Matrix.getInstance(appContext).reloadSessions(appContext) // TODO Matrix.getInstance(appContext).reloadSessions(appContext)
false false
} }
@ -751,6 +764,7 @@ class VectorSettingsPreferencesFragment : VectorPreferenceFragment(), SharedPref
findPreference(PreferencesManager.SETTINGS_DEACTIVATE_ACCOUNT_KEY) findPreference(PreferencesManager.SETTINGS_DEACTIVATE_ACCOUNT_KEY)
.onPreferenceClickListener = Preference.OnPreferenceClickListener { .onPreferenceClickListener = Preference.OnPreferenceClickListener {
activity?.let { activity?.let {
notImplemented()
// TODO startActivity(DeactivateAccountActivity.getIntent(it)) // TODO startActivity(DeactivateAccountActivity.getIntent(it))
} }


@ -795,7 +809,7 @@ class VectorSettingsPreferencesFragment : VectorPreferenceFragment(), SharedPref
super.onResume() super.onResume()


// find the view from parent activity // find the view from parent activity
// TODO mLoadingView = activity?.findViewById(R.id.vector_settings_spinner_views) mLoadingView = activity?.findViewById(R.id.vector_settings_spinner_views)


/* TODO /* TODO
if (mSession.isAlive) { if (mSession.isAlive) {
@ -880,7 +894,7 @@ class VectorSettingsPreferencesFragment : VectorPreferenceFragment(), SharedPref
var parent = view var parent = view


while (parent != null && mLoadingView == null) { while (parent != null && mLoadingView == null) {
// TODO mLoadingView = parent.findViewById(R.id.vector_settings_spinner_views) mLoadingView = parent.findViewById(R.id.vector_settings_spinner_views)
parent = parent.parent as View parent = parent.parent as View
} }
} else { } else {
@ -1080,6 +1094,7 @@ class VectorSettingsPreferencesFragment : VectorPreferenceFragment(), SharedPref
val oldPwd = oldPasswordText.text.toString().trim() val oldPwd = oldPasswordText.text.toString().trim()
val newPwd = newPasswordText.text.toString().trim() val newPwd = newPasswordText.text.toString().trim()


notImplemented()
/* TODO /* TODO
showPasswordLoadingView(true) showPasswordLoadingView(true)


@ -1128,6 +1143,7 @@ class VectorSettingsPreferencesFragment : VectorPreferenceFragment(), SharedPref
*/ */


private fun onPushRuleClick(preferenceKey: String, newValue: Boolean) { private fun onPushRuleClick(preferenceKey: String, newValue: Boolean) {
notImplemented()
/* TODO /* TODO
val matrixInstance = Matrix.getInstance(context) val matrixInstance = Matrix.getInstance(context)
val pushManager = matrixInstance.pushManager val pushManager = matrixInstance.pushManager
@ -1248,6 +1264,7 @@ class VectorSettingsPreferencesFragment : VectorPreferenceFragment(), SharedPref
* Update the displayname. * Update the displayname.
*/ */
private fun onDisplayNameClick(value: String?) { private fun onDisplayNameClick(value: String?) {
notImplemented()
/* TODO /* TODO
if (!TextUtils.equals(mSession.myUser.displayname, value)) { if (!TextUtils.equals(mSession.myUser.displayname, value)) {
displayLoadingView() displayLoadingView()
@ -1302,6 +1319,8 @@ class VectorSettingsPreferencesFragment : VectorPreferenceFragment(), SharedPref
* Update the avatar. * Update the avatar.
*/ */
private fun onUpdateAvatarClick() { private fun onUpdateAvatarClick() {
notImplemented()

/* TODO /* TODO
if (checkPermissions(PERMISSIONS_FOR_TAKING_PHOTO, this, PERMISSION_REQUEST_CODE_LAUNCH_CAMERA)) { if (checkPermissions(PERMISSIONS_FOR_TAKING_PHOTO, this, PERMISSION_REQUEST_CODE_LAUNCH_CAMERA)) {
changeAvatar() changeAvatar()
@ -1471,6 +1490,7 @@ class VectorSettingsPreferencesFragment : VectorPreferenceFragment(), SharedPref
.setTitle(R.string.dialog_title_confirmation) .setTitle(R.string.dialog_title_confirmation)
.setMessage(dialogMessage) .setMessage(dialogMessage)
.setPositiveButton(R.string.remove) { _, _ -> .setPositiveButton(R.string.remove) { _, _ ->
notImplemented()
/* TODO /* TODO
displayLoadingView() displayLoadingView()


@ -1542,6 +1562,7 @@ class VectorSettingsPreferencesFragment : VectorPreferenceFragment(), SharedPref
val idsList = ArrayList<String>() val idsList = ArrayList<String>()
idsList.add(userId) idsList.add(userId)


notImplemented()
/* TODO /* TODO
mSession.unIgnoreUsers(idsList, object : ApiCallback<Void> { mSession.unIgnoreUsers(idsList, object : ApiCallback<Void> {
override fun onSuccess(info: Void?) { override fun onSuccess(info: Void?) {
@ -1771,6 +1792,7 @@ class VectorSettingsPreferencesFragment : VectorPreferenceFragment(), SharedPref
return return
} }


notImplemented()
/* TODO /* TODO
val pid = ThreePid(email, ThreePid.MEDIUM_EMAIL) val pid = ThreePid(email, ThreePid.MEDIUM_EMAIL)


@ -1976,6 +1998,7 @@ class VectorSettingsPreferencesFragment : VectorPreferenceFragment(), SharedPref
selectedLanguagePreference.summary = VectorLocale.localeToLocalisedString(VectorLocale.applicationLocale) selectedLanguagePreference.summary = VectorLocale.localeToLocalisedString(VectorLocale.applicationLocale)


selectedLanguagePreference.onPreferenceClickListener = Preference.OnPreferenceClickListener { selectedLanguagePreference.onPreferenceClickListener = Preference.OnPreferenceClickListener {
notImplemented()
// TODO startActivityForResult(LanguagePickerActivity.getIntent(activity), REQUEST_LOCALE) // TODO startActivityForResult(LanguagePickerActivity.getIntent(activity), REQUEST_LOCALE)
true true
} }
@ -2159,6 +2182,7 @@ class VectorSettingsPreferencesFragment : VectorPreferenceFragment(), SharedPref


manageBackupPref.onPreferenceClickListener = Preference.OnPreferenceClickListener { manageBackupPref.onPreferenceClickListener = Preference.OnPreferenceClickListener {
context?.let { context?.let {
notImplemented()
// TODO startActivity(KeysBackupManageActivity.intent(it, mSession.myUserId)) // TODO startActivity(KeysBackupManageActivity.intent(it, mSession.myUserId))
} }
false false
@ -2427,6 +2451,7 @@ class VectorSettingsPreferencesFragment : VectorPreferenceFragment(), SharedPref
val layout = inflater.inflate(R.layout.dialog_base_edit_text, null) val layout = inflater.inflate(R.layout.dialog_base_edit_text, null)


val input = layout.findViewById<EditText>(R.id.edit_text) val input = layout.findViewById<EditText>(R.id.edit_text)
notImplemented()
/* TODO /* TODO
input.setText(aDeviceInfoToRename.display_name) input.setText(aDeviceInfoToRename.display_name)


@ -2487,8 +2512,9 @@ class VectorSettingsPreferencesFragment : VectorPreferenceFragment(), SharedPref
* @param deviceId the device id * @param deviceId the device id
*/ */
private fun deleteDevice(deviceId: String) { private fun deleteDevice(deviceId: String) {
displayLoadingView() notImplemented()
/* TODO /* TODO
displayLoadingView()
mSession.deleteDevice(deviceId, mAccountPassword, object : ApiCallback<Void> { mSession.deleteDevice(deviceId, mAccountPassword, object : ApiCallback<Void> {
override fun onSuccess(info: Void?) { override fun onSuccess(info: Void?) {
hideLoadingView() hideLoadingView()
@ -2522,6 +2548,7 @@ class VectorSettingsPreferencesFragment : VectorPreferenceFragment(), SharedPref
* @param aDeviceInfoToDelete device info * @param aDeviceInfoToDelete device info
*/ */
private fun displayDeviceDeletionDialog(aDeviceInfoToDelete: DeviceInfo) { private fun displayDeviceDeletionDialog(aDeviceInfoToDelete: DeviceInfo) {
notImplemented()
/* /*
TODO TODO
if (aDeviceInfoToDelete.device_id != null) { if (aDeviceInfoToDelete.device_id != null) {
@ -2569,6 +2596,7 @@ class VectorSettingsPreferencesFragment : VectorPreferenceFragment(), SharedPref
* Manage the e2e keys export. * Manage the e2e keys export.
*/ */
private fun exportKeys() { private fun exportKeys() {
notImplemented()
// We need WRITE_EXTERNAL permission // We need WRITE_EXTERNAL permission
/* /*
TODO TODO
@ -2616,6 +2644,7 @@ class VectorSettingsPreferencesFragment : VectorPreferenceFragment(), SharedPref
*/ */
@SuppressLint("NewApi") @SuppressLint("NewApi")
private fun importKeys() { private fun importKeys() {
notImplemented()
// TODO activity?.let { openFileSelection(it, this, false, REQUEST_E2E_FILE_REQUEST_CODE) } // TODO activity?.let { openFileSelection(it, this, false, REQUEST_E2E_FILE_REQUEST_CODE) }
} }



View File

@ -7,6 +7,7 @@


<androidx.appcompat.widget.Toolbar <androidx.appcompat.widget.Toolbar
android:id="@+id/mediaViewerToolbar" android:id="@+id/mediaViewerToolbar"
style="@style/VectorToolbarStyle"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize" android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary" android:background="?attr/colorPrimary"

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/vector_coordinator_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">


@ -38,4 +39,4 @@
android:visibility="visible" /> android:visibility="visible" />
</FrameLayout> </FrameLayout>


</FrameLayout> </androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@ -7,6 +7,7 @@


<androidx.appcompat.widget.Toolbar <androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar" android:id="@+id/toolbar"
style="@style/VectorToolbarStyle"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="?actionBarSize" android:layout_height="?actionBarSize"
android:background="?attr/colorPrimary" android:background="?attr/colorPrimary"
@ -40,6 +41,7 @@
android:layout_marginEnd="8dp" android:layout_marginEnd="8dp"
android:ellipsize="end" android:ellipsize="end"
android:maxLines="1" android:maxLines="1"
android:textColor="?vctr_toolbar_primary_text_color"
android:textSize="18sp" android:textSize="18sp"
app:layout_constraintBottom_toTopOf="@+id/toolbarSubtitleView" app:layout_constraintBottom_toTopOf="@+id/toolbarSubtitleView"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
@ -57,6 +59,7 @@
android:layout_marginBottom="8dp" android:layout_marginBottom="8dp"
android:ellipsize="end" android:ellipsize="end"
android:maxLines="1" android:maxLines="1"
android:textColor="?vctr_toolbar_secondary_text_color"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0" app:layout_constraintHorizontal_bias="0.0"
@ -76,13 +79,14 @@
app:layout_constraintBottom_toTopOf="@+id/composerDivider" app:layout_constraintBottom_toTopOf="@+id/composerDivider"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/toolbar" /> app:layout_constraintTop_toBottomOf="@id/toolbar"
tools:listitem="@layout/item_timeline_event_text_message" />


<View <View
android:id="@+id/composerDivider" android:id="@+id/composerDivider"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="1dp" android:layout_height="1dp"
android:background="@color/pale_grey" android:background="?vctr_list_divider_color"
app:layout_constraintBottom_toTopOf="@+id/composerLayout" /> app:layout_constraintBottom_toTopOf="@+id/composerLayout" />


<RelativeLayout <RelativeLayout

View File

@ -8,4 +8,7 @@


<string name="password_hint" translatable="false">********</string> <string name="password_hint" translatable="false">********</string>


<!-- Temporary string -->
<string name="not_implemented" translatable="false">Not implemented yet in RiotX</string>

</resources> </resources>

View File

@ -11,7 +11,7 @@
</style> </style>


<!-- toolbar styles--> <!-- toolbar styles-->
<style name="VectorToolbarStyle" parent="Widget.AppCompat.Toolbar"> <style name="VectorToolbarStyle" parent="Widget.MaterialComponents.Toolbar">
<item name="android:background">?colorPrimary</item> <item name="android:background">?colorPrimary</item>
<item name="background">?colorPrimary</item> <item name="background">?colorPrimary</item>