Skip to content
Permalink
Browse files

Added Video support (only one tattoo project has it now), added Steem…

… and Golos links to copy/open
  • Loading branch information...
morphium committed Jul 17, 2017
1 parent 21666d0 commit a8318606462f85e88ca2a0cc89ad8b6f1a2487a5
@@ -55,7 +55,7 @@ android {
compileSdkVersion 25
versionCode 15

versionName "0.1.5-alpha"
versionName "0.1.6-alpha"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
@@ -1,10 +1,13 @@
package tattoo.gogo.app.gogo_android;

import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.graphics.Bitmap;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.design.widget.Snackbar;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.View;
@@ -39,17 +42,28 @@

private String mArtistName;

@BindView(R.id.tv_artwork_title) TextView tvTitle;
@BindView(R.id.ll_artwork_images) LinearLayout llImages;
@BindView(R.id.tv_artwork_made_date) TextView tvMadeDate;
@BindView(R.id.tv_artwork_made_published) TextView tvPublishedDate;
@BindView(R.id.iv_qr_gogotattoo) ImageView ivQRgogo;
@BindView(R.id.iv_qr_gogogithub) ImageView ivQRgithub;
@BindView(R.id.tv_gogo_link) TextView tvGogoLink;
@BindView(R.id.tv_github_link) TextView tvGithubLink;
@BindView(R.id.ll_artwork_nav) LinearLayout llNav;
@BindView(R.id.tv_previous) TextView tvPrevious;
@BindView(R.id.tv_next) TextView tvNext;
@BindView(R.id.tv_artwork_title)
TextView tvTitle;
@BindView(R.id.ll_artwork_images)
LinearLayout llImages;
@BindView(R.id.tv_artwork_made_date)
TextView tvMadeDate;
@BindView(R.id.tv_artwork_made_published)
TextView tvPublishedDate;
@BindView(R.id.iv_qr_gogotattoo)
ImageView ivQRgogo;
@BindView(R.id.iv_qr_gogogithub)
ImageView ivQRgithub;
@BindView(R.id.tv_gogo_link)
TextView tvGogoLink;
@BindView(R.id.tv_github_link)
TextView tvGithubLink;
@BindView(R.id.ll_artwork_nav)
LinearLayout llNav;
@BindView(R.id.tv_previous)
TextView tvPrevious;
@BindView(R.id.tv_next)
TextView tvNext;


private ArtWork mArtwork;
@@ -143,6 +157,45 @@ public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
return false;
});

menu.add(R.string.copy_link).setOnMenuItemClickListener(menuItem -> {
copyLink(makeLink(GogoConst.MAIN_URL));
return false;
});

menu.add(R.string.copy_link_github).setOnMenuItemClickListener(menuItem -> {
copyLink(GogoConst.GITHUB_URL);
return false;
});

if (!mArtwork.getVideosIpfs().isEmpty()) {
menu.add(R.string.watch_process_video).setOnMenuItemClickListener(menuItem -> {
copyLink(GogoConst.IPFS_GATEWAY_URL + mArtwork.getVideosIpfs().get(0));
return false;
});

}
if (mArtwork.getBlockchain() != null) {
if (mArtwork.getBlockchain().getSteem() != null)
menu.add(R.string.copy_link_steem).setOnMenuItemClickListener(menuItem -> {
copyLink(GogoConst.STEEMIT_URL + mArtwork.getBlockchain().getSteem());
return false;
});

if (mArtwork.getBlockchain().getGolos() != null)
menu.add(R.string.copy_link_golos).setOnMenuItemClickListener(menuItem -> {
copyLink(GogoConst.GOLOS_URL + mArtwork.getBlockchain().getGolos());
return false;
});
}
}

private void copyLink(String link) {
ClipboardManager clipboard = (ClipboardManager) getActivity().getSystemService(Context.CLIPBOARD_SERVICE);
ClipData clip = ClipData.newPlainText("app.gogo.tattoo", link);
clipboard.setPrimaryClip(clip);
Snackbar.make(mToolbar, link, Snackbar.LENGTH_LONG)
.setAction(R.string.open_url, v -> IntentUtils.opentUrl(getContext(), link))
.show();
}


