Browse Source

inbox activity init, up gradle plugin

pms
oogee 6 years ago
parent
commit
ace845f55b
  1. 10
      app/src/main/AndroidManifest.xml
  2. 27
      app/src/main/java/gr/thmmy/mthmmy/activities/inbox/InboxActivity.java
  3. 26
      app/src/main/java/gr/thmmy/mthmmy/base/BaseActivity.java
  4. 5
      app/src/main/res/drawable/ic_message_white_24dp.xml
  5. 25
      app/src/main/res/layout/activity_inbox.xml
  6. 3
      app/src/main/res/values/strings.xml
  7. 2
      build.gradle
  8. 4
      gradle/wrapper/gradle-wrapper.properties

10
app/src/main/AndroidManifest.xml

@ -17,6 +17,7 @@
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<meta-data
android:name="firebase_crashlytics_collection_enabled"
android:value="false" />
@ -173,9 +174,16 @@
android:name="android.support.PARENT_ACTIVITY"
android:value=".activities.main.MainActivity" />
</activity>
<activity android:name=".activities.create_pm.CreatePMActivity"
<activity
android:name=".activities.create_pm.CreatePMActivity"
android:configChanges="orientation|screenSize"
android:theme="@style/AppTheme.NoActionBar" />
<activity android:name=".activities.inbox.InboxActivity"
android:theme="@style/AppTheme.NoActionBar" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".activities.main.MainActivity" />
</activity>
</application>
</manifest>

27
app/src/main/java/gr/thmmy/mthmmy/activities/inbox/InboxActivity.java

@ -0,0 +1,27 @@
package gr.thmmy.mthmmy.activities.inbox;
import android.os.Bundle;
import gr.thmmy.mthmmy.R;
import gr.thmmy.mthmmy.base.BaseActivity;
public class InboxActivity extends BaseActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_inbox);
//Initialize toolbar
toolbar = findViewById(R.id.toolbar);
toolbar.setTitle("Inbox");
setSupportActionBar(toolbar);
if (getSupportActionBar() != null) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowHomeEnabled(true);
}
createDrawer();
drawer.setSelection(INBOX_ID);
}
}

26
app/src/main/java/gr/thmmy/mthmmy/base/BaseActivity.java

