update protype
This commit is contained in:
		
							parent
							
								
									b8eeffda23
								
							
						
					
					
						commit
						be44e336d3
					
				|  | @ -87,38 +87,25 @@ | |||
|       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/annotation_processor_list" /> | ||||
|       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/apk_list" /> | ||||
|       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" /> | ||||
|       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/build-info" /> | ||||
|       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundle_manifest" /> | ||||
|       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/check_manifest_result" /> | ||||
|       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/compatible_screen_manifest" /> | ||||
|       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex" /> | ||||
|       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/external_libs_dex" /> | ||||
|       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" /> | ||||
|       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-runtime-classes" /> | ||||
|       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-verifier" /> | ||||
|       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant-run-apk" /> | ||||
|       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant_app_manifest" /> | ||||
|       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant_run_app_info_output_file" /> | ||||
|       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant_run_main_apk_resources" /> | ||||
|       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant_run_merged_manifests" /> | ||||
|       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant_run_split_apk_resources" /> | ||||
|       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/javac" /> | ||||
|       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" /> | ||||
|       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/lint_jar" /> | ||||
|       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifest-checker" /> | ||||
|       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/merged_assets" /> | ||||
|       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/merged_manifests" /> | ||||
|       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/metadata_feature_manifest" /> | ||||
|       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/prebuild" /> | ||||
|       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/processed_res" /> | ||||
|       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/reload-dex" /> | ||||
|       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" /> | ||||
|       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/resources" /> | ||||
|       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" /> | ||||
|       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/shader_assets" /> | ||||
|       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/shaders" /> | ||||
|       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/signing_config" /> | ||||
|       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/split-apk" /> | ||||
|       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" /> | ||||
|       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/transforms" /> | ||||
|       <excludeFolder url="file://$MODULE_DIR$/build/outputs" /> | ||||
|  |  | |||
|  | @ -15,11 +15,41 @@ | |||
|         android:theme="@style/ToolBarTheme" | ||||
|         android:usesCleartextTraffic="true"> | ||||
|         <activity | ||||
|             android:name=".Main5Activity" | ||||
|             android:label="@string/title_activity_main5"> | ||||
|             android:name=".Main7Activity" | ||||
|             android:label="@string/title_activity_main7" | ||||
|             android:theme="@style/ToolBarTheme.NoActionBar"> | ||||
|             <meta-data | ||||
|                 android:name="android.support.PARENT_ACTIVITY" | ||||
|                 android:value=".Activity_paihangbang" /> | ||||
|             <!-- meta tag and intent filter go into results activity --> | ||||
|             <meta-data android:name="android.app.searchable" | ||||
|                 android:resource="@xml/searchable" /> | ||||
|             <intent-filter> | ||||
|                 <action android:name="android.intent.action.SEARCH" /> | ||||
|             </intent-filter> | ||||
| 
 | ||||
| 
 | ||||
|         </activity> | ||||
|         <activity | ||||
|             android:name=".ScrollingActivity" | ||||
|             android:label="@string/title_activity_scrolling" | ||||
|             android:theme="@style/ToolBarTheme.NoActionBar" /> | ||||
|         <activity | ||||
|             android:name=".Main6Activity" | ||||
|             android:label="@string/title_activity_main6" | ||||
|             android:parentActivityName=".Main2Activity" | ||||
|             android:theme="@style/ToolBarTheme.NoActionBar" /> | ||||
|         <activity | ||||
|             android:name=".Activity_paihangbang" | ||||
|             android:label="@string/title_activity_paihangbang" | ||||
|             android:parentActivityName=".Main2Activity" | ||||
|             android:theme="@style/ToolBarTheme.NoActionBar"  > | ||||
|             <meta-data android:name="android.app.default_searchable" | ||||
|                 android:value=".Main7Activity"/> | ||||
|         </activity> | ||||
|         <activity | ||||
|             android:name=".Main5Activity" | ||||
|             android:label="@string/title_activity_main5" /> | ||||
|         <activity | ||||
|             android:name=".BookActivity" | ||||
|             android:label="@string/title_activity_book" | ||||
|  | @ -35,6 +65,8 @@ | |||
| 
 | ||||
|                 <category android:name="android.intent.category.LAUNCHER" /> | ||||
|             </intent-filter> | ||||
|             <meta-data android:name="android.app.default_searchable" | ||||
|                 android:value=".Main7Activity"/> | ||||
|         </activity> | ||||
|     </application> | ||||
| 
 | ||||
|  |  | |||
|  | @ -0,0 +1,147 @@ | |||
| package com.deiniu.zhuike; | ||||
| 
 | ||||
| import android.app.SearchManager; | ||||
| import android.content.Context; | ||||
| import android.content.Intent; | ||||
| import android.graphics.Color; | ||||
| import android.os.Build; | ||||
| import android.os.Bundle; | ||||
| import android.support.design.widget.FloatingActionButton; | ||||
| import android.support.design.widget.Snackbar; | ||||
| import android.support.v4.app.Fragment; | ||||
| import android.support.v4.app.FragmentPagerAdapter; | ||||
| import android.support.v4.view.ViewPager; | ||||
| import android.support.v7.app.AppCompatActivity; | ||||
| import android.support.v7.widget.SearchView; | ||||
| import android.support.v7.widget.Toolbar; | ||||
| import android.util.Log; | ||||
| import android.view.Menu; | ||||
| import android.view.MenuItem; | ||||
| import android.view.View; | ||||
| import android.view.Window; | ||||
| import android.view.WindowManager; | ||||
| import android.widget.LinearLayout; | ||||
| import android.widget.Toast; | ||||
| 
 | ||||
| import com.flyco.tablayout.SlidingTabLayout; | ||||
| 
 | ||||
| import java.lang.reflect.Field; | ||||
| import java.util.ArrayList; | ||||
| 
 | ||||
| import butterknife.BindView; | ||||
| import butterknife.ButterKnife; | ||||
| 
 | ||||
| public class Activity_paihangbang extends AppCompatActivity { | ||||
| public static String TAG ="com.deiniu.zhuike.paihangbang"; | ||||
|     @Override | ||||
|     protected void onCreate(Bundle savedInstanceState) { | ||||
|         super.onCreate(savedInstanceState); | ||||
| 
 | ||||
|         setContentView(R.layout.activity_paihangbang); | ||||
|         ButterKnife.bind(this); | ||||
|         Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); | ||||
|         setSupportActionBar(toolbar); | ||||
|         getSupportActionBar().setDisplayHomeAsUpEnabled(true); | ||||
|         if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { | ||||
|             WindowManager.LayoutParams localLayoutParams = getWindow().getAttributes(); | ||||
|             localLayoutParams.flags = (WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS | localLayoutParams.flags); | ||||
| 
 | ||||
|         } | ||||
| 
 | ||||
|         String title = getIntent().getStringExtra("BANGNAME"); | ||||
|         title+="榜"; | ||||
|         this.setTitle(title); | ||||
|         initTabs(); | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
|     //---------tabs------------- | ||||
|     @BindView(R.id.viewpager) | ||||
|     ViewPager mViewpager; | ||||
|     @BindView(R.id.tab_layout) | ||||
|     SlidingTabLayout tabLayout; | ||||
| 
 | ||||
|     private ArrayList<Fragment> mFragments; | ||||
|     ArrayList<View> mList; | ||||
|     String[] mTitle; | ||||
|     void initTabs() { | ||||
| 
 | ||||
|         if(mFragments ==null || mFragments.size() ==0){ | ||||
|             mTitle = new String[]{"周榜", "月榜", "总榜"}; | ||||
|             mFragments = new ArrayList<>(); | ||||
|             mFragments.add(new Fragment_shudan_list()); | ||||
|             mFragments.add(new Fragment_shudan_list()); | ||||
|             mFragments.add(new Fragment_shudan_list()); | ||||
| 
 | ||||
|         } | ||||
|         Log.d(TAG,"set viewPager adapter "); | ||||
|         FragmentPagerAdapter mAdapter = new FragmentPagerAdapter(getSupportFragmentManager()) { | ||||
|             @Override | ||||
|             public Fragment getItem(int position) { | ||||
|                 return mFragments.get(position); | ||||
|             } | ||||
| 
 | ||||
|             @Override | ||||
|             public int getCount() { | ||||
|                 return mFragments.size(); | ||||
|             } | ||||
|             //ViewPager与TabLayout绑定后,这里获取到PageTitle就是Tab的Text | ||||
|             @Override | ||||
|             public CharSequence getPageTitle(int position) { | ||||
|                 return mTitle[position]; | ||||
|             } | ||||
|         }; | ||||
|         mViewpager.setAdapter(mAdapter); | ||||
|         tabLayout.setViewPager(mViewpager); | ||||
|         //  tabLayout.setViewPager(mViewpager, mTitle, activity, mFragments); | ||||
|         mViewpager.setCurrentItem(0); | ||||
|     } | ||||
| //---search option | ||||
| 
 | ||||
|     @Override | ||||
|     public boolean onCreateOptionsMenu(Menu menu) { | ||||
|         // Inflate the menu; this adds items to the action bar if it is present. | ||||
|         getMenuInflater().inflate(R.menu.menu_search, menu); | ||||
|         // Get the SearchView and set the searchable configuration | ||||
|         SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); | ||||
|         SearchView searchView = (SearchView) menu.findItem(R.id.search).getActionView(); | ||||
|         // Assumes current activity is the searchable activity | ||||
|         searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName())); | ||||
| 
 | ||||
|         /*searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener(){ | ||||
|             @Override | ||||
|             public boolean onQueryTextSubmit(String query) { | ||||
|                 Log.i(TAG,query); | ||||
|                 Toast.makeText(Activity_paihangbang.this,query,Toast.LENGTH_SHORT).show(); | ||||
|                 return false; | ||||
|             } | ||||
| 
 | ||||
|             @Override | ||||
|             public boolean onQueryTextChange(String newText) { | ||||
|                 return false; | ||||
|             } | ||||
|         }); | ||||
|         */ | ||||
|         return true; | ||||
| 
 | ||||
| 
 | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public boolean onOptionsItemSelected(MenuItem item) { | ||||
|         // Handle action bar item clicks here. The action bar will | ||||
|         // automatically handle clicks on the Home/Up button, so long | ||||
|         // as you specify a parent activity in AndroidManifest.xml. | ||||
|         int id = item.getItemId(); | ||||
| 
 | ||||
|         //noinspection SimplifiableIfStatement | ||||
|         if (id == R.id.action_settings) { | ||||
|             return true; | ||||
|         } | ||||
| 
 | ||||
|         return super.onOptionsItemSelected(item); | ||||
|     } | ||||
| } | ||||
|  | @ -2,11 +2,13 @@ package com.deiniu.zhuike; | |||
| 
 | ||||
| 
 | ||||
