Refactoring

pull/162/head
M66B 6 years ago
parent a89032373a
commit 3dff252b37

@ -90,11 +90,11 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
private ActionBarDrawerToggle drawerToggle;
private ScrollView drawerContainer;
private RecyclerView rvAccount;
private ImageButton ivExpanderUnified;
private ImageButton ibExpanderUnified;
private RecyclerView rvUnified;
private RecyclerView rvFolder;
private RecyclerView rvMenu;
private ImageButton ivExpanderExtra;
private ImageButton ibExpanderExtra;
private RecyclerView rvMenuExtra;
private Group grpUnified;
@ -164,8 +164,8 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
rvAccount.setAdapter(aadapter);
// Unified system folders
ivExpanderUnified = drawerContainer.findViewById(R.id.ivExpanderUnified);
ivExpanderUnified.setVisibility(View.GONE);
ibExpanderUnified = drawerContainer.findViewById(R.id.ibExpanderUnified);
ibExpanderUnified.setVisibility(View.GONE);
grpUnified = drawerContainer.findViewById(R.id.grpUnified);
grpUnified.setVisibility(View.GONE);
@ -176,15 +176,15 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
rvUnified.setAdapter(uadapter);
boolean unified_system = prefs.getBoolean("unified_system", false);
ivExpanderUnified.setImageLevel(unified_system ? 0 /* less */ : 1 /* more */);
ibExpanderUnified.setImageLevel(unified_system ? 0 /* less */ : 1 /* more */);
grpUnified.setVisibility(unified_system ? View.VISIBLE : View.GONE);
ivExpanderUnified.setOnClickListener(new View.OnClickListener() {
ibExpanderUnified.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
boolean unified_system = !prefs.getBoolean("unified_system", false);
prefs.edit().putBoolean("unified_system", unified_system).apply();
ivExpanderUnified.setImageLevel(unified_system ? 0 /* less */ : 1 /* more */);
ibExpanderUnified.setImageLevel(unified_system ? 0 /* less */ : 1 /* more */);
grpUnified.setVisibility(unified_system ? View.VISIBLE : View.GONE);
}
});
@ -201,7 +201,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
rvMenu.setAdapter(madapter);
// Extra menus
ivExpanderExtra = drawerContainer.findViewById(R.id.ivExpanderExtra);
ibExpanderExtra = drawerContainer.findViewById(R.id.ibExpanderExtra);
rvMenuExtra = drawerContainer.findViewById(R.id.rvMenuExtra);
LinearLayoutManager llm = new LinearLayoutManager(this);
@ -222,15 +222,15 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
rvMenuExtra.addItemDecoration(itemDecorator);
boolean minimal = prefs.getBoolean("minimal", false);
ivExpanderExtra.setImageLevel(minimal ? 1 /* more */ : 0 /* less */);
ibExpanderExtra.setImageLevel(minimal ? 1 /* more */ : 0 /* less */);
rvMenuExtra.setVisibility(minimal ? View.GONE : View.VISIBLE);
ivExpanderExtra.setOnClickListener(new View.OnClickListener() {
ibExpanderExtra.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
boolean minimal = !prefs.getBoolean("minimal", false);
prefs.edit().putBoolean("minimal", minimal).apply();
ivExpanderExtra.setImageLevel(minimal ? 1 /* more */ : 0 /* less */);
ibExpanderExtra.setImageLevel(minimal ? 1 /* more */ : 0 /* less */);
rvMenuExtra.setVisibility(minimal ? View.GONE : View.VISIBLE);
if (!minimal)
new Handler().post(new Runnable() {
@ -399,7 +399,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
public void onChanged(List<EntityFolderUnified> folders) {
if (folders == null)
folders = new ArrayList<>();
ivExpanderUnified.setVisibility(folders.size() > 0 ? View.VISIBLE : View.GONE);
ibExpanderUnified.setVisibility(folders.size() > 0 ? View.VISIBLE : View.GONE);
boolean unified_system = prefs.getBoolean("unified_system", false);
grpUnified.setVisibility(unified_system && folders.size() > 0 ? View.VISIBLE : View.GONE);
uadapter.set(folders);

@ -97,7 +97,7 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
private ImageView ivReadOnly;
private View vwLevel;
private ImageButton ivExpander;
private ImageButton ibExpander;
private ImageView ivUnified;
private ImageView ivSubscribed;
@ -129,7 +129,7 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
ivReadOnly = itemView.findViewById(R.id.ivReadOnly);
vwLevel = itemView.findViewById(R.id.vwLevel);
ivExpander = itemView.findViewById(R.id.ivExpander);
ibExpander = itemView.findViewById(R.id.ibExpander);
ivUnified = itemView.findViewById(R.id.ivUnified);
ivSubscribed = itemView.findViewById(R.id.ivSubscribed);
@ -152,7 +152,7 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
private void wire() {
view.setOnClickListener(this);
ivExpander.setOnClickListener(this);
ibExpander.setOnClickListener(this);
if (listener == null)
view.setOnLongClickListener(this);
if (btnHelp != null)
@ -161,7 +161,7 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
private void unwire() {
view.setOnClickListener(null);
ivExpander.setOnClickListener(null);
ibExpander.setOnClickListener(null);
if (listener == null)
view.setOnLongClickListener(null);
if (btnHelp != null)
@ -215,8 +215,8 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
lp.width = (account < 0 ? 1 : folder.indentation) * dp12;
vwLevel.setLayoutParams(lp);
ivExpander.setImageLevel(folder.collapsed ? 1 /* more */ : 0 /* less */);
ivExpander.setVisibility(account < 0 || !folder.expander
ibExpander.setImageLevel(folder.collapsed ? 1 /* more */ : 0 /* less */);
ibExpander.setVisibility(account < 0 || !folder.expander
? View.GONE
: folder.child_refs != null && folder.child_refs.size() > 0
? View.VISIBLE : View.INVISIBLE);
@ -308,7 +308,7 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
if (folder.tbd != null)
return;
if (view.getId() == R.id.ivExpander)
if (view.getId() == R.id.ibExpander)
onCollapse(folder);
else if (folder.selectable) {
if (listener == null) {

@ -261,7 +261,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
private View vsBody;
private ImageButton ivExpanderAddress;
private ImageButton ibExpanderAddress;
private ImageButton ibSearchContact;
private ImageButton ibNotifyContact;
@ -345,7 +345,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
view = itemView.findViewById(R.id.clItem);
vwColor = itemView.findViewById(R.id.vwColor);
ivExpander = itemView.findViewById(R.id.ivExpander);
ivExpander = itemView.findViewById(R.id.ibExpander);
ivFlagged = itemView.findViewById(R.id.ivFlagged);
ivAvatar = itemView.findViewById(R.id.ivAvatar);
tvFrom = itemView.findViewById(subject_top ? R.id.tvSubject : R.id.tvFrom);
@ -380,7 +380,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
inAttachmentsAlt.setVisibility(attachments_alt ? View.VISIBLE : View.GONE);
ConstraintLayout attachments = (attachments_alt ? inAttachmentsAlt : inAttachments);
ivExpanderAddress = vsBody.findViewById(R.id.ivExpanderAddress);
ibExpanderAddress = vsBody.findViewById(R.id.ibExpanderAddress);
ibSearchContact = vsBody.findViewById(R.id.ibSearchContact);
ibNotifyContact = vsBody.findViewById(R.id.ibNotifyContact);
@ -501,7 +501,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
ivFlagged.setOnLongClickListener(this);
if (vsBody != null) {
ivExpanderAddress.setOnClickListener(this);
ibExpanderAddress.setOnClickListener(this);
ibSearchContact.setOnClickListener(this);
ibNotifyContact.setOnClickListener(this);
ibAddContact.setOnClickListener(this);
@ -550,7 +550,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
ivFlagged.setOnLongClickListener(null);
if (vsBody != null) {
ivExpanderAddress.setOnClickListener(null);
ibExpanderAddress.setOnClickListener(null);
ibSearchContact.setOnClickListener(null);
ibNotifyContact.setOnClickListener(null);
ibAddContact.setOnClickListener(null);
@ -986,7 +986,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
tvBody.setVisibility(View.INVISIBLE);
// Addresses
ivExpanderAddress.setImageLevel(show_addresses ? 0 /* less */ : 1 /* more */);
ibExpanderAddress.setImageLevel(show_addresses ? 0 /* less */ : 1 /* more */);
String from = MessageHelper.formatAddresses(message.senders);
String to = MessageHelper.formatAddresses(message.to);
@ -1478,7 +1478,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
onAddContact(message);
else if (viewType == ViewType.THREAD) {
switch (view.getId()) {
case R.id.ivExpanderAddress:
case R.id.ibExpanderAddress:
onToggleAddresses(message);
break;

@ -14,7 +14,7 @@
app:layout_constraintTop_toTopOf="parent" />
<ImageButton
android:id="@+id/ivExpanderAddress"
android:id="@+id/ibExpanderAddress"
android:layout_width="0dp"
android:layout_height="24dp"
android:background="?android:attr/selectableItemBackground"
@ -32,7 +32,7 @@
android:layout_marginEnd="12dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
app:layout_constraintEnd_toStartOf="@+id/ibNotifyContact"
app:layout_constraintTop_toBottomOf="@id/ivExpanderAddress"
app:layout_constraintTop_toBottomOf="@id/ibExpanderAddress"
app:srcCompat="@drawable/baseline_search_24" />
<ImageButton
@ -43,7 +43,7 @@
android:background="?android:attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/title_legend_notify"
app:layout_constraintEnd_toStartOf="@+id/ibAddContact"
app:layout_constraintTop_toBottomOf="@id/ivExpanderAddress"
app:layout_constraintTop_toBottomOf="@id/ibExpanderAddress"
app:srcCompat="@drawable/baseline_notifications_24" />
<ImageButton
@ -54,7 +54,7 @@
android:background="?android:attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/title_legend_contacts"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/ivExpanderAddress"
app:layout_constraintTop_toBottomOf="@id/ibExpanderAddress"
app:srcCompat="@drawable/baseline_import_contacts_24" />
<androidx.constraintlayout.widget.Barrier
@ -310,5 +310,5 @@
android:id="@+id/grpAddresses"
android:layout_width="0dp"
android:layout_height="0dp"
app:constraint_referenced_ids="vSeparatorAddress,ivExpanderAddress" />
app:constraint_referenced_ids="vSeparatorAddress,@+id/ibExpanderAddress" />
</androidx.constraintlayout.widget.ConstraintLayout>

@ -23,7 +23,7 @@
app:layout_constraintTop_toTopOf="parent" />
<ImageButton
android:id="@+id/ivExpander"
android:id="@+id/ibExpander"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal"
@ -41,7 +41,7 @@
android:layout_width="6dp"
android:layout_height="0dp"
android:visibility="gone"
app:layout_constraintStart_toEndOf="@+id/ivExpander"
app:layout_constraintStart_toEndOf="@+id/ibExpander"
app:layout_constraintTop_toTopOf="parent" />
<ImageView

@ -21,7 +21,7 @@
app:layout_constraintTop_toTopOf="parent" />
<ImageButton
android:id="@+id/ivExpander"
android:id="@+id/ibExpander"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal"
@ -39,7 +39,7 @@
android:layout_width="6dp"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="@+id/paddingBottom"
app:layout_constraintStart_toEndOf="@+id/ivExpander"
app:layout_constraintStart_toEndOf="@+id/ibExpander"
app:layout_constraintTop_toTopOf="parent" />
<ImageView

@ -21,7 +21,7 @@
app:layout_constraintTop_toBottomOf="@id/rvAccount" />
<ImageButton
android:id="@+id/ivExpanderUnified"
android:id="@+id/ibExpanderUnified"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:attr/selectableItemBackground"
@ -36,7 +36,7 @@
android:layout_height="wrap_content"
android:nestedScrollingEnabled="false"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/ivExpanderUnified" />
app:layout_constraintTop_toBottomOf="@id/ibExpanderUnified" />
<View
android:id="@+id/vSeparatorUnified"
@ -79,7 +79,7 @@
app:layout_constraintTop_toBottomOf="@id/rvMenu" />
<ImageButton
android:id="@+id/ivExpanderExtra"
android:id="@+id/ibExpanderExtra"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:attr/selectableItemBackground"
@ -94,7 +94,7 @@
android:layout_height="wrap_content"
android:nestedScrollingEnabled="false"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/ivExpanderExtra" />
app:layout_constraintTop_toBottomOf="@id/ibExpanderExtra" />
<androidx.constraintlayout.widget.Group
android:id="@+id/grpUnified"

@ -54,7 +54,7 @@
app:layout_constraintTop_toTopOf="parent" />
<ImageButton
android:id="@+id/ivExpander"
android:id="@+id/ibExpander"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_gravity="center_vertical|center_horizontal"
@ -74,7 +74,7 @@
android:contentDescription="@string/title_unified_folder"
android:paddingEnd="6dp"
app:layout_constraintBottom_toBottomOf="@+id/tvName"
app:layout_constraintStart_toEndOf="@id/ivExpander"
app:layout_constraintStart_toEndOf="@id/ibExpander"
app:layout_constraintTop_toTopOf="@+id/tvName"
app:srcCompat="@drawable/baseline_folder_special_24" />
@ -157,7 +157,7 @@
android:contentDescription="@string/title_legend_folder_type"
android:paddingEnd="6dp"
app:layout_constraintBottom_toBottomOf="@+id/tvType"
app:layout_constraintStart_toEndOf="@id/ivExpander"
app:layout_constraintStart_toEndOf="@id/ibExpander"
app:layout_constraintTop_toTopOf="@+id/tvType"
app:srcCompat="@drawable/baseline_inbox_24" />
@ -224,7 +224,7 @@
android:text="Keywords"
android:textAppearance="@android:style/TextAppearance.Small"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/ivExpander"
app:layout_constraintStart_toEndOf="@id/ibExpander"
app:layout_constraintTop_toBottomOf="@id/tvType" />
<TextView
@ -238,7 +238,7 @@
android:textColor="?attr/colorWarning"
android:textIsSelectable="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/ivExpander"
app:layout_constraintStart_toEndOf="@id/ibExpander"
app:layout_constraintTop_toBottomOf="@id/tvKeywords" />
<Button

@ -20,7 +20,7 @@
app:layout_constraintTop_toTopOf="parent" />
<ImageButton
android:id="@+id/ivExpander"
android:id="@+id/ibExpander"
android:layout_width="36dp"
android:layout_height="0dp"
android:layout_gravity="center_vertical|center_horizontal"
@ -37,9 +37,9 @@
android:layout_width="24dp"
android:layout_height="24dp"
android:contentDescription="@string/title_legend_folder_type"
app:layout_constraintBottom_toBottomOf="@id/ivExpander"
app:layout_constraintStart_toEndOf="@id/ivExpander"
app:layout_constraintTop_toTopOf="@id/ivExpander"
app:layout_constraintBottom_toBottomOf="@id/ibExpander"
app:layout_constraintStart_toEndOf="@id/ibExpander"
app:layout_constraintTop_toTopOf="@id/ibExpander"
app:srcCompat="@drawable/baseline_inbox_24" />
<TextView
@ -53,9 +53,9 @@
android:singleLine="true"
android:text="Name"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
app:layout_constraintBottom_toBottomOf="@id/ivExpander"
app:layout_constraintBottom_toBottomOf="@id/ibExpander"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/ivType"
app:layout_constraintTop_toTopOf="@id/ivExpander" />
app:layout_constraintTop_toTopOf="@id/ibExpander" />
</androidx.constraintlayout.widget.ConstraintLayout>
</FrameLayout>

@ -43,7 +43,7 @@
app:layout_constraintTop_toTopOf="parent" />
<ImageButton
android:id="@+id/ivExpander"
android:id="@+id/ibExpander"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_gravity="center_vertical|center_horizontal"
@ -70,7 +70,7 @@
android:text="Name"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/ivExpander"
app:layout_constraintStart_toEndOf="@id/ibExpander"
app:layout_constraintTop_toTopOf="parent" />
<View

Loading…
Cancel
Save