add placeholder BaseFragment

This commit is contained in:
Rahul Patel
2018-07-11 17:31:12 +05:30
parent 9a56ae4ee7
commit 5255976012
6 changed files with 19 additions and 26 deletions

View File

@@ -35,7 +35,7 @@ import android.widget.TextView;
import com.dragons.aurora.R;
import com.dragons.aurora.view.LinkCard;
public class AboutFragment extends AccountsHelper {
public class AboutFragment extends BaseFragment {
private final int linkIcons[] = {
R.drawable.ic_gitlab,

View File

@@ -49,7 +49,7 @@ import static com.dragons.aurora.Util.isConnected;
import static com.dragons.aurora.Util.setText;
import static com.dragons.aurora.Util.show;
public class AccountsFragment extends AccountsHelper {
public class AccountsFragment extends BaseFragment {
private boolean isSecAvailable;
private String myEmail;

View File

@@ -23,6 +23,7 @@ package com.dragons.aurora.fragment;
import android.support.v4.app.Fragment;
public abstract class AccountsHelper extends Fragment {
public abstract class BaseFragment extends Fragment {
}

View File

@@ -49,7 +49,7 @@ import com.dragons.custom.TagView;
import static com.dragons.aurora.Util.isConnected;
public class HomeFragment extends AccountsHelper {
public class HomeFragment extends BaseFragment {
private AdaptiveToolbar adtb;
private View view;

View File

@@ -35,7 +35,6 @@ import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.ScrollView;
import android.widget.Spinner;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
@@ -62,9 +61,12 @@ import static com.dragons.aurora.fragment.PreferenceFragment.PREFERENCE_REQUESTE
import static com.dragons.aurora.fragment.PreferenceFragment.PREFERENCE_REQUESTED_LANGUAGE_INDEX;
import static com.dragons.aurora.fragment.PreferenceFragment.PREFERENCE_REQUESTED_LOCATION_INDEX;
public class SpoofFragment extends AccountsHelper {
public class SpoofFragment extends BaseFragment {
static String LineageURl = "https://wiki.lineageos.org/images/devices/";
public static final String LineageURl = "https://wiki.lineageos.org/images/devices/";
public static final String BUILD_DEVICE = "Build.DEVICE";
public static final String BUILD_MANUFACTURER = "Build.MANUFACTURER";
public static final String BUILD_HARDWARE = "Build.HARDWARE";
private String deviceName;
private View view;
@@ -123,18 +125,18 @@ public class SpoofFragment extends AccountsHelper {
public void drawDevice() {
getDeviceImg(LineageURl + Build.DEVICE + ".png");
setText(R.id.device_model, R.string.device_model, Build.MODEL, Build.DEVICE);
setText(R.id.device_manufacturer, Build.MANUFACTURER);
setText(R.id.device_architect, Build.BOARD);
Util.setText(view, R.id.device_model, R.string.device_model, Build.MODEL, Build.DEVICE);
Util.setText(view, R.id.device_manufacturer, Build.MANUFACTURER);
Util.setText(view, R.id.device_architect, Build.BOARD);
}
public void drawSpoofedDevice() {
Properties properties = new SpoofDeviceManager(this.getActivity()).getProperties(deviceName);
String Model = properties.getProperty("UserReadableName");
getDeviceImg(LineageURl + properties.getProperty("Build.DEVICE") + ".png");
setText(R.id.device_model, R.string.device_model, Model.substring(0, Model.indexOf('(')), properties.getProperty("Build.DEVICE"));
setText(R.id.device_manufacturer, properties.getProperty("Build.MANUFACTURER"));
setText(R.id.device_architect, properties.getProperty("Build.HARDWARE"));
getDeviceImg(LineageURl + properties.getProperty(BUILD_DEVICE) + ".png");
Util.setText(view, R.id.device_model, R.string.device_model, Model.substring(0, Model.indexOf('(')), properties.getProperty(BUILD_DEVICE));
Util.setText(view, R.id.device_manufacturer, properties.getProperty(BUILD_MANUFACTURER));
Util.setText(view, R.id.device_architect, properties.getProperty(BUILD_HARDWARE));
}
void setupLanguage() {
@@ -253,16 +255,6 @@ public class SpoofFragment extends AccountsHelper {
}
protected void setText(int viewId, String text) {
TextView textView = (TextView) view.findViewById(viewId);
if (null != textView)
textView.setText(text);
}
protected void setText(int viewId, int stringId, Object... text) {
setText(viewId, this.getString(stringId, text));
}
protected Map<String, String> getDeviceKeyValueMap() {
Map<String, String> devices = new SpoofDeviceManager(getContext()).getDevices();
devices = Util.sort(devices);

View File

@@ -28,7 +28,7 @@ import com.dragons.aurora.ContextUtil;
import com.dragons.aurora.CredentialsEmptyException;
import com.dragons.aurora.PlayStoreApiAuthenticator;
import com.dragons.aurora.R;
import com.dragons.aurora.fragment.AccountsHelper;
import com.dragons.aurora.fragment.BaseFragment;
import com.dragons.aurora.fragment.PreferenceFragment;
import com.dragons.aurora.helpers.Accountant;
import com.dragons.aurora.playstoreapiv2.AuthException;
@@ -43,7 +43,7 @@ import java.net.UnknownHostException;
import javax.net.ssl.SSLHandshakeException;
public abstract class ExceptionTask extends AccountsHelper {
public abstract class ExceptionTask extends BaseFragment {
protected Throwable exception;