You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
FairEmail/app/src/main/java/eu/faircode/email/ActivityError.java

78 lines
2.8 KiB

package eu.faircode.email;
/*
This file is part of FairEmail.
FairEmail is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
FairEmail is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with FairEmail. If not, see <http://www.gnu.org/licenses/>.
Copyright 2018-2021 by Marcel Bokhorst (M66B)
*/
import android.content.Intent;
import android.os.Bundle;
import android.text.method.LinkMovementMethod;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageButton;
import android.widget.TextView;
public class ActivityError extends ActivityBase {
static final int PI_ERROR = 1;
static final int PI_ALERT = 2;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getSupportActionBar().setSubtitle(getString(R.string.title_setup_error));
View view = LayoutInflater.from(this).inflate(R.layout.activity_error, null);
setContentView(view);
TextView tvTitle = view.findViewById(R.id.tvTitle);
TextView tvMessage = view.findViewById(R.id.tvMessage);
ImageButton ibSetting = view.findViewById(R.id.ibSetting);
ImageButton ibInfo = view.findViewById(R.id.ibInfo);
Intent intent = getIntent();
String type = intent.getStringExtra("type");
String title = intent.getStringExtra("title");
String message = intent.getStringExtra("message");
long account = intent.getLongExtra("account", -1L);
int faq = intent.getIntExtra("faq", -1);
tvTitle.setText(title);
tvMessage.setMovementMethod(LinkMovementMethod.getInstance());
tvMessage.setText(message);
ibSetting.setVisibility(account < 0 ? View.GONE : View.VISIBLE);
ibSetting.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
v.getContext().startActivity(new Intent(v.getContext(), ActivitySetup.class)
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
.putExtra("target", "accounts"));
}
});
ibInfo.setVisibility(faq > 0 ? View.VISIBLE : View.GONE);
ibInfo.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Helper.viewFAQ(view.getContext(), faq);
}
});
}
}