View style.xml
This file contains 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="RoundedButtonStyle" parent="Widget.MaterialComponents.Button"> | |
<item name="shapeAppearance">@style/RoundedButtonShapeAppearance</item> | |
... | |
</style> | |
<style name="RoundedButtonShapeAppearance"> | |
<item name="cornerFamilyTopLeft">rounded</item> | |
<item name="cornerFamilyBottomLeft">rounded</item> | |
<item name="cornerFamilyTopRight">rounded</item> | |
<item name="cornerFamilyBottomRight">rounded</item> |
View selector_one.xml
This file contains 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
<selector xmlns:android="http://schemas.android.com/apk/res/android"> | |
<item android:drawable="@drawable/button_bfr_round_light_disabled" android:state_enabled="false" /> | |
<item android:drawable="@drawable/button_bfr_round_light_unfocused" android:state_focused="false" android:state_pressed="false" android:state_selected="false" /> | |
<item android:drawable="@drawable/button_bfr_round_light_unfocused" android:state_focused="false" android:state_pressed="false" android:state_selected="true" /> | |
<item android:drawable="@drawable/button_bfr_round_light_pressed" android:state_pressed="true" /> | |
</selector> |
View MulipartRequest
This file contains 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
import android.util.Log; | |
import com.android.volley.AuthFailureError; | |
import com.android.volley.NetworkResponse; | |
import com.android.volley.ParseError; | |
import com.android.volley.Request; | |
import com.android.volley.Response; | |
import com.android.volley.VolleyLog; | |
import com.android.volley.toolbox.HttpHeaderParser; | |
import com.google.gson.Gson; |
View androidMultiplePermissions.java
This file contains 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
private void requestMultiplePermissions() { | |
String locationPermission = Manifest.permission.ACCESS_FINE_LOCATION; | |
String calendarPermission = Manifest.permission.WRITE_CALENDAR; | |
int hasLocPermission = checkSelfPermission(locationPermission); | |
int hasCalPermission = checkSelfPermission(calendarPermission); | |
List<String> permissions = new ArrayList<String>(); | |
if (hasLocPermission != PackageManager.PERMISSION_GRANTED) { | |
permissions.add(locationPermission); | |
} | |
if (hasCalPermission != PackageManager.PERMISSION_GRANTED) { |
View PostAdapter.java
This file contains 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 class PostAdapter extends RecyclerView.Adapter<PostAdapter.BindingHolder> { | |
private List<Post> mPosts; | |
private Context mContext; | |
private boolean mIsUserPosts; | |
public PostAdapter(Context context, boolean isUserPosts) { | |
mContext = context; | |
mIsUserPosts = isUserPosts; | |
mPosts = new ArrayList<>(); | |
} |
View androidSinglePermission.java
This file contains 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
private static final int REQUEST_LOCATION = 1503; | |
private void requestSinglePermission() { | |
String locationPermission = Manifest.permission.ACCESS_FINE_LOCATION; | |
int hasPermission = checkSelfPermission(locationPermission); | |
String[] permissions = new String[] { locationPermission }; | |
if (hasPermission != PackageManager.PERMISSION_GRANTED) { | |
requestPermissions(permissions, REQUEST_LOCATION); | |
} else { | |
// Phew - we already have permission! |
View androidPermissionResult.java
This file contains 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
@Override | |
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) { | |
switch (requestCode) { | |
case REQUEST_LOCATION: | |
if (grantResults[0] == PackageManager.PERMISSION_GRANTED) { | |
// Handle permission granted | |
} else { | |
// Handle permission denied | |
} | |
break; |
View DirectoryContents
This file contains 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
#! /bin/bash | |
path="./current/"; | |
assets="./assets/"; | |
files=( "$path"* ) | |
files=( "${files[@]##*/}" ) | |
for dir in $assets*; do | |
for file in "$dir"/*; do | |
filename="${file##*/}" |
View Build.gradle
This file contains 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
buildTypes { | |
release { | |
runProguard false | |
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | |
signingConfig signingConfigs.release | |
} | |
debug { | |
versionNameSuffix " Debug" | |
debuggable true | |
testCoverageEnabled = true |
View Post.java
This file contains 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 class Post { | |
public Long id; | |
public String by; | |
public Long time; | |
public ArrayList<Long> kids; | |
public String url; | |
public Long score; | |
public String title; | |
public String text; |
NewerOlder