Native rewrite #878
7 changed files with 81 additions and 12 deletions
|
@ -1904,8 +1904,19 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||||
}
|
}
|
||||||
} else if (requestCode == REQUEST_VIDEO_CAPTURE || requestCode == REQUEST_TAKE_PHOTO) {
|
} else if (requestCode == REQUEST_VIDEO_CAPTURE || requestCode == REQUEST_TAKE_PHOTO) {
|
||||||
if (resultCode == RESULT_OK) {
|
if (resultCode == RESULT_OK) {
|
||||||
|
PublishFragment publishFragment = null;
|
||||||
|
for (Fragment fragment : openNavFragments.values()) {
|
||||||
|
if (fragment instanceof PublishFragment) {
|
||||||
|
publishFragment = (PublishFragment) fragment;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Map<String, Object> params = new HashMap<>();
|
Map<String, Object> params = new HashMap<>();
|
||||||
params.put("directFilePath", cameraOutputFilename);
|
params.put("directFilePath", cameraOutputFilename);
|
||||||
|
if (publishFragment != null) {
|
||||||
|
params.put("suggestedUrl", publishFragment.getSuggestedPublishUrl());
|
||||||
|
}
|
||||||
openFragment(PublishFormFragment.class, true, NavMenuItem.ID_ITEM_NEW_PUBLISH, params);
|
openFragment(PublishFormFragment.class, true, NavMenuItem.ID_ITEM_NEW_PUBLISH, params);
|
||||||
}
|
}
|
||||||
cameraOutputFilename = null;
|
cameraOutputFilename = null;
|
||||||
|
|
|
@ -82,7 +82,6 @@ public class ChannelFragment extends BaseFragment implements FetchChannelsListen
|
||||||
private View buttonFollowUnfollow;
|
private View buttonFollowUnfollow;
|
||||||
private int subCount;
|
private int subCount;
|
||||||
private SolidIconView iconFollowUnfollow;
|
private SolidIconView iconFollowUnfollow;
|
||||||
|
|
||||||
private View layoutNothingAtLocation;
|
private View layoutNothingAtLocation;
|
||||||
private View layoutLoadingState;
|
private View layoutLoadingState;
|
||||||
|
|
||||||
|
|
|
@ -66,6 +66,7 @@ import java.text.DecimalFormat;
|
||||||
import java.text.NumberFormat;
|
import java.text.NumberFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
|
@ -87,6 +88,7 @@ import io.lbry.browser.model.Claim;
|
||||||
import io.lbry.browser.model.ClaimCacheKey;
|
import io.lbry.browser.model.ClaimCacheKey;
|
||||||
import io.lbry.browser.model.Fee;
|
import io.lbry.browser.model.Fee;
|
||||||
import io.lbry.browser.model.LbryFile;
|
import io.lbry.browser.model.LbryFile;
|
||||||
|
import io.lbry.browser.model.NavMenuItem;
|
||||||
import io.lbry.browser.model.Tag;
|
import io.lbry.browser.model.Tag;
|
||||||
import io.lbry.browser.model.UrlSuggestion;
|
import io.lbry.browser.model.UrlSuggestion;
|
||||||
import io.lbry.browser.model.lbryinc.Reward;
|
import io.lbry.browser.model.lbryinc.Reward;
|
||||||
|
@ -109,6 +111,8 @@ import io.lbry.browser.tasks.lbryinc.FetchStatCountTask;
|
||||||
import io.lbry.browser.tasks.lbryinc.LogFileViewTask;
|
import io.lbry.browser.tasks.lbryinc.LogFileViewTask;
|
||||||
import io.lbry.browser.ui.BaseFragment;
|
import io.lbry.browser.ui.BaseFragment;
|
||||||
import io.lbry.browser.ui.controls.SolidIconView;
|
import io.lbry.browser.ui.controls.SolidIconView;
|
||||||
|
import io.lbry.browser.ui.publish.PublishFormFragment;
|
||||||
|
import io.lbry.browser.ui.publish.PublishFragment;
|
||||||
import io.lbry.browser.utils.Helper;
|
import io.lbry.browser.utils.Helper;
|
||||||
import io.lbry.browser.utils.Lbry;
|
import io.lbry.browser.utils.Lbry;
|
||||||
import io.lbry.browser.utils.LbryAnalytics;
|
import io.lbry.browser.utils.LbryAnalytics;
|
||||||
|
@ -145,6 +149,7 @@ public class FileViewFragment extends BaseFragment implements
|
||||||
private long startTimeMillis;
|
private long startTimeMillis;
|
||||||
private GetFileTask getFileTask;
|
private GetFileTask getFileTask;
|
||||||
|
|
||||||
|
private View buttonPublishSomething;
|
||||||
private View layoutLoadingState;
|
private View layoutLoadingState;
|
||||||
private View layoutNothingAtLocation;
|
private View layoutNothingAtLocation;
|
||||||
private View layoutDisplayArea;
|
private View layoutDisplayArea;
|
||||||
|
@ -158,6 +163,7 @@ public class FileViewFragment extends BaseFragment implements
|
||||||
layoutNothingAtLocation = root.findViewById(R.id.container_nothing_at_location);
|
layoutNothingAtLocation = root.findViewById(R.id.container_nothing_at_location);
|
||||||
layoutResolving = root.findViewById(R.id.file_view_loading_container);
|
layoutResolving = root.findViewById(R.id.file_view_loading_container);
|
||||||
layoutDisplayArea = root.findViewById(R.id.file_view_claim_display_area);
|
layoutDisplayArea = root.findViewById(R.id.file_view_claim_display_area);
|
||||||
|
buttonPublishSomething = root.findViewById(R.id.nothing_at_location_publish_button);
|
||||||
|
|
||||||
initUi(root);
|
initUi(root);
|
||||||
|
|
||||||
|
@ -282,10 +288,11 @@ public class FileViewFragment extends BaseFragment implements
|
||||||
}
|
}
|
||||||
|
|
||||||
private void renderNothingAtLocation() {
|
private void renderNothingAtLocation() {
|
||||||
layoutLoadingState.setVisibility(View.VISIBLE);
|
Helper.setViewVisibility(layoutLoadingState, View.VISIBLE);
|
||||||
layoutNothingAtLocation.setVisibility(View.VISIBLE);
|
Helper.setViewVisibility(layoutNothingAtLocation, View.VISIBLE);
|
||||||
layoutResolving.setVisibility(View.GONE);
|
Helper.setViewVisibility(buttonPublishSomething, View.VISIBLE);
|
||||||
layoutDisplayArea.setVisibility(View.INVISIBLE);
|
Helper.setViewVisibility(layoutResolving, View.GONE);
|
||||||
|
Helper.setViewVisibility(layoutDisplayArea, View.INVISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkNewClaimAndUrl(Claim newClaim, String newUrl) {
|
private void checkNewClaimAndUrl(Claim newClaim, String newUrl) {
|
||||||
|
@ -575,6 +582,21 @@ public class FileViewFragment extends BaseFragment implements
|
||||||
private void initUi(View root) {
|
private void initUi(View root) {
|
||||||
initWebView(root);
|
initWebView(root);
|
||||||
|
|
||||||
|
buttonPublishSomething.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
Context context = getContext();
|
||||||
|
if (!Helper.isNullOrEmpty(currentUrl) && context instanceof MainActivity) {
|
||||||
|
LbryUri uri = LbryUri.tryParse(currentUrl);
|
||||||
|
if (uri != null) {
|
||||||
|
Map<String, Object> params = new HashMap<>();
|
||||||
|
params.put("suggestedUrl", uri.getStreamName());
|
||||||
|
((MainActivity) context).openFragment(PublishFragment.class, true, NavMenuItem.ID_ITEM_NEW_PUBLISH, params);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
root.findViewById(R.id.file_view_title_area).setOnClickListener(new View.OnClickListener() {
|
root.findViewById(R.id.file_view_title_area).setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
|
|
|
@ -18,7 +18,9 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import io.lbry.browser.MainActivity;
|
import io.lbry.browser.MainActivity;
|
||||||
import io.lbry.browser.R;
|
import io.lbry.browser.R;
|
||||||
|
@ -27,11 +29,13 @@ import io.lbry.browser.listener.DownloadActionListener;
|
||||||
import io.lbry.browser.model.Claim;
|
import io.lbry.browser.model.Claim;
|
||||||
import io.lbry.browser.model.ClaimCacheKey;
|
import io.lbry.browser.model.ClaimCacheKey;
|
||||||
import io.lbry.browser.model.LbryFile;
|
import io.lbry.browser.model.LbryFile;
|
||||||
|
import io.lbry.browser.model.NavMenuItem;
|
||||||
import io.lbry.browser.tasks.claim.ClaimListResultHandler;
|
import io.lbry.browser.tasks.claim.ClaimListResultHandler;
|
||||||
import io.lbry.browser.tasks.claim.ClaimSearchResultHandler;
|
import io.lbry.browser.tasks.claim.ClaimSearchResultHandler;
|
||||||
import io.lbry.browser.tasks.LighthouseSearchTask;
|
import io.lbry.browser.tasks.LighthouseSearchTask;
|
||||||
import io.lbry.browser.tasks.claim.ResolveTask;
|
import io.lbry.browser.tasks.claim.ResolveTask;
|
||||||
import io.lbry.browser.ui.BaseFragment;
|
import io.lbry.browser.ui.BaseFragment;
|
||||||
|
import io.lbry.browser.ui.publish.PublishFragment;
|
||||||
import io.lbry.browser.utils.Helper;
|
import io.lbry.browser.utils.Helper;
|
||||||
import io.lbry.browser.utils.Lbry;
|
import io.lbry.browser.utils.Lbry;
|
||||||
import io.lbry.browser.utils.LbryAnalytics;
|
import io.lbry.browser.utils.LbryAnalytics;
|
||||||
|
@ -272,13 +276,20 @@ public class SearchFragment extends BaseFragment implements
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Context context = getContext();
|
||||||
|
if (context instanceof MainActivity) {
|
||||||
|
MainActivity activity = (MainActivity) context;
|
||||||
if (claim.isUnresolved()) {
|
if (claim.isUnresolved()) {
|
||||||
// open the publish page
|
// open the publish page
|
||||||
|
Map<String, Object> params = new HashMap<>();
|
||||||
|
params.put("suggestedUrl", claim.getName());
|
||||||
|
activity.openFragment(PublishFragment.class, true, NavMenuItem.ID_ITEM_NEW_PUBLISH, params);
|
||||||
} else if (claim.getName().startsWith("@")) {
|
} else if (claim.getName().startsWith("@")) {
|
||||||
((MainActivity) getContext()).openChannelUrl(claim.getPermanentUrl());
|
activity.openChannelUrl(claim.getPermanentUrl());
|
||||||
} else {
|
} else {
|
||||||
// not a channel
|
// not a channel
|
||||||
((MainActivity) getContext()).openFileClaim(claim);
|
activity.openFileClaim(claim);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -514,6 +514,10 @@ public class PublishFormFragment extends BaseFragment implements
|
||||||
} else if (params.containsKey("directFilePath")) {
|
} else if (params.containsKey("directFilePath")) {
|
||||||
currentFilePath = (String) params.get("directFilePath");
|
currentFilePath = (String) params.get("directFilePath");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.currentClaim == null && params.containsKey("suggestedUrl")) {
|
||||||
|
Helper.setViewText(inputAddress, (String) params.get("suggestedUrl"));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// shouldn't actually happen
|
// shouldn't actually happen
|
||||||
cancelOnFatalCondition(getString(R.string.no_file_found));
|
cancelOnFatalCondition(getString(R.string.no_file_found));
|
||||||
|
@ -843,6 +847,7 @@ public class PublishFormFragment extends BaseFragment implements
|
||||||
}
|
}
|
||||||
|
|
||||||
Context context = getContext();
|
Context context = getContext();
|
||||||
|
Helper.setWunderbarValue(null, context);
|
||||||
if (context instanceof MainActivity) {
|
if (context instanceof MainActivity) {
|
||||||
MainActivity activity = (MainActivity) context;
|
MainActivity activity = (MainActivity) context;
|
||||||
LbryAnalytics.setCurrentScreen(activity, "Channel Form", "ChannelForm");
|
LbryAnalytics.setCurrentScreen(activity, "Channel Form", "ChannelForm");
|
||||||
|
|
|
@ -237,6 +237,7 @@ public class PublishFragment extends BaseFragment implements
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
Context context = getContext();
|
Context context = getContext();
|
||||||
|
Helper.setWunderbarValue(null, context);
|
||||||
if (context instanceof MainActivity) {
|
if (context instanceof MainActivity) {
|
||||||
MainActivity activity = (MainActivity) context;
|
MainActivity activity = (MainActivity) context;
|
||||||
LbryAnalytics.setCurrentScreen(activity, "Publish", "Publish");
|
LbryAnalytics.setCurrentScreen(activity, "Publish", "Publish");
|
||||||
|
@ -306,6 +307,7 @@ public class PublishFragment extends BaseFragment implements
|
||||||
if (context instanceof MainActivity) {
|
if (context instanceof MainActivity) {
|
||||||
Map<String, Object> params = new HashMap<>();
|
Map<String, Object> params = new HashMap<>();
|
||||||
params.put("galleryItem", item);
|
params.put("galleryItem", item);
|
||||||
|
params.put("suggestedUrl", getSuggestedPublishUrl());
|
||||||
((MainActivity) context).openFragment(PublishFormFragment.class, true, NavMenuItem.ID_ITEM_NEW_PUBLISH, params);
|
((MainActivity) context).openFragment(PublishFormFragment.class, true, NavMenuItem.ID_ITEM_NEW_PUBLISH, params);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -398,6 +400,14 @@ public class PublishFragment extends BaseFragment implements
|
||||||
).show();
|
).show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getSuggestedPublishUrl() {
|
||||||
|
Map<String, Object> params = getParams();
|
||||||
|
if (params != null && params.containsKey("suggestedUrl")) {
|
||||||
|
return (String) params.get("suggestedUrl");
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldHideGlobalPlayer() {
|
public boolean shouldHideGlobalPlayer() {
|
||||||
return true;
|
return true;
|
||||||
|
@ -414,6 +424,7 @@ public class PublishFragment extends BaseFragment implements
|
||||||
if (context instanceof MainActivity) {
|
if (context instanceof MainActivity) {
|
||||||
Map<String, Object> params = new HashMap<>();
|
Map<String, Object> params = new HashMap<>();
|
||||||
params.put("directFilePath", filePath);
|
params.put("directFilePath", filePath);
|
||||||
|
params.put("suggestedUrl", getSuggestedPublishUrl());
|
||||||
((MainActivity) context).openFragment(PublishFormFragment.class, true, NavMenuItem.ID_ITEM_NEW_PUBLISH, params);
|
((MainActivity) context).openFragment(PublishFormFragment.class, true, NavMenuItem.ID_ITEM_NEW_PUBLISH, params);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,6 +44,7 @@ import io.lbry.browser.tasks.wallet.TransactionListTask;
|
||||||
import io.lbry.browser.tasks.wallet.WalletAddressUnusedTask;
|
import io.lbry.browser.tasks.wallet.WalletAddressUnusedTask;
|
||||||
import io.lbry.browser.tasks.wallet.WalletSendTask;
|
import io.lbry.browser.tasks.wallet.WalletSendTask;
|
||||||
import io.lbry.browser.ui.BaseFragment;
|
import io.lbry.browser.ui.BaseFragment;
|
||||||
|
import io.lbry.browser.ui.publish.PublishFragment;
|
||||||
import io.lbry.browser.utils.Helper;
|
import io.lbry.browser.utils.Helper;
|
||||||
import io.lbry.browser.utils.Lbry;
|
import io.lbry.browser.utils.Lbry;
|
||||||
import io.lbry.browser.utils.LbryAnalytics;
|
import io.lbry.browser.utils.LbryAnalytics;
|
||||||
|
@ -239,6 +240,15 @@ public class WalletFragment extends BaseFragment implements SdkStatusListener, W
|
||||||
itemDecoration.setDrawable(ContextCompat.getDrawable(context, R.drawable.thin_divider));
|
itemDecoration.setDrawable(ContextCompat.getDrawable(context, R.drawable.thin_divider));
|
||||||
recentTransactionsList.addItemDecoration(itemDecoration);
|
recentTransactionsList.addItemDecoration(itemDecoration);
|
||||||
|
|
||||||
|
textEarnMoreTips.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
if (context instanceof MainActivity) {
|
||||||
|
((MainActivity) context).openFragment(PublishFragment.class, true, NavMenuItem.ID_ITEM_NEW_PUBLISH);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
buttonSignUp.setOnClickListener(new View.OnClickListener() {
|
buttonSignUp.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
|
|
Loading…
Reference in a new issue