iii

package com.exmple.jinritoutiao;

import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;

import com.exmple.apa.BaseApalistce;
import com.exmple.apa.MyFrgAdapter;

import com.exmple.frage.Fragment_1;
import com.exmple.frage.Fragment_2;
import com.exmple.help.MyHelp;
import com.exmple.jinritoutiao.R;
import com.exmple.listvo.ListVo;

import com.slidingmenu.lib.SlidingMenu;

import Night1.Night;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.support.v4.view.ViewPager;
import android.support.v4.view.ViewPager.OnPageChangeListener;

import android.view.View;
import android.view.View.OnClickListener;

import android.view.WindowManager;

import android.widget.HorizontalScrollView;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;

import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.database.sqlite.SQLiteDatabase;
import android.graphics.Color;

public class FuctionActivity extends FragmentActivity implements
OnClickListener {

/** 自定义HorizontalScrollView */
private HorizontalScrollView scvi;
LinearLayout line;
LinearLayout ll_more_columns;
RelativeLayout rl_column;

private ViewPager mViewPager;
private ImageView button_more_columns;
/** 新闻分类列表 */
/** 当前选中的栏目 */
int wit;
private List<TextView> tv_list;
private List<Fragment> listf;
public static boolean blFlag = false;
// 侧滑左侧的图片
int[] imageview = new int[] { R.drawable.dynamicicon_leftdrawer,
R.drawable.topicicon_leftdrawer,
R.drawable.ic_action_favor_on_pressed,
R.drawable.activityicon_leftdrawer,

R.drawable.sellicon_leftdrawer,

R.drawable.feedbackicon_leftdrawer, };
// 侧滑左侧的图片
String[] name = new String[] { "好友动态", "我的话题", "收藏", "活动", "商城", "反馈" };

private String[] columnData1 = new String[] { "推荐", "视频", "社会", "娱乐", "科技",
"汽车", "体育", "军事", "美女", "趣图" };

public static String str;
public static ImageView image;
private SlidingMenu menu;
private ListView listview;
private List<ListVo> list2;
private TextView text;
public static WindowManager window;
private SharedPreferences sp;
private final static String DAY = "day";
private final static String NIGHT = "night";

private Night nig;
private Editor ed;
private SQLiteDatabase sql;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

setContentView(R.layout.activity_fuction);
MyHelp myHelp = new MyHelp(FuctionActivity.this, "navs", null, 1);
sql = myHelp.getWritableDatabase();
// private int flage = 0;
window = (WindowManager) getSystemService(Context.WINDOW_SERVICE);

// 加载布局文件
initView();
// 得到屏幕的宽度
WindowManager wm = getWindowManager();
wit = wm.getDefaultDisplay().getWidth();
// 找到图片
image = (ImageView) findViewById(R.id.top_head);
// 侧滑的方法
getSlidemenu();
listview = (ListView) findViewById(R.id.listview);
getImage();
getfra();
// horscoiview的配置
tv_list = new ArrayList<TextView>();
for (int i = 0; i < columnData1.length; i++) {

TextView text = new TextView(FuctionActivity.this);
text.setPadding(20, 10, 20, 10);
text.setText(columnData1[i]);
line.addView(text);
tv_list.add(text);
text.setTag(i);
text.setOnClickListener(this);
sql.execSQL("insert into nav values (?,?)", new String[] { null,
columnData1[i] });
}

BaseApalistce ba = new BaseApalistce(FuctionActivity.this, list2);
listview.setAdapter(ba);

FragmentManager fm = getSupportFragmentManager();
mViewPager.setAdapter(new MyFrgAdapter(fm, listf));
mViewPager.setCurrentItem(0);
setQTextColor(0);
mViewPager.setOnPageChangeListener(new OnPageChangeListener() {

@Override
public void onPageSelected(int arg0) {
setQTextColor(arg0);

}

@Override
public void onPageScrolled(int arg0, float arg1, int arg2) {
// TODO Auto-generated method stub

}

@Override
public void onPageScrollStateChanged(int arg0) {
// TODO Auto-generated method stub

}
});

}

private void getSlidemenu() {
menu = new SlidingMenu(FuctionActivity.this);

menu.setMode(SlidingMenu.LEFT);

/* menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN); */
// menu.setTouchModeAbove(SlidingMenu.SLIDING_WINDOW);
menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_MARGIN);
// 设置策划的宽度
menu.setShadowWidth(200);
menu.setBehindOffset(150);

// 绑定Activity
menu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT);
menu.setFadeDegree(0.35f);
menu.setMenu(R.layout.cehua);

