Added an activity to add text to a file before sending it.

This commit is contained in:
Lyndon
2017-10-13 17:13:27 +02:00
parent 17c05dd087
commit 0eadfe18d7
15 changed files with 138 additions and 71 deletions

View File

@@ -96,7 +96,8 @@
android:name="com.google.firebase.messaging.default_notification_color"
android:resource="@color/colorDefault" />
<activity android:name=".page.chat.FileConfirmationActivity"></activity>
<activity android:name=".page.chat.FileConfirmationActivity" />
<activity android:name=".page.fileconfirmation.FileConfirmationActivity"></activity>
</application>
</manifest>

View File

@@ -318,9 +318,9 @@ abstract class BaseChatActivity extends RuntimePermissionActivity implements Cha
mChatPresenter.attachView(this);
}
// Show preview for images/gifs and maybe videos
// TODO: Show preview for images/gifs and maybe videos
mCallback.sendFile(uri);
//mCallback.sendFile(uri);
}
}

View File

@@ -63,8 +63,7 @@ import static com.p3.bewoplaner.utils.FileUtils.getFileTypeFromFilePath;
* Created by Rares Teodorescu on 21/02/2017.
*/
@ActivityScope
public class ChatPresenter extends MVPAbstractPresenter<ChatView>
implements ChatView.Callback {
public class ChatPresenter extends MVPAbstractPresenter<ChatView> implements ChatView.Callback {
private static final int FIRST_PAGE = 1;
private static final int GROUP_ID_NOT_SET = -999;

View File

@@ -0,0 +1,62 @@
package com.p3.bewoplaner.page.fileconfirmation;
import android.support.annotation.Nullable;
import android.support.annotation.StringRes;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import com.p3.bewoplaner.R;
import com.p3.bewoplaner.di.InjectionHelper;
import javax.inject.Inject;
public class FileConfirmationActivity extends AppCompatActivity implements FileConfirmationView {
@Inject
FileConfirmationPresenter mFileConfirmationPresenter;
private Callback mCallback;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_file_confirmation);
}
@Override
public void sendFileSuccessful() {
}
@Override
public void setCallback(Callback callback) {
mCallback = callback;
}
@Override
protected void onDestroy() {
InjectionHelper.destroyLoginComponent();
mFileConfirmationPresenter.detachView();
super.onDestroy();
}
@Override
public void showLoading() {
}
@Override
public void showContent() {
}
@Override
public void showError(@StringRes int messageRes) {
}
@Override
public void showError(String message) {
}
}

View File

@@ -12,5 +12,5 @@ import dagger.Component;
@ActivityScope
@Component(dependencies = ApplicationComponent.class, modules = FileConfirmationModule.class)
public interface FileConfirmationComponent {
void inject(FileConfirmationFragment fileConfirmationFragment);
void inject(FileConfirmationActivity fileConfirmationActivity);
}

View File

@@ -1,8 +0,0 @@
package com.p3.bewoplaner.page.fileconfirmation;
/**
* Created by Lyndon on 13-Oct-2017.
*/
public class FileConfirmationFragment {
}

View File

@@ -1,8 +1,22 @@
package com.p3.bewoplaner.page.fileconfirmation;
import com.p3.bewoplaner.data.api.services.ChatService;
import com.p3.bewoplaner.di.P3DSEndpoint;
import com.p3.bewoplaner.di.scopes.ActivityScope;
import dagger.Module;
import dagger.Provides;
import retrofit2.Retrofit;
/**
* Created by Lyndon on 13-Oct-2017.
*/
@Module
public class FileConfirmationModule {
@Provides
@ActivityScope
ChatService provideChatService(@P3DSEndpoint Retrofit retrofit) {
return retrofit.create(ChatService.class);
}
}

View File

