Fix: Don't show unavailable menu items
This commit is contained in:
@ -1,124 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2014 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package android.support.v7.app;
|
||||
|
||||
import android.content.res.Configuration;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceActivity;
|
||||
import android.support.annotation.LayoutRes;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
/**
|
||||
* A {@link android.preference.PreferenceActivity} which implements and proxies the necessary calls
|
||||
* to be used with AppCompat.
|
||||
* <p>
|
||||
* This technique can be used with an {@link android.app.Activity} class, not just
|
||||
* {@link android.preference.PreferenceActivity}.
|
||||
*/
|
||||
public abstract class AppCompatPreferenceActivity extends PreferenceActivity {
|
||||
private AppCompatDelegate mDelegate;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
getDelegate().installViewFactory();
|
||||
getDelegate().onCreate(savedInstanceState);
|
||||
super.onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostCreate(Bundle savedInstanceState) {
|
||||
super.onPostCreate(savedInstanceState);
|
||||
getDelegate().onPostCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
public ActionBar getSupportActionBar() {
|
||||
return getDelegate().getSupportActionBar();
|
||||
}
|
||||
|
||||
public void setSupportActionBar(@Nullable Toolbar toolbar) {
|
||||
getDelegate().setSupportActionBar(toolbar);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MenuInflater getMenuInflater() {
|
||||
return getDelegate().getMenuInflater();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setContentView(@LayoutRes int layoutResID) {
|
||||
getDelegate().setContentView(layoutResID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setContentView(View view) {
|
||||
getDelegate().setContentView(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setContentView(View view, ViewGroup.LayoutParams params) {
|
||||
getDelegate().setContentView(view, params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addContentView(View view, ViewGroup.LayoutParams params) {
|
||||
getDelegate().addContentView(view, params);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostResume() {
|
||||
super.onPostResume();
|
||||
getDelegate().onPostResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onTitleChanged(CharSequence title, int color) {
|
||||
super.onTitleChanged(title, color);
|
||||
getDelegate().setTitle(title);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConfigurationChanged(Configuration newConfig) {
|
||||
super.onConfigurationChanged(newConfig);
|
||||
getDelegate().onConfigurationChanged(newConfig);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
getDelegate().onStop();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
getDelegate().onDestroy();
|
||||
}
|
||||
|
||||
public void invalidateOptionsMenu() {
|
||||
getDelegate().invalidateOptionsMenu();
|
||||
}
|
||||
|
||||
private AppCompatDelegate getDelegate() {
|
||||
if (mDelegate == null) {
|
||||
mDelegate = AppCompatDelegate.create(this, null);
|
||||
}
|
||||
return mDelegate;
|
||||
}
|
||||
}
|
@ -896,7 +896,7 @@ public final class TerminalView extends View {
|
||||
ClipboardManager clipboard = (ClipboardManager) getContext().getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
menu.add(Menu.NONE, 1, Menu.NONE, R.string.copy_text).setShowAsAction(show);
|
||||
menu.add(Menu.NONE, 2, Menu.NONE, R.string.paste_text).setEnabled(clipboard.hasPrimaryClip()).setShowAsAction(show);
|
||||
menu.add(Menu.NONE, 3, Menu.NONE, R.string.text_selection_more);
|
||||
// menu.add(Menu.NONE, 3, Menu.NONE, R.string.text_selection_more);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1,192 +0,0 @@
|
||||
package io.neoterm.ui.bonus;
|
||||
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Outline;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Path;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.GradientDrawable;
|
||||
import android.graphics.drawable.RippleDrawable;
|
||||
import android.graphics.drawable.ShapeDrawable;
|
||||
import android.graphics.drawable.shapes.OvalShape;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.Gravity;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewOutlineProvider;
|
||||
import android.view.WindowManager;
|
||||
import android.view.animation.PathInterpolator;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import io.neoterm.R;
|
||||
|
||||
/**
|
||||
* @author kiva
|
||||
*/
|
||||
|
||||
public class BonusActivity extends AppCompatActivity {
|
||||
final static int[] FLAVORS = {
|
||||
0xFF9C27B0, 0xFFBA68C8, // grape
|
||||
0xFFFF9800, 0xFFFFB74D, // orange
|
||||
0xFFF06292, 0xFFF8BBD0, // bubblegum
|
||||
0xFFAFB42B, 0xFFCDDC39, // lime
|
||||
0xFF795548, 0xFFA1887F, // mystery flavor
|
||||
};
|
||||
|
||||
FrameLayout mLayout;
|
||||
int mTapCount;
|
||||
int mKeyCount;
|
||||
PathInterpolator mInterpolator = new PathInterpolator(0f, 0f, 0.5f, 1f);
|
||||
|
||||
static int newColorIndex() {
|
||||
return 2 * ((int) (Math.random() * FLAVORS.length / 2));
|
||||
}
|
||||
|
||||
Drawable makeRipple() {
|
||||
final int idx = newColorIndex();
|
||||
final ShapeDrawable lollipopBackground = new ShapeDrawable(new OvalShape());
|
||||
lollipopBackground.getPaint().setColor(FLAVORS[idx]);
|
||||
return new RippleDrawable(
|
||||
ColorStateList.valueOf(FLAVORS[idx + 1]),
|
||||
lollipopBackground, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
mLayout = new FrameLayout(this);
|
||||
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
|
||||
WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||
setContentView(mLayout);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttachedToWindow() {
|
||||
final DisplayMetrics dm = getResources().getDisplayMetrics();
|
||||
final float dp = dm.density;
|
||||
final int size = (int)
|
||||
(Math.min(Math.min(dm.widthPixels, dm.heightPixels), 600 * dp) - 100 * dp);
|
||||
final View stick = new View(this) {
|
||||
Paint mPaint = new Paint();
|
||||
Path mShadow = new Path();
|
||||
|
||||
@Override
|
||||
public void onAttachedToWindow() {
|
||||
super.onAttachedToWindow();
|
||||
setWillNotDraw(false);
|
||||
setOutlineProvider(new ViewOutlineProvider() {
|
||||
@Override
|
||||
public void getOutline(View view, Outline outline) {
|
||||
outline.setRect(0, getHeight() / 2, getWidth(), getHeight());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDraw(Canvas c) {
|
||||
final int w = c.getWidth();
|
||||
final int h = c.getHeight() / 2;
|
||||
c.translate(0, h);
|
||||
final GradientDrawable g = new GradientDrawable();
|
||||
g.setOrientation(GradientDrawable.Orientation.LEFT_RIGHT);
|
||||
g.setGradientCenter(w * 0.75f, 0);
|
||||
g.setColors(new int[]{0xFFFFFFFF, 0xFFAAAAAA});
|
||||
g.setBounds(0, 0, w, h);
|
||||
g.draw(c);
|
||||
mPaint.setColor(0xFFAAAAAA);
|
||||
mShadow.reset();
|
||||
mShadow.moveTo(0, 0);
|
||||
mShadow.lineTo(w, 0);
|
||||
mShadow.lineTo(w, size / 2 + 1.5f * w);
|
||||
mShadow.lineTo(0, size / 2);
|
||||
mShadow.close();
|
||||
c.drawPath(mShadow, mPaint);
|
||||
}
|
||||
};
|
||||
mLayout.addView(stick, new FrameLayout.LayoutParams((int) (32 * dp),
|
||||
ViewGroup.LayoutParams.MATCH_PARENT, Gravity.CENTER_HORIZONTAL));
|
||||
stick.setAlpha(0f);
|
||||
|
||||
final ImageView im = new ImageView(this);
|
||||
im.setTranslationZ(20);
|
||||
im.setScaleX(0);
|
||||
im.setScaleY(0);
|
||||
final Drawable platlogo = getDrawable(R.drawable.plat_logo);
|
||||
platlogo.setAlpha(0);
|
||||
im.setImageDrawable(platlogo);
|
||||
im.setBackground(makeRipple());
|
||||
im.setClickable(true);
|
||||
final ShapeDrawable highlight = new ShapeDrawable(new OvalShape());
|
||||
highlight.getPaint().setColor(0x10FFFFFF);
|
||||
highlight.setBounds((int) (size * .15f), (int) (size * .15f),
|
||||
(int) (size * .6f), (int) (size * .6f));
|
||||
im.getOverlay().add(highlight);
|
||||
im.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (mTapCount == 0) {
|
||||
im.animate()
|
||||
.translationZ(40)
|
||||
.scaleX(1)
|
||||
.scaleY(1)
|
||||
.setInterpolator(mInterpolator)
|
||||
.setDuration(700)
|
||||
.setStartDelay(500)
|
||||
.start();
|
||||
|
||||
final ObjectAnimator a = ObjectAnimator.ofInt(platlogo, "alpha", 0, 255);
|
||||
a.setInterpolator(mInterpolator);
|
||||
a.setStartDelay(1000);
|
||||
a.start();
|
||||
|
||||
stick.animate()
|
||||
.translationZ(20)
|
||||
.alpha(1)
|
||||
.setInterpolator(mInterpolator)
|
||||
.setDuration(700)
|
||||
.setStartDelay(750)
|
||||
.start();
|
||||
} else {
|
||||
im.setBackground(makeRipple());
|
||||
}
|
||||
mTapCount++;
|
||||
}
|
||||
});
|
||||
|
||||
// Enable hardware keyboard input for TV compatibility.
|
||||
im.setFocusable(true);
|
||||
im.requestFocus();
|
||||
im.setOnKeyListener(new View.OnKeyListener() {
|
||||
@Override
|
||||
public boolean onKey(View v, int keyCode, KeyEvent event) {
|
||||
if (keyCode != KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_DOWN) {
|
||||
++mKeyCount;
|
||||
if (mKeyCount > 2) {
|
||||
if (mTapCount > 5) {
|
||||
im.performLongClick();
|
||||
} else {
|
||||
im.performClick();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
mLayout.addView(im, new FrameLayout.LayoutParams(size, size, Gravity.CENTER));
|
||||
|
||||
im.animate().scaleX(0.3f).scaleY(0.3f)
|
||||
.setInterpolator(mInterpolator)
|
||||
.setDuration(500)
|
||||
.setStartDelay(800)
|
||||
.start();
|
||||
}
|
||||
}
|
181
app/src/main/java/io/neoterm/ui/bonus/BonusActivity.kt
Normal file
181
app/src/main/java/io/neoterm/ui/bonus/BonusActivity.kt
Normal file
@ -0,0 +1,181 @@
|
||||
package io.neoterm.ui.bonus
|
||||
|
||||
import android.animation.ObjectAnimator
|
||||
import android.content.res.ColorStateList
|
||||
import android.graphics.Canvas
|
||||
import android.graphics.Outline
|
||||
import android.graphics.Paint
|
||||
import android.graphics.Path
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.graphics.drawable.GradientDrawable
|
||||
import android.graphics.drawable.RippleDrawable
|
||||
import android.graphics.drawable.ShapeDrawable
|
||||
import android.graphics.drawable.shapes.OvalShape
|
||||
import android.os.Bundle
|
||||
import android.support.v7.app.AppCompatActivity
|
||||
import android.util.DisplayMetrics
|
||||
import android.view.Gravity
|
||||
import android.view.KeyEvent
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.ViewOutlineProvider
|
||||
import android.view.WindowManager
|
||||
import android.view.animation.PathInterpolator
|
||||
import android.widget.FrameLayout
|
||||
import android.widget.ImageView
|
||||
|
||||
import io.neoterm.R
|
||||
|
||||
/**
|
||||
* @author kiva
|
||||
*/
|
||||
|
||||
class BonusActivity : AppCompatActivity() {
|
||||
|
||||
lateinit internal var mLayout: FrameLayout
|
||||
internal var mTapCount: Int = 0
|
||||
internal var mKeyCount: Int = 0
|
||||
internal var mInterpolator = PathInterpolator(0f, 0f, 0.5f, 1f)
|
||||
|
||||
internal fun makeRipple(): Drawable {
|
||||
val idx = newColorIndex()
|
||||
val lollipopBackground = ShapeDrawable(OvalShape())
|
||||
lollipopBackground.paint.color = FLAVORS[idx]
|
||||
return RippleDrawable(
|
||||
ColorStateList.valueOf(FLAVORS[idx + 1]),
|
||||
lollipopBackground, null)
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
mLayout = FrameLayout(this)
|
||||
window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
|
||||
WindowManager.LayoutParams.FLAG_FULLSCREEN)
|
||||
setContentView(mLayout)
|
||||
}
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
val dm = resources.displayMetrics
|
||||
val dp = dm.density
|
||||
val size = (Math.min(Math.min(dm.widthPixels, dm.heightPixels).toFloat(), 600 * dp) - 100 * dp).toInt()
|
||||
val stick = object : View(this) {
|
||||
internal var mPaint = Paint()
|
||||
internal var mShadow = Path()
|
||||
|
||||
public override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
setWillNotDraw(false)
|
||||
outlineProvider = object : ViewOutlineProvider() {
|
||||
override fun getOutline(view: View, outline: Outline) {
|
||||
outline.setRect(0, height / 2, width, height)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override fun onDraw(c: Canvas) {
|
||||
val w = c.width
|
||||
val h = c.height / 2
|
||||
c.translate(0f, h.toFloat())
|
||||
val g = GradientDrawable()
|
||||
g.orientation = GradientDrawable.Orientation.LEFT_RIGHT
|
||||
g.setGradientCenter(w * 0.75f, 0f)
|
||||
g.colors = intArrayOf(0xFFFFFFFF.toInt(), 0xFFAAAAAA.toInt())
|
||||
g.setBounds(0, 0, w, h)
|
||||
g.draw(c)
|
||||
mPaint.color = 0xFFAAAAAA.toInt()
|
||||
mShadow.reset()
|
||||
mShadow.moveTo(0f, 0f)
|
||||
mShadow.lineTo(w.toFloat(), 0f)
|
||||
mShadow.lineTo(w.toFloat(), size / 2 + 1.5f * w)
|
||||
mShadow.lineTo(0f, (size / 2).toFloat())
|
||||
mShadow.close()
|
||||
c.drawPath(mShadow, mPaint)
|
||||
}
|
||||
}
|
||||
mLayout.addView(stick, FrameLayout.LayoutParams((32 * dp).toInt(),
|
||||
ViewGroup.LayoutParams.MATCH_PARENT, Gravity.CENTER_HORIZONTAL))
|
||||
stick.alpha = 0f
|
||||
|
||||
val im = ImageView(this)
|
||||
im.translationZ = 20f
|
||||
im.scaleX = 0f
|
||||
im.scaleY = 0f
|
||||
val platlogo = getDrawable(R.drawable.plat_logo)
|
||||
platlogo!!.alpha = 0
|
||||
im.setImageDrawable(platlogo)
|
||||
im.background = makeRipple()
|
||||
im.isClickable = true
|
||||
val highlight = ShapeDrawable(OvalShape())
|
||||
highlight.paint.color = 0x10FFFFFF
|
||||
highlight.setBounds((size * .15f).toInt(), (size * .15f).toInt(),
|
||||
(size * .6f).toInt(), (size * .6f).toInt())
|
||||
im.overlay.add(highlight)
|
||||
im.setOnClickListener {
|
||||
if (mTapCount == 0) {
|
||||
im.animate()
|
||||
.translationZ(40f)
|
||||
.scaleX(1f)
|
||||
.scaleY(1f)
|
||||
.setInterpolator(mInterpolator)
|
||||
.setDuration(700)
|
||||
.setStartDelay(500)
|
||||
.start()
|
||||
|
||||
val a = ObjectAnimator.ofInt(platlogo, "alpha", 0, 255)
|
||||
a.interpolator = mInterpolator
|
||||
a.startDelay = 1000
|
||||
a.start()
|
||||
|
||||
stick.animate()
|
||||
.translationZ(20f)
|
||||
.alpha(1f)
|
||||
.setInterpolator(mInterpolator)
|
||||
.setDuration(700)
|
||||
.setStartDelay(750)
|
||||
.start()
|
||||
} else {
|
||||
im.background = makeRipple()
|
||||
}
|
||||
mTapCount++
|
||||
}
|
||||
|
||||
// Enable hardware keyboard input for TV compatibility.
|
||||
im.isFocusable = true
|
||||
im.requestFocus()
|
||||
im.setOnKeyListener { v, keyCode, event ->
|
||||
if (keyCode != KeyEvent.KEYCODE_BACK && event.action == KeyEvent.ACTION_DOWN) {
|
||||
++mKeyCount
|
||||
if (mKeyCount > 2) {
|
||||
if (mTapCount > 5) {
|
||||
im.performLongClick()
|
||||
} else {
|
||||
im.performClick()
|
||||
}
|
||||
}
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
mLayout.addView(im, FrameLayout.LayoutParams(size, size, Gravity.CENTER))
|
||||
|
||||
im.animate().scaleX(0.3f).scaleY(0.3f)
|
||||
.setInterpolator(mInterpolator)
|
||||
.setDuration(500)
|
||||
.setStartDelay(800)
|
||||
.start()
|
||||
}
|
||||
|
||||
companion object {
|
||||
internal val FLAVORS = intArrayOf(0xFF9C27B0.toInt(), 0xFFBA68C8.toInt(), // grape
|
||||
0xFFFF9800.toInt(), 0xFFFFB74D.toInt(), // orange
|
||||
0xFFF06292.toInt(), 0xFFF8BBD0.toInt(), // bubblegum
|
||||
0xFFAFB42B.toInt(), 0xFFCDDC39.toInt(), // lime
|
||||
0xFF795548.toInt(), 0xFFA1887F.toInt())// mystery flavor
|
||||
|
||||
internal fun newColorIndex(): Int {
|
||||
return 2 * (Math.random() * FLAVORS.size / 2).toInt()
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,110 @@
|
||||
/*
|
||||
* Copyright (C) 2014 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package io.neoterm.ui.settings
|
||||
|
||||
import android.content.res.Configuration
|
||||
import android.os.Bundle
|
||||
import android.preference.PreferenceActivity
|
||||
import android.support.annotation.LayoutRes
|
||||
import android.support.v7.app.ActionBar
|
||||
import android.support.v7.app.AppCompatDelegate
|
||||
import android.support.v7.widget.Toolbar
|
||||
import android.view.MenuInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
|
||||
/**
|
||||
* A [android.preference.PreferenceActivity] which implements and proxies the necessary calls
|
||||
* to be used with AppCompat.
|
||||
*
|
||||
*
|
||||
* This technique can be used with an [android.app.Activity] class, not just
|
||||
* [android.preference.PreferenceActivity].
|
||||
*/
|
||||
abstract class BasePreferenceActivity : PreferenceActivity() {
|
||||
private var mDelegate: AppCompatDelegate? = null
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
delegate.installViewFactory()
|
||||
delegate.onCreate(savedInstanceState)
|
||||
super.onCreate(savedInstanceState)
|
||||
}
|
||||
|
||||
override fun onPostCreate(savedInstanceState: Bundle?) {
|
||||
super.onPostCreate(savedInstanceState)
|
||||
delegate.onPostCreate(savedInstanceState)
|
||||
}
|
||||
|
||||
val supportActionBar: ActionBar?
|
||||
get() = delegate.supportActionBar
|
||||
|
||||
override fun getMenuInflater(): MenuInflater {
|
||||
return delegate.menuInflater
|
||||
}
|
||||
|
||||
override fun setContentView(@LayoutRes layoutResID: Int) {
|
||||
delegate.setContentView(layoutResID)
|
||||
}
|
||||
|
||||
override fun setContentView(view: View) {
|
||||
delegate.setContentView(view)
|
||||
}
|
||||
|
||||
override fun setContentView(view: View, params: ViewGroup.LayoutParams) {
|
||||
delegate.setContentView(view, params)
|
||||
}
|
||||
|
||||
override fun addContentView(view: View, params: ViewGroup.LayoutParams) {
|
||||
delegate.addContentView(view, params)
|
||||
}
|
||||
|
||||
override fun onPostResume() {
|
||||
super.onPostResume()
|
||||
delegate.onPostResume()
|
||||
}
|
||||
|
||||
override fun onTitleChanged(title: CharSequence, color: Int) {
|
||||
super.onTitleChanged(title, color)
|
||||
delegate.setTitle(title)
|
||||
}
|
||||
|
||||
override fun onConfigurationChanged(newConfig: Configuration) {
|
||||
super.onConfigurationChanged(newConfig)
|
||||
delegate.onConfigurationChanged(newConfig)
|
||||
}
|
||||
|
||||
override fun onStop() {
|
||||
super.onStop()
|
||||
delegate.onStop()
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
delegate.onDestroy()
|
||||
}
|
||||
|
||||
override fun invalidateOptionsMenu() {
|
||||
delegate.invalidateOptionsMenu()
|
||||
}
|
||||
|
||||
private val delegate: AppCompatDelegate
|
||||
get() {
|
||||
if (mDelegate == null) {
|
||||
mDelegate = AppCompatDelegate.create(this, null)
|
||||
}
|
||||
return mDelegate!!
|
||||
}
|
||||
}
|
@ -1,19 +1,18 @@
|
||||
package io.neoterm.ui.settings
|
||||
|
||||
import android.os.Bundle
|
||||
import android.support.v7.app.AppCompatPreferenceActivity
|
||||
import android.view.MenuItem
|
||||
import io.neoterm.R
|
||||
|
||||
/**
|
||||
* @author kiva
|
||||
*/
|
||||
class GeneralSettingsActivity : AppCompatPreferenceActivity() {
|
||||
class GeneralSettingsActivity : BasePreferenceActivity() {
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
supportActionBar.title = getString(R.string.general_settings)
|
||||
supportActionBar.setDisplayHomeAsUpEnabled(true)
|
||||
supportActionBar?.title = getString(R.string.general_settings)
|
||||
supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
||||
addPreferencesFromResource(R.xml.setting_general)
|
||||
}
|
||||
|
||||
|
@ -1,19 +1,18 @@
|
||||
package io.neoterm.ui.settings
|
||||
|
||||
import android.os.Bundle
|
||||
import android.support.v7.app.AppCompatPreferenceActivity
|
||||
import android.view.MenuItem
|
||||
import io.neoterm.R
|
||||
|
||||
/**
|
||||
* @author Lody
|
||||
*/
|
||||
class SettingActivity : AppCompatPreferenceActivity() {
|
||||
class SettingActivity : BasePreferenceActivity() {
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
supportActionBar.title = getString(R.string.settings)
|
||||
supportActionBar.setDisplayHomeAsUpEnabled(true)
|
||||
supportActionBar?.title = getString(R.string.settings)
|
||||
supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
||||
addPreferencesFromResource(R.xml.settings_main)
|
||||
}
|
||||
|
||||
|
@ -1,19 +1,18 @@
|
||||
package io.neoterm.ui.settings
|
||||
|
||||
import android.os.Bundle
|
||||
import android.support.v7.app.AppCompatPreferenceActivity
|
||||
import android.view.MenuItem
|
||||
import io.neoterm.R
|
||||
|
||||
/**
|
||||
* @author kiva
|
||||
*/
|
||||
class UISettingsActivity : AppCompatPreferenceActivity() {
|
||||
class UISettingsActivity : BasePreferenceActivity() {
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
supportActionBar.title = getString(R.string.ui_settings)
|
||||
supportActionBar.setDisplayHomeAsUpEnabled(true)
|
||||
supportActionBar?.title = getString(R.string.ui_settings)
|
||||
supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
||||
addPreferencesFromResource(R.xml.settings_ui)
|
||||
}
|
||||
|
||||
|
@ -39,6 +39,7 @@ class AboutActivity : AppCompatActivity() {
|
||||
AlertDialog.Builder(this)
|
||||
.setTitle(R.string.about_developers_label)
|
||||
.setMessage(R.string.about_developers)
|
||||
.setPositiveButton(android.R.string.yes, null)
|
||||
.show()
|
||||
}
|
||||
|
||||
@ -46,6 +47,7 @@ class AboutActivity : AppCompatActivity() {
|
||||
AlertDialog.Builder(this)
|
||||
.setTitle(R.string.about_credits_label)
|
||||
.setMessage(R.string.about_credits)
|
||||
.setPositiveButton(android.R.string.yes, null)
|
||||
.show()
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user