mirror of
https://github.com/status-im/syng-client.git
synced 2025-02-24 00:48:10 +00:00
Code refactor. Removing redundant dependencies in build gradle
This commit is contained in:
parent
f1b5cad97b
commit
67e511a9c5
@ -48,19 +48,13 @@ dependencies {
|
|||||||
compile 'com.android.support:multidex:1.0.1'
|
compile 'com.android.support:multidex:1.0.1'
|
||||||
compile 'com.android.support:appcompat-v7:22.2.1'
|
compile 'com.android.support:appcompat-v7:22.2.1'
|
||||||
compile 'com.android.support:recyclerview-v7:22.2.1'
|
compile 'com.android.support:recyclerview-v7:22.2.1'
|
||||||
// compile 'com.android.support:support-v4:22.2.1'
|
|
||||||
compile 'com.android.support:design:22.2.1'
|
compile 'com.android.support:design:22.2.1'
|
||||||
compile 'co.dift.ui.swipetoaction:library:1.1'
|
compile 'com.android.support:cardview-v7:22.2.1'
|
||||||
// compile 'de.hdodenhof:circleimageview:1.3.0'
|
|
||||||
compile 'com.getbase:floatingactionbutton:1.9.0'
|
compile 'com.getbase:floatingactionbutton:1.9.0'
|
||||||
// compile 'com.github.ksoichiro:android-observablescrollview:1.5.2'
|
|
||||||
compile 'com.afollestad:material-dialogs:0.7.7.0'
|
compile 'com.afollestad:material-dialogs:0.7.7.0'
|
||||||
compile 'com.github.bumptech.glide:glide:3.6.1'
|
compile 'com.github.bumptech.glide:glide:3.6.1'
|
||||||
compile(project(':cordova-android')) {
|
compile(project(':cordova-android')) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// compile 'com.netflix.rxjava:rxjava-android:0.20.7'
|
|
||||||
|
|
||||||
debugCompile 'com.squareup.leakcanary:leakcanary-android:1.3.1'
|
debugCompile 'com.squareup.leakcanary:leakcanary-android:1.3.1'
|
||||||
compile 'com.android.support:cardview-v7:22.2.1'
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package io.syng.activity;
|
package io.syng.activity;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Context;
|
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
@ -24,13 +23,10 @@ import android.view.LayoutInflater;
|
|||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.View.OnClickListener;
|
import android.view.View.OnClickListener;
|
||||||
import android.view.ViewGroup;
|
|
||||||
import android.widget.ArrayAdapter;
|
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.FrameLayout;
|
import android.widget.FrameLayout;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.RadioButton;
|
import android.widget.RadioButton;
|
||||||
import android.widget.Spinner;
|
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
@ -62,7 +58,6 @@ import io.syng.entity.Profile;
|
|||||||
import io.syng.util.GeneralUtil;
|
import io.syng.util.GeneralUtil;
|
||||||
import io.syng.util.PrefsUtil;
|
import io.syng.util.PrefsUtil;
|
||||||
|
|
||||||
import static android.view.View.GONE;
|
|
||||||
import static android.view.View.VISIBLE;
|
import static android.view.View.VISIBLE;
|
||||||
import static org.ethereum.config.SystemProperties.CONFIG;
|
import static org.ethereum.config.SystemProperties.CONFIG;
|
||||||
|
|
||||||
@ -79,7 +74,6 @@ public abstract class BaseActivity extends AppCompatActivity implements
|
|||||||
|
|
||||||
private ActionBarDrawerToggle mDrawerToggle;
|
private ActionBarDrawerToggle mDrawerToggle;
|
||||||
|
|
||||||
private Spinner mAccountSpinner;
|
|
||||||
private EditText mSearchTextView;
|
private EditText mSearchTextView;
|
||||||
private RecyclerView mDAppsRecyclerView;
|
private RecyclerView mDAppsRecyclerView;
|
||||||
private RecyclerView mAccountsRecyclerView;
|
private RecyclerView mAccountsRecyclerView;
|
||||||
@ -104,8 +98,6 @@ public abstract class BaseActivity extends AppCompatActivity implements
|
|||||||
|
|
||||||
protected abstract void onDAppClick(Dapp dapp);
|
protected abstract void onDAppClick(Dapp dapp);
|
||||||
|
|
||||||
private SpinnerAdapter spinnerAdapter;
|
|
||||||
private Profile requestProfile;
|
|
||||||
|
|
||||||
@SuppressLint("InflateParams")
|
@SuppressLint("InflateParams")
|
||||||
@Override
|
@Override
|
||||||
@ -144,7 +136,6 @@ public abstract class BaseActivity extends AppCompatActivity implements
|
|||||||
|
|
||||||
mFrontView = mDrawerLayout.findViewById(R.id.ll_front_view);
|
mFrontView = mDrawerLayout.findViewById(R.id.ll_front_view);
|
||||||
mBackView = mDrawerLayout.findViewById(R.id.ll_back_view);
|
mBackView = mDrawerLayout.findViewById(R.id.ll_back_view);
|
||||||
mBackView.setVisibility(GONE);
|
|
||||||
|
|
||||||
mAccountsRecyclerView = (RecyclerView) mBackView.findViewById(R.id.accounts_drawer_recycler_view);
|
mAccountsRecyclerView = (RecyclerView) mBackView.findViewById(R.id.accounts_drawer_recycler_view);
|
||||||
RecyclerView.LayoutManager layoutManager2 = new LinearLayoutManager(this);
|
RecyclerView.LayoutManager layoutManager2 = new LinearLayoutManager(this);
|
||||||
@ -161,13 +152,7 @@ public abstract class BaseActivity extends AppCompatActivity implements
|
|||||||
Glide.with(this).load(R.drawable.two).into(header);
|
Glide.with(this).load(R.drawable.two).into(header);
|
||||||
|
|
||||||
super.setContentView(mDrawerLayout);
|
super.setContentView(mDrawerLayout);
|
||||||
TextView textView = (TextView) findViewById(R.id.tv_name);
|
|
||||||
if (textView != null) {
|
|
||||||
textView.setText("Cow");
|
|
||||||
}
|
|
||||||
|
|
||||||
showWarningDialogIfNeed();
|
showWarningDialogIfNeed();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showWarningDialogIfNeed() {
|
private void showWarningDialogIfNeed() {
|
||||||
@ -189,11 +174,11 @@ public abstract class BaseActivity extends AppCompatActivity implements
|
|||||||
private void initProfiles() {
|
private void initProfiles() {
|
||||||
mProfiles = PrefsUtil.getProfiles();
|
mProfiles = PrefsUtil.getProfiles();
|
||||||
// Add default cow account if not present
|
// Add default cow account if not present
|
||||||
if (mProfiles.size() == 0) {
|
if (mProfiles.isEmpty()) {
|
||||||
Profile profile = new Profile();
|
Profile profile = new Profile();
|
||||||
profile.setName("Cow");
|
profile.setName("Cow");
|
||||||
// Add default cow and monkey addresses
|
// Add default cow and monkey addresses
|
||||||
List<String> addresses = new ArrayList<String>();
|
List<String> addresses = new ArrayList<>();
|
||||||
byte[] cowAddr = HashUtil.sha3("cow".getBytes());
|
byte[] cowAddr = HashUtil.sha3("cow".getBytes());
|
||||||
addresses.add(Hex.toHexString(cowAddr));
|
addresses.add(Hex.toHexString(cowAddr));
|
||||||
String secret = CONFIG.coinbaseSecret();
|
String secret = CONFIG.coinbaseSecret();
|
||||||
@ -205,17 +190,19 @@ public abstract class BaseActivity extends AppCompatActivity implements
|
|||||||
}
|
}
|
||||||
mAccountDrawerAdapter = new AccountDrawerAdapter(this, mProfiles, this);
|
mAccountDrawerAdapter = new AccountDrawerAdapter(this, mProfiles, this);
|
||||||
mAccountsRecyclerView.setAdapter(mAccountDrawerAdapter);
|
mAccountsRecyclerView.setAdapter(mAccountDrawerAdapter);
|
||||||
if (SyngApplication.currentProfile == null) {
|
if (SyngApplication.sCurrentProfile == null) {
|
||||||
SyngApplication.changeProfile(mProfiles.get(0));
|
SyngApplication.changeProfile(mProfiles.get(0));
|
||||||
|
updateCurrentProfileName(mProfiles.get(0).getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void initDApps() {
|
private void initDApps() {
|
||||||
mDApps = new ArrayList<>();
|
mDApps = new ArrayList<>();
|
||||||
if (SyngApplication.currentProfile != null) {
|
if (SyngApplication.sCurrentProfile != null) {
|
||||||
mDApps = SyngApplication.currentProfile.getDapps();
|
mDApps = SyngApplication.sCurrentProfile.getDapps();
|
||||||
}
|
}
|
||||||
|
|
||||||
updateAppList(mSearchTextView.getText().toString());
|
updateAppList(mSearchTextView.getText().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -238,9 +225,8 @@ public abstract class BaseActivity extends AppCompatActivity implements
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void requestChangeProfile(Profile profile) {
|
protected void requestChangeProfile(final Profile profile) {
|
||||||
|
|
||||||
requestProfile = profile;
|
|
||||||
new MaterialDialog.Builder(BaseActivity.this)
|
new MaterialDialog.Builder(BaseActivity.this)
|
||||||
.title(R.string.request_profile_password)
|
.title(R.string.request_profile_password)
|
||||||
.customView(R.layout.profile_password, true)
|
.customView(R.layout.profile_password, true)
|
||||||
@ -254,13 +240,14 @@ public abstract class BaseActivity extends AppCompatActivity implements
|
|||||||
.widgetColorRes(R.color.accent)
|
.widgetColorRes(R.color.accent)
|
||||||
.callback(new MaterialDialog.ButtonCallback() {
|
.callback(new MaterialDialog.ButtonCallback() {
|
||||||
|
|
||||||
|
@SuppressWarnings("ConstantConditions")
|
||||||
@Override
|
@Override
|
||||||
public void onPositive(MaterialDialog dialog) {
|
public void onPositive(MaterialDialog dialog) {
|
||||||
|
|
||||||
View view = dialog.getCustomView();
|
View view = dialog.getCustomView();
|
||||||
EditText passwordInput = (EditText) view.findViewById(R.id.passwordInput);
|
EditText passwordInput = (EditText) view.findViewById(R.id.passwordInput);
|
||||||
if (requestProfile.decrypt(passwordInput.getText().toString())) {
|
if (profile.decrypt(passwordInput.getText().toString())) {
|
||||||
changeProfile(requestProfile);
|
changeProfile(profile);
|
||||||
} else {
|
} else {
|
||||||
// dialog.hide();
|
// dialog.hide();
|
||||||
// mAccountSpinner.setSelection(currentPosition, false);
|
// mAccountSpinner.setSelection(currentPosition, false);
|
||||||
@ -419,57 +406,6 @@ public abstract class BaseActivity extends AppCompatActivity implements
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public class SpinnerAdapter extends ArrayAdapter<Profile> {
|
|
||||||
|
|
||||||
private Context context;
|
|
||||||
|
|
||||||
private List<Profile> values;
|
|
||||||
|
|
||||||
public SpinnerAdapter(Context context, int textViewResourceId, List<Profile> values) {
|
|
||||||
|
|
||||||
super(context, textViewResourceId, values);
|
|
||||||
this.context = context;
|
|
||||||
this.values = values;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getCount() {
|
|
||||||
|
|
||||||
return values.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Profile getItem(int position) {
|
|
||||||
|
|
||||||
return values.get(position);
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getItemId(int position) {
|
|
||||||
|
|
||||||
return position;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public View getView(int position, View convertView, ViewGroup parent) {
|
|
||||||
|
|
||||||
return getCustomView(position, convertView, parent);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public View getDropDownView(int position, View convertView, ViewGroup parent) {
|
|
||||||
|
|
||||||
return getCustomView(position, convertView, parent);
|
|
||||||
}
|
|
||||||
|
|
||||||
public View getCustomView(int position, View convertView, ViewGroup parent) {
|
|
||||||
|
|
||||||
LayoutInflater inflater = getLayoutInflater();
|
|
||||||
View row = inflater.inflate(android.R.layout.simple_dropdown_item_1line, parent, false);
|
|
||||||
TextView label = (TextView) row.findViewById(android.R.id.text1);
|
|
||||||
label.setText(spinnerAdapter.getItem(position).getName());
|
|
||||||
return row;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDAppItemClick(Dapp dapp) {
|
public void onDAppItemClick(Dapp dapp) {
|
||||||
onDAppClick(dapp);
|
onDAppClick(dapp);
|
||||||
@ -521,18 +457,18 @@ public abstract class BaseActivity extends AppCompatActivity implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (importJsonRadio.isChecked()) {
|
if (importJsonRadio.isChecked()) {
|
||||||
if (SyngApplication.currentProfile != null) {
|
if (SyngApplication.sCurrentProfile != null) {
|
||||||
if (SyngApplication.currentProfile.importWallet(fileContents, password)) {
|
if (SyngApplication.sCurrentProfile.importWallet(fileContents, password)) {
|
||||||
PrefsUtil.updateProfile(SyngApplication.currentProfile);
|
PrefsUtil.updateProfile(SyngApplication.sCurrentProfile);
|
||||||
SyngApplication.changeProfile(SyngApplication.currentProfile);
|
SyngApplication.changeProfile(SyngApplication.sCurrentProfile);
|
||||||
} else {
|
} else {
|
||||||
Toast.makeText(BaseActivity.this, R.string.invalid_wallet_password, Toast.LENGTH_SHORT).show();
|
Toast.makeText(BaseActivity.this, R.string.invalid_wallet_password, Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
logger.warn("SyngApplication.currentProfile is null ...?!");
|
logger.warn("SyngApplication.sCurrentProfile is null ...?!");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
SyngApplication.currentProfile.importPrivateKey(fileContents, password);
|
SyngApplication.sCurrentProfile.importPrivateKey(fileContents, password);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -603,7 +539,7 @@ public abstract class BaseActivity extends AppCompatActivity implements
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
mAccountDrawerAdapter.notifyDataSetChanged();
|
mAccountDrawerAdapter.notifyDataSetChanged();
|
||||||
if (SyngApplication.currentProfile.getId().equals(profile.getId())) {
|
if (SyngApplication.sCurrentProfile.getId().equals(profile.getId())) {
|
||||||
updateCurrentProfileName(profile.getName());
|
updateCurrentProfileName(profile.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,22 +23,22 @@ public class SyngApplication extends MultiDexApplication implements ConnectorHan
|
|||||||
|
|
||||||
private RefWatcher refWatcher;
|
private RefWatcher refWatcher;
|
||||||
|
|
||||||
public static Profile currentProfile;
|
public static Profile sCurrentProfile;
|
||||||
|
|
||||||
public static void changeProfile(Profile profile) {
|
public static void changeProfile(Profile profile) {
|
||||||
List<String> privateKeys = profile.getPrivateKeys();
|
List<String> privateKeys = profile.getPrivateKeys();
|
||||||
sEthereumConnector.init(privateKeys);
|
sEthereumConnector.init(privateKeys);
|
||||||
currentProfile = profile;
|
sCurrentProfile = profile;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addDapp(Dapp dapp) {
|
public static void addDapp(Dapp dapp) {
|
||||||
currentProfile.addDapp(dapp);
|
sCurrentProfile.addDapp(dapp);
|
||||||
PrefsUtil.updateProfile(currentProfile);
|
PrefsUtil.updateProfile(sCurrentProfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void updateDapp(Dapp dapp) {
|
public static void updateDapp(Dapp dapp) {
|
||||||
currentProfile.updateDapp(dapp);
|
sCurrentProfile.updateDapp(dapp);
|
||||||
PrefsUtil.updateProfile(currentProfile);
|
PrefsUtil.updateProfile(sCurrentProfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -70,8 +70,8 @@ public class SyngApplication extends MultiDexApplication implements ConnectorHan
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onConnectorConnected() {
|
public void onConnectorConnected() {
|
||||||
if (currentProfile != null) {
|
if (sCurrentProfile != null) {
|
||||||
sEthereumConnector.init(currentProfile.getPrivateKeys());
|
sEthereumConnector.init(sCurrentProfile.getPrivateKeys());
|
||||||
}
|
}
|
||||||
sEthereumConnector.startJsonRpc();
|
sEthereumConnector.startJsonRpc();
|
||||||
}
|
}
|
||||||
|
@ -1,30 +1,28 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:orientation="vertical" android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
>
|
>
|
||||||
|
|
||||||
<!--<android.support.design.widget.TextInputLayout-->
|
|
||||||
<!--android:layout_width="match_parent"-->
|
|
||||||
<!--android:layout_height="wrap_content">-->
|
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/dapp_name"
|
android:id="@+id/dapp_name"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:singleLine="true"
|
android:hint="@string/name"
|
||||||
android:hint="@string/name" />
|
android:singleLine="true"/>
|
||||||
<!--</android.support.design.widget.TextInputLayout>-->
|
|
||||||
|
|
||||||
<!--<android.support.design.widget.TextInputLayout-->
|
|
||||||
<!--android:layout_width="match_parent"-->
|
|
||||||
<!--android:layout_height="wrap_content">-->
|
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/dapp_url"
|
android:id="@+id/dapp_url"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:singleLine="true"
|
android:hint="@string/url"
|
||||||
android:hint="@string/url" />
|
android:singleLine="true"/>
|
||||||
<!--</android.support.design.widget.TextInputLayout>-->
|
|
||||||
|
|
||||||
|
<CheckBox
|
||||||
|
android:id="@+id/dapp_home_icon"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Create home screen icon"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
@ -3,7 +3,8 @@
|
|||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical"
|
||||||
|
android:visibility="gone">
|
||||||
|
|
||||||
|
|
||||||
<android.support.v7.widget.RecyclerView
|
<android.support.v7.widget.RecyclerView
|
||||||
|
Loading…
x
Reference in New Issue
Block a user