Skip to content

Commit

Permalink
fixed merge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
marecar3 authored and mzorz committed Apr 6, 2019
1 parent d665ac9 commit d4cec01
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2223,7 +2223,7 @@ public Fragment getItem(int position) {
case 3:
return HistoryListFragment.Companion.newInstance(mPost, mSite);
default:
return EditPostPreviewFragment.newInstance(mPost);
return EditPostPreviewFragment.newInstance(mPost, mSite);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,11 @@
import org.wordpress.android.R;
import org.wordpress.android.WordPress;
import org.wordpress.android.fluxc.model.PostModel;
import org.wordpress.android.fluxc.model.SiteModel;
import org.wordpress.android.fluxc.store.AccountStore;
import org.wordpress.android.fluxc.store.PostStore;
import org.wordpress.android.util.StringUtils;
import org.wordpress.android.util.WPWebViewClient;

import javax.inject.Inject;

Expand All @@ -26,12 +29,15 @@ public class EditPostPreviewFragment extends Fragment {
private WebView mWebView;
private int mLocalPostId;
private LoadPostPreviewTask mLoadTask;
private SiteModel mSite;

@Inject PostStore mPostStore;
@Inject AccountStore mAccountStore;

public static EditPostPreviewFragment newInstance(@NonNull PostModel post) {
public static EditPostPreviewFragment newInstance(@NonNull PostModel post, SiteModel site) {
EditPostPreviewFragment fragment = new EditPostPreviewFragment();
Bundle bundle = new Bundle();
bundle.putSerializable(WordPress.SITE, site);
bundle.putInt(ARG_LOCAL_POST_ID, post.getId());
fragment.setArguments(bundle);
return fragment;
Expand All @@ -44,6 +50,12 @@ public void setArguments(Bundle args) {
mSite = (SiteModel) args.getSerializable(WordPress.SITE);
}

@Override
public void onSaveInstanceState(Bundle outState) {
outState.putSerializable(WordPress.SITE, mSite);
super.onSaveInstanceState(outState);
}

@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Expand All @@ -55,6 +67,8 @@ public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
ViewGroup rootView = (ViewGroup) inflater
.inflate(R.layout.edit_post_preview_fragment, container, false);
mWebView = rootView.findViewById(R.id.post_preview_web_view);
WPWebViewClient client = new WPWebViewClient(mSite, mAccountStore.getAccessToken());
mWebView.setWebViewClient(client);
mWebView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
Expand Down

0 comments on commit d4cec01

Please sign in to comment.