Clean code is MainActivity

This commit is contained in:
tom79 2020-03-07 14:53:54 +01:00
parent 53b1578e7e
commit d6fa22241b
3 changed files with 36 additions and 90 deletions

View File

@ -100,12 +100,7 @@ public class AboutActivity extends BaseActivity implements OnRetrieveRemoteAccou
actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
ImageView toolbar_close = actionBar.getCustomView().findViewById(R.id.toolbar_close);
TextView toolbar_title = actionBar.getCustomView().findViewById(R.id.toolbar_title);
toolbar_close.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
toolbar_close.setOnClickListener(v -> finish());
toolbar_title.setText(R.string.action_about);
}
setContentView(R.layout.activity_about);
@ -127,73 +122,52 @@ public class AboutActivity extends BaseActivity implements OnRetrieveRemoteAccou
Button about_trunk = findViewById(R.id.about_trunk);
TextView txt_developers, txt_ux, txt_thankyou3, txt_thankyou1, txt_thankyou2;
TextView txt_developers, txt_ux, txt_thankyou1, txt_thankyou2;
txt_developers = findViewById(R.id.txt_developers);
txt_ux = findViewById(R.id.txt_ux);
txt_thankyou1 = findViewById(R.id.txt_thankyou1);
txt_thankyou2 = findViewById(R.id.txt_thankyou2);
about_code.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://framagit.org/tom79/fedilab"));
startActivity(browserIntent);
}
about_code.setOnClickListener(v -> {
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://framagit.org/tom79/fedilab"));
startActivity(browserIntent);
});
about_thekinrar.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://instances.social/"));
startActivity(browserIntent);
}
about_thekinrar.setOnClickListener(v -> {
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://instances.social/"));
startActivity(browserIntent);
});
about_trunk.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://communitywiki.org/trunk"));
startActivity(browserIntent);
}
about_trunk.setOnClickListener(v -> {
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://communitywiki.org/trunk"));
startActivity(browserIntent);
});
about_license.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.gnu.org/licenses/quick-guide-gplv3.fr.html"));
startActivity(browserIntent);
}
about_license.setOnClickListener(v -> {
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.gnu.org/licenses/quick-guide-gplv3.fr.html"));
startActivity(browserIntent);
});
Button about_translation = findViewById(R.id.about_translation);
about_translation.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://translate.yandex.com/"));
startActivity(browserIntent);
}
about_translation.setOnClickListener(v -> {
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://translate.yandex.com/"));
startActivity(browserIntent);
});
TextView about_wiki = findViewById(R.id.about_wiki);
SpannableString content = new SpannableString(about_wiki.getText().toString());
content.setSpan(new UnderlineSpan(), 0, content.length(), 0);
about_wiki.setText(content);
about_wiki.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://fedilab.app/page/howto/"));
startActivity(browserIntent);
}
about_wiki.setOnClickListener(v -> {
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://fedilab.app/page/howto/"));
startActivity(browserIntent);
});
Button about_support = findViewById(R.id.about_support);
about_support.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://liberapay.com/tom79"));
startActivity(browserIntent);
}
about_support.setOnClickListener(v -> {
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://liberapay.com/tom79"));
startActivity(browserIntent);
});
if (BuildConfig.DONATIONS) {
about_support.setVisibility(View.VISIBLE);
@ -202,12 +176,9 @@ public class AboutActivity extends BaseActivity implements OnRetrieveRemoteAccou
}
Button paypal = findViewById(R.id.about_support_paypal);
paypal.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.paypal.me/Mastalab"));
startActivity(browserIntent);
}
paypal.setOnClickListener(v -> {
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.paypal.me/Mastalab"));
startActivity(browserIntent);
});
if (BuildConfig.DONATIONS) {
@ -218,12 +189,9 @@ public class AboutActivity extends BaseActivity implements OnRetrieveRemoteAccou
TextView about_website = findViewById(R.id.about_website);
about_website.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://fedilab.app"));
startActivity(browserIntent);
}
about_website.setOnClickListener(v -> {
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://fedilab.app"));
startActivity(browserIntent);
});
@ -250,42 +218,22 @@ public class AboutActivity extends BaseActivity implements OnRetrieveRemoteAccou
name.setSpan(new UnderlineSpan(), 0, name.length(), 0);
txt_developers.setText(name);
txt_developers.setVisibility(View.VISIBLE);
txt_developers.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Helper.openBrowser(AboutActivity.this, "https://toot.fedilab.app/@fedilab");
}
});
txt_developers.setOnClickListener(v -> Helper.openBrowser(AboutActivity.this, "https://toot.fedilab.app/@fedilab"));
name = new SpannableString("@mmarif@mastodon.social");
name.setSpan(new UnderlineSpan(), 0, name.length(), 0);
txt_ux.setText(name);
txt_ux.setVisibility(View.VISIBLE);
txt_ux.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Helper.openBrowser(AboutActivity.this, "https://mastodon.social/@mmarif");
}
});
txt_ux.setOnClickListener(v -> Helper.openBrowser(AboutActivity.this, "https://mastodon.social/@mmarif"));
name = new SpannableString("@PhotonQyv@mastodon.xyz");
name.setSpan(new UnderlineSpan(), 0, name.length(), 0);
txt_thankyou1.setText(name);
txt_thankyou1.setVisibility(View.VISIBLE);
txt_thankyou1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Helper.openBrowser(AboutActivity.this, "https://mastodon.xyz/@PhotonQyv");
}
});
txt_thankyou1.setOnClickListener(v -> Helper.openBrowser(AboutActivity.this, "https://mastodon.xyz/@PhotonQyv"));
name = new SpannableString("@angrytux@social.tchncs.de");
name.setSpan(new UnderlineSpan(), 0, name.length(), 0);
txt_thankyou2.setText(name);
txt_thankyou2.setVisibility(View.VISIBLE);
txt_thankyou2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Helper.openBrowser(AboutActivity.this, "https://social.tchncs.de/@angrytux");
}
});
txt_thankyou2.setOnClickListener(v -> Helper.openBrowser(AboutActivity.this, "https://social.tchncs.de/@angrytux"));
}
}

View File

@ -261,8 +261,6 @@ public abstract class BaseMainActivity extends BaseActivity
countNewStatus = 0;
countNewNotifications = 0;
//TODO: remove that line
// social = UpdateAccountInfoAsyncTask.SOCIAL.PIXELFED;
regex_home = sharedpreferences.getString(Helper.SET_FILTER_REGEX_HOME, null);
regex_local = sharedpreferences.getString(Helper.SET_FILTER_REGEX_LOCAL, null);

View File

@ -129,7 +129,7 @@
android:layout_margin="@dimen/fab_margin_floating"
android:contentDescription="@string/toot_it"
android:src="@drawable/ic_edit"
tools:ignore="VectorDrawableCompat" />
/>
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/delete_all"
@ -140,7 +140,7 @@
android:contentDescription="@string/delete_all"
android:src="@drawable/ic_delete_floating"
android:visibility="gone"
tools:ignore="VectorDrawableCompat" />
/>
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/add_new"
@ -151,7 +151,7 @@
android:contentDescription="@string/add_new"
android:src="@drawable/ic_action_add_new"
android:visibility="gone"
tools:ignore="VectorDrawableCompat" />
/>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
<com.google.android.material.navigation.NavigationView