mirror of
https://github.com/nuclearfog/Shitter.git
synced 2025-02-06 22:13:21 +01:00
added profile toolbar blur effect
This commit is contained in:
parent
2d80392d17
commit
5d9b7e66d4
@ -46,6 +46,7 @@ dependencies {
|
||||
implementation 'org.twitter4j:twitter4j-core:4.0.7'
|
||||
implementation 'com.squareup.picasso:picasso:2.71828'
|
||||
implementation 'com.kyleduo.switchbutton:library:2.0.3'
|
||||
implementation 'com.github.open-android:Picasso-transformations:0.1.0'
|
||||
implementation 'com.github.QuadFlask:colorpicker:0.0.15'
|
||||
implementation 'com.github.nuclearfog:ZoomView:1.0.2'
|
||||
implementation 'com.github.nuclearfog:Tagger:2.2'
|
||||
|
@ -8,6 +8,7 @@ import android.graphics.Point;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.text.Spanned;
|
||||
import android.view.Gravity;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
@ -46,11 +47,13 @@ import org.nuclearfog.twidda.database.GlobalSettings;
|
||||
import java.text.NumberFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
|
||||
import jp.wasabeef.picasso.transformations.BlurTransformation;
|
||||
import jp.wasabeef.picasso.transformations.RoundedCornersTransformation;
|
||||
|
||||
import static android.content.Intent.ACTION_VIEW;
|
||||
import static android.os.AsyncTask.Status.RUNNING;
|
||||
import static android.view.View.GONE;
|
||||
import static android.view.View.VISIBLE;
|
||||
import static android.widget.LinearLayout.LayoutParams.WRAP_CONTENT;
|
||||
import static android.widget.Toast.LENGTH_SHORT;
|
||||
import static org.nuclearfog.twidda.activity.MediaViewer.KEY_MEDIA_LINK;
|
||||
import static org.nuclearfog.twidda.activity.MediaViewer.KEY_MEDIA_TYPE;
|
||||
@ -122,6 +125,7 @@ public class UserProfile extends AppCompatActivity implements OnClickListener, O
|
||||
*/
|
||||
private static final int TRANSPARENCY = 0xafffffff;
|
||||
|
||||
private Point displaySize;
|
||||
private FragmentAdapter adapter;
|
||||
private GlobalSettings settings;
|
||||
private UserAction profileAsync;
|
||||
@ -130,8 +134,8 @@ public class UserProfile extends AppCompatActivity implements OnClickListener, O
|
||||
private TextView txtUser, txtScrName;
|
||||
private TextView txtLocation, txtCreated, lnkTxt, bioTxt, follow_back;
|
||||
private Button following, follower;
|
||||
private ImageView profileImage, bannerImage;
|
||||
private View profile_head, profile_layer;
|
||||
private ImageView profileImage, bannerImage, toolbarBackground;
|
||||
private View profile_head;
|
||||
private ViewPager pager;
|
||||
private TabLayout tabLayout;
|
||||
private Dialog unfollowConfirm, blockConfirm, muteConfirm;
|
||||
@ -148,6 +152,7 @@ public class UserProfile extends AppCompatActivity implements OnClickListener, O
|
||||
setContentView(R.layout.page_profile);
|
||||
Toolbar tool = findViewById(R.id.profile_toolbar);
|
||||
View root = findViewById(R.id.user_view);
|
||||
View profile_layer = findViewById(R.id.profile_layer);
|
||||
tabLayout = findViewById(R.id.profile_tab);
|
||||
bioTxt = findViewById(R.id.bio);
|
||||
following = findViewById(R.id.following);
|
||||
@ -155,17 +160,24 @@ public class UserProfile extends AppCompatActivity implements OnClickListener, O
|
||||
lnkTxt = findViewById(R.id.links);
|
||||
profileImage = findViewById(R.id.profile_img);
|
||||
bannerImage = findViewById(R.id.profile_banner);
|
||||
toolbarBackground = findViewById(R.id.profile_toolbar_background);
|
||||
txtUser = findViewById(R.id.profile_username);
|
||||
txtScrName = findViewById(R.id.profile_screenname);
|
||||
txtLocation = findViewById(R.id.location);
|
||||
profile_head = findViewById(R.id.profile_header);
|
||||
profile_layer = findViewById(R.id.profile_layer);
|
||||
txtCreated = findViewById(R.id.profile_date);
|
||||
follow_back = findViewById(R.id.follow_back);
|
||||
pager = findViewById(R.id.profile_pager);
|
||||
|
||||
settings = GlobalSettings.getInstance(this);
|
||||
displaySize = new Point();
|
||||
getWindowManager().getDefaultDisplay().getSize(displaySize);
|
||||
int layoutHeight = displaySize.x / 3;
|
||||
int buttonHeight = (int) getResources().getDimension(R.dimen.profile_button_height);
|
||||
int layerPadding = (int) getResources().getDimension(R.dimen.profile_layer_padding);
|
||||
profile_layer.getLayoutParams().height = layoutHeight + buttonHeight + layerPadding;
|
||||
profile_layer.requestLayout();
|
||||
|
||||
settings = GlobalSettings.getInstance(this);
|
||||
following.setCompoundDrawablesWithIntrinsicBounds(R.drawable.following, 0, 0, 0);
|
||||
follower.setCompoundDrawablesWithIntrinsicBounds(R.drawable.follower, 0, 0, 0);
|
||||
txtCreated.setCompoundDrawablesWithIntrinsicBounds(R.drawable.calendar, 0, 0, 0);
|
||||
@ -590,23 +602,21 @@ public class UserProfile extends AppCompatActivity implements OnClickListener, O
|
||||
}
|
||||
if (settings.getImageLoad()) {
|
||||
if (user.hasBannerImage()) {
|
||||
Point displaySize = new Point();
|
||||
getWindowManager().getDefaultDisplay().getSize(displaySize);
|
||||
int layoutHeight = displaySize.x / 3;
|
||||
int buttonHeight = (int) getResources().getDimension(R.dimen.profile_button_height);
|
||||
profile_layer.getLayoutParams().height = layoutHeight + buttonHeight;
|
||||
String bannerLink = user.getBannerLink() + settings.getBannerSuffix();
|
||||
Picasso.get().load(bannerLink).error(R.drawable.no_banner).into(bannerImage);
|
||||
int toolbarHeight = (int) getResources().getDimension(R.dimen.profile_toolbar_height);
|
||||
Picasso.get().load(bannerLink).resize(displaySize.x, toolbarHeight).centerCrop(Gravity.TOP)
|
||||
.transform(new BlurTransformation(this, 10)).error(R.drawable.no_banner).into(toolbarBackground);
|
||||
} else {
|
||||
bannerImage.setImageResource(0);
|
||||
profile_layer.getLayoutParams().height = WRAP_CONTENT;
|
||||
}
|
||||
profile_layer.requestLayout();
|
||||
if (user.hasProfileImage()) {
|
||||
String imgLink = user.getImageLink();
|
||||
if (!user.hasDefaultProfileImage())
|
||||
imgLink += PROFILE_IMG_HIGH_RES;
|
||||
Picasso.get().load(imgLink).error(R.drawable.no_image).into(profileImage);
|
||||
Picasso.get().load(imgLink).transform(new RoundedCornersTransformation(5, 0)).error(R.drawable.no_image).into(profileImage);
|
||||
} else {
|
||||
profileImage.setImageResource(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout 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:id="@+id/user_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
@ -17,189 +18,182 @@
|
||||
app:layout_scrollFlags="scroll|exitUntilCollapsed">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/profile_header"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
android:orientation="vertical"
|
||||
android:visibility="invisible">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/profile_toolbar"
|
||||
<FrameLayout
|
||||
android:id="@+id/profile_layer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/profile_toolbar_height" />
|
||||
android:layout_height="180dp">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/profile_header"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:visibility="invisible">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/profile_layer"
|
||||
<ImageView
|
||||
android:id="@+id/profile_banner"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="wrap_content"
|
||||
android:adjustViewBounds="true"
|
||||
android:contentDescription="@string/profile_banner"
|
||||
android:scaleType="centerCrop" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/profile_toolbar_background"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/profile_toolbar_height"
|
||||
android:gravity="top"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/profile_toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/profile_toolbar_height"
|
||||
android:gravity="top" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="bottom"
|
||||
android:orientation="horizontal"
|
||||
android:paddingLeft="@dimen/profile_layout_padding"
|
||||
android:paddingRight="@dimen/profile_layout_padding">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/profile_banner"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@string/profile_banner"
|
||||
android:paddingLeft="@dimen/profile_banner_padding"
|
||||
android:paddingRight="@dimen/profile_banner_padding"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerCrop" />
|
||||
android:id="@+id/profile_img"
|
||||
android:layout_width="@dimen/profile_image"
|
||||
android:layout_height="@dimen/profile_image"
|
||||
android:contentDescription="@string/profile_image" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="bottom"
|
||||
android:orientation="horizontal"
|
||||
android:paddingLeft="@dimen/profile_layout_padding"
|
||||
android:paddingRight="@dimen/profile_layout_padding">
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/profile_layout_margin"
|
||||
android:layout_marginLeft="@dimen/profile_layout_margin"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="@dimen/profile_image"
|
||||
android:layout_height="@dimen/profile_image">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/profile_img"
|
||||
android:layout_width="@dimen/profile_image"
|
||||
android:layout_height="@dimen/profile_image"
|
||||
android:contentDescription="@string/profile_image" />
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
<TextView
|
||||
android:id="@+id/profile_username"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:drawablePadding="@dimen/profile_padding_drawable"
|
||||
android:padding="@dimen/profile_tv_padding"
|
||||
android:singleLine="true"
|
||||
android:textSize="@dimen/profile_textsize_big" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/profile_layout_margin"
|
||||
android:layout_marginLeft="@dimen/profile_layout_margin"
|
||||
android:orientation="vertical">
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/profile_username"
|
||||
android:id="@+id/profile_screenname"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="@dimen/profile_textsize_big"
|
||||
android:drawablePadding="@dimen/profile_padding_drawable"
|
||||
android:padding="@dimen/profile_tv_padding"
|
||||
android:singleLine="true" />
|
||||
android:singleLine="true"
|
||||
android:textSize="@dimen/profile_textsize_big" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
<TextView
|
||||
android:id="@+id/follow_back"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
android:drawablePadding="@dimen/profile_padding_drawable"
|
||||
android:padding="@dimen/profile_tv_padding"
|
||||
android:singleLine="true"
|
||||
android:text="@string/follows_you"
|
||||
android:textSize="@dimen/profile_textsize_big"
|
||||
android:visibility="invisible" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/profile_screenname"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="@dimen/profile_textsize_big"
|
||||
android:drawablePadding="@dimen/profile_padding_drawable"
|
||||
android:padding="@dimen/profile_tv_padding"
|
||||
android:singleLine="true" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/follow_back"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="@dimen/profile_textsize_big"
|
||||
android:drawablePadding="@dimen/profile_padding_drawable"
|
||||
android:padding="@dimen/profile_tv_padding"
|
||||
android:singleLine="true"
|
||||
android:text="@string/follows_you"
|
||||
android:visibility="invisible" />
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/profile_layout_margin"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
</LinearLayout>
|
||||
<Button
|
||||
android:id="@+id/following"
|
||||
style="@style/FeedbackButton"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="@dimen/profile_button_height"
|
||||
android:layout_marginLeft="@dimen/profile_button_margin"
|
||||
android:layout_marginRight="@dimen/profile_button_margin"
|
||||
android:layout_weight="1"
|
||||
android:paddingLeft="@dimen/profile_button_padding"
|
||||
android:paddingRight="@dimen/profile_button_padding" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/profile_layout_margin"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<Button
|
||||
android:id="@+id/following"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="@dimen/profile_button_height"
|
||||
android:layout_marginLeft="@dimen/profile_button_margin"
|
||||
android:layout_marginRight="@dimen/profile_button_margin"
|
||||
android:layout_weight="1"
|
||||
android:paddingLeft="@dimen/profile_button_padding"
|
||||
android:paddingRight="@dimen/profile_button_padding"
|
||||
style="@style/FeedbackButton" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/follower"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="@dimen/profile_button_height"
|
||||
android:layout_marginLeft="@dimen/profile_button_margin"
|
||||
android:layout_marginRight="@dimen/profile_button_margin"
|
||||
android:layout_weight="1"
|
||||
android:paddingLeft="@dimen/profile_button_padding"
|
||||
android:paddingRight="@dimen/profile_button_padding"
|
||||
style="@style/FeedbackButton" />
|
||||
|
||||
</LinearLayout>
|
||||
<Button
|
||||
android:id="@+id/follower"
|
||||
style="@style/FeedbackButton"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="@dimen/profile_button_height"
|
||||
android:layout_marginLeft="@dimen/profile_button_margin"
|
||||
android:layout_marginRight="@dimen/profile_button_margin"
|
||||
android:layout_weight="1"
|
||||
android:paddingLeft="@dimen/profile_button_padding"
|
||||
android:paddingRight="@dimen/profile_button_padding" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/bio"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/profile_tv_margin"
|
||||
android:layout_marginRight="@dimen/profile_tv_margin"
|
||||
android:fadeScrollbars="false"
|
||||
android:linksClickable="true"
|
||||
android:maxLines="@integer/profile_text_bio_lines"
|
||||
android:scrollbars="vertical" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/location"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/profile_tv_margin"
|
||||
android:layout_marginRight="@dimen/profile_tv_margin"
|
||||
android:layout_weight="1"
|
||||
android:drawablePadding="@dimen/profile_padding_drawable"
|
||||
android:singleLine="true"
|
||||
android:textSize="@dimen/profile_textsize_small" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/links"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/profile_tv_margin"
|
||||
android:layout_marginRight="@dimen/profile_tv_margin"
|
||||
android:layout_weight="1"
|
||||
android:drawablePadding="@dimen/profile_padding_drawable"
|
||||
android:linksClickable="true"
|
||||
android:singleLine="true"
|
||||
android:textSize="@dimen/profile_textsize_small" />
|
||||
</LinearLayout>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/bio"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/profile_tv_margin"
|
||||
android:layout_marginRight="@dimen/profile_tv_margin"
|
||||
android:fadeScrollbars="false"
|
||||
android:linksClickable="true"
|
||||
android:maxLines="@integer/profile_text_bio_lines"
|
||||
android:scrollbars="vertical" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/profile_date"
|
||||
android:layout_width="match_parent"
|
||||
android:id="@+id/location"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/profile_tv_margin"
|
||||
android:layout_marginRight="@dimen/profile_tv_margin"
|
||||
android:layout_weight="1"
|
||||
android:drawablePadding="@dimen/profile_padding_drawable"
|
||||
android:singleLine="true"
|
||||
android:textSize="@dimen/profile_textsize_small" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/links"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/profile_tv_margin"
|
||||
android:layout_marginRight="@dimen/profile_tv_margin"
|
||||
android:layout_weight="1"
|
||||
android:drawablePadding="@dimen/profile_padding_drawable"
|
||||
android:linksClickable="true"
|
||||
android:singleLine="true"
|
||||
android:textSize="@dimen/profile_textsize_small" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/profile_date"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/profile_tv_margin"
|
||||
android:layout_marginRight="@dimen/profile_tv_margin"
|
||||
android:drawablePadding="@dimen/profile_padding_drawable"
|
||||
android:singleLine="true"
|
||||
android:textSize="@dimen/profile_textsize_small" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</com.google.android.material.appbar.CollapsingToolbarLayout>
|
||||
|
@ -55,6 +55,7 @@
|
||||
<dimen name="profile_button_padding">5dp</dimen>
|
||||
<dimen name="profile_textsize_big">14sp</dimen>
|
||||
<dimen name="profile_textsize_small">12sp</dimen>
|
||||
<dimen name="profile_layer_padding">5dp</dimen>
|
||||
<integer name="profile_text_bio_lines">3</integer>
|
||||
|
||||
<!--dimens of page_editprofile.xml-->
|
||||
|
Loading…
x
Reference in New Issue
Block a user