mirror of
https://github.com/status-im/syng-client.git
synced 2025-02-23 00:18:18 +00:00
Different background for each profile. Redundant styles removed.
This commit is contained in:
parent
ed23bf723f
commit
c4fb74a880
@ -153,7 +153,8 @@ public abstract class BaseActivity extends AppCompatActivity implements
|
||||
initDApps();
|
||||
|
||||
mHeaderImageView = (ImageView) findViewById(R.id.iv_header);
|
||||
Glide.with(this).load(R.drawable.bg0).into(mHeaderImageView);
|
||||
String currentProfileId = SyngApplication.sCurrentProfile.getId();
|
||||
Glide.with(this).load(PrefsUtil.getBackgroundResourceId(currentProfileId)).into(mHeaderImageView);
|
||||
|
||||
GeneralUtil.showWarningDialogIfNeed(this);
|
||||
}
|
||||
@ -206,6 +207,7 @@ public abstract class BaseActivity extends AppCompatActivity implements
|
||||
updateCurrentProfileName(profile.getName());
|
||||
SyngApplication.changeProfile(profile);
|
||||
initDApps();
|
||||
Glide.with(this).load(PrefsUtil.getBackgroundResourceId(profile.getId())).into(mHeaderImageView);
|
||||
}
|
||||
|
||||
protected void updateCurrentProfileName(String name) {
|
||||
@ -348,6 +350,7 @@ public abstract class BaseActivity extends AppCompatActivity implements
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("ConstantConditions")
|
||||
private void showAccountCreateDialog() {
|
||||
MaterialDialog dialog = new MaterialDialog.Builder(this)
|
||||
.title("New account")
|
||||
@ -513,6 +516,7 @@ public abstract class BaseActivity extends AppCompatActivity implements
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
@SuppressWarnings("ConstantConditions")
|
||||
@Override
|
||||
public void onProfilePress(final Profile profile) {
|
||||
MaterialDialog dialog = new MaterialDialog.Builder(this)
|
||||
@ -610,7 +614,9 @@ public abstract class BaseActivity extends AppCompatActivity implements
|
||||
@Override
|
||||
public void onSelection(MaterialDialog dialog, View itemView, int which, CharSequence text) {
|
||||
BackgroundArrayAdapter adapter = (BackgroundArrayAdapter) dialog.getListView().getAdapter();
|
||||
Glide.with(BaseActivity.this).load(adapter.getImageResourceIdByPosition(which)).into(mHeaderImageView);
|
||||
int imageResourceId = adapter.getImageResourceIdByPosition(which);
|
||||
Glide.with(BaseActivity.this).load(imageResourceId).into(mHeaderImageView);
|
||||
PrefsUtil.setBackgroundResourceId(SyngApplication.sCurrentProfile.getId(), imageResourceId);
|
||||
dialog.dismiss();
|
||||
}
|
||||
})
|
||||
|
@ -22,11 +22,8 @@ public class DAppDrawerAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
|
||||
|
||||
public interface OnDAppClickListener {
|
||||
void onDAppItemClick(Dapp dapp);
|
||||
|
||||
void onDAppPress(Dapp dapp);
|
||||
|
||||
void onDAppAdd();
|
||||
|
||||
void onDAppContinueSearch();
|
||||
}
|
||||
|
||||
@ -130,7 +127,6 @@ public class DAppDrawerAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
|
||||
return continueSearch && position == mDataSet.size();
|
||||
}
|
||||
|
||||
|
||||
public void clear() {
|
||||
mDataSet.clear();
|
||||
notifyDataSetChanged();
|
||||
|
@ -24,12 +24,10 @@ public class ProfileDrawerAdapter extends RecyclerView.Adapter<RecyclerView.View
|
||||
private final OnProfileClickListener mListener;
|
||||
|
||||
public interface OnProfileClickListener {
|
||||
|
||||
void onProfileClick(Profile profile);
|
||||
void onProfilePress(Profile profile);
|
||||
void onProfileImport();
|
||||
void onNewProfile();
|
||||
|
||||
}
|
||||
|
||||
private final Context mContext;
|
||||
@ -94,7 +92,6 @@ public class ProfileDrawerAdapter extends RecyclerView.Adapter<RecyclerView.View
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getItemViewType(int position) {
|
||||
if (isPositionHeader(position))
|
||||
|
@ -3,9 +3,11 @@ package io.syng.util;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.SharedPreferences.Editor;
|
||||
import android.support.annotation.DrawableRes;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import io.syng.R;
|
||||
import io.syng.entity.ObjectSerializer;
|
||||
import io.syng.entity.Profile;
|
||||
|
||||
@ -56,10 +58,12 @@ public final class PrefsUtil {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static ArrayList<Profile> getProfiles() {
|
||||
ArrayList<Profile> profiles = new ArrayList<>();
|
||||
try {
|
||||
profiles = (ArrayList<Profile>) ObjectSerializer.deserialize(getPrefs().getString(PROFILES_KEY, ObjectSerializer.serialize(profiles)));
|
||||
profiles = (ArrayList<Profile>) ObjectSerializer.deserialize(
|
||||
getPrefs().getString(PROFILES_KEY, ObjectSerializer.serialize(profiles)));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -69,7 +73,7 @@ public final class PrefsUtil {
|
||||
public static void updateProfile(Profile profile) {
|
||||
|
||||
ArrayList<Profile> profiles = getProfiles();
|
||||
for (Profile item: profiles) {
|
||||
for (Profile item : profiles) {
|
||||
if (item.getId().equals(profile.getId())) {
|
||||
int index = profiles.indexOf(item);
|
||||
profiles.set(index, profile);
|
||||
@ -82,7 +86,7 @@ public final class PrefsUtil {
|
||||
public static boolean saveProfile(Profile profile) {
|
||||
|
||||
ArrayList<Profile> profiles = PrefsUtil.getProfiles();
|
||||
for (Profile item: profiles) {
|
||||
for (Profile item : profiles) {
|
||||
if (item.getName().equals(profile.getName())) {
|
||||
return false;
|
||||
}
|
||||
@ -101,4 +105,13 @@ public final class PrefsUtil {
|
||||
return getPrefs().getBoolean(FIRST_LAUNCH_KEY, true);
|
||||
}
|
||||
|
||||
|
||||
public static void setBackgroundResourceId(String profileId, @DrawableRes int resourceId) {
|
||||
getEditor().putInt(profileId, resourceId).commit();
|
||||
}
|
||||
|
||||
public static int getBackgroundResourceId(String profileId) {
|
||||
return getPrefs().getInt(profileId, R.drawable.bg0_resized);
|
||||
}
|
||||
|
||||
}
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 3.3 KiB |
Binary file not shown.
Before Width: | Height: | Size: 15 KiB |
@ -1,23 +1,5 @@
|
||||
<resources xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<style name="ContainerBG">
|
||||
<item name="android:layout_width">fill_parent</item>
|
||||
<item name="android:layout_height">match_parent</item>
|
||||
<item name="android:layout_gravity">start</item>
|
||||
<item name="android:background">@drawable/console_bg</item>
|
||||
<item name="android:orientation">vertical</item>
|
||||
</style>
|
||||
|
||||
|
||||
<!-- Container320 -->
|
||||
<style name="Container320">
|
||||
<item name="android:textSize">18sp</item>
|
||||
<item name="android:textColor">#00FF00</item>
|
||||
<item name="android:typeface">monospace</item>
|
||||
<item name="android:background">#ffffff</item>
|
||||
</style>
|
||||
|
||||
|
||||
<style name="SpinnerDrawer320">
|
||||
<item name="android:background">@null</item>
|
||||
<item name="android:layout_width">match_parent</item>
|
||||
@ -31,7 +13,6 @@
|
||||
<item name="android:textColor">#ffffff</item>
|
||||
<item name="android:textColorHint">#ffffff</item>
|
||||
<item name="android:textSize">20sp</item>
|
||||
|
||||
</style>
|
||||
|
||||
<style name="ViewDrawer320">
|
||||
@ -46,234 +27,4 @@
|
||||
<item name="android:layout_marginBottom">10dp</item>
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
<style name="ToolbarIcon">
|
||||
<item name="android:layout_marginEnd">10dp</item>
|
||||
<item name="android:layout_marginRight">10dp</item>
|
||||
<item name="android:layout_width">32dp</item>
|
||||
<item name="android:layout_height">32dp</item>
|
||||
<item name="android:layout_alignParentEnd">true</item>
|
||||
<item name="android:layout_alignParentRight">true</item>
|
||||
<item name="android:layout_gravity">right</item>
|
||||
<item name="android:background">@null</item>
|
||||
</style>
|
||||
|
||||
<!-- List -->
|
||||
<style name="ListContainer">
|
||||
<item name="android:orientation">vertical</item>
|
||||
<item name="android:layout_width">match_parent</item>
|
||||
<item name="android:layout_height">match_parent</item>
|
||||
<item name="android:layout_alignTop">@+id/web_view</item>
|
||||
<item name="android:layout_alignParentLeft">true</item>
|
||||
<item name="android:layout_alignParentStart">true</item>
|
||||
<item name="android:weightSum">1</item>
|
||||
<item name="android:background">#1a1a1a</item>
|
||||
</style>
|
||||
|
||||
<style name="ListTitle">
|
||||
<item name="android:layout_width">match_parent</item>
|
||||
<!--<item name="android:layout_height">wrap_content</item>-->
|
||||
<item name="android:layout_height">24dp</item>
|
||||
<item name="android:layout_weight">0.06</item>
|
||||
<item name="android:layout_margin">15dp</item>
|
||||
<item name="android:layout_marginBottom">0dp</item>
|
||||
<item name="android:textSize">18sp</item>
|
||||
<item name="android:textColor">#808080</item>
|
||||
</style>
|
||||
|
||||
<style name="ListItem">
|
||||
<item name="android:orientation">horizontal</item>
|
||||
<item name="android:layout_width">match_parent</item>
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
<item name="android:layout_weight">0.06</item>
|
||||
<item name="android:weightSum">1</item>
|
||||
</style>
|
||||
|
||||
<style name="ListIcon">
|
||||
<item name="android:layout_width">24dp</item>
|
||||
<item name="android:layout_height">24dp</item>
|
||||
<item name="android:layout_gravity">center</item>
|
||||
<item name="android:layout_margin">10dp</item>
|
||||
<item name="android:layout_marginLeft">15dp</item>
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
<style name="SeparatorList">
|
||||
<item name="android:layout_width">match_parent</item>
|
||||
<item name="android:layout_height">0.5dp</item>
|
||||
<item name="android:layout_below">@+id/settings</item>
|
||||
<item name="android:layout_marginBottom">5dp</item>
|
||||
<item name="android:layout_marginTop">5dp</item>
|
||||
<item name="android:layout_marginLeft">50dp</item>
|
||||
<item name="android:alpha">0.2</item>
|
||||
<item name="android:background">#ffffff</item>
|
||||
</style>
|
||||
|
||||
<!-- Greed -->
|
||||
<style name="GreedContainer">
|
||||
<item name="android:orientation">vertical</item>
|
||||
<item name="android:layout_width">match_parent</item>
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
<item name="android:layout_alignTop">@+id/web_view</item>
|
||||
<item name="android:layout_alignParentLeft">true</item>
|
||||
<item name="android:layout_alignParentStart">true</item>
|
||||
<item name="android:weightSum">1</item>
|
||||
<item name="android:background">#ffffff</item>
|
||||
<item name="android:paddingLeft">15dp</item>
|
||||
<item name="android:paddingRight">15dp</item>
|
||||
</style>
|
||||
|
||||
|
||||
<style name="TextGreen">
|
||||
<item name="android:layout_width">match_parent</item>
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
<item name="android:textColor">#ffffff</item>
|
||||
<item name="android:textSize">24sp</item>
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
<style name="GreedPanel">
|
||||
<item name="android:orientation">vertical</item>
|
||||
<item name="android:layout_width">match_parent</item>
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
<item name="android:layout_marginTop">15dp</item>
|
||||
</style>
|
||||
|
||||
|
||||
<style name="GreedPanelTitleText">
|
||||
<item name="android:layout_width">match_parent</item>
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
<item name="android:textSize">14sp</item>
|
||||
<item name="android:textColor">#98978a</item>
|
||||
<item name="android:textStyle">normal</item>
|
||||
<item name="android:padding">15dp</item>
|
||||
</style>
|
||||
|
||||
<style name="RowOne">
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
<item name="android:layout_width">match_parent</item>
|
||||
<item name="android:background">#f8f5f0</item>
|
||||
</style>
|
||||
|
||||
<style name="RowTwo">
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
<item name="android:layout_width">match_parent</item>
|
||||
<item name="android:background">#ffffff</item>
|
||||
</style>
|
||||
|
||||
<style name="TextRow">
|
||||
<item name="android:layout_weight">1</item>
|
||||
<item name="android:textColor">#000000</item>
|
||||
<item name="android:padding">5dip</item>
|
||||
<item name="android:gravity">left</item>
|
||||
</style>
|
||||
|
||||
<style name="SeparatorRow">
|
||||
<item name="android:layout_width">match_parent</item>
|
||||
<item name="android:layout_height">1dp</item>
|
||||
<item name="android:layout_below">@+id/settings</item>
|
||||
<item name="android:background">#dfd7ca</item>
|
||||
</style>
|
||||
|
||||
<style name="GreedPanelButtons">
|
||||
<item name="android:orientation">horizontal</item>
|
||||
<item name="android:layout_width">match_parent</item>
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
<item name="android:background">#ffffff</item>
|
||||
</style>
|
||||
|
||||
<!-- Popup_Window -->
|
||||
<style name="Popup_Container">
|
||||
<item name="android:layout_width">fill_parent</item>
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
<item name="android:layout_marginLeft">35dip</item>
|
||||
<item name="android:layout_marginRight">35dip</item>
|
||||
<item name="android:layout_marginTop">200dip</item>
|
||||
<item name="android:padding">8dip</item>
|
||||
<item name="android:orientation">vertical</item>
|
||||
<item name="android:gravity">center_vertical</item>
|
||||
<item name="android:background">@android:drawable/dialog_frame</item>
|
||||
</style>
|
||||
|
||||
<style name="Popup_Window">
|
||||
<item name="android:layout_width">fill_parent</item>
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
<item name="android:padding">20dip</item>
|
||||
<item name="android:layout_marginBottom">5dp</item>
|
||||
<item name="android:orientation">vertical</item>
|
||||
<item name="android:background">#ffffff</item>
|
||||
<item name="android:gravity">center_vertical</item>
|
||||
</style>
|
||||
|
||||
<style name="Popup_Window_Title">
|
||||
<item name="android:layout_width">match_parent</item>
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
<item name="android:textColor">#000000</item>
|
||||
<item name="android:textSize">20sp</item>
|
||||
<item name="android:textStyle">bold</item>
|
||||
<item name="android:layout_marginBottom">15dp</item>
|
||||
</style>
|
||||
|
||||
<style name="Popup_Window_Text">
|
||||
<item name="android:layout_width">match_parent</item>
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
<item name="android:textColor">#333333</item>
|
||||
<item name="android:textSize">16sp</item>
|
||||
</style>
|
||||
|
||||
<!-- Drawer -->
|
||||
<style name="Drawer">
|
||||
<item name="android:layout_width">wrap_content</item>
|
||||
<item name="android:layout_height">40dp</item>
|
||||
<item name="android:orientation">vertical</item>
|
||||
</style>
|
||||
|
||||
<style name="SpinnertDrawer">
|
||||
<item name="android:background">@null</item>
|
||||
<item name="android:layout_width">match_parent</item>
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
<item name="android:layout_alignParentBottom">true</item>
|
||||
<item name="android:clickable">true</item>
|
||||
<item name="android:textColor">#4a90e2</item>
|
||||
<item name="android:textSize">20sp</item>
|
||||
<item name="android:layout_marginLeft">-15dp</item>
|
||||
</style>
|
||||
|
||||
|
||||
<style name="Popup_Buttons">
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
<item name="android:layout_width">match_parent</item>
|
||||
<item name="android:orientation">horizontal</item>
|
||||
<item name="android:gravity">end</item>
|
||||
</style>
|
||||
|
||||
<style name="Popup_Button">
|
||||
<item name="android:layout_width">100dp</item>
|
||||
<item name="android:layout_height">40dp</item>
|
||||
<item name="android:textColor">#666666</item>
|
||||
<item name="android:textSize">18sp</item>
|
||||
<item name="android:textStyle">bold</item>
|
||||
<item name="android:background">@null</item>
|
||||
<item name="android:layout_marginTop">5dp</item>
|
||||
<item name="android:layout_gravity">right</item>
|
||||
<item name="android:layout_alignParentEnd">true</item>
|
||||
<item name="android:layout_alignParentRight">true</item>
|
||||
</style>
|
||||
|
||||
<style name="Popup_Button_Active">
|
||||
<item name="android:layout_width">100dp</item>
|
||||
<item name="android:layout_height">40dp</item>
|
||||
<item name="android:textColor">#4a90e2</item>
|
||||
<item name="android:textSize">18sp</item>
|
||||
<item name="android:textStyle">bold</item>
|
||||
<item name="android:background">@null</item>
|
||||
<item name="android:layout_marginTop">0dp</item>
|
||||
<item name="android:layout_gravity">right</item>
|
||||
<item name="android:layout_alignParentEnd">true</item>
|
||||
<item name="android:layout_alignParentRight">true</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
Loading…
x
Reference in New Issue
Block a user