mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-06 09:05:45 +00:00
bbe96d9b8b
--HG-- rename : mobile/android/base/GeckoMenu.java => mobile/android/base/menu/GeckoMenu.java rename : mobile/android/base/GeckoMenuInflater.java => mobile/android/base/menu/GeckoMenuInflater.java rename : mobile/android/base/GeckoMenuItem.java => mobile/android/base/menu/GeckoMenuItem.java rename : mobile/android/base/GeckoSubMenu.java => mobile/android/base/menu/GeckoSubMenu.java rename : mobile/android/base/MenuItemActionBar.java => mobile/android/base/menu/MenuItemActionBar.java rename : mobile/android/base/MenuItemDefault.java => mobile/android/base/menu/MenuItemDefault.java rename : mobile/android/base/MenuPanel.java => mobile/android/base/menu/MenuPanel.java rename : mobile/android/base/MenuPopup.java => mobile/android/base/menu/MenuPopup.java rename : mobile/android/base/Divider.java => mobile/android/base/widget/Divider.java rename : mobile/android/base/GeckoPopupMenu.java => mobile/android/base/widget/GeckoPopupMenu.java extra : rebase_source : 3b51b8af8318e346fe41b3ab7c18421d67b1359b
40 lines
1.2 KiB
Java
40 lines
1.2 KiB
Java
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
package org.mozilla.gecko.widget;
|
|
|
|
import android.content.Context;
|
|
import android.util.AttributeSet;
|
|
import android.view.View;
|
|
import android.widget.LinearLayout.LayoutParams;
|
|
|
|
public class Divider extends View {
|
|
public static enum Orientation { HORIZONTAL, VERTICAL };
|
|
|
|
// Orientation of the divider.
|
|
private Orientation mOrientation;
|
|
|
|
// Density of the device.
|
|
private int mDensity;
|
|
|
|
public Divider(Context context, AttributeSet attrs) {
|
|
super(context, attrs);
|
|
|
|
mDensity = (int) context.getResources().getDisplayMetrics().density;
|
|
|
|
setOrientation(Orientation.HORIZONTAL);
|
|
}
|
|
|
|
public void setOrientation(Orientation orientation) {
|
|
if (mOrientation != orientation) {
|
|
mOrientation = orientation;
|
|
|
|
if (mOrientation == Orientation.HORIZONTAL)
|
|
setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, mDensity));
|
|
else
|
|
setLayoutParams(new LayoutParams(mDensity, LayoutParams.FILL_PARENT));
|
|
}
|
|
}
|
|
}
|