Merge pull request #885 from lbryio/visual-tweaks

Use thin divider in transaction history. Set font for action bar title.
This commit is contained in:
Akinwale Ariwodola 2020-05-23 15:18:43 +01:00 committed by GitHub
commit f86b61741d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 26 additions and 29 deletions

View file

@ -17,6 +17,7 @@ import android.content.res.Configuration;
import android.content.res.TypedArray;
import android.database.sqlite.SQLiteDatabase;
import android.graphics.Color;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.AsyncTask;
@ -26,7 +27,10 @@ import android.os.Handler;
import android.provider.MediaStore;
import android.support.v4.media.session.MediaSessionCompat;
import android.text.Editable;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.TextWatcher;
import android.text.style.TypefaceSpan;
import android.util.Base64;
import android.util.Log;
import android.view.KeyEvent;
@ -63,6 +67,7 @@ import androidx.core.app.NotificationManagerCompat;
import androidx.core.content.ContextCompat;
import androidx.core.content.FileProvider;
import androidx.core.content.res.ResourcesCompat;
import androidx.core.graphics.TypefaceCompat;
import androidx.core.graphics.drawable.DrawableCompat;
import androidx.core.view.GravityCompat;
import androidx.core.view.OnApplyWindowInsetsListener;
@ -542,6 +547,15 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
}
}
public void setActionBarTitle(int stringResourceId) {
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
SpannableString spannable = new SpannableString(getString(stringResourceId));
spannable.setSpan(new TypefaceSpan("inter"), 0, spannable.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
actionBar.setTitle(spannable);
}
}
public void addScreenOrientationListener(ScreenOrientationListener listener) {
if (!screenOrientationListeners.contains(listener)) {
screenOrientationListeners.add(listener);

View file

@ -503,10 +503,8 @@ public class ChannelFormFragment extends BaseFragment implements
activity.addFilePickerListener(this);
activity.addWalletBalanceListener(this);
ActionBar actionBar = activity.getSupportActionBar();
if (actionBar != null) {
actionBar.setTitle(editMode ? R.string.edit_channel : R.string.create_a_channel);
}
activity.setActionBarTitle(editMode ? R.string.edit_channel : R.string.create_a_channel);
}
}
@ -544,10 +542,7 @@ public class ChannelFormFragment extends BaseFragment implements
LbryAnalytics.setCurrentScreen(activity, "Channel Form", "ChannelForm");
activity.addStoragePermissionListener(this);
if (editMode) {
ActionBar actionBar = activity.getSupportActionBar();
if (actionBar != null) {
actionBar.setTitle(R.string.edit_channel);
}
activity.setActionBarTitle(R.string.edit_channel);
}
}
String filterText = Helper.getValue(inputTagFilter.getText());

View file

@ -180,10 +180,7 @@ public class AboutFragment extends BaseFragment implements SdkStatusListener {
activity.lockDrawer();
activity.hideFloatingWalletBalance();
ActionBar actionBar = activity.getSupportActionBar();
if (actionBar != null) {
actionBar.setTitle(R.string.about_lbry);
}
activity.setActionBarTitle(R.string.about_lbry);
}
}

View file

@ -35,10 +35,7 @@ public class SettingsFragment extends PreferenceFragmentCompat implements Shared
activity.lockDrawer();
activity.hideFloatingWalletBalance();
ActionBar actionBar = activity.getSupportActionBar();
if (actionBar != null) {
actionBar.setTitle(R.string.settings);
}
activity.setActionBarTitle(R.string.settings);
}
}

View file

@ -499,10 +499,7 @@ public class PublishFormFragment extends BaseFragment implements
activity.addFilePickerListener(this);
activity.addWalletBalanceListener(this);
ActionBar actionBar = activity.getSupportActionBar();
if (actionBar != null) {
actionBar.setTitle(editMode ? R.string.edit_content : R.string.new_publish);
}
activity.setActionBarTitle(editMode ? R.string.edit_content : R.string.new_publish);
}
}
@ -889,10 +886,7 @@ public class PublishFormFragment extends BaseFragment implements
LbryAnalytics.setCurrentScreen(activity, "Channel Form", "ChannelForm");
activity.addStoragePermissionListener(this);
if (editMode) {
ActionBar actionBar = activity.getSupportActionBar();
if (actionBar != null) {
actionBar.setTitle(R.string.edit_content);
}
activity.setActionBarTitle(R.string.edit_content);
}
}

View file

@ -10,6 +10,7 @@ import android.widget.ProgressBar;
import androidx.annotation.NonNull;
import androidx.appcompat.app.ActionBar;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.DividerItemDecoration;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
@ -48,7 +49,9 @@ public class TransactionHistoryFragment extends BaseFragment implements Transact
Context context = getContext();
LinearLayoutManager llm = new LinearLayoutManager(context);
transactionList.setLayoutManager(llm);
transactionList.addItemDecoration(new DividerItemDecoration(context, DividerItemDecoration.VERTICAL));
DividerItemDecoration itemDecoration = new DividerItemDecoration(context, DividerItemDecoration.VERTICAL);
itemDecoration.setDrawable(ContextCompat.getDrawable(context, R.drawable.thin_divider));
transactionList.addItemDecoration(itemDecoration);
transactionList.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
@ -133,10 +136,7 @@ public class TransactionHistoryFragment extends BaseFragment implements Transact
activity.showNavigationBackIcon();
activity.lockDrawer();
ActionBar actionBar = activity.getSupportActionBar();
if (actionBar != null) {
actionBar.setTitle(R.string.transaction_history);
}
activity.setActionBarTitle(R.string.transaction_history);
}
}