Skip to content

Commit a2172e4

Browse files
committed
Improve Javadoc for all the library java classes
1 parent 04d0248 commit a2172e4

File tree

3 files changed

+106
-12
lines changed

3 files changed

+106
-12
lines changed

reactbutton/src/main/java/com/amrdeveloper/reactbutton/ReactButton.java

Lines changed: 52 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,27 @@
1+
/*
2+
* MIT License
3+
*
4+
* Copyright (c) 2018 AmrDeveloper (Amr Hesham)
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in all
14+
* copies or substantial portions of the Software.
15+
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
* SOFTWARE.
23+
*/
24+
125
package com.amrdeveloper.reactbutton;
226

327
import android.annotation.SuppressLint;
@@ -30,6 +54,12 @@
3054
import java.util.Arrays;
3155
import java.util.List;
3256

57+
/**
58+
* ReactButton custom class based on Button View
59+
*
60+
* Provide like and unlike feature depend on use single click
61+
* and reactions dialog feature when user provide long click event
62+
*/
3363
@SuppressLint("AppCompatCustomView")
3464
public class ReactButton
3565
extends Button
@@ -119,7 +149,6 @@ public class ReactButton
119149
*/
120150
private static final int ICON_SIZE_WITH_PADDING = 45 + ICON_PADDING;
121151

122-
123152
/**
124153
* Full reaction icon size converted from dp
125154
*/
@@ -309,35 +338,40 @@ private void updateReactButtonByReaction(Reaction react) {
309338
}
310339

311340
/**
312-
* @param drawableShape set xml Shape for react dialog layout
341+
* Modify the reactions dialog layout shape
342+
* @param drawableShape the new xml shape
313343
*/
314344
public void setReactionDialogShape(@DrawableRes int drawableShape) {
315345
this.mReactDialogShape = drawableShape;
316346
}
317347

318348
/**
319-
* @param offset from the reaction icon
349+
* Modify the tooltip offset from the reaction icon
350+
* @param offset the new tooltip offset value
320351
*/
321352
public void setTooltipOffsetFromReaction(int offset) {
322353
mTooltipOffsetFromReaction = offset;
323354
}
324355

325356
/**
326-
* @param color tooltip text color
357+
* Modify the tooltip text color
358+
* @param color the new text color value
327359
*/
328360
public void setReactionTooltipTextColor(@ColorInt int color) {
329361
mReactTooltipTextColor = color;
330362
}
331363

332364
/**
333-
* @param drawableShape tooltip shape for the layout
365+
* Modify the tooltip layout shape
366+
* @param drawableShape the new xml shape
334367
*/
335368
public void setReactionTooltipShape(@DrawableRes int drawableShape) {
336369
mReactTooltipShape = drawableShape;
337370
}
338371

339372
/**
340-
* @param isEnable enable/disable the reactions tooltip feature
373+
* Enable or disable the reactions tooltip feature
374+
* @param isEnable True to enable reactions tooltip feature
341375
*/
342376
public void setEnableReactionTooltip(boolean isEnable) {
343377
enableReactionTooltip = isEnable;
@@ -355,6 +389,7 @@ public void setReactions(Reaction... reactions) {
355389
/**
356390
* Append new reactions to the current reactions list
357391
* @param reactions Array of Reactions
392+
* @since 2.1.0
358393
*/
359394
public void addReactions(Reaction... reactions) {
360395
mReactions.addAll(Arrays.asList(reactions));
@@ -363,21 +398,24 @@ public void addReactions(Reaction... reactions) {
363398
}
364399

365400
/**
366-
* @param reaction set This Reaction as current Reaction
401+
* Modify the current reactions with new one
402+
* @param reaction new reactions to set as a current reaction
367403
*/
368404
public void setCurrentReaction(Reaction reaction) {
369405
updateReactButtonByReaction(reaction);
370406
}
371407

372408
/**
373-
* @return The Current reaction Object
409+
* Return the current reaction object
410+
* @return The Current reaction
374411
*/
375412
public Reaction getCurrentReaction() {
376413
return mCurrentReaction;
377414
}
378415

379416
/**
380-
* @param reaction Update library default Reaction by other Reaction
417+
* Update the default Reaction by other Reaction
418+
* @param reaction the new reaction be to set as a default reaction
381419
*/
382420
public void setDefaultReaction(Reaction reaction) {
383421
mDefaultReaction = reaction;
@@ -386,20 +424,23 @@ public void setDefaultReaction(Reaction reaction) {
386424
}
387425

388426
/**
389-
* @return The current default Reaction object
427+
* Return the default reaction object
428+
* @return The default Reaction
390429
*/
391430
public Reaction getDefaultReaction() {
392431
return mDefaultReaction;
393432
}
394433

395434
/**
396-
* @param number the number of reactions dialog columns
435+
* Modify the columns number for the reactions dialog
436+
* @param number the new columns number valud
397437
*/
398438
public void setDialogColumnsNumber(int number) {
399439
if (number > 0) mDialogColumnsNumber = number;
400440
}
401441

402442
/**
443+
* Modify the reactions dialog dim amount value
403444
* @param amount The new dim amount, from 0 for no dim to 1 for full dim.
404445
*/
405446
public void setDimAmount(float amount) {

reactbutton/src/main/java/com/amrdeveloper/reactbutton/Reaction.java

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,34 @@
1+
/*
2+
* MIT License
3+
*
4+
* Copyright (c) 2018 AmrDeveloper (Amr Hesham)
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in all
14+
* copies or substantial portions of the Software.
15+
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
* SOFTWARE.
23+
*/
24+
125
package com.amrdeveloper.reactbutton;
226

327
import java.util.Arrays;
428

29+
/**
30+
* Reaction model class used to store information for each reaction
31+
*/
532
public class Reaction {
633

734
private final String reactText;

reactbutton/src/main/java/com/amrdeveloper/reactbutton/ReactionAdapter.java

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,30 @@
1+
/*
2+
* MIT License
3+
*
4+
* Copyright (c) 2018 AmrDeveloper (Amr Hesham)
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in all
14+
* copies or substantial portions of the Software.
15+
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
* SOFTWARE.
23+
*/
24+
125
package com.amrdeveloper.reactbutton;
226

327
import android.content.Context;
4-
import android.util.Log;
528
import android.view.LayoutInflater;
629
import android.view.View;
730
import android.view.ViewGroup;
@@ -13,6 +36,9 @@
1336

1437
import java.util.List;
1538

39+
/**
40+
* Custom ArrayAdapter used to handle the reactions list inside the reactions dialog layout
41+
*/
1642
public class ReactionAdapter extends ArrayAdapter<Reaction> {
1743

1844
public ReactionAdapter(@NonNull Context context, @NonNull List<Reaction> reactions) {

0 commit comments

Comments
 (0)