Minor layout tweaks. Fixed action bar color in ViewPostDetailActivity in dark mode.

This commit is contained in:
Alex Ning 2019-06-11 19:59:23 +08:00
parent 62c225ffcd
commit ef8daed571
6 changed files with 32 additions and 10 deletions

Binary file not shown.

Binary file not shown.

View File

@ -1,11 +1,11 @@
apply plugin: 'com.android.application' apply plugin: 'com.android.application'
android { android {
compileSdkVersion 28 compileSdkVersion 29
defaultConfig { defaultConfig {
applicationId "ml.docilealligator.infinityforreddit" applicationId "ml.docilealligator.infinityforreddit"
minSdkVersion 21 minSdkVersion 21
targetSdkVersion 28 targetSdkVersion 29
versionCode 1 versionCode 1
versionName "1.0" versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@ -33,14 +33,14 @@ repositories {
dependencies { dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs') implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.appcompat:appcompat:1.1.0-alpha04' implementation 'androidx.appcompat:appcompat:1.1.0-alpha05'
implementation 'com.google.android.material:material:1.1.0-alpha05' implementation 'com.google.android.material:material:1.1.0-alpha07'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3' implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.legacy:legacy-support-v4:1.0.0' implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.legacy:legacy-support-v13:1.0.0' implementation 'androidx.legacy:legacy-support-v13:1.0.0'
testImplementation 'junit:junit:4.12' testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0-alpha04' androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0-alpha04' androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'com.google.android.exoplayer:exoplayer:2.9.6' implementation 'com.google.android.exoplayer:exoplayer:2.9.6'
implementation 'com.google.android.exoplayer:exoplayer-dash:2.9.6' implementation 'com.google.android.exoplayer:exoplayer-dash:2.9.6'
implementation 'androidx.browser:browser:1.0.0' implementation 'androidx.browser:browser:1.0.0'

View File

@ -5,6 +5,7 @@ import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.graphics.ColorFilter; import android.graphics.ColorFilter;
import android.graphics.PorterDuff; import android.graphics.PorterDuff;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
@ -19,6 +20,7 @@ import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import androidx.browser.customtabs.CustomTabsIntent; import androidx.browser.customtabs.CustomTabsIntent;
import androidx.coordinatorlayout.widget.CoordinatorLayout; import androidx.coordinatorlayout.widget.CoordinatorLayout;
@ -101,6 +103,7 @@ public class ViewPostDetailActivity extends AppCompatActivity {
@BindView(R.id.gilded_number_text_view_view_post_detail) TextView mGildedNumberTextView; @BindView(R.id.gilded_number_text_view_view_post_detail) TextView mGildedNumberTextView;
@BindView(R.id.crosspost_image_view_view_post_detail) ImageView mCrosspostImageView; @BindView(R.id.crosspost_image_view_view_post_detail) ImageView mCrosspostImageView;
@BindView(R.id.nsfw_text_view_view_post_detail) Chip mNSFWChip; @BindView(R.id.nsfw_text_view_view_post_detail) Chip mNSFWChip;
@BindView(R.id.link_text_view_view_post_detail) TextView linkTextView;
@BindView(R.id.image_view_wrapper_view_post_detail) RelativeLayout mRelativeLayout; @BindView(R.id.image_view_wrapper_view_post_detail) RelativeLayout mRelativeLayout;
@BindView(R.id.load_wrapper_view_post_detail) RelativeLayout mLoadWrapper; @BindView(R.id.load_wrapper_view_post_detail) RelativeLayout mLoadWrapper;
@ -141,7 +144,9 @@ public class ViewPostDetailActivity extends AppCompatActivity {
((Infinity) getApplication()).getmAppComponent().inject(this); ((Infinity) getApplication()).getmAppComponent().inject(this);
getSupportActionBar().setDisplayHomeAsUpEnabled(true); ActionBar actionBar = getSupportActionBar();
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.colorPrimary)));
mGlide = Glide.with(this); mGlide = Glide.with(this);
mLocale = getResources().getConfiguration().locale; mLocale = getResources().getConfiguration().locale;
@ -274,6 +279,10 @@ public class ViewPostDetailActivity extends AppCompatActivity {
case Post.LINK_TYPE: case Post.LINK_TYPE:
mTypeChip.setText("LINK"); mTypeChip.setText("LINK");
linkTextView.setVisibility(View.VISIBLE);
String domain = Uri.parse(mPost.getUrl()).getHost();
linkTextView.setText(domain);
mImageView.setOnClickListener(view -> { mImageView.setOnClickListener(view -> {
CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder(); CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder();
// add share action to menu list // add share action to menu list
@ -322,6 +331,10 @@ public class ViewPostDetailActivity extends AppCompatActivity {
case Post.NO_PREVIEW_LINK_TYPE: case Post.NO_PREVIEW_LINK_TYPE:
mTypeChip.setText("LINK"); mTypeChip.setText("LINK");
linkTextView.setVisibility(View.VISIBLE);
String noPreviewLinkDomain = Uri.parse(mPost.getUrl()).getHost();
linkTextView.setText(noPreviewLinkDomain);
if(!mPost.getSelfText().equals("")) { if(!mPost.getSelfText().equals("")) {
mContentMarkdownView.setVisibility(View.VISIBLE); mContentMarkdownView.setVisibility(View.VISIBLE);
mContentMarkdownView.setMarkdown(getCustomSpannableConfiguration(), mPost.getSelfText()); mContentMarkdownView.setMarkdown(getCustomSpannableConfiguration(), mPost.getSelfText());

View File

@ -101,7 +101,7 @@
android:id="@+id/type_text_view_view_post_detail" android:id="@+id/type_text_view_view_post_detail"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginEnd="8dp" android:layout_marginEnd="16dp"
android:textColor="@android:color/white" android:textColor="@android:color/white"
android:layout_centerVertical="true" android:layout_centerVertical="true"
app:chipBackgroundColor="@color/backgroundColorPrimaryDark"/> app:chipBackgroundColor="@color/backgroundColorPrimaryDark"/>
@ -152,6 +152,15 @@
</RelativeLayout> </RelativeLayout>
<TextView
android:id="@+id/link_text_view_view_post_detail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:textSize="12sp"
android:visibility="gone"/>
<RelativeLayout <RelativeLayout
android:id="@+id/image_view_wrapper_view_post_detail" android:id="@+id/image_view_wrapper_view_post_detail"
android:layout_width="match_parent" android:layout_width="match_parent"

View File

@ -31,6 +31,6 @@ task clean(type: Delete) {
} }
ext { ext {
roomVersion = '2.1.0-alpha06' roomVersion = '2.1.0-rc01'
archLifecycleVersion = '2.1.0-alpha04' archLifecycleVersion = '2.2.0-alpha01'
} }