Display popup

This commit is contained in:
tom79 2019-12-18 08:31:46 +01:00
parent 69a1c1905e
commit cec56159cc
2 changed files with 40 additions and 0 deletions

View File

@ -73,6 +73,7 @@ import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import app.fedilab.android.R;
import app.fedilab.android.asynctasks.DeleteDomainsAsyncTask;
import app.fedilab.android.asynctasks.ManageListsAsyncTask;
import app.fedilab.android.asynctasks.PostActionAsyncTask;
import app.fedilab.android.asynctasks.RetrieveAccountAsyncTask;
@ -94,6 +95,7 @@ import app.fedilab.android.client.Entities.RemoteInstance;
import app.fedilab.android.client.Entities.Status;
import app.fedilab.android.client.Entities.UserNote;
import app.fedilab.android.client.HttpsConnection;
import app.fedilab.android.drawers.DomainsListAdapter;
import app.fedilab.android.drawers.StatusListAdapter;
import app.fedilab.android.fragments.DisplayAccountsFragment;
import app.fedilab.android.fragments.DisplayStatusFragment;
@ -1553,6 +1555,43 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
if( identityProofs != null && identityProofs.size() > 0 ){
ImageView identity_proofs_indicator = findViewById(R.id.identity_proofs_indicator);
identity_proofs_indicator.setVisibility(View.VISIBLE);
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
accountUrl = account.getUrl();
int style;
if (theme == Helper.THEME_LIGHT)
style = R.style.Dialog;
else if (theme == Helper.THEME_BLACK)
style = R.style.DialogBlack;
else
style = R.style.DialogDark;
identity_proofs_indicator.setOnClickListener(v -> {
AlertDialog.Builder builder = new AlertDialog.Builder(ShowAccountActivity.this, style);
final ArrayAdapter<String> arrayAdapter = new ArrayAdapter<>(ShowAccountActivity.this, android.R.layout.select_dialog_item);
for (IdentityProof identityProof: identityProofs) {
arrayAdapter.add(String.format("✅ @%s \uD83D\uDD17 %s", identityProof.getProvider_username(), identityProof.getProvider() ));
}
builder.setAdapter(arrayAdapter, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int position) {
if( identityProofs.size() > position ) {
String url = identityProofs.get(position).getProfile_url();
Helper.openBrowser(ShowAccountActivity.this, url);
}
}
});
builder
.setTitle(R.string.identity_proofs)
.setPositiveButton(R.string.close, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
})
.show();
});
}
}

View File

@ -1208,4 +1208,5 @@
<string name="talking_about">%d people talking</string>
<string name="twitter_accounts">Twitter accounts (via Nitter)</string>
<string name="list_of_twitter_accounts">Twitter usernames space separated</string>
<string name="identity_proofs">Identity proofs</string>
</resources>