From fa250263c8e534725608f661e2c7f6e6a48b3f3d Mon Sep 17 00:00:00 2001 From: Gideon Okuro Date: Thu, 30 Nov 2023 15:41:06 +0300 Subject: [PATCH] display lang, space in team login --- .../myplanet/ui/sync/LoginActivity.java | 3 +- .../planet/myplanet/ui/sync/SyncActivity.java | 10 ++--- .../myplanet/ui/sync/TeamLoginActivity.kt | 17 +++++--- .../main/res/layout/activity_team_login.xml | 42 ++++++++++++++++++- 4 files changed, 59 insertions(+), 13 deletions(-) diff --git a/app/src/main/java/org/ole/planet/myplanet/ui/sync/LoginActivity.java b/app/src/main/java/org/ole/planet/myplanet/ui/sync/LoginActivity.java index b3591bc248..5c0239ee93 100644 --- a/app/src/main/java/org/ole/planet/myplanet/ui/sync/LoginActivity.java +++ b/app/src/main/java/org/ole/planet/myplanet/ui/sync/LoginActivity.java @@ -29,9 +29,8 @@ import java.util.List; public class LoginActivity extends SyncActivity { - private Button openCommunity, btnFeedback; private boolean guest = false; - private TextView tvAvailableSpace, previouslyLoggedIn; + private TextView previouslyLoggedIn; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); diff --git a/app/src/main/java/org/ole/planet/myplanet/ui/sync/SyncActivity.java b/app/src/main/java/org/ole/planet/myplanet/ui/sync/SyncActivity.java index 8bea05dcb3..e997965e83 100644 --- a/app/src/main/java/org/ole/planet/myplanet/ui/sync/SyncActivity.java +++ b/app/src/main/java/org/ole/planet/myplanet/ui/sync/SyncActivity.java @@ -119,8 +119,8 @@ public abstract class SyncActivity extends ProcessUserDataActivity implements Sy View positiveAction; String processedUrl; boolean isSync = false, forceSync = false; - Button btnSignIn, becomeMember, btnGuestLogin, btnLang; - TextView customDeviceName, lblVersion; + Button btnSignIn, becomeMember, btnGuestLogin, btnLang, openCommunity, btnFeedback; + TextView customDeviceName, lblVersion, tvAvailableSpace; SharedPreferences defaultPref; ImageButton imgBtnSetting; SwitchCompat switchChildMode; @@ -436,9 +436,9 @@ public void declareMoreElements() { } return false; }); - if (!prefData.getTEAMMODE1()) { - setUplanguageButton(); - } + + setUplanguageButton(); + if (defaultPref.getBoolean("saveUsernameAndPassword", false)) { inputName.setText(settings.getString(getString(R.string.login_user), "")); inputPassword.setText(settings.getString(getString(R.string.login_password), "")); diff --git a/app/src/main/java/org/ole/planet/myplanet/ui/sync/TeamLoginActivity.kt b/app/src/main/java/org/ole/planet/myplanet/ui/sync/TeamLoginActivity.kt index 8e405143ab..7d90948926 100644 --- a/app/src/main/java/org/ole/planet/myplanet/ui/sync/TeamLoginActivity.kt +++ b/app/src/main/java/org/ole/planet/myplanet/ui/sync/TeamLoginActivity.kt @@ -16,6 +16,7 @@ import org.ole.planet.myplanet.model.User import org.ole.planet.myplanet.ui.community.HomeCommunityDialogFragment import org.ole.planet.myplanet.ui.feedback.FeedbackFragment import org.ole.planet.myplanet.ui.userprofile.TeamListAdapter +import org.ole.planet.myplanet.utilities.FileUtils import org.ole.planet.myplanet.utilities.Utilities class TeamLoginActivity : SyncActivity(), TeamListAdapter.OnItemClickListener { @@ -40,8 +41,14 @@ class TeamLoginActivity : SyncActivity(), TeamListAdapter.OnItemClickListener { imgBtnSetting = activityTeamLoginBinding.imgBtnSetting syncIcon = activityTeamLoginBinding.syncIcon lblVersion = activityTeamLoginBinding.lblVersion + btnLang = activityTeamLoginBinding.btnLang + tvAvailableSpace = activityTeamLoginBinding.tvAvailableSpace + openCommunity = activityTeamLoginBinding.openCommunity + btnFeedback = activityTeamLoginBinding.btnFeedback + service = Service(this) + tvAvailableSpace.text = FileUtils.getAvailableOverTotalMemoryFormattedString() changeLogoColor() declareElements() declareMoreElements() @@ -65,15 +72,15 @@ class TeamLoginActivity : SyncActivity(), TeamListAdapter.OnItemClickListener { forceSyncTrigger() if (Utilities.getUrl().isNotEmpty()) { - activityTeamLoginBinding.openCommunity.visibility = View.VISIBLE - activityTeamLoginBinding.openCommunity.setOnClickListener { + openCommunity.visibility = View.VISIBLE + openCommunity.setOnClickListener { HomeCommunityDialogFragment().show(supportFragmentManager, "") } HomeCommunityDialogFragment().show(supportFragmentManager, "") } else { - activityTeamLoginBinding.openCommunity.visibility = View.GONE + openCommunity.visibility = View.GONE } - activityTeamLoginBinding.btnFeedback.setOnClickListener { + btnFeedback.setOnClickListener { FeedbackFragment().show(supportFragmentManager, "") } @@ -130,7 +137,7 @@ class TeamLoginActivity : SyncActivity(), TeamListAdapter.OnItemClickListener { .error(R.drawable.profile) .into(activityTeamLoginBinding.userProfile) - activityTeamLoginBinding.inputName.setText(user.name) + inputName.setText(user.name) } else { if (user.source == "guest"){ val model = mRealm.copyFromRealm(RealmUserModel.createGuestUser(user.name, mRealm, settings)) diff --git a/app/src/main/res/layout/activity_team_login.xml b/app/src/main/res/layout/activity_team_login.xml index c2abf3b26a..7a0ab3f8ca 100644 --- a/app/src/main/res/layout/activity_team_login.xml +++ b/app/src/main/res/layout/activity_team_login.xml @@ -258,14 +258,54 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/textView" /> +