Commit bebe315b authored by Thomas's avatar Thomas
Browse files

Some layout changes

parent 6a359bbb
Loading
Loading
Loading
Loading
+24 −33
Original line number Diff line number Diff line
@@ -29,7 +29,6 @@ import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
@@ -48,6 +47,7 @@ import com.google.android.material.tabs.TabLayout;
import org.jetbrains.annotations.NotNull;

import app.fedilab.android.R;
import app.fedilab.android.databinding.ActivityShowAccountPeertubeBinding;
import app.fedilab.android.mastodon.activities.BaseBarActivity;
import app.fedilab.android.peertube.client.APIResponse;
import app.fedilab.android.peertube.client.RetrofitPeertubeAPI;
@@ -64,25 +64,18 @@ import es.dmoral.toasty.Toasty;
public class ShowAccountActivity extends BaseBarActivity {


    private ViewPager mPager;
    private TabLayout tabLayout;
    private TextView account_note, subscriber_count;
    private ImageView account_pp;
    private TextView account_dn;
    private AccountData.PeertubeAccount account;
    private String accountAcct;

    private ActivityShowAccountPeertubeBinding binding;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_show_account_peertube);
        binding = ActivityShowAccountPeertubeBinding.inflate(getLayoutInflater());
        setContentView(binding.getRoot());
        setTitle("");
        Bundle b = getIntent().getExtras();
        subscriber_count = findViewById(R.id.subscriber_count);
        account_pp = findViewById(R.id.account_pp);
        account_dn = findViewById(R.id.account_dn);
        account_pp.setBackgroundResource(R.drawable.account_pp_border);
        binding.accountPp.setBackgroundResource(R.drawable.account_pp_border);
        if (b != null) {
            account = (AccountData.PeertubeAccount) b.getSerializable("account");
            accountAcct = b.getString("accountAcct");
@@ -94,8 +87,7 @@ public class ShowAccountActivity extends BaseBarActivity {
            getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        }

        tabLayout = findViewById(R.id.account_tabLayout);
        account_note = findViewById(R.id.account_note);


        manageAccount();
        AccountsVM viewModel = new ViewModelProvider(ShowAccountActivity.this).get(AccountsVM.class);
@@ -158,14 +150,13 @@ public class ShowAccountActivity extends BaseBarActivity {

        setTitle(account.getAcct());

        mPager = findViewById(R.id.account_viewpager);
        tabLayout.addTab(tabLayout.newTab().setText(getString(R.string.channels)));
        tabLayout.addTab(tabLayout.newTab().setText(getString(R.string.videos)));
        mPager.setOffscreenPageLimit(2);
        binding.accountTabLayout.addTab(binding.accountTabLayout.newTab().setText(getString(R.string.channels)));
        binding.accountTabLayout.addTab(binding.accountTabLayout.newTab().setText(getString(R.string.videos)));
        binding.accountViewpager.setOffscreenPageLimit(2);

        PagerAdapter mPagerAdapter = new ScreenSlidePagerAdapter(getSupportFragmentManager());
        mPager.setAdapter(mPagerAdapter);
        mPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
        binding.accountViewpager.setAdapter(mPagerAdapter);
        binding.accountViewpager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
            @Override
            public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {

@@ -173,7 +164,7 @@ public class ShowAccountActivity extends BaseBarActivity {

            @Override
            public void onPageSelected(int position) {
                TabLayout.Tab tab = tabLayout.getTabAt(position);
                TabLayout.Tab tab = binding.accountTabLayout.getTabAt(position);
                if (tab != null)
                    tab.select();
            }
@@ -184,10 +175,10 @@ public class ShowAccountActivity extends BaseBarActivity {
            }
        });

        tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
        binding.accountTabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
            @Override
            public void onTabSelected(TabLayout.Tab tab) {
                mPager.setCurrentItem(tab.getPosition());
                binding.accountViewpager.setCurrentItem(tab.getPosition());
            }

            @Override
@@ -198,8 +189,8 @@ public class ShowAccountActivity extends BaseBarActivity {
            @Override
            public void onTabReselected(TabLayout.Tab tab) {
                Fragment fragment = null;
                if (mPager.getAdapter() != null)
                    fragment = (Fragment) mPager.getAdapter().instantiateItem(mPager, tab.getPosition());
                if (binding.accountViewpager.getAdapter() != null)
                    fragment = (Fragment) binding.accountViewpager.getAdapter().instantiateItem(binding.accountViewpager, tab.getPosition());
                switch (tab.getPosition()) {
                    case 0:
                        if (fragment != null) {
@@ -217,10 +208,10 @@ public class ShowAccountActivity extends BaseBarActivity {
            }
        });

        account_dn.setText(account.getDisplayName());
        binding.accountDn.setText(account.getDisplayName());

        manageNotes(account);
        Helper.loadAvatar(ShowAccountActivity.this, account, account_pp);
        Helper.loadAvatar(ShowAccountActivity.this, account, binding.accountPp);
    }

    @Override
@@ -252,8 +243,8 @@ public class ShowAccountActivity extends BaseBarActivity {
                this.account = account;
                manageAccount();
            }
            subscriber_count.setText(getString(R.string.followers_count, Helper.withSuffix(account.getFollowersCount())));
            subscriber_count.setVisibility(View.VISIBLE);
            binding.subscriberCount.setText(getString(R.string.followers_count, Helper.withSuffix(account.getFollowersCount())));
            binding.subscriberCount.setVisibility(View.VISIBLE);
            manageNotes(account);
        }
    }
@@ -266,11 +257,11 @@ public class ShowAccountActivity extends BaseBarActivity {
            else
                spannableString = new SpannableString(Html.fromHtml(account.getDescription()));

            account_note.setText(spannableString, TextView.BufferType.SPANNABLE);
            account_note.setMovementMethod(LinkMovementMethod.getInstance());
            account_note.setVisibility(View.VISIBLE);
            binding.accountNote.setText(spannableString, TextView.BufferType.SPANNABLE);
            binding.accountNote.setMovementMethod(LinkMovementMethod.getInstance());
            binding.accountNote.setVisibility(View.VISIBLE);
        } else {
            account_note.setVisibility(View.GONE);
            binding.accountNote.setVisibility(View.GONE);
        }
    }

