mirror of
https://github.com/KokaKiwi/BarInsta
synced 2024-11-26 08:37:29 +00:00
Add ViewModel to post view to maintain state. Update some ui
This commit is contained in:
parent
92d8163c7b
commit
9ba1893746
@ -41,11 +41,11 @@ public class FeedPostFetchService implements PostFetcher.PostFetchService {
|
||||
hasNextPage = result.hasNextPage();
|
||||
feedModels.addAll(result.getFeedModels());
|
||||
if (fetchListener != null) {
|
||||
if (feedModels.size() < 15 && hasNextPage) {
|
||||
feedService.fetch(csrfToken, nextCursor, this);
|
||||
} else {
|
||||
fetchListener.onResult(feedModels);
|
||||
}
|
||||
// if (feedModels.size() < 15 && hasNextPage) {
|
||||
// feedService.fetch(csrfToken, nextCursor, this);
|
||||
// } else {
|
||||
fetchListener.onResult(feedModels);
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -116,7 +116,7 @@ public final class ProfilePicView extends CircularImageView {
|
||||
LARGE(3);
|
||||
|
||||
private final int value;
|
||||
private static Map<Integer, Size> map = new HashMap<>();
|
||||
private static final Map<Integer, Size> map = new HashMap<>();
|
||||
|
||||
static {
|
||||
for (Size size : Size.values()) {
|
||||
|
@ -47,7 +47,10 @@ public abstract class SharedElementTransitionDialogFragment extends DialogFragme
|
||||
final int key = destView.hashCode();
|
||||
startViews.put(key, startView);
|
||||
destViews.put(key, destView);
|
||||
initialBoundsHandler.post(() -> setupInitialBounds(startView, destView));
|
||||
setupInitialBounds(startView, destView);
|
||||
// final View view = getView();
|
||||
// if (view == null) return;
|
||||
// view.post(() -> {});
|
||||
}
|
||||
|
||||
public void startPostponedEnterTransition() {
|
||||
|
@ -0,0 +1,92 @@
|
||||
package awais.instagrabber.dialogs;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.StringRes;
|
||||
import androidx.appcompat.widget.AppCompatEditText;
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
|
||||
import awais.instagrabber.R;
|
||||
import awais.instagrabber.utils.TextUtils;
|
||||
|
||||
public class EditTextDialogFragment extends DialogFragment {
|
||||
|
||||
private Context context;
|
||||
private EditTextDialogFragmentCallback callback;
|
||||
|
||||
public static EditTextDialogFragment newInstance(@StringRes final int title,
|
||||
@StringRes final int positiveText,
|
||||
@StringRes final int negativeText,
|
||||
@Nullable final String initialText) {
|
||||
Bundle args = new Bundle();
|
||||
args.putInt("title", title);
|
||||
args.putInt("positive", positiveText);
|
||||
args.putInt("negative", negativeText);
|
||||
args.putString("initial", initialText);
|
||||
EditTextDialogFragment fragment = new EditTextDialogFragment();
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
public EditTextDialogFragment() {}
|
||||
|
||||
@Override
|
||||
public void onAttach(@NonNull final Context context) {
|
||||
super.onAttach(context);
|
||||
try {
|
||||
callback = (EditTextDialogFragmentCallback) getParentFragment();
|
||||
} catch (ClassCastException e) {
|
||||
throw new ClassCastException("Calling fragment must implement EditTextDialogFragmentCallback interface");
|
||||
}
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Dialog onCreateDialog(@Nullable final Bundle savedInstanceState) {
|
||||
final Bundle arguments = getArguments();
|
||||
int title = -1;
|
||||
int positiveButtonText = R.string.ok;
|
||||
int negativeButtonText = R.string.cancel;
|
||||
String initialText = null;
|
||||
if (arguments != null) {
|
||||
title = arguments.getInt("title", -1);
|
||||
positiveButtonText = arguments.getInt("positive", R.string.ok);
|
||||
negativeButtonText = arguments.getInt("negative", R.string.cancel);
|
||||
initialText = arguments.getString("initial", null);
|
||||
}
|
||||
final AppCompatEditText input = new AppCompatEditText(context);
|
||||
if (!TextUtils.isEmpty(initialText)) {
|
||||
input.setText(initialText);
|
||||
}
|
||||
final MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(context)
|
||||
.setView(input)
|
||||
.setPositiveButton(positiveButtonText, (d, w) -> {
|
||||
final String string = input.getText() != null ? input.getText().toString() : "";
|
||||
if (callback != null) {
|
||||
callback.onPositiveButtonClicked(string);
|
||||
}
|
||||
})
|
||||
.setNegativeButton(negativeButtonText, (dialog, which) -> {
|
||||
if (callback != null) {
|
||||
callback.onNegativeButtonClicked();
|
||||
}
|
||||
});
|
||||
if (title > 0) {
|
||||
builder.setTitle(title);
|
||||
}
|
||||
return builder.create();
|
||||
}
|
||||
|
||||
public interface EditTextDialogFragmentCallback {
|
||||
void onPositiveButtonClicked(String text);
|
||||
|
||||
void onNegativeButtonClicked();
|
||||
}
|
||||
}
|
@ -11,6 +11,7 @@ import androidx.annotation.StringRes;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
import com.google.common.primitives.Booleans;
|
||||
|
||||
import java.io.Serializable;
|
||||
@ -72,7 +73,7 @@ public class MultiOptionDialogFragment<T extends Serializable> extends DialogFra
|
||||
title = arguments.getInt("title");
|
||||
type = (Type) arguments.getSerializable("type");
|
||||
}
|
||||
final AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||
final MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(context);
|
||||
if (title > 0) {
|
||||
builder.setTitle(title);
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,273 @@
|
||||
package awais.instagrabber.viewmodels;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
import androidx.lifecycle.ViewModel;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import awais.instagrabber.R;
|
||||
import awais.instagrabber.models.Resource;
|
||||
import awais.instagrabber.models.enums.MediaItemType;
|
||||
import awais.instagrabber.repositories.responses.Caption;
|
||||
import awais.instagrabber.repositories.responses.Location;
|
||||
import awais.instagrabber.repositories.responses.Media;
|
||||
import awais.instagrabber.repositories.responses.User;
|
||||
import awais.instagrabber.utils.Constants;
|
||||
import awais.instagrabber.utils.CookieUtils;
|
||||
import awais.instagrabber.utils.TextUtils;
|
||||
import awais.instagrabber.webservices.MediaService;
|
||||
import awais.instagrabber.webservices.ServiceCallback;
|
||||
|
||||
import static awais.instagrabber.utils.Utils.settingsHelper;
|
||||
|
||||
public class PostViewV2ViewModel extends ViewModel {
|
||||
private static final String TAG = PostViewV2ViewModel.class.getSimpleName();
|
||||
|
||||
private final MutableLiveData<User> user = new MutableLiveData<>();
|
||||
private final MutableLiveData<Caption> caption = new MutableLiveData<>();
|
||||
private final MutableLiveData<Location> location = new MutableLiveData<>();
|
||||
private final MutableLiveData<String> date = new MutableLiveData<>();
|
||||
private final MutableLiveData<Long> likeCount = new MutableLiveData<>(0L);
|
||||
private final MutableLiveData<Long> commentCount = new MutableLiveData<>(0L);
|
||||
private final MutableLiveData<MediaItemType> type = new MutableLiveData<>();
|
||||
private final MutableLiveData<Boolean> liked = new MutableLiveData<>(false);
|
||||
private final MutableLiveData<Boolean> saved = new MutableLiveData<>(false);
|
||||
private final MutableLiveData<List<Integer>> options = new MutableLiveData<>(new ArrayList<>());
|
||||
private final MediaService mediaService;
|
||||
private final long viewerId;
|
||||
private final String csrfToken;
|
||||
private final boolean isLoggedIn;
|
||||
|
||||
private Media media;
|
||||
|
||||
public PostViewV2ViewModel() {
|
||||
mediaService = MediaService.getInstance();
|
||||
final String cookie = settingsHelper.getString(Constants.COOKIE);
|
||||
viewerId = CookieUtils.getUserIdFromCookie(cookie);
|
||||
csrfToken = CookieUtils.getCsrfTokenFromCookie(cookie);
|
||||
isLoggedIn = !TextUtils.isEmpty(cookie) && CookieUtils.getUserIdFromCookie(cookie) > 0;
|
||||
}
|
||||
|
||||
public void setMedia(final Media media) {
|
||||
this.media = media;
|
||||
user.postValue(media.getUser());
|
||||
caption.postValue(media.getCaption());
|
||||
location.postValue(media.getLocation());
|
||||
date.postValue(media.getDate());
|
||||
likeCount.postValue(media.getLikeCount());
|
||||
commentCount.postValue(media.getCommentCount());
|
||||
type.postValue(media.getMediaType());
|
||||
liked.postValue(media.hasLiked());
|
||||
saved.postValue(media.hasViewerSaved());
|
||||
initOptions();
|
||||
}
|
||||
|
||||
private void initOptions() {
|
||||
final ImmutableList.Builder<Integer> builder = ImmutableList.builder();
|
||||
if (isLoggedIn && media.getUser().getPk() == viewerId) {
|
||||
builder.add(R.id.edit_caption);
|
||||
}
|
||||
options.postValue(builder.build());
|
||||
}
|
||||
|
||||
public Media getMedia() {
|
||||
return media;
|
||||
}
|
||||
|
||||
public boolean isLoggedIn() {
|
||||
return isLoggedIn;
|
||||
}
|
||||
|
||||
public LiveData<User> getUser() {
|
||||
return user;
|
||||
}
|
||||
|
||||
public LiveData<Caption> getCaption() {
|
||||
return caption;
|
||||
}
|
||||
|
||||
public LiveData<Location> getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
public LiveData<String> getDate() {
|
||||
return date;
|
||||
}
|
||||
|
||||
public LiveData<Long> getLikeCount() {
|
||||
return likeCount;
|
||||
}
|
||||
|
||||
public LiveData<Long> getCommentCount() {
|
||||
return commentCount;
|
||||
}
|
||||
|
||||
public LiveData<MediaItemType> getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public LiveData<Boolean> getLiked() {
|
||||
return liked;
|
||||
}
|
||||
|
||||
public LiveData<Boolean> getSaved() {
|
||||
return saved;
|
||||
}
|
||||
|
||||
public LiveData<List<Integer>> getOptions() {
|
||||
return options;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public LiveData<Resource<Object>> toggleLike() {
|
||||
if (media.hasLiked()) {
|
||||
return unlike();
|
||||
}
|
||||
return like();
|
||||
}
|
||||
|
||||
public LiveData<Resource<Object>> like() {
|
||||
final MutableLiveData<Resource<Object>> data = new MutableLiveData<>();
|
||||
data.postValue(Resource.loading(null));
|
||||
mediaService.like(media.getPk(), viewerId, csrfToken, getLikeUnlikeCallback(data));
|
||||
return data;
|
||||
}
|
||||
|
||||
public LiveData<Resource<Object>> unlike() {
|
||||
final MutableLiveData<Resource<Object>> data = new MutableLiveData<>();
|
||||
data.postValue(Resource.loading(null));
|
||||
mediaService.unlike(media.getPk(), viewerId, csrfToken, getLikeUnlikeCallback(data));
|
||||
return data;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
private ServiceCallback<Boolean> getLikeUnlikeCallback(final MutableLiveData<Resource<Object>> data) {
|
||||
return new ServiceCallback<Boolean>() {
|
||||
@Override
|
||||
public void onSuccess(final Boolean result) {
|
||||
if (!result) {
|
||||
data.postValue(Resource.error("", null));
|
||||
return;
|
||||
}
|
||||
data.postValue(Resource.success(true));
|
||||
final long currentLikesCount = media.getLikeCount();
|
||||
final long updatedCount;
|
||||
if (!media.hasLiked()) {
|
||||
updatedCount = currentLikesCount + 1;
|
||||
media.setHasLiked(true);
|
||||
} else {
|
||||
updatedCount = currentLikesCount - 1;
|
||||
media.setHasLiked(false);
|
||||
}
|
||||
media.setLikeCount(updatedCount);
|
||||
likeCount.postValue(updatedCount);
|
||||
liked.postValue(media.hasLiked());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(final Throwable t) {
|
||||
data.postValue(Resource.error(t.getMessage(), null));
|
||||
Log.e(TAG, "Error during like/unlike", t);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public LiveData<Resource<Object>> toggleSave() {
|
||||
if (!media.hasViewerSaved()) {
|
||||
return save();
|
||||
}
|
||||
return unsave();
|
||||
}
|
||||
|
||||
public LiveData<Resource<Object>> save() {
|
||||
final MutableLiveData<Resource<Object>> data = new MutableLiveData<>();
|
||||
data.postValue(Resource.loading(null));
|
||||
mediaService.save(media.getPk(), viewerId, csrfToken, getSaveUnsaveCallback(data));
|
||||
return data;
|
||||
}
|
||||
|
||||
public LiveData<Resource<Object>> unsave() {
|
||||
final MutableLiveData<Resource<Object>> data = new MutableLiveData<>();
|
||||
data.postValue(Resource.loading(null));
|
||||
mediaService.unsave(media.getPk(), viewerId, csrfToken, getSaveUnsaveCallback(data));
|
||||
return data;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
private ServiceCallback<Boolean> getSaveUnsaveCallback(final MutableLiveData<Resource<Object>> data) {
|
||||
return new ServiceCallback<Boolean>() {
|
||||
@Override
|
||||
public void onSuccess(final Boolean result) {
|
||||
if (!result) {
|
||||
data.postValue(Resource.error("", null));
|
||||
return;
|
||||
}
|
||||
data.postValue(Resource.success(true));
|
||||
media.setHasViewerSaved(!media.hasViewerSaved());
|
||||
saved.postValue(media.hasViewerSaved());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(final Throwable t) {
|
||||
data.postValue(Resource.error(t.getMessage(), null));
|
||||
Log.e(TAG, "Error during save/unsave", t);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public LiveData<Resource<Object>> updateCaption(final String caption) {
|
||||
final MutableLiveData<Resource<Object>> data = new MutableLiveData<>();
|
||||
data.postValue(Resource.loading(null));
|
||||
mediaService.editCaption(media.getPk(), viewerId, caption, csrfToken, new ServiceCallback<Boolean>() {
|
||||
@Override
|
||||
public void onSuccess(final Boolean result) {
|
||||
if (result) {
|
||||
data.postValue(Resource.success(""));
|
||||
media.setPostCaption(caption);
|
||||
PostViewV2ViewModel.this.caption.postValue(media.getCaption());
|
||||
return;
|
||||
}
|
||||
data.postValue(Resource.error("", null));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(final Throwable t) {
|
||||
Log.e(TAG, "Error editing caption", t);
|
||||
data.postValue(Resource.error(t.getMessage(), null));
|
||||
}
|
||||
});
|
||||
return data;
|
||||
}
|
||||
|
||||
public LiveData<Resource<String>> translateCaption() {
|
||||
final MutableLiveData<Resource<String>> data = new MutableLiveData<>();
|
||||
data.postValue(Resource.loading(null));
|
||||
final Caption value = caption.getValue();
|
||||
if (value == null) return data;
|
||||
mediaService.translate(String.valueOf(value.getPk()), "1", new ServiceCallback<String>() {
|
||||
@Override
|
||||
public void onSuccess(final String result) {
|
||||
if (TextUtils.isEmpty(result)) {
|
||||
data.postValue(Resource.error("", null));
|
||||
return;
|
||||
}
|
||||
data.postValue(Resource.success(result));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(final Throwable t) {
|
||||
Log.e(TAG, "Error translating comment", t);
|
||||
data.postValue(Resource.error(t.getMessage(), null));
|
||||
}
|
||||
});
|
||||
return data;
|
||||
}
|
||||
}
|
10
app/src/main/res/drawable/ic_more_vert_24.xml
Normal file
10
app/src/main/res/drawable/ic_more_vert_24.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24"
|
||||
android:tint="?attr/colorControlNormal">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M12,8c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2 -2,0.9 -2,2 0.9,2 2,2zM12,10c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2zM12,16c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2z"/>
|
||||
</vector>
|
10
app/src/main/res/drawable/ic_round_location_on_24.xml
Normal file
10
app/src/main/res/drawable/ic_round_location_on_24.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24"
|
||||
android:tint="?attr/colorControlNormal">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M12,2C8.13,2 5,5.13 5,9c0,4.17 4.42,9.92 6.24,12.11 0.4,0.48 1.13,0.48 1.53,0C14.58,18.92 19,13.17 19,9c0,-3.87 -3.13,-7 -7,-7zM12,11.5c-1.38,0 -2.5,-1.12 -2.5,-2.5s1.12,-2.5 2.5,-2.5 2.5,1.12 2.5,2.5 -1.12,2.5 -2.5,2.5z"/>
|
||||
</vector>
|
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="oval">
|
||||
<solid android:color="@color/white" />
|
||||
<solid android:color="@color/black" />
|
||||
</shape>
|
@ -6,10 +6,6 @@
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/black_a80">
|
||||
|
||||
<!--<FrameLayout-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="match_parent">-->
|
||||
|
||||
<awais.instagrabber.customviews.drawee.DraggableZoomableDraweeView
|
||||
android:id="@+id/post_image"
|
||||
android:layout_width="match_parent"
|
||||
@ -24,8 +20,7 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:background="@mipmap/ic_launcher"
|
||||
tools:visibility="gone" />
|
||||
<!--</FrameLayout>-->
|
||||
tools:visibility="visible" />
|
||||
|
||||
<include
|
||||
android:id="@+id/video_post"
|
||||
@ -53,80 +48,79 @@
|
||||
android:id="@+id/profile_pic"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="16dp"
|
||||
android:layout_margin="12dp"
|
||||
android:transitionName="profile_pic"
|
||||
app:layout_constraintBottom_toBottomOf="@id/top_bg"
|
||||
app:layout_constraintEnd_toStartOf="@id/title"
|
||||
app:layout_constraintHorizontal_bias="0"
|
||||
app:layout_constraintHorizontal_chainStyle="packed"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/top_bg"
|
||||
app:size="regular" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="4dp"
|
||||
android:ellipsize="marquee"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="@style/TextAppearance.MaterialComponents.Subtitle1"
|
||||
android:textAppearance="@style/TextAppearance.MaterialComponents.Headline6"
|
||||
android:textColor="@color/white"
|
||||
android:textStyle="bold"
|
||||
app:layout_constrainedWidth="true"
|
||||
app:layout_constraintBottom_toTopOf="@id/subtitle"
|
||||
app:layout_constraintEnd_toStartOf="@id/isVerified"
|
||||
app:layout_constraintEnd_toStartOf="@id/options"
|
||||
app:layout_constraintStart_toEndOf="@id/profile_pic"
|
||||
app:layout_constraintTop_toTopOf="@id/profile_pic"
|
||||
tools:text="Username Username Username" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/isVerified"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="0dp"
|
||||
android:scaleType="fitCenter"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="@id/title"
|
||||
app:layout_constraintStart_toEndOf="@id/title"
|
||||
app:layout_constraintTop_toTopOf="@id/title"
|
||||
app:srcCompat="@drawable/verified"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/righttitle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginStart="4dp"
|
||||
android:ellipsize="marquee"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="@style/TextAppearance.MaterialComponents.Subtitle1"
|
||||
android:textColor="@color/grey_600"
|
||||
app:layout_constraintBottom_toBottomOf="@id/title"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/isVerified"
|
||||
app:layout_constraintTop_toTopOf="@id/title"
|
||||
tools:text="Full name Full name Full name Full name Full name Full name Full name " />
|
||||
<!--<androidx.appcompat.widget.AppCompatImageView-->
|
||||
<!-- android:id="@+id/isVerified"-->
|
||||
<!-- android:layout_width="20dp"-->
|
||||
<!-- android:layout_height="0dp"-->
|
||||
<!-- android:scaleType="fitCenter"-->
|
||||
<!-- android:visibility="gone"-->
|
||||
<!-- app:layout_constraintBottom_toBottomOf="@id/title"-->
|
||||
<!-- app:layout_constraintStart_toEndOf="@id/title"-->
|
||||
<!-- app:layout_constraintTop_toTopOf="@id/title"-->
|
||||
<!-- app:srcCompat="@drawable/verified"-->
|
||||
<!-- tools:visibility="visible" />-->
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/subtitle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="@style/TextAppearance.MaterialComponents.Subtitle1"
|
||||
android:textColor="@color/white"
|
||||
app:layout_constraintBottom_toBottomOf="@id/profile_pic"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/options"
|
||||
app:layout_constraintStart_toStartOf="@id/title"
|
||||
app:layout_constraintTop_toBottomOf="@id/title"
|
||||
tools:text="Location"
|
||||
tools:text="Full name Full name Full name Full name Full name Full name Full name " />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/options"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:paddingStart="8dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="@id/top_bg"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/top_bg"
|
||||
app:srcCompat="@drawable/ic_more_vert_24"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/media_counter"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal|bottom"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:background="@drawable/rounder_corner_semi_black_bg"
|
||||
android:gravity="center"
|
||||
android:padding="5dp"
|
||||
android:padding="8dp"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Caption"
|
||||
android:textColor="@android:color/white"
|
||||
android:visibility="gone"
|
||||
@ -135,6 +129,37 @@
|
||||
tools:text="1/5"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/location"
|
||||
style="?borderlessButtonStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:elevation="0dp"
|
||||
android:ellipsize="end"
|
||||
android:insetTop="0dp"
|
||||
android:insetBottom="0dp"
|
||||
android:maxWidth="200dp"
|
||||
android:maxLines="1"
|
||||
android:minHeight="32dp"
|
||||
android:paddingStart="8dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:textAlignment="viewStart"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="@android:color/white"
|
||||
android:visibility="gone"
|
||||
app:backgroundTint="@color/black_a50"
|
||||
app:elevation="0dp"
|
||||
app:icon="@drawable/ic_round_location_on_24"
|
||||
app:iconSize="16dp"
|
||||
app:iconTint="@color/white"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/top_bg"
|
||||
app:rippleColor="@color/grey_600"
|
||||
tools:text="Location, Location, Location, Location, "
|
||||
tools:visibility="visible" />
|
||||
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
@ -159,10 +184,10 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@null">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/captionFrame"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<awais.instagrabber.customviews.RamboTextViewV2
|
||||
@ -176,55 +201,55 @@
|
||||
android:padding="16dp"
|
||||
android:textAppearance="@style/TextAppearance.MaterialComponents.Body1"
|
||||
android:textColor="@color/white"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@id/translateTitle"
|
||||
tools:text="Text text text" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/editCaption"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:background="@null"
|
||||
android:gravity="center_vertical"
|
||||
android:text="@string/edit_caption"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textSize="16dp"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toTopOf="@id/translatedCaption"
|
||||
app:layout_constraintTop_toBottomOf="@id/caption" />
|
||||
<!--<androidx.appcompat.widget.AppCompatTextView-->
|
||||
<!-- android:id="@+id/editCaption"-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:layout_marginStart="16dp"-->
|
||||
<!-- android:layout_marginTop="8dp"-->
|
||||
<!-- android:background="@null"-->
|
||||
<!-- android:gravity="center_vertical"-->
|
||||
<!-- android:text="@string/edit_caption"-->
|
||||
<!-- android:textColor="?android:textColorSecondary"-->
|
||||
<!-- android:textSize="16sp"-->
|
||||
<!-- android:visibility="gone"-->
|
||||
<!-- app:layout_constraintBottom_toTopOf="@id/translatedCaption"-->
|
||||
<!-- app:layout_constraintTop_toBottomOf="@id/caption"-->
|
||||
<!-- tools:visibility="visible" />-->
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/translateTitle"
|
||||
android:id="@+id/translate"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:background="@null"
|
||||
android:visibility="visible"
|
||||
android:gravity="center_vertical"
|
||||
app:layout_constraintTop_toBottomOf="@id/caption"
|
||||
app:layout_constraintBottom_toTopOf="@id/translatedCaption"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:text="@string/translate_caption"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textSize="16dp"/>
|
||||
android:textColor="@color/blue_600"
|
||||
android:textSize="16sp"
|
||||
android:visibility="visible" />
|
||||
|
||||
<awais.instagrabber.customviews.RamboTextViewV2
|
||||
android:id="@+id/translatedCaption"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
android:visibility="gone"
|
||||
android:background="@null"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:padding="16dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/translateTitle"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:textAppearance="@style/TextAppearance.MaterialComponents.Body1"
|
||||
android:textColor="@color/white"
|
||||
tools:text="Text text text" />
|
||||
<!--<awais.instagrabber.customviews.RamboTextViewV2-->
|
||||
<!-- android:id="@+id/translatedCaption"-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:layout_gravity="bottom"-->
|
||||
<!-- android:background="@null"-->
|
||||
<!-- android:clickable="true"-->
|
||||
<!-- android:focusable="true"-->
|
||||
<!-- android:padding="16dp"-->
|
||||
<!-- android:textAppearance="@style/TextAppearance.MaterialComponents.Body1"-->
|
||||
<!-- android:textColor="@color/white"-->
|
||||
<!-- android:visibility="gone"-->
|
||||
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
|
||||
<!-- app:layout_constraintTop_toBottomOf="@id/translateTitle"-->
|
||||
<!-- tools:text="Text text text"-->
|
||||
<!-- tools:visibility="visible" />-->
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
@ -239,7 +264,7 @@
|
||||
app:layout_constraintBottom_toTopOf="@id/bottom_bg_barrier"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
tools:visibility="visible" />
|
||||
tools:visibility="gone" />
|
||||
|
||||
<View
|
||||
android:id="@+id/bottom_bg"
|
||||
@ -305,9 +330,9 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="8dp"
|
||||
android:textColor="@color/white"
|
||||
tools:text="2020-11-07 11:18:55"
|
||||
app:layout_constraintBottom_toBottomOf="@id/buttons_barrier"
|
||||
app:layout_constraintTop_toBottomOf="@id/likes_count"
|
||||
app:layout_constraintBottom_toBottomOf="@id/buttons_barrier" />
|
||||
tools:text="2020-11-07 11:18:55" />
|
||||
|
||||
<androidx.constraintlayout.widget.Barrier
|
||||
android:id="@+id/buttons_barrier"
|
||||
@ -316,10 +341,6 @@
|
||||
app:barrierDirection="bottom"
|
||||
app:constraint_referenced_ids="likes_count,comments_count,views_count" />
|
||||
|
||||
<!--android:text="@string/caption"-->
|
||||
<!--app:iconGravity="top"-->
|
||||
<!--android:textAppearance="@style/TextAppearance.MaterialComponents.Caption"
|
||||
android:textColor="@color/white"-->
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/caption_toggle"
|
||||
style="@style/Widget.MaterialComponents.Button.TextButton"
|
||||
@ -338,10 +359,6 @@
|
||||
app:rippleColor="@color/grey_300"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<!--android:text="@string/like_without_count"
|
||||
android:textAppearance="@style/TextAppearance.MaterialComponents.Caption"
|
||||
android:textColor="@color/white"
|
||||
app:iconGravity="top"-->
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/like"
|
||||
style="@style/Widget.MaterialComponents.Button.TextButton"
|
||||
@ -360,10 +377,6 @@
|
||||
app:rippleColor="@color/grey_300"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<!--android:text="@string/comment"
|
||||
android:textAppearance="@style/TextAppearance.MaterialComponents.Caption"
|
||||
android:textColor="@color/white"
|
||||
app:iconGravity="top"-->
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/comment"
|
||||
style="@style/Widget.MaterialComponents.Button.TextButton"
|
||||
@ -382,10 +395,6 @@
|
||||
app:rippleColor="@color/grey_300"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<!--android:text="@string/controls"
|
||||
android:textAppearance="@style/TextAppearance.MaterialComponents.Caption"
|
||||
android:textColor="@color/white"
|
||||
app:iconGravity="top"-->
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/player_controls_toggle"
|
||||
style="@style/Widget.MaterialComponents.Button.TextButton"
|
||||
@ -404,10 +413,6 @@
|
||||
app:rippleColor="@color/grey_300"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<!--android:text="@string/save"
|
||||
android:textAppearance="@style/TextAppearance.MaterialComponents.Caption"
|
||||
android:textColor="@color/white"
|
||||
app:iconGravity="top"-->
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/save"
|
||||
style="@style/Widget.MaterialComponents.Button.TextButton"
|
||||
@ -444,10 +449,6 @@
|
||||
app:rippleColor="@color/grey_300"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<!--android:text="@string/action_download"
|
||||
android:textAppearance="@style/TextAppearance.MaterialComponents.Caption"
|
||||
android:textColor="@color/white"
|
||||
app:iconGravity="top"-->
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/download"
|
||||
style="@style/Widget.MaterialComponents.Button.TextButton"
|
||||
|
6
app/src/main/res/menu/post_view_menu.xml
Normal file
6
app/src/main/res/menu/post_view_menu.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item
|
||||
android:id="@+id/edit_caption"
|
||||
android:title="@string/edit_caption" />
|
||||
</menu>
|
@ -299,8 +299,8 @@
|
||||
<string name="apply">Apply</string>
|
||||
<string name="save">Save</string>
|
||||
<string name="caption">Caption</string>
|
||||
<string name="edit_caption">Edit caption...</string>
|
||||
<string name="translate_caption">Translate caption...</string>
|
||||
<string name="edit_caption">Edit caption</string>
|
||||
<string name="translate_caption">Translate caption</string>
|
||||
<string name="player_timeline_desc">Video player timeline</string>
|
||||
<string name="one_x" translatable="false">1x</string>
|
||||
<string name="two_x" translatable="false">2x</string>
|
||||
@ -390,4 +390,5 @@
|
||||
<string name="done">Done</string>
|
||||
<string name="dms_action_make_admin">Make Admin</string>
|
||||
<string name="dms_action_remove_admin">Remove as Admin</string>
|
||||
<string name="edit_unsuccessful">Edit was unsuccessful</string>
|
||||
</resources>
|
||||
|
Loading…
Reference in New Issue
Block a user