@@ -176,12 +229,17 @@ public void onDetach() {
public interface OnArtistArtworkFragmentInteractionListener {

void savePhoto(String hash);

void shareOriginalPhoto(String hash);

void sharePhoto(View view, String text);

void sharePhotos(List<View> views, String text);

void navigateTo(String artworkName);

void showLoading();

void hideLoading();

void showContextMenu(ImageView iv, String hash, OnImageRefreshListener l);
@@ -208,8 +266,8 @@ protected void updateQRcodes() {
tvGithubLink.setOnClickListener(view -> IntentUtils.opentUrl(getActivity(), gogoGithubLink));

new AsyncTask<Void, Void, Boolean>() {
Bitmap qrGithubBitmap;
Bitmap qrGogoBitmap;
Bitmap qrGithubBitmap;
Bitmap qrGogoBitmap;

@Override
protected Boolean doInBackground(Void... params) {
@@ -11,6 +11,8 @@

protected static final String MAIN_URL = "http://gogo.tattoo/";
protected static final String GITHUB_URL = "https://gogotattoo.github.io/";
protected static final String STEEMIT_URL = "https://steemit.com/";
protected static final String GOLOS_URL = "https://golos.io/";
static final long ONE_MINUTE_IN_MILLIS = 60000; //millisecs
public static final String GOGO_TATTOO = "gogo.tattoo";
public static final int SHAKE_THRESHOLD = 800;
@@ -32,6 +32,8 @@
String image_ipfs = "";
@SerializedName("images_ipfs")
ArrayList<String> images_ipfs = new ArrayList<>();
@SerializedName("videos_ipfs")
ArrayList<String> videos_ipfs = new ArrayList<>();
@SerializedName("made_at_country")
String made_at_country = "China";
@SerializedName("made_at_city")
@@ -45,6 +47,8 @@
String extra = "";
String type = "";
String previous = "";
@SerializedName("blockchain")
Blockchain blockchain;

public ArtWork() {
}
@@ -58,6 +62,7 @@ protected ArtWork(Parcel in) {
bodypart = in.createStringArray();
image_ipfs = in.readString();
images_ipfs = in.createStringArrayList();
videos_ipfs = in.createStringArrayList();
made_at_country = in.readString();
made_at_city = in.readString();
made_at_shop = in.readString();
@@ -66,6 +71,7 @@ protected ArtWork(Parcel in) {
extra = in.readString();
type = in.readString();
previous = in.readString();
blockchain = in.readParcelable(Blockchain.class.getClassLoader());
}

public static final Creator<ArtWork> CREATOR = new Creator<ArtWork>() {
@@ -160,6 +166,14 @@ public void setImagesIpfs(ArrayList<String> images_ipfs) {
this.images_ipfs = images_ipfs;
}

public ArrayList<String> getVideosIpfs() {
return videos_ipfs;
}

public void setVideosIpfs(ArrayList<String> videos_ipfs) {
this.videos_ipfs = videos_ipfs;
}

public String getMadeAtCountry() {
return made_at_country;
}
@@ -220,6 +234,7 @@ public void writeToParcel(Parcel dest, int flags) {
dest.writeStringArray(bodypart);
dest.writeString(image_ipfs);
dest.writeStringList(images_ipfs);
dest.writeStringList(videos_ipfs);
dest.writeString(made_at_country);
dest.writeString(made_at_city);
dest.writeString(made_at_shop);
@@ -228,6 +243,7 @@ public void writeToParcel(Parcel dest, int flags) {
dest.writeString(extra);
dest.writeString(type);
dest.writeString(previous);
dest.writeParcelable(blockchain, 0);
}

public String getType() {
@@ -253,4 +269,13 @@ public int getId() {
public void setId(int id) {
this.id = id;
}

public Blockchain getBlockchain() {
return blockchain;
}

public void setBlockchain(Blockchain blockchain) {
this.blockchain = blockchain;
}

}
@@ -149,5 +149,6 @@ public void setAvatarIpfs(String avatarIpfs) {
String locationNow;
@SerializedName("avatar_ipfs")
String avatarIpfs;
String link;

}
@@ -0,0 +1,57 @@
package tattoo.gogo.app.gogo_android.model;

import android.os.Parcel;
import android.os.Parcelable;

import com.google.gson.annotations.SerializedName;

public class Blockchain implements Parcelable {
@SerializedName("steem")
private String steem;
@SerializedName("golos")
private String golos;

protected Blockchain(Parcel in) {
steem = in.readString();
golos = in.readString();
}

public static final Creator<Blockchain> CREATOR = new Creator<Blockchain>() {
@Override
public Blockchain createFromParcel(Parcel in) {
return new Blockchain(in);
}

@Override
public Blockchain[] newArray(int size) {
return new Blockchain[size];
}
};

public String getSteem() {
return steem;
}

public void setSteem(String steem) {
this.steem = steem;
}

public String getGolos() {
return golos;
}

public void setGolos(String golos) {
this.golos = golos;
}

@Override
public int describeContents() {
return 0;
}

@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(steem);
dest.writeString(golos);
}
}
@@ -55,4 +55,11 @@
<string name="delete">Delete</string>
<string name="previous_work"><![CDATA[< Previous]]></string>
<string name="next_work"><![CDATA[Next >]]></string>
<string name="copy_link">Copy link</string>
<string name="copy_link_github">Copy link (github)</string>
<string name="copy_success">Copied: %s</string>
<string name="copy_link_steem">Copy Steemit link</string>
<string name="copy_link_golos">Copy Golos link</string>
<string name="watch_process_video">Watch Video</string>
<string name="open_url">Open</string>
</resources>
@@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'
classpath 'com.android.tools.build:gradle:2.3.1'
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files

0 comments on commit a831860

Please sign in to comment.
You can’t perform that action at this time.