1. Add service layer for backup / restore operations. 2. Reduce amount of duplicate code in activity classes.
32 lines
1.1 KiB
Java
32 lines
1.1 KiB
Java
package com.stevesoltys.backup.activity;
|
|
|
|
import android.app.Activity;
|
|
import android.content.Context;
|
|
import android.graphics.Color;
|
|
import android.graphics.drawable.ColorDrawable;
|
|
import android.view.Gravity;
|
|
import android.view.LayoutInflater;
|
|
import android.view.View;
|
|
import android.view.ViewGroup;
|
|
import android.widget.PopupWindow;
|
|
import com.stevesoltys.backup.R;
|
|
|
|
/**
|
|
* @author Steve Soltys
|
|
*/
|
|
public class PopupWindowUtil {
|
|
|
|
public static PopupWindow showLoadingPopupWindow(Activity parent) {
|
|
LayoutInflater inflater = (LayoutInflater) parent.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
|
ViewGroup popupViewGroup = parent.findViewById(R.id.popup_layout);
|
|
View popupView = inflater.inflate(R.layout.progress_popup_window, popupViewGroup);
|
|
|
|
PopupWindow popupWindow = new PopupWindow(popupView, 750, 350, true);
|
|
popupWindow.setBackgroundDrawable(new ColorDrawable(Color.WHITE));
|
|
popupWindow.setElevation(10);
|
|
popupWindow.setFocusable(false);
|
|
popupWindow.showAtLocation(popupView, Gravity.CENTER, 0, 0);
|
|
popupWindow.setOutsideTouchable(false);
|
|
return popupWindow;
|
|
}
|
|
}
|