mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-11-10 04:37:25 +01:00
Minor UI tweaks. Preparing for submitting text posts.
This commit is contained in:
parent
4338dbd277
commit
117a33be3b
Binary file not shown.
Binary file not shown.
@ -19,10 +19,13 @@
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme"
|
||||
android:usesCleartextTraffic="true">
|
||||
<activity android:name=".PostTextActivity"
|
||||
android:label="@string/post_text_activity"
|
||||
android:parentActivityName=".MainActivity" />
|
||||
<activity
|
||||
android:name=".CommentActivity"
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
android:label="@string/comment_activity_label"
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
android:windowSoftInputMode="adjustResize" />
|
||||
<activity
|
||||
android:name=".SearchActivity"
|
||||
@ -54,7 +57,7 @@
|
||||
<activity
|
||||
android:name=".ViewPostDetailActivity"
|
||||
android:parentActivityName=".MainActivity"
|
||||
android:theme="@style/AppTheme.NoActionBar"/>
|
||||
android:theme="@style/AppTheme.NoActionBar" />
|
||||
<activity
|
||||
android:name=".ViewSubredditDetailActivity"
|
||||
android:parentActivityName=".MainActivity"
|
||||
|
@ -632,7 +632,7 @@ class CommentRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
||||
|
||||
class PostDetailViewHolder extends RecyclerView.ViewHolder {
|
||||
@BindView(R.id.subreddit_icon_name_linear_layout_item_post_detail) LinearLayout mSubredditIconNameLinearLayout;
|
||||
@BindView(R.id.subreddit_icon_circle_image_view_item_post_detail) AspectRatioGifImageView mSubredditIconGifImageView;
|
||||
@BindView(R.id.subreddit_icon_gif_image_view_item_post_detail) AspectRatioGifImageView mSubredditIconGifImageView;
|
||||
@BindView(R.id.subreddit_text_view_item_post_detail) TextView mSubredditTextView;
|
||||
@BindView(R.id.post_time_text_view_item_post_detail) TextView mPostTimeTextView;
|
||||
@BindView(R.id.title_text_view_item_post_detail) TextView mTitleTextView;
|
||||
|
@ -29,6 +29,7 @@ import com.bumptech.glide.request.RequestOptions;
|
||||
import com.ferfalk.simplesearchview.SimpleSearchView;
|
||||
import com.google.android.material.appbar.AppBarLayout;
|
||||
import com.google.android.material.appbar.CollapsingToolbarLayout;
|
||||
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@ -67,6 +68,7 @@ public class MainActivity extends AppCompatActivity {
|
||||
@BindView(R.id.subscribed_user_recycler_view_main_activity) RecyclerView subscribedUserRecyclerView;
|
||||
@BindView(R.id.following_label_main_activity) TextView followingLabelTextView;
|
||||
@BindView(R.id.profile_linear_layout_main_activity) LinearLayout profileLinearLayout;
|
||||
@BindView(R.id.fab_main_activity) FloatingActionButton fab;
|
||||
|
||||
private TextView mNameTextView;
|
||||
private TextView mKarmaTextView;
|
||||
@ -260,6 +262,11 @@ public class MainActivity extends AppCompatActivity {
|
||||
userAdapter.setSubscribedUsers(subscribedUserData);
|
||||
});
|
||||
}
|
||||
|
||||
fab.setOnClickListener(view -> {
|
||||
Intent intent = new Intent(this, PostTextActivity.class);
|
||||
this.startActivity(intent);
|
||||
});
|
||||
}
|
||||
|
||||
private void loadUserData() {
|
||||
|
@ -0,0 +1,54 @@
|
||||
package ml.docilealligator.infinityforreddit;
|
||||
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.view.MenuItem;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.ActionBar;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import pl.droidsonroids.gif.GifImageView;
|
||||
|
||||
public class PostTextActivity extends AppCompatActivity {
|
||||
|
||||
static final String EXTRA_SUBREDDIT_NAME = "ESN";
|
||||
|
||||
@BindView(R.id.subreddit_icon_gif_image_view_post_text_activity) GifImageView iconGifImageView;
|
||||
@BindView(R.id.subreddit_name_text_view_post_text_activity) TextView subreditNameTextView;
|
||||
@BindView(R.id.rules_button_post_text_activity) Button rulesButton;
|
||||
@BindView(R.id.post_title_edit_text_post_text_activity) EditText titleEditText;
|
||||
@BindView(R.id.post_text_content_edit_text_post_text_activity) EditText contentEditText;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_post_text);
|
||||
|
||||
ButterKnife.bind(this);
|
||||
|
||||
ActionBar actionBar = getSupportActionBar();
|
||||
Drawable upArrow = getResources().getDrawable(R.drawable.ic_arrow_back_white_24dp);
|
||||
actionBar.setHomeAsUpIndicator(upArrow);
|
||||
|
||||
if(getIntent().hasExtra(EXTRA_SUBREDDIT_NAME)) {
|
||||
subreditNameTextView.setText(getIntent().getExtras().getString(EXTRA_SUBREDDIT_NAME));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case android.R.id.home:
|
||||
finish();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
@ -8,7 +8,6 @@ import android.annotation.SuppressLint;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
@ -16,9 +15,6 @@ import android.os.AsyncTask;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.text.Spannable;
|
||||
import android.text.SpannableString;
|
||||
import android.text.style.ForegroundColorSpan;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.MotionEvent;
|
||||
@ -95,16 +91,12 @@ public class ViewImageActivity extends AppCompatActivity {
|
||||
Drawable upArrow = getResources().getDrawable(R.drawable.ic_arrow_back_white_24dp);
|
||||
actionBar.setHomeAsUpIndicator(upArrow);
|
||||
actionBar.setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.transparentActionBarColor)));
|
||||
setTitle("");
|
||||
|
||||
Intent intent = getIntent();
|
||||
mImageUrl = intent.getExtras().getString(IMAGE_URL_KEY);
|
||||
mImageFileName = intent.getExtras().getString(FILE_NAME_KEY);
|
||||
|
||||
String title = intent.getExtras().getString(TITLE_KEY);
|
||||
Spannable text = new SpannableString(title);
|
||||
text.setSpan(new ForegroundColorSpan(Color.WHITE), 0, title.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
setTitle(text);
|
||||
|
||||
mLoadErrorLinearLayout.setOnClickListener(view -> {
|
||||
if(!isSwiping) {
|
||||
mProgressBar.setVisibility(View.VISIBLE);
|
||||
@ -133,8 +125,6 @@ public class ViewImageActivity extends AppCompatActivity {
|
||||
actionBarColorAnimation.addUpdateListener(valueAnimator -> actionBar.setBackgroundDrawable(new ColorDrawable((int) valueAnimator.getAnimatedValue())));
|
||||
|
||||
actionBarElementColorAnimation.addUpdateListener(valueAnimator -> {
|
||||
text.setSpan(new ForegroundColorSpan((int) valueAnimator.getAnimatedValue()), 0, text.length(), Spannable.SPAN_INCLUSIVE_INCLUSIVE);
|
||||
actionBar.setTitle(text);
|
||||
upArrow.setColorFilter((int) valueAnimator.getAnimatedValue(), PorterDuff.Mode.SRC_IN);
|
||||
if(mMenu != null) {
|
||||
Drawable drawable = mMenu.getItem(0).getIcon();
|
||||
|
@ -8,7 +8,6 @@ import android.app.DownloadManager;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
@ -17,9 +16,6 @@ import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.text.Spannable;
|
||||
import android.text.SpannableString;
|
||||
import android.text.style.ForegroundColorSpan;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.MotionEvent;
|
||||
@ -94,9 +90,10 @@ public class ViewVideoActivity extends AppCompatActivity {
|
||||
setVolumeControlStream(AudioManager.STREAM_MUSIC);
|
||||
|
||||
ActionBar actionBar = getSupportActionBar();
|
||||
actionBar.setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.transparentActionBarColor)));
|
||||
Drawable upArrow = getResources().getDrawable(R.drawable.ic_arrow_back_white_24dp);
|
||||
getSupportActionBar().setHomeAsUpIndicator(upArrow);
|
||||
actionBar.setHomeAsUpIndicator(upArrow);
|
||||
actionBar.setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.transparentActionBarColor)));
|
||||
setTitle("");
|
||||
|
||||
//Set player controller margin bottom in order to display it above the navbar
|
||||
int resourceId = getResources().getIdentifier("navigation_bar_height", "dimen", "android");
|
||||
@ -108,11 +105,6 @@ public class ViewVideoActivity extends AppCompatActivity {
|
||||
mVideoUri = intent.getData();
|
||||
mIsDashVideo = intent.getExtras().getBoolean(IS_DASH_VIDEO_KEY);
|
||||
|
||||
String title = intent.getExtras().getString(TITLE_KEY);
|
||||
Spannable text = new SpannableString(title);
|
||||
text.setSpan(new ForegroundColorSpan(Color.WHITE), 0, title.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
setTitle(text);
|
||||
|
||||
if(intent.getExtras().getBoolean(IS_DOWNLOADABLE_KEY)) {
|
||||
mGifOrVideoFileName = intent.getExtras().getString(SUBREDDIT_KEY).substring(2)
|
||||
+ "-" + intent.getExtras().getString(ID_KEY).substring(3) + ".gif";
|
||||
@ -139,8 +131,6 @@ public class ViewVideoActivity extends AppCompatActivity {
|
||||
actionBarColorAnimation.addUpdateListener(valueAnimator -> actionBar.setBackgroundDrawable(new ColorDrawable((int) valueAnimator.getAnimatedValue())));
|
||||
|
||||
actionBarElementColorAnimation.addUpdateListener(valueAnimator -> {
|
||||
text.setSpan(new ForegroundColorSpan((int) valueAnimator.getAnimatedValue()), 0, text.length(), Spannable.SPAN_INCLUSIVE_INCLUSIVE);
|
||||
actionBar.setTitle(text);
|
||||
upArrow.setColorFilter((int) valueAnimator.getAnimatedValue(), PorterDuff.Mode.SRC_IN);
|
||||
if(mMenu != null) {
|
||||
Drawable drawable = mMenu.getItem(0).getIcon();
|
||||
|
94
app/src/main/res/layout/activity_post_text.xml
Normal file
94
app/src/main/res/layout/activity_post_text.xml
Normal file
@ -0,0 +1,94 @@
|
||||
<?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:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".PostTextActivity">
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp">
|
||||
|
||||
<pl.droidsonroids.gif.GifImageView
|
||||
android:id="@+id/subreddit_icon_gif_image_view_post_text_activity"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:src="@drawable/subreddit_default_icon" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/subreddit_name_text_view_post_text_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toStartOf="@id/rules_button_post_text_activity"
|
||||
android:layout_toEndOf="@id/subreddit_icon_gif_image_view_post_text_activity"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginStart="32dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:text="@string/choose_a_subreddit" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/rules_button_post_text_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:text="@string/rules"
|
||||
android:textColor="@color/colorAccent" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/dividerColor" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/post_title_edit_text_post_text_activity"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="top"
|
||||
android:padding="16dp"
|
||||
android:hint="@string/post_title_hint"
|
||||
android:inputType="textCapSentences|textMultiLine"
|
||||
android:textSize="18sp"
|
||||
android:background="#00000000"
|
||||
android:textColor="@color/primaryTextColor" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/dividerColor" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/post_text_content_edit_text_post_text_activity"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="top"
|
||||
android:padding="16dp"
|
||||
android:hint="@string/post_text_content_hint"
|
||||
android:inputType="textCapSentences|textMultiLine"
|
||||
android:textSize="18sp"
|
||||
android:background="#00000000"
|
||||
android:textColor="@color/primaryTextColor" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
@ -62,4 +62,12 @@
|
||||
|
||||
<include layout="@layout/content_main" />
|
||||
|
||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||
android:id="@+id/fab_main_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|end"
|
||||
android:layout_margin="@dimen/fab_margin"
|
||||
app:srcCompat="@drawable/baseline_add_white_24" />
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
|
@ -4,6 +4,9 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:paddingBottom="16dp"
|
||||
android:background="@color/transparentActionBarColor"
|
||||
android:orientation="vertical">
|
||||
|
||||
|
@ -9,8 +9,7 @@
|
||||
android:id="@+id/comment_progress_bar_view_post_detail"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:layout_margin="16dp"
|
||||
app:mlpb_progress_stoke_width="3dp"
|
||||
app:mlpb_progress_color="@color/colorAccent"
|
||||
app:mlpb_background_color="@color/circularProgressBarBackground"
|
||||
|
@ -2,7 +2,7 @@
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="36dp"
|
||||
android:layout_margin="36dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
|
@ -2,7 +2,7 @@
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="36dp"
|
||||
android:layout_margin="36dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
|
@ -26,7 +26,7 @@
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<CustomView.AspectRatioGifImageView
|
||||
android:id="@+id/subreddit_icon_circle_image_view_item_post_detail"
|
||||
android:id="@+id/subreddit_icon_gif_image_view_item_post_detail"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_gravity="center"/>
|
||||
|
@ -4,6 +4,7 @@
|
||||
<string name="search_activity_label">Search</string>
|
||||
<string name="comment_activity_label">Add Comment</string>
|
||||
<string name="comment_activity_label_is_replying">Reply</string>
|
||||
<string name="post_text_activity">Text Post</string>
|
||||
|
||||
<string name="navigation_drawer_open">Open navigation drawer</string>
|
||||
<string name="navigation_drawer_close">Close navigation drawer</string>
|
||||
@ -84,4 +85,10 @@
|
||||
<string name="comment_load_more_comments_failed">Load failed. Tap to retry.</string>
|
||||
|
||||
<string name="loading">Loading</string>
|
||||
|
||||
<string name="post_title_hint">Title</string>
|
||||
<string name="post_text_content_hint">Content</string>
|
||||
<string name="post_url_hint">URL</string>
|
||||
<string name="choose_a_subreddit">Choose a subreddit</string>
|
||||
<string name="rules">Rules</string>
|
||||
</resources>
|
||||
|
Loading…
Reference in New Issue
Block a user