mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2026-12-05 00:02:27 -08:00
Refactor for list of nodes, solve bug of add button
This commit is contained in:
1 parent
79750c5320
commit
5c4d2e607a
12 files changed
+151
-198
No files matched your search
@@ -30,6 +30,7 @@ import android.support.v7.widget.Toolbar;
|
||||
import android.util.Log;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.keepassdroid.adapters.NodeAdapter;
|
||||
import com.keepassdroid.app.App;
|
||||
@@ -50,13 +51,11 @@ import com.keepassdroid.dialog.ReadOnlyDialog;
|
||||
import com.keepassdroid.fragments.GroupEditDialogFragment;
|
||||
import com.keepassdroid.fragments.IconPickerDialogFragment;
|
||||
import com.keepassdroid.tasks.ProgressTask;
|
||||
import com.keepassdroid.view.GroupAddEntryView;
|
||||
import com.keepassdroid.view.GroupRootView;
|
||||
import com.keepassdroid.view.GroupViewOnlyView;
|
||||
import com.keepassdroid.view.ListNodesWithAddButtonView;
|
||||
import com.kunzisoft.keepass.KeePass;
|
||||
import com.kunzisoft.keepass.R;
|
||||
|
||||
public abstract class GroupActivity extends GroupBaseActivity
|
||||
public abstract class GroupActivity extends ListNodesActivity
|
||||
implements GroupEditDialogFragment.EditGroupListener, IconPickerDialogFragment.IconPickerListener {
|
||||
|
||||
protected boolean addGroupEnabled = false;
|
||||
@@ -143,17 +142,11 @@ public abstract class GroupActivity extends GroupBaseActivity
|
||||
|
||||
setupButtons();
|
||||
|
||||
if ( addGroupEnabled && addEntryEnabled ) {
|
||||
setContentView(new GroupAddEntryView(this));
|
||||
} else if ( addGroupEnabled ) {
|
||||
setContentView(new GroupRootView(this));
|
||||
} else if ( addEntryEnabled ) {
|
||||
setContentView(new GroupAddEntryView(this));
|
||||
View addGroup = findViewById(R.id.add_group);
|
||||
addGroup.setVisibility(View.GONE);
|
||||
} else {
|
||||
setContentView(new GroupViewOnlyView(this));
|
||||
}
|
||||
// Construct main view
|
||||
ListNodesWithAddButtonView rootView = new ListNodesWithAddButtonView(this);
|
||||
rootView.enableAddGroup(addGroupEnabled);
|
||||
rootView.enableAddEntry(addEntryEnabled);
|
||||
setContentView(rootView);
|
||||
|
||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
toolbar.setTitle("");
|
||||
@@ -162,8 +155,6 @@ public abstract class GroupActivity extends GroupBaseActivity
|
||||
if ( mCurrentGroup.getParent() != null )
|
||||
toolbar.setNavigationIcon(R.drawable.ic_arrow_up_white_24dp);
|
||||
|
||||
Log.w(TAG, "Set view");
|
||||
|
||||
if ( addGroupEnabled ) {
|
||||
// Add Group button
|
||||
View addGroup = findViewById(R.id.add_group);
|
||||
@@ -247,6 +238,13 @@ public abstract class GroupActivity extends GroupBaseActivity
|
||||
}
|
||||
}
|
||||
|
||||
protected void setGroupIcon() {
|
||||
if (mCurrentGroup != null) {
|
||||
ImageView iv = (ImageView) findViewById(R.id.icon);
|
||||
App.getDB().drawFactory.assignDrawableTo(iv, getResources(), mCurrentGroup.getIcon());
|
||||
}
|
||||
}
|
||||
|
||||
private void deleteEntry(PwEntry entry) {
|
||||
Handler handler = new Handler();
|
||||
DeleteEntry task = new DeleteEntry(this, App.getDB(), entry,
|
||||
|
||||
Reference in new issue
Block a user