Browse Source

Fix DM fragments, comment out deprecated activities

renovate/org.robolectric-robolectric-4.x
Ammar Githam 4 years ago
parent
commit
cc9348d8c5
  1. 12
      app/src/main/java/awais/instagrabber/InstaGrabberApplication.java
  2. 3042
      app/src/main/java/awais/instagrabber/MainHelper.java
  3. 188
      app/src/main/java/awais/instagrabber/activities/DirectMessagesActivity.java
  4. 3
      app/src/main/java/awais/instagrabber/activities/MainActivity.java
  5. 1214
      app/src/main/java/awais/instagrabber/activities/MainActivityBackup.java
  6. 9
      app/src/main/java/awais/instagrabber/activities/NotificationsViewer.java
  7. 1572
      app/src/main/java/awais/instagrabber/activities/PostViewer.java
  8. 1900
      app/src/main/java/awais/instagrabber/activities/ProfileViewer.java
  9. 26
      app/src/main/java/awais/instagrabber/adapters/viewholder/DirectMessageInboxItemViewHolder.java
  10. 18
      app/src/main/java/awais/instagrabber/dialogs/QuickAccessDialog.java
  11. 5
      app/src/main/java/awais/instagrabber/fragments/HashTagFragment.java
  12. 6
      app/src/main/java/awais/instagrabber/fragments/LocationFragment.java
  13. 2
      app/src/main/java/awais/instagrabber/fragments/StoryViewerFragment.java
  14. 104
      app/src/main/java/awais/instagrabber/fragments/directmessages/DirectMessageSettingsFragment.java
  15. 119
      app/src/main/java/awais/instagrabber/fragments/directmessages/DirectMessageThreadFragment.java
  16. 4
      app/src/main/java/awais/instagrabber/fragments/main/DiscoverFragment.java
  17. 31
      app/src/main/java/awais/instagrabber/fragments/main/ProfileFragment.java
  18. 140
      app/src/main/res/layout/layout_dm_inbox_item.xml
  19. 14
      app/src/main/res/menu/dm_thread_menu.xml
  20. 15
      app/src/main/res/menu/main_menu.xml
  21. 12
      app/src/main/res/menu/profile_menu.xml
  22. 2
      app/src/main/res/values/strings.xml

12
app/src/main/java/awais/instagrabber/InstaGrabberApplication.java

