1
0
Fork 0
mirror of https://github.com/gsantner/dandelion synced 2024-11-22 04:12:08 +01:00

AboutActivity respects intellihide settings, all coordinatorlayouts do now snap, added back button to AboutActivity and SettingsActivity

This commit is contained in:
vanitasvitae 2016-09-05 18:15:29 +02:00
parent 315361e2b2
commit 823ab7b8d8
6 changed files with 42 additions and 22 deletions

View file

@ -18,13 +18,11 @@
*/
package com.github.dfa.diaspora_android.activity;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.support.design.widget.AppBarLayout;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
@ -32,10 +30,10 @@ import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.github.dfa.diaspora_android.App;
@ -55,17 +53,18 @@ public class AboutActivity extends AppCompatActivity {
private SectionsPagerAdapter mSectionsPagerAdapter;
private ViewPager mViewPager;
@BindView(R.id.toolbar)
protected Toolbar toolbar;
@BindView(R.id.linearlayout)
protected LinearLayout linearLayout;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_about);
registerReceiver(new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
Log.d("INTREC", intent.toString());
}
}, new IntentFilter(Intent.ACTION_VIEW));
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
ButterKnife.bind(this);
setSupportActionBar(toolbar);
toolbar.setNavigationIcon(getResources().getDrawable(R.drawable.ic_arrow_back_white_24px));
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@ -84,6 +83,12 @@ public class AboutActivity extends AppCompatActivity {
TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs);
tabLayout.setupWithViewPager(mViewPager);
//Apply intellihide
if(!((App)getApplication()).getSettings().isIntellihideToolbars()) {
AppBarLayout.LayoutParams params = (AppBarLayout.LayoutParams) linearLayout.getLayoutParams();
params.setScrollFlags(0);
}
}
/**

View file

@ -29,22 +29,44 @@ import android.preference.Preference;
import android.preference.PreferenceActivity;
import android.preference.PreferenceFragment;
import android.preference.PreferenceScreen;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.MenuItem;
import android.view.View;
import com.github.dfa.diaspora_android.App;
import com.github.dfa.diaspora_android.R;
import butterknife.OnEditorAction;
/**
* @author vanitas
*/
public class SettingsActivity extends PreferenceActivity {
public class SettingsActivity extends AppCompatActivity {
private boolean activityRestartRequired;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ActionBar toolbar = getSupportActionBar();
if(toolbar != null)
toolbar.setDisplayHomeAsUpEnabled(true);
getFragmentManager().beginTransaction().replace(android.R.id.content, new SettingsFragment()).commit();
}
@Override
public boolean onOptionsItemSelected(MenuItem menuItem)
{
switch (menuItem.getItemId()) {
case android.R.id.home:
onBackPressed();
return true;
default:
return super.onOptionsItemSelected(menuItem);
}
}
private void setActivityRestartRequired() {
this.activityRestartRequired = true;
}

View file

@ -17,9 +17,10 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/linearlayout"
android:orientation="vertical"
android:background="?attr/colorPrimary"
app:layout_scrollFlags="scroll|enterAlways"
app:layout_scrollFlags="scroll|enterAlways|snap"
app:popupTheme="@style/AppTheme.PopupOverlay">
<android.support.v7.widget.Toolbar

View file

@ -17,7 +17,7 @@
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:layout_scrollFlags="scroll|enterAlways"
app:layout_scrollFlags="scroll|enterAlways|snap"
app:popupTheme="@style/AppTheme.PopupOverlay" />
</android.support.design.widget.AppBarLayout>

View file

@ -14,8 +14,6 @@
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentEnd="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentStart="true"
android:layout_centerVertical="true" />

View file

@ -45,9 +45,7 @@
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_toEndOf="@+id/textView"
android:layout_toLeftOf="@+id/podselection__button_select_pod"
android:layout_toStartOf="@+id/podselection__button_select_pod"
android:layout_toRightOf="@+id/textView"
android:hint="@string/filter_hint"
android:inputType="textUri|textWebEditText" />
@ -57,7 +55,6 @@
android:layout_height="wrap_content"
android:layout_above="@+id/podselection__listpods"
android:layout_alignEnd="@+id/podselection__listpods"
android:layout_alignRight="@+id/podselection__listpods"
android:layout_alignTop="@+id/podselection__edit_filter"
android:contentDescription="@string/confirm_url"
android:paddingLeft="5dp"
@ -69,7 +66,6 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:autoLink="web"
android:text="@string/podlist_source_note"
@ -80,11 +76,9 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/podselection__listpods"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginEnd="0dp"
android:layout_marginRight="0dp"
android:gravity="center_vertical"
android:text="@string/prefix_https"
android:textAppearance="?android:attr/textAppearanceMedium" />