mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-19 14:19:53 +01:00
Move ShardsSentDismissedListener into ShardsSentFragment
This commit is contained in:
@@ -21,7 +21,8 @@ import javax.inject.Inject;
|
|||||||
|
|
||||||
public class DistributedBackupActivity extends BriarActivity implements
|
public class DistributedBackupActivity extends BriarActivity implements
|
||||||
BaseFragment.BaseFragmentListener, ContactSelectorListener,
|
BaseFragment.BaseFragmentListener, ContactSelectorListener,
|
||||||
ThresholdDefinedListener, ShardsSentDismissedListener {
|
ThresholdDefinedListener,
|
||||||
|
ShardsSentFragment.ShardsSentDismissedListener {
|
||||||
|
|
||||||
private Collection<ContactId> custodians;
|
private Collection<ContactId> custodians;
|
||||||
|
|
||||||
@@ -73,7 +74,8 @@ public class DistributedBackupActivity extends BriarActivity implements
|
|||||||
try {
|
try {
|
||||||
db.transaction(false, txn -> {
|
db.transaction(false, txn -> {
|
||||||
socialBackupManager
|
socialBackupManager
|
||||||
.createBackup(txn, (List<ContactId>) custodians, threshold);
|
.createBackup(txn, (List<ContactId>) custodians,
|
||||||
|
threshold);
|
||||||
ShardsSentFragment fragment = new ShardsSentFragment();
|
ShardsSentFragment fragment = new ShardsSentFragment();
|
||||||
showNextFragment(fragment);
|
showNextFragment(fragment);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
package org.briarproject.briar.android.socialbackup;
|
|
||||||
|
|
||||||
import androidx.annotation.UiThread;
|
|
||||||
|
|
||||||
public interface ShardsSentDismissedListener {
|
|
||||||
|
|
||||||
@UiThread
|
|
||||||
void shardsSentDismissed();
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -13,48 +13,58 @@ import org.briarproject.briar.android.fragment.BaseFragment;
|
|||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.annotation.UiThread;
|
||||||
|
|
||||||
public class ShardsSentFragment extends BaseFragment {
|
public class ShardsSentFragment extends BaseFragment {
|
||||||
|
|
||||||
public static final String TAG = ShardsSentFragment.class.getName();
|
public static final String TAG = ShardsSentFragment.class.getName();
|
||||||
|
|
||||||
protected ShardsSentDismissedListener listener;
|
interface ShardsSentDismissedListener {
|
||||||
|
|
||||||
@Override
|
@UiThread
|
||||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
void shardsSentDismissed();
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
requireActivity().setTitle(R.string.title_distributed_backup);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
}
|
||||||
@Override
|
|
||||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
|
||||||
View view = inflater.inflate(R.layout.fragment_shards_sent,
|
|
||||||
container, false);
|
|
||||||
|
|
||||||
Button button = view.findViewById(R.id.button);
|
protected ShardsSentDismissedListener listener;
|
||||||
button.setOnClickListener(e -> {
|
|
||||||
listener.shardsSentDismissed();
|
|
||||||
});
|
|
||||||
|
|
||||||
return view;
|
@Override
|
||||||
}
|
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
requireActivity().setTitle(R.string.title_distributed_backup);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Nullable
|
||||||
public void onAttach(Context context) {
|
@Override
|
||||||
super.onAttach(context);
|
public View onCreateView(@NonNull LayoutInflater inflater,
|
||||||
listener = (ShardsSentDismissedListener) context;
|
@Nullable ViewGroup container,
|
||||||
}
|
@Nullable Bundle savedInstanceState) {
|
||||||
|
View view = inflater.inflate(R.layout.fragment_shards_sent,
|
||||||
|
container, false);
|
||||||
|
|
||||||
|
Button button = view.findViewById(R.id.button);
|
||||||
|
button.setOnClickListener(e -> {
|
||||||
|
listener.shardsSentDismissed();
|
||||||
|
});
|
||||||
|
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAttach(Context context) {
|
||||||
|
super.onAttach(context);
|
||||||
|
listener = (ShardsSentDismissedListener) context;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getUniqueTag() {
|
public String getUniqueTag() {
|
||||||
return TAG;
|
return TAG;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void injectFragment(ActivityComponent component) {
|
public void injectFragment(ActivityComponent component) {
|
||||||
component.inject(this);
|
component.inject(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user