@ -8,6 +8,7 @@ import androidx.core.app.NotificationManagerCompat;
import androidx.multidex.MultiDexApplication;
import com.facebook.drawee.backends.pipeline.Fresco;
import com.facebook.imagepipeline.core.ImagePipelineConfig;
import java.net.CookieHandler;
import java.text.SimpleDateFormat;
@ -36,7 +37,12 @@ public final class InstaGrabberApplication extends MultiDexApplication {
@Override
public void onCreate() {
super.onCreate();
Fresco.initialize(this);
final ImagePipelineConfig imagePipelineConfig = ImagePipelineConfig
.newBuilder(this)
// .setMainDiskCacheConfig(diskCacheConfig)
.setDownsampleEnabled(true)
.build();
Fresco.initialize(this, imagePipelineConfig);
if (BuildConfig.DEBUG) {
try {
@ -74,8 +80,8 @@ public final class InstaGrabberApplication extends MultiDexApplication {
if (datetimeParser == null)
datetimeParser = new SimpleDateFormat(
settingsHelper.getBoolean(Constants.CUSTOM_DATE_TIME_FORMAT_ENABLED) ?
settingsHelper.getString(Constants.CUSTOM_DATE_TIME_FORMAT) :
settingsHelper.getString(Constants.DATE_TIME_FORMAT), LocaleUtils.getCurrentLocale());
settingsHelper.getString(Constants.CUSTOM_DATE_TIME_FORMAT) :
settingsHelper.getString(Constants.DATE_TIME_FORMAT), LocaleUtils.getCurrentLocale());
settingsHelper.putString(Constants.DEVICE_UUID, UUID.randomUUID().toString());
}

3042
app/src/main/java/awais/instagrabber/MainHelper.java
File diff suppressed because it is too large
View File

188
app/src/main/java/awais/instagrabber/activities/DirectMessagesActivity.java

@ -1,94 +1,94 @@
package awais.instagrabber.activities;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.AppCompatImageView;
import androidx.appcompat.widget.Toolbar;
import androidx.coordinatorlayout.widget.CoordinatorLayout;
import androidx.navigation.NavController;
import androidx.navigation.NavDestination;
import androidx.navigation.Navigation;
import androidx.navigation.ui.AppBarConfiguration;
import androidx.navigation.ui.NavigationUI;
import awais.instagrabber.R;
import awais.instagrabber.databinding.ActivityDirectMessagesBinding;
import awais.instagrabber.fragments.directmessages.DirectMessageThreadFragmentArgs;
import awais.instagrabber.utils.Constants;
import static awais.instagrabber.utils.Utils.settingsHelper;
@Deprecated
public class DirectMessagesActivity extends BaseLanguageActivity implements NavController.OnDestinationChangedListener {
private TextView toolbarTitle;
private AppCompatImageView dmInfo, dmSeen;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
final ActivityDirectMessagesBinding binding = ActivityDirectMessagesBinding.inflate(getLayoutInflater());
final CoordinatorLayout root = binding.getRoot();
setContentView(root);
toolbarTitle = binding.toolbarTitle;
final Toolbar toolbar = binding.toolbar;
setSupportActionBar(toolbar);
dmInfo = binding.dmInfo;
dmSeen = binding.dmSeen;
final NavController navController = Navigation.findNavController(this, R.id.direct_messages_nav_host_fragment);
navController.addOnDestinationChangedListener(this);
final AppBarConfiguration appBarConfiguration = new AppBarConfiguration.Builder(navController.getGraph()).build();
NavigationUI.setupWithNavController(toolbar, navController, appBarConfiguration);
}
@Override
public void onDestinationChanged(@NonNull final NavController controller,
@NonNull final NavDestination destination,
@Nullable final Bundle arguments) {
switch (destination.getId()) {
case R.id.directMessagesInboxFragment:
setToolbarTitle(R.string.action_dms);
dmInfo.setVisibility(View.GONE);
dmSeen.setVisibility(View.GONE);
return;
case R.id.directMessagesThreadFragment:
if (arguments == null) {
return;
}
final String title = DirectMessageThreadFragmentArgs.fromBundle(arguments).getTitle();
setToolbarTitle(title);
dmInfo.setVisibility(View.VISIBLE);
dmSeen.setVisibility(settingsHelper.getBoolean(Constants.DM_MARK_AS_SEEN) ? View.GONE : View.VISIBLE);
return;
case R.id.directMessagesSettingsFragment:
if (arguments == null) {
return;
}
setToolbarTitle(R.string.action_settings);
dmInfo.setVisibility(View.GONE);
dmSeen.setVisibility(View.GONE);
return;
}
}
private void setToolbarTitle(final String text) {
if (toolbarTitle == null) {
return;
}
toolbarTitle.setText(text);
}
private void setToolbarTitle(final int resourceId) {
if (toolbarTitle == null) {
return;
}
toolbarTitle.setText(resourceId);
}
}
// package awais.instagrabber.activities;
//
// import android.os.Bundle;
// import android.view.View;
// import android.widget.TextView;
//
// import androidx.annotation.NonNull;
// import androidx.annotation.Nullable;
// import androidx.appcompat.widget.AppCompatImageView;
// import androidx.appcompat.widget.Toolbar;
// import androidx.coordinatorlayout.widget.CoordinatorLayout;
// import androidx.navigation.NavController;
// import androidx.navigation.NavDestination;
// import androidx.navigation.Navigation;
// import androidx.navigation.ui.AppBarConfiguration;
// import androidx.navigation.ui.NavigationUI;
//
// import awais.instagrabber.R;
// import awais.instagrabber.databinding.ActivityDirectMessagesBinding;
// import awais.instagrabber.fragments.directmessages.DirectMessageThreadFragmentArgs;
// import awais.instagrabber.utils.Constants;
// import static awais.instagrabber.utils.Utils.settingsHelper;
//
// @Deprecated
// public class DirectMessagesActivity extends BaseLanguageActivity implements NavController.OnDestinationChangedListener {
//
// private TextView toolbarTitle;
// private AppCompatImageView dmInfo, dmSeen;
//
// @Override
// protected void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// final ActivityDirectMessagesBinding binding = ActivityDirectMessagesBinding.inflate(getLayoutInflater());
// final CoordinatorLayout root = binding.getRoot();
// setContentView(root);
//
// toolbarTitle = binding.toolbarTitle;
//
// final Toolbar toolbar = binding.toolbar;
// setSupportActionBar(toolbar);
//
// dmInfo = binding.dmInfo;
// dmSeen = binding.dmSeen;
//
// final NavController navController = Navigation.findNavController(this, R.id.direct_messages_nav_host_fragment);
// navController.addOnDestinationChangedListener(this);
// final AppBarConfiguration appBarConfiguration = new AppBarConfiguration.Builder(navController.getGraph()).build();
// NavigationUI.setupWithNavController(toolbar, navController, appBarConfiguration);
// }
//
// @Override
// public void onDestinationChanged(@NonNull final NavController controller,
// @NonNull final NavDestination destination,
// @Nullable final Bundle arguments) {
// switch (destination.getId()) {
// case R.id.directMessagesInboxFragment:
// setToolbarTitle(R.string.action_dms);
// dmInfo.setVisibility(View.GONE);
// dmSeen.setVisibility(View.GONE);
// return;
// case R.id.directMessagesThreadFragment:
// if (arguments == null) {
// return;
// }
// final String title = DirectMessageThreadFragmentArgs.fromBundle(arguments).getTitle();
// setToolbarTitle(title);
// dmInfo.setVisibility(View.VISIBLE);
// dmSeen.setVisibility(settingsHelper.getBoolean(Constants.DM_MARK_AS_SEEN) ? View.GONE : View.VISIBLE);
// return;
// case R.id.directMessagesSettingsFragment:
// if (arguments == null) {
// return;
// }
// setToolbarTitle(R.string.action_settings);
// dmInfo.setVisibility(View.GONE);
// dmSeen.setVisibility(View.GONE);
// return;
// }
// }
//
// private void setToolbarTitle(final String text) {
// if (toolbarTitle == null) {
// return;
// }
// toolbarTitle.setText(text);
// }
//
// private void setToolbarTitle(final int resourceId) {
// if (toolbarTitle == null) {
// return;
// }
// toolbarTitle.setText(resourceId);
// }
// }

3
app/src/main/java/awais/instagrabber/activities/MainActivity.java

@ -50,7 +50,8 @@ public class MainActivity extends BaseLanguageActivity {
R.id.locationFragment,
R.id.savedViewerFragment,
R.id.commentsViewerFragment,
R.id.followViewerFragment);
R.id.followViewerFragment,
R.id.directMessagesSettingsFragment);
private static final List<Integer> REMOVE_COLLAPSING_TOOLBAR_SCROLL_DESTINATIONS = Collections.singletonList(R.id.commentsViewerFragment);
private ActivityMainBinding binding;
private LiveData<NavController> currentNavControllerLiveData;

1214
app/src/main/java/awais/instagrabber/activities/MainActivityBackup.java
File diff suppressed because it is too large
View File

9
app/src/main/java/awais/instagrabber/activities/NotificationsViewer.java

@ -76,9 +76,10 @@ public final class NotificationsViewer extends BaseLanguageActivity implements S
final DialogInterface.OnClickListener profileDialogListener = (dialog, which) -> {
if (which == 0)
searchUsername(notificationModel.getUsername());
else if (which == 1 && commentDialogList.length == 2)
startActivity(new Intent(getApplicationContext(), PostViewer.class)
.putExtra(Constants.EXTRAS_POST, new PostModel(notificationModel.getShortcode(), false)));
else if (which == 1 && commentDialogList.length == 2) {
// startActivity(new Intent(getApplicationContext(), PostViewer.class)
// .putExtra(Constants.EXTRAS_POST, new PostModel(notificationModel.getShortcode(), false)));
}
else if (which == 1) new ProfileAction().execute("/approve/");
else if (which == 2) new ProfileAction().execute("/ignore/");
};
@ -123,7 +124,7 @@ public final class NotificationsViewer extends BaseLanguageActivity implements S
private void searchUsername(final String text) {
startActivity(new Intent(getApplicationContext(), ProfileViewer.class).putExtra(Constants.EXTRAS_USERNAME, text));
// startActivity(new Intent(getApplicationContext(), ProfileViewer.class).putExtra(Constants.EXTRAS_USERNAME, text));
}
class ProfileAction extends AsyncTask<String, Void, Void> {

1572
app/src/main/java/awais/instagrabber/activities/PostViewer.java
File diff suppressed because it is too large
View File

1900
app/src/main/java/awais/instagrabber/activities/ProfileViewer.java
File diff suppressed because it is too large
View File

26
app/src/main/java/awais/instagrabber/adapters/viewholder/DirectMessageInboxItemViewHolder.java

@ -1,6 +1,7 @@
package awais.instagrabber.adapters.viewholder;
import android.content.Context;
import android.net.Uri;
import android.view.View;
import android.widget.LinearLayout;
@ -8,7 +9,11 @@ import androidx.annotation.NonNull;
import androidx.core.text.HtmlCompat;
import androidx.recyclerview.widget.RecyclerView;
import com.facebook.drawee.backends.pipeline.Fresco;
import com.facebook.drawee.view.SimpleDraweeView;
import com.facebook.imagepipeline.common.ResizeOptions;
import com.facebook.imagepipeline.request.ImageRequest;
import com.facebook.imagepipeline.request.ImageRequestBuilder;
import awais.instagrabber.R;
import awais.instagrabber.databinding.LayoutDmInboxItemBinding;
@ -50,14 +55,27 @@ public final class DirectMessageInboxItemViewHolder extends RecyclerView.ViewHol
multipleProfilePics[i].setImageURI(users[i].getSdProfilePic());
}
} else {
binding.ivProfilePic.setVisibility(View.VISIBLE);
multipleProfilePicsContainer.setVisibility(View.GONE);
binding.ivProfilePic.setImageURI(users.length == 1 ? users[0].getSdProfilePic() : null);
final String uriString = users.length == 1 ? users[0].getSdProfilePic() : null;
if (uriString == null) {
binding.ivProfilePic.setVisibility(View.GONE);
} else {
binding.ivProfilePic.setVisibility(View.VISIBLE);
multipleProfilePicsContainer.setVisibility(View.GONE);
final ImageRequest request = ImageRequestBuilder.newBuilderWithSource(Uri.parse(uriString))
.setResizeOptions(new ResizeOptions(50, 50))
.build();
binding.ivProfilePic.setController(
Fresco.newDraweeControllerBuilder()
.setOldController(binding.ivProfilePic.getController())
.setImageRequest(request)
.build()
);
}
}
binding.tvUsername.setText(model.getThreadTitle());
final DirectItemModel lastItemModel = itemModels[itemModels.length - 1];
final DirectItemType itemType = lastItemModel.getItemType();
binding.notTextType.setVisibility(itemType != DirectItemType.TEXT ? View.VISIBLE : View.GONE);
// binding.notTextType.setVisibility(itemType != DirectItemType.TEXT ? View.VISIBLE : View.GONE);
final Context context = itemView.getContext();
final CharSequence messageText;
switch (itemType) {

18
app/src/main/java/awais/instagrabber/dialogs/QuickAccessDialog.java

@ -21,8 +21,6 @@ import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
import java.util.ArrayList;
import awais.instagrabber.R;
import awais.instagrabber.activities.MainActivity;
import awais.instagrabber.activities.MainActivityBackup;
import awais.instagrabber.adapters.SimpleAdapter;
import awais.instagrabber.utils.Constants;
import awais.instagrabber.utils.DataBox;
@ -113,10 +111,10 @@ public final class QuickAccessDialog extends BottomSheetDialogFragment implement
else Utils.showImportExportDialog(v.getContext());
} else if (tag instanceof DataBox.FavoriteModel) {
if (MainActivityBackup.scanHack != null) {
MainActivityBackup.scanHack.onResult(((DataBox.FavoriteModel) tag).getQuery());
dismiss();
}
// if (MainActivityBackup.scanHack != null) {
// MainActivityBackup.scanHack.onResult(((DataBox.FavoriteModel) tag).getQuery());
// dismiss();
// }
} else if (tag instanceof DataBox.CookieModel) {
final DataBox.CookieModel cookieModel = (DataBox.CookieModel) tag;
@ -140,8 +138,8 @@ public final class QuickAccessDialog extends BottomSheetDialogFragment implement
Utils.dataBox.delFavorite(favoriteModel);
favoritesAdapter.setItems(Utils.dataBox.getAllFavorites());
})
.setNegativeButton(R.string.no, null).setMessage(getString(R.string.quick_access_confirm_delete,
favoriteModel.getQuery())).show();
.setNegativeButton(R.string.no, null).setMessage(getString(R.string.quick_access_confirm_delete,
favoriteModel.getQuery())).show();
} else if (tag instanceof DataBox.CookieModel) {
final DataBox.CookieModel cookieModel = (DataBox.CookieModel) tag;
@ -153,8 +151,8 @@ public final class QuickAccessDialog extends BottomSheetDialogFragment implement
Utils.dataBox.delUserCookie(cookieModel);
rvQuickAccess.findViewWithTag(cookieModel).setVisibility(View.GONE);
})
.setNegativeButton(R.string.no, null).setMessage(getString(R.string.quick_access_confirm_delete,
cookieModel.getUsername())).show();
.setNegativeButton(R.string.no, null).setMessage(getString(R.string.quick_access_confirm_delete,
cookieModel.getUsername())).show();
}
return true;

