added app info popup, added new dependency, bug fix

This commit is contained in:
nuclearfog 2020-05-05 13:28:23 +02:00
parent 013bd73cce
commit e01bf43b3c
No known key found for this signature in database
GPG Key ID: ED35E22099354A64
15 changed files with 84 additions and 26 deletions

View File

@ -45,4 +45,5 @@ dependencies {
implementation 'com.github.QuadFlask:colorpicker:0.0.13'
implementation 'com.github.nuclearfog:ZoomView:1.0.2'
implementation 'com.github.nuclearfog:Tagger:2.2'
implementation 'com.github.nuclearfog:LinkAndScrollMovement:1.0'
}

View File

@ -3,8 +3,6 @@ package org.nuclearfog.twidda.activity;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.DialogInterface.OnDismissListener;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.text.Editable;
import android.util.Patterns;
@ -21,7 +19,7 @@ import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.EditText;
import android.widget.NumberPicker;
import android.widget.Spinner;
import android.widget.Toast;
import android.widget.TextView;
import androidx.appcompat.app.AlertDialog.Builder;
import androidx.appcompat.app.AppCompatActivity;
@ -31,6 +29,7 @@ import com.flask.colorpicker.ColorPickerView;
import com.flask.colorpicker.OnColorChangedListener;
import com.flask.colorpicker.builder.ColorPickerDialogBuilder;
import org.nuclearfog.twidda.BuildConfig;
import org.nuclearfog.twidda.R;
import org.nuclearfog.twidda.adapter.FontAdapter;
import org.nuclearfog.twidda.adapter.LocationAdapter;
@ -46,7 +45,6 @@ import java.util.regex.Matcher;
import static android.os.AsyncTask.Status.RUNNING;
import static android.view.View.GONE;
import static android.widget.Toast.LENGTH_SHORT;
import static org.nuclearfog.twidda.activity.MainActivity.APP_LOGOUT;
import static org.nuclearfog.twidda.activity.MainActivity.DB_CLEARED;
@ -196,12 +194,14 @@ public class AppSettings extends AppCompatActivity implements OnClickListener, O
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == R.id.settings_info) {
String link = getString(R.string.information_link);
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(link));
if (intent.resolveActivity(getPackageManager()) != null)
startActivity(intent);
else
Toast.makeText(this, R.string.error_connection, LENGTH_SHORT).show();
Dialog dialog = new Dialog(this, R.style.AppInfoDialog);
dialog.setContentView(R.layout.popup_app_info);
dialog.setTitle(R.string.settings_about);
String versionName = " V" + BuildConfig.VERSION_NAME;
TextView appInfo = dialog.findViewById(R.id.settings_app_info);
appInfo.setLinkTextColor(settings.getHighlightColor());
appInfo.append(versionName);
dialog.show();
}
return super.onOptionsItemSelected(item);
}
@ -211,7 +211,7 @@ public class AppSettings extends AppCompatActivity implements OnClickListener, O
public void onClick(View v) {
switch (v.getId()) {
case R.id.delete_db:
new Builder(this, R.style.InfoDialog)
new Builder(this, R.style.ConfirmDialog)
.setMessage(R.string.confirm_delete_database)
.setNegativeButton(R.string.confirm_no, null)
.setPositiveButton(R.string.confirm_yes, new DialogInterface.OnClickListener() {
@ -225,7 +225,7 @@ public class AppSettings extends AppCompatActivity implements OnClickListener, O
break;
case R.id.logout:
new Builder(this, R.style.InfoDialog)
new Builder(this, R.style.ConfirmDialog)
.setMessage(R.string.confirm_log_lout)
.setNegativeButton(R.string.confirm_no, null)
.setPositiveButton(R.string.confirm_yes, new DialogInterface.OnClickListener() {

View File

@ -76,7 +76,7 @@ public class MessagePopup extends AppCompatActivity implements OnClickListener {
if (text.getText().toString().isEmpty() && mediaPath.isEmpty()) {
super.onBackPressed();
} else {
Builder closeDialog = new Builder(this, R.style.InfoDialog);
Builder closeDialog = new Builder(this, R.style.ConfirmDialog);
closeDialog.setMessage(R.string.confirm_cancel_message);
closeDialog.setNegativeButton(R.string.confirm_no, null);
closeDialog.setPositiveButton(R.string.confirm_yes, new DialogInterface.OnClickListener() {

View File

@ -101,7 +101,7 @@ public class ProfileEditor extends AppCompatActivity implements OnClickListener
@Override
public void onBackPressed() {
Builder closeDialog = new Builder(this, R.style.InfoDialog);
Builder closeDialog = new Builder(this, R.style.ConfirmDialog);
closeDialog.setMessage(R.string.confirm_discard);
closeDialog.setNegativeButton(R.string.confirm_no, null);
closeDialog.setPositiveButton(R.string.confirm_yes, new DialogInterface.OnClickListener() {

View File

@ -7,7 +7,6 @@ import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.text.Spannable;
import android.text.method.LinkMovementMethod;
import android.view.Menu;
import android.view.MenuItem;
import android.view.MotionEvent;
@ -31,6 +30,7 @@ import com.squareup.picasso.Picasso;
import org.nuclearfog.tag.Tagger;
import org.nuclearfog.tag.Tagger.OnTagClickListener;
import org.nuclearfog.textviewtool.LinkAndScrollMovement;
import org.nuclearfog.twidda.R;
import org.nuclearfog.twidda.adapter.FragmentAdapter;
import org.nuclearfog.twidda.adapter.FragmentAdapter.AdapterType;
@ -125,7 +125,7 @@ public class TweetDetail extends AppCompatActivity implements OnClickListener, O
FontTool.setViewFontAndColor(settings, root);
FragmentAdapter adapter = new FragmentAdapter(getSupportFragmentManager(), AdapterType.TWEET_PAGE, tweetID, username);
tweetText.setMovementMethod(LinkMovementMethod.getInstance());
tweetText.setMovementMethod(LinkAndScrollMovement.getInstance());
tweetText.setLinkTextColor(settings.getHighlightColor());
root.setBackgroundColor(settings.getBackgroundColor());
pager.setOffscreenPageLimit(1);
@ -182,7 +182,7 @@ public class TweetDetail extends AppCompatActivity implements OnClickListener, O
if (statusAsync != null && statusAsync.getStatus() != RUNNING) {
switch (item.getItemId()) {
case R.id.delete_tweet:
Builder deleteDialog = new Builder(this, R.style.InfoDialog);
Builder deleteDialog = new Builder(this, R.style.ConfirmDialog);
deleteDialog.setMessage(R.string.confirm_delete_tweet);
deleteDialog.setPositiveButton(R.string.confirm_yes, new DialogInterface.OnClickListener() {
@Override

View File

@ -295,7 +295,7 @@ public class TweetPopup extends AppCompatActivity implements OnClickListener, Lo
* @param tweet tweet to re-send
*/
public void showErrorMsg(final TweetHolder tweet) {
AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.InfoDialog);
AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.ConfirmDialog);
builder.setTitle(R.string.info_error).setMessage(R.string.error_sending_tweet)
.setPositiveButton(R.string.confirm_retry, new DialogInterface.OnClickListener() {
@Override
@ -313,7 +313,7 @@ public class TweetPopup extends AppCompatActivity implements OnClickListener, Lo
*/
private void showClosingMsg() {
if (!addition.equals(tweetText.getText().toString()) || !mediaPath.isEmpty()) {
Builder closeDialog = new Builder(this, R.style.InfoDialog);
Builder closeDialog = new Builder(this, R.style.ConfirmDialog);
closeDialog.setMessage(R.string.confirm_cancel_tweet);
closeDialog.setNegativeButton(R.string.confirm_no, null);
closeDialog.setPositiveButton(R.string.confirm_yes, new DialogInterface.OnClickListener() {

View File

@ -5,7 +5,6 @@ import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.text.Spanned;
import android.text.method.LinkMovementMethod;
import android.view.Menu;
import android.view.MenuItem;
import android.view.MotionEvent;
@ -32,6 +31,7 @@ import com.squareup.picasso.Picasso;
import org.nuclearfog.tag.Tagger;
import org.nuclearfog.tag.Tagger.OnTagClickListener;
import org.nuclearfog.textviewtool.LinkAndScrollMovement;
import org.nuclearfog.twidda.R;
import org.nuclearfog.twidda.adapter.FragmentAdapter;
import org.nuclearfog.twidda.adapter.FragmentAdapter.AdapterType;
@ -134,7 +134,7 @@ public class UserProfile extends AppCompatActivity implements OnClickListener,
txtUser.setBackgroundColor(settings.getBackgroundColor() & TRANSPARENCY);
txtScrName.setBackgroundColor(settings.getBackgroundColor() & TRANSPARENCY);
follow_back.setBackgroundColor(settings.getBackgroundColor() & TRANSPARENCY);
bioTxt.setMovementMethod(LinkMovementMethod.getInstance());
bioTxt.setMovementMethod(LinkAndScrollMovement.getInstance());
tab.setSelectedTabIndicatorColor(settings.getHighlightColor());
bioTxt.setLinkTextColor(settings.getHighlightColor());
lnkTxt.setTextColor(settings.getHighlightColor());

View File

@ -108,7 +108,7 @@ public class ListFragment extends Fragment implements OnRefreshListener, ListCli
case FOLLOW:
if (listItem.isFollowing()) {
if (getContext() != null) {
Builder confirmDialog = new Builder(getContext(), R.style.InfoDialog);
Builder confirmDialog = new Builder(getContext(), R.style.ConfirmDialog);
confirmDialog.setMessage(R.string.confirm_unfollow_list);
confirmDialog.setNegativeButton(R.string.confirm_no, null);
confirmDialog.setPositiveButton(R.string.confirm_yes, new DialogInterface.OnClickListener() {
@ -142,7 +142,7 @@ public class ListFragment extends Fragment implements OnRefreshListener, ListCli
case DELETE:
if (getContext() != null) {
Builder confirmDialog = new Builder(getContext(), R.style.InfoDialog);
Builder confirmDialog = new Builder(getContext(), R.style.ConfirmDialog);
confirmDialog.setMessage(R.string.confirm_delete_list);
confirmDialog.setNegativeButton(R.string.confirm_no, null);
confirmDialog.setPositiveButton(R.string.confirm_yes, new DialogInterface.OnClickListener() {

View File

@ -126,7 +126,7 @@ public class MessageFragment extends Fragment implements OnRefreshListener, OnIt
case DELETE:
if (getContext() != null) {
Builder confirmDialog = new Builder(getContext(), R.style.InfoDialog);
Builder confirmDialog = new Builder(getContext(), R.style.ConfirmDialog);
confirmDialog.setMessage(R.string.confirm_delete_message);
confirmDialog.setNegativeButton(R.string.confirm_no, null);
confirmDialog.setPositiveButton(R.string.confirm_yes, new DialogInterface.OnClickListener() {

View File

@ -96,6 +96,7 @@ public class TrendFragment extends Fragment implements OnRefreshListener, TrendC
@Override
public void onSettingsChange() {
adapter.clear();
notifyChange = true;
}

View File

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/settings_app_info"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="@dimen/settings_appinfo_text_padding"
android:text="@string/app_name" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="@dimen/settings_appinfo_text_padding"
android:text="@string/settings_3rd_party_license" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:autoLink="web"
android:linksClickable="true"
android:padding="@dimen/settings_appinfo_text_padding"
android:text="@string/settings_info_license_link" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="@dimen/settings_appinfo_text_padding"
android:text="@string/settings_info_github" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:autoLink="web"
android:linksClickable="true"
android:padding="@dimen/settings_appinfo_text_padding"
android:text="@string/settings_info_link" />
</LinearLayout>

View File

@ -149,4 +149,7 @@
<string name="profile_banner">Profilbanner</string>
<string name="editprofile_add_banner">Profilbanner hinzufügen</string>
<string name="error_invalid_link">Ungültiger Link!</string>
<string name="settings_about">Über</string>
<string name="settings_3rd_party_license">"App und drittabbieter Bibliotheken lizenz "</string>
<string name="settings_info_github">"Github Seite: "</string>
</resources>

View File

@ -72,4 +72,5 @@
<dimen name="profile_tv_margin">2dp</dimen>
<dimen name="profile_banner_padding">5dp</dimen>
<dimen name="profile_tv_padding">2dp</dimen>
<dimen name="settings_appinfo_text_padding">5dp</dimen>
</resources>

View File

@ -115,7 +115,7 @@
<string name="error_open_link">Failed to open link!</string>
<string name="error_image_download">Image could not be loaded!</string>
<string name="error_dm_send">Cannot send directmessage to this user!</string>
<string name="information_link" translatable="false">https://github.com/nuclearfog/Shitter</string>
<string name="settings_info_link" translatable="false">https://github.com/nuclearfog/Shitter</string>
<string name="confirm_mute">mute user?</string>
<string name="error_location">could not fetch location!</string>
<string name="info_not_implemented">This function is not implemented yet!</string>
@ -150,4 +150,8 @@
<string name="profile_banner">Profile banner image</string>
<string name="editprofile_add_banner">add banner</string>
<string name="error_invalid_link">invalid link!</string>
<string name="settings_about">About</string>
<string name="settings_3rd_party_license">App and 3rd party libraries license</string>
<string name="settings_info_license_link" translatable="false">http://www.apache.org/licenses/LICENSE-2.0</string>
<string name="settings_info_github">Github page:</string>
</resources>

View File

@ -14,13 +14,20 @@
<item name="android:backgroundDimEnabled">true</item>
</style>
<style name="InfoDialog" parent="Theme.AppCompat.Dialog.Alert">
<style name="ConfirmDialog" parent="Theme.AppCompat.Dialog.Alert">
<item name="android:colorBackground">@color/bright_transparent</item>
<item name="android:textColor">@android:color/holo_red_dark</item>
<item name="android:textColorPrimary">@android:color/black</item>
<item name="android:backgroundDimEnabled">true</item>
</style>
<style name="AppInfoDialog" parent="Theme.AppCompat.Dialog.Alert">
<item name="android:textColor">@android:color/black</item>
<item name="android:textColorLink">@android:color/holo_blue_dark</item>
<item name="android:colorBackground">@color/bright_transparent</item>
<item name="android:backgroundDimEnabled">true</item>
</style>
<style name="TransactionPending" parent="@android:style/Animation">
<item name="android:windowEnterAnimation">@android:anim/fade_in</item>
<item name="android:windowExitAnimation">@android:anim/fade_out</item>