+58 −59
Original line number Diff line number Diff line
@@ -8,7 +8,7 @@
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <ImageView
        <androidx.appcompat.widget.AppCompatImageView
            android:id="@+id/profile_picture"
            android:layout_width="80dp"
            android:layout_height="80dp"
@@ -18,15 +18,14 @@
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent" />

        <Button
        <com.google.android.material.button.MaterialButton
            android:id="@+id/select_file"
            style="@style/Widget.AppCompat.Button.Borderless"
            style="@style/Widget.Material3.Button.OutlinedButton"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginStart="20dp"
            android:singleLine="true"
            android:text="@string/change_profile_picture"
            android:textColor="?attr/colorAccent"
            app:layout_constraintBottom_toBottomOf="@id/profile_picture"
            app:layout_constraintStart_toEndOf="@+id/profile_picture" />

@@ -76,7 +75,7 @@
                android:singleLine="false" />
        </com.google.android.material.textfield.TextInputLayout>

        <TextView
        <androidx.appcompat.widget.AppCompatTextView
            android:id="@+id/notification_title"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
@@ -84,12 +83,12 @@
            android:layout_marginTop="20dp"
            android:text="@string/title_notifications"
            android:textAllCaps="true"
            android:textColor="?attr/colorAccent"
            android:textColor="?attr/colorPrimary"
            android:textSize="18sp"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@+id/description_container" />

        <TextView
        <androidx.appcompat.widget.AppCompatTextView
            android:id="@+id/spinner_indication"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
