Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

login: display language and available space (fixes #2752) #2753

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ android {
applicationId "org.ole.planet.myplanet"
minSdkVersion 21
targetSdkVersion 34
versionCode 1168
versionName "0.11.68"
versionCode 1169
versionName "0.11.69"
ndkVersion '21.3.6528147'
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -377,8 +377,9 @@ public void declareElements() {
if (!defaultPref.contains("beta_addImageToMessage")) {
defaultPref.edit().putBoolean("beta_addImageToMessage", true).commit();
}
customDeviceName.setText(getCustomDeviceName());

if (!prefData.getTEAMMODE1()){
customDeviceName.setText(getCustomDeviceName());
switchChildMode.setChecked(settings.getBoolean("isChild", false));
switchChildMode.setOnCheckedChangeListener((compoundButton, b) -> {
inputName.setText("");
Expand Down Expand Up @@ -436,9 +437,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), ""));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -40,8 +41,15 @@ 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
customDeviceName = activityTeamLoginBinding.customDeviceName

service = Service(this)

tvAvailableSpace.text = FileUtils.getAvailableOverTotalMemoryFormattedString()
changeLogoColor()
declareElements()
declareMoreElements()
Expand All @@ -65,15 +73,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, "")
}

Expand Down Expand Up @@ -130,7 +138,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))
Expand Down
52 changes: 51 additions & 1 deletion app/src/main/res/layout/activity_team_login.xml
Original file line number Diff line number Diff line change
Expand Up @@ -258,14 +258,64 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView" />

<Button
android:id="@+id/btn_lang"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:contentDescription="@string/language"
android:entries="@array/language"
android:padding="@dimen/padding_normal"
android:text="@string/language"
android:textColor="@android:color/white"
android:theme="@style/PrimaryFlatButton"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/lblVersion" />

<TextView
android:id="@+id/customDeviceName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/white"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/btn_lang"/>

<LinearLayout
android:id="@+id/ltAvailablaSpace"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="4dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/customDeviceName">

<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingHorizontal="@dimen/padding_small"
app:srcCompat="@drawable/baseline_storage_24" />

<TextView
android:id="@+id/tv_available_space"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:textColor="@color/md_white_1000"
tools:text="@string/available_space_colon" />
</LinearLayout>

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginTop="@dimen/_10dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/lblVersion" />
app:layout_constraintTop_toBottomOf="@+id/ltAvailablaSpace" />

</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>

Expand Down