5
app/src/main/java/awais/instagrabber/fragments/HashTagFragment.java

@ -187,11 +187,6 @@ public class HashTagFragment extends Fragment {
return;
}
if (checkAndResetAction()) return;
// startActivity(new Intent(requireContext(), PostViewer.class)
// .putExtra(Constants.EXTRAS_INDEX, position)
// .putExtra(Constants.EXTRAS_POST, postModel)
// .putExtra(Constants.EXTRAS_USER, hashtag)
// .putExtra(Constants.EXTRAS_TYPE, PostItemType.MAIN));
final List<PostModel> postModels = postsViewModel.getList().getValue();
if (postModels == null || postModels.size() == 0) return;
if (postModels.get(0) == null) return;

6
app/src/main/java/awais/instagrabber/fragments/LocationFragment.java

@ -209,12 +209,6 @@ public class LocationFragment extends Fragment {
idsOrShortCodes,
isId);
NavHostFragment.findNavController(this).navigate(action);
// startActivity(new Intent(requireContext(), PostViewer.class)
// .putExtra(Constants.EXTRAS_INDEX, position)
// .putExtra(Constants.EXTRAS_POST, postModel)
// .putExtra(Constants.EXTRAS_USER, locationId)
// .putExtra(Constants.EXTRAS_TYPE, PostItemType.MAIN));
}, (model, position) -> {
if (!postsAdapter.isSelecting()) {
checkAndResetAction();

2
app/src/main/java/awais/instagrabber/fragments/StoryViewerFragment.java

@ -355,8 +355,6 @@ public class StoryViewerFragment extends Fragment {
idsOrShortCodes,
isId);
NavHostFragment.findNavController(this).navigate(action);
// startActivity(new Intent(requireContext(), PostViewer.class)
// .putExtra(Constants.EXTRAS_POST, new PostModel(, ));
});
final View.OnClickListener storyActionListener = v -> {
final Object tag = v.getTag();

104
app/src/main/java/awais/instagrabber/fragments/directmessages/DirectMessageSettingsFragment.java

@ -1,6 +1,6 @@
package awais.instagrabber.fragments.directmessages;
import android.content.Intent;
import android.content.DialogInterface;
import android.os.AsyncTask;
import android.os.Bundle;
import android.text.Editable;
@ -35,7 +35,6 @@ import java.util.List;
import awais.instagrabber.BuildConfig;
import awais.instagrabber.R;
import awais.instagrabber.activities.ProfileViewer;
import awais.instagrabber.adapters.DirectMessageMembersAdapter;
import awais.instagrabber.asyncs.direct_messages.DirectMessageInboxThreadFetcher;
import awais.instagrabber.databinding.FragmentDirectMessagesSettingsBinding;
@ -46,20 +45,23 @@ import awais.instagrabber.utils.Constants;
import awais.instagrabber.utils.Utils;
public class DirectMessageSettingsFragment extends Fragment implements SwipeRefreshLayout.OnRefreshListener {
private static final String TAG = "DirectMessagesSettingsFrag";
private static final String TAG = "DirectMsgsSettingsFrag";
private FragmentActivity fragmentActivity;
private RecyclerView userList, leftUserList;
private RecyclerView userList;
private RecyclerView leftUserList;
private EditText titleText;
private View leftTitle;
private AppCompatImageView titleSend;
private AppCompatButton btnLeave;
private LinearLayoutManager layoutManager, layoutManagerDos;
private LinearLayoutManager layoutManager;
private LinearLayoutManager layoutManagerDos;
private String threadId, threadTitle;
private final String cookie = Utils.settingsHelper.getString(Constants.COOKIE);
private boolean amAdmin;
private AsyncTask<Void, Void, InboxThreadModel> currentlyRunning;
private DirectMessageMembersAdapter memberAdapter, leftAdapter;
private DirectMessageMembersAdapter memberAdapter;
private DirectMessageMembersAdapter leftAdapter;
private View.OnClickListener clickListener, basicClickListener;
private final FetchListener<InboxThreadModel> fetchListener = new FetchListener<InboxThreadModel>() {
@ -69,8 +71,13 @@ public class DirectMessageSettingsFragment extends Fragment implements SwipeRefr
@Override
public void onResult(final InboxThreadModel threadModel) {
final List<Long> adminList = Arrays.asList(threadModel.getAdmins());
amAdmin = adminList.contains(Long.parseLong(Utils.getUserIdFromCookie(cookie)));
memberAdapter = new DirectMessageMembersAdapter(threadModel.getUsers(), adminList, requireContext(), amAdmin ? clickListener : basicClickListener);
final String userIdFromCookie = Utils.getUserIdFromCookie(cookie);
if (userIdFromCookie == null) return;
amAdmin = adminList.contains(Long.parseLong(userIdFromCookie));
memberAdapter = new DirectMessageMembersAdapter(threadModel.getUsers(),
adminList,
requireContext(),
amAdmin ? clickListener : basicClickListener);
userList.setAdapter(memberAdapter);
if (threadModel.getLeftUsers() != null && threadModel.getLeftUsers().length > 0) {
leftTitle.setVisibility(View.VISIBLE);
@ -84,15 +91,12 @@ public class DirectMessageSettingsFragment extends Fragment implements SwipeRefr
public void onCreate(@Nullable final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
fragmentActivity = requireActivity();
basicClickListener = v -> {
final Object tag = v.getTag();
if (tag instanceof ProfileModel) {
ProfileModel model = (ProfileModel) tag;
startActivity(
new Intent(requireContext(), ProfileViewer.class)
.putExtra(Constants.EXTRAS_USERNAME, model.getUsername())
);
// startActivity(new Intent(requireContext(), ProfileViewer.class)
// .putExtra(Constants.EXTRAS_USERNAME, model.getUsername()));
}
};
@ -101,28 +105,25 @@ public class DirectMessageSettingsFragment extends Fragment implements SwipeRefr
if (tag instanceof ProfileModel) {
ProfileModel model = (ProfileModel) tag;
if (!amAdmin || model.getId().equals(Utils.getUserIdFromCookie(cookie))) {
startActivity(
new Intent(requireContext(), ProfileViewer.class)
.putExtra(Constants.EXTRAS_USERNAME, model.getUsername())
);
}
else {
new AlertDialog.Builder(requireContext()).setAdapter(
new ArrayAdapter<>(requireContext(), android.R.layout.simple_list_item_1, new String[]{
getString(R.string.open_profile),
getString(R.string.dms_action_kick),
}),
(d,w) -> {
if (w == 0)
startActivity(
new Intent(requireContext(), ProfileViewer.class)
.putExtra(Constants.EXTRAS_USERNAME, model.getUsername())
);
else if (w == 1) {
new ChangeSettings().execute("remove_users", model.getId());
onRefresh();
}
}).show();
// startActivity(new Intent(requireContext(), ProfileViewer.class)
// .putExtra(Constants.EXTRAS_USERNAME, model.getUsername()));
} else {
final ArrayAdapter<String> adapter = new ArrayAdapter<>(requireContext(), android.R.layout.simple_list_item_1, new String[]{
getString(R.string.open_profile),
getString(R.string.dms_action_kick),
});
final DialogInterface.OnClickListener clickListener = (d, w) -> {
if (w == 0) {
// startActivity(new Intent(requireContext(), ProfileViewer.class)
// .putExtra(Constants.EXTRAS_USERNAME, model.getUsername()));
} else if (w == 1) {
new ChangeSettings().execute("remove_users", model.getId());
onRefresh();
}
};
new AlertDialog.Builder(requireContext())
.setAdapter(adapter, clickListener)
.show();
}
}
};
@ -146,7 +147,9 @@ public class DirectMessageSettingsFragment extends Fragment implements SwipeRefr
return false;
}
};
if (getArguments() == null) {
return null;
}
threadId = DirectMessageSettingsFragmentArgs.fromBundle(getArguments()).getThreadId();
threadTitle = DirectMessageSettingsFragmentArgs.fromBundle(getArguments()).getTitle();
binding.swipeRefreshLayout.setEnabled(false);
@ -185,11 +188,9 @@ public class DirectMessageSettingsFragment extends Fragment implements SwipeRefr
btnLeave = binding.btnLeave;
btnLeave.setOnClickListener(v -> {
new AlertDialog.Builder(requireContext()).setTitle(R.string.dms_action_leave_question)
.setPositiveButton(R.string.yes, (x,y) -> {
new ChangeSettings().execute("leave");
})
.setNegativeButton(R.string.no, null)
.show();
.setPositiveButton(R.string.yes, (x, y) -> new ChangeSettings().execute("leave"))
.setNegativeButton(R.string.no, null)
.show();
});
currentlyRunning = new DirectMessageInboxThreadFetcher(threadId, null, null, fetchListener).execute();
@ -207,7 +208,9 @@ public class DirectMessageSettingsFragment extends Fragment implements SwipeRefr
try {
currentlyRunning.cancel(true);
} catch (final Exception e) {
if (BuildConfig.DEBUG) Log.e(TAG, "", e);
if (BuildConfig.DEBUG) {
Log.e(TAG, "", e);
}
}
}
}
@ -219,14 +222,14 @@ public class DirectMessageSettingsFragment extends Fragment implements SwipeRefr
protected Void doInBackground(String... rawAction) {
action = rawAction[0];
if (rawAction.length == 2) argument = rawAction[1];
final String url = "https://i.instagram.com/api/v1/direct_v2/threads/"+threadId+"/"+action+"/";
final String url = "https://i.instagram.com/api/v1/direct_v2/threads/" + threadId + "/" + action + "/";
try {
String urlParameters = "_csrftoken=" + cookie.split("csrftoken=")[1].split(";")[0]
+"&_uuid=" + Utils.settingsHelper.getString(Constants.DEVICE_UUID);
+ "&_uuid=" + Utils.settingsHelper.getString(Constants.DEVICE_UUID);
if (action.equals("update_title"))
urlParameters += "&title=" + URLEncoder.encode(titleText.getText().toString(), "UTF-8")
.replaceAll("\\+", "%20").replaceAll("%21", "!").replaceAll("%27", "'")
.replaceAll("%28", "(").replaceAll("%29", ")").replaceAll("%7E", "~");
.replaceAll("\\+", "%20").replaceAll("%21", "!").replaceAll("%27", "'")
.replaceAll("%28", "(").replaceAll("%29", ")").replaceAll("%7E", "~");
else if (action.startsWith("remove_users"))
urlParameters += ("&user_ids=[" + argument + "]");
final HttpURLConnection urlConnection = (HttpURLConnection) new URL(url).openConnection();
@ -260,16 +263,13 @@ public class DirectMessageSettingsFragment extends Fragment implements SwipeRefr
titleSend.setVisibility(View.GONE);
titleText.clearFocus();
DirectMessageThreadFragment.hasSentSomething = true;
}
else if (action.equals("leave")) {
} else if (action.equals("leave")) {
DirectMessageInboxFragment.refreshPlease = true;
NavHostFragment.findNavController(DirectMessageSettingsFragment.this).popBackStack(R.id.directMessagesInboxFragment, false);
}
else {
} else {
DirectMessageThreadFragment.hasSentSomething = true;
}
}
else Toast.makeText(requireContext(), R.string.downloader_unknown_error, Toast.LENGTH_SHORT).show();
} else Toast.makeText(requireContext(), R.string.downloader_unknown_error, Toast.LENGTH_SHORT).show();
}
}
}

