mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-07 03:22:27 +02:00
Change login option UI
This commit is contained in:
parent
fe5da24483
commit
5370cb7725
5 changed files with 75 additions and 31 deletions
|
@ -53,6 +53,9 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
|
|||
private NavigationView mNavigationView;
|
||||
private ImageView mProfilePicture;
|
||||
private TextView mDisplayName;
|
||||
private View mLoginPanel;
|
||||
private View mProfilePanel;
|
||||
private TextView mLogoutOption;
|
||||
|
||||
private boolean backToScene;
|
||||
|
||||
|
@ -63,6 +66,12 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
|
|||
|
||||
mNavigationView = findViewById(R.id.nav_view);
|
||||
mNavigationView.setNavigationItemSelectedListener(this);
|
||||
|
||||
mLoginPanel = mNavigationView.getHeaderView(0).findViewById(R.id.loginPanel);
|
||||
mProfilePanel = mNavigationView.getHeaderView(0).findViewById(R.id.profilePanel);
|
||||
|
||||
mLogoutOption = mNavigationView.findViewById(R.id.logout);
|
||||
|
||||
mDisplayName = mNavigationView.getHeaderView(0).findViewById(R.id.displayName);
|
||||
mProfilePicture = mNavigationView.getHeaderView(0).findViewById(R.id.profilePicture);
|
||||
|
||||
|
@ -113,7 +122,6 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
|
|||
|
||||
private void loadHomeFragment() {
|
||||
Fragment fragment = HomeFragment.newInstance();
|
||||
|
||||
loadFragment(fragment, getString(R.string.home), false);
|
||||
}
|
||||
|
||||
|
@ -143,17 +151,16 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
|
|||
|
||||
|
||||
private void updateLoginMenu() {
|
||||
TextView loginOption = findViewById(R.id.login);
|
||||
TextView logoutOption = findViewById(R.id.logout);
|
||||
if (nativeIsLoggedIn()) {
|
||||
loginOption.setVisibility(View.GONE);
|
||||
logoutOption.setVisibility(View.VISIBLE);
|
||||
mLoginPanel.setVisibility(View.GONE);
|
||||
mProfilePanel.setVisibility(View.VISIBLE);
|
||||
mLogoutOption.setVisibility(View.VISIBLE);
|
||||
updateProfileHeader();
|
||||
} else {
|
||||
loginOption.setVisibility(View.VISIBLE);
|
||||
logoutOption.setVisibility(View.GONE);
|
||||
mLoginPanel.setVisibility(View.VISIBLE);
|
||||
mProfilePanel.setVisibility(View.GONE);
|
||||
mLogoutOption.setVisibility(View.GONE);
|
||||
mDisplayName.setText("");
|
||||
mNavigationView.getHeaderView(0).setVisibility(View.INVISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -163,7 +170,6 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
|
|||
private void updateProfileHeader(String username) {
|
||||
if (!username.isEmpty()) {
|
||||
mDisplayName.setText(username);
|
||||
mNavigationView.getHeaderView(0).setVisibility(View.VISIBLE);
|
||||
updateProfilePicture(username);
|
||||
}
|
||||
}
|
||||
|
|
14
android/app/src/main/res/drawable/hifi_logo_header.xml
Normal file
14
android/app/src/main/res/drawable/hifi_logo_header.xml
Normal file
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="680.5dp"
|
||||
android:height="680.5dp"
|
||||
android:viewportWidth="680.5"
|
||||
android:viewportHeight="680.5">
|
||||
|
||||
<path
|
||||
android:fillColor="#E8E6E8"
|
||||
android:pathData="M340.3,642.6 C299.5,642.6,259.9,634.6,222.6,618.8 C186.6,603.6,154.3,581.8,126.5,554 S77,493.9,61.7,457.9 C45.9,420.6,37.9,381,37.9,340.3 S45.9,259.9,61.7,222.6 C76.9,186.6,98.7,154.3,126.5,126.5 S186.6,77,222.6,61.7 C259.9,45.9,299.5,37.9,340.3,37.9 S420.7,45.9,458,61.7 C494,76.9,526.3,98.7,554.1,126.5 C581.9,154.3,603.6,186.6,618.9,222.6 C634.7,259.9,642.7,299.5,642.7,340.3 S634.7,420.7,618.9,458 C603.7,494,581.9,526.3,554.1,554.1 C526.3,581.9,494,603.6,458,618.9 C420.6,634.6,381.1,642.6,340.3,642.6 Z M340.3,69.4 C191,69.4,69.5,190.9,69.5,340.2 S191,611,340.3,611 S611,489.5,611,340.3 C611.2,190.9,489.6,69.4,340.3,69.4 Z" />
|
||||
<path
|
||||
android:fillColor="#E8E6E8"
|
||||
android:pathData="M431.7,468.3 L431.7,256.1 C444.9,251.6,454.4,239.1,454.4,224.4 C454.4,205.9,439.4,190.9,420.9,190.9 S387.4,205.9,387.4,224.4 C387.4,238.5,396.1,250.6,408.5,255.5 L408.5,354.1 L270.4,290 L270.4,212.2 C283.6,207.7,293.1,195.2,293.1,180.5 C293.1,162,278.1,147,259.6,147 S226.1,162,226.1,180.5 C226.1,194.6,234.8,206.7,247.2,211.6 L247.2,425 C234.8,429.9,226.1,442,226.1,456.1 C226.1,474.6,241.1,489.6,259.6,489.6 S293.1,474.6,293.1,456.1 C293.1,441.4,283.6,428.9,270.4,424.4 L270.4,317.4 L408.6,381.5 L408.6,468.9 C396.2,473.8,387.5,485.9,387.5,500 C387.5,518.5,402.5,533.5,421,533.5 S454.5,518.5,454.5,500 C454.4,485.3,444.9,472.8,431.7,468.3 Z" />
|
||||
</vector>
|
|
@ -46,15 +46,6 @@
|
|||
android:clickable="true"
|
||||
android:orientation="vertical"
|
||||
android:padding="@dimen/activity_horizontal_margin">
|
||||
<TextView
|
||||
android:id="@+id/login"
|
||||
android:text="@string/login"
|
||||
android:onClick="onLoginClicked"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/menuOption"
|
||||
android:paddingTop="15dp"
|
||||
android:paddingBottom="15dp"/>
|
||||
<TextView
|
||||
android:id="@+id/logout"
|
||||
android:text="@string/logout"
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
android:textStyle="italic"
|
||||
android:textColor="@color/editTextColor"
|
||||
android:textColorHint="@color/editTextColor"
|
||||
android:gravity="right"
|
||||
android:gravity="right|center_vertical"
|
||||
app:layout_constraintTop_toBottomOf="@id/header"
|
||||
android:layout_marginTop="70dp"
|
||||
android:hint="@string/username_or_email" />
|
||||
|
@ -68,7 +68,7 @@
|
|||
android:textStyle="italic"
|
||||
android:textColor="@color/editTextColor"
|
||||
android:textColorHint="@color/editTextColor"
|
||||
android:gravity="right"
|
||||
android:gravity="right|center_vertical"
|
||||
app:layout_constraintTop_toBottomOf="@id/username"
|
||||
android:hint="@string/password"
|
||||
android:layout_marginTop="13dp"
|
||||
|
@ -103,8 +103,8 @@
|
|||
android:textStyle="italic"
|
||||
android:paddingRight="10dp"
|
||||
app:layout_constraintLeft_toLeftOf="@id/password"
|
||||
app:layout_constraintTop_toBottomOf="@id/password"
|
||||
android:layout_marginTop="11dp"
|
||||
app:layout_constraintTop_toTopOf="@id/loginButton"
|
||||
app:layout_constraintRight_toLeftOf="@id/loginButton"
|
||||
android:textColor="@color/colorButton1"/>
|
||||
|
||||
|
||||
|
|
|
@ -2,18 +2,52 @@
|
|||
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="144dp"
|
||||
android:minHeight="144dp">
|
||||
android:layout_height="176dp"
|
||||
android:minHeight="176dp">
|
||||
<LinearLayout
|
||||
android:id="@+id/loginPanel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:layout_marginLeft="@dimen/activity_horizontal_margin"
|
||||
android:visibility="visible">
|
||||
<ImageView
|
||||
android:id="@+id/hifiLogo"
|
||||
android:layout_width="74dp"
|
||||
android:layout_height="74dp"
|
||||
android:src="@drawable/hifi_logo_header"
|
||||
android:layout_gravity="center_vertical|left" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/login"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="@font/raleway_semibold"
|
||||
android:text="@string/login"
|
||||
android:textSize="18sp"
|
||||
android:layout_marginLeft="22dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:onClick="onLoginClicked"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/profilePanel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:layout_marginLeft="@dimen/activity_horizontal_margin"
|
||||
android:visibility="gone">
|
||||
<ImageView
|
||||
android:id="@+id/profilePicture"
|
||||
android:layout_width="64dp"
|
||||
android:layout_height="64dp"
|
||||
android:src="@drawable/default_profile_avatar"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
android:layout_marginLeft="@dimen/activity_horizontal_margin"
|
||||
android:layout_marginTop="40dp" />
|
||||
android:layout_gravity="center_vertical|left" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/displayName"
|
||||
|
@ -24,7 +58,6 @@
|
|||
android:textSize="18sp"
|
||||
app:layout_constraintLeft_toRightOf="@id/profilePicture"
|
||||
android:layout_marginLeft="22dp"
|
||||
app:layout_constraintTop_toTopOf="@id/profilePicture"
|
||||
app:layout_constraintBottom_toBottomOf="@id/profilePicture"/>
|
||||
|
||||
android:layout_gravity="center_vertical"/>
|
||||
</LinearLayout>
|
||||
</android.support.constraint.ConstraintLayout>
|
Loading…
Reference in a new issue