| import android.content.Context; | ||||
| import android.content.Intent; | ||||
| import android.content.res.Resources; | ||||
| import android.net.Uri; | ||||
| import android.os.Bundle; | ||||
| import android.support.design.widget.TabLayout; | ||||
| import android.support.v4.app.Fragment; | ||||
| import android.support.v4.app.FragmentActivity; | ||||
| import android.support.v4.app.FragmentManager; | ||||
| import android.support.v4.app.FragmentTransaction; | ||||
| import android.support.v7.widget.RecyclerView; | ||||
|  | @ -17,6 +19,7 @@ import android.view.View; | |||
| import android.view.ViewGroup; | ||||
| import android.widget.LinearLayout; | ||||
| import android.widget.TextView; | ||||
| import android.widget.Toast; | ||||
| 
 | ||||
| import java.lang.reflect.Field; | ||||
| import java.util.ArrayList; | ||||
|  | @ -32,7 +35,8 @@ import butterknife.ButterKnife; | |||
| public abstract class BasicFragment extends Fragment { | ||||
|     protected OnFragmentInteractionListener mListener; | ||||
|     public static String TAG = "need to be replaced"; | ||||
|     Main2Activity activity; | ||||
|    // Main2Activity activity; | ||||
|     FragmentActivity activity; | ||||
|     public BasicFragment() { | ||||
|         // Required empty public constructor | ||||
|     } | ||||
|  | @ -41,7 +45,8 @@ public abstract class BasicFragment extends Fragment { | |||
|         super.onCreate(savedInstanceState); | ||||
|         setFTag(); | ||||
|        // Log.d(TAG,"fragment onCreate "); | ||||
|         activity =(Main2Activity)getActivity(); | ||||
|        // activity =(Main2Activity)getActivity(); | ||||
|         activity = getActivity(); | ||||
| 
 | ||||
| 
 | ||||
|         //			 QLog.getLogger().e(dTAG,TAG+" "+ "onCreate"); | ||||
|  | @ -66,12 +71,7 @@ public abstract class BasicFragment extends Fragment { | |||
|     @Override | ||||
|     public void onAttach(Context context) { | ||||
|         super.onAttach(context); | ||||
|         if (context instanceof OnFragmentInteractionListener) { | ||||
|             mListener = (OnFragmentInteractionListener) context; | ||||
|         } else { | ||||
|             throw new RuntimeException(context.toString() | ||||
|                     + " must implement OnFragmentInteractionListener"); | ||||
|         } | ||||
| 
 | ||||
|     } | ||||
| 
 | ||||
|     public interface OnFragmentInteractionListener { | ||||
|  | @ -229,6 +229,17 @@ public abstract class BasicFragment extends Fragment { | |||
|         } | ||||
|         return  mDatas; | ||||
|     } | ||||
|     void showBookDetail(String bookId) { | ||||
| 
 | ||||
|         Toast.makeText(activity, bookId + " 即将加载",  Toast.LENGTH_SHORT).show(); | ||||
| 
 | ||||
| 
 | ||||
|         Intent intent = new Intent(activity, BookActivity.class); | ||||
|         intent.putExtra("BOOKNAME",bookId); | ||||
|         startActivity(intent); | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
| //-------------------------------------------------------------------------------------book list adapter end-------------------------------------------------- | ||||
| 
 | ||||
| 
 | ||||
|  |  | |||
|  | @ -89,8 +89,8 @@ public class Fragment_Shelf extends BasicFragment { | |||
|             @Override | ||||
|             public void onItemClick(View view, int position) | ||||
|             { | ||||
|                 Toast.makeText(activity, position + " click", | ||||
|                         Toast.LENGTH_SHORT).show(); | ||||
|                 showBookDetail( mDatas.get(position)); | ||||
| 
 | ||||
|             } | ||||
| 
 | ||||
|             @Override | ||||
|  | @ -105,6 +105,8 @@ public class Fragment_Shelf extends BasicFragment { | |||
| 
 | ||||
|             } | ||||
|         }); | ||||
| 
 | ||||
|         ((Main2Activity)  activity).fragment_shelf=this; | ||||
|     } | ||||
| 
 | ||||
|     @BindView(R.id.id_recyclerview) | ||||
|  | @ -162,7 +164,17 @@ public class Fragment_Shelf extends BasicFragment { | |||
|             mDatas.add("射雕" + (char) i); | ||||
|         } | ||||
|     } | ||||
|     public void showShelfMoreSheet() { | ||||
|         BottomSheetDialog bottomSheetDialog = new BottomSheetDialog(this.activity ); | ||||
|         bottomSheetDialog.setContentView(R.layout.fragment_shelf_more_sheet); | ||||
| //给布局设置透明背景色 | ||||
|         bottomSheetDialog.getDelegate().findViewById(android.support.design.R.id.design_bottom_sheet) | ||||
|                 .setBackgroundColor(getResources().getColor(android.R.color.transparent)); | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|         bottomSheetDialog.show(); | ||||
|     } | ||||
|     private void initDialog(int position) { | ||||
| 
 | ||||
|         BottomSheetDialog bottomSheetDialog = new BottomSheetDialog(this.activity); | ||||
|  | @ -185,6 +197,7 @@ public class Fragment_Shelf extends BasicFragment { | |||
| 
 | ||||
|         // Refresh the state of the +1 button each time the activity receives focus. | ||||
| 
 | ||||
|        // ((Main2Activity)getActivity()).swithToolbarItems(); | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
|  |  | |||
|  | @ -80,8 +80,8 @@ public class Fragment_bangdan extends BasicFragment { | |||
|             @Override | ||||
|             public void onItemClick(View view, int position) | ||||
|             { | ||||
|                 Toast.makeText(activity, position + " click", | ||||
|                         Toast.LENGTH_SHORT).show(); | ||||
| 
 | ||||
|                 showBookDetail( mData.get(position)); | ||||
|             } | ||||
| 
 | ||||
|             @Override | ||||
|  | @ -92,8 +92,8 @@ public class Fragment_bangdan extends BasicFragment { | |||
|             } | ||||
|             @Override | ||||
|             public void onLinearOutClick(View view, int bookId) { | ||||
|                 Toast.makeText(activity, "book "+ bookId + " clicked", | ||||
|                         Toast.LENGTH_SHORT).show(); | ||||
|               //  Toast.makeText(activity, "book "+ bookId + " clicked", Toast.LENGTH_SHORT).show(); | ||||
|                 showBookDetail( mData.get(bookId)); | ||||
|             } | ||||
|         }); | ||||
|     } | ||||
|  | @ -234,7 +234,7 @@ public class Fragment_bangdan extends BasicFragment { | |||
|                     @Override | ||||
|                     public void onClick(View v) | ||||
|                     { | ||||
|                         int pos = 1+position; | ||||
|                         int pos = position; | ||||
|                         mOnItemClickLitener.onLinearOutClick(holder.itemView, pos); | ||||
|                     } | ||||
|                 }); | ||||
|  | @ -243,7 +243,7 @@ public class Fragment_bangdan extends BasicFragment { | |||
|                     @Override | ||||
|                     public void onClick(View v) | ||||
|                     { | ||||
|                         int pos = 2+position; | ||||
|                         int pos =  position; | ||||
|                         mOnItemClickLitener.onLinearOutClick(holder.itemView, pos); | ||||
|                     } | ||||
|                 }); | ||||
|  | @ -252,7 +252,7 @@ public class Fragment_bangdan extends BasicFragment { | |||
|                     @Override | ||||
|                     public void onClick(View v) | ||||
|                     { | ||||
|                         int pos = 3+position; | ||||
|                         int pos = position; | ||||
|                         mOnItemClickLitener.onLinearOutClick(holder.itemView, pos); | ||||
|                     } | ||||
|                 }); | ||||
|  |  | |||
|  | @ -16,9 +16,11 @@ import android.view.LayoutInflater; | |||
| import android.view.View; | ||||
| import android.view.ViewGroup; | ||||
| import android.widget.ImageView; | ||||
| import android.widget.LinearLayout; | ||||
| import android.widget.Toast; | ||||
| 
 | ||||
| import com.bumptech.glide.Glide; | ||||
| import com.deiniu.zhuike.utils.CyclePageIndicator; | ||||
| import com.deiniu.zhuike.utils.MyViewPager; | ||||
| import com.youth.banner.Banner; | ||||
| import com.youth.banner.BannerConfig; | ||||
|  | @ -50,7 +52,15 @@ public class Fragment_jingxuan extends BasicFragment implements OnBannerListener | |||
|     // TODO: Rename and change types of parameters | ||||
|     private String mParam1; | ||||
|     private String mParam2; | ||||
|     @BindView(R.id.llTuijian) | ||||
|     LinearLayout llTuijian; | ||||
|     @BindView(R.id.banner) | ||||
|     Banner banner; | ||||
|     //  @BindView(R.id.banner2) | ||||
|     // Banner banner2; | ||||
| 
 | ||||
|     private ArrayList<String> list_path; | ||||
|     private ArrayList<String> list_title; | ||||
| 
 | ||||
|     public Fragment_jingxuan() { | ||||
|         // Required empty public constructor | ||||
|  | @ -92,30 +102,38 @@ public class Fragment_jingxuan extends BasicFragment implements OnBannerListener | |||
|     public View onCreateView(LayoutInflater inflater, ViewGroup container, | ||||
|                              Bundle savedInstanceState) { | ||||
|         // Inflate the layout for this fragment | ||||
|         Log.d(TAG," Fragment_jingxuan onCreateView"); | ||||
|         View v= inflater.inflate(R.layout.fragment_jingxuan, container, false); | ||||
|         Log.d(TAG, " Fragment_jingxuan onCreateView"); | ||||
|         View v = inflater.inflate(R.layout.fragment_jingxuan, container, false); | ||||
|         ButterKnife.bind(this, v); | ||||
|         testBanner(banner,this); | ||||
|        // testBanner2(banner2,new BannerListioner2()); | ||||
|         testBanner(banner, this); | ||||
|         // testBanner2(banner2,new BannerListioner2()); | ||||
| 
 | ||||
|         initTuijianPagers(); | ||||
|         initialBookList(); | ||||
|         return  v; | ||||
| 
 | ||||
|         llTuijian.setOnClickListener(new View.OnClickListener() { | ||||
|             @Override | ||||
|             public void onClick(View v) { | ||||
|                 showPaihangbang("推荐"); | ||||
| 
 | ||||
|             } | ||||
|         }); | ||||
|         return v; | ||||
|     } | ||||
| 
 | ||||
|     private void showPaihangbang(String type) { | ||||
| 
 | ||||
|         Intent intent = new Intent(activity, Activity_paihangbang.class); | ||||
|         intent.putExtra("BANGNAME",type); | ||||
|         startActivity(intent); | ||||
| 
 | ||||
|     } | ||||
|     @Override | ||||
|     public void setFTag() { | ||||
|         TAG ="com.deiniu.zhuike.Fragment_jingxuan"; | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
|     @BindView(R.id.banner) | ||||
|     Banner banner; | ||||
|   //  @BindView(R.id.banner2) | ||||
|    // Banner banner2; | ||||
| 
 | ||||
|     private ArrayList<String> list_path; | ||||
|     private ArrayList<String> list_title; | ||||
|     void testBanner(Banner banner,OnBannerListener listioner) { | ||||
| 
 | ||||
|         //放图片地址的集合 | ||||
|  | @ -174,6 +192,8 @@ public class Fragment_jingxuan extends BasicFragment implements OnBannerListener | |||
|     //cycle viewpagers | ||||
| 
 | ||||
|     //---------重磅推荐------------- | ||||
|     @BindView(R.id.dot_horizontal) | ||||
|     LinearLayout cyclell; | ||||
|     @BindView(R.id.viewpager_tuijian) | ||||
|     MyViewPager mViewpagerTuijian; | ||||
|    //@BindView(R.id.titleIndictator) | ||||
|  | @ -212,7 +232,7 @@ public class Fragment_jingxuan extends BasicFragment implements OnBannerListener | |||
|           //  } | ||||
|         }; | ||||
|         mViewpagerTuijian.setAdapter(mAdapter); | ||||
| 
 | ||||
|         mViewpagerTuijian.addOnPageChangeListener(new CyclePageIndicator(getContext(), cyclell, 3)); | ||||
| 
 | ||||
|     } | ||||
| 
 | ||||
|  | @ -386,15 +406,6 @@ public class Fragment_jingxuan extends BasicFragment implements OnBannerListener | |||
|         mFinishedData_g=initData(mFinishedData_g,'G'); | ||||
|     } | ||||
| 
 | ||||
