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 DAppDrawerAdapter mDAppsDrawerAdapter;
|
||||||
private ProfileDrawerAdapter mProfileDrawerAdapter;
|
private ProfileDrawerAdapter mProfileDrawerAdapter;
|
||||||
|
|
||||||
protected abstract void onDAppClick(Dapp dapp);
|
|
||||||
|
|
||||||
private ItemTouchHelper mDAppsTouchHelper;
|
private ItemTouchHelper mDAppsTouchHelper;
|
||||||
private ItemTouchHelper mProfilesTouchHelper;
|
private ItemTouchHelper mProfilesTouchHelper;
|
||||||
|
|
||||||
|
protected abstract void onDAppClick(Dapp dapp);
|
||||||
|
|
||||||
@SuppressLint("InflateParams")
|
@SuppressLint("InflateParams")
|
||||||
@Override
|
@Override
|
||||||
public void setContentView(final int layoutResID) {
|
public void setContentView(final int layoutResID) {
|
||||||
|
|
|
@ -77,4 +77,12 @@ public class Dapp implements Serializable {
|
||||||
this.id = id;
|
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 final class GeneralUtil {
|
||||||
|
|
||||||
public static void hideKeyBoard(View view, Context context) {
|
public static void hideKeyBoard(View view, Context context) {
|
||||||
if (view == null)
|
if (view == null) return;
|
||||||
return;
|
|
||||||
InputMethodManager imm = (InputMethodManager)
|
InputMethodManager imm = (InputMethodManager)
|
||||||
context.getApplicationContext().getSystemService(Activity.INPUT_METHOD_SERVICE);
|
context.getApplicationContext().getSystemService(Activity.INPUT_METHOD_SERVICE);
|
||||||
imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
|
imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void showKeyBoard(View view, Context context) {
|
public static void showKeyBoard(View view, Context context) {
|
||||||
if (view == null)
|
if (view == null) return;
|
||||||
return;
|
|
||||||
InputMethodManager imm = (InputMethodManager) context.getApplicationContext().getSystemService(Activity.INPUT_METHOD_SERVICE);
|
InputMethodManager imm = (InputMethodManager) context.getApplicationContext().getSystemService(Activity.INPUT_METHOD_SERVICE);
|
||||||
imm.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT);
|
imm.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT);
|
||||||
}
|
}
|
||||||
|
@ -158,6 +156,8 @@ public final class GeneralUtil {
|
||||||
.customView(R.layout.dapp_form, true)
|
.customView(R.layout.dapp_form, true)
|
||||||
.positiveText(R.string.save)
|
.positiveText(R.string.save)
|
||||||
.negativeText(R.string.cancel)
|
.negativeText(R.string.cancel)
|
||||||
|
.neutralText("Remove")
|
||||||
|
.neutralColorRes(android.R.color.holo_red_dark)
|
||||||
.callback(new MaterialDialog.ButtonCallback() {
|
.callback(new MaterialDialog.ButtonCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onPositive(MaterialDialog dialog) {
|
public void onPositive(MaterialDialog dialog) {
|
||||||
|
@ -185,6 +185,12 @@ public final class GeneralUtil {
|
||||||
public void onNegative(MaterialDialog dialog) {
|
public void onNegative(MaterialDialog dialog) {
|
||||||
dialog.hide();
|
dialog.hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNeutral(MaterialDialog dialog) {
|
||||||
|
ProfileManager.removeDAppInProfile(ProfileManager.getCurrentProfile(), dapp);
|
||||||
|
dialog.hide();
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.autoDismiss(false)
|
.autoDismiss(false)
|
||||||
.build();
|
.build();
|
||||||
|
@ -241,6 +247,7 @@ public final class GeneralUtil {
|
||||||
.positiveText(R.string.sImport)
|
.positiveText(R.string.sImport)
|
||||||
.negativeText(R.string.cancel)
|
.negativeText(R.string.cancel)
|
||||||
.callback(new MaterialDialog.ButtonCallback() {
|
.callback(new MaterialDialog.ButtonCallback() {
|
||||||
|
@SuppressWarnings("TryFinallyCanBeTryWithResources")
|
||||||
@Override
|
@Override
|
||||||
public void onPositive(MaterialDialog dialog) {
|
public void onPositive(MaterialDialog dialog) {
|
||||||
|
|
||||||
|
|
|
@ -96,7 +96,6 @@ public final class ProfileManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return new Profile();
|
return new Profile();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,6 +112,11 @@ public final class ProfileManager {
|
||||||
notifyListener();
|
notifyListener();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void removeDAppInProfile(Profile profile, Dapp dapp) {
|
||||||
|
profile.removeDapp(dapp);
|
||||||
|
ProfileManager.updateProfile(profile);
|
||||||
|
notifyListener();
|
||||||
|
}
|
||||||
|
|
||||||
public static void updateDAppInProfile(Profile profile, Dapp dapp) {
|
public static void updateDAppInProfile(Profile profile, Dapp dapp) {
|
||||||
profile.updateDapp(dapp);
|
profile.updateDapp(dapp);
|
||||||
|
|
Loading…
Reference in New Issue