Skip to content
This repository has been archived by the owner on Jul 11, 2022. It is now read-only.

Commit

Permalink
Merge pull request #5 from AiursoftWeb/improveui
Browse files Browse the repository at this point in the history
Improve ui
  • Loading branch information
ganlvtech authored May 23, 2019
2 parents ba458a1 + e20b8ba commit abecefe
Show file tree
Hide file tree
Showing 19 changed files with 142 additions and 89 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@
/build
/captures
.externalNativeBuild
/.idea
12 changes: 7 additions & 5 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,16 @@ android {

dependencies {
// implementation fileTree(dir: 'libs', include: ['*.jar'])
// testImplementation 'junit:junit:4.12'
// androidTestImplementation 'com.android.support.test:runner:1.0.2'
// androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

implementation 'com.squareup.okhttp3:okhttp:3.12.2'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.android.support:drawerlayout:28.0.0-alpha1'
implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'
implementation 'com.android.support:drawerlayout:28.0.0'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.jaeger.statusbarutil:library:1.5.1'
implementation 'com.davemorrissey.labs:subsampling-scale-image-view:3.10.0'
implementation 'com.android.support:design:28.0.0'

testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,7 @@
import android.text.Editable;
import android.text.TextWatcher;
import android.view.View;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;

import android.widget.*;
import com.ganlvtech.kahlanotify.client.KahlaClient;
import com.ganlvtech.kahlanotify.components.IconTitleContent;
import com.ganlvtech.kahlanotify.components.MessageListItemAdapter;
Expand Down Expand Up @@ -46,8 +40,8 @@ public class ConversationActivity extends MyServiceActivity {
private TextView mToolbarTextViewSubtitle;
private ListView mListViewConversations;
private EditText mEditTextSend;
private Button mButtonSendImage;
private Button mButtonSendFile;
private ImageButton mButtonSendImage;
private ImageButton mButtonSendFile;
private Button mButtonSend;
private MessageListItemAdapter mMessageListItemAdapter;
private ConversationListActivitySharedPreferences mConversationListActivitySharedPreferences;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
package com.ganlvtech.kahlanotify;

import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.widget.DrawerLayout;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AlertDialog;
import android.support.v7.widget.Toolbar;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.TextView;

import com.ganlvtech.kahlanotify.client.KahlaClient;
import com.ganlvtech.kahlanotify.components.AccountListItemAdapter;
import com.ganlvtech.kahlanotify.components.ContactInfoListItemAdapter;
Expand All @@ -22,15 +24,16 @@
import com.ganlvtech.kahlanotify.kahla.responses.auth.MeResponse;
import com.ganlvtech.kahlanotify.kahla.responses.friendship.MyFriendsResponse;
import com.ganlvtech.kahlanotify.util.ConversationListActivitySharedPreferences;
import com.jaeger.library.StatusBarUtil;

import java.util.List;

public class ConversationListActivity extends MyServiceActivity {
private DrawerLayout mDrawerLayoutConversationListActivity;
private ActionBarDrawerToggle mDrawerToggle;
private SwipeRefreshLayout mSwipeRefreshLayout;
private ListView mListViewConversations;
private ListView mListViewAccounts;
private Toolbar mToolbar;
private TextView mToolbalTextViewTitle;
private TextView mToolbalTextViewSubtitle;
private TextView mTextViewNewAccount;
Expand All @@ -51,8 +54,15 @@ protected void onCreate(Bundle savedInstanceState) {
mListViewConversations = findViewById(R.id.listViewConversations);
mListViewAccounts = findViewById(R.id.listViewAccounts);
mTextViewNewAccount = findViewById(R.id.textViewNewAccount);
mToolbar = findViewById(R.id.toolbar);

setSupportActionBar(mToolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeButtonEnabled(true);
getSupportActionBar().setHomeAsUpIndicator(R.drawable.ic_menu_black_24dp);

StatusBarUtil.setColorNoTranslucentForDrawerLayout(this, mDrawerLayoutConversationListActivity, getColor(R.color.main_theme));
mDrawerToggle = new ActionBarDrawerToggle(this,mDrawerLayoutConversationListActivity,R.string.Menu,R.string.Menu);
mDrawerLayoutConversationListActivity.addDrawerListener(mDrawerToggle);

mSwipeRefreshLayout.setColorSchemeColors(getColor(R.color.main_theme));
mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
Expand Down Expand Up @@ -218,7 +228,7 @@ private void startConversationActivity(int conversationId) {
}

private void signOut(@NonNull final KahlaClient kahlaClient) {
new AlertDialog.Builder(ConversationListActivity.this)
new AlertDialog.Builder(this)
.setTitle("Sign out")
.setMessage("Are you sure to sign out?")
.setPositiveButton("Sign out", new DialogInterface.OnClickListener() {
Expand All @@ -232,4 +242,12 @@ public void onClick(DialogInterface dialog, int which) {
.setNegativeButton("Cancel", null)
.show();
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
if(mDrawerToggle.onOptionsItemSelected(item)){
return true;
}
return super.onOptionsItemSelected(item);
}
}
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
package com.ganlvtech.kahlanotify;

import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.os.Bundle;

import android.support.v7.app.AppCompatActivity;
import com.davemorrissey.labs.subscaleview.ImageSource;
import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView;
import com.squareup.picasso.Picasso;
import com.squareup.picasso.Target;

public class ImageActivity extends Activity {
public class ImageActivity extends AppCompatActivity {
public static final String INTENT_EXTRA_NAME_IMAGE_URL = "imageUrl";
private String mImageUrl;
private SubsamplingScaleImageView mImageViewImage;
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/com/ganlvtech/kahlanotify/LogActivity.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.ganlvtech.kahlanotify;

import android.app.Activity;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.TextView;

public class LogActivity extends Activity {
public class LogActivity extends AppCompatActivity {
private TextView textView;

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
package com.ganlvtech.kahlanotify;

import android.app.AlertDialog;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AlertDialog;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
import android.widget.Button;
import android.widget.EditText;

import com.ganlvtech.kahlanotify.client.KahlaClient;
import com.ganlvtech.kahlanotify.kahla.responses.auth.AuthByPasswordResponse;
import com.ganlvtech.kahlanotify.util.AccountListSharedPreferences;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
package com.ganlvtech.kahlanotify;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.IBinder;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;

@SuppressLint("Registered")
public class MyServiceActivity extends Activity {
public class MyServiceActivity extends AppCompatActivity {
private static final String TAG = "MyServiceActivity";
@Nullable
protected MyService mMyService;
Expand Down
9 changes: 9 additions & 0 deletions app/src/main/res/drawable/ic_attach_file_black_24dp.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M16.5,6v11.5c0,2.21 -1.79,4 -4,4s-4,-1.79 -4,-4V5c0,-1.38 1.12,-2.5 2.5,-2.5s2.5,1.12 2.5,2.5v10.5c0,0.55 -0.45,1 -1,1s-1,-0.45 -1,-1V6H10v9.5c0,1.38 1.12,2.5 2.5,2.5s2.5,-1.12 2.5,-2.5V5c0,-2.21 -1.79,-4 -4,-4S7,2.79 7,5v12.5c0,3.04 2.46,5.5 5.5,5.5s5.5,-2.46 5.5,-5.5V6h-1.5z"/>
</vector>
9 changes: 9 additions & 0 deletions app/src/main/res/drawable/ic_image_black_24dp.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M21,19V5c0,-1.1 -0.9,-2 -2,-2H5c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h14c1.1,0 2,-0.9 2,-2zM8.5,13.5l2.5,3.01L14.5,12l4.5,6H5l3.5,-4.5z"/>
</vector>
10 changes: 10 additions & 0 deletions app/src/main/res/drawable/ic_menu_black_24dp.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:tint="#fff"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M3,18h18v-2L3,16v2zM3,13h18v-2L3,11v2zM3,6v2h18L21,6L3,6z"/>
</vector>
9 changes: 9 additions & 0 deletions app/src/main/res/drawable/ic_send_black_24dp.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M2.01,21L23,12 2.01,3 2,10l15,2 -15,2z"/>
</vector>
40 changes: 22 additions & 18 deletions app/src/main/res/layout/activity_conversation.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
Expand All @@ -26,7 +28,7 @@
android:layout_height="wrap_content"
android:layout_gravity="center"
android:textAppearance="@android:style/TextAppearance.Holo.Widget.ActionBar.Title"
android:textColor="@color/toolbar_title" />
android:textColor="@color/toolbar_title"/>

<TextView
android:id="@+id/toolbarTextViewSubtitle"
Expand All @@ -35,7 +37,7 @@
android:layout_gravity="center"
android:textAppearance="@android:style/TextAppearance.Holo.Widget.ActionBar.Title"
android:textColor="@color/toolbar_subtitle"
android:textSize="12sp" />
android:textSize="12sp"/>
</LinearLayout>
</android.support.v7.widget.Toolbar>

Expand All @@ -51,7 +53,7 @@
android:layout_height="match_parent"
android:divider="@android:color/darker_gray"
android:dividerHeight="1px"
android:scrollbars="none" />
android:scrollbars="none"/>

</android.support.v4.widget.SwipeRefreshLayout>

Expand All @@ -66,27 +68,29 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10" />
android:ems="10"/>

<Button
<ImageButton
android:layout_width="48dp"
android:layout_height="48dp"
android:src="@drawable/ic_image_black_24dp"
android:id="@+id/buttonSendImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/image" />
android:background="?android:selectableItemBackgroundBorderless"
/>

<Button
<ImageButton
android:layout_width="48dp"
android:layout_height="48dp"
android:src="@drawable/ic_attach_file_black_24dp"
android:id="@+id/buttonSendFile"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/file" />
android:background="?android:selectableItemBackgroundBorderless"/>

<Button
<android.support.design.button.MaterialButton
android:id="@+id/buttonSend"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/send" />
app:icon="@drawable/ic_send_black_24dp"
android:layout_gravity="bottom"
android:text="@string/send"/>
</LinearLayout>
</LinearLayout>
9 changes: 5 additions & 4 deletions app/src/main/res/layout/activity_conversation_list.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawerLayoutConversationListActivity"
android:layout_width="match_parent"
android:layout_height="match_parent"
Expand All @@ -11,7 +12,7 @@
android:orientation="vertical">

<android.support.v7.widget.Toolbar
android:id="@+id/id_drawer_layout_toolbar"
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/main_theme">
Expand All @@ -27,7 +28,7 @@
android:id="@+id/toolbarTextViewTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_gravity="start"
android:text="@string/app_name"
android:textAppearance="@android:style/TextAppearance.Holo.Widget.ActionBar.Title"
android:textColor="@color/toolbar_title" />
Expand All @@ -36,7 +37,7 @@
android:id="@+id/toolbarTextViewSubtitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_gravity="start"
android:textAppearance="@android:style/TextAppearance.Holo.Widget.ActionBar.Title"
android:textColor="@color/toolbar_subtitle"
android:textSize="12sp" />
Expand Down
Loading

0 comments on commit abecefe

Please sign in to comment.