Profile name in drawer bug fixed. Display title in WebView fixed. Changed some names from account to profile
This commit is contained in:
parent
491219713a
commit
3fbb32f262
|
@ -47,10 +47,10 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import io.syng.R;
|
import io.syng.R;
|
||||||
import io.syng.adapter.AccountDrawerAdapter;
|
|
||||||
import io.syng.adapter.AccountDrawerAdapter.OnProfileClickListener;
|
|
||||||
import io.syng.adapter.DAppDrawerAdapter;
|
import io.syng.adapter.DAppDrawerAdapter;
|
||||||
import io.syng.adapter.DAppDrawerAdapter.OnDAppClickListener;
|
import io.syng.adapter.DAppDrawerAdapter.OnDAppClickListener;
|
||||||
|
import io.syng.adapter.ProfileDrawerAdapter;
|
||||||
|
import io.syng.adapter.ProfileDrawerAdapter.OnProfileClickListener;
|
||||||
import io.syng.app.SyngApplication;
|
import io.syng.app.SyngApplication;
|
||||||
import io.syng.entity.Dapp;
|
import io.syng.entity.Dapp;
|
||||||
import io.syng.entity.Profile;
|
import io.syng.entity.Profile;
|
||||||
|
@ -75,11 +75,11 @@ public abstract class BaseActivity extends AppCompatActivity implements
|
||||||
|
|
||||||
private EditText mSearchTextView;
|
private EditText mSearchTextView;
|
||||||
private RecyclerView mDAppsRecyclerView;
|
private RecyclerView mDAppsRecyclerView;
|
||||||
private RecyclerView mAccountsRecyclerView;
|
private RecyclerView mProfilesRecyclerView;
|
||||||
private DrawerLayout mDrawerLayout;
|
private DrawerLayout mDrawerLayout;
|
||||||
|
|
||||||
private DAppDrawerAdapter mDAppsDrawerAdapter;
|
private DAppDrawerAdapter mDAppsDrawerAdapter;
|
||||||
private AccountDrawerAdapter mAccountDrawerAdapter;
|
private ProfileDrawerAdapter mProfileDrawerAdapter;
|
||||||
|
|
||||||
private View mFrontView;
|
private View mFrontView;
|
||||||
private View mBackView;
|
private View mBackView;
|
||||||
|
@ -103,7 +103,10 @@ public abstract class BaseActivity extends AppCompatActivity implements
|
||||||
public void setContentView(final int layoutResID) {
|
public void setContentView(final int layoutResID) {
|
||||||
LayoutInflater inflater = getLayoutInflater();
|
LayoutInflater inflater = getLayoutInflater();
|
||||||
mDrawerLayout = (DrawerLayout) inflater.inflate(R.layout.drawer, null, false);
|
mDrawerLayout = (DrawerLayout) inflater.inflate(R.layout.drawer, null, false);
|
||||||
FrameLayout content = (FrameLayout) mDrawerLayout.findViewById(R.id.content);
|
|
||||||
|
super.setContentView(mDrawerLayout);
|
||||||
|
|
||||||
|
FrameLayout content = (FrameLayout) findViewById(R.id.content);
|
||||||
|
|
||||||
Toolbar toolbar = (Toolbar) inflater.inflate(layoutResID, content, true).findViewById(R.id.myToolbar);
|
Toolbar toolbar = (Toolbar) inflater.inflate(layoutResID, content, true).findViewById(R.id.myToolbar);
|
||||||
if (toolbar != null) {
|
if (toolbar != null) {
|
||||||
|
@ -125,32 +128,31 @@ public abstract class BaseActivity extends AppCompatActivity implements
|
||||||
|
|
||||||
mDrawerLayout.setDrawerListener(mDrawerToggle);
|
mDrawerLayout.setDrawerListener(mDrawerToggle);
|
||||||
|
|
||||||
mSearchTextView = (EditText) mDrawerLayout.findViewById(R.id.search);
|
mSearchTextView = (EditText) findViewById(R.id.search);
|
||||||
initSearch();
|
initSearch();
|
||||||
|
|
||||||
mDrawerLayout.findViewById(R.id.ll_import_wallet).setOnClickListener(this);
|
findViewById(R.id.ll_import_wallet).setOnClickListener(this);
|
||||||
mDrawerLayout.findViewById(R.id.ll_settings).setOnClickListener(this);
|
findViewById(R.id.ll_settings).setOnClickListener(this);
|
||||||
mDrawerLayout.findViewById(R.id.ll_contribute).setOnClickListener(this);
|
findViewById(R.id.ll_contribute).setOnClickListener(this);
|
||||||
mDrawerLayout.findViewById(R.id.drawer_header).setOnClickListener(this);
|
findViewById(R.id.drawer_header).setOnClickListener(this);
|
||||||
|
|
||||||
mFrontView = mDrawerLayout.findViewById(R.id.ll_front_view);
|
mFrontView = findViewById(R.id.ll_front_view);
|
||||||
mBackView = mDrawerLayout.findViewById(R.id.ll_back_view);
|
mBackView = findViewById(R.id.ll_back_view);
|
||||||
|
|
||||||
mAccountsRecyclerView = (RecyclerView) mBackView.findViewById(R.id.accounts_drawer_recycler_view);
|
mProfilesRecyclerView = (RecyclerView) findViewById(R.id.accounts_drawer_recycler_view);
|
||||||
RecyclerView.LayoutManager layoutManager2 = new LinearLayoutManager(this);
|
RecyclerView.LayoutManager layoutManager2 = new LinearLayoutManager(this);
|
||||||
mAccountsRecyclerView.setLayoutManager(layoutManager2);
|
mProfilesRecyclerView.setLayoutManager(layoutManager2);
|
||||||
initProfiles();
|
initProfiles();
|
||||||
|
|
||||||
mDAppsRecyclerView = (RecyclerView) mDrawerLayout.findViewById(R.id.dapd_drawer_recycler_view);
|
mDAppsRecyclerView = (RecyclerView) findViewById(R.id.dapd_drawer_recycler_view);
|
||||||
mDAppsRecyclerView.setHasFixedSize(true);
|
mDAppsRecyclerView.setHasFixedSize(true);
|
||||||
RecyclerView.LayoutManager layoutManager1 = new LinearLayoutManager(this);
|
RecyclerView.LayoutManager layoutManager1 = new LinearLayoutManager(this);
|
||||||
mDAppsRecyclerView.setLayoutManager(layoutManager1);
|
mDAppsRecyclerView.setLayoutManager(layoutManager1);
|
||||||
initDApps();
|
initDApps();
|
||||||
|
|
||||||
ImageView header = (ImageView) mDrawerLayout.findViewById(R.id.iv_header);
|
ImageView header = (ImageView) findViewById(R.id.iv_header);
|
||||||
Glide.with(this).load(R.drawable.two).into(header);
|
Glide.with(this).load(R.drawable.drawer).into(header);
|
||||||
|
|
||||||
super.setContentView(mDrawerLayout);
|
|
||||||
GeneralUtil.showWarningDialogIfNeed(this);
|
GeneralUtil.showWarningDialogIfNeed(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,12 +174,12 @@ public abstract class BaseActivity extends AppCompatActivity implements
|
||||||
PrefsUtil.saveProfile(profile);
|
PrefsUtil.saveProfile(profile);
|
||||||
mProfiles.add(profile);
|
mProfiles.add(profile);
|
||||||
}
|
}
|
||||||
mAccountDrawerAdapter = new AccountDrawerAdapter(this, mProfiles, this);
|
mProfileDrawerAdapter = new ProfileDrawerAdapter(this, mProfiles, this);
|
||||||
mAccountsRecyclerView.setAdapter(mAccountDrawerAdapter);
|
mProfilesRecyclerView.setAdapter(mProfileDrawerAdapter);
|
||||||
if (SyngApplication.sCurrentProfile == null) {
|
if (SyngApplication.sCurrentProfile == null) {
|
||||||
SyngApplication.changeProfile(mProfiles.get(0));
|
SyngApplication.changeProfile(mProfiles.get(0));
|
||||||
updateCurrentProfileName(mProfiles.get(0).getName());
|
|
||||||
}
|
}
|
||||||
|
updateCurrentProfileName(SyngApplication.sCurrentProfile.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -199,7 +201,6 @@ public abstract class BaseActivity extends AppCompatActivity implements
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void changeProfile(Profile profile) {
|
protected void changeProfile(Profile profile) {
|
||||||
|
|
||||||
updateCurrentProfileName(profile.getName());
|
updateCurrentProfileName(profile.getName());
|
||||||
SyngApplication.changeProfile(profile);
|
SyngApplication.changeProfile(profile);
|
||||||
initDApps();
|
initDApps();
|
||||||
|
@ -207,9 +208,7 @@ public abstract class BaseActivity extends AppCompatActivity implements
|
||||||
|
|
||||||
protected void updateCurrentProfileName(String name) {
|
protected void updateCurrentProfileName(String name) {
|
||||||
TextView textView = (TextView) findViewById(R.id.tv_name);
|
TextView textView = (TextView) findViewById(R.id.tv_name);
|
||||||
if (textView != null) {
|
textView.setText(name);
|
||||||
textView.setText(name);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void requestChangeProfile(final Profile profile) {
|
protected void requestChangeProfile(final Profile profile) {
|
||||||
|
@ -359,7 +358,7 @@ public abstract class BaseActivity extends AppCompatActivity implements
|
||||||
profile.setName(input.toString());
|
profile.setName(input.toString());
|
||||||
mProfiles.add(profile);
|
mProfiles.add(profile);
|
||||||
PrefsUtil.saveProfile(profile);
|
PrefsUtil.saveProfile(profile);
|
||||||
mAccountDrawerAdapter.notifyDataSetChanged();
|
mProfileDrawerAdapter.notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
}).show();
|
}).show();
|
||||||
dialog.getInputEditText().setSingleLine();
|
dialog.getInputEditText().setSingleLine();
|
||||||
|
@ -530,7 +529,7 @@ public abstract class BaseActivity extends AppCompatActivity implements
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mAccountDrawerAdapter.notifyDataSetChanged();
|
mProfileDrawerAdapter.notifyDataSetChanged();
|
||||||
if (SyngApplication.sCurrentProfile.getId().equals(profile.getId())) {
|
if (SyngApplication.sCurrentProfile.getId().equals(profile.getId())) {
|
||||||
updateCurrentProfileName(profile.getName());
|
updateCurrentProfileName(profile.getName());
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,6 +45,7 @@ public class MainActivity extends BaseActivity {
|
||||||
switch (dapp.getUrl()) {
|
switch (dapp.getUrl()) {
|
||||||
case "":
|
case "":
|
||||||
replaceFragment(new ConsoleFragment());
|
replaceFragment(new ConsoleFragment());
|
||||||
|
getSupportActionBar().setTitle(R.string.app_name);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
WebViewFragment wvF = new WebViewFragment();
|
WebViewFragment wvF = new WebViewFragment();
|
||||||
|
@ -52,6 +53,7 @@ public class MainActivity extends BaseActivity {
|
||||||
args.putString("url", dapp.getUrl());
|
args.putString("url", dapp.getUrl());
|
||||||
wvF.setArguments(args);
|
wvF.setArguments(args);
|
||||||
replaceFragment(wvF);
|
replaceFragment(wvF);
|
||||||
|
getSupportActionBar().setTitle(dapp.getName());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ import java.util.List;
|
||||||
import io.syng.R;
|
import io.syng.R;
|
||||||
import io.syng.entity.Profile;
|
import io.syng.entity.Profile;
|
||||||
|
|
||||||
public class AccountDrawerAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
public class ProfileDrawerAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||||
|
|
||||||
private static final int TYPE_HEADER = 10;
|
private static final int TYPE_HEADER = 10;
|
||||||
private static final int TYPE_SIMPLE_ITEM = 20;
|
private static final int TYPE_SIMPLE_ITEM = 20;
|
||||||
|
@ -35,7 +35,7 @@ public class AccountDrawerAdapter extends RecyclerView.Adapter<RecyclerView.View
|
||||||
private final Context mContext;
|
private final Context mContext;
|
||||||
private List<Profile> mDataSet;
|
private List<Profile> mDataSet;
|
||||||
|
|
||||||
public AccountDrawerAdapter(Context context, List<Profile> data, OnProfileClickListener listener) {
|
public ProfileDrawerAdapter(Context context, List<Profile> data, OnProfileClickListener listener) {
|
||||||
this.mDataSet = data;
|
this.mDataSet = data;
|
||||||
mContext = context;
|
mContext = context;
|
||||||
mListener = listener;
|
mListener = listener;
|
||||||
|
@ -45,11 +45,11 @@ public class AccountDrawerAdapter extends RecyclerView.Adapter<RecyclerView.View
|
||||||
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||||
View view;
|
View view;
|
||||||
if (viewType == TYPE_SIMPLE_ITEM) {
|
if (viewType == TYPE_SIMPLE_ITEM) {
|
||||||
view = LayoutInflater.from(parent.getContext()).inflate(R.layout.account_drawer_list_item, parent, false);
|
view = LayoutInflater.from(parent.getContext()).inflate(R.layout.profile_drawer_list_item, parent, false);
|
||||||
return new SimpleViewHolder(view);
|
return new SimpleViewHolder(view);
|
||||||
}
|
}
|
||||||
if (viewType == TYPE_HEADER) {
|
if (viewType == TYPE_HEADER) {
|
||||||
view = LayoutInflater.from(parent.getContext()).inflate(R.layout.account_drawer_list_add, parent, false);
|
view = LayoutInflater.from(parent.getContext()).inflate(R.layout.profile_drawer_list_add, parent, false);
|
||||||
return new HeaderViewHolder(view);
|
return new HeaderViewHolder(view);
|
||||||
}
|
}
|
||||||
throw new RuntimeException("there is no type that matches the type " + viewType + " + make sure your using types correctly");
|
throw new RuntimeException("there is no type that matches the type " + viewType + " + make sure your using types correctly");
|
|
@ -6,7 +6,6 @@ import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
|
||||||
import android.text.method.ScrollingMovementMethod;
|
import android.text.method.ScrollingMovementMethod;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
@ -88,8 +87,6 @@ public class ConsoleFragment extends Fragment implements ConnectorHandler {
|
||||||
Glide.with(this).load(R.drawable.syng_text).into(syngText);
|
Glide.with(this).load(R.drawable.syng_text).into(syngText);
|
||||||
Glide.with(this).load(R.drawable.syng_logo).into(syngLogo);
|
Glide.with(this).load(R.drawable.syng_logo).into(syngLogo);
|
||||||
|
|
||||||
((AppCompatActivity)getActivity()).getSupportActionBar().setDisplayShowTitleEnabled(true);
|
|
||||||
|
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,6 @@ import android.graphics.Color;
|
||||||
import android.media.AudioManager;
|
import android.media.AudioManager;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
@ -68,7 +67,7 @@ public class WebViewFragment extends Fragment {
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
loadConfig();
|
loadConfig();
|
||||||
((AppCompatActivity)getActivity()).getSupportActionBar().setDisplayShowTitleEnabled(false);
|
// ((AppCompatActivity)getActivity()).getSupportActionBar().setDisplayShowTitleEnabled(false);
|
||||||
/*
|
/*
|
||||||
TODO: it's can be only in activity before adding content and we may need it in Cordova Dapps
|
TODO: it's can be only in activity before adding content and we may need it in Cordova Dapps
|
||||||
if(!preferences.getBoolean("ShowTitle", false))
|
if(!preferences.getBoolean("ShowTitle", false))
|
||||||
|
|
|
@ -29,7 +29,6 @@
|
||||||
android:layout_marginStart="20dp"
|
android:layout_marginStart="20dp"
|
||||||
android:layout_toEndOf="@+id/nv_email"
|
android:layout_toEndOf="@+id/nv_email"
|
||||||
android:layout_toRightOf="@+id/nv_email"
|
android:layout_toRightOf="@+id/nv_email"
|
||||||
android:text="Jarrad Hope"
|
|
||||||
android:textColor="#ffffff"/>
|
android:textColor="#ffffff"/>
|
||||||
|
|
||||||
<Spinner
|
<Spinner
|
||||||
|
|
Loading…
Reference in New Issue