@ -48,6 +48,7 @@ import gr.thmmy.mthmmy.activities.AboutActivity;
import gr.thmmy.mthmmy.activities.LoginActivity;
import gr.thmmy.mthmmy.activities.bookmarks.BookmarksActivity;
import gr.thmmy.mthmmy.activities.downloads.DownloadsActivity;
import gr.thmmy.mthmmy.activities.inbox.InboxActivity;
import gr.thmmy.mthmmy.activities.main.MainActivity;
import gr.thmmy.mthmmy.activities.profile.ProfileActivity;
import gr.thmmy.mthmmy.activities.settings.SettingsActivity;
@ -161,6 +162,7 @@ public abstract class BaseActivity extends AppCompatActivity {
protected static final int ABOUT_ID = 5;
protected static final int SETTINGS_ID = 6;
protected static final int SHOUTBOX_ID = 7;
protected static final int INBOX_ID = 8;
private AccountHeader accountHeader;
private ProfileDrawerItem profileDrawerItem;
@ -175,8 +177,9 @@ public abstract class BaseActivity extends AppCompatActivity {
final int selectedPrimaryColor = ContextCompat.getColor(this, R.color.primary_dark);
final int selectedSecondaryColor = ContextCompat.getColor(this, R.color.accent);
PrimaryDrawerItem homeItem, bookmarksItem, settingsItem, aboutItem, shoutboxItem;
IconicsDrawable homeIcon, homeIconSelected, downloadsIcon, downloadsIconSelected, uploadIcon, uploadIconSelected, settingsIcon,
PrimaryDrawerItem homeItem, bookmarksItem, settingsItem, aboutItem, shoutboxItem, inboxItem;
IconicsDrawable homeIcon, homeIconSelected, downloadsIcon, downloadsIconSelected, uploadIcon,
uploadIconSelected, settingsIcon,
settingsIconSelected, bookmarksIcon, bookmarksIconSelected, aboutIcon, aboutIconSelected;
//Drawer Icons
@ -274,6 +277,18 @@ public abstract class BaseActivity extends AppCompatActivity {
.withSelectedIconColor(selectedSecondaryColor)
.withIconTintingEnabled(true);
inboxItem = new PrimaryDrawerItem()
.withTextColor(primaryColor)
.withSelectedColor(selectedPrimaryColor)
.withSelectedTextColor(selectedSecondaryColor)
.withIdentifier(INBOX_ID)
.withName(R.string.inbox)
.withIcon(R.drawable.ic_message_white_24dp)
.withIconColor(primaryColor)
.withSelectedIconColor(selectedSecondaryColor)
.withIconTintingEnabled(true);
if (sessionManager.isLoggedIn()) //When logged in
{
loginLogoutItem = new PrimaryDrawerItem()
@ -368,6 +383,11 @@ public abstract class BaseActivity extends AppCompatActivity {
Intent intent = new Intent(BaseActivity.this, ShoutboxActivity.class);
startActivity(intent);
}
} else if (drawerItem.equals(INBOX_ID)) {
if (!(BaseActivity.this instanceof InboxActivity)) {
Intent intent = new Intent(BaseActivity.this, InboxActivity.class);
startActivity(intent);
}
} else if (drawerItem.equals(DOWNLOADS_ID)) {
if (!(BaseActivity.this instanceof DownloadsActivity)) {
Intent intent = new Intent(BaseActivity.this, DownloadsActivity.class);
@ -412,7 +432,7 @@ public abstract class BaseActivity extends AppCompatActivity {
});
if (sessionManager.isLoggedIn())
drawerBuilder.addDrawerItems(homeItem, bookmarksItem, shoutboxItem, downloadsItem, settingsItem, loginLogoutItem, aboutItem);
drawerBuilder.addDrawerItems(homeItem, bookmarksItem, shoutboxItem, inboxItem, downloadsItem, settingsItem, loginLogoutItem, aboutItem);
else
drawerBuilder.addDrawerItems(homeItem, bookmarksItem, shoutboxItem, settingsItem, loginLogoutItem, aboutItem);

5
app/src/main/res/drawable/ic_message_white_24dp.xml

@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#FFFFFF"
android:viewportHeight="24.0" android:viewportWidth="24.0"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M20,2L4,2c-1.1,0 -1.99,0.9 -1.99,2L2,22l4,-4h14c1.1,0 2,-0.9 2,-2L22,4c0,-1.1 -0.9,-2 -2,-2zM18,14L6,14v-2h12v2zM18,11L6,11L6,9h12v2zM18,8L6,8L6,6h12v2z"/>
</vector>

25
app/src/main/res/layout/activity_inbox.xml

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:orientation="vertical"
tools:context=".activities.inbox.InboxActivity">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ToolbarTheme">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:gravity="center"
app:popupTheme="@style/ToolbarTheme" />
</com.google.android.material.appbar.AppBarLayout>
</LinearLayout>

3
app/src/main/res/values/strings.xml

@ -11,6 +11,8 @@
<string name="about">About</string>
<string name="home">Home</string>
<string name="bookmark">Bookmarks</string>
<string name="shoutbox">Shoutbox</string>
<string name="inbox">Inbox</string>
<string name="info">Info</string>
<string name="ok">OK</string>
<string name="cancel">Cancel</string>
@ -21,7 +23,6 @@
<string name="recent">Recent</string>
<string name="forum">Forum</string>
<string name="unread">Unread</string>
<string name="shoutbox">Shoutbox</string>
<string name="refresh">Refresh</string>
<!--Login Activity-->

2
build.gradle

@ -8,7 +8,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.android.tools.build:gradle:3.3.0'
classpath 'com.google.gms:google-services:4.2.0'
classpath 'io.fabric.tools:gradle:1.26.1'
classpath 'org.ajoberstar.grgit:grgit-core:3.0.0' // Also change in app/gradle/grgit.gradle

4
gradle/wrapper/gradle-wrapper.properties

@ -1,6 +1,6 @@
#Fri Sep 28 13:21:54 EEST 2018
#Sat Feb 09 12:35:50 EET 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip

Loading…
Cancel
Save