mirror of
https://github.com/viq/NewsBlur.git
synced 2025-09-18 21:43:31 +00:00
Merge branch 'sictiru'
* sictiru: Android v10.3.0. #1438 Downsample large images and max out at 800px #1431 Material Design Chips for story tags Update dependencies #1431 Display saved story timestamp #1237 Preference to toggle offline text storage #1245 Copy to clipboard holds story url
This commit is contained in:
commit
1e470a828e
33 changed files with 144 additions and 151 deletions
|
@ -1,5 +1,5 @@
|
|||
buildscript {
|
||||
ext.kotlin_version = '1.4.30'
|
||||
ext.kotlin_version = '1.4.31'
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven {
|
||||
|
@ -9,7 +9,7 @@ buildscript {
|
|||
google()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:4.1.2'
|
||||
classpath 'com.android.tools.build:gradle:4.1.3'
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
}
|
||||
}
|
||||
|
@ -29,15 +29,15 @@ apply plugin: 'checkstyle'
|
|||
|
||||
dependencies {
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
||||
implementation 'androidx.fragment:fragment-ktx:1.3.0'
|
||||
implementation 'androidx.fragment:fragment-ktx:1.3.1'
|
||||
implementation 'androidx.recyclerview:recyclerview:1.1.0'
|
||||
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
|
||||
implementation 'com.squareup.okhttp3:okhttp:4.9.0'
|
||||
implementation 'com.google.code.gson:gson:2.8.6'
|
||||
implementation 'com.android.billingclient:billing:3.0.2'
|
||||
implementation 'com.android.billingclient:billing:3.0.3'
|
||||
implementation 'nl.dionsegijn:konfetti:1.2.2'
|
||||
implementation 'com.github.jinatonic.confetti:confetti:1.1.2'
|
||||
implementation 'com.google.android.play:core:1.9.1'
|
||||
implementation 'com.google.android.play:core:1.10.0'
|
||||
implementation "com.google.android.material:material:1.3.0"
|
||||
implementation "androidx.preference:preference-ktx:1.1.1"
|
||||
implementation "androidx.browser:browser:1.3.0"
|
||||
|
@ -49,8 +49,8 @@ android {
|
|||
applicationId "com.newsblur"
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 30
|
||||
versionCode 182
|
||||
versionName "10.2.1b3"
|
||||
versionCode 184
|
||||
versionName "10.3.0"
|
||||
}
|
||||
compileOptions.with {
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<corners android:radius="3dp" />
|
||||
<solid android:color="@color/tag_bg_dark" />
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
|
@ -1,18 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<corners android:radius="3dp" />
|
||||
<solid android:color="@color/tag_red_shadow" />
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
<item android:bottom="2px">
|
||||
<shape android:shape="rectangle">
|
||||
<corners android:radius="3dp" />
|
||||
<solid android:color="@color/tag_red" />
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
</layer-list>
|
|
@ -1,18 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<corners android:radius="3dp" />
|
||||
<solid android:color="@color/tag_gray_shadow" />
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
<item android:bottom="2px">
|
||||
<shape android:shape="rectangle">
|
||||
<corners android:radius="3dp" />
|
||||
<solid android:color="@color/tag_gray" />
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
</layer-list>
|
|
@ -1,18 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<corners android:radius="3dp" />
|
||||
<solid android:color="@color/tag_green_shadow" />
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
<item android:bottom="2px">
|
||||
<shape android:shape="rectangle">
|
||||
<corners android:radius="3dp" />
|
||||
<solid android:color="@color/tag_green" />
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
</layer-list>
|
Binary file not shown.
Before Width: | Height: | Size: 1.3 KiB |
12
clients/android/NewsBlur/res/drawable/ic_clock.xml
Normal file
12
clients/android/NewsBlur/res/drawable/ic_clock.xml
Normal file
|
@ -0,0 +1,12 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="20dp"
|
||||
android:height="20dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="#90928B"
|
||||
android:pathData="M11.99,2C6.47,2 2,6.48 2,12s4.47,10 9.99,10C17.52,22 22,17.52 22,12S17.52,2 11.99,2zM12,20c-4.42,0 -8,-3.58 -8,-8s3.58,-8 8,-8 8,3.58 8,8 -3.58,8 -8,8z" />
|
||||
<path
|
||||
android:fillColor="#90928B"
|
||||
android:pathData="M12.5,7H11v6l5.25,3.15 0.75,-1.23 -4.5,-2.67z" />
|
||||
</vector>
|
9
clients/android/NewsBlur/res/drawable/ic_thumb_down.xml
Normal file
9
clients/android/NewsBlur/res/drawable/ic_thumb_down.xml
Normal file
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="#8C3F3F"
|
||||
android:pathData="M22,4h-2c-0.55,0 -1,0.45 -1,1v9c0,0.55 0.45,1 1,1h2V4zM2.17,11.12c-0.11,0.25 -0.17,0.52 -0.17,0.8V13c0,1.1 0.9,2 2,2h5.5l-0.92,4.65c-0.05,0.22 -0.02,0.46 0.08,0.66 0.23,0.45 0.52,0.86 0.88,1.22L10,22l6.41,-6.41c0.38,-0.38 0.59,-0.89 0.59,-1.42V6.34C17,5.05 15.95,4 14.66,4h-8.1c-0.71,0 -1.36,0.37 -1.72,0.97l-2.67,6.15z" />
|
||||
</vector>
|
9
clients/android/NewsBlur/res/drawable/ic_thumb_up.xml
Normal file
9
clients/android/NewsBlur/res/drawable/ic_thumb_up.xml
Normal file
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="#3F8C3F"
|
||||
android:pathData="M2,20h2c0.55,0 1,-0.45 1,-1v-9c0,-0.55 -0.45,-1 -1,-1L2,9v11zM21.83,12.88c0.11,-0.25 0.17,-0.52 0.17,-0.8L22,11c0,-1.1 -0.9,-2 -2,-2h-5.5l0.92,-4.65c0.05,-0.22 0.02,-0.46 -0.08,-0.66 -0.23,-0.45 -0.52,-0.86 -0.88,-1.22L14,2 7.59,8.41C7.21,8.79 7,9.3 7,9.83v7.84C7,18.95 8.05,20 9.34,20h8.11c0.7,0 1.36,-0.37 1.72,-0.97l2.66,-6.15z" />
|
||||
</vector>
|
15
clients/android/NewsBlur/res/layout/chip_view.xml
Normal file
15
clients/android/NewsBlur/res/layout/chip_view.xml
Normal file
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<com.google.android.material.chip.Chip xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/chip"
|
||||
style="?chip"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:textSize="11sp"
|
||||
app:chipCornerRadius="4dp"
|
||||
app:chipIconSize="14dp"
|
||||
app:chipMinHeight="18dp"
|
||||
app:chipMinTouchTargetSize="18dp"
|
||||
app:textEndPadding="2dp"
|
||||
app:textStartPadding="2dp" />
|
|
@ -1,5 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout 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">
|
||||
|
||||
|
@ -63,7 +64,7 @@
|
|||
style="?rowItemHeaderBackground"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="8dp">
|
||||
android:paddingBottom="16dp">
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/story_context_menu_button"
|
||||
|
@ -114,23 +115,38 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/reading_item_date"
|
||||
android:layout_alignLeft="@id/reading_item_title"
|
||||
android:drawableStart="@drawable/ic_file_edit"
|
||||
android:drawablePadding="6dp"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="4dp"
|
||||
android:text="@string/story_show_changes"
|
||||
android:textSize="12sp"
|
||||
android:visibility="gone" />
|
||||
android:visibility="gone"
|
||||
app:drawableStartCompat="@drawable/ic_file_edit" />
|
||||
|
||||
<com.newsblur.view.FlowLayout
|
||||
<com.google.android.material.chip.ChipGroup
|
||||
android:id="@+id/reading_item_tags"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="17dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/reading_story_changes"
|
||||
android:layout_alignLeft="@id/reading_item_title"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="8dp" />
|
||||
app:chipSpacingHorizontal="4dp"
|
||||
app:chipSpacingVertical="4dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/reading_item_saved_timestamp"
|
||||
style="?readingItemMetadata"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/reading_item_tags"
|
||||
android:layout_alignLeft="@id/reading_item_tags"
|
||||
android:layout_marginTop="8dp"
|
||||
android:drawablePadding="2dp"
|
||||
android:gravity="center_vertical"
|
||||
android:textSize="12sp"
|
||||
android:visibility="gone"
|
||||
app:drawableStartCompat="@drawable/ic_clock" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
android:layout_marginLeft="12dp"
|
||||
android:layout_marginRight="12dp"
|
||||
android:contentDescription="@string/description_row_folder_icon"
|
||||
android:src="@drawable/clock" />
|
||||
android:src="@drawable/ic_clock" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/row_folder_indicator"
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/tag_text"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="15dp"
|
||||
android:paddingLeft="5dp"
|
||||
android:paddingRight="5dp"
|
||||
android:paddingBottom="1dp"
|
||||
style="?tag"
|
||||
android:textSize="11sp" />
|
|
@ -66,7 +66,7 @@
|
|||
|
||||
<ImageView
|
||||
android:id="@+id/story_item_saved_icon"
|
||||
android:src="@drawable/clock"
|
||||
android:src="@drawable/ic_clock"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_below="@id/story_item_feedtitle"
|
||||
|
|
|
@ -61,7 +61,7 @@
|
|||
|
||||
<ImageView
|
||||
android:id="@+id/story_item_saved_icon"
|
||||
android:src="@drawable/clock"
|
||||
android:src="@drawable/ic_clock"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_above="@id/story_item_feedtitle"
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<attr name="selectorStoryBackground" format="string" />
|
||||
<attr name="rowItemHeaderBackground" format="string" />
|
||||
<attr name="readingItemMetadata" format="string" />
|
||||
<attr name="tag" format="string" />
|
||||
<attr name="chip" format="string" />
|
||||
<attr name="actionButtons" format="string" />
|
||||
<attr name="storyButtons" format="string" />
|
||||
<attr name="shareBarBackground" format="string" />
|
||||
|
|
|
@ -126,13 +126,10 @@
|
|||
<color name="negative">#CC2A2E</color>
|
||||
|
||||
<color name="tag_red">#D89595</color>
|
||||
<color name="tag_red_shadow">#D29090</color>
|
||||
<color name="tag_red_text">#FFFFFF</color>
|
||||
<color name="tag_green">#AACFA6</color>
|
||||
<color name="tag_green_shadow">#A4C7A0</color>
|
||||
<color name="tag_green_text">#FFFFFF</color>
|
||||
<color name="tag_gray">#E0E0DE</color>
|
||||
<color name="tag_gray_shadow">#C9C9C8</color>
|
||||
<color name="tag_bg_dark">#757575</color>
|
||||
|
||||
<color name="newsblur_blue">#319DC5</color>
|
||||
|
|
|
@ -55,7 +55,6 @@
|
|||
|
||||
<string name="top_level">TOP LEVEL</string>
|
||||
|
||||
<string name="send_brief">%1$s %2$s</string>
|
||||
<string name="send_full">%1$s \n\%2$s \n\n%3$s \n\n—\nShared with NewsBlur.com</string>
|
||||
<string name="share_comment_hint">Comment (Optional)</string>
|
||||
<string name="share_newsblur">Share \"%s\" to your Blurblog?</string>
|
||||
|
@ -198,7 +197,8 @@
|
|||
|
||||
<string name="story_show_changes">Show Story Changes</string>
|
||||
<string name="story_hide_changes">Hide Story Changes</string>
|
||||
<string name="story_changes_loading">Story Changes Loading ...</string>
|
||||
<string name="story_changes_loading">Story Changes Loading …</string>
|
||||
<string name="story_saved_timestamp">Saved %s</string>
|
||||
<string name="your_feeds_search_hint">Search your feeds</string>
|
||||
<string name="story_search_hint">Search for stories</string>
|
||||
<string name="empty_search_notice">Type a search term to begin</string>
|
||||
|
@ -292,6 +292,8 @@
|
|||
<string name="settings_enable_offline_sum">Periodically fetch stories in background</string>
|
||||
<string name="settings_enable_image_prefetch">Download Images</string>
|
||||
<string name="settings_enable_image_prefetch_sum">Pre-fetch images for offline reading</string>
|
||||
<string name="settings_enable_text_prefetch">Download Text</string>
|
||||
<string name="settings_enable_text_prefetch_sum">Pre-fetch text for offline reading</string>
|
||||
<string name="settings_keep_old_stories">Keep Stories after Reading</string>
|
||||
<string name="settings_keep_old_stories_sum">Disable to reduce storage usage</string>
|
||||
|
||||
|
|
|
@ -154,13 +154,13 @@
|
|||
<item name="android:textColor">@color/half_white</item>
|
||||
</style>
|
||||
|
||||
<style name="tag">
|
||||
<style name="chip">
|
||||
<item name="android:textColor">@color/gray55</item>
|
||||
<item name="android:background">@drawable/tag_background_neutral</item>
|
||||
<item name="chipBackgroundColor">@color/tag_gray</item>
|
||||
</style>
|
||||
<style name="tag.dark">
|
||||
<item name="android:textColor">@color/tag_gray_shadow</item>
|
||||
<item name="android:background">@drawable/tag_background_dark</item>
|
||||
<style name="chip.dark">
|
||||
<item name="android:textColor">@color/tag_gray</item>
|
||||
<item name="chipBackgroundColor">@color/tag_bg_dark</item>
|
||||
</style>
|
||||
|
||||
<style name="actionButtons">
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
<item name="selectorStoryBackground">@style/selectorStoryBackground</item>
|
||||
<item name="rowItemHeaderBackground">@style/rowItemHeaderBackground</item>
|
||||
<item name="readingItemMetadata">@style/readingItemMetadata</item>
|
||||
<item name="tag">@style/tag</item>
|
||||
<item name="chip">@style/chip</item>
|
||||
<item name="actionButtons">@style/actionButtons</item>
|
||||
<item name="storyButtons">@style/storyButtons</item>
|
||||
<item name="shareBarBackground">@style/shareBarBackground</item>
|
||||
|
@ -76,7 +76,7 @@
|
|||
<item name="selectorStoryBackground">@style/selectorStoryBackground.dark</item>
|
||||
<item name="rowItemHeaderBackground">@style/rowItemHeaderBackground.dark</item>
|
||||
<item name="readingItemMetadata">@style/readingItemMetadata.dark</item>
|
||||
<item name="tag">@style/tag.dark</item>
|
||||
<item name="chip">@style/chip.dark</item>
|
||||
<item name="actionButtons">@style/actionButtons.dark</item>
|
||||
<item name="storyButtons">@style/storyButtons.dark</item>
|
||||
<item name="shareBarBackground">@style/shareBarBackground.dark</item>
|
||||
|
@ -128,7 +128,7 @@
|
|||
<item name="selectorStoryBackground">@style/selectorStoryBackground.black</item>
|
||||
<item name="rowItemHeaderBackground">@style/rowItemHeaderBackground.black</item>
|
||||
<item name="readingItemMetadata">@style/readingItemMetadata.dark</item>
|
||||
<item name="tag">@style/tag.dark</item>
|
||||
<item name="chip">@style/chip.dark</item>
|
||||
<item name="actionButtons">@style/actionButtons.dark</item>
|
||||
<item name="storyButtons">@style/storyButtons.dark</item>
|
||||
<item name="shareBarBackground">@style/shareBarBackground.black</item>
|
||||
|
|
|
@ -13,6 +13,11 @@
|
|||
android:key="enable_image_prefetch"
|
||||
android:title="@string/settings_enable_image_prefetch"
|
||||
android:summary="@string/settings_enable_image_prefetch_sum" />
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="true"
|
||||
android:key="enable_text_prefetch"
|
||||
android:title="@string/settings_enable_text_prefetch"
|
||||
android:summary="@string/settings_enable_text_prefetch_sum" />
|
||||
<ListPreference
|
||||
android:key="offline_network_select"
|
||||
android:title="@string/menu_network_select"
|
||||
|
|
|
@ -775,7 +775,7 @@ public abstract class Reading extends NbActivity implements OnPageChangeListener
|
|||
public void overlaySend(View v) {
|
||||
if ((readingAdapter == null) || (pager == null)) return;
|
||||
Story story = readingAdapter.getStory(pager.getCurrentItem());
|
||||
FeedUtils.sendStoryBrief(story, this);
|
||||
FeedUtils.sendStoryUrl(story, this);
|
||||
}
|
||||
|
||||
public void overlayText(View v) {
|
||||
|
|
|
@ -15,7 +15,7 @@ public class SavedStoriesItemsList extends ItemsList {
|
|||
if (fs.getSingleSavedTag() != null) {
|
||||
title = title + " - " + fs.getSingleSavedTag();
|
||||
}
|
||||
UIUtils.setupToolbar(this, R.drawable.clock, title, false);
|
||||
UIUtils.setupToolbar(this, R.drawable.ic_clock, title, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -15,7 +15,7 @@ public class SavedStoriesReading extends Reading {
|
|||
if (fs.getSingleSavedTag() != null) {
|
||||
title = title + " - " + fs.getSingleSavedTag();
|
||||
}
|
||||
UIUtils.setupToolbar(this, R.drawable.clock, title, false);
|
||||
UIUtils.setupToolbar(this, R.drawable.ic_clock, title, false);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -397,7 +397,7 @@ public class StoryViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHold
|
|||
return true;
|
||||
|
||||
case R.id.menu_send_story:
|
||||
FeedUtils.sendStoryBrief(story, context);
|
||||
FeedUtils.sendStoryUrl(story, context);
|
||||
return true;
|
||||
|
||||
case R.id.menu_send_story_full:
|
||||
|
|
|
@ -8,7 +8,6 @@ import android.content.Intent;
|
|||
import android.content.IntentFilter;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.GradientDrawable;
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
|
@ -17,6 +16,7 @@ import androidx.annotation.NonNull;
|
|||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.appcompat.widget.PopupMenu;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
@ -28,8 +28,8 @@ import android.view.View;
|
|||
import android.view.View.OnClickListener;
|
||||
import android.view.ViewGroup;
|
||||
import android.webkit.WebView.HitTestResult;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.google.android.material.chip.Chip;
|
||||
import com.newsblur.R;
|
||||
import com.newsblur.activity.FeedItemsList;
|
||||
import com.newsblur.activity.NbActivity;
|
||||
|
@ -227,11 +227,6 @@ public class ReadingItemFragment extends NbFragment implements PopupMenu.OnMenuI
|
|||
clickShare();
|
||||
}
|
||||
});
|
||||
|
||||
if (selectedFeedView == DefaultFeedView.STORY && story.hasModifications) {
|
||||
binding.readingStoryChanges.setVisibility(View.VISIBLE);
|
||||
binding.readingStoryChanges.setOnClickListener(v -> loadStoryChanges());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -328,7 +323,7 @@ public class ReadingItemFragment extends NbFragment implements PopupMenu.OnMenuI
|
|||
newFragment.show(getActivity().getSupportFragmentManager(), "dialog");
|
||||
return true;
|
||||
} else if (item.getItemId() == R.id.menu_send_story) {
|
||||
FeedUtils.sendStoryBrief(story, getActivity());
|
||||
FeedUtils.sendStoryUrl(story, getActivity());
|
||||
return true;
|
||||
} else if (item.getItemId() == R.id.menu_send_story_full) {
|
||||
FeedUtils.sendStoryFull(story, getActivity());
|
||||
|
@ -454,6 +449,18 @@ public class ReadingItemFragment extends NbFragment implements PopupMenu.OnMenuI
|
|||
binding.readingItemTags.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
if (selectedFeedView == DefaultFeedView.STORY && story.hasModifications) {
|
||||
binding.readingStoryChanges.setVisibility(View.VISIBLE);
|
||||
binding.readingStoryChanges.setOnClickListener(v -> loadStoryChanges());
|
||||
}
|
||||
|
||||
if (story.starred && story.starredTimestamp != 0) {
|
||||
String savedTimestampText = String.format(getResources().getString(R.string.story_saved_timestamp),
|
||||
StoryUtils.formatLongDate(getActivity(), story.starredTimestamp));
|
||||
binding.readingItemSavedTimestamp.setVisibility(View.VISIBLE);
|
||||
binding.readingItemSavedTimestamp.setText(savedTimestampText);
|
||||
}
|
||||
|
||||
binding.readingItemAuthors.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
@ -489,51 +496,34 @@ public class ReadingItemFragment extends NbFragment implements PopupMenu.OnMenuI
|
|||
}
|
||||
|
||||
private void setupTagsAndIntel() {
|
||||
int tag_green_text = UIUtils.getColor(getActivity(), R.color.tag_green_text);
|
||||
int tag_red_text = UIUtils.getColor(getActivity(), R.color.tag_red_text);
|
||||
Drawable tag_green_background = UIUtils.getDrawable(getActivity(), R.drawable.tag_background_positive);
|
||||
Drawable tag_red_background = UIUtils.getDrawable(getActivity(), R.drawable.tag_background_negative);
|
||||
|
||||
binding.readingItemTags.removeAllViews();
|
||||
for (String tag : story.tags) {
|
||||
// TODO: these textviews with compound images are buggy, but stubbed in to let colourblind users
|
||||
// see what is going on. these should be replaced with proper Chips when the v28 Chip lib
|
||||
// is in full release.
|
||||
View v = getLayoutInflater().inflate(R.layout.tag_view, null);
|
||||
View v = getLayoutInflater().inflate(R.layout.chip_view, null);
|
||||
|
||||
TextView tagText = (TextView) v.findViewById(R.id.tag_text);
|
||||
tagText.setText(tag);
|
||||
Chip chip = v.findViewById(R.id.chip);
|
||||
chip.setText(tag);
|
||||
|
||||
if (classifier != null && classifier.tags.containsKey(tag)) {
|
||||
switch (classifier.tags.get(tag)) {
|
||||
case Classifier.LIKE:
|
||||
UIUtils.setViewBackground(tagText, tag_green_background);
|
||||
tagText.setTextColor(tag_green_text);
|
||||
Drawable icon_like = UIUtils.getDrawable(getActivity(), R.drawable.ic_like_active);
|
||||
icon_like.setBounds(0, 0, 30, 30);
|
||||
tagText.setCompoundDrawables(null, null, icon_like, null);
|
||||
tagText.setCompoundDrawablePadding(8);
|
||||
chip.setChipBackgroundColorResource(R.color.tag_green);
|
||||
chip.setTextColor(ContextCompat.getColor(requireContext(), R.color.tag_green_text));
|
||||
chip.setChipIcon(ContextCompat.getDrawable(requireContext(), R.drawable.ic_thumb_up));
|
||||
break;
|
||||
case Classifier.DISLIKE:
|
||||
UIUtils.setViewBackground(tagText, tag_red_background);
|
||||
tagText.setTextColor(tag_red_text);
|
||||
Drawable icon_dislike = UIUtils.getDrawable(getActivity(), R.drawable.ic_dislike_active);
|
||||
icon_dislike.setBounds(0, 0, 30, 30);
|
||||
tagText.setCompoundDrawables(null, null, icon_dislike, null);
|
||||
tagText.setCompoundDrawablePadding(8);
|
||||
chip.setChipBackgroundColorResource(R.color.tag_red);
|
||||
chip.setTextColor(ContextCompat.getColor(requireContext(), R.color.tag_red_text));
|
||||
chip.setChipIcon(ContextCompat.getDrawable(requireContext(), R.drawable.ic_thumb_down));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// tapping tags in saved stories doesn't bring up training
|
||||
if (!(fs.isAllSaved() || (fs.getSingleSavedTag() != null))) {
|
||||
v.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (story.feedId.equals("0")) return; // cannot train on feedless stories
|
||||
StoryIntelTrainerFragment intelFrag = StoryIntelTrainerFragment.newInstance(story, fs);
|
||||
intelFrag.show(getParentFragmentManager(), StoryIntelTrainerFragment.class.getName());
|
||||
}
|
||||
v.setOnClickListener(view -> {
|
||||
if (story.feedId.equals("0")) return; // cannot train on feedless stories
|
||||
StoryIntelTrainerFragment intelFrag = StoryIntelTrainerFragment.newInstance(story, fs);
|
||||
intelFrag.show(getParentFragmentManager(), StoryIntelTrainerFragment.class.getName());
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -40,6 +40,7 @@ public class StoryTypeAdapter implements JsonDeserializer<Story> {
|
|||
|
||||
// Convert story_timestamp to milliseconds
|
||||
story.timestamp = story.timestamp * 1000;
|
||||
story.starredTimestamp = story.starredTimestamp * 1000;
|
||||
|
||||
// replace http image urls with https
|
||||
if (httpSniff.matcher(story.content).find() && story.secureImageUrls != null && story.secureImageUrls.size() > 0) {
|
||||
|
|
|
@ -134,6 +134,7 @@ public class UnreadsService extends SubService {
|
|||
|
||||
boolean isOfflineEnabled = PrefsUtils.isOfflineEnabled(parent);
|
||||
boolean isEnableNotifications = PrefsUtils.isEnableNotifications(parent);
|
||||
boolean isTextPrefetchEnabled = PrefsUtils.isTextPrefetchEnabled(parent);
|
||||
if (! (isOfflineEnabled || isEnableNotifications)) return;
|
||||
|
||||
startExpensiveCycle();
|
||||
|
@ -163,7 +164,9 @@ public class UnreadsService extends SubService {
|
|||
StoryHashQueue.remove(hash);
|
||||
}
|
||||
|
||||
parent.prefetchOriginalText(response);
|
||||
if (isTextPrefetchEnabled) {
|
||||
parent.prefetchOriginalText(response);
|
||||
}
|
||||
parent.prefetchImages(response);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -397,13 +397,13 @@ public class FeedUtils {
|
|||
doAction(ra, context);
|
||||
}
|
||||
|
||||
public static void sendStoryBrief(Story story, Context context) {
|
||||
public static void sendStoryUrl(Story story, Context context) {
|
||||
if (story == null) return;
|
||||
Intent intent = new Intent(Intent.ACTION_SEND);
|
||||
intent.setType("text/plain");
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
intent.putExtra(Intent.EXTRA_SUBJECT, story.title);
|
||||
intent.putExtra(Intent.EXTRA_TEXT, String.format(context.getResources().getString(R.string.send_brief), story.title, story.permalink));
|
||||
intent.putExtra(Intent.EXTRA_TEXT, story.permalink);
|
||||
context.startActivity(Intent.createChooser(intent, "Send using"));
|
||||
}
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ public class ImageLoader {
|
|||
}
|
||||
|
||||
public PhotoToLoad displayImage(String url, ImageView imageView, float roundRadius, boolean cropSquare) {
|
||||
return displayImage(url, imageView, roundRadius, cropSquare, Integer.MAX_VALUE, false);
|
||||
return displayImage(url, imageView, roundRadius, cropSquare, imageView.getHeight(), false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -179,8 +179,9 @@ public class ImageLoader {
|
|||
if (!isUrlMapped(photoToLoad.imageView, photoToLoad.url)) return;
|
||||
|
||||
// callers frequently might botch this due to lazy view measuring
|
||||
// limit max dimensions to 800px
|
||||
if (photoToLoad.maxDimPX < 1) {
|
||||
photoToLoad.maxDimPX = Integer.MAX_VALUE;
|
||||
photoToLoad.maxDimPX = 800;
|
||||
}
|
||||
|
||||
// try from disk
|
||||
|
|
|
@ -67,6 +67,7 @@ public class PrefConstants {
|
|||
|
||||
public static final String ENABLE_OFFLINE = "enable_offline";
|
||||
public static final String ENABLE_IMAGE_PREFETCH = "enable_image_prefetch";
|
||||
public static final String ENABLE_TEXT_PREFETCH = "enable_text_prefetch";
|
||||
public static final String NETWORK_SELECT = "offline_network_select";
|
||||
public static final String KEEP_OLD_STORIES = "keep_old_stories";
|
||||
public static final String CACHE_AGE_SELECT = "cache_age_select";
|
||||
|
|
|
@ -718,6 +718,11 @@ public class PrefsUtils {
|
|||
return prefs.getBoolean(PrefConstants.ENABLE_IMAGE_PREFETCH, false);
|
||||
}
|
||||
|
||||
public static boolean isTextPrefetchEnabled(Context context) {
|
||||
SharedPreferences prefs = context.getSharedPreferences(PrefConstants.PREFERENCES, 0);
|
||||
return prefs.getBoolean(PrefConstants.ENABLE_TEXT_PREFETCH, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Compares the user's setting for when background data use is allowed against the
|
||||
* current network status and sees if it is okay to sync.
|
||||
|
|
|
@ -62,7 +62,7 @@ public abstract class ActivityDetailsAdapter extends ArrayAdapter<ActivityDetail
|
|||
} else if (activity.category == Category.SHARED_STORY) {
|
||||
FeedUtils.iconLoader.displayImage(currentUserDetails.photoUrl, imageView, 10f, false);
|
||||
} else if (activity.category == Category.STAR) {
|
||||
imageView.setImageResource(R.drawable.clock);
|
||||
imageView.setImageResource(R.drawable.ic_clock);
|
||||
} else if (activity.user != null) {
|
||||
FeedUtils.iconLoader.displayImage(activity.user.photoUrl, imageView, 5, false);
|
||||
} else {
|
||||
|
|
Loading…
Add table
Reference in a new issue