ImageView setting = (ImageView) findViewById(R.id.setting);
ImageView night = (ImageView) findViewById(R.id.night);
text = (TextView) findViewById(R.id.day);
// 白天,黑夜的切换
sp = this.getSharedPreferences("skinchange", Context.MODE_PRIVATE);
String mode = sp.getString("skin", "");
nig = new Night(window, FuctionActivity.this);
if (mode != null || !mode.equals("")) {
if (mode.equals(NIGHT)) {
nig.night();
} else {
nig.day();
}
}
// 创建商品对象
SharedPreferences sha1 = getSharedPreferences("num", MODE_APPEND);
ed = sha1.edit();

night.setOnClickListener(new OnClickListener() {

@Override
public void onClick(View v) {
SharedPreferences sha2 = getSharedPreferences("num",
MODE_APPEND);
int flage = sha2.getInt("aa", 0);
if (flage % 2 == 0) {
nig.night();
text.setText("白天模式");
text.setTextColor(Color.WHITE);
flage++;
} else {
nig.day();
text.setText("夜间模式");
text.setTextColor(Color.BLACK);
flage++;
}
ed.putInt("aa", flage);
ed.commit();
}

});

ImageView qq = (ImageView) findViewById(R.id.qq);
ImageView webo = (ImageView) findViewById(R.id.webo);
TextView login = (TextView) findViewById(R.id.login);
ImageView down = (ImageView) findViewById(R.id.down);
down.setOnClickListener(new OnClickListener() {

@Override
public void onClick(View v) {

Intent ints = new Intent(FuctionActivity.this,
DownActivity.class);
startActivityForResult(ints, 11);
overridePendingTransition(R.anim.slide_right, R.anim.slide_left);
}
});
login.setOnClickListener(new OnClickListener() {

@Override
public void onClick(View v) {
Intent ints = new Intent(FuctionActivity.this,
LoginMoreActivity.class);
startActivityForResult(ints, 2);
overridePendingTransition(R.anim.slide_right, R.anim.slide_left);

}
});
webo.setOnClickListener(new OnClickListener() {

@Override
public void onClick(View v) {
ThridLogin.getViBo(FuctionActivity.this);

}
});
qq.setOnClickListener(new OnClickListener() {

@Override
public void onClick(View v) {
ThridLogin.getThrid(FuctionActivity.this);

}
});

setting.setOnClickListener(new OnClickListener() {

@Override
public void onClick(View v) {
Intent ints = new Intent(FuctionActivity.this,
SettingActivity.class);
startActivityForResult(ints, 1);
overridePendingTransition(R.anim.slide_right, R.anim.slide_left);

}
});
image.setOnClickListener(new OnClickListener() {

public void onClick(View v) {

if (menu.isMenuShowing() == false) {
menu.showMenu(true);
} else {
menu.showMenu(false);
}
}
});

}

/*
* public void night4(View view) { SharedPreferences preferences =
* getSharedPreferences("default_night", MODE_PRIVATE); Editor editor =
* preferences.edit(); if (blFlag) {
* this.setTheme(R.style.BrowserThemeNight); blFlag = false;
* editor.putBoolean("default_night", false); } else {
* this.setTheme(R.style.BrowserThemeDefault); blFlag = true;
* editor.putBoolean("default_night", true);
*
* } // 提交修改 editor.commit();
* this.setContentView(R.layout.activity_fuction); }
*/
// 为侧滑左侧配置数据
private List<ListVo> getImage() {

list2 = new ArrayList<ListVo>();
for (int i = 0; i < imageview.length; i++) {
ListVo li = new ListVo();
li.setImageview(imageview[i]);
li.setText(name[i]);

list2.add(li);

}
return list2;
}

// 为fragemetn配置数据
private List<Fragment> getfra() {

listf = new ArrayList<Fragment>();
for (int i = 0; i < columnData1.length; i++) {
Fragment_2 f2 = new Fragment_2();
// bundle传值
Bundle bundle = new Bundle();
bundle.putString("text", columnData1[i]);

/* Fragment_1 f1 = new Fragment_1(url[i]); */

f2.setArguments(bundle);

listf.add(f2);

}
return listf;
}

private void setQTextColor(int p) {

TextView textView = tv_list.get(p);
for (int i = 0; i < tv_list.size(); i++) {

TextView text = tv_list.get(p);
int k = text.getMeasuredWidth();
int l = text.getLeft();

int s = k / 2 + l - wit / 2;
scvi.smoothScrollTo(s, 0);

TextView t = tv_list.get(i);
if (!t.equals(textView)) {
t.setTextColor(Color.BLACK);

} else {
t.setTextColor(Color.RED);
}
}
}

