diff options
author | 0xd9a <0xd9a@noreply.codeberg.org> | 2023-01-26 08:38:16 +0530 |
---|---|---|
committer | 0xd9a <0xd9a@noreply.codeberg.org> | 2023-01-26 08:38:16 +0530 |
commit | 58e7346f7167614f495f25eaec40e3d968582a20 (patch) | |
tree | c2c3077eb63c802cbe218e0e02f2456a3c59b6c1 | |
parent | fc34de1da476538c58ab7fe41b3640bfb356d2ad (diff) |
update some peertube UI
6 files changed, 180 insertions, 273 deletions
diff --git a/app/src/main/java/app/fedilab/android/peertube/activities/LoginActivity.java b/app/src/main/java/app/fedilab/android/peertube/activities/LoginActivity.java index f0729699e..fe3f09d5e 100644 --- a/app/src/main/java/app/fedilab/android/peertube/activities/LoginActivity.java +++ b/app/src/main/java/app/fedilab/android/peertube/activities/LoginActivity.java @@ -71,23 +71,10 @@ public class LoginActivity extends BaseBarActivity { finish(); } - if (getSupportActionBar() != null) + if (getSupportActionBar() != null) { getSupportActionBar().setDisplayHomeAsUpEnabled(true); - - - SpannableString content_create; - content_create = new SpannableString(getString(R.string.join_peertube)); - - content_create.setSpan(new UnderlineSpan(), 0, content_create.length(), 0); - content_create.setSpan(new ForegroundColorSpan(Helper.fetchAccentColor(LoginActivity.this)), 0, content_create.length(), - Spanned.SPAN_INCLUSIVE_EXCLUSIVE); - binding.createAnAccountPeertube.setText(content_create, TextView.BufferType.SPANNABLE); - - binding.createAnAccountPeertube.setOnClickListener(v -> { - Intent mainActivity = new Intent(LoginActivity.this, PeertubeRegisterActivity.class); - startActivity(mainActivity); - }); - + getSupportActionBar().setTitle(R.string.login); + } binding.loginInstanceContainer.setVisibility(View.VISIBLE); diff --git a/app/src/main/java/app/fedilab/android/ui/fragment/FragmentLoginJoin.java b/app/src/main/java/app/fedilab/android/ui/fragment/FragmentLoginJoin.java index fcbb855b0..07e181357 100644 --- a/app/src/main/java/app/fedilab/android/ui/fragment/FragmentLoginJoin.java +++ b/app/src/main/java/app/fedilab/android/ui/fragment/FragmentLoginJoin.java @@ -14,6 +14,7 @@ package app.fedilab.android.ui.fragment; * You should have received a copy of the GNU General Public License along with Fedilab; if not, * see <http://www.gnu.org/licenses>. */ +import android.content.Intent; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; @@ -24,11 +25,10 @@ import androidx.fragment.app.Fragment; import app.fedilab.android.databinding.FragmentLoginJoinBinding; import app.fedilab.android.mastodon.helper.Helper; +import app.fedilab.android.peertube.activities.PeertubeRegisterActivity; public class FragmentLoginJoin extends Fragment { - - private FragmentLoginJoinBinding binding; public View onCreateView(@NonNull LayoutInflater inflater, @@ -41,7 +41,16 @@ public class FragmentLoginJoin extends Fragment { getParentFragmentManager(), android.R.id.content, new FragmentLoginPickInstanceMastodon(), null, null, FragmentLoginPickInstanceMastodon.class.getName()); }); - + binding.joinPeertube.setOnClickListener(v -> { + Intent mainActivity = new Intent(requireActivity(), PeertubeRegisterActivity.class); + startActivity(mainActivity); + }); return root; } + + @Override + public void onDestroyView() { + super.onDestroyView(); + binding = null; + } }
\ No newline at end of file diff --git a/app/src/main/res/layouts/mastodon/layout/fragment_login_join.xml b/app/src/main/res/layouts/mastodon/layout/fragment_login_join.xml index 45f8c6818..9161b4c8f 100644 --- a/app/src/main/res/layouts/mastodon/layout/fragment_login_join.xml +++ b/app/src/main/res/layouts/mastodon/layout/fragment_login_join.xml @@ -14,147 +14,151 @@ You should have received a copy of the GNU General Public License along with Fedilab; if not, see <http://www.gnu.org/licenses>. --> -<androidx.appcompat.widget.LinearLayoutCompat xmlns:android="http://schemas.android.com/apk/res/android" +<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" - android:background="?android:windowBackground" - android:orientation="vertical" - android:padding="12dp" tools:context=".peertube.activities.LoginActivity"> - <com.google.android.material.textview.MaterialTextView + <androidx.appcompat.widget.LinearLayoutCompat android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginTop="12dp" - android:gravity="center_horizontal" - android:text="@string/invite_join_the_fediverse" - android:textAppearance="@style/TextAppearance.Material3.HeadlineMedium" /> + android:orientation="vertical" + android:padding="12dp"> - <com.google.android.material.card.MaterialCardView - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_margin="12dp" - app:cardElevation="2dp"> + <com.google.android.material.textview.MaterialTextView + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginTop="12dp" + android:gravity="center_horizontal" + android:text="@string/invite_join_the_fediverse" + android:textAppearance="@style/TextAppearance.Material3.HeadlineMedium" /> - <androidx.appcompat.widget.LinearLayoutCompat + <com.google.android.material.card.MaterialCardView android:layout_width="match_parent" android:layout_height="wrap_content" - android:orientation="vertical" - android:padding="12dp"> + android:layout_margin="12dp" + app:cardElevation="2dp"> <androidx.appcompat.widget.LinearLayoutCompat android:layout_width="match_parent" android:layout_height="wrap_content" - android:gravity="center_vertical" - android:orientation="horizontal"> + android:orientation="vertical" + android:padding="12dp"> - <androidx.appcompat.widget.AppCompatImageView - android:id="@+id/logo_mastodon" - android:layout_width="24sp" - android:layout_height="24sp" - android:adjustViewBounds="true" - android:scaleType="fitCenter" - android:src="@drawable/logo_mastodon" /> + <androidx.appcompat.widget.LinearLayoutCompat + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:gravity="center_vertical" + android:orientation="horizontal"> + + <androidx.appcompat.widget.AppCompatImageView + android:id="@+id/logo_mastodon" + android:layout_width="24sp" + android:layout_height="24sp" + android:adjustViewBounds="true" + android:scaleType="fitCenter" + android:src="@drawable/logo_mastodon" /> + + <com.google.android.material.textview.MaterialTextView + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_marginStart="12dp" + android:layout_weight="1" + android:text="Mastodon" + android:textAppearance="@style/TextAppearance.Material3.HeadlineSmall" + tools:ignore="HardcodedText" /> + + </androidx.appcompat.widget.LinearLayoutCompat> <com.google.android.material.textview.MaterialTextView - android:layout_width="0dp" + android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginStart="12dp" - android:layout_weight="1" - android:text="Mastodon" - android:textAppearance="@style/TextAppearance.Material3.HeadlineSmall" - tools:ignore="HardcodedText" /> - - </androidx.appcompat.widget.LinearLayoutCompat> - - <com.google.android.material.textview.MaterialTextView - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginTop="12dp" - android:text="@string/about_mastodon" - android:textAppearance="@style/TextAppearance.Material3.BodyMedium" /> - - <com.google.android.material.textview.MaterialTextView - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:text="- joinmastodon.org" - android:textAppearance="@style/TextAppearance.Material3.BodyMedium" - tools:ignore="HardcodedText" /> + android:layout_marginTop="12dp" + android:text="@string/about_mastodon" + android:textAppearance="@style/TextAppearance.Material3.BodyMedium" /> - <com.google.android.material.button.MaterialButton - android:id="@+id/join_mastodon" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginTop="12dp" - android:text="@string/join_mastodon" /> + <com.google.android.material.textview.MaterialTextView + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:text="- joinmastodon.org" + android:textAppearance="@style/TextAppearance.Material3.BodyMedium" + tools:ignore="HardcodedText" /> - </androidx.appcompat.widget.LinearLayoutCompat> + <com.google.android.material.button.MaterialButton + android:id="@+id/join_mastodon" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginTop="12dp" + android:text="@string/join_mastodon" /> - </com.google.android.material.card.MaterialCardView> + </androidx.appcompat.widget.LinearLayoutCompat> - <!-- - <com.google.android.material.card.MaterialCardView - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_margin="12dp" - app:cardElevation="2dp"> + </com.google.android.material.card.MaterialCardView> - <androidx.appcompat.widget.LinearLayoutCompat + <com.google.android.material.card.MaterialCardView android:layout_width="match_parent" android:layout_height="wrap_content" - android:orientation="vertical" - android:padding="12dp"> + android:layout_margin="12dp" + app:cardElevation="2dp"> <androidx.appcompat.widget.LinearLayoutCompat android:layout_width="match_parent" android:layout_height="wrap_content" - android:gravity="center_vertical" - android:orientation="horizontal"> + android:orientation="vertical" + android:padding="12dp"> - <androidx.appcompat.widget.AppCompatImageView - android:layout_width="24sp" - android:layout_height="24sp" - android:adjustViewBounds="true" - android:scaleType="fitCenter" - android:src="@drawable/logo_peertub" /> + <androidx.appcompat.widget.LinearLayoutCompat + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:gravity="center_vertical" + android:orientation="horizontal"> + + <androidx.appcompat.widget.AppCompatImageView + android:id="@+id/logo_peertube" + android:layout_width="24sp" + android:layout_height="24sp" + android:adjustViewBounds="true" + android:scaleType="fitCenter" + android:src="@drawable/peertube_icon" /> + + <com.google.android.material.textview.MaterialTextView + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_marginStart="12dp" + android:layout_weight="1" + android:text="Peertube" + android:textAppearance="@style/TextAppearance.Material3.HeadlineSmall" + tools:ignore="HardcodedText" /> + + </androidx.appcompat.widget.LinearLayoutCompat> <com.google.android.material.textview.MaterialTextView - android:layout_width="0dp" + android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginStart="12dp" - android:layout_weight="1" - android:text="PeerTube" - android:textAppearance="@style/TextAppearance.Material3.Headline5" - tools:ignore="HardcodedText" /> - - </androidx.appcompat.widget.LinearLayoutCompat> + android:layout_marginTop="12dp" + android:text="@string/about_peertube" + android:textAppearance="@style/TextAppearance.Material3.BodyMedium" /> - <com.google.android.material.textview.MaterialTextView - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginTop="12dp" - android:text="@string/join_peertube_message" - android:textAppearance="@style/TextAppearance.Material3.Caption" /> + <com.google.android.material.textview.MaterialTextView + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:text="- joinpeertube.org" + android:textAppearance="@style/TextAppearance.Material3.BodyMedium" + tools:ignore="HardcodedText" /> - <com.google.android.material.textview.MaterialTextView - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:text="- joinpeertube.org" - android:textAppearance="@style/TextAppearance.Material3.Caption" - tools:ignore="HardcodedText" /> + <com.google.android.material.button.MaterialButton + android:id="@+id/join_peertube" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginTop="12dp" + android:text="@string/join_peertube" /> - <com.google.android.material.button.MaterialButton - android:id="@+id/join_peertube" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginTop="12dp" - android:text="@string/join_peertube" /> + </androidx.appcompat.widget.LinearLayoutCompat> - </androidx.appcompat.widget.LinearLayoutCompat> + </com.google.android.material.card.MaterialCardView> - </com.google.android.material.card.MaterialCardView> - --> -</androidx.appcompat.widget.LinearLayoutCompat>
\ No newline at end of file + </androidx.appcompat.widget.LinearLayoutCompat> +</ScrollView>
\ No newline at end of file diff --git a/app/src/main/res/layouts/peertube/layout/activity_login_peertube.xml b/app/src/main/res/layouts/peertube/layout/activity_login_peertube.xml index 17241d5bf..cb6e59124 100644 --- a/app/src/main/res/layouts/peertube/layout/activity_login_peertube.xml +++ b/app/src/main/res/layouts/peertube/layout/activity_login_peertube.xml @@ -14,168 +14,73 @@ You should have received a copy of the GNU General Public License along with Fedilab; if not, see <http://www.gnu.org/licenses>. --> -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" +<androidx.appcompat.widget.LinearLayoutCompat 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="match_parent" - android:orientation="vertical"> + android:gravity="center" + android:orientation="vertical" + android:padding="24dp"> - <androidx.constraintlayout.widget.ConstraintLayout + <com.google.android.material.textfield.TextInputLayout + android:id="@+id/login_instance_container" android:layout_width="match_parent" - android:layout_height="wrap_content"> + android:layout_height="wrap_content" + android:hint="@string/instance"> - <ImageView - android:id="@+id/main_logo" - android:layout_width="150dp" - android:layout_height="150dp" - android:layout_gravity="center_horizontal" - android:layout_marginTop="20dp" - android:contentDescription="@string/app_logo" - android:src="@drawable/ic_launcher_foreground" - app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toTopOf="parent" /> - - - <TextView - android:id="@+id/create_an_account_peertube" - android:layout_width="wrap_content" + <com.google.android.material.textfield.TextInputEditText + android:id="@+id/login_instance" + style="@style/Widget.Material3.TextInputLayout.OutlinedBox.Dense" + android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_gravity="center" - android:layout_marginTop="20dp" - android:drawablePadding="10dp" - android:gravity="center" - android:text="@string/join_peertube" - android:textSize="16sp" - app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toBottomOf="@id/main_logo" /> + android:enabled="false" + android:importantForAutofill="no" + android:inputType="textWebEmailAddress" + android:singleLine="true" /> - </androidx.constraintlayout.widget.ConstraintLayout> + </com.google.android.material.textfield.TextInputLayout> - <androidx.constraintlayout.widget.ConstraintLayout + <com.google.android.material.textfield.TextInputLayout + android:id="@+id/login_uid_container" android:layout_width="match_parent" - android:layout_height="match_parent" - android:layout_marginTop="20dp" - android:paddingStart="50dp" - android:paddingEnd="50dp"> - - <com.google.android.material.textfield.TextInputLayout - android:id="@+id/login_instance_container" - android:layout_width="0dp" - android:layout_height="wrap_content" - app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toTopOf="parent"> - - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/login_instance" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:enabled="false" - android:hint="@string/title_instance_login" - android:importantForAutofill="no" - android:inputType="textWebEmailAddress" - android:paddingTop="2dp" - android:singleLine="true" /> - - </com.google.android.material.textfield.TextInputLayout> + android:layout_height="wrap_content" + android:layout_marginTop="12dp"> - <TextView - android:id="@+id/instance_picker_title" - android:layout_width="wrap_content" + <com.google.android.material.textfield.TextInputEditText + android:id="@+id/login_uid" + android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginTop="20dp" - android:text="@string/instances_picker" - android:visibility="gone" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toTopOf="parent" /> - - <Spinner - android:id="@+id/instance_picker" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginTop="10dp" - android:layout_marginBottom="20dp" - android:visibility="gone" - app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toBottomOf="@id/instance_picker_title" /> - - <androidx.constraintlayout.widget.Barrier - android:id="@+id/barrierTop" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - app:barrierDirection="bottom" - app:constraint_referenced_ids="instance_picker, login_instance_container" /> - - <com.google.android.material.textfield.TextInputLayout - android:id="@+id/login_uid_container" - android:layout_width="0dp" - android:layout_height="wrap_content" - android:layout_marginTop="10dp" - app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toBottomOf="@id/barrierTop"> - - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/login_uid" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/email_address" - android:importantForAutofill="no" - android:inputType="textEmailAddress" - android:singleLine="true" /> - </com.google.android.material.textfield.TextInputLayout> - - <com.google.android.material.textfield.TextInputLayout - android:id="@+id/login_passwd_container" - android:layout_width="0dp" - android:layout_height="wrap_content" - android:layout_marginTop="10dp" - app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toBottomOf="@id/login_uid_container" - app:passwordToggleEnabled="true"> - - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/login_passwd" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/password" - android:importantForAutofill="no" - android:inputType="textPassword" - android:singleLine="true" /> - </com.google.android.material.textfield.TextInputLayout> - - - <androidx.constraintlayout.widget.Barrier - android:id="@+id/barrier" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - app:barrierDirection="bottom" - app:constraint_referenced_ids="login_passwd_container,instance_picker" /> + android:hint="@string/username_or_email" + android:importantForAutofill="no" + android:inputType="textEmailAddress" + android:singleLine="true" /> + </com.google.android.material.textfield.TextInputLayout> + + <com.google.android.material.textfield.TextInputLayout + android:id="@+id/login_passwd_container" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginTop="12dp" + app:passwordToggleEnabled="true"> - <Button - android:id="@+id/login_button" - style="@style/Base.Widget.AppCompat.Button.Colored" - android:layout_width="wrap_content" + <com.google.android.material.textfield.TextInputEditText + android:id="@+id/login_passwd" + android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_gravity="center" - android:layout_marginTop="20dp" - android:drawablePadding="10dp" - android:gravity="center" - android:paddingStart="15dp" - android:paddingTop="12dp" - android:paddingEnd="20dp" - android:paddingBottom="12dp" - android:singleLine="true" - android:text="@string/login" - android:textAllCaps="false" - android:textSize="20sp" - app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toBottomOf="@id/barrier" /> - - </androidx.constraintlayout.widget.ConstraintLayout> -</LinearLayout>
\ No newline at end of file + android:hint="@string/password" + android:importantForAutofill="no" + android:inputType="textPassword" + android:singleLine="true" /> + </com.google.android.material.textfield.TextInputLayout> + + <com.google.android.material.button.MaterialButton + android:id="@+id/login_button" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginTop="24dp" + android:text="@string/login" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@id/login_passwd_container" /> + +</androidx.appcompat.widget.LinearLayoutCompat>
\ No newline at end of file diff --git a/app/src/main/res/values/peertube_strings.xml b/app/src/main/res/values/peertube_strings.xml index d53524309..63bd9c634 100644 --- a/app/src/main/res/values/peertube_strings.xml +++ b/app/src/main/res/values/peertube_strings.xml @@ -302,6 +302,7 @@ <string name="title_video_peertube">Title for the video</string> <string name="join_peertube">Join Peertube</string> <string name="agreement_check_peertube">I am at least 16 years old and agree to the %1$s of this instance</string> + <string name="username_or_email">Username/Email</string> <string name="display_nsfw_videos">Display sensitive videos</string> diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index db5251df2..c7fb49e64 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -673,6 +673,7 @@ <string name="join_the_fediverse">Join the fediverse</string> <string name="invite_join_the_fediverse">Hi! We invite you to join the Fediverse.</string> <string name="about_mastodon">\"Mastodon isn’t a single website like Twitter or Facebook, it\'s a network of thousands of communities operated by different organizations and individuals that provide a seamless social media experience.\"</string> + <string name="about_peertube">\"PeerTube is a tool for sharing online videos developed by Framasoft, a french non-profit.…PeerTube allows platforms to be connected to each other, creating a big network of platforms that are both autonomous and interconnected.\"</string> <string name="notif_display_mentions">Mentions</string> <string name="notif_display_favourites">Favourites</string> <string name="notif_display_reblogs">Reblogs</string> |