initial commit
1
app/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/build
|
31
app/build.gradle
Normal file
@ -0,0 +1,31 @@
|
||||
apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
compileSdkVersion 24
|
||||
defaultConfig {
|
||||
applicationId "org.nuclearfog.twidda"
|
||||
minSdkVersion 16
|
||||
targetSdkVersion 16
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
//testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile fileTree(include: ['*.jar'], dir: 'libs')
|
||||
compile 'com.android.support:appcompat-v7:24.+'
|
||||
compile 'com.android.support:design:24.+'
|
||||
compile files('libs/twitter4j-core-4.0.4.jar')
|
||||
}
|
||||
|
||||
repositories {
|
||||
jcenter()
|
||||
}
|
BIN
app/libs/twitter4j-core-4.0.4.jar
Normal file
25
app/proguard-rules.pro
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# By default, the flags in this file are appended to flags specified
|
||||
# in C:\Users\Sufian\AppData\Local\Android\android-sdk/tools/proguard/proguard-android.txt
|
||||
# You can edit the include path and order by changing the proguardFiles
|
||||
# directive in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# Add any project specific keep options here:
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
24
app/src/main/AndroidManifest.xml
Normal file
@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="org.nuclearfog.twidda">
|
||||
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/Theme.AppCompat">
|
||||
<activity
|
||||
android:name=".LoginActivity"
|
||||
android:screenOrientation="portrait">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
</application>
|
||||
</manifest>
|
127
app/src/main/java/org/nuclearfog/twidda/LoginActivity.java
Normal file
@ -0,0 +1,127 @@
|
||||
package org.nuclearfog.twidda;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Fragment;
|
||||
import android.app.TabActivity;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TabHost;
|
||||
import android.widget.TabHost.TabSpec;
|
||||
import android.widget.Toast;
|
||||
import android.content.SharedPreferences;
|
||||
|
||||
import org.nuclearfog.twidda.engine.TwitterEngine;
|
||||
|
||||
public class LoginActivity extends AppCompatActivity //Activity
|
||||
{
|
||||
private Button linkButton, verifierButon, loginButton;
|
||||
private EditText pin;
|
||||
private Context con;
|
||||
private SharedPreferences einstellungen;
|
||||
private TabHost tabhost;
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
einstellungen = getApplicationContext().getSharedPreferences("settings", 0);
|
||||
con = getApplicationContext();
|
||||
if( !loggedIn() ) {
|
||||
setContentView(R.layout.activity_login);
|
||||
pin = (EditText) findViewById(R.id.pin);
|
||||
linkButton = (Button) findViewById(R.id.linkButton);
|
||||
verifierButon = (Button) findViewById(R.id.verifier);
|
||||
loginButton = (Button) findViewById(R.id.loginButton);
|
||||
linkButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override public void onClick(View arg0){linkTwitter();}});
|
||||
verifierButon.setOnClickListener(new View.OnClickListener() {
|
||||
@Override public void onClick(View arg0){verifier();}});
|
||||
loginButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override public void onClick(View arg0){login();}});
|
||||
} else {
|
||||
login();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private void linkTwitter() {
|
||||
RegisterAccount account = new RegisterAccount(con);
|
||||
account.execute("");
|
||||
// linkButton.setVisibility(Button.INVISIBLE);
|
||||
}
|
||||
|
||||
private void verifier() {
|
||||
String twitterPin = pin.getText().toString();
|
||||
if(!twitterPin.trim().isEmpty()) {
|
||||
RegisterAccount account = new RegisterAccount(con);
|
||||
account.setButton(loginButton,verifierButon);
|
||||
account.execute(twitterPin);
|
||||
} else {
|
||||
Toast.makeText(con,"PIN eingeben!",Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
|
||||
private void login(){
|
||||
setTheme(R.style.AppTheme);
|
||||
setContentView(R.layout.main_layout);
|
||||
|
||||
|
||||
tabhost = (TabHost)findViewById(R.id.tabHost);
|
||||
tabhost.setup();
|
||||
|
||||
// Tab #1
|
||||
TabSpec tab1 = tabhost.newTabSpec("timeline");
|
||||
tab1.setIndicator("Timeline").setContent(R.id.timeline);
|
||||
tabhost.addTab(tab1);
|
||||
|
||||
// Tab #2
|
||||
TabSpec tab2 = tabhost.newTabSpec("trends");
|
||||
tab2.setIndicator("Trend").setContent(R.id.timeline);
|
||||
tabhost.addTab(tab2);
|
||||
|
||||
// Tab #3
|
||||
TabSpec tab3 = tabhost.newTabSpec("mention");
|
||||
tab3.setIndicator("Mention").setContent(R.id.timeline);
|
||||
tabhost.addTab(tab3);
|
||||
|
||||
tabhost.setOnTabChangedListener(new TabHost.OnTabChangeListener() {
|
||||
@Override
|
||||
public void onTabChanged(String tabId) {
|
||||
switch(tabId) {
|
||||
case "timeline":
|
||||
ListView timeline = (ListView) findViewById(R.id.timelinelist);
|
||||
TwitterEngine homeView = new TwitterEngine(getApplicationContext(), timeline);
|
||||
homeView.execute(0);
|
||||
break;
|
||||
|
||||
case "trends":
|
||||
ListView trends = (ListView) findViewById(R.id.timelinelist);
|
||||
TwitterEngine trendView = new TwitterEngine(getApplicationContext(), trends);
|
||||
trendView.execute(1);
|
||||
break;
|
||||
|
||||
case "mention":
|
||||
ListView mentions = (ListView) findViewById(R.id.timelinelist);
|
||||
TwitterEngine mentionView = new TwitterEngine(getApplicationContext(), mentions);
|
||||
mentionView.execute(2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
tabhost.setCurrentTab(0);
|
||||
}
|
||||
|
||||
private boolean loggedIn() {
|
||||
return einstellungen.getBoolean("login", false);
|
||||
}
|
||||
}
|
88
app/src/main/java/org/nuclearfog/twidda/RegisterAccount.java
Normal file
@ -0,0 +1,88 @@
|
||||
package org.nuclearfog.twidda;
|
||||
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
import android.widget.Button;
|
||||
import android.widget.Toast;
|
||||
import twitter4j.Twitter;
|
||||
import twitter4j.TwitterException;
|
||||
import twitter4j.TwitterFactory;
|
||||
import twitter4j.auth.AccessToken;
|
||||
import twitter4j.auth.RequestToken;
|
||||
import twitter4j.conf.Configuration;
|
||||
import twitter4j.conf.ConfigurationBuilder;
|
||||
|
||||
public class RegisterAccount extends AsyncTask<String, Void, Boolean> {
|
||||
|
||||
private final String TWITTER_CONSUMER_KEY = "GrylGIgQK3cDjo9mSTBqF1vwf";
|
||||
private final String TWITTER_CONSUMER_SECRET = "pgaWUlDVS5b7Q6VJQDgBzHKw0mIxJIX0UQBcT1oFJEivsCl5OV";
|
||||
|
||||
private static Twitter twitter;
|
||||
private static RequestToken requestToken;
|
||||
|
||||
private Button loginButton, verifierButton;
|
||||
private SharedPreferences einstellungen;
|
||||
private Context context;
|
||||
|
||||
public RegisterAccount( Context context ){
|
||||
this.context = context;
|
||||
einstellungen = context.getSharedPreferences("settings", 0);
|
||||
}
|
||||
|
||||
public void setButton( Button loginButton, Button verifierButton ) {
|
||||
this.loginButton=loginButton;
|
||||
this.verifierButton=verifierButton;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Boolean doInBackground( String... twitterPin ) {
|
||||
// DEBUG
|
||||
if(android.os.Debug.isDebuggerConnected())
|
||||
android.os.Debug.waitForDebugger();
|
||||
|
||||
if ( twitter == null ) {
|
||||
ConfigurationBuilder builder = new ConfigurationBuilder();
|
||||
builder.setDebugEnabled(true);
|
||||
builder.setOAuthConsumerKey(TWITTER_CONSUMER_KEY);
|
||||
builder.setOAuthConsumerSecret(TWITTER_CONSUMER_SECRET);
|
||||
Configuration configuration = builder.build();
|
||||
TwitterFactory factory = new TwitterFactory(configuration);
|
||||
twitter = factory.getInstance();
|
||||
}
|
||||
try {
|
||||
if ( requestToken == null ) {
|
||||
requestToken = twitter.getOAuthRequestToken();
|
||||
String redirectURL = requestToken.getAuthenticationURL();
|
||||
Intent i = new Intent(Intent.ACTION_VIEW);
|
||||
i.setData(Uri.parse(redirectURL));
|
||||
context.startActivity(i);
|
||||
}
|
||||
if( !(twitterPin[0].isEmpty()) ) {
|
||||
AccessToken accessToken = twitter.getOAuthAccessToken(requestToken, twitterPin[0]);
|
||||
SharedPreferences.Editor e = einstellungen.edit();
|
||||
e.putBoolean("login", true);
|
||||
e.putString("accesstoken", accessToken.getToken());
|
||||
e.putString("accesstokensecret", accessToken.getTokenSecret());
|
||||
e.commit();
|
||||
|
||||
return true;
|
||||
}
|
||||
} catch ( TwitterException e ) {
|
||||
Toast.makeText(context,"Fehler bei der Registrierung",Toast.LENGTH_LONG).show();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
protected void onPostExecute(Boolean result) {
|
||||
if(android.os.Debug.isDebuggerConnected())
|
||||
android.os.Debug.waitForDebugger();
|
||||
if( result ) {
|
||||
loginButton.setVisibility(Button.VISIBLE);
|
||||
verifierButton.setVisibility(Button.INVISIBLE);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,99 @@
|
||||
package org.nuclearfog.twidda.engine;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.AsyncTask;
|
||||
import twitter4j.ResponseList;
|
||||
import twitter4j.Trends;
|
||||
import twitter4j.Twitter;
|
||||
import twitter4j.Status;
|
||||
import twitter4j.TwitterException;
|
||||
import twitter4j.TwitterFactory;
|
||||
import twitter4j.auth.AccessToken;
|
||||
import twitter4j.conf.ConfigurationBuilder;
|
||||
import android.content.SharedPreferences;
|
||||
import android.widget.ListView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.nuclearfog.twidda.LoginActivity;
|
||||
import org.nuclearfog.twidda.R;
|
||||
import org.nuclearfog.twidda.engine.ViewAdapter.TimelineAdapter;
|
||||
import org.nuclearfog.twidda.engine.ViewAdapter.TrendsAdapter;
|
||||
|
||||
public class TwitterEngine extends AsyncTask<Integer, Void, Void>
|
||||
{
|
||||
private final String TWITTER_CONSUMER_KEY = "GrylGIgQK3cDjo9mSTBqF1vwf";
|
||||
private final String TWITTER_CONSUMER_SECRET = "pgaWUlDVS5b7Q6VJQDgBzHKw0mIxJIX0UQBcT1oFJEivsCl5OV";
|
||||
private final String ERR_MSG = "Fehler bei der Verbindung";
|
||||
|
||||
private static Twitter twitter;
|
||||
private List<Object> stats;
|
||||
private Context context;
|
||||
private ListView timeline;
|
||||
private TimelineAdapter timelineAdapter;
|
||||
private TrendsAdapter trendsAdapter;
|
||||
|
||||
public TwitterEngine(Context context, ListView timeline) {
|
||||
this.context=context;
|
||||
this.timeline = timeline;
|
||||
stats = new ArrayList<>();
|
||||
|
||||
if(twitter == null) init();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Void doInBackground(Integer... args) {
|
||||
if(android.os.Debug.isDebuggerConnected())
|
||||
android.os.Debug.waitForDebugger();
|
||||
|
||||
// twitter.getRateLimitStatus();
|
||||
|
||||
try{
|
||||
switch(args[0]) {
|
||||
case (0): // Home Timeline
|
||||
stats.addAll(twitter.getHomeTimeline());
|
||||
timelineAdapter = new TimelineAdapter(context,R.layout.tweet,twitter.getHomeTimeline());
|
||||
break;
|
||||
|
||||
case(1): // Trends
|
||||
stats.addAll(twitter.getAvailableTrends());
|
||||
Trends trend = twitter.getPlaceTrends(1);
|
||||
trendsAdapter = new TrendsAdapter(context,R.layout.tweet,trend.getTrends());
|
||||
break;
|
||||
|
||||
case(2): // Mentions
|
||||
// TODO
|
||||
break;
|
||||
}
|
||||
|
||||
} catch (TwitterException e) {
|
||||
Toast.makeText(context, ERR_MSG, Toast.LENGTH_SHORT).show();
|
||||
} catch (Exception e){ e.printStackTrace(); }
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(Void v) {
|
||||
if(timelineAdapter != null)
|
||||
timeline.setAdapter(timelineAdapter);
|
||||
else if(trendsAdapter != null)
|
||||
timeline.setAdapter(trendsAdapter);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Init Twitter
|
||||
*/
|
||||
private void init() {
|
||||
SharedPreferences einstellungen = context.getSharedPreferences("settings", 0);
|
||||
ConfigurationBuilder builder = new ConfigurationBuilder();
|
||||
builder.setOAuthConsumerKey(TWITTER_CONSUMER_KEY);
|
||||
builder.setOAuthConsumerSecret(TWITTER_CONSUMER_SECRET);
|
||||
String accessToken = einstellungen.getString("accesstoken","");
|
||||
String accessTokenSec = einstellungen.getString("accesstokensecret","");
|
||||
AccessToken token = new AccessToken(accessToken,accessTokenSec);
|
||||
twitter = new TwitterFactory( builder.build() ).getInstance(token);
|
||||
}
|
||||
}
|
@ -0,0 +1,76 @@
|
||||
package org.nuclearfog.twidda.engine.ViewAdapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.TextView;
|
||||
import twitter4j.Status;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.nuclearfog.twidda.R;
|
||||
|
||||
public class TimelineAdapter extends ArrayAdapter {
|
||||
private List<Status> stats;
|
||||
private Context c;
|
||||
private Date now;
|
||||
|
||||
public TimelineAdapter(Context c, int layout, List<Status> stats) {
|
||||
super(c, layout);
|
||||
this.c = c;
|
||||
this.stats = stats;
|
||||
now = new Date();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return stats.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
return stats.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
View v = convertView;
|
||||
if(v == null) {
|
||||
LayoutInflater inf=(LayoutInflater)c.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
v = inf.inflate(R.layout.tweet, null);
|
||||
}
|
||||
Status status = stats.get(position);
|
||||
Date date = status.getCreatedAt();
|
||||
String username = status.getUser().getName();
|
||||
String twittername = status.getUser().getScreenName();
|
||||
String tweet = status.getText();
|
||||
String retweets = Integer.toString(status.getRetweetCount());
|
||||
String favorites = Integer.toString(status.getFavoriteCount());
|
||||
String answers = ""; //TODO
|
||||
String tweetdate = getTweetTime(date);
|
||||
|
||||
((TextView) v.findViewById(R.id.username)).setText(username+" @"+twittername);
|
||||
((TextView) v.findViewById(R.id.tweettext)).setText(tweet);
|
||||
((TextView) v.findViewById(R.id.answer_number)).setText(answers);
|
||||
((TextView) v.findViewById(R.id.retweet_number)).setText(retweets);
|
||||
((TextView) v.findViewById(R.id.favorite_number)).setText(favorites);
|
||||
((TextView) v.findViewById(R.id.time)).setText(tweetdate);
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
private String getTweetTime(Date time) {
|
||||
int tweetHour = now.getHours() - time.getHours();
|
||||
int tweetMin = now.getMinutes() - time.getMinutes();
|
||||
int tweetSec = now.getSeconds() - time.getSeconds();
|
||||
|
||||
if (tweetHour > 0)
|
||||
return "vor "+tweetHour+" h";
|
||||
else if ( tweetMin > 0)
|
||||
return "vor "+tweetMin+" min";
|
||||
else
|
||||
return "vor "+tweetSec+" sec";
|
||||
}
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
package org.nuclearfog.twidda.engine.ViewAdapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.nuclearfog.twidda.R;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import twitter4j.Location;
|
||||
import twitter4j.ResponseList;
|
||||
import twitter4j.Trend;
|
||||
import twitter4j.Trends;
|
||||
|
||||
public class TrendsAdapter extends ArrayAdapter {
|
||||
|
||||
private Trend[] list;
|
||||
private Context c;
|
||||
|
||||
public TrendsAdapter(Context c, int layout, Trend[] list){
|
||||
super(c, layout);
|
||||
this.list = list;
|
||||
this.c = c;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return list.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
return list[position];
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
View v = convertView;
|
||||
if(android.os.Debug.isDebuggerConnected())
|
||||
android.os.Debug.waitForDebugger();
|
||||
|
||||
if(v == null) {
|
||||
LayoutInflater inf=(LayoutInflater)c.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
v = inf.inflate(R.layout.trend, null);
|
||||
}
|
||||
|
||||
String trendName = list[position].getName();
|
||||
((TextView) v.findViewById(R.id.trendname)).setText(trendName);
|
||||
return v;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package org.nuclearfog.twidda.engine.ViewAdapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.ListView;
|
||||
|
||||
public class TwitterListView extends ListView {
|
||||
public TwitterListView(Context c) {
|
||||
super(c);
|
||||
}
|
||||
public TwitterListView(Context c, AttributeSet attributeSet) {
|
||||
super(c, attributeSet);
|
||||
}
|
||||
public TwitterListView(Context c, AttributeSet attributeSet, int defStyle) {
|
||||
super(c, attributeSet, defStyle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMeasure(int width, int heigh) {
|
||||
int expand = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST);
|
||||
super.onMeasure(width, expand);
|
||||
}
|
||||
}
|
BIN
app/src/main/res/drawable/chat.png
Normal file
After Width: | Height: | Size: 9.3 KiB |
BIN
app/src/main/res/drawable/retweet.png
Normal file
After Width: | Height: | Size: 4.5 KiB |
BIN
app/src/main/res/drawable/star.png
Normal file
After Width: | Height: | Size: 10 KiB |
46
app/src/main/res/layout/activity_login.xml
Normal file
@ -0,0 +1,46 @@
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin">
|
||||
|
||||
|
||||
<!-- user name label -->
|
||||
|
||||
<!-- Twitter Login Button -->
|
||||
<Button
|
||||
android:id="@+id/linkButton"
|
||||
android:layout_width="180dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="30dip"
|
||||
android:background="@android:color/darker_gray"
|
||||
android:text="Link zur Anmeldung" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/pin"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="30dip"
|
||||
android:hint="PIN" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/verifier"
|
||||
android:layout_width="180dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="30dp"
|
||||
android:background="@android:color/darker_gray"
|
||||
android:text="Verifizieren" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/loginButton"
|
||||
android:layout_width="180dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@android:color/darker_gray"
|
||||
android:text="Login"
|
||||
android:visibility="invisible" />
|
||||
|
||||
</LinearLayout>
|
68
app/src/main/res/layout/main_layout.xml
Normal file
@ -0,0 +1,68 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/twitterBlau"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TabHost
|
||||
android:id="@+id/tabHost"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="visible">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TabWidget
|
||||
android:id="@android:id/tabs"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@android:id/tabcontent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/timeline"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:elevation="1dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ListView
|
||||
android:id="@+id/timelinelist"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:clickable="true" android:focusable="true"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/trends"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ListView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/mention"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ListView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
</LinearLayout>
|
||||
</FrameLayout>
|
||||
</LinearLayout>
|
||||
</TabHost>
|
||||
|
||||
</LinearLayout>
|
15
app/src/main/res/layout/trend.xml
Normal file
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/twitterBlau"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/trendname"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
98
app/src/main/res/layout/tweet.xml
Normal file
@ -0,0 +1,98 @@
|
||||
<?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"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:background="@color/twitterBlau"
|
||||
android:orientation="vertical"
|
||||
app:layout_collapseMode="none">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/user"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/username"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/time"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="right"
|
||||
android:gravity="right"
|
||||
android:textAlignment="gravity" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView"
|
||||
android:layout_width="64dp"
|
||||
android:layout_height="64dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tweettext"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/actionbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="32dp"
|
||||
android:layout_weight="1"
|
||||
android:addStatesFromChildren="false"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<Button
|
||||
android:id="@+id/answer"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/chat" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/answer_number"
|
||||
android:layout_width="64dp"
|
||||
android:layout_height="match_parent"
|
||||
android:ems="10" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/favorite"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/star" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/favorite_number"
|
||||
android:layout_width="64dp"
|
||||
android:layout_height="match_parent"
|
||||
android:ems="10" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/retweet"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/retweet" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/retweet_number"
|
||||
android:layout_width="64dp"
|
||||
android:layout_height="match_parent"
|
||||
android:ems="10" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
BIN
app/src/main/res/mipmap-hdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 4.7 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 7.5 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 10 KiB |
7
app/src/main/res/values/colors.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="colorPrimary">#3F51B5</color>
|
||||
<color name="colorPrimaryDark">#303F9F</color>
|
||||
<color name="colorAccent">#FF4081</color>
|
||||
<color name="twitterBlau">#061a22</color>
|
||||
</resources>
|
5
app/src/main/res/values/dimens.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<resources>
|
||||
<!-- Default screen margins, per the Android Design guidelines. -->
|
||||
<dimen name="activity_horizontal_margin">16dp</dimen>
|
||||
<dimen name="activity_vertical_margin">16dp</dimen>
|
||||
</resources>
|
10
app/src/main/res/values/strings.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<resources>
|
||||
<string name="app_name">Twidda</string>
|
||||
|
||||
<!-- Strings related to login -->
|
||||
<string name="prompt_token">Pin eingeben</string>
|
||||
<string name="action_sign_in">Login</string>
|
||||
<string name="error_field_required">This field is required</string>
|
||||
|
||||
|
||||
</resources>
|
11
app/src/main/res/values/styles.xml
Normal file
@ -0,0 +1,11 @@
|
||||
<resources>
|
||||
|
||||
<!-- Base application theme. -->
|
||||
<style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">
|
||||
<!-- Customize your theme here. -->
|
||||
<item name="colorPrimary">@color/colorPrimary</item>
|
||||
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||
<item name="colorAccent">@color/colorAccent</item>
|
||||
</style>
|
||||
|
||||
</resources>
|