Removed the test project
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -5,3 +5,4 @@
|
||||
/PrototypChat/obj/Debug
|
||||
/PrototypChat/obj/Release
|
||||
/publish
|
||||
/BeWoPlanerChat/MyTestApplication
|
||||
|
||||
Binary file not shown.
@@ -96,7 +96,6 @@
|
||||
android:name="com.google.firebase.messaging.default_notification_color"
|
||||
android:resource="@color/colorDefault" />
|
||||
|
||||
<activity android:name=".page.chat.FileConfirmationActivity" />
|
||||
<activity android:name=".page.fileconfirmation.FileConfirmationActivity"></activity>
|
||||
</application>
|
||||
|
||||
|
||||
@@ -10,8 +10,10 @@ import com.p3.bewoplaner.di.InjectionHelper;
|
||||
import com.p3.bewoplaner.model.Group;
|
||||
import com.p3.bewoplaner.model.Message;
|
||||
import com.p3.bewoplaner.page.common.RuntimePermissionActivity;
|
||||
import com.p3.bewoplaner.page.fileconfirmation.FileConfirmationActivity;
|
||||
import com.p3.bewoplaner.page.login.LoginPresenter;
|
||||
import com.p3.bewoplaner.page.main.LogoutNavigation;
|
||||
import com.p3.bewoplaner.utils.Constants;
|
||||
import com.p3.bewoplaner.utils.EndlessScrollListener;
|
||||
import com.p3.bewoplaner.utils.FileUtils;
|
||||
import com.p3.bewoplaner.utils.SystemUtils;
|
||||
@@ -320,6 +322,14 @@ abstract class BaseChatActivity extends RuntimePermissionActivity implements Cha
|
||||
|
||||
// TODO: Show preview for images/gifs and maybe videos
|
||||
|
||||
/*Bundle bundle = new Bundle();
|
||||
bundle.putString(Constants.FILENAME, uri.toString());
|
||||
|
||||
Intent intent = new Intent(this, FileConfirmationActivity.class);
|
||||
intent.putExtras(bundle);
|
||||
|
||||
startActivityForResult(intent, 666);*/
|
||||
|
||||
mCallback.sendFile(uri);
|
||||
}
|
||||
}
|
||||
@@ -364,6 +374,7 @@ abstract class BaseChatActivity extends RuntimePermissionActivity implements Cha
|
||||
if (!mChatPresenter.isAttached()) {
|
||||
mChatPresenter.attachView(this);
|
||||
}
|
||||
|
||||
mCallback.resendMessage(message);
|
||||
}
|
||||
|
||||
|
||||
@@ -382,10 +382,12 @@ public class ChatPresenter extends MVPAbstractPresenter<ChatView> implements Cha
|
||||
@Override
|
||||
public void sendFile(Uri fileUri) {
|
||||
File file = getView().getFile(fileUri);
|
||||
|
||||
if (file == null || !file.exists()) {
|
||||
getView().showToastMessage(R.string.error_file_not_found);
|
||||
return;
|
||||
}
|
||||
|
||||
String[] split = file.getAbsolutePath().split("/");
|
||||
|
||||
Message message = new Message(findUniqueRandomId(mRealmProvider, mUserIdPreference.get()),
|
||||
@@ -404,8 +406,7 @@ public class ChatPresenter extends MVPAbstractPresenter<ChatView> implements Cha
|
||||
mUserIdPreference.get(),
|
||||
false);
|
||||
|
||||
storeMessageLocally(message)
|
||||
.subscribe(new Subscriber<Object>() {
|
||||
storeMessageLocally(message).subscribe(new Subscriber<Object>() {
|
||||
@Override
|
||||
public void onCompleted() {
|
||||
if (mSystemUtils.isNetworkUnavailable()) {
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package com.p3.bewoplaner.page.fileconfirmation;
|
||||
|
||||
import android.database.Cursor;
|
||||
import android.net.Uri;
|
||||
import android.provider.MediaStore;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.annotation.StringRes;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
@@ -9,10 +12,15 @@ import android.widget.ImageView;
|
||||
|
||||
import com.p3.bewoplaner.R;
|
||||
import com.p3.bewoplaner.di.InjectionHelper;
|
||||
import com.p3.bewoplaner.utils.Constants;
|
||||
import com.p3.bewoplaner.utils.FileUtils;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import hani.momanii.supernova_emoji_library.Helper.EmojiconEditText;
|
||||
|
||||
public class FileConfirmationActivity extends AppCompatActivity implements FileConfirmationView {
|
||||
@@ -39,6 +47,38 @@ public class FileConfirmationActivity extends AppCompatActivity implements FileC
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_file_confirmation);
|
||||
|
||||
InjectionHelper.getFileConfirmationComponent(this).inject(this);
|
||||
ButterKnife.bind(this);
|
||||
mFileConfirmationPresenter.attachView(this);
|
||||
|
||||
String fileUri = getIntent().getStringExtra(Constants.FILENAME);
|
||||
|
||||
File file = getFile(Uri.parse(fileUri));
|
||||
String absolutePath = file.getAbsolutePath();
|
||||
|
||||
String html = "<html><head></head><body><img src=\""+ absolutePath + "\"></body></html>";
|
||||
try {
|
||||
mFileWebView.loadDataWithBaseURL("", html, "text/html", "utf-8", null);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private String getPath(Uri uri) {
|
||||
String[] projection = {MediaStore.Images.Media.DATA};
|
||||
Cursor cursor = getContentResolver().query(uri, projection, null, null, null);
|
||||
|
||||
if(cursor == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
int columnIndex = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
|
||||
cursor.moveToFirst();
|
||||
String path = cursor.getString(columnIndex);
|
||||
cursor.close();
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -77,4 +117,8 @@ public class FileConfirmationActivity extends AppCompatActivity implements FileC
|
||||
public void showError(String message) {
|
||||
|
||||
}
|
||||
|
||||
public File getFile(Uri fileUri) {
|
||||
return FileUtils.getFile(this, fileUri);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ package com.p3.bewoplaner.utils;
|
||||
*/
|
||||
public interface Constants {
|
||||
String BEWOPLANER_ENDPOINT = "https://www.p3ds.net/bewoplaner/public/";
|
||||
String VOUCHER_ENDPOINT = "https://bewoplaner.beyondsoft.de/";
|
||||
int DISK_CACHE_SIZE = 10 * 1024;
|
||||
String GROUP_NR_USERS = "group_nb_users";
|
||||
String GROUP_ID = "groupid";
|
||||
|
||||
@@ -560,7 +560,7 @@ public class FileUtils {
|
||||
} else {
|
||||
extension = "*/*";
|
||||
}
|
||||
|
||||
return extension;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,7 +10,7 @@
|
||||
<WebView
|
||||
android:id="@+id/media_file_webview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="match_parent">
|
||||
|
||||
</WebView>
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:background="@color/colorPrimary"
|
||||
app:layout_behavior="com.p3.bewoplaner.utils.ui.LinearLayoutBehavior">
|
||||
|
||||
<ImageView
|
||||
|
||||
@@ -20,10 +20,6 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/chat_item_sending_failed"
|
||||
android:layout_width="wrap_content"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="colorPrimary">#FFFFFF</color>
|
||||
<color name="colorPrimary">#ffffff</color>
|
||||
<color name="colorPrimaryDark">#E0E0E0</color>
|
||||
<color name="colorAccent">#FFFFFF</color>
|
||||
<color name="colorBackground">#F3F3F3</color>
|
||||
|
||||
Reference in New Issue
Block a user