Code Cleanup
This commit is contained in:
NudeDude 2018-02-23 12:42:44 +01:00
parent 6654c2c335
commit 2bbe615d57
5 changed files with 84 additions and 76 deletions

View File

@ -7,6 +7,7 @@ import android.support.design.widget.AppBarLayout;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
@ -116,35 +117,27 @@ public class UserProfile extends AppCompatActivity implements View.OnClickListen
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
switch(parent.getId()) {
case R.id.ht_list:
if(!homeReload.isRefreshing()) {
TimelineAdapter tlAdp = (TimelineAdapter) homeTweets.getAdapter();
TweetDatabase twDB = tlAdp.getData();
long tweetID = twDB.getTweetId(position);
long userID = twDB.getUserID(position);
Intent intent = new Intent(getApplicationContext(), TweetDetail.class);
Bundle bundle = new Bundle();
bundle.putLong("tweetID",tweetID);
bundle.putLong("userID",userID);
intent.putExtras(bundle);
startActivity(intent);
}
break;
case R.id.hf_list:
if(!favoriteReload.isRefreshing()) {
TimelineAdapter tlAdp = (TimelineAdapter) homeFavorits.getAdapter();
TweetDatabase twDB = tlAdp.getData();
long tweetID = twDB.getTweetId(position);
long userID = twDB.getUserID(position);
Intent intent = new Intent(getApplicationContext(), TweetDetail.class);
Bundle bundle = new Bundle();
bundle.putLong("tweetID",tweetID);
bundle.putLong("userID",userID);
intent.putExtras(bundle);
startActivity(intent);
}
break;
TimelineAdapter tlAdp;
if(parent.getId() == R.id.ht_list) {
tlAdp = (TimelineAdapter) homeTweets.getAdapter();
}
else {
tlAdp = (TimelineAdapter) homeFavorits.getAdapter();
}
if(position >= tlAdp.getCount()) {
} else {
TweetDatabase twDB = tlAdp.getData();
long tweetID = twDB.getTweetId(position);
long userID = twDB.getUserID(position);
Intent intent = new Intent(getApplicationContext(), TweetDetail.class);
Bundle bundle = new Bundle();
bundle.putLong("tweetID",tweetID);
bundle.putLong("userID",userID);
intent.putExtras(bundle);
startActivity(intent);
}
}
@ -169,13 +162,16 @@ public class UserProfile extends AppCompatActivity implements View.OnClickListen
currentTab = tabId;
}
/**
* Deaktiviert
*/
@Override
public void onOffsetChanged(AppBarLayout mBar, int high) {
int max = - mBar.getTotalScrollRange();
if(high == max) {
homeTweets.setNestedScrollingEnabled(true);
homeFavorits.setNestedScrollingEnabled(true);
} else {
} else if (high == 0) {
homeTweets.setNestedScrollingEnabled(false);
homeFavorits.setNestedScrollingEnabled(false);
}

View File

@ -0,0 +1,4 @@
<vector android:height="24dp" android:viewportHeight="20.0"
android:viewportWidth="20.0" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FFFFFF" android:pathData="M4.516,7.548c0.436,-0.446 1.043,-0.481 1.576,0L10,11.295l3.908,-3.747c0.533,-0.481 1.141,-0.446 1.574,0c0.436,0.445 0.408,1.197 0,1.615c-0.406,0.418 -4.695,4.502 -4.695,4.502C10.57,13.888 10.285,14 10,14s-0.57,-0.112 -0.789,-0.335c0,0 -4.287,-4.084 -4.695,-4.502C4.107,8.745 4.08,7.993 4.516,7.548z"/>
</vector>

View File

@ -0,0 +1,15 @@
<?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="64dp"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:id="@+id/downarrow"
android:layout_width="32dp"
android:layout_height="32dp"
android:contentDescription="@string/downarrow"
app:srcCompat="@drawable/downarrow" />
</LinearLayout>

View File

@ -7,7 +7,7 @@
android:fitsSystemWindows="true">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:id="@+id/tweetwindow"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
@ -94,57 +94,49 @@
android:linksClickable="false"
android:textSize="12sp" />
<TableLayout
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:orientation="horizontal">
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/tweet_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:contentDescription="@string/tweet_image"
app:srcCompat="@android:color/black" />
<ImageView
android:id="@+id/tweet_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:layout_weight="1"
android:contentDescription="@string/tweet_image"
app:srcCompat="@android:color/black" />
<ImageView
android:id="@+id/tweet_image2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:contentDescription="@string/tweet_image"
app:srcCompat="@android:color/black" />
</LinearLayout>
<ImageView
android:id="@+id/tweet_image2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:layout_weight="1"
android:contentDescription="@string/tweet_image"
app:srcCompat="@android:color/black" />
</TableRow>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/tweet_image3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:contentDescription="@string/tweet_image"
app:srcCompat="@android:color/black" />
<ImageView
android:id="@+id/tweet_image3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:layout_weight="1"
android:contentDescription="@string/tweet_image"
app:srcCompat="@android:color/black" />
<ImageView
android:id="@+id/tweet_image4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:layout_weight="1"
android:contentDescription="@string/tweet_image"
app:srcCompat="@android:color/black" />
</TableRow>
</TableLayout>
<ImageView
android:id="@+id/tweet_image4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:contentDescription="@string/tweet_image"
app:srcCompat="@android:color/black" />
</LinearLayout>
</LinearLayout>

View File

@ -39,4 +39,5 @@
<string name="verify">Verifiziert</string>
<string name="yes_confirm">Ja</string>
<string name="no_confirm">Nein</string>
<string name="downarrow">Pfeil nach unten</string>
</resources>