@@ -112,7 +111,7 @@
            app:layout_constraintStart_toEndOf="@+id/spinner_indication"
            app:layout_constraintTop_toBottomOf="@+id/notification_title" />

        <LinearLayout
        <androidx.appcompat.widget.LinearLayoutCompat
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_margin="20dp"
@@ -121,248 +120,248 @@
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@+id/refresh_time">

            <LinearLayout
            <androidx.appcompat.widget.LinearLayoutCompat
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal">

                <TextView
                <androidx.appcompat.widget.AppCompatTextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="10"
                    android:text="@string/activity"
                    android:textStyle="bold" />

                <TextView
                <androidx.appcompat.widget.AppCompatTextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:text="@string/app"
                    android:textStyle="bold" />

                <TextView
                <androidx.appcompat.widget.AppCompatTextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:text="@string/email"
                    android:textStyle="bold" />
            </LinearLayout>
            </androidx.appcompat.widget.LinearLayoutCompat>

            <LinearLayout
            <androidx.appcompat.widget.LinearLayoutCompat
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal">

                <TextView
                <androidx.appcompat.widget.AppCompatTextView
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="10"
                    android:text="@string/notif_new_video" />

                <androidx.appcompat.widget.SwitchCompat
                <com.google.android.material.switchmaterial.SwitchMaterial
                    android:id="@+id/notif_new_video_app"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1" />

                <androidx.appcompat.widget.SwitchCompat
                <com.google.android.material.switchmaterial.SwitchMaterial
                    android:id="@+id/notif_new_video_mail"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1" />
            </LinearLayout>
            </androidx.appcompat.widget.LinearLayoutCompat>

            <LinearLayout
            <androidx.appcompat.widget.LinearLayoutCompat
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal">

                <TextView
                <androidx.appcompat.widget.AppCompatTextView
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="10"
                    android:text="@string/notif_new_comment" />

                <androidx.appcompat.widget.SwitchCompat
                <com.google.android.material.switchmaterial.SwitchMaterial
                    android:id="@+id/notif_new_comment_app"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1" />

                <androidx.appcompat.widget.SwitchCompat
                <com.google.android.material.switchmaterial.SwitchMaterial
                    android:id="@+id/notif_new_comment_mail"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1" />
            </LinearLayout>
            </androidx.appcompat.widget.LinearLayoutCompat>

            <LinearLayout
            <androidx.appcompat.widget.LinearLayoutCompat
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal">

                <TextView
                <androidx.appcompat.widget.AppCompatTextView
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="10"
                    android:text="@string/notif_blocked" />

                <androidx.appcompat.widget.SwitchCompat
                <com.google.android.material.switchmaterial.SwitchMaterial
                    android:id="@+id/notif_blocked_app"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1" />

                <androidx.appcompat.widget.SwitchCompat
                <com.google.android.material.switchmaterial.SwitchMaterial
                    android:id="@+id/notif_blocked_mail"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1" />
            </LinearLayout>
            </androidx.appcompat.widget.LinearLayoutCompat>

            <LinearLayout
            <androidx.appcompat.widget.LinearLayoutCompat
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal">

                <TextView
                <androidx.appcompat.widget.AppCompatTextView
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="10"
                    android:text="@string/notif_video_published" />

                <androidx.appcompat.widget.SwitchCompat
                <com.google.android.material.switchmaterial.SwitchMaterial
                    android:id="@+id/notif_video_published_app"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1" />

                <androidx.appcompat.widget.SwitchCompat
                <com.google.android.material.switchmaterial.SwitchMaterial
                    android:id="@+id/notif_video_published_mail"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1" />
            </LinearLayout>
            </androidx.appcompat.widget.LinearLayoutCompat>

            <LinearLayout
            <androidx.appcompat.widget.LinearLayoutCompat
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal">

                <TextView
                <androidx.appcompat.widget.AppCompatTextView
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="10"
                    android:text="@string/notif_video_imported" />

                <androidx.appcompat.widget.SwitchCompat
                <com.google.android.material.switchmaterial.SwitchMaterial
                    android:id="@+id/notif_video_imported_app"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1" />

                <androidx.appcompat.widget.SwitchCompat
                <com.google.android.material.switchmaterial.SwitchMaterial
                    android:id="@+id/notif_video_imported_mail"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1" />
            </LinearLayout>
            </androidx.appcompat.widget.LinearLayoutCompat>

            <LinearLayout
            <androidx.appcompat.widget.LinearLayoutCompat
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal">

                <TextView
                <androidx.appcompat.widget.AppCompatTextView
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="10"
                    android:text="@string/notif_new_followers" />

                <androidx.appcompat.widget.SwitchCompat
                <com.google.android.material.switchmaterial.SwitchMaterial
                    android:id="@+id/notif_new_followers_app"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1" />

                <androidx.appcompat.widget.SwitchCompat
                <com.google.android.material.switchmaterial.SwitchMaterial
                    android:id="@+id/notif_new_followers_mail"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1" />
            </LinearLayout>
            </androidx.appcompat.widget.LinearLayoutCompat>

            <LinearLayout
            <androidx.appcompat.widget.LinearLayoutCompat
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal">

                <TextView
                <androidx.appcompat.widget.AppCompatTextView
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="10"
                    android:text="@string/notif_video_mention" />

                <androidx.appcompat.widget.SwitchCompat
                <com.google.android.material.switchmaterial.SwitchMaterial
                    android:id="@+id/notif_video_mention_app"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1" />

                <androidx.appcompat.widget.SwitchCompat
                <com.google.android.material.switchmaterial.SwitchMaterial
                    android:id="@+id/notif_video_mention_mail"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1" />
            </LinearLayout>
            </androidx.appcompat.widget.LinearLayoutCompat>

            <LinearLayout
            <androidx.appcompat.widget.LinearLayoutCompat
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal">

                <TextView
                <androidx.appcompat.widget.AppCompatTextView
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="10"
                    android:text="@string/notif_abuse_received" />

                <androidx.appcompat.widget.SwitchCompat
                <com.google.android.material.switchmaterial.SwitchMaterial
                    android:id="@+id/notif_abuse_received_app"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1" />

                <androidx.appcompat.widget.SwitchCompat
                <com.google.android.material.switchmaterial.SwitchMaterial
                    android:id="@+id/notif_abuse_received_mail"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1" />
            </LinearLayout>
            </androidx.appcompat.widget.LinearLayoutCompat>

            <LinearLayout
            <androidx.appcompat.widget.LinearLayoutCompat
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal">

                <TextView
                <androidx.appcompat.widget.AppCompatTextView
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="10"
                    android:text="@string/notif_abuse_accepted" />

                <androidx.appcompat.widget.SwitchCompat
                <com.google.android.material.switchmaterial.SwitchMaterial
                    android:id="@+id/notif_abuse_accepted_app"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1" />

                <androidx.appcompat.widget.SwitchCompat
                <com.google.android.material.switchmaterial.SwitchMaterial
                    android:id="@+id/notif_abuse_accepted_mail"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1" />
            </LinearLayout>
        </LinearLayout>
            </androidx.appcompat.widget.LinearLayoutCompat>
        </androidx.appcompat.widget.LinearLayoutCompat>
    </androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>
+5 −12

File changed.

Preview size limit exceeded, changes collapsed.