Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
varundeva opened this issue Jan 3, 2019 · 78 comments
Open

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

varundeva opened this issue Jan 3, 2019 · 78 comments

Comments

@varundeva
Copy link

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
Copy link

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

@hariiprasad
Copy link

hariiprasad commented Jan 4, 2019

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

@varundeva
Copy link
Author

varundeva commented Jan 4, 2019 via email

@viztushar
Copy link
Owner

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
Copy link
Author

varundeva commented Jan 4, 2019 via email

@hariiprasad
Copy link

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

@varundeva
Copy link
Author

varundeva commented Jan 4, 2019 via email

@hariiprasad
Copy link

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

@viztushar
Copy link
Owner

@hariiprasad send me your json link.

@hariiprasad
Copy link

@hazarbozkurt
Copy link

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

@hariiprasad
Copy link

hariiprasad commented Jan 4, 2019

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

@hazarbozkurt
Copy link

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

here:
6ggclthosbccu_acvlvkva

@hazarbozkurt
Copy link

hazarbozkurt commented Jan 4, 2019

@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
Copy link

hariiprasad commented Jan 4, 2019

@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
Copy link

screenshot 95
screenshot 96

@hariiprasad
Copy link

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

@hazarbozkurt
Copy link

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
Copy link

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

No yet

@hariiprasad
Copy link

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

@Naynesh-Patel
Copy link

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
Copy link
Owner

viztushar commented Jan 6, 2019

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

@Naynesh-Patel
Copy link

i fully use your StickerProvider class

other code is mine

@Naynesh-Patel
Copy link

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
Copy link

Please tell me what you need exactly ?

So i give you

@Naynesh-Patel
Copy link

screenshot 26

Here i stop

@hariiprasad
Copy link

@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
Copy link
Owner

viztushar commented Jan 6, 2019

@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
Copy link

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

@Naynesh-Patel
Copy link

okay i got it

@Naynesh-Patel
Copy link

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

@viztushar
Copy link
Owner

@Naynesh-Patel device file explorer try to find that and in that go to data/data/your package name/....

@Naynesh-Patel
Copy link

ff

The Only Diffrence i found in my and your package name is you have added sticker_packs file when i did't.

@hariiprasad
Copy link

@viztushar broo sorry its working fine. there was a small mistake i have done in my json file.

@Naynesh-Patel
Copy link

@varundeva please tell me what i do next ?

@viztushar
Copy link
Owner

@Naynesh-Patel yah right so just add that in your path and it will work

@hazarbozkurt
Copy link

@viztushar broo sorry its working fine. there was a small mistake i have done in my json file.

Can you share how you solved your problem?

@hariiprasad
Copy link

hariiprasad commented Jan 7, 2019

@hazarbozkurt 😂😂 i have placed my files in some other directory. i was repeatedly checking only code not the links in json file.I later realized it.

@hazarbozkurt
Copy link

@hazarbozkurt 😂😂 i have placed my files in some other directory. i was repeatedly checking only code not the links in json file.I later realized it.

Unfortunately, I have the same problem. No stickers appear. I can't solve the problem.

@hariiprasad
Copy link

hariiprasad commented Jan 8, 2019

@hazarbozkurt bro you place your stickers having resolution 300*300 and less than 100kb in your own github directory ,upload one json file in your github,edit that and click on Raw button ,You will find one link, replace the link in strings values with that link in android studio, edit adapter file in your android studio project( replace the sticker base link with your own like (https:/raw.githubusercontent.com/jhonson/master/sticker/emoji.png if this your sticker location,,the base link in adapter should be https:/raw.githubusercontent.com/jhonson/master/sticker/ this.)) Do same with tray image also... Sorry for my bad english... I hope you understand

@Naynesh-Patel
Copy link

Hey

My Sticker Added Successfully,but when i add another sticker pack that that old sticker pack get remove and new pack added

Please tell me where is my mistake ?

@varundeva
Copy link
Author

varundeva commented Jan 17, 2019 via email

@Naynesh-Patel
Copy link

i am getting single single pack at a time

@varundeva
Copy link
Author

varundeva commented Jan 17, 2019 via email

@Naynesh-Patel
Copy link

Is There Any Problem With Key ??

I call api in StckerDetaisActivity

@Naynesh-Patel
Copy link

i am also adding sticker from gallery images..it also added but old one get remove when i added new

@hariiprasad
Copy link

@Naynesh-Patel hii ,you just add one more tray i.e add different identifier name and place your sticker links. it will work.

@Naynesh-Patel
Copy link

untitled

@Naynesh-Patel
Copy link

Two Sticker Pack :

23,27

Both have it own tray file and separate
location

@Naynesh-Patel
Copy link

screenshot_2019-01-25-13-31-19-940_com whatsapp

![Uploading Screenshot_2019-01-25-13-30-53-305_com.whatsapp.png…](

![Uploading Screenshot_2019-01-25-13-31-03-947_com.whatsapp.png…](

This is happening,old sticker replace with new one

@Naynesh-Patel
Copy link

screenshot_2019-01-25-13-31-03-947_com whatsapp
screenshot_2019-01-25-13-30-53-305_com whatsapp

@Naynesh-Patel
Copy link

Hey Any One Is Here To Help Me

I got the problem and looking for someone help

@Naynesh-Patel
Copy link

Your This Statement Is Call Only Once In Your App And In My Case I am adding single single pack.

Hawk.put("sticker_packs", stickerPacks);

So when i add new pack exting sticker pack replace with new one,so when i call This method

public List getStickerPackList() {
return (List)Hawk.get("sticker_packs",new ArrayList());
}

Every time it returns only single pack

Please give me idea how to add multiple sticker pack

@desaibijal
Copy link

@Naynesh-Patel have fix that issue? i got also same error

@Naynesh-Patel
Copy link

Yes i solved

@desaibijal
Copy link

desaibijal commented Feb 13, 2019

how to fix this problem @Naynesh-Patel

@desaibijal
Copy link

desaibijal commented Feb 13, 2019 via email

@Naynesh-Patel
Copy link

It's tough to explain here, because we have to change in many files... please pin me on my personal email [email protected]

I will explain in details

@desaibijal
Copy link

ok @Naynesh-Patel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants