Add files via upload

This commit is contained in:
Agent-8 2017-12-26 12:41:20 -05:00 committed by GitHub
parent f7d4914882
commit 906410643b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 207 additions and 160 deletions

View file

@ -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();

View file

@ -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));
} }

View file

@ -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();