mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-09-02 09:45:31 +00:00
Improve appearance of the Android preferences screen
* .gitignore: Add org/gnu/emacs/R.java. * cross/Makefile.in (top_builddir): Include verbose.mk. Rewrite rules to print nice looking statements. * doc/emacs/android.texi (Android, Android Startup) (Android Environment, Android Windowing, Android Fonts): * doc/emacs/emacs.texi (Top): Add an extra ``Android Troubleshooting'' node and move troubleshooting details there. * java/Makefile.in: Generate R.java; improve appearance by using verbose.mk. * java/org/gnu/emacs/EmacsPreferencesActivity.java: Reimplement in terms of PreferencesActivity. * java/org/gnu/emacs/EmacsView.java (handleDirtyBitmap): Avoid flicker. * java/res/xml/preferences.xml: New file. * src/verbose.mk.in (AM_V_AAPT, AM_V_SILENT): New variables.
This commit is contained in:
parent
2489126e68
commit
dc120c7ad6
9 changed files with 280 additions and 153 deletions
5
.gitignore
vendored
5
.gitignore
vendored
|
@ -57,12 +57,15 @@ src/emacs-module.h
|
|||
!INSTALL.android
|
||||
!verbose.mk.android
|
||||
|
||||
# Built by `java'.
|
||||
# Built by `javac'.
|
||||
java/install_temp/*
|
||||
java/*.apk*
|
||||
java/*.dex
|
||||
java/org/gnu/emacs/*.class
|
||||
|
||||
# Built by `aapt'.
|
||||
java/org/gnu/emacs/R.java
|
||||
|
||||
# Built by `config.status'.
|
||||
java/AndroidManifest.xml
|
||||
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
top_srcdir = @top_srcdir@
|
||||
top_builddir = @top_builddir@
|
||||
|
||||
-include $(top_builddir)/src/verbose.mk
|
||||
|
||||
# Cross-compiling Emacs for Android.
|
||||
|
||||
# The cross compiled binaries are built by having ``variant''
|
||||
|
@ -63,11 +65,11 @@ all: lib/libgnu.a src/libemacs.so src/android-emacs $(LIBSRC_BINARIES)
|
|||
# This file is used to tell lib/gnulib.mk when
|
||||
# $(top_srcdir)/config.status changes.
|
||||
config.status: $(top_srcdir)/config.status
|
||||
touch config.status
|
||||
$(AM_V_GEN) touch config.status
|
||||
|
||||
src/verbose.mk: verbose.mk.android
|
||||
mkdir -p src
|
||||
cp -f verbose.mk.android src/verbose.mk
|
||||
$(AM_V_GEN) mkdir -p src
|
||||
$(AM_V_SILENT) cp -f verbose.mk.android src/verbose.mk
|
||||
|
||||
# Gnulib, make-fingerprint and make-docfile must be built before
|
||||
# entering any of the rules below, or they will get the Android
|
||||
|
@ -75,30 +77,35 @@ src/verbose.mk: verbose.mk.android
|
|||
|
||||
.PHONY: $(top_builddir)/lib/libgnu.a
|
||||
$(top_builddir)/lib/libgnu.a:
|
||||
+ make -C $(top_builddir)/lib libgnu.a
|
||||
$(MAKE) -C $(top_builddir)/lib libgnu.a
|
||||
|
||||
.PHONY: $(top_builddir)/lib-src/make-fingerprint
|
||||
$(top_builddir)/lib-src/make-fingerprint:
|
||||
make -C $(top_builddir)/lib-src make-fingerprint
|
||||
$(MAKE) -C $(top_builddir)/lib-src make-fingerprint
|
||||
|
||||
.PHONY: $(top_builddir)/lib-src/make-docfile
|
||||
$(top_builddir)/lib-src/make-docfile:
|
||||
make -C $(top_builddir)/lib-src make-docfile
|
||||
$(MAKE) -C $(top_builddir)/lib-src make-docfile
|
||||
|
||||
PRE_BUILD_DEPS=$(top_builddir)/lib/libgnu.a \
|
||||
$(top_builddir)/lib-src/make-fingerprint \
|
||||
$(top_builddir)/lib-src/make-docfile
|
||||
|
||||
lib/config.h: $(top_builddir)/src/config.h.android
|
||||
cp -f -p $(top_builddir)/src/config.h.android lib/config.h
|
||||
$(AM_V_GEN) cp -f -p $(top_builddir)/src/config.h.android \
|
||||
lib/config.h
|
||||
|
||||
lib/gnulib.mk: $(top_builddir)/lib/gnulib.mk.android
|
||||
cp -f -p $(top_builddir)/lib/gnulib.mk.android lib/gnulib.mk
|
||||
$(AM_V_GEN) cp -f -p $(top_builddir)/lib/gnulib.mk.android \
|
||||
lib/gnulib.mk
|
||||
$(AM_V_SILENT) \
|
||||
sed -i 's/srcdir =.*$$/srcdir = $(subst /,\/,$(LIB_SRCDIR))/g' \
|
||||
lib/gnulib.mk
|
||||
|
||||
lib/Makefile: $(top_builddir)/lib/Makefile.android
|
||||
cp -f -p $(top_builddir)/lib/Makefile.android lib/Makefile
|
||||
$(AM_V_GEN) cp -f -p $(top_builddir)/lib/Makefile.android \
|
||||
lib/Makefile
|
||||
$(AM_V_SILENT) \
|
||||
sed -i 's/top_srcdir =.*$$/top_srcdir = $(subst /,\/,$(LIB_TOP_SRCDIR))/g' \
|
||||
lib/Makefile
|
||||
|
||||
|
@ -108,53 +115,65 @@ LIB_DEPS = lib/config.h lib/gnulib.mk lib/Makefile
|
|||
.PHONY: lib/libgnu.a
|
||||
lib/libgnu.a: src/verbose.mk config.status $(LIB_DEPS) $(PRE_BUILD_DEPS)
|
||||
mkdir -p lib/deps lib/deps/malloc
|
||||
+make -C lib libgnu.a
|
||||
$(MAKE) -C lib libgnu.a
|
||||
|
||||
src/Makefile src/config.h &: $(top_builddir)/src/config.h.android \
|
||||
$(top_builddir)/src/Makefile.android
|
||||
mkdir -p src src/deps
|
||||
$(AM_V_GEN)
|
||||
$(AM_V_SILENT) mkdir -p src src/deps
|
||||
# Copy config.h to src/
|
||||
$(AM_V_SILENT) \
|
||||
cp -f -p $(top_builddir)/src/config.h.android src/config.h
|
||||
# And the Makefile.
|
||||
$(AM_V_SILENT) \
|
||||
cp -f -p $(top_builddir)/src/Makefile.android src/Makefile
|
||||
# Next, edit srcdir and top_srcdir to the right location.
|
||||
$(AM_V_SILENT) \
|
||||
sed -i 's/srcdir =.*$$/srcdir = $(subst /,\/,$(SRC_SRCDIR))/g' src/Makefile
|
||||
$(AM_V_SILENT) \
|
||||
sed -i 's/top_srcdir =.*$$/top_srcdir = $(subst /,\/,$(LIB_TOP_SRCDIR))/g' \
|
||||
src/Makefile
|
||||
# Edit references to ../admin/unidata to read ../../admin/unidata.
|
||||
$(AM_V_SILENT) \
|
||||
sed -i 's/\.\.\/admin\/unidata/..\/..\/admin\/unidata/g' src/Makefile
|
||||
$(AM_V_SILENT) \
|
||||
sed -i 's/\.\.\/admin\/charsets/..\/..\/admin\/charsets/g' src/Makefile
|
||||
# Next, edit libsrc to the location at top_srcdir! It is important
|
||||
# that src/Makefile uses the binaries there, instead of any
|
||||
# cross-compiled binaries at ./lib-src.
|
||||
$(AM_V_SILENT) \
|
||||
sed -i 's/libsrc =.*$$/libsrc = \.\.\/\.\.\/lib-src/g' src/Makefile
|
||||
# Edit out anything saying -I($(top_srcdir)/lib); that should be
|
||||
# covered by -I$(lib)
|
||||
$(AM_V_SILENT) \
|
||||
sed -i 's/-I\$$(top_srcdir)\/lib//g' src/Makefile
|
||||
|
||||
.PHONY: src/android-emacs src/libemacs.so
|
||||
src/android-emacs src/libemacs.so &: src/Makefile src/config.h \
|
||||
src/verbose.mk lib/libgnu.a $(PRE_BUILD_DEPS)
|
||||
+make -C src android-emacs libemacs.so
|
||||
$(MAKE) -C src android-emacs libemacs.so
|
||||
|
||||
lib-src/Makefile: $(top_builddir)/lib-src/Makefile.android
|
||||
mkdir -p lib-src
|
||||
cp -f -p $< $@
|
||||
sed -i 's/-I\$${srcdir}\/\.\.\/lib//g' lib-src/Makefile
|
||||
$(AM_V_GEN) mkdir -p src lib-src
|
||||
$(AM_V_SILENT) mkdir -p lib-src
|
||||
$(AM_V_SILENT) cp -f -p $< $@
|
||||
$(AM_V_SILENT) sed -i 's/-I\$${srcdir}\/\.\.\/lib//g' lib-src/Makefile
|
||||
# Next, edit srcdir and top_srcdir to the right location.
|
||||
$(AM_V_SILENT) \
|
||||
sed -i 's/srcdir=.*$$/srcdir = $(subst /,\/,$(LIB_SRC_SRCDIR))/g' \
|
||||
lib-src/Makefile
|
||||
$(AM_V_SILENT) \
|
||||
sed -i 's/top_srcdir=.*$$/top_srcdir = $(subst /,\/,$(LIB_SRC_TOP_SRCDIR))/g' \
|
||||
lib-src/Makefile
|
||||
# Edit out SCRIPTS, it interferes with the build.
|
||||
$(AM_V_SILENT) \
|
||||
sed -i 's/^SCRIPTS=.*$$/SCRIPTS=/g' lib-src/Makefile
|
||||
|
||||
.PHONY: $(LIBSRC_BINARIES)
|
||||
$(LIBSRC_BINARIES) &: src/verbose.mk $(top_builddir)/$@ lib/libgnu.a \
|
||||
src/config.h lib-src/Makefile $(PRE_BUILD_DEPS)
|
||||
mkdir -p src lib-src
|
||||
# Next, edit srcdir and top_srcdir to the right location.
|
||||
sed -i 's/srcdir=.*$$/srcdir = $(subst /,\/,$(LIB_SRC_SRCDIR))/g' \
|
||||
lib-src/Makefile
|
||||
sed -i 's/top_srcdir=.*$$/top_srcdir = $(subst /,\/,$(LIB_SRC_TOP_SRCDIR))/g' \
|
||||
lib-src/Makefile
|
||||
# Edit out SCRIPTS, it interferes with the build.
|
||||
sed -i 's/^SCRIPTS=.*$$/SCRIPTS=/g' lib-src/Makefile
|
||||
# Finally, go into lib-src and make everything being built
|
||||
+make -C lib-src $(foreach bin,$(LIBSRC_BINARIES),$(notdir $(bin)))
|
||||
$(MAKE) -C lib-src $(foreach bin,$(LIBSRC_BINARIES),$(notdir $(bin)))
|
||||
|
||||
.PHONY: clean maintainer-clean distclean
|
||||
clean:
|
||||
|
|
|
@ -14,12 +14,13 @@ or digitizer device and on-screen keyboard. For more information
|
|||
about using such devices with Emacs, @pxref{Other Input Devices}.
|
||||
|
||||
@menu
|
||||
* What is Android?:: Preamble.
|
||||
* Android Startup:: Starting up Emacs on Android.
|
||||
* Android File System:: The Android file system.
|
||||
* Android Environment:: Running Emacs under Android.
|
||||
* Android Windowing:: The Android window system.
|
||||
* Android Fonts:: Font selection under Android.
|
||||
* What is Android?:: Preamble.
|
||||
* Android Startup:: Starting up Emacs on Android.
|
||||
* Android File System:: The Android file system.
|
||||
* Android Environment:: Running Emacs under Android.
|
||||
* Android Windowing:: The Android window system.
|
||||
* Android Fonts:: Font selection under Android.
|
||||
* Android Troubleshooting:: Dealing with problems.
|
||||
@end menu
|
||||
|
||||
@node What is Android?
|
||||
|
@ -83,32 +84,6 @@ command on that other system:
|
|||
$ adb logcat | grep -E "(android_run_debug_thread|[Ee]macs)"
|
||||
@end example
|
||||
|
||||
@cindex emacs -Q, android
|
||||
Since Android has no command line, there is normally no way to
|
||||
specify command-line arguments when starting Emacs. However, Emacs
|
||||
can be started with the equivalent of the @code{--quick} option
|
||||
(@pxref{Initial Options}) through a special preferences screen, which
|
||||
can be accessed through the Emacs ``app info'' page in the system
|
||||
settings application.
|
||||
|
||||
Consult the manufacturer of your device for more details, as how to
|
||||
do this varies by device.
|
||||
|
||||
@cindex dumping, android
|
||||
The first time any given copy of Emacs starts on a device, it spends
|
||||
a while loading the preloaded Lisp files which normally come with
|
||||
Emacs. This produces a ``dump file'' (@pxref{Initial Options}) in the
|
||||
files directory, containing an identifier unique to this copy of
|
||||
Emacs.
|
||||
|
||||
The next time that same copy of Emacs starts up, it simply loads the
|
||||
data contained in that dump file, greatly improving start up time.
|
||||
|
||||
However, if by some unforseen circumstance the dump file is
|
||||
corrupted, Emacs can crash. If that happens, the dump file stored in
|
||||
the Emacs files directory can be erased through the same preferences
|
||||
screen.
|
||||
|
||||
@cindex emacsclient wrapper, android
|
||||
Since there is no other way to start the @command{emacsclient}
|
||||
program (@pxref{Emacs Server}) from another Android program, Emacs
|
||||
|
@ -213,7 +188,7 @@ Android.
|
|||
|
||||
From the perspective of users, Android is mostly a single user
|
||||
operating system; however, from the perspective of applications and
|
||||
Emacs, the system has an overwhelming number of users!
|
||||
Emacs, the system has an overwhelming number of users.
|
||||
|
||||
Each application runs in its own user, with his own home directory,
|
||||
which is the app data directory (@pxref{Android File System}.)
|
||||
|
@ -418,6 +393,7 @@ Due to the unusual nature of the Android windowing environment, Emacs
|
|||
only supports a limited subset of GUI features. Here is a list of
|
||||
known limitations, and features which are not implemented:
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
Scroll bars are not supported, as they are close to useless on Android
|
||||
devices.
|
||||
|
@ -484,3 +460,46 @@ lousy font driver, because of limitations and inaccuracies in the font
|
|||
metrics provided by the Android platform. In that case, Emacs uses
|
||||
the ``Monospace'' typeface configured on your system; this should
|
||||
always be Droid Sans Mono.
|
||||
|
||||
@node Android Troubleshooting
|
||||
@section What to do when something goes wrong on Android
|
||||
@cindex troubleshooting, android
|
||||
|
||||
@cindex emacs -Q, android
|
||||
Since Android has no command line, there is normally no way to
|
||||
specify command-line arguments when starting Emacs. This is very
|
||||
nasty when you make a mistake in your Emacs initialization files that
|
||||
prevents Emacs from starting up at all, as the system normally
|
||||
prevents other programs from accessing Emacs's home directory.
|
||||
|
||||
However, Emacs can be started with the equivalent of the
|
||||
@code{--quick} option (@pxref{Initial Options}) through a special
|
||||
preferences screen, which can be accessed through the Emacs ``app
|
||||
info'' page in the system settings application.
|
||||
|
||||
Consult the manufacturer of your device for more details, as how to
|
||||
do this varies by device.
|
||||
|
||||
@cindex dumping, android
|
||||
The first time any given copy of Emacs starts on a device, it spends
|
||||
a while loading the preloaded Lisp files which normally come with
|
||||
Emacs. This produces a ``dump file'' (@pxref{Initial Options}) in the
|
||||
files directory, containing an identifier unique to this copy of
|
||||
Emacs.
|
||||
|
||||
The next time that same copy of Emacs starts up, it simply loads the
|
||||
data contained in that dump file, greatly improving start up time.
|
||||
|
||||
If by some unforseen circumstance the dump file is corrupted, Emacs
|
||||
can crash. If that happens, the dump file stored in the Emacs files
|
||||
directory can be erased through the same preferences screen.
|
||||
|
||||
@cindex accessing Emacs directories, Android
|
||||
Emacs supports an alternative method of rescuing broken Emacs
|
||||
installations on Android 4.4 and later: Emacs exports a ``documents
|
||||
provider'' which accesses the contents of Emacs's home directory, that
|
||||
can then be accessed by any file manager program.
|
||||
|
||||
If you can find out how to open that documents provider in the file
|
||||
manager that comes with your device, you can rename, delete, or edit
|
||||
your initialization or dump files from there instead.
|
||||
|
|
|
@ -1264,12 +1264,13 @@ Emacs and Haiku
|
|||
|
||||
Emacs and Android
|
||||
|
||||
* What is Android?:: Preamble.
|
||||
* Android Startup:: Starting up Emacs on Android.
|
||||
* Android File System:: The Android file system.
|
||||
* Android Environment:: Running Emacs under Android.
|
||||
* Android Windowing:: The Android window system.
|
||||
* Android Fonts:: Font selection under Android.
|
||||
* What is Android?:: Preamble.
|
||||
* Android Startup:: Starting up Emacs on Android.
|
||||
* Android File System:: The Android file system.
|
||||
* Android Environment:: Running Emacs under Android.
|
||||
* Android Windowing:: The Android window system.
|
||||
* Android Fonts:: Font selection under Android.
|
||||
* Android Troubleshooting:: Dealing with problems.
|
||||
|
||||
Emacs and unconventional input devices
|
||||
|
||||
|
|
104
java/Makefile.in
104
java/Makefile.in
|
@ -54,18 +54,33 @@ JARSIGNER_FLAGS =
|
|||
endif
|
||||
|
||||
SIGN_EMACS = -keystore emacs.keystore -storepass emacs1 $(JARSIGNER_FLAGS)
|
||||
SIGN_EMACS_V2 = sign --v2-signing-enabled --ks emacs.keystore \
|
||||
SIGN_EMACS_V2 = sign --v2-signing-enabled --ks emacs.keystore \
|
||||
--debuggable-apk-permitted --ks-pass pass:emacs1
|
||||
|
||||
JAVA_FILES = $(wildcard $(srcdir)/org/gnu/emacs/*.java)
|
||||
RESOURCE_FILES = $(wildcard $(srcdir)/res/drawable/*)
|
||||
CLASS_FILES = $(foreach file,$(JAVA_FILES),$(basename $(file)).class)
|
||||
JAVA_FILES := $(wildcard $(srcdir)/org/gnu/emacs/*.java)
|
||||
RESOURCE_FILES := $(foreach file,$(wildcard $(srcdir)/res/*), \
|
||||
$(wildcard $(file)/*))
|
||||
|
||||
# R.java is a file generated by the `aapt' utility containing
|
||||
# constants that can then be used to locate ``resource identifiers''.
|
||||
# It is not a regular file and should not be compiled as Java source
|
||||
# code. Instead, it is automatically included by the Java compiler.
|
||||
RESOURCE_FILE := $(srcdir)/org/gnu/emacs/R.java
|
||||
|
||||
# CLASS_FILES is what should actually be built and included in the
|
||||
# resulting Emacs executable. The Java compiler might generate more
|
||||
# than one class file for each source file, so this only serves as a
|
||||
# list of dependencies for Make.
|
||||
CLASS_FILES := $(foreach file,$(JAVA_FILES),$(basename $(file)).class)
|
||||
|
||||
# Remove RESOURCE_FILE from JAVA_FILES, if it is already present.
|
||||
JAVA_FILES := $(filter-out $(RESOURCE_FILE),$(JAVA_FILES))
|
||||
|
||||
# Compute the name for the Emacs application package. This should be:
|
||||
# emacs-<version>-<min-sdk>-<abi>.apk
|
||||
|
||||
ANDROID_MIN_SDK = @ANDROID_MIN_SDK@
|
||||
APK_NAME = emacs-$(version)-$(ANDROID_MIN_SDK)-$(ANDROID_ABI).apk
|
||||
ANDROID_MIN_SDK := @ANDROID_MIN_SDK@
|
||||
APK_NAME := emacs-$(version)-$(ANDROID_MIN_SDK)-$(ANDROID_ABI).apk
|
||||
|
||||
# How this stuff works.
|
||||
|
||||
|
@ -113,19 +128,25 @@ include $(top_builddir)/cross/ndk-build/ndk-build.mk
|
|||
$(libsrc)/asset-directory-tool:
|
||||
$(MAKE) -C $(libsrc) $(notdir $@)
|
||||
|
||||
emacs.apk-in: $(CROSS_BINS) $(CROSS_LIBS) $(libsrc)/asset-directory-tool \
|
||||
AndroidManifest.xml $(NDK_BUILD_SHARED) $(RESOURCE_FILES)
|
||||
# install_tmp is a directory used to generate emacs.apk-in.
|
||||
# That is then packaged into $(APK_NAME).
|
||||
|
||||
.PHONY: install_temp install_temp/assets/directory-tree
|
||||
install_temp: $(CROSS_BINS) $(CROSS_LIBS) $(NDK_BUILD_SHARED) \
|
||||
$(RESOURCE_FILES)
|
||||
$(AM_V_GEN)
|
||||
# Make the working directory for this stuff
|
||||
rm -rf install_temp
|
||||
mkdir -p install_temp/lib/$(ANDROID_ABI)
|
||||
mkdir -p install_temp/assets/etc
|
||||
mkdir -p install_temp/assets/lisp
|
||||
mkdir -p install_temp/assets/info
|
||||
$(AM_V_SILENT) rm -rf install_temp
|
||||
$(AM_V_SILENT) mkdir -p install_temp/lib/$(ANDROID_ABI)
|
||||
$(AM_V_SILENT) mkdir -p install_temp/assets/etc
|
||||
$(AM_V_SILENT) mkdir -p install_temp/assets/lisp
|
||||
$(AM_V_SILENT) mkdir -p install_temp/assets/info
|
||||
# Install architecture independents to assets/etc and assets/lisp
|
||||
cp -r $(top_builddir)/lisp install_temp/assets
|
||||
cp -r $(top_builddir)/etc install_temp/assets
|
||||
cp -r $(top_builddir)/info install_temp/assets
|
||||
$(AM_V_SILENT) cp -r $(top_builddir)/lisp install_temp/assets
|
||||
$(AM_V_SILENT) cp -r $(top_builddir)/etc install_temp/assets
|
||||
$(AM_V_SILENT) cp -r $(top_builddir)/info install_temp/assets
|
||||
# Remove undesirable files from those directories.
|
||||
$(AM_V_SILENT) \
|
||||
for subdir in `find install_temp -type d -print`; do \
|
||||
chmod a+rx $${subdir} ; \
|
||||
rm -rf $${subdir}/.gitignore ; \
|
||||
|
@ -139,34 +160,44 @@ emacs.apk-in: $(CROSS_BINS) $(CROSS_LIBS) $(libsrc)/asset-directory-tool \
|
|||
rm -rf $${subdir}/Makefile; \
|
||||
done
|
||||
# Generate the directory tree for those directories.
|
||||
$(libsrc)/asset-directory-tool install_temp/assets \
|
||||
install_temp/assets/directory-tree
|
||||
# Install architecture dependents to lib/$(ANDROID_ABI). This
|
||||
# perculiar naming scheme is required to make Android preserve these
|
||||
# binaries upon installation.
|
||||
$(AM_V_SILENT) \
|
||||
for file in $(CROSS_BINS); do \
|
||||
if [ -x $$file ]; then \
|
||||
filename=`basename $$file`; \
|
||||
cp -f $$file install_temp/lib/$(ANDROID_ABI)/lib$${filename}.so; \
|
||||
fi \
|
||||
done
|
||||
$(AM_V_SILENT) \
|
||||
for file in $(CROSS_LIBS); do \
|
||||
if [ -x $$file ]; then \
|
||||
cp -f $$file install_temp/lib/$(ANDROID_ABI); \
|
||||
fi \
|
||||
done
|
||||
ifneq ($(NDK_BUILD_SHARED),)
|
||||
cp -f $(NDK_BUILD_SHARED) install_temp/lib/$(ANDROID_ABI)
|
||||
$(AM_V_SILENT) cp -f $(NDK_BUILD_SHARED) \
|
||||
install_temp/lib/$(ANDROID_ABI)
|
||||
endif
|
||||
|
||||
install_temp/assets/directory-tree: $(libsrc)/asset-directory-tool install_temp
|
||||
$(AM_V_GEN) $(libsrc)/asset-directory-tool install_temp/assets \
|
||||
install_temp/assets/directory-tree
|
||||
|
||||
emacs.apk-in: install_temp install_temp/assets/directory-tree \
|
||||
AndroidManifest.xml
|
||||
# Package everything. Specifying the assets on this command line is
|
||||
# necessary for AAssetManager_getNextFileName to work on old versions
|
||||
# of Android. Make sure not to generate R.java, as it's not required
|
||||
# by Emacs.
|
||||
$(AAPT) package -I "$(ANDROID_JAR)" -F $@ -f \
|
||||
-M AndroidManifest.xml -A install_temp/assets \
|
||||
# of Android. Make sure not to generate R.java, as it's already been
|
||||
# generated.
|
||||
$(AM_V_AAPT) $(AAPT) p -I "$(ANDROID_JAR)" -F $@ \
|
||||
-f -M AndroidManifest.xml -A install_temp/assets \
|
||||
-S res -J install_temp
|
||||
pushd install_temp; $(AAPT) add ../$@ `find lib -type f`; popd
|
||||
rm -rf install_temp
|
||||
$(AM_V_SILENT) pushd install_temp &> /dev/null; \
|
||||
$(AAPT) add ../$@ `find lib -type f`; \
|
||||
popd &> /dev/null
|
||||
$(AM_V_SILENT) rm -rf install_temp
|
||||
|
||||
# Makefile itself.
|
||||
.PRECIOUS: ../config.status Makefile
|
||||
|
@ -180,6 +211,14 @@ AndroidManifest.xml: $(top_srcdir)/configure.ac $(top_srcdir)/m4/*.m4 \
|
|||
AndroidManifest.xml.in
|
||||
pushd ..; ./config.status java/AndroidManifest.xml; popd
|
||||
|
||||
# R.java:
|
||||
$(RESOURCE_FILE): $(RESOURCE_FILES)
|
||||
$(AM_V_GEN) $(AAPT) p -I "$(ANDROID_JAR)" -f \
|
||||
-J $(dir $@) -M AndroidManifest.xml -S res
|
||||
|
||||
# Make all class files depend on R.java being built.
|
||||
$(CLASS_FILES): $(RESOURCE_FILE)
|
||||
|
||||
.SUFFIXES: .java .class
|
||||
.java.class &:
|
||||
$(AM_V_JAVAC) $(JAVAC) $(JAVAFLAGS) $<
|
||||
|
@ -199,17 +238,18 @@ classes.dex: $(CLASS_FILES)
|
|||
.PHONY: clean maintainer-clean
|
||||
|
||||
$(APK_NAME): classes.dex emacs.apk-in emacs.keystore
|
||||
cp -f emacs.apk-in $@.unaligned
|
||||
$(AAPT) add $@.unaligned classes.dex
|
||||
$(JARSIGNER) $(SIGN_EMACS) $@.unaligned "Emacs keystore"
|
||||
$(ZIPALIGN) -f 4 $@.unaligned $@
|
||||
$(AM_V_GEN)
|
||||
$(AM_V_SILENT) cp -f emacs.apk-in $@.unaligned
|
||||
$(AM_V_SILENT) $(AAPT) add $@.unaligned classes.dex
|
||||
$(AM_V_SILENT) $(JARSIGNER) $(SIGN_EMACS) $@.unaligned "Emacs keystore"
|
||||
$(AM_V_SILENT) $(ZIPALIGN) -f 4 $@.unaligned $@
|
||||
# Signing must happen after alignment!
|
||||
$(APKSIGNER) $(SIGN_EMACS_V2) $@
|
||||
rm -f $@.unaligned *.idsig
|
||||
$(AM_V_SILENT) $(APKSIGNER) $(SIGN_EMACS_V2) $@
|
||||
$(AM_V_SILENT) rm -f $@.unaligned *.idsig
|
||||
|
||||
clean:
|
||||
rm -f *.apk emacs.apk-in *.dex *.unaligned *.class *.idsig
|
||||
rm -rf install-temp
|
||||
rm -rf install-temp $(RESOURCE_FILE)
|
||||
find . -name '*.class' -delete
|
||||
|
||||
maintainer-clean distclean bootstrap-clean: clean
|
||||
|
|
|
@ -22,27 +22,28 @@
|
|||
import java.io.File;
|
||||
|
||||
import android.app.Activity;
|
||||
|
||||
import android.content.Intent;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.os.Build;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup.LayoutParams;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import android.R;
|
||||
import android.widget.Toast;
|
||||
|
||||
import android.preference.*;
|
||||
|
||||
/* This module provides a ``preferences'' display for Emacs. It is
|
||||
supposed to be launched from inside the Settings application to
|
||||
perform various actions, such as starting Emacs with the ``-Q''
|
||||
option, which would not be possible otherwise, as there is no
|
||||
command line on Android. */
|
||||
command line on Android.
|
||||
|
||||
public class EmacsPreferencesActivity extends Activity
|
||||
Android provides a preferences activity, but it is deprecated.
|
||||
Unfortunately, there is no alternative that looks the same way. */
|
||||
|
||||
@SuppressWarnings ("deprecation")
|
||||
public class EmacsPreferencesActivity extends PreferenceActivity
|
||||
{
|
||||
/* The linear layout associated with the activity. */
|
||||
private LinearLayout layout;
|
||||
|
||||
/* Restart Emacs with -Q. Call EmacsThread.exit to kill Emacs now, and
|
||||
tell the system to EmacsActivity with some parameters later. */
|
||||
|
||||
|
@ -59,72 +60,82 @@ public class EmacsPreferencesActivity extends Activity
|
|||
System.exit (0);
|
||||
}
|
||||
|
||||
/* Erase Emacs's dump file. */
|
||||
|
||||
private void
|
||||
eraseDumpFile ()
|
||||
{
|
||||
String wantedDumpFile;
|
||||
File file;
|
||||
Toast toast;
|
||||
|
||||
wantedDumpFile = ("emacs-" + EmacsNative.getFingerprint ()
|
||||
+ ".pdmp");
|
||||
file = new File (getFilesDir (), wantedDumpFile);
|
||||
|
||||
if (file.exists ())
|
||||
file.delete ();
|
||||
|
||||
/* Make sure to clear EmacsApplication.dumpFileName, or
|
||||
starting Emacs without restarting this program will
|
||||
make Emacs try to load a nonexistent dump file. */
|
||||
EmacsApplication.dumpFileName = null;
|
||||
|
||||
/* Display a message stating that the dump file has been
|
||||
erased. */
|
||||
toast = Toast.makeText (this, "Dump file removed",
|
||||
Toast.LENGTH_SHORT);
|
||||
toast.show ();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void
|
||||
onCreate (Bundle savedInstanceState)
|
||||
{
|
||||
LinearLayout layout;
|
||||
TextView textView;
|
||||
LinearLayout.LayoutParams params;
|
||||
int resid;
|
||||
Preference tem;
|
||||
Preference.OnPreferenceClickListener listener;
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
|
||||
setTheme (R.style.Theme_DeviceDefault_Settings);
|
||||
setTheme (android.R.style.Theme_DeviceDefault_Settings);
|
||||
else if (Build.VERSION.SDK_INT
|
||||
>= Build.VERSION_CODES.ICE_CREAM_SANDWICH)
|
||||
setTheme (R.style.Theme_DeviceDefault);
|
||||
setTheme (android.R.style.Theme_DeviceDefault);
|
||||
|
||||
layout = new LinearLayout (this);
|
||||
layout.setOrientation (LinearLayout.VERTICAL);
|
||||
setContentView (layout);
|
||||
/* This must come before using any preference APIs. */
|
||||
super.onCreate (savedInstanceState);
|
||||
|
||||
textView = new TextView (this);
|
||||
textView.setPadding (8, 20, 20, 8);
|
||||
/* Add preferences from the XML file where they are defined. */
|
||||
addPreferencesFromResource (R.xml.preferences);
|
||||
|
||||
params = new LinearLayout.LayoutParams (LayoutParams.MATCH_PARENT,
|
||||
LayoutParams.WRAP_CONTENT);
|
||||
textView.setLayoutParams (params);
|
||||
textView.setText ("(Re)start Emacs with -Q");
|
||||
textView.setOnClickListener (new View.OnClickListener () {
|
||||
/* Now, set up on click handlers for each of the preferences
|
||||
items. */
|
||||
|
||||
tem = findPreference ("start_quick");
|
||||
|
||||
listener = new Preference.OnPreferenceClickListener () {
|
||||
@Override
|
||||
public void
|
||||
onClick (View view)
|
||||
public boolean
|
||||
onPreferenceClick (Preference preference)
|
||||
{
|
||||
startEmacsQ ();
|
||||
return true;
|
||||
}
|
||||
});
|
||||
layout.addView (textView);
|
||||
};
|
||||
|
||||
textView = new TextView (this);
|
||||
textView.setPadding (8, 20, 20, 8);
|
||||
tem.setOnPreferenceClickListener (listener);
|
||||
|
||||
params = new LinearLayout.LayoutParams (LayoutParams.MATCH_PARENT,
|
||||
LayoutParams.WRAP_CONTENT);
|
||||
textView.setLayoutParams (params);
|
||||
textView.setText ("Erase dump file");
|
||||
textView.setOnClickListener (new View.OnClickListener () {
|
||||
tem = findPreference ("erase_dump");
|
||||
|
||||
listener = new Preference.OnPreferenceClickListener () {
|
||||
@Override
|
||||
public void
|
||||
onClick (View view)
|
||||
public boolean
|
||||
onPreferenceClick (Preference preference)
|
||||
{
|
||||
String wantedDumpFile;
|
||||
File file;
|
||||
|
||||
wantedDumpFile = ("emacs-" + EmacsNative.getFingerprint ()
|
||||
+ ".pdmp");
|
||||
file = new File (getFilesDir (), wantedDumpFile);
|
||||
|
||||
if (file.exists ())
|
||||
file.delete ();
|
||||
|
||||
/* Make sure to clear EmacsApplication.dumpFileName, or
|
||||
starting Emacs without restarting this program will
|
||||
make Emacs try to load a nonexistent dump file. */
|
||||
EmacsApplication.dumpFileName = null;
|
||||
eraseDumpFile ();
|
||||
return true;
|
||||
}
|
||||
});
|
||||
layout.addView (textView);
|
||||
};
|
||||
|
||||
super.onCreate (savedInstanceState);
|
||||
tem.setOnPreferenceClickListener (listener);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -181,7 +181,10 @@ public class EmacsView extends ViewGroup
|
|||
if (oldBitmap != null)
|
||||
{
|
||||
oldBitmap.recycle ();
|
||||
surfaceView.setBitmap (null, null);
|
||||
|
||||
/* Make sure to set the view's bitmap to the new bitmap, or
|
||||
ugly flicker can result. */
|
||||
surfaceView.setBitmap (bitmap, null);
|
||||
}
|
||||
|
||||
/* Some Android versions still don't free the bitmap until the
|
||||
|
|
28
java/res/xml/preferences.xml
Normal file
28
java/res/xml/preferences.xml
Normal file
|
@ -0,0 +1,28 @@
|
|||
<!-- Descriptions for the preferences screen for GNU Emacs on Android.
|
||||
|
||||
Copyright (C) 2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Emacs.
|
||||
|
||||
GNU Emacs is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
GNU Emacs is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. -->
|
||||
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<Preference android:key="start_quick"
|
||||
android:title="Restart Emacs with -Q"
|
||||
android:summary="Restart Emacs, but do not load site lisp or init files."/>
|
||||
|
||||
<Preference android:key="erase_dump"
|
||||
android:title="Delete dump file"
|
||||
android:summary="Remove the dumped state created when Emacs was installed"/>
|
||||
</PreferenceScreen>
|
|
@ -36,6 +36,7 @@ AM_V_JAVAC =
|
|||
AM_V_DX =
|
||||
AM_V_AAPT =
|
||||
AM_V_ZIPALIGN =
|
||||
AM_V_SILENT =
|
||||
else
|
||||
|
||||
# Whether $(info ...) works. This is to work around a bug in GNU Make
|
||||
|
@ -84,4 +85,6 @@ AM_V_RC = @$(info $ RC $@)
|
|||
# These are used for the Android port.
|
||||
AM_V_JAVAC = @$(info $ JAVAC $@)
|
||||
AM_V_D8 = @$(info $ D8 $@)
|
||||
AM_V_AAPT = @$(info $ AAPT $@)
|
||||
AM_V_SILENT = @
|
||||
endif
|
||||
|
|
Loading…
Reference in a new issue