mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-18 21:59:54 +01:00
@@ -1,29 +0,0 @@
|
|||||||
package org.briarproject.android.util;
|
|
||||||
|
|
||||||
import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
|
|
||||||
import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT;
|
|
||||||
import android.view.ViewGroup;
|
|
||||||
import android.widget.LinearLayout;
|
|
||||||
import android.widget.RelativeLayout;
|
|
||||||
|
|
||||||
public class CommonLayoutParams {
|
|
||||||
|
|
||||||
public static final ViewGroup.LayoutParams MATCH_MATCH =
|
|
||||||
new ViewGroup.LayoutParams(MATCH_PARENT, MATCH_PARENT);
|
|
||||||
|
|
||||||
public static final ViewGroup.LayoutParams MATCH_WRAP =
|
|
||||||
new ViewGroup.LayoutParams(MATCH_PARENT, WRAP_CONTENT);
|
|
||||||
|
|
||||||
public static final ViewGroup.LayoutParams WRAP_WRAP =
|
|
||||||
new ViewGroup.LayoutParams(WRAP_CONTENT, WRAP_CONTENT);
|
|
||||||
|
|
||||||
public static final LinearLayout.LayoutParams MATCH_WRAP_1 =
|
|
||||||
new LinearLayout.LayoutParams(MATCH_PARENT, WRAP_CONTENT, 1);
|
|
||||||
|
|
||||||
public static final LinearLayout.LayoutParams WRAP_WRAP_1 =
|
|
||||||
new LinearLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT, 1);
|
|
||||||
|
|
||||||
public static RelativeLayout.LayoutParams relative() {
|
|
||||||
return new RelativeLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
package org.briarproject.android.util;
|
|
||||||
|
|
||||||
import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.view.View;
|
|
||||||
import android.widget.LinearLayout.LayoutParams;
|
|
||||||
|
|
||||||
public class ElasticHorizontalSpace extends View {
|
|
||||||
|
|
||||||
public ElasticHorizontalSpace(Context ctx) {
|
|
||||||
super(ctx);
|
|
||||||
setLayoutParams(new LayoutParams(WRAP_CONTENT, 0, 1));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
package org.briarproject.android.util;
|
|
||||||
|
|
||||||
import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
|
|
||||||
|
|
||||||
import org.briarproject.R;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.ViewGroup.LayoutParams;
|
|
||||||
|
|
||||||
public class HorizontalBorder extends View {
|
|
||||||
|
|
||||||
public HorizontalBorder(Context ctx) {
|
|
||||||
super(ctx);
|
|
||||||
setLayoutParams(new LayoutParams(MATCH_PARENT, 1));
|
|
||||||
setBackgroundColor(getResources().getColor(R.color.horizontal_border));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
package org.briarproject.android.util;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.util.DisplayMetrics;
|
|
||||||
import android.view.WindowManager;
|
|
||||||
|
|
||||||
import static android.content.Context.WINDOW_SERVICE;
|
|
||||||
|
|
||||||
public class LayoutUtils {
|
|
||||||
|
|
||||||
public static int getPadding(Context ctx) {
|
|
||||||
DisplayMetrics metrics = getDisplayMetrics(ctx);
|
|
||||||
int percent = Math.max(metrics.widthPixels, metrics.heightPixels) / 100;
|
|
||||||
return percent + 7;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static DisplayMetrics getDisplayMetrics(Context ctx) {
|
|
||||||
DisplayMetrics metrics = new DisplayMetrics();
|
|
||||||
WindowManager wm = (WindowManager) ctx.getSystemService(WINDOW_SERVICE);
|
|
||||||
wm.getDefaultDisplay().getMetrics(metrics);
|
|
||||||
return metrics;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
package org.briarproject.android.util;
|
|
||||||
|
|
||||||
import static android.view.Gravity.CENTER;
|
|
||||||
import static org.briarproject.android.util.CommonLayoutParams.MATCH_WRAP_1;
|
|
||||||
import static org.briarproject.android.util.CommonLayoutParams.WRAP_WRAP;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.widget.LinearLayout;
|
|
||||||
import android.widget.ProgressBar;
|
|
||||||
|
|
||||||
public class ListLoadingProgressBar extends LinearLayout {
|
|
||||||
|
|
||||||
public ListLoadingProgressBar(Context ctx) {
|
|
||||||
super(ctx);
|
|
||||||
setLayoutParams(MATCH_WRAP_1);
|
|
||||||
setGravity(CENTER);
|
|
||||||
ProgressBar progress = new ProgressBar(ctx);
|
|
||||||
progress.setLayoutParams(WRAP_WRAP);
|
|
||||||
progress.setIndeterminate(true);
|
|
||||||
addView(progress);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user