private void initView() {

// 找控件
scvi = (HorizontalScrollView) findViewById(R.id.mColumnHorizontalScrollView);
// HorizontalScrollView里的线性
line = (LinearLayout) findViewById(R.id.mRadioGroup_content);
ll_more_columns = (LinearLayout) findViewById(R.id.ll_more_columns);
rl_column = (RelativeLayout) findViewById(R.id.rl_column);
button_more_columns = (ImageView) findViewById(R.id.button_more_columns);
mViewPager = (ViewPager) findViewById(R.id.mViewPager);

button_more_columns.setOnClickListener(new OnClickListener() {

@Override
public void onClick(View v) {
Toast.makeText(FuctionActivity.this, "我是添加频道的", 0).show();

}
});

}

@Override
public void onClick(View v) {

int i = (Integer) v.getTag();
/* System.out.println(columnData[i]); */

for (int j = 0; j < tv_list.size(); j++) {

/*
* Toast.makeText(FuctionActivity.this, (CharSequence)
* tv_list.get(j), 0).show();
*/
mViewPager.setCurrentItem(i);

}

}

}

时间: 2024-10-03 04:52:31

iii的相关文章

HDU2122 Ice_cream’s world III【Kruskal】

Ice_cream's world III Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 997    Accepted Submission(s): 321 Problem Description ice_cream's world becomes stronger and stronger; every road is built

矩阵经典题目七:Warcraft III 守望者的烦恼(矩阵加速递推)

https://www.vijos.org/p/1067 很容易推出递推式f[n] = f[n-1]+f[n-2]+......+f[n-k]. 构造矩阵的方法:构造一个k*k的矩阵,其中右上角的(k-1)*(k-1)的矩阵是单位矩阵,第k行的每个数分别对应f[n-1],f[n-2],,f[n-k]的系数.然后构造一个k*1的矩阵,它的第i行代表f[i],是经过直接递推得到的.设ans[][]是第一个矩阵的n-k次幂乘上第二个矩阵,f[n]就是ans[k][1]. 注意:用__int64 #in

260. Single Number III

260. Single Number III DescriptionHintsSubmissionsDiscussSolution DiscussPick One Given an array of numbers nums, in which exactly two elements appear only once and all the other elements appear exactly twice. Find the two elements that appear only o

[LeetCode][Java]Contains Duplicate III

Contains Duplicate III Given an array of integers, find out whether there are two distinct indices i and j in the array such that the difference between nums[i] and nums[j] is at most t and the difference between i and j is at most k. 数组中是否存在两个元素,他们的

leetcode Single Number III

题目连接 https://leetcode.com/problems/single-number-iii/ Single Number III Description Given an array of numbers nums, in which exactly two elements appear only once and all the other elements appear exactly twice. Find the two elements that appear only

Marshal&#39;s Confusion III(快速幂)

Marshal's Confusion III Time Limit: 3000 MS Memory Limit: 65536 K Total Submit: 236(62 users) Total Accepted: 74(51 users) Rating: Special Judge: No Description Marshallike to solve acm problems.But they are very busy, one day they meet a problem. Gi

Light oj 1138 - Trailing Zeroes (III) 【二分查找 &amp;&amp; N!中末尾连续0的个数】

1138 - Trailing Zeroes (III) PDF (English) Statistics Forum Time Limit: 2 second(s) Memory Limit: 32 MB You task is to find minimal natural number N, so that N! contains exactly Q zeroes on the trail in decimal notation. As you know N! = 1*2*...*N. F

LightOJ Trailing Zeroes (III) 1138【二分搜索+阶乘分解】

1138 - Trailing Zeroes (III) PDF (English) Statistics Forum Time Limit: 2 second(s) Memory Limit: 32 MB You task is to find minimal natural number N, so that N! contains exactly Q zeroes on the trail in decimal notation. As you know N! = 1*2*...*N. F

hdoj 2122 Ice_cream’s world III 【最小生成树】

Ice_cream's world III Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1254    Accepted Submission(s): 414 Problem Description ice_cream's world becomes stronger and stronger; every road is buil

python爬虫Pragmatic系列III

python爬虫Pragmatic系列III 说明: 在上一篇博客中,我们已经学会了从赶集网上的一家公司中提取出有关的信息,并存储到Excel中. 本次目标: 在本节中,我们将批量下载赶集首页上所有的公司界面(注意不是赶集网上所有的公司页面,我们可以把这个留给之后的任务),并批量的处理所有公司的有关信息,并保存到Excel中. 注意: 在上一篇博客中,我们使用的只是匹配赶集网上其中一家公司界面的中信息,而且不幸的是,很多的其他的公司的联系店主模块中的信息数量并不是固定的,即有的是10个li,而有