viztushar / stickers-internet

37 stars 9 forks source link

Please Provide doc as well as some extra features details #6

Open varundeva opened 5 years ago

varundeva commented 5 years ago

I checked it working like boss add documentation or i tell me how to addd sticker pack details activity to it? now its now showing sticker publisher and etc information

hazarbozkurt commented 5 years ago

I guess the owner of the source code is busy these days. I'm looking forward to her.

hariiprasad commented 5 years ago

@hazarbozkurt hey bro what are the exactly changes i need to do with this source?

varundeva commented 5 years ago

I want exactly clone of WhatsApp sticker app by WhatsApp

On Fri 4 Jan, 2019, 7:26 AM Hari <notifications@github.com wrote:

@hazarbozkurt https://github.com/hazarbozkurt what are the exactly changes i need to do with this source?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/viztushar/stickers-internet/issues/6#issuecomment-451334601, or mute the thread https://github.com/notifications/unsubscribe-auth/AX8BPRRvYSGIbm_12LBed8tv45bfTt1cks5u_rTegaJpZM4ZnwCf .

viztushar commented 5 years ago

I'm too busy right now because of exam and other stuff so I'll do what all you want after I done with all stuff

varundeva commented 5 years ago

Ok

On Fri 4 Jan, 2019, 10:29 AM Tushar <notifications@github.com wrote:

I'm too busy right now because of exam and other stuff so I'll do what all you want after I done with all stuff

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/viztushar/stickers-internet/issues/6#issuecomment-451353854, or mute the thread https://github.com/notifications/unsubscribe-auth/AX8BPVBbS8CV538uXgSRz4GO-UTx3xKIks5u_t_IgaJpZM4ZnwCf .

hariiprasad commented 5 years ago

@varundeva Hey bro plz solve my problem.. Whenever i placed my stickers links in json file its not showing in app.

varundeva commented 5 years ago

Put link same as they showed in given Json file

On Fri 4 Jan, 2019, 8:39 PM Hari <notifications@github.com wrote:

@varundeva https://github.com/varundeva Hey bro plz solve my problem.. Whenever i placed my stickers links in json file its not showing in app.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/viztushar/stickers-internet/issues/6#issuecomment-451469803, or mute the thread https://github.com/notifications/unsubscribe-auth/AX8BPR8fypsbTmw7mH_4unGgYK0ytdlAks5u_26ggaJpZM4ZnwCf .

hariiprasad commented 5 years ago

@varundeva Broo then how can i add my stickers to app?

viztushar commented 5 years ago

@hariiprasad send me your json link.

hariiprasad commented 5 years ago

@viztushar bro here is the link https://gist.github.com/hariiprasad/4a2eddc021f52d71c9f87914df8904c0

hariiprasad commented 5 years ago

@viztushar sorry for late reply here is the raw link https://gist.githubusercontent.com/hariiprasad/4a2eddc021f52d71c9f87914df8904c0/raw/43862a5d343672a89912b8769017905621c5fac4/contents.json

hazarbozkurt commented 5 years ago

https://whatsappaero.com/contents.json My json file works fine.

hariiprasad commented 5 years ago

@hazarbozkurt broo where you added your own stickers links in json file???

hazarbozkurt commented 5 years ago

@hazarbozkurt broo where you added your stickers link???

here: 6ggclthosbccu_acvlvkva

hazarbozkurt commented 5 years ago

@viztushar sorry for late reply here is the raw link https://gist.githubusercontent.com/hariiprasad/4a2eddc021f52d71c9f87914df8904c0/raw/43862a5d343672a89912b8769017905621c5fac4/contents.json

Are you sure this part is right?

screenshot_5

The smallest mistake spoils everything. Can you try the sample json file?

hariiprasad commented 5 years ago

@hazarbozkurt yes it is correct bro .its just a single tray. i removed 2nd tray and i tried using sample json file also but didnt worked. i have replaced old json_link with my contents.json link in strings values also...

hariiprasad commented 5 years ago

screenshot 95 screenshot 96

hariiprasad commented 5 years ago

@hazarbozkurt bro did you tried with your own stickers links in json file?

