Austin Huang
4 years ago
No known key found for this signature in database
GPG Key ID: 84C23AA04587A91F
38 changed files with 734 additions and 262 deletions
-
9app/src/main/AndroidManifest.xml
-
14app/src/main/java/awais/instagrabber/activities/Main.java
-
140app/src/main/java/awais/instagrabber/activities/NotificationsViewer.java
-
24app/src/main/java/awais/instagrabber/activities/ProfileViewer.java
-
90app/src/main/java/awais/instagrabber/adapters/NotificationsAdapter.java
-
76app/src/main/java/awais/instagrabber/adapters/viewholder/NotificationViewHolder.java
-
85app/src/main/java/awais/instagrabber/asyncs/NotificationsFetcher.java
-
68app/src/main/java/awais/instagrabber/asyncs/ProfilePictureFetcher.java
-
62app/src/main/java/awais/instagrabber/dialogs/ProfileSettingsDialog.java
-
58app/src/main/java/awais/instagrabber/models/NotificationModel.java
-
10app/src/main/java/awais/instagrabber/models/enums/NotificationType.java
-
7app/src/main/java/awais/instagrabber/models/enums/ProfilePictureFetchMode.java
-
1app/src/main/java/awais/instagrabber/utils/Constants.java
-
1app/src/main/java/awais/instagrabber/utils/ExportImportUtils.java
-
3app/src/main/java/awais/instagrabber/utils/SettingsHelper.java
-
13app/src/main/java/awais/instagrabber/utils/Utils.java
-
1app/src/main/java/awaisomereport/LogCollector.java
-
11app/src/main/res/drawable-anydpi/ic_notif.xml
-
BINapp/src/main/res/drawable-hdpi/ic_notif.png
-
BINapp/src/main/res/drawable-mdpi/ic_notif.png
-
BINapp/src/main/res/drawable-xhdpi/ic_notif.png
-
BINapp/src/main/res/drawable-xxhdpi/ic_notif.png
-
30app/src/main/res/layout/activity_notification.xml
-
48app/src/main/res/layout/dialog_profile_settings.xml
-
20app/src/main/res/layout/item_notification.xml
-
18app/src/main/res/layout/layout_changelog_textview.xml
-
154app/src/main/res/layout/layout_include_notif_item.xml
-
8app/src/main/res/menu/menu.xml
-
4app/src/main/res/values-de/arrays.xml
-
4app/src/main/res/values-es/arrays.xml
-
4app/src/main/res/values-fr/arrays.xml
-
4app/src/main/res/values-in/arrays.xml
-
4app/src/main/res/values-it/arrays.xml
-
4app/src/main/res/values-pl/arrays.xml
-
4app/src/main/res/values-ru/arrays.xml
-
4app/src/main/res/values-zh/arrays.xml
-
5app/src/main/res/values/arrays.xml
-
8app/src/main/res/values/strings.xml
@ -0,0 +1,140 @@ |
|||||
|
package awais.instagrabber.activities; |
||||
|
|
||||
|
import android.content.DialogInterface; |
||||
|
import android.content.Intent; |
||||
|
import android.content.res.Resources; |
||||
|
import android.os.AsyncTask; |
||||
|
import android.os.Bundle; |
||||
|
import android.text.SpannableString; |
||||
|
import android.text.Spanned; |
||||
|
import android.text.style.RelativeSizeSpan; |
||||
|
import android.util.Log; |
||||
|
import android.view.Menu; |
||||
|
import android.view.MenuItem; |
||||
|
import android.view.View; |
||||
|
import android.view.inputmethod.InputMethodManager; |
||||
|
import android.widget.ArrayAdapter; |
||||
|
import android.widget.Toast; |
||||
|
|
||||
|
import androidx.annotation.Nullable; |
||||
|
import androidx.appcompat.app.AlertDialog; |
||||
|
import androidx.appcompat.widget.SearchView; |
||||
|
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; |
||||
|
|
||||
|
import java.io.DataOutputStream; |
||||
|
import java.net.HttpURLConnection; |
||||
|
import java.net.URL; |
||||
|
import java.net.URLEncoder; |
||||
|
|
||||
|
import awais.instagrabber.R; |
||||
|
import awais.instagrabber.adapters.NotificationsAdapter; |
||||
|
import awais.instagrabber.asyncs.NotificationsFetcher; |
||||
|
import awais.instagrabber.databinding.ActivityNotificationBinding; |
||||
|
import awais.instagrabber.interfaces.FetchListener; |
||||
|
import awais.instagrabber.interfaces.MentionClickListener; |
||||
|
import awais.instagrabber.models.NotificationModel; |
||||
|
import awais.instagrabber.models.PostModel; |
||||
|
import awais.instagrabber.models.ProfileModel; |
||||
|
import awais.instagrabber.utils.Constants; |
||||
|
import awais.instagrabber.utils.Utils; |
||||
|
|
||||
|
public final class NotificationsViewer extends BaseLanguageActivity implements SwipeRefreshLayout.OnRefreshListener { |
||||
|
private NotificationsAdapter notificationsAdapter; |
||||
|
private NotificationModel notificationModel; |
||||
|
private ActivityNotificationBinding notificationsBinding; |
||||
|
private ArrayAdapter<String> commmentDialogAdapter; |
||||
|
private String shortCode, postId, userId; |
||||
|
private final String cookie = Utils.settingsHelper.getString(Constants.COOKIE); |
||||
|
private Resources resources; |
||||
|
private InputMethodManager imm; |
||||
|
|
||||
|
@Override |
||||
|
protected void onCreate(@Nullable final Bundle savedInstanceState) { |
||||
|
super.onCreate(savedInstanceState); |
||||
|
notificationsBinding = ActivityNotificationBinding.inflate(getLayoutInflater()); |
||||
|
setContentView(notificationsBinding.getRoot()); |
||||
|
notificationsBinding.swipeRefreshLayout.setOnRefreshListener(this); |
||||
|
|
||||
|
notificationsBinding.swipeRefreshLayout.setRefreshing(true); |
||||
|
setSupportActionBar(notificationsBinding.toolbar.toolbar); |
||||
|
notificationsBinding.toolbar.toolbar.setTitle(R.string.title_notifications); |
||||
|
|
||||
|
resources = getResources(); |
||||
|
|
||||
|
new NotificationsFetcher(new FetchListener<NotificationModel[]>() { |
||||
|
@Override |
||||
|
public void onResult(final NotificationModel[] notificationModels) { |
||||
|
notificationsAdapter = new NotificationsAdapter(notificationModels, clickListener, mentionClickListener); |
||||
|
|
||||
|
notificationsBinding.rvComments.setAdapter(notificationsAdapter); |
||||
|
notificationsBinding.swipeRefreshLayout.setRefreshing(false); |
||||
|
} |
||||
|
}).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void onRefresh() { |
||||
|
notificationsBinding.swipeRefreshLayout.setRefreshing(true); |
||||
|
new NotificationsFetcher(new FetchListener<NotificationModel[]>() { |
||||
|
@Override |
||||
|
public void onResult(final NotificationModel[] notificationModels) { |
||||
|
notificationsBinding.swipeRefreshLayout.setRefreshing(false); |
||||
|
|
||||
|
notificationsAdapter = new NotificationsAdapter(notificationModels, clickListener, mentionClickListener); |
||||
|
|
||||
|
notificationsBinding.rvComments.setAdapter(notificationsAdapter); |
||||
|
} |
||||
|
}).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); |
||||
|
} |
||||
|
|
||||
|
final DialogInterface.OnClickListener profileDialogListener = (dialog, which) -> { |
||||
|
if (which == 0) |
||||
|
searchUsername(notificationModel.getUsername()); |
||||
|
else if (which == 1) |
||||
|
startActivity(new Intent(getApplicationContext(), PostViewer.class) |
||||
|
.putExtra(Constants.EXTRAS_POST, new PostModel(notificationModel.getShortcode()))); |
||||
|
}; |
||||
|
|
||||
|
private final View.OnClickListener clickListener = v -> { |
||||
|
final Object tag = v.getTag(); |
||||
|
if (tag instanceof NotificationModel) { |
||||
|
notificationModel = (NotificationModel) tag; |
||||
|
|
||||
|
final String username = notificationModel.getUsername(); |
||||
|
final SpannableString title = new SpannableString(username + ":\n" + notificationModel.getText()); |
||||
|
title.setSpan(new RelativeSizeSpan(1.23f), 0, username.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE); |
||||
|
|
||||
|
String[] commentDialogList; |
||||
|
|
||||
|
if (notificationModel.getShortcode() != null) commentDialogList = new String[]{ |
||||
|
resources.getString(R.string.open_profile), |
||||
|
resources.getString(R.string.view_post) |
||||
|
}; |
||||
|
else commentDialogList = new String[]{ |
||||
|
resources.getString(R.string.open_profile) |
||||
|
}; |
||||
|
|
||||
|
commmentDialogAdapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, commentDialogList); |
||||
|
|
||||
|
new AlertDialog.Builder(this).setTitle(title) |
||||
|
.setAdapter(commmentDialogAdapter, profileDialogListener) |
||||
|
.setNeutralButton(R.string.cancel, null) |
||||
|
.show(); |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
private final MentionClickListener mentionClickListener = (view, text, isHashtag) -> |
||||
|
new AlertDialog.Builder(this).setTitle(text) |
||||
|
.setMessage(isHashtag ? R.string.comment_view_mention_hash_search : R.string.comment_view_mention_user_search) |
||||
|
.setNegativeButton(R.string.cancel, null).setPositiveButton(R.string.ok, |
||||
|
(dialog, which) -> searchUsername(text)).show(); |
||||
|
|
||||
|
|
||||
|
private void searchUsername(final String text) { |
||||
|
if (Main.scanHack != null) { |
||||
|
Main.scanHack.onResult(text); |
||||
|
setResult(6969); |
||||
|
finish(); |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,90 @@ |
|||||
|
package awais.instagrabber.adapters; |
||||
|
|
||||
|
import android.content.Context; |
||||
|
import android.view.LayoutInflater; |
||||
|
import android.view.View; |
||||
|
import android.view.ViewGroup; |
||||
|
|
||||
|
import androidx.annotation.NonNull; |
||||
|
import androidx.core.text.HtmlCompat; |
||||
|
import androidx.recyclerview.widget.RecyclerView; |
||||
|
|
||||
|
import com.bumptech.glide.Glide; |
||||
|
import com.bumptech.glide.RequestManager; |
||||
|
import com.bumptech.glide.request.RequestOptions; |
||||
|
|
||||
|
import java.util.ArrayList; |
||||
|
|
||||
|
import awais.instagrabber.R; |
||||
|
import awais.instagrabber.adapters.viewholder.NotificationViewHolder; |
||||
|
import awais.instagrabber.interfaces.MentionClickListener; |
||||
|
import awais.instagrabber.models.NotificationModel; |
||||
|
import awais.instagrabber.utils.LocaleUtils; |
||||
|
import awais.instagrabber.utils.Utils; |
||||
|
|
||||
|
public final class NotificationsAdapter extends RecyclerView.Adapter<NotificationViewHolder> { |
||||
|
private final View.OnClickListener onClickListener; |
||||
|
private final MentionClickListener mentionClickListener; |
||||
|
private final NotificationModel[] notificationModels; |
||||
|
private LayoutInflater layoutInflater; |
||||
|
|
||||
|
public NotificationsAdapter(final NotificationModel[] notificationModels, final View.OnClickListener onClickListener, |
||||
|
final MentionClickListener mentionClickListener) { |
||||
|
this.notificationModels = notificationModels; |
||||
|
this.onClickListener = onClickListener; |
||||
|
this.mentionClickListener = mentionClickListener; |
||||
|
} |
||||
|
|
||||
|
@NonNull |
||||
|
@Override |
||||
|
public NotificationViewHolder onCreateViewHolder(@NonNull final ViewGroup parent, final int type) { |
||||
|
final Context context = parent.getContext(); |
||||
|
if (layoutInflater == null) layoutInflater = LayoutInflater.from(context); |
||||
|
return new NotificationViewHolder(layoutInflater.inflate(R.layout.item_notification, |
||||
|
parent, false), onClickListener, mentionClickListener); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void onBindViewHolder(@NonNull final NotificationViewHolder holder, final int position) { |
||||
|
final NotificationModel notificationModel = notificationModels[position]; |
||||
|
if (notificationModel != null) { |
||||
|
holder.setNotificationModel(notificationModel); |
||||
|
|
||||
|
int text = -1; |
||||
|
CharSequence subtext = null; |
||||
|
switch (notificationModel.getType()) { |
||||
|
case LIKE: |
||||
|
text = R.string.liked_notif; |
||||
|
break; |
||||
|
case COMMENT: |
||||
|
text = R.string.comment_notif; |
||||
|
subtext = notificationModel.getText(); |
||||
|
break; |
||||
|
case MENTION: |
||||
|
text = R.string.mention_notif; |
||||
|
subtext = notificationModel.getText(); |
||||
|
break; |
||||
|
case FOLLOW: |
||||
|
text = R.string.follow_notif; |
||||
|
break; |
||||
|
} |
||||
|
|
||||
|
holder.setCommment(text); |
||||
|
holder.setSubCommment(subtext); |
||||
|
holder.setDate(notificationModel.getDateTime()); |
||||
|
|
||||
|
holder.setUsername(notificationModel.getUsername()); |
||||
|
|
||||
|
final RequestManager rm = Glide.with(layoutInflater.getContext()) |
||||
|
.applyDefaultRequestOptions(new RequestOptions().skipMemoryCache(true)); |
||||
|
|
||||
|
rm.load(notificationModel.getProfilePic()).into(holder.getProfilePicView()); |
||||
|
rm.load(notificationModel.getPreviewPic()).into(holder.getPreviewPicView()); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public int getItemCount() { |
||||
|
return notificationModels == null ? 0 : notificationModels.length; |
||||
|
} |
||||
|
} |
@ -0,0 +1,76 @@ |
|||||
|
package awais.instagrabber.adapters.viewholder; |
||||
|
|
||||
|
import android.text.Spannable; |
||||
|
import android.view.View; |
||||
|
import android.widget.ImageView; |
||||
|
import android.widget.TextView; |
||||
|
|
||||
|
import androidx.annotation.NonNull; |
||||
|
import androidx.recyclerview.widget.RecyclerView; |
||||
|
|
||||
|
import awais.instagrabber.R; |
||||
|
import awais.instagrabber.adapters.CommentsAdapter; |
||||
|
import awais.instagrabber.customviews.RamboTextView; |
||||
|
import awais.instagrabber.interfaces.MentionClickListener; |
||||
|
import awais.instagrabber.models.NotificationModel; |
||||
|
|
||||
|
public final class NotificationViewHolder extends RecyclerView.ViewHolder { |
||||
|
private final MentionClickListener mentionClickListener; |
||||
|
private final ImageView ivProfilePic, ivPreviewPic; |
||||
|
private final TextView tvUsername, tvDate, tvComment, tvSubComment; |
||||
|
private final View container, rightContainer; |
||||
|
|
||||
|
public NotificationViewHolder(@NonNull final View itemView, final View.OnClickListener onClickListener, final MentionClickListener mentionClickListener) { |
||||
|
super(itemView); |
||||
|
|
||||
|
container = itemView.findViewById(R.id.container); |
||||
|
rightContainer = itemView.findViewById(R.id.rightContainer); |
||||
|
if (onClickListener != null) container.setOnClickListener(onClickListener); |
||||
|
|
||||
|
this.mentionClickListener = mentionClickListener; |
||||
|
|
||||
|
ivProfilePic = itemView.findViewById(R.id.ivProfilePic); |
||||
|
ivPreviewPic = itemView.findViewById(R.id.ivPreviewPic); |
||||
|
tvUsername = itemView.findViewById(R.id.tvUsername); |
||||
|
tvDate = itemView.findViewById(R.id.tvDate); |
||||
|
tvComment = itemView.findViewById(R.id.tvComment); |
||||
|
tvSubComment = itemView.findViewById(R.id.tvSubComment); |
||||
|
|
||||
|
tvUsername.setSelected(true); |
||||
|
tvDate.setSelected(true); |
||||
|
} |
||||
|
|
||||
|
public final ImageView getProfilePicView() { |
||||
|
return ivProfilePic; |
||||
|
} |
||||
|
|
||||
|
public final ImageView getPreviewPicView() { |
||||
|
return ivPreviewPic; |
||||
|
} |
||||
|
|
||||
|
public final void setNotificationModel(final NotificationModel notificationModel) { |
||||
|
if (container != null) container.setTag(notificationModel); |
||||
|
if (rightContainer != null) rightContainer.setTag(notificationModel); |
||||
|
} |
||||
|
|
||||
|
public final void setUsername(final String username) { |
||||
|
if (tvUsername != null) tvUsername.setText(username); |
||||
|
} |
||||
|
|
||||
|
public final void setDate(final String date) { |
||||
|
if (tvDate != null) tvDate.setText(date); |
||||
|
} |
||||
|
|
||||
|
public final void setCommment(final int commment) { |
||||
|
if (tvComment != null) { |
||||
|
tvComment.setText(commment); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public final void setSubCommment(final CharSequence commment) { |
||||
|
if (tvSubComment != null) { |
||||
|
tvSubComment.setText(commment, commment instanceof Spannable ? TextView.BufferType.SPANNABLE : TextView.BufferType.NORMAL); |
||||
|
((RamboTextView) tvSubComment).setMentionClickListener(mentionClickListener); |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,85 @@ |
|||||
|
package awais.instagrabber.asyncs; |
||||
|
|
||||
|
import android.os.AsyncTask; |
||||
|
import android.util.Log; |
||||
|
|
||||
|
import org.json.JSONArray; |
||||
|
import org.json.JSONObject; |
||||
|
|
||||
|
import java.net.HttpURLConnection; |
||||
|
import java.net.URL; |
||||
|
|
||||
|
import awais.instagrabber.BuildConfig; |
||||
|
import awais.instagrabber.interfaces.FetchListener; |
||||
|
import awais.instagrabber.models.NotificationModel; |
||||
|
import awais.instagrabber.utils.Constants; |
||||
|
import awais.instagrabber.utils.Utils; |
||||
|
import awaisomereport.LogCollector; |
||||
|
|
||||
|
import static awais.instagrabber.utils.Utils.logCollector; |
||||
|
|
||||
|
public final class NotificationsFetcher extends AsyncTask<Void, Void, NotificationModel[]> { |
||||
|
private final FetchListener<NotificationModel[]> fetchListener; |
||||
|
|
||||
|
public NotificationsFetcher(final FetchListener<NotificationModel[]> fetchListener) { |
||||
|
this.fetchListener = fetchListener; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
protected NotificationModel[] doInBackground(final Void... voids) { |
||||
|
NotificationModel[] result = null; |
||||
|
final String url = "https://www.instagram.com/accounts/activity/?__a=1"; |
||||
|
|
||||
|
try { |
||||
|
final HttpURLConnection conn = (HttpURLConnection) new URL(url).openConnection(); |
||||
|
conn.setInstanceFollowRedirects(false); |
||||
|
conn.setUseCaches(false); |
||||
|
conn.connect(); |
||||
|
|
||||
|
if (conn.getResponseCode() == HttpURLConnection.HTTP_OK) { |
||||
|
JSONObject data = new JSONObject(Utils.readFromConnection(conn)) |
||||
|
.getJSONObject("graphql").getJSONObject("user").getJSONObject("activity_feed").getJSONObject("edge_web_activity_feed"); |
||||
|
|
||||
|
JSONArray media; |
||||
|
if ((media = data.optJSONArray("edges")) != null && media.length() > 0 && |
||||
|
(data = media.optJSONObject(0).optJSONObject("node")) != null) { |
||||
|
|
||||
|
final int mediaLen = media.length(); |
||||
|
|
||||
|
final NotificationModel[] models = new NotificationModel[mediaLen]; |
||||
|
for (int i = 0; i < mediaLen; ++i) { |
||||
|
data = media.optJSONObject(i).optJSONObject("node"); |
||||
|
if (Utils.getNotifType(data.getString("__typename")) == null) continue; |
||||
|
models[i] = new NotificationModel(data.getString(Constants.EXTRAS_ID), |
||||
|
data.optString("text"), // comments or mentions |
||||
|
data.getLong("timestamp"), |
||||
|
data.getJSONObject("user").getString("username"), |
||||
|
data.getJSONObject("user").getString("profile_pic_url"), |
||||
|
!data.isNull("media") ? data.getJSONObject("media").getString("shortcode") : null, |
||||
|
!data.isNull("media") ? data.getJSONObject("media").getString("thumbnail_src") : null, |
||||
|
Utils.getNotifType(data.getString("__typename"))); |
||||
|
} |
||||
|
result = models; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
conn.disconnect(); |
||||
|
} catch (final Exception e) { |
||||
|
if (logCollector != null) |
||||
|
logCollector.appendException(e, LogCollector.LogFile.ASYNC_NOTIFICATION_FETCHER, "doInBackground"); |
||||
|
if (BuildConfig.DEBUG) Log.e("AWAISKING_APP", "", e); |
||||
|
} |
||||
|
|
||||
|
return result; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
protected void onPreExecute() { |
||||
|
if (fetchListener != null) fetchListener.doBefore(); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
protected void onPostExecute(final NotificationModel[] result) { |
||||
|
if (fetchListener != null) fetchListener.onResult(result); |
||||
|
} |
||||
|
} |
@ -1,62 +0,0 @@ |
|||||
package awais.instagrabber.dialogs; |
|
||||
|
|
||||
import android.app.Activity; |
|
||||
import android.app.Dialog; |
|
||||
import android.content.Context; |
|
||||
import android.content.DialogInterface; |
|
||||
import android.os.Bundle; |
|
||||
import android.view.View; |
|
||||
import android.widget.AdapterView; |
|
||||
import android.widget.Spinner; |
|
||||
|
|
||||
import androidx.annotation.NonNull; |
|
||||
import androidx.annotation.Nullable; |
|
||||
|
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment; |
|
||||
|
|
||||
import awais.instagrabber.R; |
|
||||
|
|
||||
import static awais.instagrabber.utils.Constants.PROFILE_FETCH_MODE; |
|
||||
import static awais.instagrabber.utils.Utils.settingsHelper; |
|
||||
|
|
||||
public final class ProfileSettingsDialog extends BottomSheetDialogFragment implements AdapterView.OnItemSelectedListener { |
|
||||
private int fetchIndex; |
|
||||
private Activity activity; |
|
||||
private Spinner spProfileFetchMode; |
|
||||
|
|
||||
@NonNull |
|
||||
@Override |
|
||||
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) { |
|
||||
final Dialog dialog = super.onCreateDialog(savedInstanceState); |
|
||||
|
|
||||
final Context context = getContext(); |
|
||||
activity = context instanceof Activity ? (Activity) context : getActivity(); |
|
||||
|
|
||||
final View contentView = View.inflate(activity, R.layout.dialog_profile_settings, null); |
|
||||
|
|
||||
spProfileFetchMode = contentView.findViewById(R.id.spProfileFetchMode); |
|
||||
|
|
||||
fetchIndex = Math.min(2, Math.max(0, settingsHelper.getInteger(PROFILE_FETCH_MODE))); |
|
||||
spProfileFetchMode.setSelection(fetchIndex); |
|
||||
spProfileFetchMode.setOnItemSelectedListener(this); |
|
||||
|
|
||||
dialog.setContentView(contentView); |
|
||||
|
|
||||
return dialog; |
|
||||
} |
|
||||
|
|
||||
@Override |
|
||||
public void onDismiss(@NonNull final DialogInterface dialog) { |
|
||||
super.onDismiss(dialog); |
|
||||
if (activity != null && (spProfileFetchMode == null || fetchIndex != spProfileFetchMode.getSelectedItemPosition())) |
|
||||
activity.recreate(); |
|
||||
} |
|
||||
|
|
||||
@Override |
|
||||
public void onItemSelected(final AdapterView<?> parent, final View view, final int position, final long id) { |
|
||||
settingsHelper.putInteger(PROFILE_FETCH_MODE, position); |
|
||||
} |
|
||||
|
|
||||
@Override |
|
||||
public void onNothingSelected(final AdapterView<?> parent) { } |
|
||||
} |
|
@ -0,0 +1,58 @@ |
|||||
|
package awais.instagrabber.models; |
||||
|
|
||||
|
import androidx.annotation.NonNull; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
|
||||
|
import awais.instagrabber.utils.Utils; |
||||
|
import awais.instagrabber.models.enums.NotificationType; |
||||
|
|
||||
|
public final class NotificationModel { |
||||
|
private final String id, username, profilePicUrl, shortcode, previewUrl; |
||||
|
private final NotificationType type; |
||||
|
private final CharSequence text; |
||||
|
private final long timestamp; |
||||
|
|
||||
|
public NotificationModel(final String id, final String text, final long timestamp, final String username, |
||||
|
final String profilePicUrl, final String shortcode, final String previewUrl, final NotificationType type) { |
||||
|
this.id = id; |
||||
|
this.text = Utils.hasMentions(text) ? Utils.getMentionText(text) : text; |
||||
|
this.timestamp = timestamp; |
||||
|
this.username = username; |
||||
|
this.profilePicUrl = profilePicUrl; |
||||
|
this.shortcode = shortcode; |
||||
|
this.previewUrl = previewUrl; |
||||
|
this.type = type; |
||||
|
} |
||||
|
|
||||
|
public String getId() { |
||||
|
return id; |
||||
|
} |
||||
|
|
||||
|
public CharSequence getText() { |
||||
|
return text; |
||||
|
} |
||||
|
|
||||
|
@NonNull |
||||
|
public String getDateTime() { |
||||
|
return Utils.datetimeParser.format(new Date(timestamp * 1000L)); |
||||
|
} |
||||
|
|
||||
|
public String getUsername() { |
||||
|
return username; |
||||
|
} |
||||
|
|
||||
|
public String getProfilePic() { |
||||
|
return profilePicUrl; |
||||
|
} |
||||
|
|
||||
|
public String getShortcode() { |
||||
|
return shortcode; |
||||
|
} |
||||
|
|
||||
|
public String getPreviewPic() { |
||||
|
return previewUrl; |
||||
|
} |
||||
|
|
||||
|
public NotificationType getType() { return type; } |
||||
|
} |
@ -0,0 +1,10 @@ |
|||||
|
package awais.instagrabber.models.enums; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
public enum NotificationType implements Serializable { |
||||
|
LIKE, |
||||
|
FOLLOW, |
||||
|
COMMENT, |
||||
|
MENTION |
||||
|
} |
@ -1,7 +0,0 @@ |
|||||
package awais.instagrabber.models.enums; |
|
||||
|
|
||||
public enum ProfilePictureFetchMode { |
|
||||
INSTADP, |
|
||||
INSTAFULLSIZE, |
|
||||
INSTA_STALKER, |
|
||||
} |
|
@ -0,0 +1,11 @@ |
|||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android" |
||||
|
android:width="24dp" |
||||
|
android:height="24dp" |
||||
|
android:viewportWidth="24" |
||||
|
android:viewportHeight="24" |
||||
|
android:tint="#333333" |
||||
|
android:alpha="0.6"> |
||||
|
<path |
||||
|
android:fillColor="@android:color/white" |
||||
|
android:pathData="M12,22c1.1,0 2,-0.9 2,-2h-4c0,1.1 0.89,2 2,2zM18,16v-5c0,-3.07 -1.64,-5.64 -4.5,-6.32L13.5,4c0,-0.83 -0.67,-1.5 -1.5,-1.5s-1.5,0.67 -1.5,1.5v0.68C7.63,5.36 6,7.92 6,11v5l-2,2v1h16v-1l-2,-2z"/> |
||||
|
</vector> |
After Width: 36 | Height: 36 | Size: 269 B |
After Width: 24 | Height: 24 | Size: 193 B |
After Width: 48 | Height: 48 | Size: 321 B |
After Width: 72 | Height: 72 | Size: 433 B |
@ -0,0 +1,30 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<LinearLayout 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" |
||||
|
android:orientation="vertical" |
||||
|
tools:context=".activities.NotificationsViewer"> |
||||
|
|
||||
|
<include |
||||
|
android:id="@+id/toolbar" |
||||
|
layout="@layout/layout_include_toolbar" /> |
||||
|
|
||||
|
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout |
||||
|
android:id="@+id/swipeRefreshLayout" |
||||
|
android:layout_width="match_parent" |
||||
|
android:layout_height="match_parent"> |
||||
|
<androidx.recyclerview.widget.RecyclerView |
||||
|
android:id="@+id/rvComments" |
||||
|
android:layout_width="match_parent" |
||||
|
android:layout_height="match_parent" |
||||
|
android:clipToPadding="false" |
||||
|
android:paddingStart="8dp" |
||||
|
android:paddingLeft="8dp" |
||||
|
android:paddingEnd="8dp" |
||||
|
android:paddingRight="8dp" |
||||
|
app:layoutManager="LinearLayoutManager" |
||||
|
tools:listitem="@layout/item_notification" /> |
||||
|
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout> |
||||
|
</LinearLayout> |
@ -1,48 +0,0 @@ |
|||||
<?xml version="1.0" encoding="utf-8"?> |
|
||||
<androidx.appcompat.widget.LinearLayoutCompat xmlns:android="http://schemas.android.com/apk/res/android" |
|
||||
android:layout_width="match_parent" |
|
||||
android:layout_height="match_parent" |
|
||||
android:orientation="vertical" |
|
||||
android:paddingBottom="10dp"> |
|
||||
|
|
||||
<androidx.appcompat.widget.AppCompatTextView |
|
||||
style="@style/TextAppearance.AppCompat.Headline" |
|
||||
android:layout_width="match_parent" |
|
||||
android:layout_height="wrap_content" |
|
||||
android:ellipsize="end" |
|
||||
android:paddingStart="?attr/dialogPreferredPadding" |
|
||||
android:paddingLeft="?attr/dialogPreferredPadding" |
|
||||
android:paddingTop="10dp" |
|
||||
android:paddingEnd="?attr/dialogPreferredPadding" |
|
||||
android:paddingRight="?attr/dialogPreferredPadding" |
|
||||
android:paddingBottom="6dp" |
|
||||
android:singleLine="true" |
|
||||
android:text="@string/action_settings" /> |
|
||||
|
|
||||
<androidx.appcompat.widget.LinearLayoutCompat |
|
||||
android:layout_width="match_parent" |
|
||||
android:layout_height="wrap_content" |
|
||||
android:layout_marginStart="5dp" |
|
||||
android:layout_marginLeft="5dp" |
|
||||
android:orientation="vertical" |
|
||||
android:layout_marginBottom="24dp" |
|
||||
android:padding="5dp"> |
|
||||
|
|
||||
<androidx.appcompat.widget.AppCompatTextView |
|
||||
android:layout_width="match_parent" |
|
||||
android:layout_height="match_parent" |
|
||||
android:gravity="center_vertical" |
|
||||
android:padding="5dp" |
|
||||
android:text="@string/profile_endpoint" |
|
||||
android:textColor="?android:textColorPrimary" |
|
||||
android:textSize="16sp" /> |
|
||||
|
|
||||
<androidx.appcompat.widget.AppCompatSpinner |
|
||||
android:id="@+id/spProfileFetchMode" |
|
||||
android:layout_width="match_parent" |
|
||||
android:layout_height="wrap_content" |
|
||||
android:entries="@array/profile_fetch_modes" |
|
||||
android:paddingTop="4dp" |
|
||||
android:paddingBottom="4dp" /> |
|
||||
</androidx.appcompat.widget.LinearLayoutCompat> |
|
||||
</androidx.appcompat.widget.LinearLayoutCompat> |
|
@ -0,0 +1,20 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<LinearLayout 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="wrap_content" |
||||
|
android:orientation="vertical" |
||||
|
tools:viewBindingIgnore="true"> |
||||
|
|
||||
|
<include |
||||
|
android:id="@+id/container" |
||||
|
layout="@layout/layout_include_notif_item" /> |
||||
|
|
||||
|
<View |
||||
|
android:layout_width="match_parent" |
||||
|
android:layout_height="1dp" |
||||
|
android:layout_gravity="bottom" |
||||
|
android:layout_marginBottom="4dp" |
||||
|
android:background="#80888888" /> |
||||
|
</LinearLayout> |
@ -1,18 +0,0 @@ |
|||||
<?xml version="1.0" encoding="utf-8"?> |
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" |
|
||||
android:layout_width="match_parent" |
|
||||
android:layout_height="match_parent" |
|
||||
android:clipChildren="false" |
|
||||
android:clipToPadding="false"> |
|
||||
|
|
||||
<awais.instagrabber.customviews.RamboTextView |
|
||||
android:layout_width="match_parent" |
|
||||
android:layout_height="wrap_content" |
|
||||
android:paddingStart="10dp" |
|
||||
android:paddingLeft="10dp" |
|
||||
android:paddingEnd="10dp" |
|
||||
android:paddingRight="10dp" |
|
||||
android:paddingBottom="24dp" |
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Body1" |
|
||||
android:textSize="16sp" /> |
|
||||
</ScrollView> |
|
@ -0,0 +1,154 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<LinearLayout 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="wrap_content" |
||||
|
android:background="?android:selectableItemBackground" |
||||
|
android:orientation="horizontal" |
||||
|
android:paddingStart="0dp" |
||||
|
android:paddingLeft="0dp" |
||||
|
android:paddingEnd="4dp" |
||||
|
android:paddingRight="4dp"> |
||||
|
|
||||
|
<FrameLayout |
||||
|
android:layout_width="@dimen/simple_item_picture_size" |
||||
|
android:layout_height="@dimen/simple_item_picture_size" |
||||
|
android:gravity="center"> |
||||
|
|
||||
|
<androidx.appcompat.widget.AppCompatImageView |
||||
|
android:id="@+id/ivProfilePic" |
||||
|
android:layout_width="match_parent" |
||||
|
android:layout_height="match_parent" /> |
||||
|
|
||||
|
<LinearLayout |
||||
|
android:id="@+id/container" |
||||
|
android:layout_width="match_parent" |
||||
|
android:layout_height="match_parent" |
||||
|
android:orientation="horizontal"> |
||||
|
|
||||
|
<androidx.appcompat.widget.AppCompatImageView |
||||
|
android:layout_width="@dimen/simple_item_picture_size_half" |
||||
|
android:layout_height="match_parent" /> |
||||
|
|
||||
|
<LinearLayout |
||||
|
android:layout_width="@dimen/simple_item_picture_size_half" |
||||
|
android:layout_height="match_parent" |
||||
|
android:orientation="vertical"> |
||||
|
|
||||
|
<androidx.appcompat.widget.AppCompatImageView |
||||
|
android:layout_width="@dimen/simple_item_picture_size_half" |
||||
|
android:layout_height="@dimen/simple_item_picture_size_half" /> |
||||
|
|
||||
|
<androidx.appcompat.widget.AppCompatImageView |
||||
|
android:layout_width="@dimen/simple_item_picture_size_half" |
||||
|
android:layout_height="@dimen/simple_item_picture_size_half" /> |
||||
|
</LinearLayout> |
||||
|
</LinearLayout> |
||||
|
</FrameLayout> |
||||
|
|
||||
|
<LinearLayout |
||||
|
android:layout_width="0dp" |
||||
|
android:layout_weight="1" |
||||
|
android:layout_height="wrap_content" |
||||
|
android:orientation="vertical"> |
||||
|
|
||||
|
<androidx.appcompat.widget.AppCompatTextView |
||||
|
android:id="@+id/tvUsername" |
||||
|
android:layout_width="match_parent" |
||||
|
android:layout_height="wrap_content" |
||||
|
android:layout_gravity="start" |
||||
|
android:layout_weight="1.0" |
||||
|
android:ellipsize="marquee" |
||||
|
android:paddingStart="8dp" |
||||
|
android:paddingLeft="8dp" |
||||
|
android:paddingTop="4dp" |
||||
|
android:paddingEnd="4dp" |
||||
|
android:paddingRight="4dp" |
||||
|
android:singleLine="true" |
||||
|
android:textAppearance="@style/TextAppearance.AppCompat.Medium" |
||||
|
android:textColor="?android:textColorPrimary" |
||||
|
android:textStyle="bold" /> |
||||
|
|
||||
|
<LinearLayout |
||||
|
android:layout_width="match_parent" |
||||
|
android:layout_height="wrap_content" |
||||
|
android:orientation="vertical" |
||||
|
android:paddingLeft="8dp" |
||||
|
android:paddingTop="4dp" |
||||
|
android:paddingRight="8dp"> |
||||
|
|
||||
|
<awais.instagrabber.customviews.RamboTextView |
||||
|
android:id="@+id/tvComment" |
||||
|
android:layout_width="match_parent" |
||||
|
android:layout_height="wrap_content" |
||||
|
android:layout_gravity="start" |
||||
|
android:ellipsize="end" |
||||
|
android:linksClickable="true" |
||||
|
android:textStyle="italic" |
||||
|
android:textAppearance="@style/TextAppearance.AppCompat" /> |
||||
|
|
||||
|
<awais.instagrabber.customviews.RamboTextView |
||||
|
android:id="@+id/tvSubComment" |
||||
|
android:layout_width="match_parent" |
||||
|
android:layout_height="wrap_content" |
||||
|
android:layout_gravity="start" |
||||
|
android:autoLink="web|email" |
||||
|
android:ellipsize="end" |
||||
|
android:linksClickable="true" |
||||
|
android:textAppearance="@style/TextAppearance.AppCompat" /> |
||||
|
</LinearLayout> |
||||
|
|
||||
|
<androidx.appcompat.widget.AppCompatTextView |
||||
|
android:id="@+id/tvDate" |
||||
|
android:layout_width="match_parent" |
||||
|
android:layout_height="wrap_content" |
||||
|
android:layout_gravity="start" |
||||
|
android:ellipsize="marquee" |
||||
|
android:gravity="right" |
||||
|
android:paddingStart="4dp" |
||||
|
android:paddingLeft="4dp" |
||||
|
android:paddingTop="4dp" |
||||
|
android:paddingEnd="8dp" |
||||
|
android:paddingRight="8dp" |
||||
|
android:singleLine="true" |
||||
|
android:textStyle="italic" /> |
||||
|
|
||||
|
</LinearLayout> |
||||
|
|
||||
|
<FrameLayout |
||||
|
android:layout_width="@dimen/simple_item_picture_size" |
||||
|
android:layout_height="@dimen/simple_item_picture_size" |
||||
|
android:gravity="center"> |
||||
|
|
||||
|
<androidx.appcompat.widget.AppCompatImageView |
||||
|
android:id="@+id/ivPreviewPic" |
||||
|
android:layout_width="match_parent" |
||||
|
android:layout_height="match_parent" /> |
||||
|
|
||||
|
<LinearLayout |
||||
|
android:id="@+id/rightContainer" |
||||
|
android:layout_width="match_parent" |
||||
|
android:layout_height="match_parent" |
||||
|
android:orientation="horizontal"> |
||||
|
|
||||
|
<androidx.appcompat.widget.AppCompatImageView |
||||
|
android:layout_width="@dimen/simple_item_picture_size_half" |
||||
|
android:layout_height="match_parent" /> |
||||
|
|
||||
|
<LinearLayout |
||||
|
android:layout_width="@dimen/simple_item_picture_size_half" |
||||
|
android:layout_height="match_parent" |
||||
|
android:orientation="vertical"> |
||||
|
|
||||
|
<androidx.appcompat.widget.AppCompatImageView |
||||
|
android:layout_width="@dimen/simple_item_picture_size_half" |
||||
|
android:layout_height="@dimen/simple_item_picture_size_half" /> |
||||
|
|
||||
|
<androidx.appcompat.widget.AppCompatImageView |
||||
|
android:layout_width="@dimen/simple_item_picture_size_half" |
||||
|
android:layout_height="@dimen/simple_item_picture_size_half" /> |
||||
|
</LinearLayout> |
||||
|
</LinearLayout> |
||||
|
</FrameLayout> |
||||
|
</LinearLayout> |
@ -4,6 +4,7 @@ |
|||||
<string name="description">The original maintainer, AWAiS, made InstaGrabber as a small and basic little personal app with intentions of [steali-]downloading posts off Instagram. Very unfortunately, this was abandoned and me, Austin Huang, took over the ship. [Let\'s hope that\'s at least a lil\' bit cash money.] After all, this app is fully open source, ad-less, and tracking-less [aside from what Instagram knows]. Even if you don\'t care about downloading stuff [like me], it\'s still a great Instagram client to use!\n\nGot questions [or just wanna talk]? Contact [email protected] or click one of the buttons below.</string> |
<string name="description">The original maintainer, AWAiS, made InstaGrabber as a small and basic little personal app with intentions of [steali-]downloading posts off Instagram. Very unfortunately, this was abandoned and me, Austin Huang, took over the ship. [Let\'s hope that\'s at least a lil\' bit cash money.] After all, this app is fully open source, ad-less, and tracking-less [aside from what Instagram knows]. Even if you don\'t care about downloading stuff [like me], it\'s still a great Instagram client to use!\n\nGot questions [or just wanna talk]? Contact [email protected] or click one of the buttons below.</string> |
||||
<string name="action_quickaccess">Quick Access</string> |
<string name="action_quickaccess">Quick Access</string> |
||||
<string name="action_about">About</string> |
<string name="action_about">About</string> |
||||
|
<string name="action_notif">Notifications</string> |
||||
<string name="action_dms">Direct Messages</string> |
<string name="action_dms">Direct Messages</string> |
||||
<string name="action_setting">Settings (v%s)</string> |
<string name="action_setting">Settings (v%s)</string> |
||||
<string name="action_settings">Settings</string> |
<string name="action_settings">Settings</string> |
||||
@ -29,6 +30,7 @@ |
|||||
<string name="title_favorites">Favorites</string> |
<string name="title_favorites">Favorites</string> |
||||
<string name="title_discover">Discover</string> |
<string name="title_discover">Discover</string> |
||||
<string name="title_comments">Comments</string> |
<string name="title_comments">Comments</string> |
||||
|
<string name="title_notifications">Notifications</string> |
||||
<string name="title_highlight">Highlight: %s</string> |
<string name="title_highlight">Highlight: %s</string> |
||||
<string name="title_user_story">User Story</string> |
<string name="title_user_story">User Story</string> |
||||
<string name="title_changelog">Changelog</string> |
<string name="title_changelog">Changelog</string> |
||||
@ -60,6 +62,7 @@ |
|||||
<string name="show_stories">Show stories</string> |
<string name="show_stories">Show stories</string> |
||||
<string name="no_more_stories">No more stories!</string> |
<string name="no_more_stories">No more stories!</string> |
||||
<string name="view_story_post">View Story Post</string> |
<string name="view_story_post">View Story Post</string> |
||||
|
<string name="view_post">View Post</string> |
||||
<string name="spotify">Spotify</string> |
<string name="spotify">Spotify</string> |
||||
<string name="vote_story_poll">Vote</string> |
<string name="vote_story_poll">Vote</string> |
||||
<string name="votef_story_poll">Vote successful!</string> |
<string name="votef_story_poll">Vote successful!</string> |
||||
@ -180,6 +183,11 @@ |
|||||
|
|
||||
<string name="comment_hint">Write a new comment...</string> |
<string name="comment_hint">Write a new comment...</string> |
||||
|
|
||||
|
<string name="liked_notif">Liked your post</string> |
||||
|
<string name="comment_notif">Commented on your post:</string> |
||||
|
<string name="follow_notif">Started following you</string> |
||||
|
<string name="mention_notif">Mentioned you:</string> |
||||
|
|
||||
<string name="share_public_post">Share this public post to...</string> |
<string name="share_public_post">Share this public post to...</string> |
||||
<string name="share_private_post">This is a private post! Share to those who can view them!</string> |
<string name="share_private_post">This is a private post! Share to those who can view them!</string> |
||||
|
|
||||
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue