Browse Source

init pm activity

pms
oogee 6 years ago
parent
commit
fd41917ec0
  1. 3
      app/build.gradle
  2. 1
      app/src/main/AndroidManifest.xml
  3. 63
      app/src/main/java/gr/thmmy/mthmmy/activities/create_pm/CreatePMActivity.java
  4. 2
      app/src/main/java/gr/thmmy/mthmmy/activities/create_topic/CreateTopicActivity.java
  5. 56
      app/src/main/res/layout/activity_create_pm.xml
  6. 0
      app/src/main/res/layout/activity_create_topic.xml

3
app/build.gradle

@ -89,7 +89,8 @@ dependencies {
implementation 'ru.noties:markwon:2.0.0'
implementation 'net.gotev:uploadservice:3.4.2'
implementation 'net.gotev:uploadservice-okhttp:3.4.2'
implementation 'com.itkacher.okhttpprofiler:okhttpprofiler:1.0.4' //Plugin: https://plugins.jetbrains.com/plugin/11249-okhttp-profiler
implementation 'com.itkacher.okhttpprofiler:okhttpprofiler:1.0.4'
//Plugin: https://plugins.jetbrains.com/plugin/11249-okhttp-profiler
}
apply plugin: 'com.google.gms.google-services'

1
app/src/main/AndroidManifest.xml

@ -173,6 +173,7 @@
android:name="android.support.PARENT_ACTIVITY"
android:value=".activities.main.MainActivity" />
</activity>
<activity android:name=".activities.create_pm.CreatePMActivity"></activity>
</application>
</manifest>

63
app/src/main/java/gr/thmmy/mthmmy/activities/create_pm/CreatePMActivity.java

@ -0,0 +1,63 @@
package gr.thmmy.mthmmy.activities.create_pm;
import android.os.Bundle;
import android.text.InputType;
import android.view.View;
import android.view.inputmethod.EditorInfo;
import com.google.android.material.textfield.TextInputLayout;
import gr.thmmy.mthmmy.R;
import gr.thmmy.mthmmy.base.BaseActivity;
import gr.thmmy.mthmmy.editorview.EditorView;
import gr.thmmy.mthmmy.editorview.EmojiKeyboard;
import me.zhanghai.android.materialprogressbar.MaterialProgressBar;
public class CreatePMActivity extends BaseActivity {
private MaterialProgressBar progressBar;
private EditorView contentEditor;
private TextInputLayout subjectInput;
private EmojiKeyboard emojiKeyboard;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_create_pm);
//Initialize toolbar
toolbar = findViewById(R.id.toolbar);
toolbar.setTitle("Create topic");
setSupportActionBar(toolbar);
if (getSupportActionBar() != null) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowHomeEnabled(true);
}
progressBar = findViewById(R.id.progressBar);
emojiKeyboard = findViewById(R.id.emoji_keyboard);
subjectInput = findViewById(R.id.subject_input);
subjectInput.getEditText().setRawInputType(InputType.TYPE_CLASS_TEXT);
subjectInput.getEditText().setImeOptions(EditorInfo.IME_ACTION_DONE);
contentEditor = findViewById(R.id.main_content_editorview);
contentEditor.setEmojiKeyboard(emojiKeyboard);
emojiKeyboard.registerEmojiInputField(contentEditor);
contentEditor.setOnSubmitListener(v -> {
// TODO: send pm
});
}
@Override
public void onBackPressed() {
if (emojiKeyboard.getVisibility() == View.VISIBLE) {
emojiKeyboard.setVisibility(View.GONE);
} else {
super.onBackPressed();
}
}
}

2
app/src/main/java/gr/thmmy/mthmmy/activities/create_topic/CreateTopicActivity.java

@ -33,7 +33,7 @@ public class CreateTopicActivity extends BaseActivity implements NewTopicTask.Ne
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_create_content);
setContentView(R.layout.activity_create_topic);
//Initialize toolbar
toolbar = findViewById(R.id.toolbar);

56
app/src/main/res/layout/activity_create_pm.xml

@ -0,0 +1,56 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout 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"
android:fitsSystemWindows="true"
tools:context=".activities.create_pm.CreatePMActivity">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/appbar_padding_top"
android:theme="@style/ToolbarTheme">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:gravity="center"
app:popupTheme="@style/ToolbarTheme"></androidx.appcompat.widget.Toolbar>
</com.google.android.material.appbar.AppBarLayout>
<include
layout="@layout/full_post_editor"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/appbar" />
<gr.thmmy.mthmmy.editorview.EmojiKeyboard
android:id="@+id/emoji_keyboard"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:visibility="gone" />
</RelativeLayout>
<me.zhanghai.android.materialprogressbar.MaterialProgressBar
android:id="@+id/progressBar"
style="@style/Widget.MaterialProgressBar.ProgressBar.Horizontal.NoPadding"
android:layout_width="match_parent"
android:layout_height="@dimen/progress_bar_height"
android:indeterminate="true"
android:visibility="invisible"
app:layout_anchor="@id/appbar"
app:layout_anchorGravity="bottom|center"
app:mpb_indeterminateTint="@color/accent"
app:mpb_progressStyle="horizontal" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>

0
app/src/main/res/layout/activity_create_content.xml → app/src/main/res/layout/activity_create_topic.xml

Loading…
Cancel
Save