[V2 UI] Get account status text functional

This commit is contained in:
Duy Tran Khanh 2021-01-15 15:48:04 +07:00
parent cff5b588ca
commit c10e7c543d
3 changed files with 8 additions and 2 deletions

View file

@ -37,7 +37,7 @@ public class PojavLauncherActivity extends BaseLauncherActivity
private ViewPager viewPager; private ViewPager viewPager;
private TextView tvUsernameView; private TextView tvUsernameView, tvConnectStatus;
private Spinner accountSelector; private Spinner accountSelector;
private ViewPagerAdapter viewPageAdapter; private ViewPagerAdapter viewPageAdapter;
private final Button[] Tabs = new Button[4]; private final Button[] Tabs = new Button[4];
@ -89,6 +89,7 @@ public class PojavLauncherActivity extends BaseLauncherActivity
}); });
viewPager.setAdapter(viewPageAdapter); viewPager.setAdapter(viewPageAdapter);
tvConnectStatus = (TextView) findViewById(R.id.launchermain_text_accountstatus);
tvUsernameView = (TextView) findViewById(R.id.launchermain_text_welcome); tvUsernameView = (TextView) findViewById(R.id.launchermain_text_welcome);
mTextVersion = (TextView) findViewById(R.id.launcherMainVersionView); mTextVersion = (TextView) findViewById(R.id.launcherMainVersionView);
@ -218,6 +219,7 @@ public class PojavLauncherActivity extends BaseLauncherActivity
mProfile = PojavProfile.getCurrentProfileContent(this); mProfile = PojavProfile.getCurrentProfileContent(this);
tvUsernameView.setText(getString(R.string.main_welcome, mProfile.username)); tvUsernameView.setText(getString(R.string.main_welcome, mProfile.username));
tvConnectStatus.setText(mProfile.accessToken.equals("0") ? R.string.mcl_account_offline : R.string.mcl_account_connected);
} catch(Exception e) { } catch(Exception e) {
mProfile = new MinecraftAccount(); mProfile = new MinecraftAccount();
Tools.showError(this, e, true); Tools.showError(this, e, true);

View file

@ -51,7 +51,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingStart="8dp" android:paddingStart="8dp"
android:paddingEnd="8dp" android:paddingEnd="8dp"
android:text="Connected" android:text="@string/global_waiting"
app:layout_constraintEnd_toStartOf="@+id/guidelineLeft" app:layout_constraintEnd_toStartOf="@+id/guidelineLeft"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/launchermain_spinner_account" /> app:layout_constraintTop_toBottomOf="@+id/launchermain_spinner_account" />

View file

@ -66,6 +66,10 @@
<string name="mcl_tab_mcje">Minecraft: Java Edition</string> <string name="mcl_tab_mcje">Minecraft: Java Edition</string>
<string name="mcl_tab_console">Development console</string> <string name="mcl_tab_console">Development console</string>
<string name="mcl_tab_crash">Crash log</string> <string name="mcl_tab_crash">Crash log</string>
<!-- MCLauncherActivity: Account status -->
<string name="mcl_account_connected">Connected</string>
<string name="mcl_account_offline">Offline</string>
<!-- MCLauncherActivity: Strings --> <!-- MCLauncherActivity: Strings -->
<string name="mcl_version_msg">Ready to play Minecraft %s</string> <string name="mcl_version_msg">Ready to play Minecraft %s</string>