Skip to content

Commit

Permalink
Maintanence
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonHalvdansson committed Sep 23, 2023
1 parent b0a386b commit d5a3d8a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 30 deletions.
5 changes: 2 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ android {
}

dependencies {

implementation "androidx.lifecycle:lifecycle-viewmodel:2.6.2"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.2"

Expand All @@ -53,16 +52,16 @@ dependencies {
implementation "androidx.window:window:1.1.0"
implementation "androidx.window:window-java:1.1.0"
implementation 'androidx.startup:startup-runtime:1.1.1'
implementation 'androidx.core:core:1.12.0'

//implementation 'org.jsoup:jsoup:1.11.1'

implementation 'com.google.android.material:material:1.11.0-alpha02'

implementation 'com.android.volley:volley:1.2.1'
//implementation 'org.sufficientlysecure:html-textview:4.0'
implementation "com.squareup.okhttp3:okhttp:4.11.0"
implementation 'com.squareup.okhttp:okhttp-urlconnection:2.7.5'
implementation 'com.facebook.shimmer:shimmer:0.5.0'
implementation 'com.squareup.picasso:picasso:2.8'
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.22'
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import android.text.TextUtils;
import android.util.Base64;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
Expand Down Expand Up @@ -97,8 +96,6 @@
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.sufficientlysecure.htmltextview.HtmlTextView;
import org.sufficientlysecure.htmltextview.OnClickATagListener;

import java.io.ByteArrayInputStream;
import java.io.File;
Expand Down Expand Up @@ -440,9 +437,7 @@ private void initializeRecyclerView() {
SettingsUtils.shouldShowWebviewExpandButton(getContext()),
ThemeUtils.isDarkMode(getContext()));

adapter.setOnHeaderClickListener(story1 -> {
Utils.launchCustomTab(getActivity(), story1.url);
});
adapter.setOnHeaderClickListener(story1 -> Utils.launchCustomTab(getActivity(), story1.url));

adapter.setOnCommentClickListener((comment, index, commentView) -> {
comment.expanded = !comment.expanded;
Expand Down Expand Up @@ -1118,21 +1113,16 @@ public void clickShare(View view) {
popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
int id = item.getItemId();

switch (item.getItemId()) {
case R.id.menu_link:
startActivity(ShareUtils.getShareIntent(adapter.story.url));
break;
case R.id.menu_link_title:
startActivity(ShareUtils.getShareIntentWithTitle(adapter.story.title, adapter.story.url));
break;
case R.id.menu_hacker_news_link:
startActivity(ShareUtils.getShareIntent(adapter.story.id));
break;
case R.id.menu_hacker_news_link_title:
startActivity(ShareUtils.getShareIntentWithTitle(adapter.story.title, adapter.story.id));
break;
int itemId = item.getItemId();

if (itemId == R.id.menu_link) {
startActivity(ShareUtils.getShareIntent(adapter.story.url));
} else if (itemId == R.id.menu_link_title) {
startActivity(ShareUtils.getShareIntentWithTitle(adapter.story.title, adapter.story.url));
} else if (itemId == R.id.menu_hacker_news_link) {
startActivity(ShareUtils.getShareIntent(adapter.story.id));
} else if (itemId == R.id.menu_hacker_news_link_title) {
startActivity(ShareUtils.getShareIntentWithTitle(adapter.story.title, adapter.story.id));
}

return true;
Expand Down Expand Up @@ -1317,7 +1307,7 @@ public void onItemClick(Comment comment, int pos, View view) {
new Pair<>("Select text", R.drawable.ic_action_select),
new Pair<>("Vote up", R.drawable.ic_action_thumbs_up),
new Pair<>("Unvote", R.drawable.ic_action_thumbs),
new Pair<>("Vote down (experimental)", R.drawable.ic_action_thumb_down),
new Pair<>("Vote down", R.drawable.ic_action_thumb_down),
};
} else {
items = new Pair[]{
Expand Down Expand Up @@ -1470,11 +1460,11 @@ public interface BottomSheetFragmentCallback {
}

public static class PdfAndroidJavascriptBridge {
private File mFile;
private final File mFile;
private @Nullable
RandomAccessFile mRandomAccessFile;
private @Nullable Callbacks mCallback;
private Handler mHandler;
private final @Nullable Callbacks mCallback;
private final Handler mHandler;

PdfAndroidJavascriptBridge(String filePath, @Nullable Callbacks callback) {
mFile = new File(filePath);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
//lets create a request and fill in the data when we have it
String url = "https://hacker-news.firebaseio.com/v0/user/" + userName + ".json";

@SuppressLint("SetTextI18n") StringRequest stringRequest = new StringRequest(Request.Method.GET, url,
StringRequest stringRequest = new StringRequest(Request.Method.GET, url,
response -> {
try {
//lets try to parse the response
Expand All @@ -99,7 +99,7 @@ public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
cal.setTime(new Date(jsonObject.getInt("created") * 1000L));

// Users who have never submitted before do not receive this key as part of their response.
JSONArray submitted = null;
JSONArray submitted;
if (jsonObject.has("submitted")) {
submitted = jsonObject.getJSONArray("submitted");
} else {
Expand Down

0 comments on commit d5a3d8a

Please sign in to comment.