Skip to content

Instantly share code, notes, and snippets.

View avipars's full-sized avatar
🎯
Focusing

Avi Parshan avipars

🎯
Focusing
View GitHub Profile
@avipars
avipars / layout.xml
Created April 13, 2018 11:22
Avoid Overlap RecyclerVIew
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
android:id="@+id/relative"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:context=".MainActivity"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
@avipars
avipars / mapping.bat
Created July 12, 2018 17:56
Batch Files for Android Developers
start "" C:\Users\currentuser\Desktop\converter\app\build\outputs\mapping\release
REM change file path accordingly
REM when you are using Proguard and want to traverse to the mapping.txt file for upload to the play store deobfuscation files but just don't have the energy to open it manually
@avipars
avipars / open_mapping.vbs
Created August 28, 2018 19:08
Medium Post: Proguard Script
Dim WshShell, BtnCode, strCurDir
REM open_url opens in chrome, it should be set to the URL where you can upload your Deobfuscation (Mapping) File on the Dev Console
open_url = "ENTER_URL_HERE"
Set WshShell = WScript.CreateObject("WScript.Shell")
BtnCode = WshShell.Popup("Open the mapping file", 7, "Mapping Android APK:", 4 + 32)
Select Case BtnCode
case 6 WshShell.run "chrome -url " &open_url
strCurDir = WshShell.CurrentDirectory
WshShell.run strCurDir & "\app\build\outputs\mapping\release"
case 7 WScript.Echo "Okay :("
@avipars
avipars / clock.xml
Last active October 25, 2018 18:08
Clock Animation
<?xml version="1.0" encoding="utf-8"?>
<animated-vector
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:aapt="http://schemas.android.com/aapt"
tools:targetApi="lollipop">
<aapt:attr name="android:drawable">
<vector
android:width="24dp"
android:height="24dp"
@avipars
avipars / MainActivity.java
Created October 25, 2018 18:08
Animated Vector
Drawable clockMove = clock.getDrawable();
if (clockMove instanceof Animatable) {
((Animatable) clockMove).start();
}
@avipars
avipars / MainActivity.java
Created October 28, 2019 05:44
MultiSelectListPreference
private Set getHiddenUnits = new HashSet<>();
List list;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
getHiddenUnits = App.getHiddenUnits();
if(!getHiddenUnits.isEmpty())
{
@avipars
avipars / item.xml
Created April 6, 2020 12:15
Badge for my app
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/relative"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:clickable="true"
android:focusable="true"
@avipars
avipars / Solution.java
Last active April 15, 2020 13:04
Java Code Answer for Number of Steps to Reduce a Number to Zero. https://link.medium.com/nqICUGZMH5
class Solution {
// article: https://link.medium.com/nqICUGZMH5
public int numberOfSteps (int num) {
int step = 0;
while(num!= 0)
{
if(num % 2 == 0) //even
{
step++;
num=num/2;
@avipars
avipars / AndroidMaifest.xml
Last active April 30, 2020 11:48
unitMeasure - Get Intents
<activity
android:name=".activities.Main"
android:configChanges="orientation"
android:label="@string/app_name"
android:resizeableActivity="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
@avipars
avipars / ic_launcher.xml
Created May 3, 2020 17:36
unitMeasure Icons
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>