Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: create UI library module #118

Closed
wants to merge 15 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
13 changes: 3 additions & 10 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ android {

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation project(path: ':tinodesdk')
implementation project(path: ':tinui')

// Don't change to 1.4.0 (requires API 31).
// noinspection GradleDependency
Expand All @@ -74,18 +74,14 @@ dependencies {
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
// noinspection GradleDependency
implementation 'androidx.coordinatorlayout:coordinatorlayout:1.1.0'
// Don't change to 1.4.0 (requires API 31).
// noinspection GradleDependency
implementation 'androidx.fragment:fragment:1.3.1'
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
implementation 'androidx.exifinterface:exifinterface:1.3.3'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.legacy:legacy-support-v13:1.0.0'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
implementation 'androidx.preference:preference:1.1.1'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
implementation 'androidx.recyclerview:recyclerview:1.2.1'
implementation 'androidx.recyclerview:recyclerview-selection:1.1.0'
implementation 'androidx.vectordrawable:vectordrawable:1.1.0'
implementation 'androidx.viewpager2:viewpager2:1.0.0'
// Don't change to 2.7.0 (requires API 31).
// noinspection GradleDependency
implementation 'androidx.work:work-runtime:2.6.0'
Expand All @@ -98,8 +94,5 @@ dependencies {
implementation 'com.google.firebase:firebase-messaging:23.0.0'

// Don't change to 2.7182... The 2.8 is the latest.
// noinspection GradleDependency
implementation 'com.squareup.picasso:picasso:2.8'

annotationProcessor 'androidx.lifecycle:lifecycle-common-java8:2.4.0'
}
2 changes: 1 addition & 1 deletion app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# Add any project specific keep options here:

# Classes which define json wire protocol.
-keep class co.tinode.tinodesdk.model.** {*;}
-keep class co.tinode.tinsdk.model.** {*;}
-keepattributes *Annotation*,EnclosingMethod,Signature
-keepattributes SourceFile,LineNumberTable
-keepnames class com.fasterxml.jackson.** {*;}
Expand Down
11 changes: 4 additions & 7 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

<application
android:name=".TindroidApp"
android:icon="@mipmap/ic_launcher"
android:icon="@mipmap/tinui_ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme"
android:networkSecurityConfig="@xml/network_security_config"
Expand All @@ -57,7 +57,7 @@
<!-- Default icon for push notifications. -->
<meta-data
android:name="com.google.firebase.messaging.default_notification_icon"
android:resource="@drawable/ic_icon_push" />
android:resource="@drawable/tinui_ic_icon_push" />
<!-- Default color for push notifications. -->
<meta-data
android:name="com.google.firebase.messaging.default_notification_color"
Expand All @@ -73,10 +73,9 @@
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>

<activity
android:name=".LoginActivity"
android:label="@string/app_name"
android:launchMode="singleTask"
android:theme="@style/AppTheme"
android:exported="true">
Expand All @@ -95,7 +94,6 @@

<activity
android:name=".ChatsActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme"
android:windowSoftInputMode="adjustResize">

Expand All @@ -108,12 +106,11 @@

<activity
android:name=".MessageActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme"
android:windowSoftInputMode="adjustResize"
android:exported="true">

<intent-filter android:icon="@mipmap/ic_launcher" tools:ignore="AppLinkUrlError">
<intent-filter android:icon="@mipmap/tinui_ic_launcher" tools:ignore="AppLinkUrlError">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/java/co/tinode/tindroid/AboutDialogFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
import android.view.View;
import android.widget.TextView;

import java.util.Locale;

import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import androidx.fragment.app.DialogFragment;

import java.util.Locale;

/**
* About Dialog
*/
Expand All @@ -26,7 +26,7 @@ public Dialog onCreateDialog(Bundle savedInstanceState) {
}

AlertDialog.Builder builder = new AlertDialog.Builder(activity);
View dialog = View.inflate(activity, R.layout.dialog_about, null);
View dialog = View.inflate(activity, R.layout.tindroid_dialog_about, null);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no need for prefixes in the app. The prefixes should be used only in the libraries.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's right, I did this just to make the search/replace easier for me.
I'll remove the prefix once I have finish.

((TextView) dialog.findViewById(R.id.app_version)).setText(TindroidApp.getAppVersion());
((TextView) dialog.findViewById(R.id.app_build)).setText(String.format(Locale.US, "%d",
TindroidApp.getAppBuild()));
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/java/co/tinode/tindroid/AccAboutFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
import android.view.ViewGroup;
import android.widget.TextView;

import java.util.Locale;

import androidx.annotation.NonNull;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.fragment.app.Fragment;

import java.util.Locale;

/**
* Fragment for editing current user details.
*/
Expand All @@ -31,7 +31,7 @@ public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
return null;
}
// Inflate the fragment layout
View fragment = inflater.inflate(R.layout.dialog_about, container, false);
View fragment = inflater.inflate(R.layout.tindroid_dialog_about, container, false);
final ActionBar bar = activity.getSupportActionBar();
if (bar != null) {
bar.setDisplayHomeAsUpEnabled(true);
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/java/co/tinode/tindroid/AccHelpFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
import android.view.ViewGroup;
import android.widget.TextView;

import com.google.android.gms.oss.licenses.OssLicensesMenuActivity;

import androidx.annotation.NonNull;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.fragment.app.Fragment;

import com.google.android.gms.oss.licenses.OssLicensesMenuActivity;

/**
* Fragment for editing current user details.
*/
Expand All @@ -41,7 +41,7 @@ public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
return null;
}
// Inflate the fragment layout
View fragment = inflater.inflate(R.layout.fragment_acc_help, container, false);
View fragment = inflater.inflate(R.layout.tindroid_fragment_acc_help, container, false);
final ActionBar bar = activity.getSupportActionBar();
if (bar != null) {
bar.setDisplayHomeAsUpEnabled(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.preference.PreferenceManager;
import co.tinode.tindroid.media.VxCard;
import co.tinode.tinodesdk.MeTopic;
import co.tinode.tinodesdk.NotConnectedException;
import co.tinode.tinodesdk.PromisedReply;
import co.tinode.tinodesdk.model.ServerMessage;

import co.tinode.tinsdk.MeTopic;
import co.tinode.tinsdk.NotConnectedException;
import co.tinode.tinsdk.PromisedReply;
import co.tinode.tinsdk.model.ServerMessage;
import co.tinode.tinui.media.VxCard;

/**
* Fragment for editing current user details.
Expand All @@ -45,7 +46,7 @@ public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
return null;
}
// Inflate the fragment layout
View fragment = inflater.inflate(R.layout.fragment_acc_notifications, container, false);
View fragment = inflater.inflate(R.layout.tindroid_fragment_acc_notifications, container, false);
final ActionBar bar = activity.getSupportActionBar();
if (bar != null) {
bar.setDisplayHomeAsUpEnabled(true);
Expand Down
35 changes: 18 additions & 17 deletions app/src/main/java/co/tinode/tindroid/AccPersonalFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@
import android.widget.LinearLayout;
import android.widget.TextView;

import com.google.android.flexbox.FlexboxLayout;

import java.util.Map;

import androidx.activity.result.ActivityResultLauncher;
import androidx.activity.result.contract.ActivityResultContracts;
import androidx.annotation.NonNull;
Expand All @@ -29,12 +25,17 @@
import androidx.appcompat.widget.Toolbar;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import co.tinode.tindroid.media.VxCard;
import co.tinode.tinodesdk.MeTopic;
import co.tinode.tinodesdk.PromisedReply;
import co.tinode.tinodesdk.model.Credential;
import co.tinode.tinodesdk.model.MsgSetMeta;
import co.tinode.tinodesdk.model.ServerMessage;

import com.google.android.flexbox.FlexboxLayout;

import java.util.Map;

import co.tinode.tinsdk.MeTopic;
import co.tinode.tinsdk.PromisedReply;
import co.tinode.tinsdk.model.Credential;
import co.tinode.tinsdk.model.MsgSetMeta;
import co.tinode.tinsdk.model.ServerMessage;
import co.tinode.tinui.media.VxCard;

/**
* Fragment for editing current user details.
Expand Down Expand Up @@ -78,7 +79,7 @@ public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
return null;
}
// Inflate the fragment layout
View fragment = inflater.inflate(R.layout.fragment_acc_personal, container, false);
View fragment = inflater.inflate(R.layout.tindroid_fragment_acc_personal, container, false);
final ActionBar bar = activity.getSupportActionBar();
if (bar != null) {
bar.setDisplayHomeAsUpEnabled(true);
Expand Down Expand Up @@ -140,7 +141,7 @@ public void updateFormValues(final FragmentActivity activity, final MeTopic<VxCa
Credential[] creds = me.getCreds();
if (creds != null) {
for (Credential cred : creds) {
View container = inflater.inflate(R.layout.credential, credList, false);
View container = inflater.inflate(R.layout.tindroid_credential, credList, false);
((TextView) container.findViewById(R.id.method)).setText(cred.meth);
((TextView) container.findViewById(R.id.value)).setText(cred.val);
Button btn = container.findViewById(R.id.buttonConfirm);
Expand Down Expand Up @@ -179,7 +180,7 @@ public void updateFormValues(final FragmentActivity activity, final MeTopic<VxCa
String[] tags = me.getTags();
if (tags != null) {
for (String tag : tags) {
TextView label = (TextView) inflater.inflate(R.layout.tag, tagsView, false);
TextView label = (TextView) inflater.inflate(R.layout.tindroid_tag, tagsView, false);
label.setText(tag);
tagsView.addView(label);
label.requestLayout();
Expand All @@ -204,7 +205,7 @@ private void showEditTags() {
String tags = tagArray != null ? TextUtils.join(", ", tagArray) : "";

final AlertDialog.Builder builder = new AlertDialog.Builder(activity);
final View editor = LayoutInflater.from(builder.getContext()).inflate(R.layout.dialog_edit_tags, null);
final View editor = LayoutInflater.from(builder.getContext()).inflate(R.layout.tindroid_dialog_edit_tags, null);
builder.setView(editor).setTitle(R.string.tags_management);

final EditText tagsEditor = editor.findViewById(R.id.editTags);
Expand All @@ -228,7 +229,7 @@ private void showConfirmCredential(final String meth, final String val) {
}

final AlertDialog.Builder builder = new AlertDialog.Builder(activity);
final View editor = LayoutInflater.from(builder.getContext()).inflate(R.layout.dialog_validate, null);
final View editor = LayoutInflater.from(builder.getContext()).inflate(R.layout.tindroid_dialog_validate, null);
builder.setView(editor).setTitle(R.string.validate_cred_title)
.setMessage(getString(R.string.validate_cred, meth))
// FIXME: check for empty input and refuse to dismiss the dialog.
Expand Down Expand Up @@ -273,7 +274,7 @@ private void showAddCredential() {
return;
}

final View editor = LayoutInflater.from(activity).inflate(R.layout.dialog_add_credential, null);
final View editor = LayoutInflater.from(activity).inflate(R.layout.tindroid_dialog_add_credential, null);
final AlertDialog dialog = new AlertDialog.Builder(activity)
.setView(editor).setTitle(R.string.add_credential_title)
.setPositiveButton(android.R.string.ok, null)
Expand Down Expand Up @@ -315,7 +316,7 @@ public void showAvatarPreview(final Bundle args) {

@Override
public void onCreateOptionsMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) {
inflater.inflate(R.menu.menu_save, menu);
inflater.inflate(R.menu.tindroid_menu_save, menu);
super.onCreateOptionsMenu(menu, inflater);
}

Expand Down
15 changes: 8 additions & 7 deletions app/src/main/java/co/tinode/tindroid/AccSecurityFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
import android.widget.TextView;
import android.widget.Toast;

import java.util.concurrent.atomic.AtomicInteger;

import androidx.annotation.NonNull;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AlertDialog;
Expand All @@ -23,9 +21,12 @@
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.preference.PreferenceManager;
import co.tinode.tindroid.media.VxCard;
import co.tinode.tinodesdk.MeTopic;
import co.tinode.tinodesdk.NotConnectedException;

import java.util.concurrent.atomic.AtomicInteger;

import co.tinode.tinsdk.MeTopic;
import co.tinode.tinsdk.NotConnectedException;
import co.tinode.tinui.media.VxCard;

/**
* Fragment for editing current user details.
Expand All @@ -46,7 +47,7 @@ public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
return null;
}
// Inflate the fragment layout
View fragment = inflater.inflate(R.layout.fragment_acc_security, container, false);
View fragment = inflater.inflate(R.layout.tindroid_fragment_acc_security, container, false);
final ActionBar bar = activity.getSupportActionBar();
if (bar != null) {
bar.setDisplayHomeAsUpEnabled(true);
Expand Down Expand Up @@ -96,7 +97,7 @@ public void onResume() {
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
builder
.setTitle(R.string.change_password)
.setView(R.layout.dialog_password)
.setView(R.layout.tindroid_dialog_password)
.setCancelable(true)
.setPositiveButton(android.R.string.ok, (dialog, which) -> {
TextView editor = ((AlertDialog) dialog).findViewById(R.id.enterPassword);
Expand Down
9 changes: 5 additions & 4 deletions app/src/main/java/co/tinode/tindroid/AccountInfoFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@
import androidx.appcompat.widget.Toolbar;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import co.tinode.tindroid.media.VxCard;
import co.tinode.tinodesdk.MeTopic;

import co.tinode.tinsdk.MeTopic;
import co.tinode.tinui.media.VxCard;

/**
* Fragment for editing current user details.
Expand All @@ -38,7 +39,7 @@ public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
return null;
}
// Inflate the fragment layout
View fragment = inflater.inflate(R.layout.fragment_account_info, container, false);
View fragment = inflater.inflate(R.layout.tindroid_fragment_account_info, container, false);
final ActionBar bar = activity.getSupportActionBar();
if (bar != null) {
bar.setDisplayHomeAsUpEnabled(true);
Expand Down Expand Up @@ -117,7 +118,7 @@ public void updateFormValues(final FragmentActivity activity, final MeTopic<VxCa
@Override
public void onCreateOptionsMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) {
// Inflate the menu; this adds items to the action bar if it is present.
inflater.inflate(R.menu.menu_edit, menu);
inflater.inflate(R.menu.tindroid_menu_edit, menu);
super.onCreateOptionsMenu(menu, inflater);
}

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/co/tinode/tindroid/AddByIDFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class AddByIDFragment extends Fragment {
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_add_by_id, container, false);
return inflater.inflate(R.layout.tindroid_fragment_add_by_id, container, false);
}

@Override
Expand Down
Loading