|     void showBookDetail(String bookId) { | ||||
| 
 | ||||
|         Toast.makeText(activity, bookId + " 即将加载",  Toast.LENGTH_SHORT).show(); | ||||
| 
 | ||||
| 
 | ||||
|         Intent intent = new Intent(activity, BookActivity.class); | ||||
|         intent.putExtra("BOOKNAME",bookId); | ||||
|         startActivity(intent); | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|  |  | |||
|  | @ -85,8 +85,7 @@ public class Fragment_paihang extends BasicFragment { | |||
| 
 | ||||
|             @Override | ||||
|             public void onItemClick(View view, int position) { | ||||
|                 Toast.makeText(activity, position + " click", | ||||
|                         Toast.LENGTH_SHORT).show(); | ||||
|                 showBookDetail( mData.get(position)); | ||||
|             } | ||||
| 
 | ||||
|             @Override | ||||
|  |  | |||
|  | @ -125,7 +125,7 @@ public class Fragment_shudan_list    extends BasicFragment { | |||
|     RecyclerView rvShudan; | ||||
|     private void initData() { | ||||
| 
 | ||||
|         mData =initData(mData,'G'); | ||||
|         mData =initData(mData,'Z'); | ||||
|     } | ||||
|     void initialBookList() { | ||||
| 
 | ||||
|  |  | |||
|  | @ -1,11 +1,13 @@ | |||
| package com.deiniu.zhuike; | ||||
| 
 | ||||
| import android.app.SearchManager; | ||||
| import android.content.Context; | ||||
| import android.net.Uri; | ||||
| import android.nfc.Tag; | ||||
| import android.os.Bundle; | ||||
| import android.support.annotation.NonNull; | ||||
| import android.support.design.widget.BottomNavigationView; | ||||
| import android.support.design.widget.BottomSheetDialog; | ||||
| import android.support.design.widget.FloatingActionButton; | ||||
| import android.support.design.widget.Snackbar; | ||||
| import android.support.v4.app.Fragment; | ||||
|  | @ -13,6 +15,8 @@ import android.support.v4.app.FragmentManager; | |||
| import android.support.v4.app.FragmentTransaction; | ||||
| import android.support.v4.view.PagerAdapter; | ||||
| import android.support.v4.view.ViewPager; | ||||
| import android.support.v7.widget.AppCompatSpinner; | ||||
| import android.support.v7.widget.SearchView; | ||||
| import android.util.Log; | ||||
| import android.view.KeyEvent; | ||||
| import android.view.View; | ||||
|  | @ -25,6 +29,9 @@ import android.support.v7.widget.Toolbar; | |||
| import android.view.Menu; | ||||
| import android.view.MenuItem; | ||||
| import android.view.ViewGroup; | ||||
| import android.view.Window; | ||||
| import android.widget.Button; | ||||
| import android.widget.ImageButton; | ||||
| import android.widget.ImageView; | ||||
| import android.widget.TextView; | ||||
| import android.widget.Toast; | ||||
|  | @ -48,35 +55,37 @@ import butterknife.ButterKnife; | |||
| public class Main2Activity extends AppCompatActivity | ||||
|         implements NavigationView.OnNavigationItemSelectedListener , BasicFragment.OnFragmentInteractionListener { | ||||
|     public MyApp app  ; | ||||
| 
 | ||||
|    public static String TAG ="com.deiniu.zhuike.Main2Activity"; | ||||
|     @BindView(R.id.toolbar) | ||||
|     Toolbar toolbar; | ||||
|     @BindView(R.id.fab) | ||||
|     FloatingActionButton fab ; | ||||
| 
 | ||||
| 
 | ||||
|    // @BindView(R.id.fab) | ||||
|   //  FloatingActionButton fab ; | ||||
|     @BindView(R.id.nav_view ) | ||||
|     NavigationView navigationView; | ||||
|     @BindView(R.id.navigation ) | ||||
|     BottomNavigationView botoomNavigation; | ||||
| 
 | ||||
|     @Override | ||||
|     protected void onCreate(Bundle savedInstanceState) { | ||||
|         super.onCreate(savedInstanceState); | ||||
|        // requestWindowFeature(Window.FEATURE_CUSTOM_TITLE); | ||||
|         setContentView(R.layout.activity_main2); | ||||
|        // getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE,R.layout.activity_title_layout); | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|         ButterKnife.bind(this); | ||||
|         creatToolbar(); | ||||
| 
 | ||||
|       //  FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); | ||||
|         fab.setOnClickListener(new View.OnClickListener() { | ||||
|             @Override | ||||
|             public void onClick(View view) { | ||||
|                 Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG) | ||||
|                         .setAction("Action", null).show(); | ||||
|             } | ||||
|         }); | ||||
|         setupNavi(); | ||||
|      //   botoomNavigation.setSelectedItemId(botoomNavigation.getMenu().getItem(2).getItemId()); | ||||
| 
 | ||||
| 
 | ||||
|         NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); | ||||
|         navigationView.setNavigationItemSelectedListener(this); | ||||
|        showHome(); | ||||
|        //  initTabs(); | ||||
|         showHome(); | ||||
|         //swithToolbarItems(); | ||||
|         // showBookStore(); | ||||
| 
 | ||||
|         //  initTabs(); | ||||
| 
 | ||||
| 
 | ||||
|      //  banner = (Banner) findViewById(R.id.banner); | ||||
|  | @ -86,6 +95,7 @@ public class Main2Activity extends AppCompatActivity | |||
| 
 | ||||
|         getDataFromServer(); | ||||
| 
 | ||||
| 
 | ||||
|     } | ||||
| 
 | ||||
|     String currentActiveFragment; | ||||
|  | @ -98,8 +108,6 @@ public class Main2Activity extends AppCompatActivity | |||
|         if (findViewById(R.id.realtabcontent) != null) { //realtabcontent | ||||
| 
 | ||||
|             ft.replace(R.id.realtabcontent, fragment,fragmentTag); | ||||
|             // //			 QLog.getLogger().d(dTAG, " before commit,getSupportFragmentManager().findFragmentByTag: "+fragmentTag 		    		+", result is:"+getSupportFragmentManager().findFragmentByTag(fragmentTag)); | ||||
|        //   Fragment lastFragmeng =  getSupportFragmentManager().findFragmentByTag(  currentActiveFragment); | ||||
| 
 | ||||
|             ft.addToBackStack(null); //add to backstack. | ||||
| 
 | ||||
|  | @ -113,74 +121,71 @@ public class Main2Activity extends AppCompatActivity | |||
|                // Utils.logStackTrace(e, dTAG); | ||||
|             } | ||||
|         } | ||||
|         //  ft.show(bmapview_fragment); | ||||
| 
 | ||||
|          currentActiveFragment =fragmentTag; | ||||
| // 		ft.setTransition(2500);//TRANSIT_FRAGMENT_OPEN | ||||
|         ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN); | ||||
| //		ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE); | ||||
| //					ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_CLOSE); | ||||
| //			ft.setTransition(FragmentTransaction.TRANSIT_EXIT_MASK); | ||||
| //			ft.setTransition(FragmentTransaction.TRANSIT_ENTER_MASK); | ||||
| //			ft.setTransition(FragmentTransaction.TRANSIT_UNSET); | ||||
| //							ft.setTransition(FragmentTransaction.TRANSIT_EXIT_MASK); | ||||
| //		ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_CLOSE); | ||||
| //		ft.setTransition(FragmentTransaction.TRANSIT_NONE); | ||||
| 
 | ||||
| //		 ft.commit(); | ||||
|         ft.commitAllowingStateLoss(); | ||||
| //		 fm.executePendingTransactions(); | ||||
| 
 | ||||
| 
 | ||||
|         // //			 QLog.getLogger().d(dTAG, " after commit,getSupportFragmentManager().findFragmentByTag: "+fragmentTag +", result is:"+getSupportFragmentManager().findFragmentByTag(fragmentTag)); | ||||
| //		 Fragment frgmnt =  getSupportFragmentManager().findFragmentByTag(fragmentTag); | ||||
| //		 int i=0; | ||||
| //		 i++; | ||||
| //		 i++; | ||||
| 
 | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
|     private ActionBarDrawerToggle toggle; | ||||
|     private void creatToolbar() { | ||||
| 
 | ||||
|         //  toolbar= (Toolbar) findViewById(R.id.toolbar); | ||||
|         //setSupportActionBar(toolbar); | ||||
|           setSupportActionBar(toolbar); | ||||
|         //  toolbar.setNavigationIcon(R.mipmap.ic_launcher_round);//设置导航栏图标 | ||||
|         //   toolbar.setLogo(R.mipmap.ic_launcher);//设置app logo | ||||
|      //  toolbar.setTitle("Title");//设置主标题 | ||||
|     //    setTitle("title"); | ||||
|         setTitle("titleaa"); | ||||
|       //  toolbar.setSubtitle("Subtitle");//设置子标题 | ||||
| 
 | ||||
|         toolbar.inflateMenu(R.menu.main);//设置右上角的填充菜单 | ||||
|        toolbar.inflateMenu(R.menu.main);//设置右上角的填充菜单 | ||||
|         toolbar.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() { | ||||
|             @Override | ||||
|             public boolean onMenuItemClick(MenuItem item) { | ||||
|                 int menuItemId = item.getItemId(); | ||||
|                 if (menuItemId == R.id.menu_1) { | ||||
|                     Toast.makeText(Main2Activity.this , R.string.test, Toast.LENGTH_SHORT).show(); | ||||
| 
 | ||||
|                 } else if (menuItemId == R.id.menu_2) { | ||||
|                     Toast.makeText( Main2Activity.this , R.string.test , Toast.LENGTH_SHORT).show(); | ||||
| 
 | ||||
|                 } else if (menuItemId == R.id.menu_3) { | ||||
|                     Toast.makeText( Main2Activity.this , R.string.test , Toast.LENGTH_SHORT).show(); | ||||
| 
 | ||||
|                 } else if (menuItemId == R.id.menu_4) { | ||||
|                 if (menuItemId == R.id.menuFenlei) { | ||||
|                     Toast.makeText( Main2Activity.this , R.string.test , Toast.LENGTH_SHORT).show(); | ||||
| 
 | ||||
|                 }else if(menuItemId == R.id.menuMore) { | ||||
|                     showShelfMoreSheet(); | ||||
|                 } | ||||
|                 return true; | ||||
|             } | ||||
|         }); | ||||
|      //   mTextMessage = (TextView) findViewById(R.id.message); | ||||
|         BottomNavigationView navigation = (BottomNavigationView) findViewById(R.id.navigation); | ||||
|         navigation.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener); | ||||
|     } | ||||
| 
 | ||||
