Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .idea/AndroidProjectSystem.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions .idea/appInsightsSettings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1,834 changes: 1,834 additions & 0 deletions .idea/caches/deviceStreaming.xml

Large diffs are not rendered by default.

18 changes: 1 addition & 17 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions .idea/deploymentTargetSelector.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 3 additions & 8 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/markdown.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions .idea/migrations.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

59 changes: 34 additions & 25 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 0 additions & 11 deletions .idea/modules.xml

This file was deleted.

8 changes: 8 additions & 0 deletions .idea/runConfigurations.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 15 additions & 9 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
apply plugin: 'com.android.application'
plugins {
id 'com.android.application'
}

android {
compileSdkVersion 24
buildToolsVersion "24.0.2"
namespace 'me.kareluo.popupmenuview'
compileSdk 34

defaultConfig {
applicationId "me.kareluo.popupmenuview"
minSdkVersion 14
targetSdkVersion 24
minSdk 21
targetSdk 34
versionCode 1
versionName "1.0"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
release {
minifyEnabled false
Expand All @@ -20,8 +25,9 @@ android {
}

dependencies {
compile 'com.android.support:appcompat-v7:24.2.1'
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile project(path: ':popmenu')
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation project(':popmenu')
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
}
9 changes: 5 additions & 4 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="me.kareluo.popupmenuview">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<activity
android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand All @@ -17,4 +18,4 @@
</activity>
</application>

</manifest>
</manifest>
85 changes: 37 additions & 48 deletions app/src/main/java/me/kareluo/popupmenuview/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import android.graphics.Path;
import android.graphics.RectF;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.view.menu.MenuBuilder;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.view.menu.MenuBuilder;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.RadioGroup;
Expand Down Expand Up @@ -131,57 +131,46 @@ public void onStopTrackingTouch(SeekBar seekBar) {

@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.btn_orientation:
if (mMenuView.getOrientation() == LinearLayout.HORIZONTAL) {
mMenuView.setOrientation(LinearLayout.VERTICAL);
mPopupMenuView.setOrientation(LinearLayout.VERTICAL);
mCustomMenuView.setOrientation(LinearLayout.VERTICAL);
} else {
mMenuView.setOrientation(LinearLayout.HORIZONTAL);
mPopupMenuView.setOrientation(LinearLayout.HORIZONTAL);
mCustomMenuView.setOrientation(LinearLayout.HORIZONTAL);
}
break;
case R.id.btn_show:
case R.id.btn_show1:
case R.id.btn_show2:
case R.id.btn_show3:
mPopupMenuView.show(v);
break;
case R.id.btn_custom:
mCustomMenuView.show(v);
break;
int id = v.getId();
if (id == R.id.btn_orientation) {
if (mMenuView.getOrientation() == LinearLayout.HORIZONTAL) {
mMenuView.setOrientation(LinearLayout.VERTICAL);
mPopupMenuView.setOrientation(LinearLayout.VERTICAL);
mCustomMenuView.setOrientation(LinearLayout.VERTICAL);
} else {
mMenuView.setOrientation(LinearLayout.HORIZONTAL);
mPopupMenuView.setOrientation(LinearLayout.HORIZONTAL);
mCustomMenuView.setOrientation(LinearLayout.HORIZONTAL);
}
} else if (id == R.id.btn_show || id == R.id.btn_show1 || id == R.id.btn_show2 || id == R.id.btn_show3) {
mPopupMenuView.show(v);
} else if (id == R.id.btn_custom) {
mCustomMenuView.show(v);
}
}

@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
switch (checkedId) {
case R.id.radio1:
mPopLayout.setSiteMode(PopLayout.SITE_LEFT);
mImgPopLayout.setSiteMode(PopLayout.SITE_LEFT);
mPopupMenuView.setSites(PopupView.SITE_LEFT, PopupView.SITE_TOP, PopupView.SITE_RIGHT, PopupView.SITE_BOTTOM);
mCustomMenuView.setSites(PopupView.SITE_LEFT, PopupView.SITE_TOP, PopupView.SITE_RIGHT, PopupView.SITE_BOTTOM);
break;
case R.id.radio2:
mPopLayout.setSiteMode(PopLayout.SITE_TOP);
mImgPopLayout.setSiteMode(PopLayout.SITE_TOP);
mPopupMenuView.setSites(PopupView.SITE_TOP, PopupView.SITE_RIGHT, PopupView.SITE_BOTTOM, PopupView.SITE_LEFT);
mCustomMenuView.setSites(PopupView.SITE_TOP, PopupView.SITE_RIGHT, PopupView.SITE_BOTTOM, PopupView.SITE_LEFT);
break;
case R.id.radio3:
mPopLayout.setSiteMode(PopLayout.SITE_RIGHT);
mImgPopLayout.setSiteMode(PopLayout.SITE_RIGHT);
mPopupMenuView.setSites(PopupView.SITE_RIGHT, PopupView.SITE_BOTTOM, PopupView.SITE_LEFT, PopupView.SITE_TOP);
mCustomMenuView.setSites(PopupView.SITE_RIGHT, PopupView.SITE_BOTTOM, PopupView.SITE_LEFT, PopupView.SITE_TOP);
break;
case R.id.radio4:
mPopLayout.setSiteMode(PopLayout.SITE_BOTTOM);
mImgPopLayout.setSiteMode(PopLayout.SITE_BOTTOM);
mPopupMenuView.setSites(PopupView.SITE_BOTTOM, PopupView.SITE_LEFT, PopupView.SITE_TOP, PopupView.SITE_RIGHT);
mCustomMenuView.setSites(PopupView.SITE_BOTTOM, PopupView.SITE_LEFT, PopupView.SITE_TOP, PopupView.SITE_RIGHT);
break;
if (checkedId == R.id.radio1) {
mPopLayout.setSiteMode(PopLayout.SITE_LEFT);
mImgPopLayout.setSiteMode(PopLayout.SITE_LEFT);
mPopupMenuView.setSites(PopupView.SITE_LEFT, PopupView.SITE_TOP, PopupView.SITE_RIGHT, PopupView.SITE_BOTTOM);
mCustomMenuView.setSites(PopupView.SITE_LEFT, PopupView.SITE_TOP, PopupView.SITE_RIGHT, PopupView.SITE_BOTTOM);
} else if (checkedId == R.id.radio2) {
mPopLayout.setSiteMode(PopLayout.SITE_TOP);
mImgPopLayout.setSiteMode(PopLayout.SITE_TOP);
mPopupMenuView.setSites(PopupView.SITE_TOP, PopupView.SITE_RIGHT, PopupView.SITE_BOTTOM, PopupView.SITE_LEFT);
mCustomMenuView.setSites(PopupView.SITE_TOP, PopupView.SITE_RIGHT, PopupView.SITE_BOTTOM, PopupView.SITE_LEFT);
} else if (checkedId == R.id.radio3) {
mPopLayout.setSiteMode(PopLayout.SITE_RIGHT);
mImgPopLayout.setSiteMode(PopLayout.SITE_RIGHT);
mPopupMenuView.setSites(PopupView.SITE_RIGHT, PopupView.SITE_BOTTOM, PopupView.SITE_LEFT, PopupView.SITE_TOP);
mCustomMenuView.setSites(PopupView.SITE_RIGHT, PopupView.SITE_BOTTOM, PopupView.SITE_LEFT, PopupView.SITE_TOP);
} else if (checkedId == R.id.radio4) {
mPopLayout.setSiteMode(PopLayout.SITE_BOTTOM);
mImgPopLayout.setSiteMode(PopLayout.SITE_BOTTOM);
mPopupMenuView.setSites(PopupView.SITE_BOTTOM, PopupView.SITE_LEFT, PopupView.SITE_TOP, PopupView.SITE_RIGHT);
mCustomMenuView.setSites(PopupView.SITE_BOTTOM, PopupView.SITE_LEFT, PopupView.SITE_TOP, PopupView.SITE_RIGHT);
}
}

Expand Down
Loading