@@ -1,8 +1,43 @@
package com.p3.bewoplaner.page.fileconfirmation;
import android.content.Context;
import android.net.Uri;
import android.support.annotation.NonNull;
import com.p3.bewoplaner.data.api.services.ChatService;
import com.p3.bewoplaner.page.mvp.MVPAbstractPresenter;
import javax.inject.Inject;
/**
* Created by Lyndon on 13-Oct-2017.
*/
public class FileConfirmationPresenter {
public class FileConfirmationPresenter extends MVPAbstractPresenter<FileConfirmationView> implements FileConfirmationView.Callback {
@Inject
ChatService mChatService;
@Inject
Context mContext;
@Inject
FileConfirmationPresenter() {}
@Override
protected void afterAttachView(@NonNull FileConfirmationView view) {
super.afterAttachView(view);
view.setCallback(this);
}
@Override
protected void beforeDetachView(@NonNull FileConfirmationView view) {
view.setCallback(null);
super.beforeDetachView(view);
}
@Override
public void sendFile(Uri fileUri) {
}
}

View File

@@ -1,15 +1,19 @@
package com.p3.bewoplaner.page.fileconfirmation;
import com.p3.bewoplaner.page.mvp.MVPView;
import android.net.Uri;
import com.p3.bewoplaner.page.mvp.MVPLceView;
/**
* Created by Lyndon on 13-Oct-2017.
*/
public interface FileConfirmationView extends MVPView {
public interface FileConfirmationView extends MVPLceView {
void sendFileSuccessful();
void setCallback(Callback callback);
interface Callback {
void sendFile();
void sendFile(Uri fileUri);
}
}

View File

@@ -170,6 +170,7 @@ public class MainActivity extends AppCompatActivity implements MainNavigation, L
private void switchFragment(@NonNull Fragment fragment, boolean clearBackStack) {
Fragment currentFragment = getSupportFragmentManager().findFragmentById(R.id.content_main);
if (fragment.getClass().isInstance(currentFragment)) {
return;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 549 KiB

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.p3.bewoplaner.page.fileconfirmation.FileConfirmationActivity">
</RelativeLayout>

View File

@@ -1,50 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:emojicon="http://schemas.android.com/apk/res-auto"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<WebView
android:id="@+id/media_presenter_webview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
</WebView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<hani.momanii.supernova_emoji_library.Helper.EmojiconEditText
android:id="@+id/file_message"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:maxHeight="100dp"
android:layout_weight="1"
android:background="@android:color/transparent"
android:hint="@string/chat_type_your_message"
android:paddingEnd="5dp"
android:paddingRight="5dp"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:scrollHorizontally="false"
android:scrollbars="vertical"
android:textColor="@color/colorBlack"
android:textColorHint="@color/colorManatee"
emojicon:emojiconSize="28sp"
tools:ignore="RtlSymmetry" />
<ImageView
android:id="@+id/chat_send_message"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:contentDescription="@null"
android:paddingEnd="16dp"
android:paddingRight="16dp"
android:src="@drawable/send"
tools:ignore="RtlSymmetry" />
</LinearLayout>
</LinearLayout>

View File

@@ -30,7 +30,7 @@
style="@style/AppTheme.ListTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="John Doe" />
tools:text="Sasha Grey" />
<hani.momanii.supernova_emoji_library.Helper.EmojiconTextView
android:id="@+id/contact_message_last"

View File

@@ -23,7 +23,7 @@
<style name="AppTheme.FullBackground" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowTranslucentStatus" tools:targetApi="kitkat">true</item>
<item name="android:windowBackground">@drawable/splash_one_size_fits_all</item>
<item name="android:windowBackground">@drawable/one_size_fits_all_2</item>
</style>
<!-- Login style -->
@@ -97,7 +97,7 @@
<style name="BaseChatItemText">
<item name="android:textSize">14sp</item>
<item name="android:autoLink">all</item>
<item name="android:textColorLink">#424242</item>
<item name="android:textColorLink">#666666</item>
</style>
<style name="RightChatItemRelativeLayout">