mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-28 21:33:53 +01:00
Add files via upload
This commit is contained in:
parent
f7d4914882
commit
906410643b
3 changed files with 207 additions and 160 deletions
|
|
@ -16,22 +16,45 @@ import android.util.AttributeSet;
|
||||||
import fr.free.nrw.commons.R;
|
import fr.free.nrw.commons.R;
|
||||||
import fr.free.nrw.commons.utils.UiUtils;
|
import fr.free.nrw.commons.utils.UiUtils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* a text view compatible with older versions of the platform
|
||||||
|
*/
|
||||||
public class CompatTextView extends AppCompatTextView {
|
public class CompatTextView extends AppCompatTextView {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a new instance of CompatTextView
|
||||||
|
* @param context the view context
|
||||||
|
*/
|
||||||
public CompatTextView(Context context) {
|
public CompatTextView(Context context) {
|
||||||
super(context);
|
super(context);
|
||||||
init(null);
|
init(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a new instance of CompatTextView
|
||||||
|
* @param context the view context
|
||||||
|
* @param attrs the set of attributes for the view
|
||||||
|
*/
|
||||||
public CompatTextView(Context context, AttributeSet attrs) {
|
public CompatTextView(Context context, AttributeSet attrs) {
|
||||||
super(context, attrs);
|
super(context, attrs);
|
||||||
init(attrs);
|
init(attrs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a new instance of CompatTextView
|
||||||
|
* @param context
|
||||||
|
* @param attrs
|
||||||
|
* @param defStyleAttr
|
||||||
|
*/
|
||||||
public CompatTextView(Context context, AttributeSet attrs, int defStyleAttr) {
|
public CompatTextView(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||||
super(context, attrs, defStyleAttr);
|
super(context, attrs, defStyleAttr);
|
||||||
init(attrs);
|
init(attrs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* initializes the view
|
||||||
|
* @param attrs the attribute set of the view, which can be null
|
||||||
|
*/
|
||||||
private void init(@Nullable AttributeSet attrs) {
|
private void init(@Nullable AttributeSet attrs) {
|
||||||
if (attrs != null) {
|
if (attrs != null) {
|
||||||
Context context = getContext();
|
Context context = getContext();
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,11 @@ import android.util.AttributeSet;
|
||||||
*/
|
*/
|
||||||
public class HtmlTextView extends AppCompatTextView {
|
public class HtmlTextView extends AppCompatTextView {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a new instance of HtmlTextView
|
||||||
|
* @param context the context of the view
|
||||||
|
* @param attrs the set of attributes for the view
|
||||||
|
*/
|
||||||
public HtmlTextView(Context context, AttributeSet attrs) {
|
public HtmlTextView(Context context, AttributeSet attrs) {
|
||||||
super(context, attrs);
|
super(context, attrs);
|
||||||
|
|
||||||
|
|
@ -21,6 +26,10 @@ public class HtmlTextView extends AppCompatTextView {
|
||||||
setText(fromHtml(getText().toString()));
|
setText(fromHtml(getText().toString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the text to be displayed
|
||||||
|
* @param newText the text to be displayed
|
||||||
|
*/
|
||||||
public void setHtmlText(String newText) {
|
public void setHtmlText(String newText) {
|
||||||
setText(fromHtml(newText));
|
setText(fromHtml(newText));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,20 +11,35 @@ import android.view.View;
|
||||||
import android.view.Window;
|
import android.view.Window;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* a formatted dialog fragment
|
||||||
|
*/
|
||||||
public abstract class OverlayDialog extends DialogFragment {
|
public abstract class OverlayDialog extends DialogFragment {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* creates a DialogFragment with the correct style and theme
|
||||||
|
* @param savedInstanceState
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setStyle(STYLE_NO_FRAME, android.R.style.Theme_Holo_Light);
|
setStyle(STYLE_NO_FRAME, android.R.style.Theme_Holo_Light);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* allows subclasses to initialize themselves if needed
|
||||||
|
* @param view the view being used
|
||||||
|
* @param savedInstanceState bundle re-constructed from a previous saved state
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void onViewCreated(View view, Bundle savedInstanceState) {
|
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||||
setDialogLayoutToFullScreen();
|
setDialogLayoutToFullScreen();
|
||||||
super.onViewCreated(view, savedInstanceState);
|
super.onViewCreated(view, savedInstanceState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* sets the dialog layout to fullscreen
|
||||||
|
*/
|
||||||
private void setDialogLayoutToFullScreen() {
|
private void setDialogLayoutToFullScreen() {
|
||||||
Window window = getDialog().getWindow();
|
Window window = getDialog().getWindow();
|
||||||
WindowManager.LayoutParams wlp = window.getAttributes();
|
WindowManager.LayoutParams wlp = window.getAttributes();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue