This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SegmentView(context: Context, attrs: AttributeSet) : LinearLayout(context, attrs) { | |
init { | |
View.inflate(context, R.layout. segment_button, this); | |
val btnSeg1: Button = findViewById(R.id.button) | |
val btnSeg2: Button = findViewById(R.id.button2) | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let total = 0; | |
orders.forEach(order => total += order.value); | |
console.log(total); | |
///////////// Map function | |
let ordersWithShipping = orders.map(order => { | |
order.shipping = calculateShipping(order); | |
order.total = order.value + order.shipping; | |
return order; | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"name": "Afghanistan", | |
"dial_code": "+93", | |
"code": "AF" | |
}, | |
{ | |
"name": "Aland Islands", | |
"dial_code": "+358", | |
"code": "AX" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Module | |
public class NetModule { | |
String mBaseUrl; | |
// Constructor needs one parameter to instantiate. | |
public NetModule(String baseUrl) { | |
this.mBaseUrl = baseUrl; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public abstract class SwipeDismissBaseActivity extends AppCompatActivity { | |
private static final int SWIPE_MIN_DISTANCE = 120; | |
private static final int SWIPE_MAX_OFF_PATH = 250; | |
private static final int SWIPE_THRESHOLD_VELOCITY = 200; | |
private GestureDetector gestureDetector; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
gestureDetector = new GestureDetector(new SwipeDetector()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<resources> | |
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"> | |
<!-- Customize your theme here. --> | |
<item name="colorPrimary">@color/colorPrimary</item> | |
<item name="colorPrimaryDark">@color/colorPrimaryDark</item> | |
<item name="android:textColorSecondary">@color/secondary_text</item> | |
<item name="android:windowBackground">@color/windowBackground</item> | |
<item name="colorControlHighlight">@color/accent_translucent</item> | |
<item name="colorAccent">@color/pink</item> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<style name="MyMaterialTheme" parent="MyMaterialTheme.Base"> | |
<item name="android:windowContentTransitions">true</item> | |
<item name="android:textColorSecondary">@color/secondary_text</item> | |
<item name="android:windowAllowEnterTransitionOverlap">true</item> | |
<item name="android:windowAllowReturnTransitionOverlap">true</item> | |
<item name="android:windowSharedElementEnterTransition">@android:transition/move</item> | |
<item name="android:windowSharedElementExitTransition">@android:transition/move</item> | |
<item name="android:colorAccent">@color/pink</item> | |
<item name="colorControlHighlight">@color/accent_translucent</item> | |
<item name="android:typeface">serif</item> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Using reflection to override default typeface | |
* NOTICE: DO NOT FORGET TO SET TYPEFACE FOR APP THEME AS DEFAULT TYPEFACE WHICH WILL BE OVERRIDDEN | |
*Use | |
* @param context to work with assets | |
* @param defaultFontNameToOverride for example "monospace" | |
* @param customFontFileNameInAssets file name of the font from assets | |
*/ | |
public static void overrideFont(Context context, String defaultFontNameToOverride, String customFontFileNameInAssets) { | |
try { |
NewerOlder