replace dialogplus with bottomsheet
This commit is contained in:
parent
aa4be6b399
commit
7443ae3179
12
Makefile
12
Makefile
@ -1,4 +1,4 @@
|
||||
.PHONY: debug build release clean libs
|
||||
.PHONY: debug build release clean
|
||||
|
||||
default:
|
||||
|
||||
@ -8,21 +8,17 @@ lint:
|
||||
debug: build
|
||||
adb install -r ./app/build/outputs/apk/debug/app-debug.apk
|
||||
|
||||
build: libs
|
||||
build:
|
||||
ssh qemu '. .bash_aliases && cd /hostfs/vanilla && ./gradlew build -x lintVitalRelease -x lint'
|
||||
|
||||
release: clean libs
|
||||
release: clean
|
||||
ssh qemu '. .bash_aliases && cd /hostfs/vanilla && ./gradlew assembleRelease && cd ./app/build/outputs/apk/release && zipalign -v -p 4 app-release-unsigned.apk aligned.apk && /home/adrian/Android/build-tools/27.0.3/apksigner sign -ks /hostfs/.android.keystore --out final.apk aligned.apk'
|
||||
|
||||
clean:
|
||||
rm -rf ./app/build
|
||||
rm -rf ./libs ; git checkout libs
|
||||
|
||||
uninstall:
|
||||
adb uninstall ch.blinkenlights.android.vanilla
|
||||
|
||||
gce-nightly: libs
|
||||
gce-nightly:
|
||||
./gradlew assembleRelease && cd ./app/build/outputs/apk/release && zipalign -v -p 4 app-release-unsigned.apk aligned.apk && echo aaaaaa | apksigner sign -ks ~/.android.keystore --out nightly-signed.apk aligned.apk
|
||||
|
||||
libs:
|
||||
$(MAKE) -C libs
|
||||
|
@ -29,7 +29,7 @@ android {
|
||||
|
||||
dependencies {
|
||||
implementation 'com.android.support:support-core-ui:28.0.0'
|
||||
implementation project(':dialogplus')
|
||||
implementation 'com.android.support:design:28.0.0'
|
||||
compileOnly 'com.android.support:support-annotations:28.0.0'
|
||||
compileOnly 'junit:junit:4.12'
|
||||
}
|
||||
|
@ -22,13 +22,11 @@
|
||||
|
||||
package ch.blinkenlights.android.vanilla.ui;
|
||||
|
||||
import com.orhanobut.dialogplus.DialogPlus;
|
||||
import com.orhanobut.dialogplus.OnItemClickListener;
|
||||
|
||||
import ch.blinkenlights.android.vanilla.R;
|
||||
import ch.blinkenlights.android.vanilla.ThemeHelper;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.design.widget.BottomSheetDialog;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@ -40,6 +38,7 @@ import android.widget.ImageView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
|
||||
public class FancyMenu {
|
||||
/**
|
||||
* Title to use for this FancyMenu
|
||||
@ -171,28 +170,32 @@ public class FancyMenu {
|
||||
* @param y y-coord position hint
|
||||
*/
|
||||
public void show(View parent, float x, float y) {
|
||||
final Sheet sheet = new Sheet(mContext);
|
||||
final Adapter adapter = assembleAdapter(mItems);
|
||||
final OnItemClickListener listener = new OnItemClickListener() {
|
||||
final AdapterView.OnItemClickListener listener = new AdapterView.OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(DialogPlus dialog, Object object, View view, int position) {
|
||||
FancyMenuItem item = (FancyMenuItem)object;
|
||||
public void onItemClick(AdapterView<?> parent, View view, int pos, long id) {
|
||||
FancyMenuItem item = adapter.getItem(pos);
|
||||
if (!item.isSpacer()) {
|
||||
mCallback.onFancyItemSelected(item);
|
||||
}
|
||||
dialog.dismiss();
|
||||
sheet.dismiss();
|
||||
}
|
||||
};
|
||||
ListView list = new ListView(mContext);
|
||||
list.setAdapter(adapter);
|
||||
list.setOnItemClickListener(listener);
|
||||
list.setDivider(null);
|
||||
|
||||
// TODO: setHeader ?
|
||||
int bgColor = ThemeHelper.fetchThemeColor(mContext, android.R.attr.colorBackground);
|
||||
DialogPlus dialog = DialogPlus.newDialog(mContext)
|
||||
.setAdapter(adapter)
|
||||
.setOnItemClickListener(listener)
|
||||
.setExpanded(true)
|
||||
.setCancelable(true)
|
||||
.setContentBackgroundColor(bgColor)
|
||||
.create();
|
||||
dialog.show();
|
||||
sheet.setTitle(mTitle);
|
||||
sheet.setContentView(list);
|
||||
sheet.show();
|
||||
}
|
||||
|
||||
private class Sheet extends BottomSheetDialog {
|
||||
Sheet(Context context) {
|
||||
super(context);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,4 +0,0 @@
|
||||
default: dialogplus
|
||||
|
||||
dialogplus:
|
||||
git clone https://github.com/vanilla-music/dialogplus
|
@ -1,4 +1 @@
|
||||
include "app"
|
||||
include "dialogplus"
|
||||
|
||||
project(':dialogplus').projectDir = new File('./libs/dialogplus/dialogplus')
|
||||
|
Loading…
x
Reference in New Issue
Block a user