|     Fragment_Shelf fragment_shelf; | ||||
|     private void showShelfMoreSheet() { | ||||
|       { | ||||
|           if(fragment_shelf!=null) | ||||
|           fragment_shelf.showShelfMoreSheet(); | ||||
| 
 | ||||
|         } | ||||
| 
 | ||||
|     } | ||||
| 
 | ||||
|     void setupNavi() { | ||||
| 
 | ||||
|         //drawer | ||||
|           navigationView = (NavigationView) findViewById(R.id.nav_view); | ||||
|         navigationView.setNavigationItemSelectedListener(this); | ||||
|         DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); | ||||
|         ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( | ||||
|          toggle = new ActionBarDrawerToggle( | ||||
|                 this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); | ||||
|         drawer.addDrawerListener(toggle); | ||||
|         toggle.syncState(); | ||||
| 
 | ||||
|         //   mTextMessage = (TextView) findViewById(R.id.message); | ||||
|         botoomNavigation = (BottomNavigationView) findViewById(R.id.navigation); | ||||
|         botoomNavigation.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener); | ||||
| 
 | ||||
| 
 | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public void onBackPressed() { | ||||
|         DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); | ||||
|  | @ -194,7 +199,11 @@ public class Main2Activity extends AppCompatActivity | |||
|     @Override | ||||
|     public boolean onCreateOptionsMenu(Menu menu) { | ||||
|         // Inflate the menu; this adds items to the action bar if it is present. | ||||
|         getMenuInflater().inflate(R.menu.main2, menu); | ||||
|         getMenuInflater().inflate(R.menu.main, menu); | ||||
|         SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); | ||||
|         SearchView searchView = (SearchView) menu.findItem(R.id.menuSearch).getActionView(); | ||||
|         // Assumes current activity is the searchable activity | ||||
|         searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName())); | ||||
|         return true; | ||||
|     } | ||||
| 
 | ||||
|  | @ -246,13 +255,16 @@ public class Main2Activity extends AppCompatActivity | |||
|             switch (item.getItemId()) { | ||||
|                 case R.id.navigation_home: | ||||
|                     //mTextMessage.setText(R.string.title_home); | ||||
|                     bottomSelectedIndex =0; | ||||
|                     showHome(); | ||||
|                     return true; | ||||
|                 case R.id.navigation_dashboard: | ||||
|                   //  mTextMessage.setText(R.string.title_dashboard); | ||||
|                     bottomSelectedIndex=1; | ||||
|                     showBookStore(); | ||||
|                     return true; | ||||
|                 case R.id.navigation_notifications: | ||||
|                     bottomSelectedIndex=2; | ||||
|                    // mTextMessage.setText(R.string.title_notifications); | ||||
|                     showPaihang(); | ||||
|                     return true; | ||||
|  | @ -261,6 +273,58 @@ public class Main2Activity extends AppCompatActivity | |||
|             return false; | ||||
|         } | ||||
|     }; | ||||
| @BindView(R.id.sexSelect) | ||||
| AppCompatSpinner spinner; | ||||
| @BindView(R.id.toolbarTitle) | ||||
| TextView txtTitle; | ||||
| private  int bottomSelectedIndex; | ||||
| 
 | ||||
