Remove DApp functionality
This commit is contained in:
parent
70b9b77fef
commit
b529bc8179
|
@ -109,11 +109,11 @@ public abstract class BaseActivity extends AppCompatActivity implements
|
|||
private DAppDrawerAdapter mDAppsDrawerAdapter;
|
||||
private ProfileDrawerAdapter mProfileDrawerAdapter;
|
||||
|
||||
protected abstract void onDAppClick(Dapp dapp);
|
||||
|
||||
private ItemTouchHelper mDAppsTouchHelper;
|
||||
private ItemTouchHelper mProfilesTouchHelper;
|
||||
|
||||
protected abstract void onDAppClick(Dapp dapp);
|
||||
|
||||
@SuppressLint("InflateParams")
|
||||
@Override
|
||||
public void setContentView(final int layoutResID) {
|
||||
|
|
|
@ -77,4 +77,12 @@ public class Dapp implements Serializable {
|
|||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (!(o instanceof Dapp)) return false;
|
||||
Dapp object = (Dapp) o;
|
||||
return object.getId().equalsIgnoreCase(id);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,16 +43,14 @@ import io.syng.entity.Profile;
|
|||
public final class GeneralUtil {
|
||||
|
||||
public static void hideKeyBoard(View view, Context context) {
|
||||
if (view == null)
|
||||
return;
|
||||
if (view == null) return;
|
||||
InputMethodManager imm = (InputMethodManager)
|
||||
context.getApplicationContext().getSystemService(Activity.INPUT_METHOD_SERVICE);
|
||||
imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
|
||||
}
|
||||
|
||||
public static void showKeyBoard(View view, Context context) {
|
||||
if (view == null)
|
||||
return;
|
||||
if (view == null) return;
|
||||
InputMethodManager imm = (InputMethodManager) context.getApplicationContext().getSystemService(Activity.INPUT_METHOD_SERVICE);
|
||||
imm.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT);
|
||||
}
|
||||
|
@ -158,6 +156,8 @@ public final class GeneralUtil {
|
|||
.customView(R.layout.dapp_form, true)
|
||||
.positiveText(R.string.save)
|
||||
.negativeText(R.string.cancel)
|
||||
.neutralText("Remove")
|
||||
.neutralColorRes(android.R.color.holo_red_dark)
|
||||
.callback(new MaterialDialog.ButtonCallback() {
|
||||
@Override
|
||||
public void onPositive(MaterialDialog dialog) {
|
||||
|
@ -185,6 +185,12 @@ public final class GeneralUtil {
|
|||
public void onNegative(MaterialDialog dialog) {
|
||||
dialog.hide();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeutral(MaterialDialog dialog) {
|
||||
ProfileManager.removeDAppInProfile(ProfileManager.getCurrentProfile(), dapp);
|
||||
dialog.hide();
|
||||
}
|
||||
})
|
||||
.autoDismiss(false)
|
||||
.build();
|
||||
|
@ -241,6 +247,7 @@ public final class GeneralUtil {
|
|||
.positiveText(R.string.sImport)
|
||||
.negativeText(R.string.cancel)
|
||||
.callback(new MaterialDialog.ButtonCallback() {
|
||||
@SuppressWarnings("TryFinallyCanBeTryWithResources")
|
||||
@Override
|
||||
public void onPositive(MaterialDialog dialog) {
|
||||
|
||||
|
|
|
@ -96,7 +96,6 @@ public final class ProfileManager {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
return new Profile();
|
||||
}
|
||||
|
||||
|
@ -113,6 +112,11 @@ public final class ProfileManager {
|
|||
notifyListener();
|
||||
}
|
||||
|
||||
public static void removeDAppInProfile(Profile profile, Dapp dapp) {
|
||||
profile.removeDapp(dapp);
|
||||
ProfileManager.updateProfile(profile);
|
||||
notifyListener();
|
||||
}
|
||||
|
||||
public static void updateDAppInProfile(Profile profile, Dapp dapp) {
|
||||
profile.updateDapp(dapp);
|
||||
|
|
Loading…
Reference in New Issue