119
app/src/main/java/awais/instagrabber/fragments/directmessages/DirectMessageThreadFragment.java

@ -12,6 +12,7 @@ import android.os.Handler;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
@ -25,7 +26,6 @@ import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentContainerView;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;
import androidx.lifecycle.ViewModelProvider;
@ -50,7 +50,6 @@ import java.util.LinkedList;
import java.util.List;
import awais.instagrabber.R;
import awais.instagrabber.activities.PostViewer;
import awais.instagrabber.adapters.DirectMessageItemsAdapter;
import awais.instagrabber.asyncs.ImageUploader;
import awais.instagrabber.asyncs.direct_messages.DirectMessageInboxThreadFetcher;
@ -60,7 +59,6 @@ import awais.instagrabber.databinding.FragmentDirectMessagesThreadBinding;
import awais.instagrabber.interfaces.FetchListener;
import awais.instagrabber.interfaces.MentionClickListener;
import awais.instagrabber.models.ImageUploadOptions;
import awais.instagrabber.models.PostModel;
import awais.instagrabber.models.ProfileModel;
import awais.instagrabber.models.direct_messages.DirectItemModel;
import awais.instagrabber.models.direct_messages.InboxThreadModel;
@ -76,14 +74,16 @@ public class DirectMessageThreadFragment extends Fragment {
private static final int PICK_IMAGE = 100;
private AppCompatActivity fragmentActivity;
private String threadId, threadTitle, cursor, lastMessage;
private String threadId;
private String threadTitle;
private String cursor;
private String lastMessage;
private final String cookie = Utils.settingsHelper.getString(Constants.COOKIE);
private final String myId = Utils.getUserIdFromCookie(cookie);
private FragmentDirectMessagesThreadBinding binding;
private DirectItemModelListViewModel listViewModel;
private DirectItemModel directItemModel;
private RecyclerView messageList;
// private AppCompatImageView dmInfo, dmSeen;
private boolean hasDeletedSomething;
private boolean hasOlder = true;
public static boolean hasSentSomething;
@ -158,6 +158,8 @@ public class DirectMessageThreadFragment extends Fragment {
binding.swipeRefreshLayout.setRefreshing(false);
}
};
private LinearLayout root;
private boolean shouldRefresh = true;
@Override
public void onCreate(@Nullable final Bundle savedInstanceState) {
@ -166,27 +168,29 @@ public class DirectMessageThreadFragment extends Fragment {
setHasOptionsMenu(true);
}
@Override
public void onResume() {
super.onResume();
if (hasSentSomething) {
new DirectMessageInboxThreadFetcher(threadId, UserInboxDirection.OLDER, null, fetchListener).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
}
@Override
public View onCreateView(@NonNull final LayoutInflater inflater,
final ViewGroup container,
final Bundle savedInstanceState) {
binding = FragmentDirectMessagesThreadBinding.inflate(inflater, container, false);
final FragmentContainerView containerTwo = (FragmentContainerView) container.getParent();
// dmInfo = containerTwo.findViewById(R.id.dmInfo);
// dmSeen = containerTwo.findViewById(R.id.dmSeen);
final LinearLayout root = binding.getRoot();
listViewModel = new ViewModelProvider(fragmentActivity).get(DirectItemModelListViewModel.class);
if (getArguments() == null) {
if (root != null) {
shouldRefresh = false;
return root;
}
binding = FragmentDirectMessagesThreadBinding.inflate(inflater, container, false);
root = binding.getRoot();
return root;
}
@Override
public void onViewCreated(@NonNull final View view, @Nullable final Bundle savedInstanceState) {
if (!shouldRefresh) return;
init();
shouldRefresh = false;
}
private void init() {
listViewModel = new ViewModelProvider(fragmentActivity).get(DirectItemModelListViewModel.class);
if (getArguments() == null) return;
if (!DirectMessageThreadFragmentArgs.fromBundle(getArguments()).getThreadId().equals(threadId)) {
listViewModel.empty();
threadId = DirectMessageThreadFragmentArgs.fromBundle(getArguments()).getThreadId();
@ -203,25 +207,14 @@ public class DirectMessageThreadFragment extends Fragment {
binding.image.setOnClickListener(clickListener);
final LinearLayoutManager layoutManager = new LinearLayoutManager(requireContext());
layoutManager.setReverseLayout(true);
// layoutManager.setStackFromEnd(true);
messageList.setLayoutManager(layoutManager);
messageList.addOnScrollListener(new RecyclerLazyLoader(layoutManager, (page, totalItemsCount) -> {
if (Utils.isEmpty(cursor) || !hasOlder) {
return;
}
new DirectMessageInboxThreadFetcher(threadId, UserInboxDirection.OLDER, cursor, fetchListener).execute(); // serial because we don't want messages to be randomly ordered
new DirectMessageInboxThreadFetcher(threadId, UserInboxDirection.OLDER, cursor, fetchListener)
.execute(); // serial because we don't want messages to be randomly ordered
}));
// dmInfo.setOnClickListener(v -> {
// final NavDirections action =
// DirectMessageThreadFragmentDirections.actionDMThreadFragmentToDMSettingsFragment(threadId, threadTitle);
// NavHostFragment.findNavController(DirectMessageThreadFragment.this).navigate(action);
// });
// dmSeen.setOnClickListener(v -> {
// new ThreadAction().execute("seen", lastMessage);
// dmSeen.setVisibility(View.GONE);
// });
final DialogInterface.OnClickListener onDialogListener = (dialogInterface, which) -> {
if (which == 0) {
final DirectItemType itemType = directItemModel.getItemType();
@ -248,11 +241,12 @@ public class DirectMessageThreadFragment extends Fragment {
final ProfileModel user = getUser(directItemModel.getUserId());
final DirectItemModel.DirectItemMediaModel selectedItem =
itemType == DirectItemType.MEDIA ? directItemModel.getMediaModel() : directItemModel.getRavenMediaModel().getMedia();
final String url = selectedItem.getMediaType() == MediaItemType.MEDIA_TYPE_VIDEO ? selectedItem.getVideoUrl() : selectedItem.getThumbUrl();
final String url = selectedItem.getMediaType() == MediaItemType.MEDIA_TYPE_VIDEO
? selectedItem.getVideoUrl()
: selectedItem.getThumbUrl();
if (url == null) {
Toast.makeText(requireContext(), R.string.downloader_unknown_error, Toast.LENGTH_SHORT).show();
}
else {
} else {
Utils.dmDownload(requireContext(), user.getUsername(), DownloadMethod.DOWNLOAD_DIRECT, selectedItem);
Toast.makeText(requireContext(), R.string.downloader_downloading_media, Toast.LENGTH_SHORT).show();
}
@ -283,7 +277,7 @@ public class DirectMessageThreadFragment extends Fragment {
searchUsername(directItemModel.getText().toString().split("@")[1].split(" ")[0]);
break;
default:
Log.d("austin_debug", "unsupported type " + itemType);
Log.d(TAG, "unsupported type " + itemType);
}
} else if (which == 1) {
sendText(null, directItemModel.getItemId(), directItemModel.isLiked());
@ -350,9 +344,22 @@ public class DirectMessageThreadFragment extends Fragment {
messageList.setAdapter(adapter);
listViewModel.getList().observe(fragmentActivity, adapter::submitList);
if (listViewModel.isEmpty()) {
new DirectMessageInboxThreadFetcher(threadId, UserInboxDirection.OLDER, null, fetchListener).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
new DirectMessageInboxThreadFetcher(threadId, UserInboxDirection.OLDER, null, fetchListener)
.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
}
@Override
public void onResume() {
super.onResume();
if (hasSentSomething) {
new DirectMessageInboxThreadFetcher(threadId, UserInboxDirection.OLDER, null, fetchListener)
.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
final ActionBar actionBar = fragmentActivity.getSupportActionBar();
if (actionBar != null) {
actionBar.setTitle(threadTitle);
}
return root;
}
@Override
@ -361,6 +368,27 @@ public class DirectMessageThreadFragment extends Fragment {
item.setVisible(false);
}
@Override
public void onCreateOptionsMenu(@NonNull final Menu menu, @NonNull final MenuInflater inflater) {
inflater.inflate(R.menu.dm_thread_menu, menu);
}
@Override
public boolean onOptionsItemSelected(@NonNull final MenuItem item) {
final int itemId = item.getItemId();
switch (itemId) {
case R.id.info:
final NavDirections action = DirectMessageThreadFragmentDirections.actionDMThreadFragmentToDMSettingsFragment(threadId, threadTitle);
NavHostFragment.findNavController(this).navigate(action);
return true;
case R.id.mark_as_seen:
new ThreadAction().execute("seen", lastMessage);
item.setVisible(false);
return true;
}
return super.onOptionsItemSelected(item);
}
@Override
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
@ -409,7 +437,8 @@ public class DirectMessageThreadFragment extends Fragment {
}
DirectMessageInboxFragment.refreshPlease = true;
hasSentSomething = true;
new DirectMessageInboxThreadFetcher(threadId, UserInboxDirection.OLDER, null, fetchListener).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
new DirectMessageInboxThreadFetcher(threadId, UserInboxDirection.OLDER, null, fetchListener)
.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
});
}
@ -433,7 +462,9 @@ public class DirectMessageThreadFragment extends Fragment {
// Broadcast
final DirectThreadBroadcaster.ImageBroadcastOptions options = new DirectThreadBroadcaster.ImageBroadcastOptions(true, uploadId);
hasSentSomething = true;
broadcast(options, broadcastResponse -> new DirectMessageInboxThreadFetcher(threadId, UserInboxDirection.OLDER, null, fetchListener).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR));
broadcast(options,
broadcastResponse -> new DirectMessageInboxThreadFetcher(threadId, UserInboxDirection.OLDER, null, fetchListener)
.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR));
} catch (JSONException e) {
Log.e(TAG, "Error parsing json response", e);
}
@ -446,7 +477,8 @@ public class DirectMessageThreadFragment extends Fragment {
}
}
private void broadcast(final DirectThreadBroadcaster.BroadcastOptions broadcastOptions, final DirectThreadBroadcaster.OnBroadcastCompleteListener listener) {
private void broadcast(final DirectThreadBroadcaster.BroadcastOptions broadcastOptions,
final DirectThreadBroadcaster.OnBroadcastCompleteListener listener) {
final DirectThreadBroadcaster broadcaster = new DirectThreadBroadcaster(threadId);
broadcaster.setOnTaskCompleteListener(listener);
broadcaster.execute(broadcastOptions);
@ -529,7 +561,8 @@ public class DirectMessageThreadFragment extends Fragment {
protected void onPostExecute(Void result) {
if (hasDeletedSomething) {
directItemModel = null;
new DirectMessageInboxThreadFetcher(threadId, UserInboxDirection.OLDER, null, fetchListener).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
new DirectMessageInboxThreadFetcher(threadId, UserInboxDirection.OLDER, null, fetchListener)
.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
}
}

4
app/src/main/java/awais/instagrabber/fragments/main/DiscoverFragment.java

@ -202,10 +202,6 @@ public class DiscoverFragment extends Fragment {
return;
}
if (checkAndResetAction()) return;
// startActivity(new Intent(requireContext(), PostViewer.class)
// .putExtra(Constants.EXTRAS_INDEX, position)
// .putExtra(Constants.EXTRAS_TYPE, PostItemType.DISCOVER)
// .putExtra(Constants.EXTRAS_POST, new PostModel(model.getShortCode(), false)));
final List<DiscoverItemModel> discoverItemModels = discoverItemViewModel.getList().getValue();
if (discoverItemModels == null || discoverItemModels.size() == 0) return;
if (discoverItemModels.get(0) == null) return;

31
app/src/main/java/awais/instagrabber/fragments/main/ProfileFragment.java

@ -12,6 +12,8 @@ import android.text.style.StyleSpan;
import android.util.Log;
import android.view.ActionMode;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
@ -179,12 +181,14 @@ public class ProfileFragment extends Fragment {
action.setUsername("@" + text);
NavHostFragment.findNavController(this).navigate(action);
};
private MenuItem favMenuItem;
@Override
public void onCreate(@Nullable final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
fragmentActivity = (MainActivity) requireActivity();
friendshipService = FriendshipService.getInstance();
setHasOptionsMenu(true);
}
@Override
@ -225,6 +229,12 @@ public class ProfileFragment extends Fragment {
shouldRefresh = false;
}
@Override
public void onCreateOptionsMenu(@NonNull final Menu menu, @NonNull final MenuInflater inflater) {
inflater.inflate(R.menu.profile_menu, menu);
favMenuItem = menu.findItem(R.id.favourites);
}
@Override
public void onDestroy() {
super.onDestroy();
@ -289,6 +299,12 @@ public class ProfileFragment extends Fragment {
private void fetchProfileDetails() {
new ProfileFetcher(username.substring(1), profileModel -> {
this.profileModel = profileModel;
final String userIdFromCookie = Utils.getUserIdFromCookie(cookie);
final boolean isSelf = isLoggedIn
&& profileModel != null
&& userIdFromCookie != null
&& userIdFromCookie.equals(profileModel.getId());
favMenuItem.setVisible(isSelf);
setProfileDetails();
}).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
@ -423,8 +439,8 @@ public class ProfileFragment extends Fragment {
span.setSpan(new StyleSpan(Typeface.BOLD), 0, followingCountStrLen, 0);
binding.mainFollowing.setText(span);
binding.mainFullName.setText(Utils.isEmpty(profileModel.getName()) ? profileModel
.getUsername() : profileModel.getName());
binding.mainFullName.setText(Utils.isEmpty(profileModel.getName()) ? profileModel.getUsername()
: profileModel.getName());
CharSequence biography = profileModel.getBiography();
binding.mainBiography.setCaptionIsExpandable(true);
@ -455,13 +471,10 @@ public class ProfileFragment extends Fragment {
if (isLoggedIn) {
final View.OnClickListener followClickListener = v -> {
// startActivity(new Intent(requireContext(), FollowViewerFragment.class)
// .putExtra(Constants.EXTRAS_FOLLOWERS, v == binding.mainFollowers)
// .putExtra(Constants.EXTRAS_NAME, profileModel.getUsername())
// .putExtra(Constants.EXTRAS_ID, profileId));
final NavDirections action = ProfileFragmentDirections.actionProfileFragmentToFollowViewerFragment(profileId,
v == binding.mainFollowers,
profileModel.getUsername());
final NavDirections action = ProfileFragmentDirections.actionProfileFragmentToFollowViewerFragment(
profileId,
v == binding.mainFollowers,
profileModel.getUsername());
NavHostFragment.findNavController(this).navigate(action);
};

140
app/src/main/res/layout/layout_dm_inbox_item.xml

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.constraintlayout.widget.ConstraintLayout 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"
@ -8,10 +8,14 @@
android:orientation="horizontal">
<FrameLayout
android:id="@+id/profile_pic_container"
android:layout_width="@dimen/simple_item_picture_size"
android:layout_height="@dimen/simple_item_picture_size"
android:gravity="center"
android:padding="4dp">
android:padding="4dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<com.facebook.drawee.view.SimpleDraweeView
android:id="@+id/ivProfilePic"
@ -24,7 +28,8 @@
android:id="@+id/multi_pic_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
android:orientation="horizontal"
android:visibility="gone">
<com.facebook.drawee.view.SimpleDraweeView
android:layout_width="@dimen/simple_item_picture_size_half"
@ -49,74 +54,67 @@
</LinearLayout>
</FrameLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="vertical"
android:padding="8dp">
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/tvUsername"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:ellipsize="marquee"
android:gravity="center_vertical"
android:singleLine="true"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:textColor="?android:textColorPrimary"
android:textStyle="bold"
app:layout_constraintEnd_toStartOf="@id/tvDate"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="username" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/tvUsername"
android:layout_width="0dp"
android:layout_height="0dp"
android:ellipsize="marquee"
android:gravity="bottom"
android:singleLine="true"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:textColor="?android:textColorPrimary"
android:textStyle="bold"
app:layout_constraintBottom_toTopOf="@id/tvComment"
app:layout_constraintEnd_toStartOf="@id/tvDate"
app:layout_constraintStart_toEndOf="@id/profile_pic_container"
app:layout_constraintTop_toTopOf="parent"
tools:text="username" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/tvDate"
android:layout_width="0dp"
android:layout_height="0dp"
android:ellipsize="marquee"
android:gravity="center_vertical|end"
android:singleLine="true"
android:textAppearance="@style/TextAppearance.AppCompat.Caption"
android:textStyle="italic"
app:layout_constraintBottom_toTopOf="@id/comment_container"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/tvUsername"
app:layout_constraintTop_toTopOf="parent"
tools:text="long date................................" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/tvDate"
android:layout_width="0dp"
android:layout_height="0dp"
android:ellipsize="marquee"
android:gravity="bottom|end"
android:singleLine="true"
android:textAppearance="@style/TextAppearance.AppCompat.Caption"
android:textStyle="italic"
app:layout_constraintBottom_toTopOf="@id/tvComment"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/tvUsername"
app:layout_constraintTop_toTopOf="parent"
tools:text="long date................................" />
<LinearLayout
android:id="@+id/comment_container"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvUsername">
<!--<androidx.appcompat.widget.AppCompatImageView-->
<!-- android:id="@+id/notTextType"-->
<!-- android:layout_width="4dp"-->
<!-- android:layout_height="4dp"-->
<!-- android:layout_gravity="center_vertical"-->
<!-- android:layout_marginEnd="4dp"-->
<!-- android:layout_marginRight="4dp"-->
<!-- android:visibility="gone"-->
<!-- app:tint="@color/feed_text_primary_color" />-->
<!--<FrameLayout-->
<!-- android:id="@+id/comment_container"-->
<!-- android:layout_width="0dp"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:orientation="horizontal">-->
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/notTextType"
android:layout_width="4dp"
android:layout_height="4dp"
android:layout_gravity="center_vertical"
android:layout_marginEnd="4dp"
android:layout_marginRight="4dp"
android:visibility="gone"
app:srcCompat="@android:drawable/ic_notification_overlay"
app:tint="@color/feed_text_primary_color" />
<awais.instagrabber.customviews.RamboTextView
android:id="@+id/tvComment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:autoLink="web|email"
android:ellipsize="end"
android:linksClickable="true"
android:textAppearance="@style/TextAppearance.AppCompat.Caption"
tools:text="comment" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
<!-- -->
<!--</FrameLayout>-->
<awais.instagrabber.customviews.RamboTextView
android:id="@+id/tvComment"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_gravity="center_vertical"
android:autoLink="web|email"
android:ellipsize="end"
android:linksClickable="true"
android:textAppearance="@style/TextAppearance.AppCompat.Caption"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@id/profile_pic_container"
app:layout_constraintTop_toBottomOf="@id/tvUsername"
tools:text="comment" />
</androidx.constraintlayout.widget.ConstraintLayout>

14
app/src/main/res/menu/dm_thread_menu.xml

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/info"
android:icon="@drawable/ic_outline_info_24"
android:title="@string/dm_thread_info"
app:showAsAction="always" />
<item
android:id="@+id/mark_as_seen"
android:icon="@drawable/ic_outline_views_24"
android:title="@string/mark_as_seen"
app:showAsAction="ifRoom" />
</menu>

15
app/src/main/res/menu/main_menu.xml

@ -1,12 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/favourites"
android:enabled="true"
android:icon="@drawable/ic_star_24"
android:title="@string/title_favorites"
app:showAsAction="ifRoom" />
<menu>
<!--<item-->
<!-- android:id="@+id/favourites"-->
<!-- android:enabled="true"-->
<!-- android:icon="@drawable/ic_star_24"-->
<!-- android:title="@string/title_favorites"-->
<!-- app:showAsAction="ifRoom" />-->
<!--<item-->
<!-- android:id="@+id/direct_messages"-->

12
app/src/main/res/menu/profile_menu.xml

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/favourites"
android:enabled="true"
android:icon="@drawable/ic_star_24"
android:title="@string/title_favorites"
android:visible="false"
app:showAsAction="ifRoom" />
</menu>

2
app/src/main/res/values/strings.xml

@ -249,4 +249,6 @@
<string name="relogin">Relogin</string>
<string name="relogin_summary">Refresh your cookies if facing any issues</string>
<string name="logout_success">Successfully logged out!</string>
<string name="dm_thread_info">Info</string>
<string name="mark_as_seen">Mark as seen</string>
</resources>
Loading…
Cancel
Save