|     public  void swithToolbarItems( ) { | ||||
| 
 | ||||
|         Log.e( TAG, "swithToolbarItems: " ); | ||||
|         boolean showToggle =bottomSelectedIndex !=1; | ||||
|         boolean showSpinner = bottomSelectedIndex ==1; | ||||
|         boolean showTitle = bottomSelectedIndex !=1; | ||||
|         String title =  bottomSelectedIndex==0?"我的书架":"排行榜"; | ||||
| 
 | ||||
|         toggle.setDrawerIndicatorEnabled(showToggle); | ||||
|         toggle.syncState(); | ||||
| 
 | ||||
|         spinner.setVisibility( showSpinner?View.VISIBLE:View.INVISIBLE); | ||||
| 
 | ||||
|         supportInvalidateOptionsMenu(); | ||||
|         //invalidateOptionsMenu(); | ||||
| 
 | ||||
|         if(bottomSelectedIndex==1) { | ||||
|           title =""; | ||||
|         } | ||||
| 
 | ||||
|          this.setTitle(title); | ||||
| 
 | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public boolean onPrepareOptionsMenu(Menu menu) { | ||||
|         Log.e(TAG, "onPrepareOptionsMenu"); | ||||
| 
 | ||||
|        // menu.findItem(R.id.menuSearch).setVisible(true); | ||||
|         if(bottomSelectedIndex==0) { | ||||
|             menu.findItem(R.id.menuFenlei).setVisible(false); | ||||
|             menu.findItem(R.id.menuMore).setVisible(true); | ||||
| 
 | ||||
| 
 | ||||
|         }else if(bottomSelectedIndex==1) { | ||||
|             menu.findItem(R.id.menuFenlei).setVisible(true); | ||||
|             menu.findItem(R.id.menuMore).setVisible(false); | ||||
| 
 | ||||
|         }else if(bottomSelectedIndex==2) { | ||||
|             menu.findItem(R.id.menuFenlei).setVisible(false); | ||||
|             menu.findItem(R.id.menuMore).setVisible(false); | ||||
| 
 | ||||
|         } | ||||
| 
 | ||||
|         return super.onPrepareOptionsMenu(menu); | ||||
|     } | ||||
| 
 | ||||
|     private void showHome() { | ||||
| 
 | ||||
|  | @ -268,6 +332,8 @@ public class Main2Activity extends AppCompatActivity | |||
|                 .findFragmentByTag(Fragment_Shelf.getFTag()); | ||||
|         if(fragment_Shelf==null) fragment_Shelf =new Fragment_Shelf(); | ||||
|         showFragment(fragment_Shelf,Fragment_Shelf.getFTag()); | ||||
|          swithToolbarItems(); | ||||
| 
 | ||||
| 
 | ||||
|     } | ||||
|     private void showBookStore() { | ||||
|  | @ -275,12 +341,16 @@ public class Main2Activity extends AppCompatActivity | |||
|                 .findFragmentByTag(Fragment_bookStore.getFTag()); | ||||
|         if(fragment ==null) fragment  =new Fragment_bookStore(); | ||||
|         showFragment(fragment ,Fragment_bookStore.getFTag()); | ||||
|           swithToolbarItems(); | ||||
| 
 | ||||
| 
 | ||||
|     } | ||||
|     private void showOther() { | ||||
|         Fragment_other fragment = (Fragment_other) getSupportFragmentManager() | ||||
|                 .findFragmentByTag(Fragment_other.getFTag()); | ||||
|         if(fragment ==null) fragment  =new Fragment_other(); | ||||
|         showFragment(fragment ,Fragment_other.getFTag()); | ||||
|          showFragment(fragment ,Fragment_other.getFTag()); | ||||
| 
 | ||||
|     } | ||||
| 
 | ||||
|     private void showPaihang(){ | ||||
|  | @ -289,6 +359,7 @@ public class Main2Activity extends AppCompatActivity | |||
|                 .findFragmentByTag(Fragment_paihang.getFTag()); | ||||
|         if(fragment ==null) fragment  =new Fragment_paihang(); | ||||
|         showFragment(fragment ,Fragment_other.getFTag()); | ||||
|           swithToolbarItems( ); | ||||
| 
 | ||||
|     } | ||||
| 
 | ||||
|  | @ -372,7 +443,12 @@ public class Main2Activity extends AppCompatActivity | |||
|         } | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
| @Override | ||||
|     public void onResume() { | ||||
|     super.onResume(); | ||||
|    // swithToolbarItems( ); | ||||
|    // setTitle("title on resume"); | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|  |  | |||
|  | @ -0,0 +1,138 @@ | |||
| package com.deiniu.zhuike; | ||||
| 
 | ||||
| import android.support.design.widget.FloatingActionButton; | ||||
| import android.support.design.widget.Snackbar; | ||||
| import android.support.v7.app.AppCompatActivity; | ||||
| import android.support.v7.widget.Toolbar; | ||||
| 
 | ||||
| import android.support.v4.app.Fragment; | ||||
| import android.support.v4.app.FragmentManager; | ||||
| import android.support.v4.app.FragmentPagerAdapter; | ||||
| import android.support.v4.view.ViewPager; | ||||
| import android.os.Bundle; | ||||
| import android.view.LayoutInflater; | ||||
| import android.view.Menu; | ||||
| import android.view.MenuItem; | ||||
| import android.view.View; | ||||
| import android.view.ViewGroup; | ||||
| 
 | ||||
| import android.widget.TextView; | ||||
| 
 | ||||
| public class Main6Activity extends AppCompatActivity { | ||||
| 
 | ||||
|     /** | ||||
|      * The {@link android.support.v4.view.PagerAdapter} that will provide | ||||
|      * fragments for each of the sections. We use a | ||||
|      * {@link FragmentPagerAdapter} derivative, which will keep every | ||||
|      * loaded fragment in memory. If this becomes too memory intensive, it | ||||
|      * may be best to switch to a | ||||
|      * {@link android.support.v4.app.FragmentStatePagerAdapter}. | ||||
|      */ | ||||
|     private SectionsPagerAdapter mSectionsPagerAdapter; | ||||
| 
 | ||||
|     /** | ||||
|      * The {@link ViewPager} that will host the section contents. | ||||
|      */ | ||||
|     private ViewPager mViewPager; | ||||
| 
 | ||||
|     @Override | ||||
|     protected void onCreate(Bundle savedInstanceState) { | ||||
|         super.onCreate(savedInstanceState); | ||||
|         setContentView(R.layout.activity_main6); | ||||
| 
 | ||||
|         Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); | ||||
|         setSupportActionBar(toolbar); | ||||
|         // Create the adapter that will return a fragment for each of the three | ||||
|         // primary sections of the activity. | ||||
|         mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager()); | ||||
| 
 | ||||
|         // Set up the ViewPager with the sections adapter. | ||||
|         mViewPager = (ViewPager) findViewById(R.id.container); | ||||
|         mViewPager.setAdapter(mSectionsPagerAdapter); | ||||
| 
 | ||||
|        // getSupportActionBar().setDisplayHomeAsUpEnabled(true); | ||||
| 
 | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
|     @Override | ||||
|     public boolean onCreateOptionsMenu(Menu menu) { | ||||
|         // Inflate the menu; this adds items to the action bar if it is present. | ||||
|         getMenuInflater().inflate(R.menu.menu_main6, menu); | ||||
|         return true; | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public boolean onOptionsItemSelected(MenuItem item) { | ||||
|         // Handle action bar item clicks here. The action bar will | ||||
|         // automatically handle clicks on the Home/Up button, so long | ||||
|         // as you specify a parent activity in AndroidManifest.xml. | ||||
|         int id = item.getItemId(); | ||||
| 
 | ||||
|         //noinspection SimplifiableIfStatement | ||||
|         if (id == R.id.action_settings) { | ||||
|             return true; | ||||
|         } | ||||
| 
 | ||||
|         return super.onOptionsItemSelected(item); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * A placeholder fragment containing a simple view. | ||||
|      */ | ||||
|     public static class PlaceholderFragment extends Fragment { | ||||
|         /** | ||||
|          * The fragment argument representing the section number for this | ||||
|          * fragment. | ||||
|          */ | ||||
|         private static final String ARG_SECTION_NUMBER = "section_number"; | ||||
| 
 | ||||
|         public PlaceholderFragment() { | ||||
|         } | ||||
| 
 | ||||
|         /** | ||||
|          * Returns a new instance of this fragment for the given section | ||||
|          * number. | ||||
|          */ | ||||
|         public static PlaceholderFragment newInstance(int sectionNumber) { | ||||
|             PlaceholderFragment fragment = new PlaceholderFragment(); | ||||
|             Bundle args = new Bundle(); | ||||
|             args.putInt(ARG_SECTION_NUMBER, sectionNumber); | ||||
|             fragment.setArguments(args); | ||||
|             return fragment; | ||||
|         } | ||||
| 
 | ||||
|         @Override | ||||
|         public View onCreateView(LayoutInflater inflater, ViewGroup container, | ||||
|                                  Bundle savedInstanceState) { | ||||
|             View rootView = inflater.inflate(R.layout.fragment_main6, container, false); | ||||
|             TextView textView = (TextView) rootView.findViewById(R.id.section_label); | ||||
|             textView.setText(getString(R.string.section_format, getArguments().getInt(ARG_SECTION_NUMBER))); | ||||
|             return rootView; | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * A {@link FragmentPagerAdapter} that returns a fragment corresponding to | ||||
|      * one of the sections/tabs/pages. | ||||
|      */ | ||||
|     public class SectionsPagerAdapter extends FragmentPagerAdapter { | ||||
| 
 | ||||
|         public SectionsPagerAdapter(FragmentManager fm) { | ||||
|             super(fm); | ||||
|         } | ||||
| 
 | ||||
|         @Override | ||||
|         public Fragment getItem(int position) { | ||||
|             // getItem is called to instantiate the fragment for the given page. | ||||
|             // Return a PlaceholderFragment (defined as a static inner class below). | ||||
|             return PlaceholderFragment.newInstance(position + 1); | ||||
|         } | ||||
| 
 | ||||
|         @Override | ||||
|         public int getCount() { | ||||
|             // Show 3 total pages. | ||||
|             return 3; | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | @ -0,0 +1,161 @@ | |||
| package com.deiniu.zhuike; | ||||
| 
 | ||||
| import android.graphics.Color; | ||||
| import android.support.design.widget.FloatingActionButton; | ||||
| import android.support.design.widget.Snackbar; | ||||
| import android.support.v7.app.AppCompatActivity; | ||||
| import android.support.v7.widget.Toolbar; | ||||
| 
 | ||||
| import android.support.v4.app.Fragment; | ||||
| import android.support.v4.app.FragmentManager; | ||||
| import android.support.v4.app.FragmentPagerAdapter; | ||||
| import android.support.v4.view.ViewPager; | ||||
| import android.os.Bundle; | ||||
| import android.view.LayoutInflater; | ||||
| import android.view.Menu; | ||||
| import android.view.MenuItem; | ||||
| import android.view.View; | ||||
| import android.view.ViewGroup; | ||||
| 
 | ||||
| import android.widget.TextView; | ||||
| 
 | ||||
| import java.lang.reflect.Field; | ||||
| 
 | ||||
| public class Main7Activity extends AppCompatActivity { | ||||
| 
 | ||||
|     /** | ||||
|      * The {@link android.support.v4.view.PagerAdapter} that will provide | ||||
|      * fragments for each of the sections. We use a | ||||
|      * {@link FragmentPagerAdapter} derivative, which will keep every | ||||
|      * loaded fragment in memory. If this becomes too memory intensive, it | ||||
|      * may be best to switch to a | ||||
|      * {@link android.support.v4.app.FragmentStatePagerAdapter}. | ||||
|      */ | ||||
|     private SectionsPagerAdapter mSectionsPagerAdapter; | ||||
| 
 | ||||
|     /** | ||||
|      * The {@link ViewPager} that will host the section contents. | ||||
|      */ | ||||
|     private ViewPager mViewPager; | ||||
| 
 | ||||
|     @Override | ||||
|     protected void onCreate(Bundle savedInstanceState) { | ||||
|         super.onCreate(savedInstanceState); | ||||
|        // if (android.os.Build.VERSION.SDK_INT >= 21) | ||||
|         { | ||||
|             //解决Android5.0以上,状态栏设置颜色后变灰的问题 | ||||
| 
 | ||||
|           //  getWindow().setStatusBarColor(Color.TRANSPARENT); | ||||
|             try { | ||||
|                 Class decorViewClazz = Class.forName("com.android.internal.policy.DecorView"); | ||||
|                 Field field = decorViewClazz.getDeclaredField("mSemiTransparentStatusBarColor"); | ||||
|                 field.setAccessible(true); | ||||
|                 field.setInt(getWindow().getDecorView(), Color.TRANSPARENT);  //设置透明 | ||||
|             } catch (Exception e) { } | ||||
|         } | ||||
|         setContentView(R.layout.activity_main7); | ||||
| 
 | ||||
|         Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); | ||||
|         setSupportActionBar(toolbar); | ||||
|         // Create the adapter that will return a fragment for each of the three | ||||
|         // primary sections of the activity. | ||||
|         mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager()); | ||||
| 
 | ||||
|         // Set up the ViewPager with the sections adapter. | ||||
|         mViewPager = (ViewPager) findViewById(R.id.container); | ||||
|         mViewPager.setAdapter(mSectionsPagerAdapter); | ||||
| 
 | ||||
|         FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); | ||||
|         fab.setOnClickListener(new View.OnClickListener() { | ||||
|             @Override | ||||
|             public void onClick(View view) { | ||||
|                 Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG) | ||||
|                         .setAction("Action", null).show(); | ||||
|             } | ||||
|         }); | ||||
| 
 | ||||
| 
 | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
|     @Override | ||||
|     public boolean onCreateOptionsMenu(Menu menu) { | ||||
|         // Inflate the menu; this adds items to the action bar if it is present. | ||||
|         getMenuInflater().inflate(R.menu.menu_main7, menu); | ||||
|         return true; | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public boolean onOptionsItemSelected(MenuItem item) { | ||||
|         // Handle action bar item clicks here. The action bar will | ||||
|         // automatically handle clicks on the Home/Up button, so long | ||||
|         // as you specify a parent activity in AndroidManifest.xml. | ||||
|         int id = item.getItemId(); | ||||
| 
 | ||||
|         //noinspection SimplifiableIfStatement | ||||
|         if (id == R.id.action_settings) { | ||||
|             return true; | ||||
|         } | ||||
| 
 | ||||
|         return super.onOptionsItemSelected(item); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * A placeholder fragment containing a simple view. | ||||
|      */ | ||||
|     public static class PlaceholderFragment extends Fragment { | ||||
|         /** | ||||
|          * The fragment argument representing the section number for this | ||||
|          * fragment. | ||||
|          */ | ||||
|         private static final String ARG_SECTION_NUMBER = "section_number"; | ||||
| 
 | ||||
|         public PlaceholderFragment() { | ||||
|         } | ||||
| 
 | ||||
|         /** | ||||
|          * Returns a new instance of this fragment for the given section | ||||
|          * number. | ||||
|          */ | ||||
|         public static PlaceholderFragment newInstance(int sectionNumber) { | ||||
|             PlaceholderFragment fragment = new PlaceholderFragment(); | ||||
|             Bundle args = new Bundle(); | ||||
|             args.putInt(ARG_SECTION_NUMBER, sectionNumber); | ||||
|             fragment.setArguments(args); | ||||
|             return fragment; | ||||
|         } | ||||
| 
 | ||||
|         @Override | ||||
|         public View onCreateView(LayoutInflater inflater, ViewGroup container, | ||||
|                                  Bundle savedInstanceState) { | ||||
|             View rootView = inflater.inflate(R.layout.fragment_main7, container, false); | ||||
|             TextView textView = (TextView) rootView.findViewById(R.id.section_label); | ||||
|             textView.setText(getString(R.string.section_format, getArguments().getInt(ARG_SECTION_NUMBER))); | ||||
|             return rootView; | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * A {@link FragmentPagerAdapter} that returns a fragment corresponding to | ||||
|      * one of the sections/tabs/pages. | ||||
|      */ | ||||
|     public class SectionsPagerAdapter extends FragmentPagerAdapter { | ||||
| 
 | ||||
|         public SectionsPagerAdapter(FragmentManager fm) { | ||||
|             super(fm); | ||||
|         } | ||||
| 
 | ||||
|         @Override | ||||
|         public Fragment getItem(int position) { | ||||
|             // getItem is called to instantiate the fragment for the given page. | ||||
|             // Return a PlaceholderFragment (defined as a static inner class below). | ||||
|             return PlaceholderFragment.newInstance(position + 1); | ||||
|         } | ||||
| 
 | ||||
|         @Override | ||||
|         public int getCount() { | ||||
|             // Show 3 total pages. | ||||
|             return 3; | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | @ -69,16 +69,7 @@ public class MainActivity extends AppCompatActivity { | |||
|             @Override | ||||
|             public boolean onMenuItemClick(MenuItem item) { | ||||
|                 int menuItemId = item.getItemId(); | ||||
|                 if (menuItemId == R.id.menu_1) { | ||||
|                     Toast.makeText(MainActivity.this , R.string.test, Toast.LENGTH_SHORT).show(); | ||||
| 
 | ||||
|                 } else if (menuItemId == R.id.menu_2) { | ||||
|                     Toast.makeText( MainActivity.this , R.string.test , Toast.LENGTH_SHORT).show(); | ||||
| 
 | ||||
|                 } else if (menuItemId == R.id.menu_3) { | ||||
|                     Toast.makeText( MainActivity.this , R.string.test , Toast.LENGTH_SHORT).show(); | ||||
| 
 | ||||
|                 } else if (menuItemId == R.id.menu_4) { | ||||
|                  if (menuItemId == R.id.menuFenlei) { | ||||
|                     Toast.makeText( MainActivity.this , R.string.test , Toast.LENGTH_SHORT).show(); | ||||
| 
 | ||||
|                 } | ||||
|  |  | |||
|  | @ -0,0 +1,28 @@ | |||
| package com.deiniu.zhuike; | ||||
| 
 | ||||
| import android.os.Bundle; | ||||
| import android.support.design.widget.FloatingActionButton; | ||||
| import android.support.design.widget.Snackbar; | ||||
| import android.support.v7.app.AppCompatActivity; | ||||
| import android.support.v7.widget.Toolbar; | ||||
| import android.view.View; | ||||
| 
 | ||||
| public class ScrollingActivity extends AppCompatActivity { | ||||
| 
 | ||||
|     @Override | ||||
|     protected void onCreate(Bundle savedInstanceState) { | ||||
|         super.onCreate(savedInstanceState); | ||||
|         setContentView(R.layout.activity_scrolling); | ||||
|         Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); | ||||
|         setSupportActionBar(toolbar); | ||||
| 
 | ||||
|         FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); | ||||
|         fab.setOnClickListener(new View.OnClickListener() { | ||||
|             @Override | ||||
|             public void onClick(View view) { | ||||
|                 Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG) | ||||
|                         .setAction("Action", null).show(); | ||||
|             } | ||||
|         }); | ||||
|     } | ||||
| } | ||||
|  | @ -0,0 +1,68 @@ | |||
| package com.deiniu.zhuike.utils; | ||||
| 
 | ||||
| import android.content.Context; | ||||
| import android.support.v4.view.ViewPager; | ||||
| import android.view.ViewGroup; | ||||
| import android.widget.ImageView; | ||||
| import android.widget.LinearLayout; | ||||
| 
 | ||||
| import com.deiniu.zhuike.R; | ||||
| 
 | ||||
| import java.util.ArrayList; | ||||
| import java.util.List; | ||||
| 
 | ||||
| public class CyclePageIndicator  implements ViewPager.OnPageChangeListener { | ||||
|         private int mPageCount;//页数 | ||||
|         private List<ImageView> mImgList;//保存img总个数 | ||||
|         private int img_select; | ||||
|         private int img_unSelect; | ||||
| 
 | ||||
|         public CyclePageIndicator(Context context, LinearLayout linearLayout, int pageCount) { | ||||
|             this.mPageCount = pageCount; | ||||
| 
 | ||||
|             mImgList = new ArrayList<>(); | ||||
|             img_select = R.drawable.cyle_indicator_selected; | ||||
|             img_unSelect = R.drawable.cycle_indicator_unselected; | ||||
|             final int imgSize = 25; | ||||
| 
 | ||||
|             for (int i = 0; i < mPageCount; i++) { | ||||
|                 ImageView imageView = new ImageView(context); | ||||
|                 LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(new ViewGroup.LayoutParams( | ||||
|                         ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)); | ||||
|                 //为小圆点左右添加间距 | ||||
|                 params.leftMargin = 10; | ||||
|                 params.rightMargin = 10; | ||||
|                 //给小圆点一个默认大小 | ||||
|                 params.height = imgSize; | ||||
|                 params.width = imgSize; | ||||
|                 if (i == 0) { | ||||
|                     imageView.setBackgroundResource(img_select); | ||||
|                 } else { | ||||
|                     imageView.setBackgroundResource(img_unSelect); | ||||
|                 } | ||||
|                 //为LinearLayout添加ImageView | ||||
|                 linearLayout.addView(imageView, params); | ||||
|                 mImgList.add(imageView); | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|         @Override | ||||
|         public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {} | ||||
| 
 | ||||
|         @Override | ||||
|         public void onPageSelected(int position) { | ||||
|             for (int i = 0; i < mPageCount; i++) { | ||||
|                 //选中的页面改变小圆点为选中状态,反之为未选中 | ||||
|                 if ((position % mPageCount) == i) { | ||||
|                     (mImgList.get(i)).setBackgroundResource(img_select); | ||||
|                 } else { | ||||
|                     (mImgList.get(i)).setBackgroundResource(img_unSelect); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|         @Override | ||||
|         public void onPageScrollStateChanged(int state) {} | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
|  | @ -0,0 +1,5 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <shape xmlns:android="http://schemas.android.com/apk/res/android"> | ||||
|     <solid android:color="@color/lightgray" /> | ||||
|     <corners android:radius="1000dp" /> | ||||
| </shape> | ||||
|  | @ -0,0 +1,8 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <shape xmlns:android="http://schemas.android.com/apk/res/android"> | ||||
|      <solid android:color="@color/crimson" /> | ||||
|     <corners android:radius="1000dp" /> | ||||
|  </shape> | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|  | @ -12,6 +12,8 @@ | |||
| 
 | ||||
|         android:layout_width="match_parent" | ||||
|         android:layout_height="match_parent" | ||||
| 
 | ||||
|         android:clipToPadding="false" | ||||
|         android:fitsSystemWindows="true" | ||||
|     android:layout_weight="1" | ||||
|         > | ||||
|  |  | |||
|  | @ -0,0 +1,54 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||||
|     xmlns:app="http://schemas.android.com/apk/res-auto" | ||||
|     xmlns:tools="http://schemas.android.com/tools" | ||||
|     android:id="@+id/main_content" | ||||
|     android:layout_width="match_parent" | ||||
|     android:layout_height="match_parent" | ||||
|     android:fitsSystemWindows="true" | ||||
|     tools:context=".Main6Activity"> | ||||
| 
 | ||||
|     <android.support.design.widget.AppBarLayout | ||||
|         android:id="@+id/appbar" | ||||
|         android:layout_width="match_parent" | ||||
|         android:layout_height="wrap_content" | ||||
|         android:paddingTop="@dimen/appbar_padding_top" | ||||
|         android:theme="@style/ToolBarTheme.AppBarOverlay"> | ||||
| 
 | ||||
|         <android.support.v7.widget.Toolbar | ||||
|             android:id="@+id/toolbar" | ||||
|             android:layout_width="match_parent" | ||||
|             android:layout_height="?attr/actionBarSize" | ||||
|             android:layout_weight="1" | ||||
|             android:background="?attr/colorPrimary" | ||||
|             app:layout_scrollFlags="scroll|enterAlways" | ||||
|             app:popupTheme="@style/ToolBarTheme.PopupOverlay" | ||||
|             app:title="@string/app_name"> | ||||
| 
 | ||||
|         </android.support.v7.widget.Toolbar> | ||||
| 
 | ||||
|     </android.support.design.widget.AppBarLayout> | ||||
| 
 | ||||
|     <com.flyco.tablayout.SlidingTabLayout | ||||
|         android:id="@+id/tab_layout" | ||||
|         android:layout_width="match_parent" | ||||
|         android:layout_height="40dp" | ||||
|         android:background="@color/white" | ||||
|         app:tl_indicator_color="@color/crimson" | ||||
|         app:tl_indicator_corner_radius="1.5dp" | ||||
|         app:tl_indicator_height="2dp" | ||||
|         app:tl_indicator_width="45dp" | ||||
|         app:tl_textSelectColor="@color/crimson" | ||||
|         app:tl_textUnselectColor="@color/grey" | ||||
|         app:tl_tab_space_equal ="true" | ||||
|         android:layout_marginTop="?attr/actionBarSize" | ||||
|         /> | ||||
|     <android.support.v4.view.ViewPager | ||||
|         android:id="@+id/container" | ||||
|         android:layout_width="match_parent" | ||||
|         android:layout_height="match_parent" | ||||
|         app:layout_behavior="@string/appbar_scrolling_view_behavior" /> | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| </android.support.design.widget.CoordinatorLayout> | ||||
|  | @ -0,0 +1,46 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||||
|     xmlns:app="http://schemas.android.com/apk/res-auto" | ||||
|     xmlns:tools="http://schemas.android.com/tools" | ||||
|     android:id="@+id/main_content" | ||||
|     android:layout_width="match_parent" | ||||
|     android:layout_height="match_parent" | ||||
|     android:fitsSystemWindows="true" | ||||
|     tools:context=".Main7Activity"> | ||||
| 
 | ||||
|     <android.support.design.widget.AppBarLayout | ||||
|         android:id="@+id/appbar" | ||||
|         android:layout_width="match_parent" | ||||
|         android:layout_height="wrap_content" | ||||
|         android:paddingTop="@dimen/appbar_padding_top" | ||||
|         android:theme="@style/ToolBarTheme.AppBarOverlay"> | ||||
| 
 | ||||
|         <android.support.v7.widget.Toolbar | ||||
|             android:id="@+id/toolbar" | ||||
|             android:layout_width="match_parent" | ||||
|             android:layout_height="?attr/actionBarSize" | ||||
|             android:layout_weight="1" | ||||
|             android:background="?attr/colorPrimary" | ||||
|             app:layout_scrollFlags="scroll|enterAlways" | ||||
|             app:popupTheme="@style/ToolBarTheme.PopupOverlay" | ||||
|             app:title="@string/app_name"> | ||||
| 
 | ||||
|         </android.support.v7.widget.Toolbar> | ||||
| 
 | ||||
|     </android.support.design.widget.AppBarLayout> | ||||
| 
 | ||||
|     <android.support.v4.view.ViewPager | ||||
|         android:id="@+id/container" | ||||
|         android:layout_width="match_parent" | ||||
|         android:layout_height="match_parent" | ||||
|         app:layout_behavior="@string/appbar_scrolling_view_behavior" /> | ||||
| 
 | ||||
|     <android.support.design.widget.FloatingActionButton | ||||
|         android:id="@+id/fab" | ||||
|         android:layout_width="wrap_content" | ||||
|         android:layout_height="wrap_content" | ||||
|         android:layout_gravity="end|bottom" | ||||
|         android:layout_margin="@dimen/fab_margin" | ||||
|         app:srcCompat="@android:drawable/ic_dialog_email" /> | ||||
| 
 | ||||
| </android.support.design.widget.CoordinatorLayout> | ||||
|  | @ -0,0 +1,33 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||||
|     xmlns:app="http://schemas.android.com/apk/res-auto" | ||||
|     xmlns:tools="http://schemas.android.com/tools" | ||||
|     android:layout_width="match_parent" | ||||
|     android:layout_height="match_parent" | ||||
|     tools:context=".Activity_paihangbang" | ||||
|     android:fitsSystemWindows="true" | ||||
|     android:clipToPadding="true" | ||||
|      > | ||||
| <!-- 即toolbar悬浮在statusbar之后 https://blog.csdn.net/zafir6453/article/details/51344241--> | ||||
|     <android.support.design.widget.AppBarLayout | ||||
|         android:layout_width="match_parent" | ||||
|         android:layout_height="wrap_content" | ||||
|         android:paddingTop="22dp" | ||||
|         android:fitsSystemWindows="true" | ||||
|         android:theme="@style/ToolBarTheme.AppBarOverlay"> | ||||
| 
 | ||||
|         <android.support.v7.widget.Toolbar | ||||
|             android:id="@+id/toolbar" | ||||
|             android:layout_width="match_parent" | ||||
|             android:layout_height="?attr/actionBarSize" | ||||
|             android:background="?attr/colorPrimary" | ||||
|             app:popupTheme="@style/ToolBarTheme.PopupOverlay" | ||||
| 
 | ||||
|             /> | ||||
| 
 | ||||
|     </android.support.design.widget.AppBarLayout> | ||||
| 
 | ||||
|     <include layout="@layout/content_activity_paihangbang" /> | ||||
| 
 | ||||
| 
 | ||||
| </android.support.design.widget.CoordinatorLayout > | ||||
|  | @ -0,0 +1,47 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||||
|     xmlns:app="http://schemas.android.com/apk/res-auto" | ||||
|     xmlns:tools="http://schemas.android.com/tools" | ||||
|     android:layout_width="match_parent" | ||||
|     android:layout_height="match_parent" | ||||
|     android:fitsSystemWindows="true" | ||||
|     tools:context=".ScrollingActivity"> | ||||
| 
 | ||||
|     <android.support.design.widget.AppBarLayout | ||||
|         android:id="@+id/app_bar" | ||||
|         android:layout_width="match_parent" | ||||
|         android:layout_height="@dimen/app_bar_height" | ||||
|         android:fitsSystemWindows="true" | ||||
|         android:theme="@style/ToolBarTheme.AppBarOverlay"> | ||||
|         <android.support.v7.widget.Toolbar | ||||
|             android:id="@+id/toolbar" | ||||
|             android:layout_width="match_parent" | ||||
|             android:layout_height="?attr/actionBarSize" | ||||
|             app:layout_collapseMode="pin" | ||||
|             app:popupTheme="@style/ToolBarTheme.PopupOverlay" /> | ||||
|         <android.support.design.widget.CollapsingToolbarLayout | ||||
|             android:id="@+id/toolbar_layout" | ||||
|             android:layout_width="match_parent" | ||||
|             android:layout_height="match_parent" | ||||
|             android:fitsSystemWindows="true" | ||||
|             app:contentScrim="?attr/colorPrimary" | ||||
|             app:layout_scrollFlags="scroll|exitUntilCollapsed" | ||||
|             app:toolbarId="@+id/toolbar"> | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|         </android.support.design.widget.CollapsingToolbarLayout> | ||||
|     </android.support.design.widget.AppBarLayout> | ||||
| 
 | ||||
|     <include layout="@layout/content_scrolling" /> | ||||
| 
 | ||||
|     <android.support.design.widget.FloatingActionButton | ||||
|         android:id="@+id/fab" | ||||
|         android:layout_width="wrap_content" | ||||
|         android:layout_height="wrap_content" | ||||
|         android:layout_margin="@dimen/fab_margin" | ||||
|         app:layout_anchor="@id/app_bar" | ||||
|         app:layout_anchorGravity="bottom|end" | ||||
|         app:srcCompat="@android:drawable/ic_dialog_email" /> | ||||
| 
 | ||||
| </android.support.design.widget.CoordinatorLayout> | ||||
|  | @ -0,0 +1,10 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||||
|     android:layout_width="wrap_content" | ||||
|     android:layout_height="wrap_content" | ||||
|     android:layout_gravity="center"> | ||||
|     <TextView android:id="@+id/textTile" | ||||
|         android:layout_width="wrap_content" | ||||
|         android:layout_height="wrap_content" | ||||
|         android:text="title" /> | ||||
| </LinearLayout> | ||||
|  | @ -36,11 +36,22 @@ | |||
|                 android:popupTheme="@style/common_spinner" | ||||
|                 android:entries="@array/sex" | ||||
|                 android:layout_gravity="left|center_vertical" | ||||
|                 > | ||||
|                 android:layout_weight="0" | ||||
|                 android:visibility="gone" | ||||
|                 /> | ||||
|             <TextView | ||||
|                 android:id="@+id/toolbarTitle" | ||||
|                 android:layout_width="match_parent" | ||||
|                 android:layout_height="wrap_content" | ||||
|                 android:layout_gravity="center" | ||||
|                 android:gravity="center" | ||||
|                 android:text="我是标题" | ||||
|                 android:textSize="20sp" | ||||
|                 android:layout_weight="1" | ||||
|                 android:visibility="gone" | ||||
|                 /> | ||||
| 
 | ||||
| 
 | ||||
|             </android.support.v7.widget.AppCompatSpinner> | ||||
| 
 | ||||
| 
 | ||||
|         </android.support.v7.widget.Toolbar> | ||||
|     </android.support.design.widget.AppBarLayout> | ||||
|  |  | |||
|  | @ -0,0 +1,31 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | ||||
|     <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:layout_marginTop="?attr/actionBarSize" | ||||
|     android:orientation="vertical" | ||||
|         > | ||||
| 
 | ||||
| 
 | ||||
|         <com.flyco.tablayout.SlidingTabLayout | ||||
|             android:id="@+id/tab_layout" | ||||
|             android:layout_width="match_parent" | ||||
|             android:layout_height="40dp" | ||||
|             android:background="@color/white" | ||||
|             app:tl_indicator_color="@color/crimson" | ||||
|             app:tl_indicator_corner_radius="1.5dp" | ||||
|             app:tl_indicator_height="2dp" | ||||
|             app:tl_indicator_width="45dp" | ||||
|             app:tl_textSelectColor="@color/crimson" | ||||
|             app:tl_textUnselectColor="@color/grey" | ||||
|             app:tl_tab_space_equal ="true" | ||||
|             /> | ||||
|         <android.support.v4.view.ViewPager | ||||
|             android:id="@+id/viewpager" | ||||
|             android:layout_width="match_parent" | ||||
|             android:layout_height="match_parent"> | ||||
|         </android.support.v4.view.ViewPager> | ||||
| 
 | ||||
|     </LinearLayout> | ||||
|  | @ -0,0 +1,17 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android" | ||||
|     xmlns:app="http://schemas.android.com/apk/res-auto" | ||||
|     xmlns:tools="http://schemas.android.com/tools" | ||||
|     android:layout_width="match_parent" | ||||
|     android:layout_height="match_parent" | ||||
|     app:layout_behavior="@string/appbar_scrolling_view_behavior" | ||||
|     tools:context=".ScrollingActivity" | ||||
|     tools:showIn="@layout/activity_scrolling"> | ||||
| 
 | ||||
|     <TextView | ||||
|         android:layout_width="wrap_content" | ||||
|         android:layout_height="wrap_content" | ||||
|         android:layout_margin="@dimen/text_margin" | ||||
|         android:text="@string/large_text" /> | ||||
| 
 | ||||
| </android.support.v4.widget.NestedScrollView> | ||||
|  | @ -18,21 +18,12 @@ | |||
|         app:tl_textSelectColor="@color/crimson" | ||||
|         app:tl_textUnselectColor="@color/grey" | ||||
|         app:tl_tab_space_equal ="true" | ||||
| 
 | ||||
|         /> | ||||
|     <android.support.v4.view.ViewPager | ||||
|         android:id="@+id/viewpager" | ||||
|         android:layout_width="match_parent" | ||||
|         android:layout_height="match_parent"> | ||||
| 
 | ||||
| 
 | ||||
|         <!-- | ||||
|         <android.support.design.widget.TabLayout | ||||
|             android:id="@+id/tab_layout" | ||||
|             android:layout_width="match_parent" | ||||
|             android:layout_height="wrap_content" | ||||
|             app:tabMode="fixed"/> | ||||
| 
 | ||||
|         --> | ||||
|     </android.support.v4.view.ViewPager> | ||||
| 
 | ||||
| </LinearLayout> | ||||
|  | @ -73,6 +73,14 @@ | |||
|                     android:id="@+id/viewpager_tuijian" | ||||
|                     android:layout_width="match_parent" | ||||
|                     android:layout_height="wrap_content"></com.deiniu.zhuike.utils.MyViewPager> | ||||
|                 <LinearLayout | ||||
|                     android:id="@+id/dot_horizontal" | ||||
|                     android:layout_width="match_parent" | ||||
|                     android:layout_height="wrap_content" | ||||
|                     android:layout_gravity="bottom" | ||||
|                     android:layout_margin="3dp" | ||||
|                     android:gravity="center" | ||||
|                     android:orientation="horizontal"/> | ||||
| 
 | ||||
|                 <!-- | ||||
|                 <com.viewpagerindicator.TitlePageIndicator | ||||
|  |  | |||
|  | @ -9,6 +9,7 @@ android:gravity="center"> | |||
| 
 | ||||
| 
 | ||||
| <LinearLayout | ||||
|     android:id="@+id/llTuijian" | ||||
|     android:orientation="vertical" | ||||
|     android:layout_width="60dp" | ||||
|     android:layout_height="70dp" | ||||
|  |  | |||
|  | @ -0,0 +1,23 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||||
|     xmlns:app="http://schemas.android.com/apk/res-auto" | ||||
|     xmlns:tools="http://schemas.android.com/tools" | ||||
|     android:id="@+id/constraintLayout" | ||||
|     android:layout_width="match_parent" | ||||
|     android:layout_height="match_parent" | ||||
|     tools:context=".Main6Activity$PlaceholderFragment"> | ||||
| 
 | ||||
|     <TextView | ||||
|         android:id="@+id/section_label" | ||||
|         android:layout_width="wrap_content" | ||||
|         android:layout_height="wrap_content" | ||||
|         android:layout_marginStart="@dimen/activity_horizontal_margin" | ||||
|         android:layout_marginTop="@dimen/activity_vertical_margin" | ||||
|         android:layout_marginEnd="@dimen/activity_horizontal_margin" | ||||
|         android:layout_marginBottom="@dimen/activity_vertical_margin" | ||||
|         app:layout_constraintLeft_toLeftOf="parent" | ||||
|         app:layout_constraintTop_toTopOf="@+id/constraintLayout" | ||||
|         tools:layout_constraintLeft_creator="1" | ||||
|         tools:layout_constraintTop_creator="1" /> | ||||
| 
 | ||||
| </android.support.constraint.ConstraintLayout> | ||||
|  | @ -0,0 +1,23 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||||
|     xmlns:app="http://schemas.android.com/apk/res-auto" | ||||
|     xmlns:tools="http://schemas.android.com/tools" | ||||
|     android:id="@+id/constraintLayout" | ||||
|     android:layout_width="match_parent" | ||||
|     android:layout_height="match_parent" | ||||
|     tools:context=".Main7Activity$PlaceholderFragment"> | ||||
| 
 | ||||
|     <TextView | ||||
|         android:id="@+id/section_label" | ||||
|         android:layout_width="wrap_content" | ||||
|         android:layout_height="wrap_content" | ||||
|         android:layout_marginStart="@dimen/activity_horizontal_margin" | ||||
|         android:layout_marginTop="@dimen/activity_vertical_margin" | ||||
|         android:layout_marginEnd="@dimen/activity_horizontal_margin" | ||||
|         android:layout_marginBottom="@dimen/activity_vertical_margin" | ||||
|         app:layout_constraintLeft_toLeftOf="parent" | ||||
|         app:layout_constraintTop_toTopOf="@+id/constraintLayout" | ||||
|         tools:layout_constraintLeft_creator="1" | ||||
|         tools:layout_constraintTop_creator="1" /> | ||||
| 
 | ||||
| </android.support.constraint.ConstraintLayout> | ||||
|  | @ -0,0 +1,33 @@ | |||
| <?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:orientation="vertical"> | ||||
| <Button | ||||
|     android:layout_width="match_parent" | ||||
|     android:layout_height="wrap_content" | ||||
|     android:layout_margin="5dp" | ||||
|     android:text="1" | ||||
|     /> | ||||
|     <Button | ||||
|         android:layout_width="match_parent" | ||||
|         android:layout_height="wrap_content" | ||||
|         android:text="2" android:layout_margin="5dp" | ||||
|         /> | ||||
|     <Button | ||||
|         android:layout_width="match_parent" | ||||
|         android:layout_height="wrap_content" | ||||
|         android:text="3" android:layout_margin="5dp" | ||||
|         /> | ||||
|     <Button | ||||
|         android:layout_width="match_parent" | ||||
|         android:layout_height="wrap_content" | ||||
|         android:text="4" android:layout_margin="5dp" | ||||
|         /> | ||||
| 
 | ||||
|     <Button | ||||
|         android:layout_width="match_parent" | ||||
|         android:layout_height="wrap_content" | ||||
|         android:text="5" android:layout_margin="5dp" | ||||
|         /> | ||||
| </LinearLayout> | ||||
|  | @ -7,17 +7,17 @@ | |||
|         android:showAsAction="never" | ||||
|         android:title="@string/action_history"/>--> | ||||
|     <item | ||||
|         android:id="@+id/menu_1" | ||||
|         android:id="@+id/menuSearch" | ||||
|         android:orderInCategory="100" | ||||
|         android:title="@string/test" | ||||
|         app:actionViewClass="android.support.v7.widget.SearchView" | ||||
|         app:showAsAction="ifRoom" /> | ||||
|     <item | ||||
|     <!--item | ||||
|         android:id="@+id/menu_2" | ||||
|         android:orderInCategory="100" | ||||
|         android:title="@string/test" | ||||
|         android:title="@string/fenlei" | ||||
|         app:actionProviderClass="android.support.v7.widget.ShareActionProvider" | ||||
|         app:showAsAction="never" /> | ||||
|         app:showAsAction="never" / --> | ||||
|     <!--<item--> | ||||
|         <!--android:id="@+id/action_settings"--> | ||||
|         <!--android:orderInCategory="100"--> | ||||
|  | @ -29,25 +29,20 @@ | |||
|         <!--android:showAsAction="never"--> | ||||
|         <!--android:title="@string/action_login"/>--> | ||||
|     <item | ||||
|         android:id="@+id/menu_3" | ||||
|         android:id="@+id/menuMore" | ||||
| 
 | ||||
|         android:orderInCategory="100" | ||||
|         android:title="test" | ||||
|         app:showAsAction="never" /> | ||||
|         android:title="@string/more" | ||||
|         app:showAsAction="ifRoom" /> | ||||
|     <item | ||||
|         android:id="@+id/menuFenlei" | ||||
| 
 | ||||
|         android:orderInCategory="100" | ||||
|         android:title="@string/fenlei" | ||||
|         app:showAsAction="ifRoom" /> | ||||
|  <!--  app:actionProviderClass="android.widget.ShareActionProvider" --> | ||||
| 
 | ||||
| 
 | ||||
|     <item | ||||
|         android:id="@+id/menu_4" | ||||
|         android:orderInCategory="100" | ||||
|         android:title="@string/test" | ||||
|         app:showAsAction="never" /> | ||||
|     <item | ||||
|         android:id="@+id/menu_5" | ||||
|         android:orderInCategory="100" | ||||
|         android:title="@string/test" | ||||
|         app:showAsAction="never" /> | ||||
| 
 | ||||
|     <!-- | ||||
|         <item | ||||
|         android:id="@+id/action_navi" | ||||
|  |  | |||
|  | @ -2,8 +2,14 @@ | |||
| <menu xmlns:android="http://schemas.android.com/apk/res/android" | ||||
|     xmlns:app="http://schemas.android.com/apk/res-auto"> | ||||
|     <item | ||||
|         android:id="@+id/action_settings" | ||||
|         android:id="@+id/search" | ||||
|         android:orderInCategory="100" | ||||
|         android:title="@string/action_settings" | ||||
|         app:showAsAction="never" /> | ||||
|         android:title="@string/test" | ||||
|         app:actionViewClass="android.support.v7.widget.SearchView" | ||||
|         app:showAsAction="always" /> | ||||
|     <item | ||||
|         android:orderInCategory="100" | ||||
|         android:id="@+id/shelfTool" | ||||
|         android:title="+" | ||||
|         app:showAsAction="always" /> | ||||
| </menu> | ||||
|  |  | |||
|  | @ -2,8 +2,9 @@ | |||
| <menu xmlns:android="http://schemas.android.com/apk/res/android" | ||||
|     xmlns:app="http://schemas.android.com/apk/res-auto"> | ||||
|     <item | ||||
|         android:id="@+id/action_settings" | ||||
|         android:id="@+id/search" | ||||
|         android:orderInCategory="100" | ||||
|         android:title="@string/action_settings" | ||||
|         app:showAsAction="never" /> | ||||
|         android:title="@string/test" | ||||
|         app:actionViewClass="android.support.v7.widget.SearchView" | ||||
|         app:showAsAction="always" /> | ||||
| </menu> | ||||
|  |  | |||
|  | @ -0,0 +1,10 @@ | |||
| <menu xmlns:android="http://schemas.android.com/apk/res/android" | ||||
|     xmlns:app="http://schemas.android.com/apk/res-auto" | ||||
|     xmlns:tools="http://schemas.android.com/tools" | ||||
|     tools:context="com.deiniu.zhuike.Main6Activity"> | ||||
|     <item | ||||
|         android:id="@+id/action_settings" | ||||
|         android:orderInCategory="100" | ||||
|         android:title="@string/action_settings" | ||||
|         app:showAsAction="never" /> | ||||
| </menu> | ||||
|  | @ -0,0 +1,10 @@ | |||
| <menu xmlns:android="http://schemas.android.com/apk/res/android" | ||||
|     xmlns:app="http://schemas.android.com/apk/res-auto" | ||||
|     xmlns:tools="http://schemas.android.com/tools" | ||||
|     tools:context="com.deiniu.zhuike.Main7Activity"> | ||||
|     <item | ||||
|         android:id="@+id/action_settings" | ||||
|         android:orderInCategory="100" | ||||
|         android:title="@string/action_settings" | ||||
|         app:showAsAction="never" /> | ||||
| </menu> | ||||
|  | @ -0,0 +1,10 @@ | |||
| <menu xmlns:android="http://schemas.android.com/apk/res/android" | ||||
|     xmlns:app="http://schemas.android.com/apk/res-auto" | ||||
|     xmlns:tools="http://schemas.android.com/tools" | ||||
|     tools:context="com.deiniu.zhuike.ScrollingActivity"> | ||||
|     <item | ||||
|         android:id="@+id/action_settings" | ||||
|         android:orderInCategory="100" | ||||
|         android:title="@string/action_settings" | ||||
|         app:showAsAction="never" /> | ||||
| </menu> | ||||
|  | @ -0,0 +1,10 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <menu  xmlns:app="http://schemas.android.com/apk/res-auto" | ||||
|     xmlns:android="http://schemas.android.com/apk/res/android"> | ||||
|     <item | ||||
|         android:id="@+id/search" | ||||
|         android:orderInCategory="100" | ||||
|         android:title="@string/search" | ||||
|         app:actionViewClass="android.support.v7.widget.SearchView" | ||||
|         app:showAsAction="always" /> | ||||
| </menu> | ||||
|  | @ -0,0 +1,6 @@ | |||
| <resources> | ||||
|     <!-- Example customization of dimensions originally defined in res/values/dimens.xml | ||||
|          (such as screen margins) for screens with more than 820dp of available width. This | ||||
|          would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). --> | ||||
|     <dimen name="activity_horizontal_margin">64dp</dimen> | ||||
| </resources> | ||||
|  | @ -35,5 +35,6 @@ | |||
|     <!-- 设置 tab选择块高 --> | ||||
|     <dimen name="tabBlock_height">25dp</dimen> | ||||
|     <dimen name="text_margin">16dp</dimen> | ||||
|     <dimen name="appbar_padding_top">8dp</dimen> | ||||
| 
 | ||||
| </resources> | ||||
|  |  | |||
|  | @ -4,7 +4,7 @@ | |||
|     <string name="title_dashboard">书城</string> | ||||
|     <string name="title_notifications">排行榜</string> | ||||
|     <string name="test">test</string> | ||||
| 
 | ||||
|     <string name="search">搜索</string> | ||||
|     <!-- TODO: Remove or change this placeholder text --> | ||||
|     <string name="hello_blank_fragment">Hello blank fragment</string> | ||||
|     <string name="title_activity_main2">Main2Activity</string> | ||||
|  | @ -113,5 +113,12 @@ | |||
|     <string name="title_on_shelf">加入书架</string> | ||||
|     <string name="title_read">立即阅读</string> | ||||
|     <string name="title_download">下载序列</string> | ||||
|     <string name="title_activity_paihangbang">榜</string> | ||||
|     <string name="title_activity_main6">Main6Activity</string> | ||||
|     <string name="section_format">Hello World from section: %1$d</string> | ||||
|     <string name="title_activity_scrolling">ScrollingActivity</string> | ||||
|     <string name="title_activity_main7">Main7Activity</string> | ||||
|     <string name="fenlei">分类</string> | ||||
|     <string name="more">更多</string> | ||||
| 
 | ||||
| </resources> | ||||
|  |  | |||
|  | @ -4,15 +4,17 @@ | |||
|     <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> | ||||
|         <!-- Customize your theme here. --> | ||||
|         <item name="colorPrimary">@color/colorPrimary</item> | ||||
|         <item name="colorPrimaryDark">@color/colorPrimaryDark</item> | ||||
|         <!--item name="colorPrimaryDark">@color/colorPrimaryDark</item--> | ||||
|         <item name="colorPrimaryDark">@color/colorPrimary</item> | ||||
|         <item name="colorAccent">@color/colorAccent</item> | ||||
|     </style> | ||||
| 
 | ||||
|     <style name="ToolBarTheme" parent="Theme.AppCompat.Light.NoActionBar"> | ||||
|         <item name="colorPrimary">@color/colorPrimary</item> | ||||
|         <item name="colorPrimaryDark">@color/colorPrimaryDark</item> | ||||
|         <item name="colorPrimaryDark">@color/colorPrimary</item>  <!--colorPrimaryDark --> | ||||
|         <item name="colorAccent">@color/colorAccent</item> | ||||
| 
 | ||||
|         <item name="android:statusBarColor">@android:color/transparent</item> | ||||
|         <item name="android:windowTranslucentStatus">true</item> | ||||
|         <item name="actionOverflowMenuStyle">@style/LYJMenuStyle</item> | ||||
|     </style> | ||||
| 
 | ||||
|  |  | |||
|  | @ -0,0 +1,5 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <searchable xmlns:android="http://schemas.android.com/apk/res/android" | ||||
|     android:label="@string/app_name" | ||||
|     android:imeOptions="actionSearch" | ||||
|     android:hint="姓名" /> | ||||
		Loading…
	
		Reference in New Issue