diff --git a/app/src/main/java/io/syng/activity/BaseActivity.java b/app/src/main/java/io/syng/activity/BaseActivity.java
index 602a31f..dfc61d7 100644
--- a/app/src/main/java/io/syng/activity/BaseActivity.java
+++ b/app/src/main/java/io/syng/activity/BaseActivity.java
@@ -15,7 +15,6 @@ import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.text.Editable;
-import android.text.InputType;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.util.Patterns;
@@ -55,6 +54,7 @@ import io.syng.adapter.ProfileDrawerAdapter;
import io.syng.adapter.ProfileDrawerAdapter.OnProfileClickListener;
import io.syng.entity.Dapp;
import io.syng.entity.Profile;
+import io.syng.fragment.ProfileDialogFragment;
import io.syng.util.GeneralUtil;
import io.syng.util.PrefsUtil;
import io.syng.util.ProfileManager;
@@ -107,7 +107,7 @@ public abstract class BaseActivity extends AppCompatActivity implements
FrameLayout content = (FrameLayout) findViewById(R.id.content);
ViewGroup inflated = (ViewGroup) inflater.inflate(layoutResID, content, true);
- Toolbar toolbar = (Toolbar) inflated.findViewById(R.id.myToolbar);
+ Toolbar toolbar = (Toolbar) inflated.findViewById(R.id.profile_toolbar);
if (toolbar != null) {
setSupportActionBar(toolbar);
@@ -178,19 +178,6 @@ public abstract class BaseActivity extends AppCompatActivity implements
mHandler.postDelayed(mRunnable, DRAWER_CLOSE_DELAY_SHORT);
}
- private void changeProfile(Profile profile) {
- ProfileManager.setCurrentProfile(profile);
- updateCurrentProfileName();
- Glide.with(this).load(PrefsUtil.getBackgroundResourceId(profile.getId())).into(mHeaderImageView);
- populateDApps();
- flipDrawer();
- }
-
- private void updateCurrentProfileName() {
- TextView textView = (TextView) findViewById(R.id.tv_name);
- textView.setText(ProfileManager.getCurrentProfile().getName());
- }
-
private void requestChangeProfile(final Profile profile) {
Dialog dialog = new MaterialDialog.Builder(BaseActivity.this)
.title(R.string.request_profile_password)
@@ -215,6 +202,19 @@ public abstract class BaseActivity extends AppCompatActivity implements
GeneralUtil.showKeyBoard(name, this);
}
+ private void changeProfile(Profile profile) {
+ ProfileManager.setCurrentProfile(profile);
+ updateCurrentProfileName();
+ Glide.with(this).load(PrefsUtil.getBackgroundResourceId(profile.getId())).into(mHeaderImageView);
+ populateDApps();
+ flipDrawer();
+ }
+
+ private void updateCurrentProfileName() {
+ TextView textView = (TextView) findViewById(R.id.tv_name);
+ textView.setText(ProfileManager.getCurrentProfile().getName());
+ }
+
private void initSearch() {
mSearchTextView.addTextChangedListener(new TextWatcher() {
@Override
@@ -503,21 +503,24 @@ public abstract class BaseActivity extends AppCompatActivity implements
@SuppressWarnings("ConstantConditions")
@Override
public void onProfilePress(final Profile profile) {
- MaterialDialog dialog = new MaterialDialog.Builder(this)
- .title("Edit account")
- .content("Put your name to create new account")
- .inputType(InputType.TYPE_CLASS_TEXT)
- .input("Name", "", new MaterialDialog.InputCallback() {
- @Override
- public void onInput(MaterialDialog dialog, CharSequence input) {
- profile.setName(input.toString());
- ProfileManager.updateProfile(profile);
- mProfileDrawerAdapter.swapData(ProfileManager.getProfiles());
- updateCurrentProfileName();
- }
- }).show();
- dialog.getInputEditText().setSingleLine();
- dialog.getInputEditText().setText(profile.getName());
+// MaterialDialog dialog = new MaterialDialog.Builder(this)
+// .title("Edit account")
+// .content("Put your name to create new account")
+// .inputType(InputType.TYPE_CLASS_TEXT)
+// .input("Name", "", new MaterialDialog.InputCallback() {
+// @Override
+// public void onInput(MaterialDialog dialog, CharSequence input) {
+// profile.setName(input.toString());
+// ProfileManager.updateProfile(profile);
+// mProfileDrawerAdapter.swapData(ProfileManager.getProfiles());
+// updateCurrentProfileName();
+// }
+// }).show();
+// dialog.getInputEditText().setSingleLine();
+// dialog.getInputEditText().setText(profile.getName());
+
+ ProfileDialogFragment dialogFragment = ProfileDialogFragment.newInstance();
+ dialogFragment.show(getSupportFragmentManager(), "profile_dialog");
}
@Override
diff --git a/app/src/main/java/io/syng/adapter/ProfileViewPagerAdapter.java b/app/src/main/java/io/syng/adapter/ProfileViewPagerAdapter.java
new file mode 100644
index 0000000..65486f9
--- /dev/null
+++ b/app/src/main/java/io/syng/adapter/ProfileViewPagerAdapter.java
@@ -0,0 +1,48 @@
+package io.syng.adapter;
+
+import android.content.Context;
+import android.support.v4.app.Fragment;
+import android.support.v4.app.FragmentManager;
+import android.support.v4.app.FragmentPagerAdapter;
+import android.support.v4.app.FragmentTransaction;
+import android.view.ViewGroup;
+
+import io.syng.fragment.ConsoleFragment;
+
+public final class ProfileViewPagerAdapter extends FragmentPagerAdapter {
+
+ public static final int GENERAL_POSITION = 0;
+ public static final int KEYS_POSITION = 1;
+
+ public static final String[] LABELS = new String[]{"General", "Keys"};
+ private final Context mContext;
+
+ public ProfileViewPagerAdapter(FragmentManager fragmentManager, Context context) {
+ super(fragmentManager);
+ this.mContext = context;
+ }
+
+ @Override
+ public Fragment getItem(int position) {
+ return new ConsoleFragment();
+ }
+
+ @Override
+ public void destroyItem(ViewGroup container, int position, Object object) {
+ FragmentManager manager = ((Fragment) object).getFragmentManager();
+ FragmentTransaction trans = manager.beginTransaction();
+ trans.remove((Fragment) object);
+ trans.commit();
+ super.destroyItem(container, position, object);
+ }
+
+ @Override
+ public int getCount() {
+ return LABELS.length;
+ }
+
+ @Override
+ public CharSequence getPageTitle(int position) {
+ return LABELS[position];
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/io/syng/fragment/ProfileDialogFragment.java b/app/src/main/java/io/syng/fragment/ProfileDialogFragment.java
new file mode 100644
index 0000000..bc3e200
--- /dev/null
+++ b/app/src/main/java/io/syng/fragment/ProfileDialogFragment.java
@@ -0,0 +1,98 @@
+package io.syng.fragment;
+
+import android.app.Dialog;
+import android.graphics.drawable.Drawable;
+import android.os.Bundle;
+import android.support.annotation.Nullable;
+import android.support.design.widget.TabLayout;
+import android.support.v4.app.DialogFragment;
+import android.support.v4.graphics.drawable.DrawableCompat;
+import android.support.v4.view.ViewPager;
+import android.support.v4.view.ViewPager.OnPageChangeListener;
+import android.support.v7.widget.Toolbar;
+import android.view.LayoutInflater;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.Window;
+
+import io.syng.R;
+import io.syng.adapter.ProfileViewPagerAdapter;
+
+public class ProfileDialogFragment extends DialogFragment implements OnPageChangeListener {
+
+ private ViewPager mViewPager;
+ private TabLayout mTabLayout;
+ private Toolbar mToolbar;
+
+ public static ProfileDialogFragment newInstance() {
+ return new ProfileDialogFragment();
+ }
+
+ @Override
+ public void onCreate(@Nullable Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setRetainInstance(true);
+ }
+
+ @Override
+ public Dialog onCreateDialog(Bundle savedInstanceState) {
+ Dialog dialog = super.onCreateDialog(savedInstanceState);
+ dialog.getWindow().requestFeature(Window.FEATURE_NO_TITLE);
+ return dialog;
+ }
+
+ @Nullable
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
+ View view = inflater.inflate(R.layout.profile_edit_dialog, container);
+ mTabLayout = (TabLayout) view.findViewById(R.id.profile_tabs);
+ mViewPager = (ViewPager) view.findViewById(R.id.profile_view_pager);
+
+ mViewPager.addOnPageChangeListener(this);
+ mToolbar = (Toolbar) view.findViewById(R.id.profile_toolbar);
+ mToolbar.setTitle("Edit Profile");
+ mToolbar.inflateMenu(R.menu.profile_menu);
+ mToolbar.getMenu().findItem(R.id.action_key_export).setVisible(false);
+ mToolbar.getMenu().findItem(R.id.action_key_import).setVisible(false);
+ tintMenuItem();
+
+ mViewPager.setAdapter(new ProfileViewPagerAdapter(getChildFragmentManager(), getActivity()));
+ mTabLayout.setupWithViewPager(mViewPager);
+
+ return view;
+ }
+
+ private void tintMenuItem() {
+ Drawable drawable1 = mToolbar.getMenu().findItem(R.id.action_key_export).getIcon();
+ drawable1 = DrawableCompat.wrap(drawable1);
+ DrawableCompat.setTint(drawable1, getResources().getColor(R.color.drawer_icon_color));
+ mToolbar.getMenu().findItem(R.id.action_key_export).setIcon(drawable1);
+
+ Drawable drawable2 = mToolbar.getMenu().findItem(R.id.action_key_import).getIcon();
+ drawable2 = DrawableCompat.wrap(drawable2);
+ DrawableCompat.setTint(drawable2, getResources().getColor(R.color.drawer_icon_color));
+ mToolbar.getMenu().findItem(R.id.action_key_import).setIcon(drawable2);
+ }
+
+ @Override
+ public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
+ }
+
+ @Override
+ public void onPageSelected(int position) {
+ invalidateToolbarMenu();
+ }
+
+ @Override
+ public void onPageScrollStateChanged(int state) {
+ }
+
+ private void invalidateToolbarMenu() {
+ MenuItem exp = mToolbar.getMenu().findItem(R.id.action_key_export);
+ MenuItem imp = mToolbar.getMenu().findItem(R.id.action_key_import);
+ boolean showExport = mViewPager.getCurrentItem() == ProfileViewPagerAdapter.KEYS_POSITION;
+ exp.setVisible(showExport);
+ imp.setVisible(showExport);
+ }
+}
diff --git a/app/src/main/res/drawable-hdpi/ic_forward_black_24dp.png b/app/src/main/res/drawable-hdpi/ic_forward_black_24dp.png
new file mode 100644
index 0000000..13a9128
Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_forward_black_24dp.png differ
diff --git a/app/src/main/res/drawable-hdpi/ic_import_export_black_24dp.png b/app/src/main/res/drawable-hdpi/ic_import_export_black_24dp.png
new file mode 100644
index 0000000..b4466c8
Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_import_export_black_24dp.png differ
diff --git a/app/src/main/res/drawable-mdpi/ic_forward_black_24dp.png b/app/src/main/res/drawable-mdpi/ic_forward_black_24dp.png
new file mode 100644
index 0000000..8b185cb
Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_forward_black_24dp.png differ
diff --git a/app/src/main/res/drawable-mdpi/ic_import_export_black_24dp.png b/app/src/main/res/drawable-mdpi/ic_import_export_black_24dp.png
new file mode 100644
index 0000000..90f8c45
Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_import_export_black_24dp.png differ
diff --git a/app/src/main/res/drawable-xhdpi/ic_forward_black_24dp.png b/app/src/main/res/drawable-xhdpi/ic_forward_black_24dp.png
new file mode 100644
index 0000000..ec952d4
Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_forward_black_24dp.png differ
diff --git a/app/src/main/res/drawable-xhdpi/ic_import_export_black_24dp.png b/app/src/main/res/drawable-xhdpi/ic_import_export_black_24dp.png
new file mode 100644
index 0000000..9b643bd
Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_import_export_black_24dp.png differ
diff --git a/app/src/main/res/drawable-xxhdpi/ic_forward_black_24dp.png b/app/src/main/res/drawable-xxhdpi/ic_forward_black_24dp.png
new file mode 100644
index 0000000..9a05bf2
Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_forward_black_24dp.png differ
diff --git a/app/src/main/res/drawable-xxhdpi/ic_import_export_black_24dp.png b/app/src/main/res/drawable-xxhdpi/ic_import_export_black_24dp.png
new file mode 100644
index 0000000..78e865d
Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_import_export_black_24dp.png differ
diff --git a/app/src/main/res/drawable-xxxhdpi/ic_forward_black_24dp.png b/app/src/main/res/drawable-xxxhdpi/ic_forward_black_24dp.png
new file mode 100644
index 0000000..2187b5f
Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_forward_black_24dp.png differ
diff --git a/app/src/main/res/drawable-xxxhdpi/ic_import_export_black_24dp.png b/app/src/main/res/drawable-xxxhdpi/ic_import_export_black_24dp.png
new file mode 100644
index 0000000..36aa872
Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_import_export_black_24dp.png differ
diff --git a/app/src/main/res/layout/app_toolbar.xml b/app/src/main/res/layout/app_toolbar.xml
index 6bf26ab..9f37652 100644
--- a/app/src/main/res/layout/app_toolbar.xml
+++ b/app/src/main/res/layout/app_toolbar.xml
@@ -1,5 +1,5 @@
+ android:tint="@color/drawer_icon_color"/>
+ android:tint="@color/drawer_icon_color"/>
+ android:tint="@color/drawer_icon_color"/>
+ android:tint="@color/drawer_icon_color"/>
+ android:tint="@color/drawer_icon_color"/>
+ android:tint="@color/drawer_icon_color"/>
+ android:tint="@color/drawer_icon_color"/>
diff --git a/app/src/main/res/layout/profile_drawer_list_add.xml b/app/src/main/res/layout/profile_drawer_list_add.xml
index f573c5c..7594f8f 100644
--- a/app/src/main/res/layout/profile_drawer_list_add.xml
+++ b/app/src/main/res/layout/profile_drawer_list_add.xml
@@ -13,7 +13,7 @@
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:src="@drawable/ic_add_black_24dp"
- android:tint="@color/drawer_icons_color"/>
+ android:tint="@color/drawer_icon_color"/>
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/menu/profile_menu.xml b/app/src/main/res/menu/profile_menu.xml
new file mode 100644
index 0000000..4c0112f
--- /dev/null
+++ b/app/src/main/res/menu/profile_menu.xml
@@ -0,0 +1,20 @@
+
+
diff --git a/app/src/main/res/menu/webview_menu.xml b/app/src/main/res/menu/webview_menu.xml
index cb474b9..8895455 100644
--- a/app/src/main/res/menu/webview_menu.xml
+++ b/app/src/main/res/menu/webview_menu.xml
@@ -4,7 +4,7 @@
tools:context=".webview">
- #536DFE
#cfcfcf
- #737373
+ #737373
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 719cb56..746d0fa 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -35,5 +35,7 @@
Repeat password
Create
Cancel
+ Import
+ Export