Added proper message list, and almost nice notifications

This commit is contained in:
Christian Basler 2015-08-28 13:49:53 +02:00
parent 5e2d19df58
commit e5b00c7453
24 changed files with 390 additions and 94 deletions

View File

@ -2,8 +2,10 @@ package ch.dissem.apps.abit;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.support.v4.app.NavUtils; import android.support.v4.app.NavUtils;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.MenuItem; import android.view.MenuItem;
@ -16,13 +18,15 @@ import android.view.MenuItem;
* This activity is mostly just a 'shell' activity containing nothing * This activity is mostly just a 'shell' activity containing nothing
* more than a {@link MessageDetailFragment}. * more than a {@link MessageDetailFragment}.
*/ */
public class MessageDetailActivity extends ActionBarActivity { public class MessageDetailActivity extends AppCompatActivity {
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_message_detail); setContentView(R.layout.toolbar_layout);
final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
// Show the Up button in the action bar. // Show the Up button in the action bar.
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
@ -39,12 +43,12 @@ public class MessageDetailActivity extends ActionBarActivity {
// Create the detail fragment and add it to the activity // Create the detail fragment and add it to the activity
// using a fragment transaction. // using a fragment transaction.
Bundle arguments = new Bundle(); Bundle arguments = new Bundle();
arguments.putString(MessageDetailFragment.ARG_ITEM, arguments.putSerializable(MessageDetailFragment.ARG_ITEM,
getIntent().getStringExtra(MessageDetailFragment.ARG_ITEM)); getIntent().getSerializableExtra(MessageDetailFragment.ARG_ITEM));
MessageDetailFragment fragment = new MessageDetailFragment(); MessageDetailFragment fragment = new MessageDetailFragment();
fragment.setArguments(arguments); fragment.setArguments(arguments);
getSupportFragmentManager().beginTransaction() getSupportFragmentManager().beginTransaction()
.add(R.id.message_detail_container, fragment) .add(R.id.content, fragment)
.commit(); .commit();
} }
} }

View File

