diff --git a/.gitignore b/.gitignore index 7e6c454..f5eb1cf 100644 --- a/.gitignore +++ b/.gitignore @@ -7,7 +7,6 @@ /build /captures /.idea -/gradle # Built application files *.apk @@ -24,7 +23,6 @@ bin/ gen/ # Gradle files -.gradle/ build/ /*/build/ diff --git a/README.md b/README.md index 0647ee1..a5974d7 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ After that you can easily include the library in your **app** `build.gradle`: ```groovy dependencies { - compile 'com.github.anshulagarwal06:ExpandableMenu:master-SNAPSHOT' + compile 'com.github.anshulagarwal06:ExpandableMenu::v1.0' } ``` @@ -36,14 +36,45 @@ dependencies { Add ExpandableMenuView to your xml fule ```groovy - ``` - Most of xml attributes are self explanatory. + + +Add menu click callback in java - + +```groovy + + mExpandableMenuView.setOnMenuListener(new ExpandableMenuView.MenuListener() { + + @Override + public void rightPressed() { + } + + @Override + public void leftPressed() { + } + + @Override + public void topPressed() { + } + + @Override + public void bottomPressed() { + } + }); +``` + +-- + diff --git a/app/src/androidTest/java/android/anshul/com/fireview/ApplicationTest.java b/app/src/androidTest/java/android/anshul/com/fireview/ApplicationTest.java deleted file mode 100644 index 8eadb3d..0000000 --- a/app/src/androidTest/java/android/anshul/com/fireview/ApplicationTest.java +++ /dev/null @@ -1,13 +0,0 @@ -package android.anshul.com.fireview; - -import android.app.Application; -import android.test.ApplicationTestCase; - -/** - * Testing Fundamentals - */ -public class ApplicationTest extends ApplicationTestCase { - public ApplicationTest() { - super(Application.class); - } -} \ No newline at end of file diff --git a/app/src/main/java/android/anshul/com/expendableMenu/MainActivity.java b/app/src/main/java/android/anshul/com/expendableMenu/MainActivity.java deleted file mode 100644 index 5193f73..0000000 --- a/app/src/main/java/android/anshul/com/expendableMenu/MainActivity.java +++ /dev/null @@ -1,65 +0,0 @@ -package android.anshul.com.expendableMenu; - -import android.anshul.com.fireview.R; -import android.support.v7.app.ActionBarActivity; -import android.os.Bundle; -import android.view.Menu; -import android.view.MenuItem; -import android.widget.Toast; - - -public class MainActivity extends ActionBarActivity implements ExpandableMenuView.MenuListener { - - - private ExpandableMenuView mExpandableMenuView; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_main); - mExpandableMenuView = (ExpandableMenuView) findViewById(R.id.fire_view); - mExpandableMenuView.setOnMenuListener(this); - } - - @Override - public boolean onCreateOptionsMenu(Menu menu) { - // Inflate the menu; this adds items to the action bar if it is present. - getMenuInflater().inflate(R.menu.menu_main, menu); - return true; - } - - @Override - public boolean onOptionsItemSelected(MenuItem item) { - // Handle action bar item clicks here. The action bar will - // automatically handle clicks on the Home/Up button, so long - // as you specify a parent activity in AndroidManifest.xml. - int id = item.getItemId(); - - //noinspection SimplifiableIfStatement - if (id == R.id.action_settings) { - return true; - } - - return super.onOptionsItemSelected(item); - } - - @Override - public void rightPressed() { - Toast.makeText(this, "Right Pressed", Toast.LENGTH_SHORT).show(); - } - - @Override - public void leftPressed() { - Toast.makeText(this, "Left Pressed", Toast.LENGTH_SHORT).show(); - } - - @Override - public void topPressed() { - Toast.makeText(this, "Top Pressed", Toast.LENGTH_SHORT).show(); - } - - @Override - public void bottomPressed() { - Toast.makeText(this, "Bottom Pressed", Toast.LENGTH_SHORT).show(); - } -} diff --git a/app/src/main/res/menu/menu_main.xml b/app/src/main/res/menu/menu_main.xml deleted file mode 100644 index b1cb908..0000000 --- a/app/src/main/res/menu/menu_main.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml deleted file mode 100644 index 44b4ed9..0000000 --- a/app/src/main/res/values/strings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - FireView - - Hello world! - Settings - diff --git a/build.gradle b/build.gradle index c6f2f50..d5b7141 100644 --- a/build.gradle +++ b/build.gradle @@ -15,5 +15,6 @@ buildscript { allprojects { repositories { jcenter() + maven { url 'https://jitpack.io' } } } diff --git a/app/.gitignore b/demo/.gitignore similarity index 100% rename from app/.gitignore rename to demo/.gitignore diff --git a/app/build.gradle b/demo/build.gradle similarity index 77% rename from app/build.gradle rename to demo/build.gradle index ccfb36c..92d2db0 100644 --- a/app/build.gradle +++ b/demo/build.gradle @@ -20,6 +20,8 @@ android { } dependencies { - compile fileTree(dir: 'libs', include: ['*.jar']) - compile 'com.android.support:appcompat-v7:22.2.0' + compile fileTree(include: ['*.jar'], dir: 'libs') + compile 'com.android.support:appcompat-v7:25.0.0' + compile project(':library') + } diff --git a/app/app.iml b/demo/demo.iml similarity index 84% rename from app/app.iml rename to demo/demo.iml index c58242a..d594f4f 100644 --- a/app/app.iml +++ b/demo/demo.iml @@ -1,9 +1,9 @@ - + - @@ -62,13 +62,6 @@ - - - - - - - @@ -76,31 +69,43 @@ + + + + + + + - - + - - + - - - - + + + + + + + + + + + \ No newline at end of file diff --git a/app/proguard-rules.pro b/demo/proguard-rules.pro similarity index 100% rename from app/proguard-rules.pro rename to demo/proguard-rules.pro diff --git a/app/src/main/AndroidManifest.xml b/demo/src/main/AndroidManifest.xml similarity index 81% rename from app/src/main/AndroidManifest.xml rename to demo/src/main/AndroidManifest.xml index b750a39..e8c97db 100644 --- a/app/src/main/AndroidManifest.xml +++ b/demo/src/main/AndroidManifest.xml @@ -1,15 +1,15 @@ + package="android.anshul.com.fireview"> + android:theme="@style/AppTheme"> + android:label="@string/app_name"> diff --git a/demo/src/main/java/android/anshul/com/expendableMenu/MainActivity.java b/demo/src/main/java/android/anshul/com/expendableMenu/MainActivity.java new file mode 100644 index 0000000..234ae38 --- /dev/null +++ b/demo/src/main/java/android/anshul/com/expendableMenu/MainActivity.java @@ -0,0 +1,45 @@ +package android.anshul.com.expendableMenu; + +import android.anshul.com.fireview.R; +import android.os.Bundle; +import android.support.v7.app.AppCompatActivity; +import android.widget.Toast; +import me.anshulagarwal.expandablemenuoption.ExpandableMenuView; + + +public class MainActivity extends AppCompatActivity { + + private ExpandableMenuView mExpandableMenuView; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + + mExpandableMenuView = (ExpandableMenuView) findViewById(R.id.expanded_menu); + + mExpandableMenuView.setOnMenuListener(new ExpandableMenuView.MenuListener() { + + @Override + public void rightPressed() { + Toast.makeText(MainActivity.this, "Right Pressed", Toast.LENGTH_SHORT).show(); + } + + @Override + public void leftPressed() { + Toast.makeText(MainActivity.this, "Left Pressed", Toast.LENGTH_SHORT).show(); + } + + @Override + public void topPressed() { + Toast.makeText(MainActivity.this, "Top Pressed", Toast.LENGTH_SHORT).show(); + } + + @Override + public void bottomPressed() { + Toast.makeText(MainActivity.this, "Bottom Pressed", Toast.LENGTH_SHORT).show(); + } + }); + } + +} diff --git a/app/src/main/res/drawable-hdpi/camera.png b/demo/src/main/res/drawable-hdpi/camera.png similarity index 100% rename from app/src/main/res/drawable-hdpi/camera.png rename to demo/src/main/res/drawable-hdpi/camera.png diff --git a/app/src/main/res/drawable-hdpi/camera_selected.png b/demo/src/main/res/drawable-hdpi/camera_selected.png similarity index 100% rename from app/src/main/res/drawable-hdpi/camera_selected.png rename to demo/src/main/res/drawable-hdpi/camera_selected.png diff --git a/app/src/main/res/drawable-hdpi/ic_audio.png b/demo/src/main/res/drawable-hdpi/ic_audio.png similarity index 100% rename from app/src/main/res/drawable-hdpi/ic_audio.png rename to demo/src/main/res/drawable-hdpi/ic_audio.png diff --git a/app/src/main/res/drawable-hdpi/ic_doc.png b/demo/src/main/res/drawable-hdpi/ic_doc.png similarity index 100% rename from app/src/main/res/drawable-hdpi/ic_doc.png rename to demo/src/main/res/drawable-hdpi/ic_doc.png diff --git a/app/src/main/res/drawable-hdpi/ic_photo.png b/demo/src/main/res/drawable-hdpi/ic_photo.png similarity index 100% rename from app/src/main/res/drawable-hdpi/ic_photo.png rename to demo/src/main/res/drawable-hdpi/ic_photo.png diff --git a/app/src/main/res/drawable-hdpi/ic_video.png b/demo/src/main/res/drawable-hdpi/ic_video.png similarity index 100% rename from app/src/main/res/drawable-hdpi/ic_video.png rename to demo/src/main/res/drawable-hdpi/ic_video.png diff --git a/app/src/main/res/drawable-hdpi/location.png b/demo/src/main/res/drawable-hdpi/location.png similarity index 100% rename from app/src/main/res/drawable-hdpi/location.png rename to demo/src/main/res/drawable-hdpi/location.png diff --git a/app/src/main/res/drawable-hdpi/location_selected.png b/demo/src/main/res/drawable-hdpi/location_selected.png similarity index 100% rename from app/src/main/res/drawable-hdpi/location_selected.png rename to demo/src/main/res/drawable-hdpi/location_selected.png diff --git a/demo/src/main/res/drawable-hdpi/menu_icon.png b/demo/src/main/res/drawable-hdpi/menu_icon.png new file mode 100644 index 0000000..3e25b96 Binary files /dev/null and b/demo/src/main/res/drawable-hdpi/menu_icon.png differ diff --git a/app/src/main/res/drawable-hdpi/phone.png b/demo/src/main/res/drawable-hdpi/phone.png similarity index 100% rename from app/src/main/res/drawable-hdpi/phone.png rename to demo/src/main/res/drawable-hdpi/phone.png diff --git a/app/src/main/res/drawable-hdpi/phone_selected.png b/demo/src/main/res/drawable-hdpi/phone_selected.png similarity index 100% rename from app/src/main/res/drawable-hdpi/phone_selected.png rename to demo/src/main/res/drawable-hdpi/phone_selected.png diff --git a/app/src/main/res/drawable-hdpi/play.png b/demo/src/main/res/drawable-hdpi/play.png similarity index 100% rename from app/src/main/res/drawable-hdpi/play.png rename to demo/src/main/res/drawable-hdpi/play.png diff --git a/app/src/main/res/drawable-hdpi/play_selected.png b/demo/src/main/res/drawable-hdpi/play_selected.png similarity index 100% rename from app/src/main/res/drawable-hdpi/play_selected.png rename to demo/src/main/res/drawable-hdpi/play_selected.png diff --git a/app/src/main/res/drawable-hdpi/plus.png b/demo/src/main/res/drawable-hdpi/plus.png similarity index 100% rename from app/src/main/res/drawable-hdpi/plus.png rename to demo/src/main/res/drawable-hdpi/plus.png diff --git a/app/src/main/res/drawable-mdpi/camera.png b/demo/src/main/res/drawable-mdpi/camera.png similarity index 100% rename from app/src/main/res/drawable-mdpi/camera.png rename to demo/src/main/res/drawable-mdpi/camera.png diff --git a/app/src/main/res/drawable-mdpi/camera_selected.png b/demo/src/main/res/drawable-mdpi/camera_selected.png similarity index 100% rename from app/src/main/res/drawable-mdpi/camera_selected.png rename to demo/src/main/res/drawable-mdpi/camera_selected.png diff --git a/app/src/main/res/drawable-mdpi/ic_audio.png b/demo/src/main/res/drawable-mdpi/ic_audio.png similarity index 100% rename from app/src/main/res/drawable-mdpi/ic_audio.png rename to demo/src/main/res/drawable-mdpi/ic_audio.png diff --git a/app/src/main/res/drawable-mdpi/ic_doc.png b/demo/src/main/res/drawable-mdpi/ic_doc.png similarity index 100% rename from app/src/main/res/drawable-mdpi/ic_doc.png rename to demo/src/main/res/drawable-mdpi/ic_doc.png diff --git a/app/src/main/res/drawable-mdpi/ic_photo.png b/demo/src/main/res/drawable-mdpi/ic_photo.png similarity index 100% rename from app/src/main/res/drawable-mdpi/ic_photo.png rename to demo/src/main/res/drawable-mdpi/ic_photo.png diff --git a/app/src/main/res/drawable-mdpi/ic_video.png b/demo/src/main/res/drawable-mdpi/ic_video.png similarity index 100% rename from app/src/main/res/drawable-mdpi/ic_video.png rename to demo/src/main/res/drawable-mdpi/ic_video.png diff --git a/app/src/main/res/drawable-mdpi/location.png b/demo/src/main/res/drawable-mdpi/location.png similarity index 100% rename from app/src/main/res/drawable-mdpi/location.png rename to demo/src/main/res/drawable-mdpi/location.png diff --git a/app/src/main/res/drawable-mdpi/location_selected.png b/demo/src/main/res/drawable-mdpi/location_selected.png similarity index 100% rename from app/src/main/res/drawable-mdpi/location_selected.png rename to demo/src/main/res/drawable-mdpi/location_selected.png diff --git a/demo/src/main/res/drawable-mdpi/menu_icon.png b/demo/src/main/res/drawable-mdpi/menu_icon.png new file mode 100644 index 0000000..90cf5c4 Binary files /dev/null and b/demo/src/main/res/drawable-mdpi/menu_icon.png differ diff --git a/app/src/main/res/drawable-mdpi/phone.png b/demo/src/main/res/drawable-mdpi/phone.png similarity index 100% rename from app/src/main/res/drawable-mdpi/phone.png rename to demo/src/main/res/drawable-mdpi/phone.png diff --git a/app/src/main/res/drawable-mdpi/phone_selected.png b/demo/src/main/res/drawable-mdpi/phone_selected.png similarity index 100% rename from app/src/main/res/drawable-mdpi/phone_selected.png rename to demo/src/main/res/drawable-mdpi/phone_selected.png diff --git a/app/src/main/res/drawable-mdpi/play.png b/demo/src/main/res/drawable-mdpi/play.png similarity index 100% rename from app/src/main/res/drawable-mdpi/play.png rename to demo/src/main/res/drawable-mdpi/play.png diff --git a/app/src/main/res/drawable-mdpi/play_selected.png b/demo/src/main/res/drawable-mdpi/play_selected.png similarity index 100% rename from app/src/main/res/drawable-mdpi/play_selected.png rename to demo/src/main/res/drawable-mdpi/play_selected.png diff --git a/app/src/main/res/drawable-mdpi/plus.png b/demo/src/main/res/drawable-mdpi/plus.png similarity index 100% rename from app/src/main/res/drawable-mdpi/plus.png rename to demo/src/main/res/drawable-mdpi/plus.png diff --git a/app/src/main/res/drawable-xhdpi/camera.png b/demo/src/main/res/drawable-xhdpi/camera.png similarity index 100% rename from app/src/main/res/drawable-xhdpi/camera.png rename to demo/src/main/res/drawable-xhdpi/camera.png diff --git a/app/src/main/res/drawable-xhdpi/camera_selected.png b/demo/src/main/res/drawable-xhdpi/camera_selected.png similarity index 100% rename from app/src/main/res/drawable-xhdpi/camera_selected.png rename to demo/src/main/res/drawable-xhdpi/camera_selected.png diff --git a/app/src/main/res/drawable-xhdpi/ic_audio.png b/demo/src/main/res/drawable-xhdpi/ic_audio.png similarity index 100% rename from app/src/main/res/drawable-xhdpi/ic_audio.png rename to demo/src/main/res/drawable-xhdpi/ic_audio.png diff --git a/app/src/main/res/drawable-xhdpi/ic_doc.png b/demo/src/main/res/drawable-xhdpi/ic_doc.png similarity index 100% rename from app/src/main/res/drawable-xhdpi/ic_doc.png rename to demo/src/main/res/drawable-xhdpi/ic_doc.png diff --git a/app/src/main/res/drawable-xhdpi/ic_photo.png b/demo/src/main/res/drawable-xhdpi/ic_photo.png similarity index 100% rename from app/src/main/res/drawable-xhdpi/ic_photo.png rename to demo/src/main/res/drawable-xhdpi/ic_photo.png diff --git a/app/src/main/res/drawable-xhdpi/ic_video.png b/demo/src/main/res/drawable-xhdpi/ic_video.png similarity index 100% rename from app/src/main/res/drawable-xhdpi/ic_video.png rename to demo/src/main/res/drawable-xhdpi/ic_video.png diff --git a/app/src/main/res/drawable-xhdpi/location.png b/demo/src/main/res/drawable-xhdpi/location.png similarity index 100% rename from app/src/main/res/drawable-xhdpi/location.png rename to demo/src/main/res/drawable-xhdpi/location.png diff --git a/app/src/main/res/drawable-xhdpi/location_selected.png b/demo/src/main/res/drawable-xhdpi/location_selected.png similarity index 100% rename from app/src/main/res/drawable-xhdpi/location_selected.png rename to demo/src/main/res/drawable-xhdpi/location_selected.png diff --git a/demo/src/main/res/drawable-xhdpi/menu_icon.png b/demo/src/main/res/drawable-xhdpi/menu_icon.png new file mode 100644 index 0000000..4b412d1 Binary files /dev/null and b/demo/src/main/res/drawable-xhdpi/menu_icon.png differ diff --git a/app/src/main/res/drawable-xhdpi/phone.png b/demo/src/main/res/drawable-xhdpi/phone.png similarity index 100% rename from app/src/main/res/drawable-xhdpi/phone.png rename to demo/src/main/res/drawable-xhdpi/phone.png diff --git a/app/src/main/res/drawable-xhdpi/phone_selected.png b/demo/src/main/res/drawable-xhdpi/phone_selected.png similarity index 100% rename from app/src/main/res/drawable-xhdpi/phone_selected.png rename to demo/src/main/res/drawable-xhdpi/phone_selected.png diff --git a/app/src/main/res/drawable-xhdpi/play.png b/demo/src/main/res/drawable-xhdpi/play.png similarity index 100% rename from app/src/main/res/drawable-xhdpi/play.png rename to demo/src/main/res/drawable-xhdpi/play.png diff --git a/app/src/main/res/drawable-xhdpi/play_selected.png b/demo/src/main/res/drawable-xhdpi/play_selected.png similarity index 100% rename from app/src/main/res/drawable-xhdpi/play_selected.png rename to demo/src/main/res/drawable-xhdpi/play_selected.png diff --git a/app/src/main/res/drawable-xhdpi/plus.png b/demo/src/main/res/drawable-xhdpi/plus.png similarity index 100% rename from app/src/main/res/drawable-xhdpi/plus.png rename to demo/src/main/res/drawable-xhdpi/plus.png diff --git a/app/src/main/res/drawable-xxhdpi/camera.png b/demo/src/main/res/drawable-xxhdpi/camera.png similarity index 100% rename from app/src/main/res/drawable-xxhdpi/camera.png rename to demo/src/main/res/drawable-xxhdpi/camera.png diff --git a/app/src/main/res/drawable-xxhdpi/camera_selected.png b/demo/src/main/res/drawable-xxhdpi/camera_selected.png similarity index 100% rename from app/src/main/res/drawable-xxhdpi/camera_selected.png rename to demo/src/main/res/drawable-xxhdpi/camera_selected.png diff --git a/app/src/main/res/drawable-xxhdpi/ic_audio.png b/demo/src/main/res/drawable-xxhdpi/ic_audio.png similarity index 100% rename from app/src/main/res/drawable-xxhdpi/ic_audio.png rename to demo/src/main/res/drawable-xxhdpi/ic_audio.png diff --git a/app/src/main/res/drawable-xxhdpi/ic_doc.png b/demo/src/main/res/drawable-xxhdpi/ic_doc.png similarity index 100% rename from app/src/main/res/drawable-xxhdpi/ic_doc.png rename to demo/src/main/res/drawable-xxhdpi/ic_doc.png diff --git a/app/src/main/res/drawable-xxhdpi/ic_photo.png b/demo/src/main/res/drawable-xxhdpi/ic_photo.png similarity index 100% rename from app/src/main/res/drawable-xxhdpi/ic_photo.png rename to demo/src/main/res/drawable-xxhdpi/ic_photo.png diff --git a/app/src/main/res/drawable-xxhdpi/ic_video.png b/demo/src/main/res/drawable-xxhdpi/ic_video.png similarity index 100% rename from app/src/main/res/drawable-xxhdpi/ic_video.png rename to demo/src/main/res/drawable-xxhdpi/ic_video.png diff --git a/app/src/main/res/drawable-xxhdpi/location.png b/demo/src/main/res/drawable-xxhdpi/location.png similarity index 100% rename from app/src/main/res/drawable-xxhdpi/location.png rename to demo/src/main/res/drawable-xxhdpi/location.png diff --git a/app/src/main/res/drawable-xxhdpi/location_selected.png b/demo/src/main/res/drawable-xxhdpi/location_selected.png similarity index 100% rename from app/src/main/res/drawable-xxhdpi/location_selected.png rename to demo/src/main/res/drawable-xxhdpi/location_selected.png diff --git a/demo/src/main/res/drawable-xxhdpi/menu_icon.png b/demo/src/main/res/drawable-xxhdpi/menu_icon.png new file mode 100644 index 0000000..f8789cc Binary files /dev/null and b/demo/src/main/res/drawable-xxhdpi/menu_icon.png differ diff --git a/app/src/main/res/drawable-xxhdpi/phone.png b/demo/src/main/res/drawable-xxhdpi/phone.png similarity index 100% rename from app/src/main/res/drawable-xxhdpi/phone.png rename to demo/src/main/res/drawable-xxhdpi/phone.png diff --git a/app/src/main/res/drawable-xxhdpi/phone_selected.png b/demo/src/main/res/drawable-xxhdpi/phone_selected.png similarity index 100% rename from app/src/main/res/drawable-xxhdpi/phone_selected.png rename to demo/src/main/res/drawable-xxhdpi/phone_selected.png diff --git a/app/src/main/res/drawable-xxhdpi/play.png b/demo/src/main/res/drawable-xxhdpi/play.png similarity index 100% rename from app/src/main/res/drawable-xxhdpi/play.png rename to demo/src/main/res/drawable-xxhdpi/play.png diff --git a/app/src/main/res/drawable-xxhdpi/play_selected.png b/demo/src/main/res/drawable-xxhdpi/play_selected.png similarity index 100% rename from app/src/main/res/drawable-xxhdpi/play_selected.png rename to demo/src/main/res/drawable-xxhdpi/play_selected.png diff --git a/app/src/main/res/drawable-xxhdpi/plus.png b/demo/src/main/res/drawable-xxhdpi/plus.png similarity index 100% rename from app/src/main/res/drawable-xxhdpi/plus.png rename to demo/src/main/res/drawable-xxhdpi/plus.png diff --git a/app/src/main/res/drawable-xxxhdpi/ic_audio.png b/demo/src/main/res/drawable-xxxhdpi/ic_audio.png similarity index 100% rename from app/src/main/res/drawable-xxxhdpi/ic_audio.png rename to demo/src/main/res/drawable-xxxhdpi/ic_audio.png diff --git a/app/src/main/res/drawable-xxxhdpi/ic_doc.png b/demo/src/main/res/drawable-xxxhdpi/ic_doc.png similarity index 100% rename from app/src/main/res/drawable-xxxhdpi/ic_doc.png rename to demo/src/main/res/drawable-xxxhdpi/ic_doc.png diff --git a/app/src/main/res/drawable-xxxhdpi/ic_photo.png b/demo/src/main/res/drawable-xxxhdpi/ic_photo.png similarity index 100% rename from app/src/main/res/drawable-xxxhdpi/ic_photo.png rename to demo/src/main/res/drawable-xxxhdpi/ic_photo.png diff --git a/app/src/main/res/drawable-xxxhdpi/ic_video.png b/demo/src/main/res/drawable-xxxhdpi/ic_video.png similarity index 100% rename from app/src/main/res/drawable-xxxhdpi/ic_video.png rename to demo/src/main/res/drawable-xxxhdpi/ic_video.png diff --git a/app/src/main/res/drawable-xxxhdpi/plus.png b/demo/src/main/res/drawable-xxxhdpi/plus.png similarity index 100% rename from app/src/main/res/drawable-xxxhdpi/plus.png rename to demo/src/main/res/drawable-xxxhdpi/plus.png diff --git a/app/src/main/res/drawable/alarm_snooze_pressed.png b/demo/src/main/res/drawable/alarm_snooze_pressed.png similarity index 100% rename from app/src/main/res/drawable/alarm_snooze_pressed.png rename to demo/src/main/res/drawable/alarm_snooze_pressed.png diff --git a/app/src/main/res/drawable/camera_selector.xml b/demo/src/main/res/drawable/camera_selector.xml similarity index 100% rename from app/src/main/res/drawable/camera_selector.xml rename to demo/src/main/res/drawable/camera_selector.xml diff --git a/app/src/main/res/drawable/item_selector.xml b/demo/src/main/res/drawable/item_selector.xml similarity index 100% rename from app/src/main/res/drawable/item_selector.xml rename to demo/src/main/res/drawable/item_selector.xml diff --git a/app/src/main/res/drawable/location_selector.xml b/demo/src/main/res/drawable/location_selector.xml similarity index 100% rename from app/src/main/res/drawable/location_selector.xml rename to demo/src/main/res/drawable/location_selector.xml diff --git a/app/src/main/res/drawable/phone_selector.xml b/demo/src/main/res/drawable/phone_selector.xml similarity index 100% rename from app/src/main/res/drawable/phone_selector.xml rename to demo/src/main/res/drawable/phone_selector.xml diff --git a/app/src/main/res/drawable/play_selector.xml b/demo/src/main/res/drawable/play_selector.xml similarity index 100% rename from app/src/main/res/drawable/play_selector.xml rename to demo/src/main/res/drawable/play_selector.xml diff --git a/app/src/main/res/layout/activity_main.xml b/demo/src/main/res/layout/activity_main.xml similarity index 69% rename from app/src/main/res/layout/activity_main.xml rename to demo/src/main/res/layout/activity_main.xml index 4295a8e..67a8410 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/demo/src/main/res/layout/activity_main.xml @@ -7,15 +7,18 @@ android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" - tools:context=".MainActivity"> + tools:context="android.anshul.com.expendableMenu.MainActivity"> - - diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.png b/demo/src/main/res/mipmap-hdpi/ic_launcher.png similarity index 100% rename from app/src/main/res/mipmap-hdpi/ic_launcher.png rename to demo/src/main/res/mipmap-hdpi/ic_launcher.png diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.png b/demo/src/main/res/mipmap-mdpi/ic_launcher.png similarity index 100% rename from app/src/main/res/mipmap-mdpi/ic_launcher.png rename to demo/src/main/res/mipmap-mdpi/ic_launcher.png diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/demo/src/main/res/mipmap-xhdpi/ic_launcher.png similarity index 100% rename from app/src/main/res/mipmap-xhdpi/ic_launcher.png rename to demo/src/main/res/mipmap-xhdpi/ic_launcher.png diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/demo/src/main/res/mipmap-xxhdpi/ic_launcher.png similarity index 100% rename from app/src/main/res/mipmap-xxhdpi/ic_launcher.png rename to demo/src/main/res/mipmap-xxhdpi/ic_launcher.png diff --git a/app/src/main/res/values-w820dp/dimens.xml b/demo/src/main/res/values-w820dp/dimens.xml similarity index 100% rename from app/src/main/res/values-w820dp/dimens.xml rename to demo/src/main/res/values-w820dp/dimens.xml diff --git a/demo/src/main/res/values/color.xml b/demo/src/main/res/values/color.xml new file mode 100644 index 0000000..f7a2098 --- /dev/null +++ b/demo/src/main/res/values/color.xml @@ -0,0 +1,5 @@ + + + + #ffca28 + diff --git a/app/src/main/res/values/dimens.xml b/demo/src/main/res/values/dimens.xml similarity index 74% rename from app/src/main/res/values/dimens.xml rename to demo/src/main/res/values/dimens.xml index 653e88c..110047c 100644 --- a/app/src/main/res/values/dimens.xml +++ b/demo/src/main/res/values/dimens.xml @@ -4,6 +4,6 @@ 16dp 100dp - 40dp - 100dp + 60dp + 120dp diff --git a/demo/src/main/res/values/strings.xml b/demo/src/main/res/values/strings.xml new file mode 100644 index 0000000..4ac4626 --- /dev/null +++ b/demo/src/main/res/values/strings.xml @@ -0,0 +1,4 @@ + + Expandable MenuView Demo + Settings + diff --git a/app/src/main/res/values/styles.xml b/demo/src/main/res/values/styles.xml similarity index 100% rename from app/src/main/res/values/styles.xml rename to demo/src/main/res/values/styles.xml diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..13372ae Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..d78c6c0 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Wed Apr 12 14:58:49 IST 2017 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip diff --git a/library/.gitignore b/library/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/library/.gitignore @@ -0,0 +1 @@ +/build diff --git a/library/build.gradle b/library/build.gradle new file mode 100644 index 0000000..521966d --- /dev/null +++ b/library/build.gradle @@ -0,0 +1,30 @@ +apply plugin: 'com.android.library' +apply plugin: 'maven' + +group = 'com.github.anshulagarwal06' +android { + compileSdkVersion 25 + buildToolsVersion "25.0.2" + + defaultConfig { + minSdkVersion 14 + targetSdkVersion 25 + versionCode 1 + versionName "1.0" + + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } +} + +dependencies { + compile fileTree(dir: 'libs', include: ['*.jar']) + androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { + exclude group: 'com.android.support', module: 'support-annotations' + }) + compile 'com.android.support:appcompat-v7:25.3.0' +} diff --git a/library/library.iml b/library/library.iml new file mode 100644 index 0000000..988339e --- /dev/null +++ b/library/library.iml @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/library/proguard-rules.pro b/library/proguard-rules.pro new file mode 100644 index 0000000..04ab158 --- /dev/null +++ b/library/proguard-rules.pro @@ -0,0 +1,25 @@ +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in /Users/Anshul/Library/Android/sdk/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the proguardFiles +# directive in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile diff --git a/library/src/androidTest/java/me/anshulagarwal/expandablemenuoption/ExampleInstrumentedTest.java b/library/src/androidTest/java/me/anshulagarwal/expandablemenuoption/ExampleInstrumentedTest.java new file mode 100644 index 0000000..56dd678 --- /dev/null +++ b/library/src/androidTest/java/me/anshulagarwal/expandablemenuoption/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package me.anshulagarwal.expandablemenuoption; + +import android.content.Context; +import android.support.test.InstrumentationRegistry; +import android.support.test.runner.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.*; + +/** + * Instrumentation test, which will execute on an Android device. + * + * @see Testing documentation + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() throws Exception { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getTargetContext(); + + assertEquals("me.anshulagarwal.expandablemenuoption.test", appContext.getPackageName()); + } +} diff --git a/library/src/main/AndroidManifest.xml b/library/src/main/AndroidManifest.xml new file mode 100644 index 0000000..ee87671 --- /dev/null +++ b/library/src/main/AndroidManifest.xml @@ -0,0 +1,12 @@ + + + + + + + diff --git a/app/src/main/java/android/anshul/com/expendableMenu/ExpandableMenuView.java b/library/src/main/java/me/anshulagarwal/expandablemenuoption/ExpandableMenuView.java similarity index 91% rename from app/src/main/java/android/anshul/com/expendableMenu/ExpandableMenuView.java rename to library/src/main/java/me/anshulagarwal/expandablemenuoption/ExpandableMenuView.java index 115dc58..98217f3 100644 --- a/app/src/main/java/android/anshul/com/expendableMenu/ExpandableMenuView.java +++ b/library/src/main/java/me/anshulagarwal/expandablemenuoption/ExpandableMenuView.java @@ -1,26 +1,21 @@ -package android.anshul.com.expendableMenu; +package me.anshulagarwal.expandablemenuoption; import android.animation.ValueAnimator; import android.annotation.TargetApi; -import android.anshul.com.fireview.R; import android.content.Context; -import android.content.res.Resources; import android.content.res.TypedArray; -import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.drawable.Drawable; +import android.support.annotation.ColorRes; +import android.support.annotation.DimenRes; +import android.support.annotation.DrawableRes; import android.util.AttributeSet; -import android.util.TypedValue; import android.view.MotionEvent; import android.view.View; import android.view.animation.AccelerateInterpolator; -import android.view.animation.AnticipateOvershootInterpolator; -import android.view.animation.BounceInterpolator; import android.view.animation.LinearInterpolator; -import java.util.ArrayList; - /** * Created by Anshul on 10/07/15. */ @@ -69,6 +64,7 @@ public ExpandableMenuView(Context context, AttributeSet attrs, int defStyleAttr) initView(context, attrs); } + @TargetApi(21) public ExpandableMenuView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { super(context, attrs, defStyleAttr, defStyleRes); initView(context, attrs); @@ -77,6 +73,11 @@ public ExpandableMenuView(Context context, AttributeSet attrs, int defStyleAttr, private void initView(Context context, AttributeSet attrs) { + @ColorRes int colorRes = R.color.circle_color; + + @DimenRes int smallRadius = R.dimen.com_expandable_small_radius; + @DimenRes int bigRadius = R.dimen.com_expandable_big_radius; + @DrawableRes int menuDrawable = R.drawable.plus; if (attrs != null) { TypedArray typedArray = getContext().getTheme().obtainStyledAttributes( attrs, @@ -101,19 +102,27 @@ private void initView(Context context, AttributeSet attrs) { updateDrawableSize(mLeftDrawable.getIntrinsicWidth(), mLeftDrawable.getIntrinsicHeight()); } + colorRes = typedArray.getResourceId(R.styleable.expendableMenu_menu_color, R.color.circle_color); + smallRadius = typedArray.getResourceId(R.styleable.expendableMenu_menu_radius, R.dimen.com_expandable_small_radius); + bigRadius = typedArray.getResourceId(R.styleable.expendableMenu_menu_expanded_radius, R.dimen.com_expandable_big_radius); + menuDrawable = typedArray.getResourceId(R.styleable.expendableMenu_menu_drawable, R.drawable.plus); + } finally { typedArray.recycle(); typedArray = null; } } + + mCenterDrawable = getResources().getDrawable(menuDrawable); + setDrawableBound(); mCirclePaint = new Paint(); - mCirclePaint.setColor(getResources().getColor(R.color.circle_color)); + mCirclePaint.setColor(getResources().getColor(colorRes)); mCirclePaint.setStyle(Paint.Style.FILL); - mSmallRadius = getResources().getDimensionPixelSize(R.dimen.small_radius); - mBigRadius = getResources().getDimensionPixelSize(R.dimen.big_radius); + mSmallRadius = getResources().getDimensionPixelOffset(smallRadius); + mBigRadius = getResources().getDimensionPixelOffset(bigRadius); mRadius = mSmallRadius; mExpendAnimation = ValueAnimator.ofFloat(mSmallRadius, mBigRadius - 20); @@ -153,6 +162,9 @@ private void setDrawableBound() { if (mTopDrawable != null) { mTopDrawable.setBounds(0, 0, mDrawableWidth, mDrawableHeight); } + + mCenterDrawable.setBounds(0, 0, mCenterDrawable.getIntrinsicWidth(), mCenterDrawable.getIntrinsicHeight()); + } @TargetApi(22) @@ -270,8 +282,8 @@ protected void onDraw(Canvas canvas) { @Override protected void onAttachedToWindow() { super.onAttachedToWindow(); - mCenterDrawable = getResources().getDrawable(R.drawable.item_selector); - mCenterDrawable.setBounds(0, 0, mCenterDrawable.getIntrinsicWidth(), mCenterDrawable.getIntrinsicHeight()); + // mCenterDrawable = getResources().getDrawable(R.drawable.item_selector); + // mCenterDrawable.setBounds(0, 0, mCenterDrawable.getIntrinsicWidth(), mCenterDrawable.getIntrinsicHeight()); } @Override diff --git a/library/src/main/res/drawable-hdpi/plus.png b/library/src/main/res/drawable-hdpi/plus.png new file mode 100644 index 0000000..1ae5b2d Binary files /dev/null and b/library/src/main/res/drawable-hdpi/plus.png differ diff --git a/library/src/main/res/drawable-mdpi/plus.png b/library/src/main/res/drawable-mdpi/plus.png new file mode 100644 index 0000000..d51f0dd Binary files /dev/null and b/library/src/main/res/drawable-mdpi/plus.png differ diff --git a/library/src/main/res/drawable-xhdpi/plus.png b/library/src/main/res/drawable-xhdpi/plus.png new file mode 100644 index 0000000..9ea0eeb Binary files /dev/null and b/library/src/main/res/drawable-xhdpi/plus.png differ diff --git a/library/src/main/res/drawable-xxhdpi/plus.png b/library/src/main/res/drawable-xxhdpi/plus.png new file mode 100644 index 0000000..75f192a Binary files /dev/null and b/library/src/main/res/drawable-xxhdpi/plus.png differ diff --git a/app/src/main/res/values/attrs.xml b/library/src/main/res/values/attrs.xml similarity index 61% rename from app/src/main/res/values/attrs.xml rename to library/src/main/res/values/attrs.xml index 1433ebf..3ce5e87 100644 --- a/app/src/main/res/values/attrs.xml +++ b/library/src/main/res/values/attrs.xml @@ -1,11 +1,13 @@ - + - + + + diff --git a/app/src/main/res/values/color.xml b/library/src/main/res/values/color.xml similarity index 100% rename from app/src/main/res/values/color.xml rename to library/src/main/res/values/color.xml diff --git a/library/src/main/res/values/dimens.xml b/library/src/main/res/values/dimens.xml new file mode 100644 index 0000000..a7ee6da --- /dev/null +++ b/library/src/main/res/values/dimens.xml @@ -0,0 +1,9 @@ + + + 16dp + 16dp + + 100dp + 40dp + 80dp + diff --git a/library/src/main/res/values/strings.xml b/library/src/main/res/values/strings.xml new file mode 100644 index 0000000..7dcff2c --- /dev/null +++ b/library/src/main/res/values/strings.xml @@ -0,0 +1,3 @@ + + ExpandableMenuOption + diff --git a/library/src/test/java/me/anshulagarwal/expandablemenuoption/ExampleUnitTest.java b/library/src/test/java/me/anshulagarwal/expandablemenuoption/ExampleUnitTest.java new file mode 100644 index 0000000..80ad2f8 --- /dev/null +++ b/library/src/test/java/me/anshulagarwal/expandablemenuoption/ExampleUnitTest.java @@ -0,0 +1,17 @@ +package me.anshulagarwal.expandablemenuoption; + +import org.junit.Test; + +import static org.junit.Assert.*; + +/** + * Example local unit test, which will execute on the development machine (host). + * + * @see Testing documentation + */ +public class ExampleUnitTest { + @Test + public void addition_isCorrect() throws Exception { + assertEquals(4, 2 + 2); + } +} \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index e7b4def..462ba77 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1 +1 @@ -include ':app' +include ':demo', ':library'