hazarbozkurt commented 5 years ago

https://user-images.githubusercontent.com/42040267/50701275-4cf63c80-1073-11e9-9d3c-c9523d98c8b3.png

Before you can view sticker images, you must download them from the download button on the main screen.

(sorry for my bad English)

hazarbozkurt commented 5 years ago

@hazarbozkurt bro did you tried with your own stickers links in json file?

No yet

hariiprasad commented 5 years ago

@hazarbozkurt bro i have downloaded and i checked.still its not working.Once you plz check with your stickers link

Naynesh-Patel commented 5 years ago

I Exactly done what you have done.

But at the end of the add sticker pack to whatsapp it throw exception FileNotFound.

private AssetFileDescriptor fetchFile(@NonNull Uri uri, @NonNull AssetManager am, @NonNull String fileName, @NonNull String identifier) { try { File file; if(fileName.endsWith(".png")){ // file = new File(getContext().getFilesDir()+ "/" + "stickers_asset" + "/" + identifier + "/tray/", fileName); file = new File(Environment.getExternalStorageDirectory()+ "/" + "stickers_asset" + "/" + identifier + "/tray/", fileName); } else { file = new File(Environment.getExternalStorageDirectory()+ "/" + "stickers_asset" + "/" + identifier + "/", fileName); } if (!file.exists()) { Log.d("fetFile", "StickerPack dir not found"); } Log.d("fetchFile", "StickerPack " + file.getPath()); return new AssetFileDescriptor(ParcelFileDescriptor.open(file,ParcelFileDescriptor.MODE_READ_ONLY), 0L, -1L); } catch (IOException e) { Log.e(Objects.requireNonNull(getContext()).getPackageName(), "IOException when getting asset file, uri:" + uri, e); return null; } }

This Line Throw FileNotFound Exception

return new AssetFileDescriptor(ParcelFileDescriptor.open(file,ParcelFileDescriptor.MODE_READ_ONLY), 0L, -1L);

Please help me

viztushar commented 5 years ago

@Naynesh-Patel you are using my code?? Or you use just that part of the code in your app??

Naynesh-Patel commented 5 years ago

i fully use your StickerProvider class

other code is mine

Naynesh-Patel commented 5 years ago

Here Is My Download Sticker Code :

class DownloadSticker extends AsyncTask<String, Integer, List> { List rowItems; int noOfURLs;

    @Override
    protected List<RowItem> doInBackground(String... urls) {
        noOfURLs = urls.length;
        rowItems = new ArrayList<RowItem>();
        Bitmap map = null;
        for (String url : urls) {
            map = downloadImage(url);
            rowItems.add(new RowItem(map));
        }
        return rowItems;
    }

    private Bitmap downloadImage(String urlString) {
        int count = 0;
        Bitmap bitmap = null;
        URL url;
        InputStream inputStream = null;
        BufferedOutputStream outputStream = null;
        try {
            url = new URL(urlString);
            URLConnection connection = url.openConnection();
            int lenghtOfFile = connection.getContentLength();
            inputStream = new BufferedInputStream(url.openStream());
            ByteArrayOutputStream dataStream = new ByteArrayOutputStream();
            outputStream = new BufferedOutputStream(dataStream);
            byte data[] = new byte[512];
            long total = 0;

            while ((count = inputStream.read(data)) != -1) {
                total += count;
                publishProgress((int) ((total * 100) / lenghtOfFile));
                outputStream.write(data, 0, count);
            }
            outputStream.flush();

            BitmapFactory.Options bmOptions = new BitmapFactory.Options();
            bmOptions.outWidth=512;
            bmOptions.outHeight=512;
            bmOptions.inSampleSize = 1;

            byte[] bytes = dataStream.toByteArray();
            bitmap = BitmapFactory.decodeByteArray(bytes, 0, bytes.length, bmOptions);

            saveImage(bitmap, getLastBitFromUrl(url.toString()), stickerPack.identifier);
        } catch (MalformedURLException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            FileUtils.close(inputStream);
            FileUtils.close(outputStream);
        }
        return bitmap;
    }

    @Override
    protected void onProgressUpdate(Integer... values) {
        progressBar.setProgress(values[0]);
        tvPercentage.setText(values[0] + "%");
    }

    @Override
    protected void onPostExecute(List<RowItem> rowItems) {
        rltPercentage.setVisibility(View.GONE);
        btnDownload.setVisibility(View.VISIBLE);
        btnDownload.setText("Add To Whatsapp");
        btnDownload.setBackgroundResource(R.drawable.download_complete_bg);
        isDownloaded = true;
    }
}

Here Is My Save Sticker To Internal Storage Code :

public String path;

public void saveImage(Bitmap finalBitmap, String name, String identifier) {

    String root = path + "/" + identifier;
    File myDir = new File(root);
    myDir.mkdirs();
    String fname = name;
    fname = name.replace(".png","")
            .replace(".jpg","")
            .replace(" ","_") + ".webp";
    File file = new File(myDir, fname);
    if (file.exists()) file.delete();
    try {
        FileOutputStream out = new FileOutputStream(file);
        finalBitmap.compress(Bitmap.CompressFormat.WEBP, 90, out);
        out.flush();
        out.close();

    } catch (Exception e) {
        e.printStackTrace();
    }
}
Naynesh-Patel commented 5 years ago

Please tell me what you need exactly ?

So i give you

Naynesh-Patel commented 5 years ago

screenshot 26

Here i stop

hariiprasad commented 5 years ago

@viztushar Hey broo... In stickerAdapter jave file when i replaced trayimage link with my link.. its showing error like [ There's is a problem with this sticker pack] . Can you resolve this?.

viztushar commented 5 years ago

@Naynesh-Patel I guess you are saving image some where else and find in somewhere so that's why you are getting that error.

First check all image are save in same direction/location as you find in context provider.

Naynesh-Patel commented 5 years ago

@varundeva No i get same path at the save time and get time

Naynesh-Patel commented 5 years ago

@varundeva should i have send my code ?

viztushar commented 5 years ago

@Naynesh-Patel try to log it all locations and find what's wrong

Naynesh-Patel commented 5 years ago

okay i send my log details

viztushar commented 5 years ago

@hariiprasad just change base link for tryimage in adapter line 83.

Naynesh-Patel commented 5 years ago

save log

This Is Where Save Sticker And Tray Image

viztushar commented 5 years ago

@Naynesh-Patel now check which location you get in content provider. And then compare both links.

Naynesh-Patel commented 5 years ago

f

Both Time I Get Same Path

hariiprasad commented 5 years ago

@viztushar my tray image link in json file i have tried these links screenshot 100 screenshot 101

"tray_image_file": "https://raw.githubusercontent.com/hariiprasad/my-personal/master/emojis/icon.png",

viztushar commented 5 years ago

@Naynesh-Patel this log of json object right??

You have to check my code line number 128 check that method how I log the url that WhatsApp need and then check to your url.

viztushar commented 5 years ago

@hariiprasad still not working?? Check image is getting downloaded or not.

hariiprasad commented 5 years ago

@viztushar bro there is no problem with the stickers when i placed tray image link that you have provided. but when i changed my tray images links its showing there's is a problem with this sticker pack

Naynesh-Patel commented 5 years ago

Yes it download as it is in our format

but right now i unable to locate my com.classyclub.whatsappsticker package in android/data folder

Naynesh-Patel commented 5 years ago

i also not found your package name folder in my device

it may be invisible ?

viztushar commented 5 years ago

@hariiprasad then the image size is big may be.

viztushar commented 5 years ago

@Naynesh-Patel you can't get that location in phone you have to use android studio to check the location. Google it or you can find that in tool or in the right bottom part.

hariiprasad commented 5 years ago

@viztushar bro the image size is 96*96,7.36kb and png file

viztushar commented 5 years ago

@hariiprasad I need to check then.

Naynesh-Patel commented 5 years ago

@viztushar Please give me hint how i can check in android studio wheter my file is downloade din com.classyclub.whatsappsticker/files/stickes_assests/... folder or not ?

Naynesh-Patel commented 5 years ago

okay i got it

Naynesh-Patel commented 5 years ago

@varundeva but i did not found any folder in your package name as well as in my package name