@ -5,8 +5,14 @@ import android.support.v4.app.Fragment;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import ch.dissem.apps.abit.service.Singleton;
import ch.dissem.bitmessage.entity.BitmessageAddress;
import ch.dissem.bitmessage.entity.Plaintext; import ch.dissem.bitmessage.entity.Plaintext;
import ch.dissem.bitmessage.entity.valueobject.Label;
import java.util.Iterator;
/** /**
@ -53,9 +59,29 @@ public class MessageDetailFragment extends Fragment {
// Show the dummy content as text in a TextView. // Show the dummy content as text in a TextView.
if (item != null) { if (item != null) {
((TextView) rootView.findViewById(R.id.message_detail)).setText(item.getText()); ((TextView) rootView.findViewById(R.id.subject)).setText(item.getSubject());
BitmessageAddress sender = item.getFrom();
((ImageView) rootView.findViewById(R.id.avatar)).setImageDrawable(new Identicon(sender));
((TextView) rootView.findViewById(R.id.sender)).setText(sender.toString());
if (item.getTo() != null) {
((TextView) rootView.findViewById(R.id.recipient)).setText(item.getTo().toString());
} else if (item.getType() == Plaintext.Type.BROADCAST) {
((TextView) rootView.findViewById(R.id.recipient)).setText(R.string.broadcast);
}
((TextView) rootView.findViewById(R.id.text)).setText(item.getText());
} }
boolean removed = false;
Iterator<Label> labels = item.getLabels().iterator();
while (labels.hasNext()) {
if (labels.next().getType() == Label.Type.UNREAD) {
labels.remove();
removed = true;
}
}
if (removed) {
Singleton.getBitmessageContext(inflater.getContext()).messages().save(item);
}
return rootView; return rootView;
} }
} }

View File

@ -8,7 +8,6 @@ import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.widget.AdapterView; import android.widget.AdapterView;
import android.widget.Toast;
import ch.dissem.apps.abit.service.Singleton; import ch.dissem.apps.abit.service.Singleton;
import ch.dissem.bitmessage.BitmessageContext; import ch.dissem.bitmessage.BitmessageContext;
import ch.dissem.bitmessage.entity.BitmessageAddress; import ch.dissem.bitmessage.entity.BitmessageAddress;
@ -28,6 +27,8 @@ import com.mikepenz.materialdrawer.model.SecondaryDrawerItem;
import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem; import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem;
import com.mikepenz.materialdrawer.model.interfaces.IProfile; import com.mikepenz.materialdrawer.model.interfaces.IProfile;
import com.mikepenz.materialdrawer.model.interfaces.Nameable; import com.mikepenz.materialdrawer.model.interfaces.Nameable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList; import java.util.ArrayList;
@ -51,6 +52,9 @@ import java.util.ArrayList;
*/ */
public class MessageListActivity extends AppCompatActivity public class MessageListActivity extends AppCompatActivity
implements MessageListFragment.Callbacks { implements MessageListFragment.Callbacks {
public static final String EXTRA_SHOW_MESSAGE = "show_message";
private static final Logger LOG = LoggerFactory.getLogger(MessageListActivity.class);
private static final int ADD_IDENTITY = 1; private static final int ADD_IDENTITY = 1;
/** /**
@ -97,6 +101,7 @@ public class MessageListActivity extends AppCompatActivity
private void createDrawer(Toolbar toolbar) { private void createDrawer(Toolbar toolbar) {
final ArrayList<IProfile> profiles = new ArrayList<>(); final ArrayList<IProfile> profiles = new ArrayList<>();
for (BitmessageAddress identity : bmc.addresses().getIdentities()) { for (BitmessageAddress identity : bmc.addresses().getIdentities()) {
LOG.info("Adding identity " + identity.getAddress());
profiles.add(new ProfileDrawerItem() profiles.add(new ProfileDrawerItem()
.withName(identity.toString()) .withName(identity.toString())
.withEmail(identity.getAddress()) .withEmail(identity.getAddress())
@ -203,18 +208,7 @@ public class MessageListActivity extends AppCompatActivity
public boolean onOptionsItemSelected(MenuItem item) { public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) { switch (item.getItemId()) {
case R.id.sync_disabled: case R.id.sync_disabled:
bmc.startup(new BitmessageContext.Listener() { bmc.startup(Singleton.getMessageListener(this));
@Override
public void receive(final Plaintext plaintext) {
// TODO
runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(MessageListActivity.this, plaintext.getSubject(), Toast.LENGTH_LONG).show();
}
});
}
});
updateMenu(); updateMenu();
return true; return true;
case R.id.sync_enabled: case R.id.sync_enabled:
@ -256,4 +250,5 @@ public class MessageListActivity extends AppCompatActivity
public Label getSelectedLabel() { public Label getSelectedLabel() {
return selectedLabel; return selectedLabel;
} }
} }

View File

@ -2,6 +2,7 @@ package ch.dissem.apps.abit;
import android.app.Activity; import android.app.Activity;
import android.content.Intent; import android.content.Intent;
import android.graphics.Typeface;
import android.os.Bundle; import android.os.Bundle;
import android.support.design.widget.FloatingActionButton; import android.support.design.widget.FloatingActionButton;
import android.support.v4.app.ListFragment; import android.support.v4.app.ListFragment;
@ -9,7 +10,9 @@ import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.ListView; import android.widget.ListView;
import android.widget.TextView;
import ch.dissem.apps.abit.service.Singleton; import ch.dissem.apps.abit.service.Singleton;
import ch.dissem.bitmessage.BitmessageContext; import ch.dissem.bitmessage.BitmessageContext;
import ch.dissem.bitmessage.entity.Plaintext; import ch.dissem.bitmessage.entity.Plaintext;
@ -84,11 +87,34 @@ public class MessageListFragment extends ListFragment {
} }
public void updateList(Label label) { public void updateList(Label label) {
setListAdapter(new ArrayAdapter<>( setListAdapter(new ArrayAdapter<Plaintext>(
getActivity(), getActivity(),
android.R.layout.simple_list_item_activated_1, android.R.layout.simple_list_item_activated_1,
android.R.id.text1, android.R.id.text1,
bmc.messages().findMessages(label))); bmc.messages().findMessages(label)) {
@Override
public View getView(int position, View convertView, ViewGroup parent) {
if (convertView == null) {
LayoutInflater inflater = LayoutInflater.from(getContext());
convertView = inflater.inflate(R.layout.message_row, null, false);
}
Plaintext item = getItem(position);
((ImageView) convertView.findViewById(R.id.avatar)).setImageDrawable(new Identicon(item.getFrom()));
TextView sender = (TextView) convertView.findViewById(R.id.sender);
sender.setText(item.getFrom().toString());
TextView subject = (TextView) convertView.findViewById(R.id.subject);
subject.setText(item.getSubject());
((TextView) convertView.findViewById(R.id.text)).setText(item.getText());
if (item.isUnread()) {
sender.setTypeface(Typeface.DEFAULT_BOLD);
subject.setTypeface(Typeface.DEFAULT_BOLD);
} else {
sender.setTypeface(Typeface.DEFAULT);
subject.setTypeface(Typeface.DEFAULT);
}
return convertView;
}
});
} }
@Override @Override

View File

@ -0,0 +1,69 @@
/*
* Copyright 2015 Christian Basler
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ch.dissem.apps.abit;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.support.v7.app.NotificationCompat;
import ch.dissem.bitmessage.BitmessageContext;
import ch.dissem.bitmessage.entity.Plaintext;
/**
* Created by chris on 22.08.15.
*/
public class MessageListener implements BitmessageContext.Listener {
private final Context ctx;
private final NotificationManager manager;
public MessageListener(Context ctx) {
this.ctx = ctx.getApplicationContext();
this.manager = (NotificationManager) ctx.getSystemService(Context.NOTIFICATION_SERVICE);
}
@Override
public void receive(final Plaintext plaintext) {
// TODO
// ctx.runOnUiThread(new Runnable() {
// @Override
// public void run() {
NotificationCompat.Builder builder = new NotificationCompat.Builder(ctx);
builder.setSmallIcon(R.drawable.ic_notification_new_message)
.setContentTitle(plaintext.getFrom().toString())
.setContentText(plaintext.getSubject());
NotificationCompat.InboxStyle inboxStyle = new NotificationCompat.InboxStyle();
inboxStyle.setBigContentTitle(plaintext.getFrom().toString());
inboxStyle.setSummaryText(plaintext.getSubject());
String text = plaintext.getText();
if (text.length() > 100)
inboxStyle.addLine(text.substring(0, 100) + "");
else
inboxStyle.addLine(text);
builder.setStyle(inboxStyle);
Intent intent = new Intent(ctx, MessageListActivity.class);
intent.putExtra(MessageListActivity.EXTRA_SHOW_MESSAGE, plaintext);
PendingIntent pendingIntent = PendingIntent.getActivity(ctx, 0, intent, 0);
builder.setContentIntent(pendingIntent);
manager.notify(0, builder.build());
// }
// });
}
}

View File

@ -184,7 +184,13 @@ public class AndroidAddressRepository implements AddressRepository {
// Create a new map of values, where column names are the keys // Create a new map of values, where column names are the keys
ContentValues values = new ContentValues(); ContentValues values = new ContentValues();
values.put(COLUMN_ALIAS, address.getAlias()); values.put(COLUMN_ALIAS, address.getAlias());
values.put(COLUMN_PUBLIC_KEY, Encode.bytes(address.getPubkey())); if (address.getPubkey() != null) {
ByteArrayOutputStream out = new ByteArrayOutputStream();
address.getPubkey().writeUnencrypted(out);
values.put(COLUMN_PUBLIC_KEY, out.toByteArray());
} else {
values.put(COLUMN_PUBLIC_KEY, (byte[]) null);
}
values.put(COLUMN_PRIVATE_KEY, Encode.bytes(address.getPrivateKey())); values.put(COLUMN_PRIVATE_KEY, Encode.bytes(address.getPrivateKey()));
values.put(COLUMN_SUBSCRIBED, address.isSubscribed()); values.put(COLUMN_SUBSCRIBED, address.isSubscribed());

View File

@ -18,6 +18,7 @@ package ch.dissem.apps.abit.repositories;
import android.content.ContentValues; import android.content.ContentValues;
import android.database.Cursor; import android.database.Cursor;
import android.database.sqlite.SQLiteConstraintException;
import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteDatabase;
import ch.dissem.bitmessage.entity.ObjectMessage; import ch.dissem.bitmessage.entity.ObjectMessage;
import ch.dissem.bitmessage.entity.payload.ObjectType; import ch.dissem.bitmessage.entity.payload.ObjectType;
@ -168,10 +169,9 @@ public class AndroidInventory implements Inventory {
values.put(COLUMN_TYPE, object.getType()); values.put(COLUMN_TYPE, object.getType());
values.put(COLUMN_VERSION, object.getVersion()); values.put(COLUMN_VERSION, object.getVersion());
long insert = db.insert(TABLE_NAME, null, values); db.insertOrThrow(TABLE_NAME, null, values);
if (insert < 0) { } catch (SQLiteConstraintException e) {
LOG.trace("Error while inserting object. Most probably it was requested twice."); LOG.trace(e.getMessage(), e);
}
} catch (IOException e) { } catch (IOException e) {
LOG.error(e.getMessage(), e); LOG.error(e.getMessage(), e);
} }

View File

@ -138,7 +138,7 @@ public class AndroidMessageRepository implements MessageRepository, InternalCont
text = ctx.getString(R.string.trash); text = ctx.getString(R.string.trash);
break; break;
case BROADCAST: case BROADCAST:
text = ctx.getString(R.string.broadcast); text = ctx.getString(R.string.broadcasts);
break; break;
default: default:
text = c.getString(c.getColumnIndex(LBL_COLUMN_LABEL)); text = c.getString(c.getColumnIndex(LBL_COLUMN_LABEL));
@ -192,7 +192,8 @@ public class AndroidMessageRepository implements MessageRepository, InternalCont
Cursor c = db.query( Cursor c = db.query(
TABLE_NAME, projection, TABLE_NAME, projection,
where, where,
null, null, null, null null, null, null,
COLUMN_RECEIVED + " DESC"
); );
c.moveToFirst(); c.moveToFirst();
while (!c.isAfterLast()) { while (!c.isAfterLast()) {
@ -224,8 +225,8 @@ public class AndroidMessageRepository implements MessageRepository, InternalCont
@Override @Override
public void save(Plaintext message) { public void save(Plaintext message) {
SQLiteDatabase db = sql.getWritableDatabase();
try { try {
SQLiteDatabase db = sql.getWritableDatabase();
db.beginTransaction(); db.beginTransaction();
// save from address if necessary // save from address if necessary
@ -256,9 +257,11 @@ public class AndroidMessageRepository implements MessageRepository, InternalCont
values.put(JT_COLUMN_MESSAGE, (Long) message.getId()); values.put(JT_COLUMN_MESSAGE, (Long) message.getId());
db.insertOrThrow(JOIN_TABLE_NAME, null, values); db.insertOrThrow(JOIN_TABLE_NAME, null, values);
} }
db.endTransaction(); db.setTransactionSuccessful();
} catch (IOException e) { } catch (IOException e) {
LOG.error(e.getMessage(), e); LOG.error(e.getMessage(), e);
} finally {
db.endTransaction();
} }
} }

View File

@ -33,7 +33,6 @@ public class SqlHelper extends SQLiteOpenHelper {
public SqlHelper(Context ctx) { public SqlHelper(Context ctx) {
super(ctx, DATABASE_NAME, null, DATABASE_VERSION); super(ctx, DATABASE_NAME, null, DATABASE_VERSION);
setWriteAheadLoggingEnabled(true);
this.ctx = ctx; this.ctx = ctx;
} }

View File

@ -1,6 +1,7 @@
package ch.dissem.apps.abit.service; package ch.dissem.apps.abit.service;
import android.content.Context; import android.content.Context;
import ch.dissem.apps.abit.MessageListener;
import ch.dissem.apps.abit.repositories.AndroidAddressRepository; import ch.dissem.apps.abit.repositories.AndroidAddressRepository;
import ch.dissem.apps.abit.repositories.AndroidInventory; import ch.dissem.apps.abit.repositories.AndroidInventory;
import ch.dissem.apps.abit.repositories.AndroidMessageRepository; import ch.dissem.apps.abit.repositories.AndroidMessageRepository;
@ -11,10 +12,11 @@ import ch.dissem.bitmessage.ports.MemoryNodeRegistry;
import ch.dissem.bitmessage.security.sc.SpongySecurity; import ch.dissem.bitmessage.security.sc.SpongySecurity;
/** /**
* Created by chris on 16.07.15. * Provides singleton objects across the application.
*/ */
public class Singleton { public class Singleton {
private static BitmessageContext bitmessageContext; private static BitmessageContext bitmessageContext;
private static MessageListener messageListener;
public static BitmessageContext getBitmessageContext(Context ctx) { public static BitmessageContext getBitmessageContext(Context ctx) {
if (bitmessageContext == null) { if (bitmessageContext == null) {
@ -35,4 +37,15 @@ public class Singleton {
} }
return bitmessageContext; return bitmessageContext;
} }
public static MessageListener getMessageListener(Context ctx) {
if (messageListener == null) {
synchronized (Singleton.class) {
if (messageListener == null) {
messageListener = new MessageListener(ctx);
}
}
}
return messageListener;
}
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 356 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 273 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 455 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 660 B

View File

@ -1,25 +0,0 @@
<?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"
android:gravity="center"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
android:elevation="4dp" />
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_below="@id/toolbar"
android:id="@+id/message_detail_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MessageDetailActivity"
tools:layout="@android:layout/list_content"/>
</RelativeLayout>

View File

@ -6,24 +6,24 @@
android:padding="16dp"> android:padding="16dp">
<TextView <TextView
android:id="@+id/address"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="BM-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" android:text="BM-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
android:textAppearance="?android:attr/textAppearanceSmall" android:textAppearance="?android:attr/textAppearanceSmall"/>
android:id="@+id/address"/>
<android.support.design.widget.TextInputLayout <android.support.design.widget.TextInputLayout
android:id="@+id/label_wrapper"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:id="@+id/label_wrapper"
android:layout_below="@+id/address"> android:layout_below="@+id/address">
<EditText <EditText
android:id="@+id/label"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:inputType="textPersonName" android:inputType="textPersonName"
android:hint="@string/label" android:hint="@string/label"/>
android:id="@+id/label"/>
</android.support.design.widget.TextInputLayout> </android.support.design.widget.TextInputLayout>
@ -37,30 +37,47 @@
android:layout_marginTop="8dp"/> android:layout_marginTop="8dp"/>
<Switch <Switch
android:id="@+id/subscribe"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/subscribe" android:text="@string/subscribe"
android:id="@+id/subscribe"
android:layout_below="@+id/import_contact" android:layout_below="@+id/import_contact"
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"/> android:layout_marginBottom="8dp"/>
<Button <Button
android:id="@+id/compose_message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Message"
style="?android:attr/borderlessButtonStyle"
android:layout_below="@+id/subscribe"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_marginTop="12dp"
android:layout_marginBottom="12dp"/>
<Button
android:id="@+id/do_import"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/do_import" android:text="@string/do_import"
android:id="@+id/do_import" style="?android:attr/borderlessButtonStyle"
android:layout_alignParentBottom="true" android:layout_below="@+id/subscribe"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"/> android:layout_alignParentEnd="true"
android:layout_marginTop="12dp"
android:layout_marginBottom="12dp"/>
<Button <Button
android:id="@+id/cancel"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/cancel" android:text="@string/cancel"
android:id="@+id/cancel" style="?android:attr/borderlessButtonStyle"
android:layout_alignParentBottom="true" android:layout_alignTop="@+id/do_import"
android:layout_toLeftOf="@id/do_import"/> android:layout_toLeftOf="@+id/do_import"
android:layout_toStartOf="@+id/do_import"/>
</RelativeLayout> </RelativeLayout>

View File

@ -1,9 +1,82 @@
<TextView xmlns:android="http://schemas.android.com/apk/res/android" <?xml version="1.0" encoding="utf-8"?>
xmlns:tools="http://schemas.android.com/tools" <ScrollView
android:id="@+id/message_detail" xmlns:android="http://schemas.android.com/apk/res/android"
style="?android:attr/textAppearanceLarge" android:layout_height="match_parent"
android:layout_width="match_parent" android:layout_width="match_parent">
android:layout_height="match_parent"
android:padding="16dp" <RelativeLayout
android:textIsSelectable="true" android:orientation="vertical"
tools:context=".MessageDetailFragment"/> android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true">
<TextView
android:id="@+id/subject"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:gravity="center_vertical"
android:text="Subject"
android:padding="16dp"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:elegantTextHeight="false"
android:enabled="false"/>
<View
android:id="@+id/divider"
android:layout_width="fill_parent"
android:layout_height="2dip"
android:layout_below="@id/subject"
android:background="@color/divider"/>
<ImageView
android:id="@+id/avatar"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_below="@+id/divider"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:src="@color/accent"
android:layout_margin="16dp"/>
<TextView
android:id="@+id/sender"
android:layout_width="wrap_content"
android:layout_height="20dp"
android:text="Sender"
android:layout_alignTop="@+id/avatar"
android:layout_toRightOf="@+id/avatar"
android:layout_toEndOf="@+id/avatar"
android:gravity="center_vertical"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:textStyle="bold"/>
<TextView
android:id="@+id/recipient"
android:layout_width="wrap_content"
android:layout_height="20dp"
android:text="Recipient"
android:gravity="center_vertical"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:layout_alignBottom="@+id/avatar"
android:layout_toRightOf="@+id/avatar"
android:layout_toEndOf="@+id/avatar"/>
<TextView
android:id="@+id/text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="New Text"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="32dp"
android:paddingBottom="64dp"
android:layout_below="@+id/avatar"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"/>
</RelativeLayout>
</ScrollView>

View File

@ -0,0 +1,80 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright 2015 Christian Basler
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/avatar"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:src="@color/accent"
android:layout_margin="16dp"/>
<TextView
android:id="@+id/sender"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Sender"
android:lines="1"
android:ellipsize="end"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_alignTop="@+id/avatar"
android:layout_toRightOf="@+id/avatar"
android:layout_toEndOf="@+id/avatar"
android:layout_marginTop="-5dp"
android:paddingTop="0dp"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:paddingBottom="0dp"
android:textStyle="bold"
/>
<TextView
android:id="@+id/subject"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Subject"
android:lines="1"
android:ellipsize="end"
android:textAppearance="?android:attr/textAppearanceSmall"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:layout_below="@+id/sender"
android:layout_toRightOf="@+id/avatar"
android:layout_toEndOf="@+id/avatar"/>
<TextView
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Text"
android:lines="1"
android:ellipsize="end"
android:textAppearance="?android:attr/textAppearanceSmall"
android:gravity="center_vertical"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:paddingBottom="8dp"
android:layout_below="@+id/subject"
android:layout_toRightOf="@+id/avatar"
android:layout_toEndOf="@+id/avatar"/>
</RelativeLayout>

View File

@ -21,5 +21,5 @@
<string name="sent">Gesendet</string> <string name="sent">Gesendet</string>
<string name="unread">Ungelesen</string> <string name="unread">Ungelesen</string>
<string name="trash">Papierkorb</string> <string name="trash">Papierkorb</string>
<string name="broadcast">Broadcasts</string> <string name="broadcasts">Broadcasts</string>
</resources> </resources>

View File

@ -6,12 +6,22 @@
<string name="wifi_only_summary">Nicht mit Mobilfunknetz verbinden</string> <string name="wifi_only_summary">Nicht mit Mobilfunknetz verbinden</string>
<string name="bitmessage_active">Bitmessage ist aktiv</string> <string name="bitmessage_active">Bitmessage ist aktiv</string>
<string name="disable_sync">Synchronisieren ausschalten</string> <string name="disable_sync">Synchronisieren ausschalten</string>
<string name="emoji_input">Eingabe von Emojis</string>
<string name="emoji_input_summary">Emoji-Taste anstelle von Eingabe anzeigen</string>
<string name="enable_sync">Synchronisieren einschalten</string> <string name="enable_sync">Synchronisieren einschalten</string>
<string name="subject">Betreff</string> <string name="subject">Betreff</string>
<string name="to">An</string> <string name="to">An</string>
<string name="title_message_detail">Nachricht</string> <string name="title_message_detail">Nachricht</string>
<string name="subscriptions">Abonnements</string> <string name="subscriptions">Abonnements</string>
<string name="wifi_mode">Art der WLAN-Verbindung</string> <string name="wifi_mode">Art der WLAN-Verbindung</string>
<string name="action_settings">Einstellungen</string>
<string name="add_identity">Identität hinzufügen</string>
<string name="add_identity_summary">Eine neue Identität erstellen</string>
<string name="broadcast">Broadcast</string>
<string name="cancel">Abbrechen</string>
<string name="do_import">Importieren</string>
<string name="import_address">Adresse importieren</string>
<string name="import_contact">Kontakt hinzufügen</string>
<string name="label">Label</string>
<string name="manage_identity">Identität verwalten</string>
<string name="subscribe">Abonnieren</string>
<string name="title_activity_open_bitmessage_link">Kontakt importieren</string>
</resources> </resources>

View File

@ -21,5 +21,5 @@
<string name="sent">Sent</string> <string name="sent">Sent</string>
<string name="unread">Unread</string> <string name="unread">Unread</string>
<string name="trash">Trash</string> <string name="trash">Trash</string>
<string name="broadcast">Broadcasts</string> <string name="broadcasts">Broadcasts</string>
</resources> </resources>

View File

@ -11,14 +11,11 @@
<string name="subscriptions">Subscriptions</string> <string name="subscriptions">Subscriptions</string>
<string name="to">To</string> <string name="to">To</string>
<string name="subject">Subject</string> <string name="subject">Subject</string>
<string name="emoji_input">Emoji Input</string>
<string name="emoji_input_summary">Show the emoji button instead of enter</string>
<string name="manage_identity">Manage Identity</string> <string name="manage_identity">Manage Identity</string>
<string name="add_identity">Add Identity</string> <string name="add_identity">Add Identity</string>
<string name="add_identity_summary">Create new identity</string> <string name="add_identity_summary">Create new identity</string>
<string name="title_activity_open_bitmessage_link">Import Contact</string> <string name="title_activity_open_bitmessage_link">Import Contact</string>
<string name="hello_world">Hello world!</string>
<string name="action_settings">Settings</string> <string name="action_settings">Settings</string>
<string name="import_address">Import Address</string> <string name="import_address">Import Address</string>
<string name="import_contact">Add to contacts</string> <string name="import_contact">Add to contacts</string>
@ -26,4 +23,5 @@
<string name="subscribe">Subscribe</string> <string name="subscribe">Subscribe</string>
<string name="do_import">Import</string> <string name="do_import">Import</string>
<string name="cancel">Cancel</string> <string name="cancel">Cancel</string>
<string name="broadcast">Broadcast</string>
</resources> </resources>

View File

@ -4,18 +4,20 @@
<style name="AppTheme.Base" parent="MaterialDrawerTheme.Light.DarkToolbar.TranslucentStatus"> <style name="AppTheme.Base" parent="MaterialDrawerTheme.Light.DarkToolbar.TranslucentStatus">
<item name="android:activatedBackgroundIndicator">@color/primary_light</item> <item name="android:activatedBackgroundIndicator">@color/primary_light</item>
<item name="android:textColor">@color/primary_text</item>
<item name="android:textColorSecondary">@color/secondary_text</item>
<!-- MaterialDrawer specific values --> <!-- MaterialDrawer specific values -->
<item name="material_drawer_background">@color/primary_dark</item> <item name="material_drawer_background">@color/primary_dark</item>
<item name="material_drawer_icons">@color/icons</item> <item name="material_drawer_icons">@color/primary_text</item>
<item name="material_drawer_primary_icon">@color/icons</item> <item name="material_drawer_primary_icon">@color/icons</item>
<item name="material_drawer_primary_text">@color/icons</item> <item name="material_drawer_primary_text">@color/primary_text</item>
<item name="material_drawer_secondary_text">@color/icons</item> <item name="material_drawer_secondary_text">@color/secondary_text</item>
<item name="material_drawer_hint_text">@color/icons</item> <item name="material_drawer_hint_text">@color/secondary_text</item>
<item name="material_drawer_divider">@color/icons</item> <item name="material_drawer_divider">@color/divider</item>
<item name="material_drawer_selected">@color/primary</item> <item name="material_drawer_selected">@color/primary</item>
<item name="material_drawer_selected_text">@color/icons</item> <item name="material_drawer_selected_text">@color/primary_text</item>
<item name="material_drawer_header_selection_text">@color/icons</item> <item name="material_drawer_header_selection_text">@color/primary_text</item>
</style> </style>

View File

@ -9,7 +9,7 @@ buildscript {
jcenter() jcenter()
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:1.2.3' classpath 'com.android.tools.build:gradle:1.3.0'
// NOTE: Do not place your application dependencies here; they belong // NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files // in the individual module build.gradle files