mirror of
https://github.com/whyorean/AuroraStore.git
synced 2026-06-19 21:19:16 -04:00
Add back Spoof Activity
This commit is contained in:
@@ -111,12 +111,6 @@
|
||||
android:configChanges="keyboardHidden|orientation|screenSize|locale"
|
||||
android:launchMode="singleInstance" />
|
||||
|
||||
<activity
|
||||
android:name=".activities.DeviceActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize|locale"
|
||||
android:label="@string/action_spoofed"
|
||||
android:launchMode="singleInstance" />
|
||||
|
||||
<activity
|
||||
android:name=".activities.AuroraActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize|locale"
|
||||
|
||||
@@ -117,10 +117,21 @@ public class Util {
|
||||
PreferenceManager.getDefaultSharedPreferences(context).edit().putString(key, TextUtils.join(DELIMITER, set)).apply();
|
||||
}
|
||||
|
||||
static public void putString(Context context, String key, String value) {
|
||||
PreferenceManager.getDefaultSharedPreferences(context).edit().putString(key, value).apply();
|
||||
}
|
||||
|
||||
static public void putInteger(Context context, String key, int value) {
|
||||
PreferenceManager.getDefaultSharedPreferences(context).edit().putInt(key, value).apply();
|
||||
}
|
||||
|
||||
static public void putBoolean(Context context, String key, boolean value) {
|
||||
PreferenceManager.getDefaultSharedPreferences(context).edit().putBoolean(key, value).apply();
|
||||
}
|
||||
|
||||
public static int getInteger(Context context, String key) {
|
||||
return PreferenceManager.getDefaultSharedPreferences(context).getInt(key, 0);
|
||||
}
|
||||
|
||||
public static Boolean getBoolean(Context context, String key) {
|
||||
return PreferenceManager.getDefaultSharedPreferences(context).getBoolean(key, false);
|
||||
@@ -262,4 +273,11 @@ public class Util {
|
||||
return oldName.substring(0, oldName.indexOf("("));
|
||||
else return oldName;
|
||||
}
|
||||
|
||||
public static void completeCheckout(Context context) {
|
||||
putBoolean(context, "LOGGED_IN", false);
|
||||
putString(context, "GOOGLE_NAME", "");
|
||||
putString(context, "GOOGLE_URL", "");
|
||||
new PlayStoreApiAuthenticator(context).logout();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -141,6 +141,9 @@ public class AuroraActivity extends BaseActivity implements View.OnClickListener
|
||||
case R.id.action_settings:
|
||||
startActivity(new Intent(getApplicationContext(), PreferenceActivity.class));
|
||||
break;
|
||||
case R.id.action_spoof:
|
||||
startActivity(new Intent(getApplicationContext(), SpoofActivity.class));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,102 +0,0 @@
|
||||
/*
|
||||
* Aurora Store
|
||||
* Copyright (C) 2018 Rahul Kumar Patel <whyorean@gmail.com>
|
||||
*
|
||||
* Yalp Store
|
||||
* Copyright (C) 2018 Sergey Yeriomin <yeriomin@gmail.com>
|
||||
*
|
||||
* Aurora Store (a fork of Yalp Store )is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Aurora Store is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Aurora Store. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.dragons.aurora.activities;
|
||||
|
||||
import android.content.res.ColorStateList;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.widget.ImageViewCompat;
|
||||
import android.view.Display;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.dragons.aurora.R;
|
||||
import com.dragons.aurora.SpoofDeviceManager;
|
||||
import com.dragons.aurora.fragment.PreferenceFragment;
|
||||
|
||||
import java.util.Properties;
|
||||
import java.util.TimeZone;
|
||||
|
||||
public class DeviceActivity extends AuroraActivity {
|
||||
String deviceName;
|
||||
ImageView spoofed;
|
||||
Display mDisplay;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
FrameLayout contentFrameLayout = (FrameLayout) findViewById(R.id.content_frame);
|
||||
getLayoutInflater().inflate(R.layout.app_device_inc, contentFrameLayout);
|
||||
|
||||
deviceName = PreferenceFragment.getString(this, PreferenceFragment.PREFERENCE_DEVICE_TO_PRETEND_TO_BE);
|
||||
spoofed = (ImageView) findViewById(R.id.spoofed_indicator);
|
||||
mDisplay = (this).getWindowManager().getDefaultDisplay();
|
||||
|
||||
if (isSpoofed())
|
||||
drawSpoofedDevice();
|
||||
else
|
||||
drawDevice();
|
||||
}
|
||||
|
||||
public boolean isSpoofed() {
|
||||
return (deviceName.contains("device-"));
|
||||
}
|
||||
|
||||
public void drawDevice() {
|
||||
ImageViewCompat.setImageTintList(spoofed, ColorStateList.valueOf((getResources().getColor(R.color.colorGreen))));
|
||||
setText(R.id.device_model, R.string.device_model, Build.MODEL, Build.DEVICE);
|
||||
setText(R.id.device_manufacturer, R.string.device_manufacturer, Build.MANUFACTURER);
|
||||
setText(R.id.device_architect, R.string.device_board, Build.BOARD);
|
||||
setText(R.id.device_timezone, R.string.device_timezone, (CharSequence) TimeZone.getDefault().getDisplayName());
|
||||
setText(R.id.device_resolution, R.string.device_res, mDisplay.getWidth(), mDisplay.getHeight());
|
||||
setText(R.id.device_api, R.string.device_api, Build.VERSION.SDK);
|
||||
setText(R.id.device_cpu, R.string.device_cpu, Build.CPU_ABI);
|
||||
}
|
||||
|
||||
public void drawSpoofedDevice() {
|
||||
ImageViewCompat.setImageTintList(spoofed, ColorStateList.valueOf((getResources().getColor(R.color.colorRed))));
|
||||
|
||||
Properties properties = new SpoofDeviceManager(this).getProperties(deviceName);
|
||||
String Model = properties.getProperty("UserReadableName");
|
||||
|
||||
setText(R.id.device_model, R.string.device_model, Model.substring(0, Model.indexOf('(')), properties.getProperty("Build.DEVICE"));
|
||||
setText(R.id.device_manufacturer, R.string.device_manufacturer, properties.getProperty("Build.MANUFACTURER"));
|
||||
setText(R.id.device_architect, R.string.device_board, properties.getProperty("Build.HARDWARE"));
|
||||
setText(R.id.device_timezone, R.string.device_timezone, properties.getProperty("TimeZone"));
|
||||
setText(R.id.device_resolution, R.string.device_res, properties.getProperty("Screen.Width"), properties.getProperty("Screen.Height"));
|
||||
setText(R.id.device_api, R.string.device_api, properties.getProperty("Build.VERSION.SDK_INT"));
|
||||
String Platforms = properties.getProperty("Platforms");
|
||||
setText(R.id.device_cpu, R.string.device_cpu, Platforms.substring(0, Platforms.indexOf(',')));
|
||||
}
|
||||
|
||||
protected void setText(int viewId, String text) {
|
||||
TextView textView = (TextView) this.findViewById(viewId);
|
||||
if (null != textView)
|
||||
textView.setText(text);
|
||||
}
|
||||
|
||||
protected void setText(int viewId, int stringId, Object... text) {
|
||||
setText(viewId, this.getString(stringId, text));
|
||||
}
|
||||
}
|
||||
@@ -21,37 +21,60 @@
|
||||
|
||||
package com.dragons.aurora.activities;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.design.widget.FloatingActionButton;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.widget.TableLayout;
|
||||
import android.widget.TableRow;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.dragons.aurora.ContextUtil;
|
||||
import com.dragons.aurora.R;
|
||||
import com.dragons.aurora.SpoofDeviceManager;
|
||||
import com.dragons.aurora.Util;
|
||||
import com.dragons.aurora.playstoreapiv2.PropertiesDeviceInfoProvider;
|
||||
import com.dragons.aurora.view.PropCard;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Properties;
|
||||
|
||||
import static com.dragons.aurora.fragment.PreferenceFragment.PREFERENCE_DEVICE_TO_PRETEND_TO_BE;
|
||||
import static com.dragons.aurora.fragment.PreferenceFragment.PREFERENCE_DEVICE_TO_PRETEND_TO_BE_INDEX;
|
||||
|
||||
public class DeviceInfoActivity extends AuroraActivity {
|
||||
|
||||
public static final String INTENT_DEVICE_NAME = "INTENT_DEVICE_NAME";
|
||||
public static final String INTENT_DEVICE_INDEX = "INTENT_DEVICE_INDEX";
|
||||
private String deviceName;
|
||||
private int deviceIndex;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.deviceinfo_activity_layout);
|
||||
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE
|
||||
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
|
||||
getWindow().setStatusBarColor(getResources().getColor(R.color.semi_transparent));
|
||||
onNewIntent(getIntent());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
super.onBackPressed();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onNewIntent(Intent intent) {
|
||||
super.onNewIntent(intent);
|
||||
String deviceName = intent.getStringExtra(INTENT_DEVICE_NAME);
|
||||
deviceName = intent.getStringExtra(INTENT_DEVICE_NAME);
|
||||
deviceIndex = intent.getIntExtra(INTENT_DEVICE_INDEX, 0);
|
||||
if (TextUtils.isEmpty(deviceName)) {
|
||||
Log.e(getClass().getSimpleName(), "No device name given");
|
||||
finish();
|
||||
@@ -59,35 +82,58 @@ public class DeviceInfoActivity extends AuroraActivity {
|
||||
}
|
||||
|
||||
Properties properties = new SpoofDeviceManager(this).getProperties(deviceName);
|
||||
setTitle(properties.getProperty("UserReadableName"));
|
||||
((TextView) findViewById(R.id.aurora_title)).setText(properties.getProperty("UserReadableName"));
|
||||
List<String> keys = new ArrayList<>();
|
||||
for (Object key : properties.keySet()) {
|
||||
keys.add((String) key);
|
||||
}
|
||||
Collections.sort(keys);
|
||||
|
||||
TableLayout table = (TableLayout) findViewById(R.id.device_info);
|
||||
Collections.sort(keys);
|
||||
LinearLayout root = findViewById(R.id.device_info);
|
||||
for (String key : keys) {
|
||||
addRow(table, key, ((String) properties.get(key)).replace(",", ", "));
|
||||
addCards(root, key, ((String) properties.get(key)).replace(",", ", "));
|
||||
}
|
||||
|
||||
setupButtons();
|
||||
}
|
||||
|
||||
private void addRow(TableLayout parent, String key, String value) {
|
||||
TableRow.LayoutParams rowParams = new TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.WRAP_CONTENT);
|
||||
private void addCards(LinearLayout root, String key, String value) {
|
||||
root.addView(new PropCard(this, key, value));
|
||||
}
|
||||
|
||||
TextView textViewKey = new TextView(this);
|
||||
textViewKey.setText(key);
|
||||
textViewKey.setLayoutParams(rowParams);
|
||||
private void setupButtons() {
|
||||
ImageView toolbar_back = findViewById(R.id.toolbar_back);
|
||||
toolbar_back.setOnClickListener(click -> onBackPressed());
|
||||
|
||||
TextView textViewValue = new TextView(this);
|
||||
textViewValue.setText(value);
|
||||
textViewValue.setLayoutParams(rowParams);
|
||||
FloatingActionButton incognito_fab = findViewById(R.id.incognito_fab);
|
||||
incognito_fab.show();
|
||||
incognito_fab.setOnClickListener(click -> showConfirmationDialog());
|
||||
}
|
||||
|
||||
TableRow tableRow = new TableRow(this);
|
||||
tableRow.setLayoutParams(new TableLayout.LayoutParams(TableLayout.LayoutParams.WRAP_CONTENT, TableLayout.LayoutParams.WRAP_CONTENT));
|
||||
tableRow.addView(textViewKey);
|
||||
tableRow.addView(textViewValue);
|
||||
private boolean isDeviceDefinitionValid(String spoofDevice) {
|
||||
PropertiesDeviceInfoProvider deviceInfoProvider = new PropertiesDeviceInfoProvider();
|
||||
deviceInfoProvider.setProperties(new SpoofDeviceManager(this).getProperties(spoofDevice));
|
||||
deviceInfoProvider.setLocaleString(Locale.getDefault().toString());
|
||||
return deviceInfoProvider.isValid();
|
||||
}
|
||||
|
||||
parent.addView(tableRow);
|
||||
private void showConfirmationDialog() {
|
||||
new AlertDialog.Builder(this)
|
||||
.setMessage(R.string.pref_device_to_pretend_to_be_toast)
|
||||
.setTitle(R.string.dialog_title_logout)
|
||||
.setPositiveButton(R.string.action_logout, (dialogInterface, i) -> {
|
||||
if (!TextUtils.isEmpty(deviceName) && !isDeviceDefinitionValid(deviceName)) {
|
||||
ContextUtil.toast(this, R.string.error_invalid_device_definition);
|
||||
} else {
|
||||
Util.putString(this, PREFERENCE_DEVICE_TO_PRETEND_TO_BE, deviceName);
|
||||
Util.putInteger(this, PREFERENCE_DEVICE_TO_PRETEND_TO_BE_INDEX, deviceIndex);
|
||||
}
|
||||
Util.completeCheckout(this);
|
||||
dialogInterface.dismiss();
|
||||
startActivity(new Intent(this, LoginActivity.class));
|
||||
this.finish();
|
||||
})
|
||||
.setNegativeButton(android.R.string.cancel, null)
|
||||
.show();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
package com.dragons.aurora.activities;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
import com.dragons.aurora.R;
|
||||
import com.dragons.aurora.fragment.SpoofFragment;
|
||||
@@ -31,9 +32,10 @@ public class SpoofActivity extends AuroraActivity {
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
setContentView(R.layout.helper_activity);
|
||||
|
||||
setContentView(R.layout.helper_activity_alt);
|
||||
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE
|
||||
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
|
||||
getWindow().setStatusBarColor(getResources().getColor(R.color.semi_transparent));
|
||||
getSupportFragmentManager()
|
||||
.beginTransaction()
|
||||
.replace(R.id.content_frame, new SpoofFragment())
|
||||
|
||||
@@ -118,7 +118,6 @@ public class SingleRatingsAdapter extends RecyclerView.Adapter<SingleRatingsAdap
|
||||
viewHolder.badgeContainer.setBackgroundColor(ColorUtils.setAlphaComponent(dotColor, 20));
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isLastPref(int position) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
return prefs.getFloat("FILTER_RATING", 0.0f) == Float.parseFloat(mValues[position]);
|
||||
|
||||
@@ -28,7 +28,6 @@ import android.support.annotation.NonNull;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
@@ -36,6 +35,7 @@ import android.widget.TextView;
|
||||
import com.dragons.aurora.CircleTransform;
|
||||
import com.dragons.aurora.PlayStoreApiAuthenticator;
|
||||
import com.dragons.aurora.R;
|
||||
import com.dragons.aurora.Util;
|
||||
import com.dragons.aurora.activities.LoginActivity;
|
||||
import com.dragons.aurora.task.UserProvidedCredentialsTask;
|
||||
import com.github.florent37.shapeofview.shapes.CircleView;
|
||||
@@ -190,8 +190,7 @@ public class AccountsFragment extends UtilFragment {
|
||||
.setMessage(R.string.dialog_message_logout)
|
||||
.setTitle(R.string.dialog_title_logout)
|
||||
.setPositiveButton(android.R.string.yes, (dialogInterface, i) -> {
|
||||
checkOut();
|
||||
new PlayStoreApiAuthenticator(getContext()).logout();
|
||||
Util.completeCheckout(getContext());
|
||||
dialogInterface.dismiss();
|
||||
getActivity().finish();
|
||||
startActivity(new Intent(getContext(), LoginActivity.class));
|
||||
|
||||
@@ -28,6 +28,7 @@ import android.support.v7.app.AlertDialog;
|
||||
|
||||
import com.dragons.aurora.PlayStoreApiAuthenticator;
|
||||
import com.dragons.aurora.R;
|
||||
import com.dragons.aurora.Util;
|
||||
import com.dragons.aurora.activities.LoginActivity;
|
||||
import com.dragons.aurora.task.AppProvidedCredentialsTask;
|
||||
import com.dragons.aurora.task.UserProvidedCredentialsTask;
|
||||
@@ -63,7 +64,7 @@ public abstract class AccountsHelper extends Fragment {
|
||||
|
||||
public void switchDummy() {
|
||||
if (isLoggedIn())
|
||||
new PlayStoreApiAuthenticator(getContext()).logout();
|
||||
Util.completeCheckout(getContext());
|
||||
|
||||
AppProvidedCredentialsTask.LoginTask task = new AppProvidedCredentialsTask.LoginTask(getContext());
|
||||
task.setContext(getContext());
|
||||
@@ -77,7 +78,7 @@ public abstract class AccountsHelper extends Fragment {
|
||||
|
||||
public void loginWithDummy() {
|
||||
if (isLoggedIn())
|
||||
new PlayStoreApiAuthenticator(getContext()).logout();
|
||||
Util.completeCheckout(getContext());
|
||||
new AppProvidedCredentialsTask(getContext()).logInWithPredefinedAccount();
|
||||
}
|
||||
|
||||
|
||||
@@ -46,10 +46,8 @@ import com.dragons.aurora.Util;
|
||||
import com.dragons.aurora.activities.AuroraActivity;
|
||||
import com.dragons.aurora.fragment.preference.Blacklist;
|
||||
import com.dragons.aurora.fragment.preference.CheckUpdates;
|
||||
import com.dragons.aurora.fragment.preference.Device;
|
||||
import com.dragons.aurora.fragment.preference.DownloadDirectory;
|
||||
import com.dragons.aurora.fragment.preference.InstallationMethod;
|
||||
import com.dragons.aurora.fragment.preference.Language;
|
||||
|
||||
public class PreferenceFragment extends android.preference.PreferenceFragment {
|
||||
|
||||
@@ -62,7 +60,9 @@ public class PreferenceFragment extends android.preference.PreferenceFragment {
|
||||
public static final String PREFERENCE_BACKGROUND_UPDATE_WIFI_ONLY = "PREFERENCE_BACKGROUND_UPDATE_WIFI_ONLY";
|
||||
public static final String PREFERENCE_BACKGROUND_UPDATE_INSTALL = "PREFERENCE_BACKGROUND_UPDATE_INSTALL";
|
||||
public static final String PREFERENCE_REQUESTED_LANGUAGE = "PREFERENCE_REQUESTED_LANGUAGE";
|
||||
public static final String PREFERENCE_REQUESTED_LANGUAGE_INDEX = "PREFERENCE_REQUESTED_LANGUAGE_INDEX";
|
||||
public static final String PREFERENCE_DEVICE_TO_PRETEND_TO_BE = "PREFERENCE_DEVICE_TO_PRETEND_TO_BE";
|
||||
public static final String PREFERENCE_DEVICE_TO_PRETEND_TO_BE_INDEX = "PREFERENCE_DEVICE_TO_PRETEND_TO_BE_INDEX";
|
||||
public static final String PREFERENCE_INSTALLATION_METHOD = "PREFERENCE_INSTALLATION_METHOD";
|
||||
public static final String PREFERENCE_NO_IMAGES = "PREFERENCE_NO_IMAGES";
|
||||
public static final String PREFERENCE_DOWNLOAD_DIRECTORY = "PREFERENCE_DOWNLOAD_DIRECTORY";
|
||||
@@ -112,9 +112,7 @@ public class PreferenceFragment extends android.preference.PreferenceFragment {
|
||||
setupThemes(getActivity());
|
||||
setupSwitches(getActivity());
|
||||
drawBlackList();
|
||||
drawLanguages();
|
||||
drawUpdatesCheck();
|
||||
drawDevices();
|
||||
drawInstallationMethod();
|
||||
new DownloadDirectory(this).setPreference((EditTextPreference) findPreference(PREFERENCE_DOWNLOAD_DIRECTORY)).draw();
|
||||
}
|
||||
@@ -143,18 +141,6 @@ public class PreferenceFragment extends android.preference.PreferenceFragment {
|
||||
checkUpdatesFragment.draw();
|
||||
}
|
||||
|
||||
private void drawLanguages() {
|
||||
Language languageFragment = new Language(this);
|
||||
languageFragment.setListPreference((ListPreference) findPreference(PREFERENCE_REQUESTED_LANGUAGE));
|
||||
languageFragment.draw();
|
||||
}
|
||||
|
||||
private void drawDevices() {
|
||||
Device languageFragment = new Device(this);
|
||||
languageFragment.setListPreference((ListPreference) findPreference(PREFERENCE_DEVICE_TO_PRETEND_TO_BE));
|
||||
languageFragment.draw();
|
||||
}
|
||||
|
||||
private void drawInstallationMethod() {
|
||||
InstallationMethod installationMethodFragment = new InstallationMethod(this);
|
||||
installationMethodFragment.setInstallationMethodPreference((ListPreference) findPreference(PREFERENCE_INSTALLATION_METHOD));
|
||||
|
||||
@@ -21,30 +21,45 @@
|
||||
|
||||
package com.dragons.aurora.fragment;
|
||||
|
||||
import android.content.res.ColorStateList;
|
||||
import android.content.Intent;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.widget.ImageViewCompat;
|
||||
import android.view.Display;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.dragons.aurora.PlayStoreApiAuthenticator;
|
||||
import com.dragons.aurora.R;
|
||||
import com.dragons.aurora.SpoofDeviceManager;
|
||||
import com.dragons.aurora.Util;
|
||||
import com.dragons.aurora.activities.DeviceInfoActivity;
|
||||
import com.squareup.picasso.Picasso;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import static com.dragons.aurora.fragment.PreferenceFragment.PREFERENCE_DEVICE_TO_PRETEND_TO_BE;
|
||||
import static com.dragons.aurora.fragment.PreferenceFragment.PREFERENCE_DEVICE_TO_PRETEND_TO_BE_INDEX;
|
||||
import static com.dragons.aurora.fragment.PreferenceFragment.PREFERENCE_REQUESTED_LANGUAGE;
|
||||
import static com.dragons.aurora.fragment.PreferenceFragment.PREFERENCE_REQUESTED_LANGUAGE_INDEX;
|
||||
|
||||
public class SpoofFragment extends UtilFragment {
|
||||
|
||||
static String LineageURl = "https://wiki.lineageos.org/images/devices/";
|
||||
|
||||
private String deviceName;
|
||||
private ImageView spoofed;
|
||||
private Display mDisplay;
|
||||
private View v;
|
||||
private View view;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
@@ -54,59 +69,146 @@ public class SpoofFragment extends UtilFragment {
|
||||
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
if (v != null) {
|
||||
if ((ViewGroup) v.getParent() != null)
|
||||
((ViewGroup) v.getParent()).removeView(v);
|
||||
return v;
|
||||
if (view != null) {
|
||||
if ((ViewGroup) view.getParent() != null)
|
||||
((ViewGroup) view.getParent()).removeView(view);
|
||||
return view;
|
||||
}
|
||||
|
||||
v = inflater.inflate(R.layout.app_device_inc, container, false);
|
||||
|
||||
deviceName = PreferenceFragment.getString(getActivity(), PreferenceFragment.PREFERENCE_DEVICE_TO_PRETEND_TO_BE);
|
||||
spoofed = (ImageView) v.findViewById(R.id.spoofed_indicator);
|
||||
mDisplay = (this).getActivity().getWindowManager().getDefaultDisplay();
|
||||
view = inflater.inflate(R.layout.fragment_spoof, container, false);
|
||||
|
||||
if (isSpoofed())
|
||||
drawSpoofedDevice();
|
||||
else
|
||||
drawDevice();
|
||||
return v;
|
||||
|
||||
setupLanguage();
|
||||
setupDevice();
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
if (isSpoofed())
|
||||
drawSpoofedDevice();
|
||||
else
|
||||
drawDevice();
|
||||
}
|
||||
|
||||
public boolean isSpoofed() {
|
||||
deviceName = PreferenceFragment.getString(getActivity(), PreferenceFragment.PREFERENCE_DEVICE_TO_PRETEND_TO_BE);
|
||||
return (deviceName.contains("device-"));
|
||||
}
|
||||
|
||||
public void drawDevice() {
|
||||
ImageViewCompat.setImageTintList(spoofed, ColorStateList.valueOf((getResources().getColor(R.color.colorGreen))));
|
||||
Picasso
|
||||
.with(getContext())
|
||||
.load(LineageURl + Build.DEVICE + ".png")
|
||||
.placeholder(ContextCompat.getDrawable(getContext(), R.drawable.ic_device))
|
||||
.into((ImageView) view.findViewById(R.id.device_avatar));
|
||||
|
||||
setText(R.id.device_model, R.string.device_model, Build.MODEL, Build.DEVICE);
|
||||
setText(R.id.device_manufacturer, R.string.device_manufacturer, Build.MANUFACTURER);
|
||||
setText(R.id.device_architect, R.string.device_board, Build.BOARD);
|
||||
setText(R.id.device_timezone, R.string.device_timezone, (CharSequence) TimeZone.getDefault().getDisplayName());
|
||||
setText(R.id.device_resolution, R.string.device_res, mDisplay.getWidth(), mDisplay.getHeight());
|
||||
setText(R.id.device_api, R.string.device_api, Build.VERSION.SDK);
|
||||
setText(R.id.device_cpu, R.string.device_cpu, Build.CPU_ABI);
|
||||
setText(R.id.device_manufacturer, Build.MANUFACTURER);
|
||||
setText(R.id.device_architect, Build.BOARD);
|
||||
}
|
||||
|
||||
public void drawSpoofedDevice() {
|
||||
ImageViewCompat.setImageTintList(spoofed, ColorStateList.valueOf((getResources().getColor(R.color.colorRed))));
|
||||
|
||||
Properties properties = new SpoofDeviceManager(this.getActivity()).getProperties(deviceName);
|
||||
String Model = properties.getProperty("UserReadableName");
|
||||
|
||||
Picasso
|
||||
.with(getContext())
|
||||
.load(LineageURl + properties.getProperty("Build.DEVICE") + ".png")
|
||||
.placeholder(ContextCompat.getDrawable(getContext(), R.drawable.ic_device))
|
||||
.into((ImageView) view.findViewById(R.id.device_avatar));
|
||||
|
||||
setText(R.id.device_model, R.string.device_model, Model.substring(0, Model.indexOf('(')), properties.getProperty("Build.DEVICE"));
|
||||
setText(R.id.device_manufacturer, R.string.device_manufacturer, properties.getProperty("Build.MANUFACTURER"));
|
||||
setText(R.id.device_architect, R.string.device_board, properties.getProperty("Build.HARDWARE"));
|
||||
setText(R.id.device_timezone, R.string.device_timezone, properties.getProperty("TimeZone"));
|
||||
setText(R.id.device_resolution, R.string.device_res, properties.getProperty("Screen.Width"), properties.getProperty("Screen.Height"));
|
||||
setText(R.id.device_api, R.string.device_api, properties.getProperty("Build.VERSION.SDK_INT"));
|
||||
String Platforms = properties.getProperty("Platforms");
|
||||
setText(R.id.device_cpu, R.string.device_cpu, Platforms.substring(0, Platforms.indexOf(',')));
|
||||
setText(R.id.device_manufacturer, properties.getProperty("Build.MANUFACTURER"));
|
||||
setText(R.id.device_architect, properties.getProperty("Build.HARDWARE"));
|
||||
}
|
||||
|
||||
void setupLanguage() {
|
||||
Spinner spinner = (Spinner) view.findViewById(R.id.spoof_language);
|
||||
Map<String, String> locales = getLanguageKeyValueMap();
|
||||
String[] localeList = locales.values().toArray(new String[0]);
|
||||
String[] localeKeys = locales.keySet().toArray(new String[0]);
|
||||
|
||||
ArrayAdapter<CharSequence> adapter = new ArrayAdapter<>(
|
||||
getContext(),
|
||||
android.R.layout.simple_spinner_item,
|
||||
localeList
|
||||
);
|
||||
|
||||
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
spinner.setAdapter(adapter);
|
||||
spinner.setSelection(Util.getInteger(getContext(), PREFERENCE_REQUESTED_LANGUAGE_INDEX), true);
|
||||
spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||
if (position > 0) {
|
||||
try {
|
||||
new PlayStoreApiAuthenticator(getActivity()).getApi().setLocale(new Locale(localeKeys[position]));
|
||||
Util.putString(getContext(), PREFERENCE_REQUESTED_LANGUAGE, localeKeys[position]);
|
||||
Util.putInteger(getContext(), PREFERENCE_REQUESTED_LANGUAGE_INDEX, position);
|
||||
} catch (IOException e) {
|
||||
// Should be impossible to get to preferences with incorrect credentials
|
||||
}
|
||||
}
|
||||
|
||||
if (position == 0) {
|
||||
Util.putString(getContext(), PREFERENCE_REQUESTED_LANGUAGE, "");
|
||||
Util.putInteger(getContext(), PREFERENCE_REQUESTED_LANGUAGE_INDEX, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> parent) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void setupDevice() {
|
||||
Spinner spinner = view.findViewById(R.id.spoof_device);
|
||||
Map<String, String> devices = getDeviceKeyValueMap();
|
||||
|
||||
String[] deviceList = devices.values().toArray(new String[0]);
|
||||
String[] deviceKeys = devices.keySet().toArray(new String[0]);
|
||||
|
||||
ArrayAdapter<CharSequence> adapter = new ArrayAdapter<>(
|
||||
getContext(),
|
||||
android.R.layout.simple_spinner_item,
|
||||
deviceList
|
||||
);
|
||||
|
||||
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
spinner.setAdapter(adapter);
|
||||
spinner.setSelection(Util.getInteger(getContext(), PREFERENCE_DEVICE_TO_PRETEND_TO_BE_INDEX), true);
|
||||
spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||
if (position > 0) {
|
||||
Intent i = new Intent(getContext(), DeviceInfoActivity.class);
|
||||
i.putExtra(DeviceInfoActivity.INTENT_DEVICE_NAME, deviceKeys[position]);
|
||||
i.putExtra(DeviceInfoActivity.INTENT_DEVICE_INDEX, position);
|
||||
getContext().startActivity(i);
|
||||
}
|
||||
if (position == 0) {
|
||||
Util.putString(getContext(), PREFERENCE_DEVICE_TO_PRETEND_TO_BE, "");
|
||||
Util.putInteger(getContext(), PREFERENCE_DEVICE_TO_PRETEND_TO_BE_INDEX, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> parent) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected void setText(int viewId, String text) {
|
||||
TextView textView = (TextView) v.findViewById(viewId);
|
||||
TextView textView = (TextView) view.findViewById(viewId);
|
||||
if (null != textView)
|
||||
textView.setText(text);
|
||||
}
|
||||
@@ -114,4 +216,28 @@ public class SpoofFragment extends UtilFragment {
|
||||
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);
|
||||
Util.addToStart(
|
||||
(LinkedHashMap<String, String>) devices,
|
||||
"",
|
||||
view.getContext().getString(R.string.pref_device_to_pretend_to_be_default)
|
||||
);
|
||||
return devices;
|
||||
}
|
||||
|
||||
protected Map<String, String> getLanguageKeyValueMap() {
|
||||
Map<String, String> languages = new HashMap<>();
|
||||
for (Locale locale : Locale.getAvailableLocales()) {
|
||||
String displayName = locale.getDisplayName();
|
||||
displayName = displayName.substring(0, 1).toUpperCase(Locale.getDefault()) + displayName.substring(1);
|
||||
languages.put(locale.toString(), displayName);
|
||||
}
|
||||
languages = Util.sort(languages);
|
||||
Util.addToStart((LinkedHashMap<String, String>) languages, "",
|
||||
getActivity().getString(R.string.pref_requested_language_default));
|
||||
return languages;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,176 +0,0 @@
|
||||
/*
|
||||
* Aurora Store
|
||||
* Copyright (C) 2018 Rahul Kumar Patel <whyorean@gmail.com>
|
||||
*
|
||||
* Yalp Store
|
||||
* Copyright (C) 2018 Sergey Yeriomin <yeriomin@gmail.com>
|
||||
*
|
||||
* Aurora Store (a fork of Yalp Store )is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Aurora Store is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Aurora Store. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.dragons.aurora.fragment.preference;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.preference.Preference;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.dragons.aurora.ContextUtil;
|
||||
import com.dragons.aurora.OnListPreferenceChangeListener;
|
||||
import com.dragons.aurora.PlayStoreApiAuthenticator;
|
||||
import com.dragons.aurora.R;
|
||||
import com.dragons.aurora.SpoofDeviceManager;
|
||||
import com.dragons.aurora.Util;
|
||||
import com.dragons.aurora.activities.AuroraActivity;
|
||||
import com.dragons.aurora.activities.DeviceInfoActivity;
|
||||
import com.dragons.aurora.fragment.PreferenceFragment;
|
||||
import com.dragons.aurora.playstoreapiv2.PropertiesDeviceInfoProvider;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
public class Device extends List {
|
||||
|
||||
private static final String PREFERENCE_DEVICE_DEFINITION_REQUESTED = "PREFERENCE_DEVICE_DEFINITION_REQUESTED";
|
||||
|
||||
public Device(PreferenceFragment activity) {
|
||||
super(activity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw() {
|
||||
super.draw();
|
||||
listPreference.setOnPreferenceClickListener(preference -> {
|
||||
ContextUtil.toast(
|
||||
activity.getActivity().getApplicationContext(),
|
||||
R.string.pref_device_to_pretend_to_be_notice,
|
||||
PreferenceManager.getDefaultSharedPreferences(activity.getActivity()).getString(PreferenceFragment.PREFERENCE_DOWNLOAD_DIRECTORY, "")
|
||||
);
|
||||
((AlertDialog) listPreference.getDialog()).getListView().setOnItemLongClickListener((parent, v, position, id) -> {
|
||||
if (position > 0) {
|
||||
Intent i = new Intent(activity.getActivity(), DeviceInfoActivity.class);
|
||||
i.putExtra(DeviceInfoActivity.INTENT_DEVICE_NAME, (String) keyValueMap.keySet().toArray()[position]);
|
||||
activity.startActivity(i);
|
||||
}
|
||||
return false;
|
||||
});
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected OnListPreferenceChangeListener getOnListPreferenceChangeListener() {
|
||||
OnListPreferenceChangeListener listener = new OnListPreferenceChangeListener() {
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
if (!TextUtils.isEmpty((String) newValue) && !isDeviceDefinitionValid((String) newValue)) {
|
||||
ContextUtil.toast(activity.getActivity().getApplicationContext(), R.string.error_invalid_device_definition);
|
||||
return false;
|
||||
}
|
||||
showLogOutDialog();
|
||||
return super.onPreferenceChange(preference, newValue);
|
||||
}
|
||||
};
|
||||
listener.setDefaultLabel(activity.getString(R.string.pref_device_to_pretend_to_be_default));
|
||||
return listener;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Map<String, String> getKeyValueMap() {
|
||||
Map<String, String> devices = new SpoofDeviceManager(activity.getActivity()).getDevices();
|
||||
devices = Util.sort(devices);
|
||||
Util.addToStart(
|
||||
(LinkedHashMap<String, String>) devices,
|
||||
"",
|
||||
activity.getString(R.string.pref_device_to_pretend_to_be_default)
|
||||
);
|
||||
return devices;
|
||||
}
|
||||
|
||||
private boolean isDeviceDefinitionValid(String spoofDevice) {
|
||||
PropertiesDeviceInfoProvider deviceInfoProvider = new PropertiesDeviceInfoProvider();
|
||||
deviceInfoProvider.setProperties(new SpoofDeviceManager(activity.getActivity()).getProperties(spoofDevice));
|
||||
deviceInfoProvider.setLocaleString(Locale.getDefault().toString());
|
||||
return deviceInfoProvider.isValid();
|
||||
}
|
||||
|
||||
private boolean showRequestDialog(boolean logOut) {
|
||||
PreferenceManager.getDefaultSharedPreferences(activity.getActivity())
|
||||
.edit()
|
||||
.putBoolean(PREFERENCE_DEVICE_DEFINITION_REQUESTED, true)
|
||||
.apply()
|
||||
;
|
||||
return true;
|
||||
}
|
||||
|
||||
private AlertDialog showLogOutDialog() {
|
||||
return new AlertDialog.Builder(activity.getActivity())
|
||||
.setMessage(R.string.pref_device_to_pretend_to_be_toast)
|
||||
.setTitle(R.string.dialog_title_logout)
|
||||
.setPositiveButton(android.R.string.yes, new RequestOnClickListener(activity.getActivity(), true))
|
||||
.setNegativeButton(R.string.dialog_two_factor_cancel, new RequestOnClickListener(activity.getActivity(), false))
|
||||
.show()
|
||||
;
|
||||
}
|
||||
|
||||
private void finishAll() {
|
||||
new PlayStoreApiAuthenticator(activity.getActivity().getApplicationContext()).logout();
|
||||
AuroraActivity.cascadeFinish();
|
||||
activity.getActivity().finish();
|
||||
}
|
||||
|
||||
class RequestOnClickListener implements DialogInterface.OnClickListener {
|
||||
|
||||
private boolean logOut;
|
||||
private boolean askedAlready;
|
||||
|
||||
public RequestOnClickListener(Activity activity, boolean logOut) {
|
||||
askedAlready = PreferenceFragment.getBoolean(activity, PREFERENCE_DEVICE_DEFINITION_REQUESTED);
|
||||
this.logOut = logOut;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
dialogInterface.dismiss();
|
||||
if (askedAlready) {
|
||||
if (logOut) {
|
||||
finishAll();
|
||||
}
|
||||
} else {
|
||||
showRequestDialog(logOut);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class FinishingOnClickListener implements DialogInterface.OnClickListener {
|
||||
|
||||
private boolean logOut;
|
||||
|
||||
public FinishingOnClickListener(boolean logOut) {
|
||||
this.logOut = logOut;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
dialogInterface.dismiss();
|
||||
if (logOut) {
|
||||
finishAll();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,78 +0,0 @@
|
||||
/*
|
||||
* Aurora Store
|
||||
* Copyright (C) 2018 Rahul Kumar Patel <whyorean@gmail.com>
|
||||
*
|
||||
* Yalp Store
|
||||
* Copyright (C) 2018 Sergey Yeriomin <yeriomin@gmail.com>
|
||||
*
|
||||
* Aurora Store (a fork of Yalp Store )is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Aurora Store is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Aurora Store. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.dragons.aurora.fragment.preference;
|
||||
|
||||
import android.preference.Preference;
|
||||
|
||||
import com.dragons.aurora.OnListPreferenceChangeListener;
|
||||
import com.dragons.aurora.PlayStoreApiAuthenticator;
|
||||
import com.dragons.aurora.R;
|
||||
import com.dragons.aurora.Util;
|
||||
import com.dragons.aurora.fragment.PreferenceFragment;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
public class Language extends List {
|
||||
|
||||
public Language(PreferenceFragment activity) {
|
||||
super(activity);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected OnListPreferenceChangeListener getOnListPreferenceChangeListener() {
|
||||
OnListPreferenceChangeListener listener = new OnListPreferenceChangeListener() {
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
boolean result = super.onPreferenceChange(preference, newValue);
|
||||
try {
|
||||
new PlayStoreApiAuthenticator(activity.getActivity()).getApi().setLocale(new Locale((String) newValue));
|
||||
} catch (IOException e) {
|
||||
// Should be impossible to get to preferences with incorrect credentials
|
||||
}
|
||||
return result;
|
||||
}
|
||||
};
|
||||
listener.setDefaultLabel(activity.getString(R.string.pref_requested_language_default));
|
||||
return listener;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Map<String, String> getKeyValueMap() {
|
||||
Map<String, String> languages = new HashMap<>();
|
||||
for (Locale locale : Locale.getAvailableLocales()) {
|
||||
String displayName = locale.getDisplayName();
|
||||
displayName = displayName.substring(0, 1).toUpperCase(Locale.getDefault()) + displayName.substring(1);
|
||||
languages.put(locale.toString(), displayName);
|
||||
}
|
||||
languages = Util.sort(languages);
|
||||
Util.addToStart(
|
||||
(LinkedHashMap<String, String>) languages,
|
||||
"",
|
||||
activity.getString(R.string.pref_requested_language_default)
|
||||
);
|
||||
return languages;
|
||||
}
|
||||
}
|
||||
@@ -1,87 +0,0 @@
|
||||
/*
|
||||
* Aurora Store
|
||||
* Copyright (C) 2018 Rahul Kumar Patel <whyorean@gmail.com>
|
||||
*
|
||||
* Yalp Store
|
||||
* Copyright (C) 2018 Sergey Yeriomin <yeriomin@gmail.com>
|
||||
*
|
||||
* Aurora Store (a fork of Yalp Store )is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Aurora Store is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Aurora Store. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.dragons.aurora.fragment.preference;
|
||||
|
||||
import android.os.AsyncTask;
|
||||
import android.preference.ListPreference;
|
||||
|
||||
import com.dragons.aurora.OnListPreferenceChangeListener;
|
||||
import com.dragons.aurora.fragment.PreferenceFragment;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public abstract class List extends Abstract {
|
||||
|
||||
protected ListPreference listPreference;
|
||||
protected Map<String, String> keyValueMap;
|
||||
|
||||
public List(PreferenceFragment activity) {
|
||||
super(activity);
|
||||
}
|
||||
|
||||
abstract protected Map<String, String> getKeyValueMap();
|
||||
|
||||
abstract protected OnListPreferenceChangeListener getOnListPreferenceChangeListener();
|
||||
|
||||
public void setListPreference(ListPreference listPreference) {
|
||||
this.listPreference = listPreference;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw() {
|
||||
new ListValuesTask(this, listPreference).execute();
|
||||
}
|
||||
|
||||
static class ListValuesTask extends AsyncTask<Void, Void, Void> {
|
||||
|
||||
private List list;
|
||||
private ListPreference listPreference;
|
||||
|
||||
public ListValuesTask(List list, ListPreference listPreference) {
|
||||
this.list = list;
|
||||
this.listPreference = listPreference;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
listPreference.setEntries(new String[0]);
|
||||
listPreference.setEntryValues(new String[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(Void aVoid) {
|
||||
int count = list.keyValueMap.size();
|
||||
listPreference.setEntries(list.keyValueMap.values().toArray(new CharSequence[count]));
|
||||
listPreference.setEntryValues(list.keyValueMap.keySet().toArray(new CharSequence[count]));
|
||||
OnListPreferenceChangeListener listener = list.getOnListPreferenceChangeListener();
|
||||
listener.setKeyValueMap(list.keyValueMap);
|
||||
listPreference.setOnPreferenceChangeListener(listener);
|
||||
listener.setSummary(listPreference, listPreference.getValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Void doInBackground(Void... voids) {
|
||||
list.keyValueMap = list.getKeyValueMap();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -123,7 +123,7 @@ public class UserProvidedCredentialsTask extends CheckCredentialsTask {
|
||||
if (checkBox.isChecked()) {
|
||||
setGooglePrefs(email, password);
|
||||
}
|
||||
new PlayStoreApiAuthenticator(context).logout();
|
||||
Util.completeCheckout(context);
|
||||
getUserCredentialsTask().execute(email, password);
|
||||
});
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ import android.text.TextUtils;
|
||||
|
||||
import com.dragons.aurora.CategoryManager;
|
||||
import com.dragons.aurora.PlayStoreApiAuthenticator;
|
||||
import com.dragons.aurora.fragment.PreferenceFragment;
|
||||
import com.dragons.aurora.playstoreapiv2.DocV2;
|
||||
import com.dragons.aurora.playstoreapiv2.GooglePlayAPI;
|
||||
import com.dragons.aurora.playstoreapiv2.ListResponse;
|
||||
@@ -74,9 +75,10 @@ public class CategoryListTask extends ExceptionTask {
|
||||
}
|
||||
|
||||
private Locale getLocale(Context context) {
|
||||
return new Locale.Builder()
|
||||
.setLanguage(context.getResources().getConfiguration().locale.getLanguage())
|
||||
.setRegion(context.getResources().getConfiguration().locale.getCountry())
|
||||
.build();
|
||||
String locale = PreferenceFragment.getString(context, PreferenceFragment.PREFERENCE_REQUESTED_LANGUAGE);
|
||||
if (TextUtils.isEmpty(locale))
|
||||
return Locale.getDefault();
|
||||
else
|
||||
return new Locale(locale);
|
||||
}
|
||||
}
|
||||
@@ -29,6 +29,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.Util;
|
||||
import com.dragons.aurora.fragment.PreferenceFragment;
|
||||
import com.dragons.aurora.playstoreapiv2.AuthException;
|
||||
import com.dragons.aurora.task.AppProvidedCredentialsTask;
|
||||
@@ -115,8 +116,8 @@ abstract public class PlayStoreTask<T> extends TaskWithProgress<T> {
|
||||
new AppProvidedCredentialsTask(context).refreshToken();
|
||||
return;
|
||||
} else {
|
||||
ContextUtil.toast(this.context, R.string.error_incorrect_password);
|
||||
new PlayStoreApiAuthenticator(context).logout();
|
||||
ContextUtil.toast(context, R.string.error_incorrect_password);
|
||||
Util.completeCheckout(context);
|
||||
}
|
||||
if (ContextUtil.isAlive(context)) {
|
||||
//Mehh!
|
||||
|
||||
58
app/src/main/java/com/dragons/aurora/view/PropCard.java
Normal file
58
app/src/main/java/com/dragons/aurora/view/PropCard.java
Normal file
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Aurora Store
|
||||
* Copyright (C) 2018 Rahul Kumar Patel <whyorean@gmail.com>
|
||||
*
|
||||
* Yalp Store
|
||||
* Copyright (C) 2018 Sergey Yeriomin <yeriomin@gmail.com>
|
||||
*
|
||||
* Aurora Store (a fork of Yalp Store )is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Aurora Store is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Aurora Store. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.dragons.aurora.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.dragons.aurora.R;
|
||||
|
||||
public class PropCard extends RelativeLayout {
|
||||
|
||||
String key;
|
||||
String value;
|
||||
TextView card_key;
|
||||
TextView card_value;
|
||||
|
||||
public PropCard(Context context, String key, String value) {
|
||||
super(context);
|
||||
this.key = key;
|
||||
this.value = value;
|
||||
init(context);
|
||||
}
|
||||
|
||||
public PropCard(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
init(context);
|
||||
}
|
||||
|
||||
private void init(Context context) {
|
||||
View view = inflate(context, R.layout.prop_card, this);
|
||||
card_key = view.findViewById(R.id.prop_key);
|
||||
card_value = view.findViewById(R.id.prop_value);
|
||||
card_key.setText(key);
|
||||
card_value.setText(value.isEmpty() ? "N/A" : value);
|
||||
}
|
||||
}
|
||||
@@ -1,28 +1,10 @@
|
||||
<!-- Copyright (C) 2017 Flaticon under CreativeCommon License -->
|
||||
<vector android:height="24dp" android:viewportHeight="512.0"
|
||||
android:viewportWidth="512.0" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#8CC63F" android:pathData="M256,256m-256,0a256,256 0,1 1,512 0a256,256 0,1 1,-512 0"/>
|
||||
<path android:fillColor="#8CC63F" android:pathData="M509.1,294.3L336.4,121.5L78,322.4l44.9,44.9l-23.7,13.2l130.1,130.1C238.1,511.5 247,512 256,512C384.4,512 490.7,417.5 509.1,294.3z"/>
|
||||
<path android:fillColor="#E0E0E0" android:pathData="M260.7,380.6l-107,0l15.4,-79.4l76.2,0z"/>
|
||||
<path android:fillColor="#C0C0C0" android:pathData="M245.3,301.2l-38.3,0l0,79.4l53.7,0z"/>
|
||||
<path android:fillColor="#1A1A1A" android:pathData="M78,121.5h258.3v183h-258.3z"/>
|
||||
<path android:fillColor="#FF000000" android:pathData="M207,121.5h129.4v183h-129.4z"/>
|
||||
<path android:fillColor="#35CCFF" android:pathData="M95.7,138.7h223.1v173.5h-223.1z"/>
|
||||
<path android:fillColor="#00BAFF" android:pathData="M207,138.7h111.7v173.5h-111.7z"/>
|
||||
<path android:fillColor="#FFFFFF" android:pathData="M78,269.7h258.3v52.8h-258.3z"/>
|
||||
<path android:fillColor="#E0E0E0" android:pathData="M207,269.7h129.4v52.8h-129.4z"/>
|
||||
<path android:fillColor="#E0E0E0" android:pathData="M207.2,293.1m-11.4,0a11.4,11.4 0,1 1,22.7 0a11.4,11.4 0,1 1,-22.7 0"/>
|
||||
<path android:fillColor="#C0C0C0" android:pathData="M207.2,281.8c-0.1,0 -0.1,0 -0.2,0v22.7c0.1,0 0.1,0 0.2,0c6.3,0 11.4,-5.1 11.4,-11.4C218.6,286.8 213.5,281.8 207.2,281.8z"/>
|
||||
<path android:fillColor="#333333" android:pathData="M242,243h189.5v123h-189.5z"/>
|
||||
<path android:fillColor="#1A1A1A" android:pathData="M336,243h95.5v123h-95.5z"/>
|
||||
<path android:fillColor="#35CCFF" android:pathData="M255.3,256.3h162.9v105.7h-162.9z"/>
|
||||
<path android:fillColor="#00BAFF" android:pathData="M336,256.3h82.2v105.7h-82.2z"/>
|
||||
<path android:fillColor="#1A1A1A" android:pathData="M232.9,352.2h207.7v28.3h-207.7z"/>
|
||||
<path android:fillColor="#FF000000" android:pathData="M336,352.2h104.6v28.3h-104.6z"/>
|
||||
<path android:fillColor="#333333" android:pathData="M99.3,220.9h91.4v159.7h-91.4z"/>
|
||||
<path android:fillColor="#1A1A1A" android:pathData="M145,220.9h45.7v159.7h-45.7z"/>
|
||||
<path android:fillColor="#B9EAFF" android:pathData="M108.9,230.6h72.2v125h-72.2z"/>
|
||||
<path android:fillColor="#35CCFF" android:pathData="M145,230.6h36.1v125h-36.1z"/>
|
||||
<path android:fillColor="#4D4D4D" android:pathData="M145,367.3m-7.2,0a7.2,7.2 0,1 1,14.3 0a7.2,7.2 0,1 1,-14.3 0"/>
|
||||
<path android:fillColor="#333333" android:pathData="M145,360.2c-0,0 -0,0 -0,0v14.3c0,0 0,0 0,0c4,0 7.2,-3.2 7.2,-7.2C152.2,363.4 149,360.2 145,360.2z"/>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportHeight="24.0"
|
||||
android:viewportWidth="24.0">
|
||||
<path
|
||||
android:fillAlpha=".75"
|
||||
android:fillColor="?android:attr/colorForeground"
|
||||
android:pathData="M3,4H20A2,2 0,0 1,22 6V8H18V6H5V18H14V20H3A2,2 0,0 1,1 18V6A2,2 0,0 1,3 4M17,10H23A1,1 0,0 1,24 11V21A1,1 0,0 1,23 22H17A1,1 0,0 1,16 21V11A1,1 0,0 1,17 10M18,12V19H22V12H18Z" />
|
||||
</vector>
|
||||
|
||||
30
app/src/main/res/drawable/ic_incognito.xml
Normal file
30
app/src/main/res/drawable/ic_incognito.xml
Normal file
@@ -0,0 +1,30 @@
|
||||
<!--
|
||||
~ Aurora Store
|
||||
~ Copyright (C) 2018 Rahul Kumar Patel <whyorean@gmail.com>
|
||||
~
|
||||
~ Yalp Store
|
||||
~ Copyright (C) 2018 Sergey Yeriomin <yeriomin@gmail.com>
|
||||
~
|
||||
~ Aurora Store (a fork of Yalp Store )is free software: you can redistribute it and/or modify
|
||||
~ it under the terms of the GNU General Public License as published by
|
||||
~ the Free Software Foundation, either version 2 of the License, or
|
||||
~ (at your option) any later version.
|
||||
~
|
||||
~ Aurora Store is distributed in the hope that it will be useful,
|
||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
~ GNU General Public License for more details.
|
||||
~
|
||||
~ You should have received a copy of the GNU General Public License
|
||||
~ along with Aurora Store. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportHeight="24.0"
|
||||
android:viewportWidth="24.0">
|
||||
<path
|
||||
android:fillColor="?android:attr/colorForeground"
|
||||
android:pathData="M12,3C9.31,3 7.41,4.22 7.41,4.22L6,9H18L16.59,4.22C16.59,4.22 14.69,3 12,3M12,11C9.27,11 5.39,11.54 5.13,11.59C4.09,11.87 3.25,12.15 2.59,12.41C1.58,12.75 1,13 1,13H23C23,13 22.42,12.75 21.41,12.41C20.75,12.15 19.89,11.87 18.84,11.59C18.84,11.59 14.82,11 12,11M7.5,14A3.5,3.5 0,0 0,4 17.5A3.5,3.5 0,0 0,7.5 21A3.5,3.5 0,0 0,11 17.5C11,17.34 11,17.18 10.97,17.03C11.29,16.96 11.63,16.9 12,16.91C12.37,16.91 12.71,16.96 13.03,17.03C13,17.18 13,17.34 13,17.5A3.5,3.5 0,0 0,16.5 21A3.5,3.5 0,0 0,20 17.5A3.5,3.5 0,0 0,16.5 14C15.03,14 13.77,14.9 13.25,16.19C12.93,16.09 12.55,16 12,16C11.45,16 11.07,16.09 10.75,16.19C10.23,14.9 8.97,14 7.5,14M7.5,15A2.5,2.5 0,0 1,10 17.5A2.5,2.5 0,0 1,7.5 20A2.5,2.5 0,0 1,5 17.5A2.5,2.5 0,0 1,7.5 15M16.5,15A2.5,2.5 0,0 1,19 17.5A2.5,2.5 0,0 1,16.5 20A2.5,2.5 0,0 1,14 17.5A2.5,2.5 0,0 1,16.5 15Z" />
|
||||
</vector>
|
||||
30
app/src/main/res/drawable/ic_translate.xml
Normal file
30
app/src/main/res/drawable/ic_translate.xml
Normal file
@@ -0,0 +1,30 @@
|
||||
<!--
|
||||
~ Aurora Store
|
||||
~ Copyright (C) 2018 Rahul Kumar Patel <whyorean@gmail.com>
|
||||
~
|
||||
~ Yalp Store
|
||||
~ Copyright (C) 2018 Sergey Yeriomin <yeriomin@gmail.com>
|
||||
~
|
||||
~ Aurora Store (a fork of Yalp Store )is free software: you can redistribute it and/or modify
|
||||
~ it under the terms of the GNU General Public License as published by
|
||||
~ the Free Software Foundation, either version 2 of the License, or
|
||||
~ (at your option) any later version.
|
||||
~
|
||||
~ Aurora Store is distributed in the hope that it will be useful,
|
||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
~ GNU General Public License for more details.
|
||||
~
|
||||
~ You should have received a copy of the GNU General Public License
|
||||
~ along with Aurora Store. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportHeight="24.0"
|
||||
android:viewportWidth="24.0">
|
||||
<path
|
||||
android:fillColor="?android:attr/colorForeground"
|
||||
android:pathData="M12.87,15.07L10.33,12.56L10.36,12.53C12.1,10.59 13.34,8.36 14.07,6H17V4H10V2H8V4H1V6H12.17C11.5,7.92 10.44,9.75 9,11.35C8.07,10.32 7.3,9.19 6.69,8H4.69C5.42,9.63 6.42,11.17 7.67,12.56L2.58,17.58L4,19L9,14L12.11,17.11L12.87,15.07M18.5,10H16.5L12,22H14L15.12,19H19.87L21,22H23L18.5,10M15.88,17L17.5,12.67L19.12,17H15.88Z" />
|
||||
</vector>
|
||||
@@ -1,5 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ Aurora Store
|
||||
~ Copyright (C) 2018 Rahul Kumar Patel <whyorean@gmail.com>
|
||||
~
|
||||
|
||||
@@ -1,146 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Aurora Store
|
||||
~ Copyright (C) 2018 Rahul Kumar Patel <whyorean@gmail.com>
|
||||
~
|
||||
~ Yalp Store
|
||||
~ Copyright (C) 2018 Sergey Yeriomin <yeriomin@gmail.com>
|
||||
~
|
||||
~ Aurora Store (a fork of Yalp Store )is free software: you can redistribute it and/or modify
|
||||
~ it under the terms of the GNU General Public License as published by
|
||||
~ the Free Software Foundation, either version 2 of the License, or
|
||||
~ (at your option) any later version.
|
||||
~
|
||||
~ Aurora Store is distributed in the hope that it will be useful,
|
||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
~ GNU General Public License for more details.
|
||||
~
|
||||
~ You should have received a copy of the GNU General Public License
|
||||
~ along with Aurora Store. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fadeScrollbars="true"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:weightSum="2">
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
app:cardUseCompatPadding="true">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal"
|
||||
android:padding="5dp"
|
||||
android:weightSum="8">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/device_avatar"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="@dimen/icon_size_big"
|
||||
android:layout_weight="2"
|
||||
android:src="@drawable/ic_device" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/device_detail_container"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_weight="5.5"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/device_model"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/device_manufacturer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/device_architect"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/device_timezone"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="14sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/spoofed_indicator"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="@dimen/icon_size_small"
|
||||
android:layout_weight=".5"
|
||||
android:src="@drawable/ic_checked" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="12dp"
|
||||
android:orientation="horizontal"
|
||||
android:padding="5dp"
|
||||
android:weightSum="3">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/device_resolution"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:drawableLeft="@drawable/ic_resolution"
|
||||
android:drawablePadding="5dp"
|
||||
android:gravity="center" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/device_api"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:drawablePadding="5dp"
|
||||
android:drawableStart="@drawable/ic_api"
|
||||
android:gravity="center" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/device_cpu"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:drawablePadding="5dp"
|
||||
android:drawableStart="@drawable/ic_cpu"
|
||||
android:gravity="center" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</android.support.v7.widget.CardView>
|
||||
</LinearLayout>
|
||||
</android.support.v4.widget.NestedScrollView>
|
||||
@@ -18,14 +18,106 @@
|
||||
~ You should have received a copy of the GNU General Public License
|
||||
~ along with Aurora Store. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<TableLayout
|
||||
android:id="@+id/device_info"
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
</ScrollView>
|
||||
<FrameLayout
|
||||
android:id="@+id/top_artwork"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<com.github.florent37.shapeofview.shapes.DiagonalView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="200dp"
|
||||
android:alpha=".8"
|
||||
app:shape_diagonal_angle="5"
|
||||
app:shape_diagonal_direction="left"
|
||||
app:shape_diagonal_position="bottom">
|
||||
|
||||
<View
|
||||
android:id="@+id/diagonalView1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/header_grad2" />
|
||||
|
||||
</com.github.florent37.shapeofview.shapes.DiagonalView>
|
||||
|
||||
<com.github.florent37.shapeofview.shapes.DiagonalView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="200dp"
|
||||
android:alpha=".8"
|
||||
app:shape_diagonal_angle="10"
|
||||
app:shape_diagonal_direction="right"
|
||||
app:shape_diagonal_position="bottom">
|
||||
|
||||
<View
|
||||
android:id="@+id/diagonalView2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/header_grad1" />
|
||||
</com.github.florent37.shapeofview.shapes.DiagonalView>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/toolbar_back"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="28dp"
|
||||
android:background="?android:selectableItemBackgroundBorderless"
|
||||
android:padding="10dp"
|
||||
android:src="@drawable/ic_arrow_left" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/aurora_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:fontFamily="@font/google_sans_bold"
|
||||
android:text="@string/app_name"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="22sp" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_margin="10dp"
|
||||
android:layout_weight="1">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/device_info"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="5dp" />
|
||||
</ScrollView>
|
||||
</LinearLayout>
|
||||
|
||||
<android.support.design.widget.FloatingActionButton
|
||||
android:id="@+id/incognito_fab"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end|bottom"
|
||||
android:layout_margin="15dp"
|
||||
android:src="@drawable/ic_incognito"
|
||||
android:tint="@color/white"
|
||||
android:visibility="gone"
|
||||
app:fabSize="normal"
|
||||
app:layout_anchorGravity="top|end" />
|
||||
|
||||
</android.support.design.widget.CoordinatorLayout>
|
||||
319
app/src/main/res/layout/fragment_spoof.xml
Normal file
319
app/src/main/res/layout/fragment_spoof.xml
Normal file
@@ -0,0 +1,319 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ Aurora Store
|
||||
~ Copyright (C) 2018 Rahul Kumar Patel <whyorean@gmail.com>
|
||||
~
|
||||
~ Yalp Store
|
||||
~ Copyright (C) 2018 Sergey Yeriomin <yeriomin@gmail.com>
|
||||
~
|
||||
~ Aurora Store (a fork of Yalp Store )is free software: you can redistribute it and/or modify
|
||||
~ it under the terms of the GNU General Public License as published by
|
||||
~ the Free Software Foundation, either version 2 of the License, or
|
||||
~ (at your option) any later version.
|
||||
~
|
||||
~ Aurora Store is distributed in the hope that it will be useful,
|
||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
~ GNU General Public License for more details.
|
||||
~
|
||||
~ You should have received a copy of the GNU General Public License
|
||||
~ along with Aurora Store. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/top_artwork"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<com.github.florent37.shapeofview.shapes.DiagonalView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="200dp"
|
||||
android:alpha=".8"
|
||||
app:shape_diagonal_angle="5"
|
||||
app:shape_diagonal_direction="left"
|
||||
app:shape_diagonal_position="bottom">
|
||||
|
||||
<View
|
||||
android:id="@+id/diagonalView1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/header_grad2" />
|
||||
|
||||
</com.github.florent37.shapeofview.shapes.DiagonalView>
|
||||
|
||||
<com.github.florent37.shapeofview.shapes.DiagonalView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="200dp"
|
||||
android:alpha=".8"
|
||||
app:shape_diagonal_angle="10"
|
||||
app:shape_diagonal_direction="right"
|
||||
app:shape_diagonal_position="bottom">
|
||||
|
||||
<View
|
||||
android:id="@+id/diagonalView2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/header_grad1" />
|
||||
</com.github.florent37.shapeofview.shapes.DiagonalView>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/aurora"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:fontFamily="@font/google_sans_bold"
|
||||
android:text="@string/app_name"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="22sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/store"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:alpha=".75"
|
||||
android:fontFamily="@font/google_sans"
|
||||
android:text="Spoof"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="22sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fadeScrollbars="true"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="5dp">
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
android:id="@+id/device_info"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="10dp"
|
||||
android:minHeight="72dp"
|
||||
app:cardBackgroundColor="?android:attr/panelBackground"
|
||||
app:cardCornerRadius="10dp"
|
||||
app:cardElevation="2dp"
|
||||
app:cardPreventCornerOverlap="false"
|
||||
app:cardUseCompatPadding="true">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/device_detail_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/device_avatar"
|
||||
android:layout_width="56dp"
|
||||
android:layout_height="56dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_margin="5dp"
|
||||
android:padding="10dp"
|
||||
android:src="@drawable/ic_device" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/device_model"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_toEndOf="@+id/device_avatar"
|
||||
android:ellipsize="end"
|
||||
android:fontFamily="@font/google_sans_bold"
|
||||
android:singleLine="true"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/device_model"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_toEndOf="@+id/device_avatar">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/device_manufacturer"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true" />
|
||||
|
||||
<View
|
||||
android:id="@+id/divider"
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="10dp"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_toEndOf="@id/device_manufacturer"
|
||||
android:background="@color/gray" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/device_architect"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_toEndOf="@+id/divider" />
|
||||
</RelativeLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</android.support.v7.widget.CardView>
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
android:id="@+id/device_card"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/device_info"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:minHeight="76dp"
|
||||
app:cardBackgroundColor="?android:attr/panelBackground"
|
||||
app:cardCornerRadius="10dp"
|
||||
app:cardElevation="2dp"
|
||||
app:cardPreventCornerOverlap="false"
|
||||
app:cardUseCompatPadding="true">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/spoof_device_header"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/spoof_device_img"
|
||||
android:layout_width="56dp"
|
||||
android:layout_height="56dp"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_margin="5dp"
|
||||
android:alpha=".75"
|
||||
android:padding="10dp"
|
||||
android:src="@drawable/ic_incognito" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/spoof_device_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="5dp"
|
||||
android:layout_toEndOf="@id/spoof_device_img"
|
||||
android:fontFamily="@font/google_sans_bold"
|
||||
android:text="@string/pref_category_spoof_device"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/spoof_device_summary"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/spoof_device_title"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_toEndOf="@id/spoof_device_img"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="2"
|
||||
android:text="@string/pref_device_to_pretend_to_be" />
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/spoof_device"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/spoof_device_summary"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:layout_marginStart="-2dp"
|
||||
android:layout_toEndOf="@id/spoof_device_img" />
|
||||
</RelativeLayout>
|
||||
|
||||
</android.support.v7.widget.CardView>
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
android:id="@+id/device_language"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/device_card"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:minHeight="76dp"
|
||||
app:cardBackgroundColor="?android:attr/panelBackground"
|
||||
app:cardCornerRadius="10dp"
|
||||
app:cardElevation="2dp"
|
||||
app:cardPreventCornerOverlap="false"
|
||||
app:cardUseCompatPadding="true">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/spoof_header"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/spoof_img"
|
||||
android:layout_width="56dp"
|
||||
android:layout_height="56dp"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_margin="5dp"
|
||||
android:alpha=".75"
|
||||
android:padding="10dp"
|
||||
android:src="@drawable/ic_translate" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/spoof_language_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="5dp"
|
||||
android:layout_toEndOf="@id/spoof_img"
|
||||
android:fontFamily="@font/google_sans_bold"
|
||||
android:text="@string/pref_category_spoof_lang"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/spoof_language_summary"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/spoof_language_title"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_toEndOf="@id/spoof_img"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="2"
|
||||
android:text="@string/pref_requested_language" />
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/spoof_language"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/spoof_language_summary"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:layout_marginStart="-2dp"
|
||||
android:layout_toEndOf="@id/spoof_img" />
|
||||
</RelativeLayout>
|
||||
|
||||
</android.support.v7.widget.CardView>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
</LinearLayout>
|
||||
64
app/src/main/res/layout/prop_card.xml
Normal file
64
app/src/main/res/layout/prop_card.xml
Normal file
@@ -0,0 +1,64 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ Aurora Store
|
||||
~ Copyright (C) 2018 Rahul Kumar Patel <whyorean@gmail.com>
|
||||
~
|
||||
~ Yalp Store
|
||||
~ Copyright (C) 2018 Sergey Yeriomin <yeriomin@gmail.com>
|
||||
~
|
||||
~ Aurora Store (a fork of Yalp Store )is free software: you can redistribute it and/or modify
|
||||
~ it under the terms of the GNU General Public License as published by
|
||||
~ the Free Software Foundation, either version 2 of the License, or
|
||||
~ (at your option) any later version.
|
||||
~
|
||||
~ Aurora Store is distributed in the hope that it will be useful,
|
||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
~ GNU General Public License for more details.
|
||||
~
|
||||
~ You should have received a copy of the GNU General Public License
|
||||
~ along with Aurora Store. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="72dp"
|
||||
app:cardBackgroundColor="?android:attr/panelBackground"
|
||||
app:cardCornerRadius="10dp"
|
||||
app:cardElevation="1dp"
|
||||
app:cardPreventCornerOverlap="false"
|
||||
app:cardUseCompatPadding="true"
|
||||
app:contentPadding="5dp">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/prop_key"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:layout_marginStart="5dp"
|
||||
android:fontFamily="@font/google_sans_bold"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/prop_value"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/prop_key"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="3" />
|
||||
</RelativeLayout>
|
||||
</android.support.v7.widget.CardView>
|
||||
</RelativeLayout>
|
||||
@@ -32,4 +32,8 @@
|
||||
android:id="@+id/action_settings"
|
||||
android:icon="@drawable/ic_settings"
|
||||
android:title="@string/action_settings" />
|
||||
<item
|
||||
android:id="@+id/action_spoof"
|
||||
android:icon="@drawable/ic_incognito"
|
||||
android:title="@string/action_spoofed" />
|
||||
</menu>
|
||||
|
||||
@@ -298,6 +298,8 @@
|
||||
<string name="pref_background_update_wifi_only">On Wi-Fi only</string>
|
||||
<string name="pref_category_installation">Installation</string>
|
||||
<string name="pref_category_spoofing">Spoofing</string>
|
||||
<string name="pref_category_spoof_device">Spoof Device</string>
|
||||
<string name="pref_category_spoof_lang">Spoof Language</string>
|
||||
<string name="pref_category_ui">User Interface</string>
|
||||
<string name="pref_category_updates">Updates</string>
|
||||
<string name="pref_delete_apk_after_install">Delete .apk after installation</string>
|
||||
|
||||
@@ -127,14 +127,4 @@
|
||||
android:key="PREFERENCE_INSTALLATION_METHOD"
|
||||
android:title="@string/pref_installation_method" />
|
||||
</PreferenceCategory>
|
||||
<PreferenceCategory android:title="@string/pref_category_spoofing">
|
||||
<ListPreference
|
||||
android:defaultValue=""
|
||||
android:key="PREFERENCE_REQUESTED_LANGUAGE"
|
||||
android:title="@string/pref_requested_language" />
|
||||
<ListPreference
|
||||
android:defaultValue=""
|
||||
android:key="PREFERENCE_DEVICE_TO_PRETEND_TO_BE"
|
||||
android:title="@string/pref_device_to_pretend_to_be" />
|
||||
</PreferenceCategory>
|
||||
</PreferenceScreen>
|
||||
Reference in New Issue
Block a user